@byteplus/rtc 4.49.0 → 4.49.2
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/extension-ainr/index.js +1 -0
- package/extension-ainr/index.umd.js +1 -0
- package/extension-beauty/index.js +1 -0
- package/extension-beauty/index.umd.js +1 -0
- package/index.d.ts +0 -6
- package/index.esm.min.js +2 -2
- package/index.min.js +2 -2
- package/package.json +7 -2
package/index.min.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Copyright (c) 2020 The BytePlusRTC project authors. All Rights Reserved.
|
|
3
3
|
* @brief BytePlusRTC Advance API
|
|
4
|
-
* version: 4.49.
|
|
4
|
+
* version: 4.49.2
|
|
5
5
|
*/
|
|
6
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).BytePlusRTC=t()}(this,(function(){"use strict";function e(e,t){return t.forEach((function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach((function(r){if("default"!==r&&!(r in e)){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})}}))})),Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}function t(e){var t,n,i,o=2;for("undefined"!=typeof Symbol&&(n=Symbol.asyncIterator,i=Symbol.iterator);o--;){if(n&&null!=(t=e[n]))return t.call(e);if(i&&null!=(t=e[i]))return new r(t.call(e));n="@@asyncIterator",i="@@iterator"}throw new TypeError("Object is not async iterable")}function r(e){function t(e){if(Object(e)!==e)return Promise.reject(new TypeError(e+" is not an object."));var t=e.done;return Promise.resolve(e.value).then((function(e){return{value:e,done:t}}))}return(r=function(e){this.s=e,this.n=e.next}).prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments))},return:function(e){var r=this.s.return;return void 0===r?Promise.resolve({value:e,done:!0}):t(r.apply(this.s,arguments))},throw:function(e){var r=this.s.return;return void 0===r?Promise.reject(e):t(r.apply(this.s,arguments))}},new r(e)}function n(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?n(Object(r),!0).forEach((function(t){h(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function o(){o=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=Object.defineProperty||function(e,t,r){e[t]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function u(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(C){u=function(e,t,r){return e[t]=r}}function d(e,t,r,i){var o=t&&t.prototype instanceof f?t:f,a=Object.create(o.prototype),s=new A(i||[]);return n(a,"_invoke",{value:E(e,r,s)}),a}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(C){return{type:"throw",arg:C}}}e.wrap=d;var h={};function f(){}function p(){}function v(){}var _={};u(_,a,(function(){return this}));var m=Object.getPrototypeOf,y=m&&m(m(R([])));y&&y!==t&&r.call(y,a)&&(_=y);var g=v.prototype=f.prototype=Object.create(_);function S(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function b(e,t){function i(n,o,a,s){var c=l(e[n],e,o);if("throw"!==c.type){var u=c.arg,d=u.value;return d&&"object"==typeof d&&r.call(d,"__await")?t.resolve(d.__await).then((function(e){i("next",e,a,s)}),(function(e){i("throw",e,a,s)})):t.resolve(d).then((function(e){u.value=e,a(u)}),(function(e){return i("throw",e,a,s)}))}s(c.arg)}var o;n(this,"_invoke",{value:function(e,r){function n(){return new t((function(t,n){i(e,r,t,n)}))}return o=o?o.then(n,n):n()}})}function E(e,t,r){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return{value:void 0,done:!0}}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var s=k(a,r);if(s){if(s===h)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=l(e,t,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===h)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}function k(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,k(e,t),"throw"===t.method))return h;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var n=l(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,h;var i=n.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,h):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,h)}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 I(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function A(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(T,this),this.reset(!0)}function R(e){if(e){var t=e[a];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:w}}function w(){return{value:void 0,done:!0}}return p.prototype=v,n(g,"constructor",{value:v,configurable:!0}),n(v,"constructor",{value:p,configurable:!0}),p.displayName=u(v,c,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===p||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,u(e,c,"GeneratorFunction")),e.prototype=Object.create(g),e},e.awrap=function(e){return{__await:e}},S(b.prototype),u(b.prototype,s,(function(){return this})),e.AsyncIterator=b,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var a=new b(d(t,r,n,i),o);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},S(g),u(g,c,"Generator"),u(g,a,(function(){return this})),u(g,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},e.values=R,A.prototype={constructor:A,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(I),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return a.type="throw",a.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var s=r.call(o,"catchLoc"),c=r.call(o,"finallyLoc");if(s&&c){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,h):this.complete(a)},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),h},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),I(r),h}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;I(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:R(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},e}function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function s(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(u){return void r(u)}s.done?t(c):Promise.resolve(c).then(n,i)}function c(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){s(o,n,i,a,c,"next",e)}function c(e){s(o,n,i,a,c,"throw",e)}a(void 0)}))}}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function d(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function l(e,t,r){return t&&d(e.prototype,t),r&&d(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function h(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function f(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&v(e,t)}function p(e){return(p=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function v(e,t){return(v=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function _(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function m(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function y(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return m(e)}function g(e){var t=function(){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}}();return function(){var r,n=p(e);if(t){var i=p(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return y(this,r)}}function S(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=p(e)););return e}function b(){return b="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=S(e,t);if(n){var i=Object.getOwnPropertyDescriptor(n,t);return i.get?i.get.call(arguments.length<3?e:r):i.value}},b.apply(this,arguments)}function E(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var n,i,o=[],a=!0,s=!1;try{for(r=r.call(e);!(a=(n=r.next()).done)&&(o.push(n.value),!t||o.length!==t);a=!0);}catch(c){s=!0,i=c}finally{try{a||null==r.return||r.return()}finally{if(s)throw i}}return o}(e,t)||T(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 k(e){return function(e){if(Array.isArray(e))return I(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||T(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 T(e,t){if(e){if("string"==typeof e)return I(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?I(e,t):void 0}}function I(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function A(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=T(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},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 o,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}var R=function(e){return e[e.VIDEO_SOURCE_TYPE_EXTERNAL=0]="VIDEO_SOURCE_TYPE_EXTERNAL",e[e.VIDEO_SOURCE_TYPE_INTERNAL=1]="VIDEO_SOURCE_TYPE_INTERNAL",e}(R||{}),w=function(e){return e[e.AUDIO_SOURCE_TYPE_EXTERNAL=0]="AUDIO_SOURCE_TYPE_EXTERNAL",e[e.AUDIO_SOURCE_TYPE_INTERNAL=1]="AUDIO_SOURCE_TYPE_INTERNAL",e}(w||{}),C=function(e){return e[e.QUIT=0]="QUIT",e[e.DROPPED=1]="DROPPED",e[e.SWITCH_TO_INVISIBLE=2]="SWITCH_TO_INVISIBLE",e[e.KICKED_BY_ADMIN=3]="KICKED_BY_ADMIN",e}(C||{}),O=function(e){return e[e.CHANNEL_PROFILE_COMMUNICATION=0]="CHANNEL_PROFILE_COMMUNICATION",e[e.CHANNEL_PROFILE_LIVE_BROADCASTING=1]="CHANNEL_PROFILE_LIVE_BROADCASTING",e}(O||{}),x=function(e){return e[e.AUTO_SUBSCRIBE_MODE=0]="AUTO_SUBSCRIBE_MODE",e[e.MANUAL_SUBSCRIBE_MODE=1]="MANUAL_SUBSCRIBE_MODE",e}(x||{}),D=function(e){return e[e.SUBSCRIBE_SUCC=0]="SUBSCRIBE_SUCC",e[e.SUBSCRIBE_FAIL=1]="SUBSCRIBE_FAIL",e}(D||{}),N=function(e){return e[e.PUBLISH_SUCC=0]="PUBLISH_SUCC",e[e.PUBLISH_FAIL=1]="PUBLISH_FAIL",e}(N||{}),P=function(e){return e[e.MIRROR_MODE_OFF=0]="MIRROR_MODE_OFF",e[e.MIRROR_MODE_ON=1]="MIRROR_MODE_ON",e}(P||{}),M=function(e){return e[e.RENDER_MODE_HIDDEN=0]="RENDER_MODE_HIDDEN",e[e.RENDER_MODE_FIT=1]="RENDER_MODE_FIT",e}(M||{}),L=function(e){return e[e.STREAM_INDEX_MAIN=0]="STREAM_INDEX_MAIN",e[e.STREAM_INDEX_SCREEN=1]="STREAM_INDEX_SCREEN",e}(L||{}),U=function(e){return e[e.AUDIO=1]="AUDIO",e[e.VIDEO=2]="VIDEO",e[e.AUDIO_AND_VIDEO=3]="AUDIO_AND_VIDEO",e}(U||{}),V=function(e){return e[e.STREAM_REMOVE_REASON_UNPUBLISH=0]="STREAM_REMOVE_REASON_UNPUBLISH",e[e.STREAM_REMOVE_REASON_PUBLISH_FAILED=1]="STREAM_REMOVE_REASON_PUBLISH_FAILED",e[e.STREAM_REMOVE_REASON_KEEP_LIVE_FAILED=2]="STREAM_REMOVE_REASON_KEEP_LIVE_FAILED",e[e.STREAM_REMOVE_REASON_CLIENT_DISCONNECTED=3]="STREAM_REMOVE_REASON_CLIENT_DISCONNECTED",e[e.STREAM_REMOVE_REASON_REPUBLISH=4]="STREAM_REMOVE_REASON_REPUBLISH",e[e.STREAM_REMOVE_REASON_OTHER=5]="STREAM_REMOVE_REASON_OTHER",e}(V||{}),F=function(e){return e[e.CONNECTION_START=0]="CONNECTION_START",e[e.CONNECTION_STATE_DISCONNECTED=1]="CONNECTION_STATE_DISCONNECTED",e[e.CONNECTION_STATE_CONNECTING=2]="CONNECTION_STATE_CONNECTING",e[e.CONNECTION_STATE_CONNECTED=3]="CONNECTION_STATE_CONNECTED",e[e.CONNECTION_STATE_RECONNECTING=4]="CONNECTION_STATE_RECONNECTING",e[e.CONNECTION_STATE_RECONNECTED=5]="CONNECTION_STATE_RECONNECTED",e[e.CONNECTION_STATE_LOST=6]="CONNECTION_STATE_LOST",e}(F||{}),B=function(e){return e[e.MIRROR_TYPE_NONE=0]="MIRROR_TYPE_NONE",e[e.MIRROR_TYPE_RENDER=1]="MIRROR_TYPE_RENDER",e}(B||{}),j=function(e){return e[e.domestic=0]="domestic",e[e.overseas=1]="overseas",e}(j||{}),G=function(e){return e[e.OFFLINE=0]="OFFLINE",e[e.ONLINE=1]="ONLINE",e[e.UNREACHABLE=2]="UNREACHABLE",e}(G||{}),H=function(e){return e[e.AUDIO_AND_VIDEO=0]="AUDIO_AND_VIDEO",e[e.AUDIO_ONLY=1]="AUDIO_ONLY",e[e.VIDEO_ONLY=2]="VIDEO_ONLY",e}(H||{}),z=function(e){return e[e.PREV_FRAME=0]="PREV_FRAME",e[e.OTHER_FRAME=1]="OTHER_FRAME",e}(z||{}),X=function(e){return e[e.DISABLE=0]="DISABLE",e[e.VIDEO_STREAM_LOW=1]="VIDEO_STREAM_LOW",e[e.AUDIO_ONLY=2]="AUDIO_ONLY",e}(X||{}),K=function(e){return e[e.LOW=0]="LOW",e[e.MEDIUM=100]="MEDIUM",e[e.HIGH=200]="HIGH",e}(K||{}),q=function(e){return e[e.UNKNOWN=0]="UNKNOWN",e[e.EXCELLENT=1]="EXCELLENT",e[e.GOOD=2]="GOOD",e[e.POOR=3]="POOR",e[e.BAD=4]="BAD",e[e.VBAD=5]="VBAD",e}(q||{}),W=function(e){return e[e.Unknown=-1]="Unknown",e[e.SubscribeFallbackByBandwidth=0]="SubscribeFallbackByBandwidth",e[e.SubscribeRecoverByBandwidth=2]="SubscribeRecoverByBandwidth",e}(W||{}),Y=function(e){return e[e.communication=0]="communication",e[e.chat=5]="chat",e[e.chatRoom=6]="chatRoom",e[e.coHost=9]="coHost",e[e.meeting=16]="meeting",e[e.classRoom=18]="classRoom",e}(Y||{}),J=function(e){return e[e.default=0]="default",e[e.fluent=1]="fluent",e[e.standard=2]="standard",e[e.hd=3]="hd",e[e.standardStereo=4]="standardStereo",e[e.hdMono=5]="hdMono",e}(J||{}),Q=function(e){return e[e.AUTO_PLAY=0]="AUTO_PLAY",e[e.VIDEO_ONLY=1]="VIDEO_ONLY",e[e.PLAY_MANUALLY=2]="PLAY_MANUALLY",e}(Q||{}),Z=function(e){return e.LC="LC",e.HEv1="HEv1",e.HEv2="HEv2",e}(Z||{}),$=function(e){return e.H264="H264",e.H265="H265",e}($||{}),ee=Object.freeze(Object.defineProperty({__proto__:null,VideoSourceType:R,AudioSourceType:w,UserOfflineReason:C,ChannelProfile:O,SubscribeMode:x,SubscribeState:D,PublishState:N,MirrorMode:P,VideoRenderMode:M,StreamIndex:L,MediaType:U,StreamRemoveReason:V,ConnectionState:F,MirrorType:B,LogChannel:j,USER_ONLINE_STATUS:G,PublicStreamType:H,PublicInterpolationMode:z,SubscribeFallbackOption:X,RemoteUserPriority:K,NetworkQuality:q,FallbackOrRecoverReason:W,RoomProfileType:Y,AudioProfileType:J,RTCAutoPlayPolicy:Q,AAC_PROFILE:Z,TRANSCODING_VIDEO_CODEC:$},Symbol.toStringTag,{value:"Module"})),te=function(e){return e[e.AUTO=0]="AUTO",e[e.MODE_L=1]="MODE_L",e[e.MODE_R=2]="MODE_R",e[e.MODE_MIX=3]="MODE_MIX",e}(te||{}),re=function(e){return e[e.PLAYOUT=0]="PLAYOUT",e[e.PUBLISH=1]="PUBLISH",e[e.PLAYOUT_AND_PUBLISH=2]="PLAYOUT_AND_PUBLISH",e}(re||{}),ne=function(e){return e[e.AUDIO_MIXING_STATE_PRELOADED=0]="AUDIO_MIXING_STATE_PRELOADED",e[e.AUDIO_MIXING_STATE_PLAYING=1]="AUDIO_MIXING_STATE_PLAYING",e[e.AUDIO_MIXING_STATE_PAUSED=2]="AUDIO_MIXING_STATE_PAUSED",e[e.AUDIO_MIXING_STATE_STOPPED=3]="AUDIO_MIXING_STATE_STOPPED",e[e.AUDIO_MIXING_STATE_FAILED=4]="AUDIO_MIXING_STATE_FAILED",e[e.AUDIO_MIXING_STATE_FINISHED=5]="AUDIO_MIXING_STATE_FINISHED",e[e.AUDIO_MIXING_STATE_PCM_ENABLED=6]="AUDIO_MIXING_STATE_PCM_ENABLED",e[e.AUDIO_MIXING_STATE_PCM_DISABLED=7]="AUDIO_MIXING_STATE_PCM_DISABLED",e}(ne||{}),ie=Object.freeze(Object.defineProperty({__proto__:null,AudioMixingDualMonoMode:te,AudioMixingType:re,AudioMixingState:ne},Symbol.toStringTag,{value:"Module"})),oe=function(e){return e.onTrackEnded="onTrackEnded",e.onPlayerEvent="onPlayerEvent",e.onAutoplayFailed="onAutoplayFailed",e.onUserJoined="onUserJoined",e.onUserLeave="onUserLeave",e.onConnectionStateChanged="onConnectionStateChanged",e.onUserPublishStream="onUserPublishStream",e.onUserUnpublishStream="onUserUnpublishStream",e.onUserPublishScreen="onUserPublishScreen",e.onUserUnpublishScreen="onUserUnpublishScreen",e.onRoomMessageReceived="onRoomMessageReceived",e.onRoomBinaryMessageReceived="onRoomBinaryMessageReceived",e.onUserMessageReceived="onUserMessageReceived",e.onUserBinaryMessageReceived="onUserBinaryMessageReceived",e.onVideoFirstFrameRendered="onVideoFirstFrameRendered",e.onVideoFirstFrameDecoded="onVideoFirstFrameDecoded",e.onRemoteVideoFirstFrame="onRemoteVideoFirstFrame",e.onAudioFirstFrameDecoded="onAudioFirstFrameDecoded",e.onRemoteAudioFirstFrame="onRemoteAudioFirstFrame",e.onFirstPublicStreamVideoFrameRendered="onFirstPublicStreamVideoFrameRendered",e.onFirstPublicStreamVideoFrameDecoded="onFirstPublicStreamVideoFrameDecoded",e.onFirstPublicStreamAudioFrameDecoded="onFirstPublicStreamAudioFrameDecoded",e.onVideoDeviceStateChanged="onVideoDeviceStateChanged",e.onAudioDeviceStateChanged="onAudioDeviceStateChanged",e.onRemoteStreamStats="onRemoteStreamStats",e.onPublicStreamStats="onPublicStreamStats",e.onLocalStreamStats="onLocalStreamStats",e.onAudioVolumeIndication="onAudioVolumeIndication",e.onLocalAudioPropertiesReport="onLocalAudioPropertiesReport",e.onRemoteAudioPropertiesReport="onRemoteAudioPropertiesReport",e.onActiveSpeaker="onActiveSpeaker",e.onAudioPlaybackDeviceChanged="onAudioPlaybackDeviceChanged",e.onUserStartVideoCapture="onUserStartVideoCapture",e.onUserStopVideoCapture="onUserStopVideoCapture",e.onUserStartAudioCapture="onUserStartAudioCapture",e.onUserStopAudioCapture="onUserStopAudioCapture",e.onAutoPublishResult="onAutoPublishResult",e.onAutoSubscribeResult="onAutoSubscribeResult",e.onLiveTranscodingResult="onLiveTranscodingResult",e.onStreamMixingEvent="onStreamMixingEvent",e.onAudioPlaybackDeviceTestVolume="onAudioPlaybackDeviceTestVolume",e.onSEIMessageReceived="onSEIMessageReceived",e.onError="onError",e.onAudioMixingStateChanged="onAudioMixingStateChanged",e.onUserMessageReceivedOutsideRoom="onUserMessageReceivedOutsideRoom",e.onUserBinaryMessageReceivedOutsideRoom="onUserBinaryMessageReceivedOutsideRoom",e.onTokenWillExpire="onTokenWillExpire",e.onCloudProxyConnected="onCloudProxyConnected",e.onPushPublicStreamResult="onPushPublicStreamResult",e.onPublicStreamSEIMessageReceived="onPublicStreamSEIMessageReceived",e.onNetworkQuality="onNetworkQuality",e.onSimulcastSubscribeFallback="onSimulcastSubscribeFallback",e.onRemoteVideoSizeChanged="onRemoteVideoSizeChanged",e.onVideoStreamBanned="onVideoStreamBanned",e.onAudioStreamBanned="onAudioStreamBanned",e.onLocalVideoSizeChanged="onLocalVideoSizeChanged",e.onServerParamsSetResult="onServerParamsSetResult",e}(oe||{}),ae="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},se=function(e){return e&&e.Math==Math&&e},ce=se("object"==typeof globalThis&&globalThis)||se("object"==typeof window&&window)||se("object"==typeof self&&self)||se("object"==typeof ae&&ae)||function(){return this}()||Function("return this")(),ue={},de=function(e){try{return!!e()}catch(t){return!0}},le=!de((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),he=!de((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),fe=he,pe=Function.prototype.call,ve=fe?pe.bind(pe):function(){return pe.apply(pe,arguments)},_e={},me={}.propertyIsEnumerable,ye=Object.getOwnPropertyDescriptor,ge=ye&&!me.call({1:2},1);_e.f=ge?function(e){var t=ye(this,e);return!!t&&t.enumerable}:me;var Se,be,Ee=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},ke=he,Te=Function.prototype,Ie=Te.call,Ae=ke&&Te.bind.bind(Ie,Ie),Re=ke?Ae:function(e){return function(){return Ie.apply(e,arguments)}},we=Re,Ce=we({}.toString),Oe=we("".slice),xe=function(e){return Oe(Ce(e),8,-1)},De=de,Ne=xe,Pe=Object,Me=Re("".split),Le=De((function(){return!Pe("z").propertyIsEnumerable(0)}))?function(e){return"String"==Ne(e)?Me(e,""):Pe(e)}:Pe,Ue=function(e){return null==e},Ve=Ue,Fe=TypeError,Be=function(e){if(Ve(e))throw Fe("Can't call method on "+e);return e},je=Le,Ge=Be,He=function(e){return je(Ge(e))},ze="object"==typeof document&&document.all,Xe={all:ze,IS_HTMLDDA:void 0===ze&&void 0!==ze},Ke=Xe.all,qe=Xe.IS_HTMLDDA?function(e){return"function"==typeof e||e===Ke}:function(e){return"function"==typeof e},We=qe,Ye=Xe.all,Je=Xe.IS_HTMLDDA?function(e){return"object"==typeof e?null!==e:We(e)||e===Ye}:function(e){return"object"==typeof e?null!==e:We(e)},Qe=ce,Ze=qe,$e=function(e){return Ze(e)?e:void 0},et=function(e,t){return arguments.length<2?$e(Qe[e]):Qe[e]&&Qe[e][t]},tt=Re({}.isPrototypeOf),rt=et("navigator","userAgent")||"",nt=ce,it=rt,ot=nt.process,at=nt.Deno,st=ot&&ot.versions||at&&at.version,ct=st&&st.v8;ct&&(be=(Se=ct.split("."))[0]>0&&Se[0]<4?1:+(Se[0]+Se[1])),!be&&it&&(!(Se=it.match(/Edge\/(\d+)/))||Se[1]>=74)&&(Se=it.match(/Chrome\/(\d+)/))&&(be=+Se[1]);var ut=be,dt=ut,lt=de,ht=!!Object.getOwnPropertySymbols&&!lt((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&dt&&dt<41})),ft=ht&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,pt=et,vt=qe,_t=tt,mt=Object,yt=ft?function(e){return"symbol"==typeof e}:function(e){var t=pt("Symbol");return vt(t)&&_t(t.prototype,mt(e))},gt=String,St=function(e){try{return gt(e)}catch(t){return"Object"}},bt=qe,Et=St,kt=TypeError,Tt=function(e){if(bt(e))return e;throw kt(Et(e)+" is not a function")},It=Tt,At=Ue,Rt=function(e,t){var r=e[t];return At(r)?void 0:It(r)},wt=ve,Ct=qe,Ot=Je,xt=TypeError,Dt={exports:{}},Nt=ce,Pt=Object.defineProperty,Mt=function(e,t){try{Pt(Nt,e,{value:t,configurable:!0,writable:!0})}catch(r){Nt[e]=t}return t},Lt=Mt,Ut="__core-js_shared__",Vt=ce[Ut]||Lt(Ut,{}),Ft=Vt;(Dt.exports=function(e,t){return Ft[e]||(Ft[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.26.1",mode:"global",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.26.1/LICENSE",source:"https://github.com/zloirock/core-js"});var Bt=Be,jt=Object,Gt=function(e){return jt(Bt(e))},Ht=Gt,zt=Re({}.hasOwnProperty),Xt=Object.hasOwn||function(e,t){return zt(Ht(e),t)},Kt=Re,qt=0,Wt=Math.random(),Yt=Kt(1..toString),Jt=function(e){return"Symbol("+(void 0===e?"":e)+")_"+Yt(++qt+Wt,36)},Qt=ce,Zt=Dt.exports,$t=Xt,er=Jt,tr=ht,rr=ft,nr=Zt("wks"),ir=Qt.Symbol,or=ir&&ir.for,ar=rr?ir:ir&&ir.withoutSetter||er,sr=function(e){if(!$t(nr,e)||!tr&&"string"!=typeof nr[e]){var t="Symbol."+e;tr&&$t(ir,e)?nr[e]=ir[e]:nr[e]=rr&&or?or(t):ar(t)}return nr[e]},cr=ve,ur=Je,dr=yt,lr=Rt,hr=function(e,t){var r,n;if("string"===t&&Ct(r=e.toString)&&!Ot(n=wt(r,e)))return n;if(Ct(r=e.valueOf)&&!Ot(n=wt(r,e)))return n;if("string"!==t&&Ct(r=e.toString)&&!Ot(n=wt(r,e)))return n;throw xt("Can't convert object to primitive value")},fr=TypeError,pr=sr("toPrimitive"),vr=function(e,t){if(!ur(e)||dr(e))return e;var r,n=lr(e,pr);if(n){if(void 0===t&&(t="default"),r=cr(n,e,t),!ur(r)||dr(r))return r;throw fr("Can't convert object to primitive value")}return void 0===t&&(t="number"),hr(e,t)},_r=vr,mr=yt,yr=function(e){var t=_r(e,"string");return mr(t)?t:t+""},gr=Je,Sr=ce.document,br=gr(Sr)&&gr(Sr.createElement),Er=function(e){return br?Sr.createElement(e):{}},kr=Er,Tr=!le&&!de((function(){return 7!=Object.defineProperty(kr("div"),"a",{get:function(){return 7}}).a})),Ir=le,Ar=ve,Rr=_e,wr=Ee,Cr=He,Or=yr,xr=Xt,Dr=Tr,Nr=Object.getOwnPropertyDescriptor;ue.f=Ir?Nr:function(e,t){if(e=Cr(e),t=Or(t),Dr)try{return Nr(e,t)}catch(r){}if(xr(e,t))return wr(!Ar(Rr.f,e,t),e[t])};var Pr={},Mr=le&&de((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Lr=Je,Ur=String,Vr=TypeError,Fr=function(e){if(Lr(e))return e;throw Vr(Ur(e)+" is not an object")},Br=le,jr=Tr,Gr=Mr,Hr=Fr,zr=yr,Xr=TypeError,Kr=Object.defineProperty,qr=Object.getOwnPropertyDescriptor,Wr="enumerable",Yr="configurable",Jr="writable";Pr.f=Br?Gr?function(e,t,r){if(Hr(e),t=zr(t),Hr(r),"function"==typeof e&&"prototype"===t&&"value"in r&&Jr in r&&!r.writable){var n=qr(e,t);n&&n.writable&&(e[t]=r.value,r={configurable:Yr in r?r.configurable:n.configurable,enumerable:Wr in r?r.enumerable:n.enumerable,writable:!1})}return Kr(e,t,r)}:Kr:function(e,t,r){if(Hr(e),t=zr(t),Hr(r),jr)try{return Kr(e,t,r)}catch(n){}if("get"in r||"set"in r)throw Xr("Accessors not supported");return"value"in r&&(e[t]=r.value),e};var Qr=Pr,Zr=Ee,$r=le?function(e,t,r){return Qr.f(e,t,Zr(1,r))}:function(e,t,r){return e[t]=r,e},en={exports:{}},tn=le,rn=Xt,nn=Function.prototype,on=tn&&Object.getOwnPropertyDescriptor,an=rn(nn,"name"),sn={EXISTS:an,PROPER:an&&"something"===function(){}.name,CONFIGURABLE:an&&(!tn||tn&&on(nn,"name").configurable)},cn=qe,un=Vt,dn=Re(Function.toString);cn(un.inspectSource)||(un.inspectSource=function(e){return dn(e)});var ln,hn,fn,pn=un.inspectSource,vn=qe,_n=ce.WeakMap,mn=vn(_n)&&/native code/.test(String(_n)),yn=Dt.exports,gn=Jt,Sn=yn("keys"),bn=function(e){return Sn[e]||(Sn[e]=gn(e))},En={},kn=mn,Tn=ce,In=Je,An=$r,Rn=Xt,wn=Vt,Cn=bn,On=En,xn="Object already initialized",Dn=Tn.TypeError,Nn=Tn.WeakMap;if(kn||wn.state){var Pn=wn.state||(wn.state=new Nn);Pn.get=Pn.get,Pn.has=Pn.has,Pn.set=Pn.set,ln=function(e,t){if(Pn.has(e))throw Dn(xn);return t.facade=e,Pn.set(e,t),t},hn=function(e){return Pn.get(e)||{}},fn=function(e){return Pn.has(e)}}else{var Mn=Cn("state");On[Mn]=!0,ln=function(e,t){if(Rn(e,Mn))throw Dn(xn);return t.facade=e,An(e,Mn,t),t},hn=function(e){return Rn(e,Mn)?e[Mn]:{}},fn=function(e){return Rn(e,Mn)}}var Ln={set:ln,get:hn,has:fn,enforce:function(e){return fn(e)?hn(e):ln(e,{})},getterFor:function(e){return function(t){var r;if(!In(t)||(r=hn(t)).type!==e)throw Dn("Incompatible receiver, "+e+" required");return r}}},Un=de,Vn=qe,Fn=Xt,Bn=le,jn=sn.CONFIGURABLE,Gn=pn,Hn=Ln.enforce,zn=Ln.get,Xn=Object.defineProperty,Kn=Bn&&!Un((function(){return 8!==Xn((function(){}),"length",{value:8}).length})),qn=String(String).split("String"),Wn=en.exports=function(e,t,r){"Symbol("===String(t).slice(0,7)&&(t="["+String(t).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),r&&r.getter&&(t="get "+t),r&&r.setter&&(t="set "+t),(!Fn(e,"name")||jn&&e.name!==t)&&(Bn?Xn(e,"name",{value:t,configurable:!0}):e.name=t),Kn&&r&&Fn(r,"arity")&&e.length!==r.arity&&Xn(e,"length",{value:r.arity});try{r&&Fn(r,"constructor")&&r.constructor?Bn&&Xn(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(i){}var n=Hn(e);return Fn(n,"source")||(n.source=qn.join("string"==typeof t?t:"")),e};Function.prototype.toString=Wn((function(){return Vn(this)&&zn(this).source||Gn(this)}),"toString");var Yn=qe,Jn=Pr,Qn=en.exports,Zn=Mt,$n=function(e,t,r,n){n||(n={});var i=n.enumerable,o=void 0!==n.name?n.name:t;if(Yn(r)&&Qn(r,o,n),n.global)i?e[t]=r:Zn(t,r);else{try{n.unsafe?e[t]&&(i=!0):delete e[t]}catch(a){}i?e[t]=r:Jn.f(e,t,{value:r,enumerable:!1,configurable:!n.nonConfigurable,writable:!n.nonWritable})}return e},ei={},ti=Math.ceil,ri=Math.floor,ni=Math.trunc||function(e){var t=+e;return(t>0?ri:ti)(t)},ii=function(e){var t=+e;return t!=t||0===t?0:ni(t)},oi=ii,ai=Math.max,si=Math.min,ci=function(e,t){var r=oi(e);return r<0?ai(r+t,0):si(r,t)},ui=ii,di=Math.min,li=function(e){return e>0?di(ui(e),9007199254740991):0},hi=li,fi=function(e){return hi(e.length)},pi=He,vi=ci,_i=fi,mi=function(e){return function(t,r,n){var i,o=pi(t),a=_i(o),s=vi(n,a);if(e&&r!=r){for(;a>s;)if((i=o[s++])!=i)return!0}else for(;a>s;s++)if((e||s in o)&&o[s]===r)return e||s||0;return!e&&-1}},yi={includes:mi(!0),indexOf:mi(!1)},gi=Xt,Si=He,bi=yi.indexOf,Ei=En,ki=Re([].push),Ti=function(e,t){var r,n=Si(e),i=0,o=[];for(r in n)!gi(Ei,r)&&gi(n,r)&&ki(o,r);for(;t.length>i;)gi(n,r=t[i++])&&(~bi(o,r)||ki(o,r));return o},Ii=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Ai=Ti,Ri=Ii.concat("length","prototype");ei.f=Object.getOwnPropertyNames||function(e){return Ai(e,Ri)};var wi={};wi.f=Object.getOwnPropertySymbols;var Ci=et,Oi=ei,xi=wi,Di=Fr,Ni=Re([].concat),Pi=Ci("Reflect","ownKeys")||function(e){var t=Oi.f(Di(e)),r=xi.f;return r?Ni(t,r(e)):t},Mi=Xt,Li=Pi,Ui=ue,Vi=Pr,Fi=function(e,t,r){for(var n=Li(t),i=Vi.f,o=Ui.f,a=0;a<n.length;a++){var s=n[a];Mi(e,s)||r&&Mi(r,s)||i(e,s,o(t,s))}},Bi=de,ji=qe,Gi=/#|\.prototype\./,Hi=function(e,t){var r=Xi[zi(e)];return r==qi||r!=Ki&&(ji(t)?Bi(t):!!t)},zi=Hi.normalize=function(e){return String(e).replace(Gi,".").toLowerCase()},Xi=Hi.data={},Ki=Hi.NATIVE="N",qi=Hi.POLYFILL="P",Wi=Hi,Yi=ce,Ji=ue.f,Qi=$r,Zi=$n,$i=Mt,eo=Fi,to=Wi,ro=function(e,t){var r,n,i,o,a,s=e.target,c=e.global,u=e.stat;if(r=c?Yi:u?Yi[s]||$i(s,{}):(Yi[s]||{}).prototype)for(n in t){if(o=t[n],i=e.dontCallGetSet?(a=Ji(r,n))&&a.value:r[n],!to(c?n:s+(u?".":"#")+n,e.forced)&&void 0!==i){if(typeof o==typeof i)continue;eo(o,i)}(e.sham||i&&i.sham)&&Qi(o,"sham",!0),Zi(r,n,o,e)}},no=xe,io=Array.isArray||function(e){return"Array"==no(e)},oo=TypeError,ao=function(e){if(e>9007199254740991)throw oo("Maximum allowed index exceeded");return e},so=yr,co=Pr,uo=Ee,lo=function(e,t,r){var n=so(t);n in e?co.f(e,n,uo(0,r)):e[n]=r},ho={};ho[sr("toStringTag")]="z";var fo="[object z]"===String(ho),po=fo,vo=qe,_o=xe,mo=sr("toStringTag"),yo=Object,go="Arguments"==_o(function(){return arguments}()),So=po?_o:function(e){var t,r,n;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=function(e,t){try{return e[t]}catch(r){}}(t=yo(e),mo))?r:go?_o(t):"Object"==(n=_o(t))&&vo(t.callee)?"Arguments":n},bo=Re,Eo=de,ko=qe,To=So,Io=pn,Ao=function(){},Ro=[],wo=et("Reflect","construct"),Co=/^\s*(?:class|function)\b/,Oo=bo(Co.exec),xo=!Co.exec(Ao),Do=function(e){if(!ko(e))return!1;try{return wo(Ao,Ro,e),!0}catch(t){return!1}},No=function(e){if(!ko(e))return!1;switch(To(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return xo||!!Oo(Co,Io(e))}catch(t){return!0}};No.sham=!0;var Po=!wo||Eo((function(){var e;return Do(Do.call)||!Do(Object)||!Do((function(){e=!0}))||e}))?No:Do,Mo=io,Lo=Po,Uo=Je,Vo=sr("species"),Fo=Array,Bo=function(e){var t;return Mo(e)&&(t=e.constructor,(Lo(t)&&(t===Fo||Mo(t.prototype))||Uo(t)&&null===(t=t[Vo]))&&(t=void 0)),void 0===t?Fo:t},jo=function(e,t){return new(Bo(e))(0===t?0:t)},Go=de,Ho=ut,zo=sr("species"),Xo=function(e){return Ho>=51||!Go((function(){var t=[];return(t.constructor={})[zo]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},Ko=ro,qo=de,Wo=io,Yo=Je,Jo=Gt,Qo=fi,Zo=ao,$o=lo,ea=jo,ta=Xo,ra=ut,na=sr("isConcatSpreadable"),ia=ra>=51||!qo((function(){var e=[];return e[na]=!1,e.concat()[0]!==e})),oa=ta("concat"),aa=function(e){if(!Yo(e))return!1;var t=e[na];return void 0!==t?!!t:Wo(e)};Ko({target:"Array",proto:!0,arity:1,forced:!ia||!oa},{concat:function(e){var t,r,n,i,o,a=Jo(this),s=ea(a,0),c=0;for(t=-1,n=arguments.length;t<n;t++)if(aa(o=-1===t?a:arguments[t]))for(i=Qo(o),Zo(c+i),r=0;r<i;r++,c++)r in o&&$o(s,c,o[r]);else Zo(c+1),$o(s,c++,o);return s.length=c,s}});var sa=So,ca=fo?{}.toString:function(){return"[object "+sa(this)+"]"};fo||$n(Object.prototype,"toString",ca,{unsafe:!0});var ua={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},da=Er("span").classList,la=da&&da.constructor&&da.constructor.prototype,ha=la===Object.prototype?void 0:la,fa=xe,pa=Re,va=function(e){if("Function"===fa(e))return pa(e)},_a=Tt,ma=he,ya=va(va.bind),ga=function(e,t){return _a(e),void 0===t?e:ma?ya(e,t):function(){return e.apply(t,arguments)}},Sa=ga,ba=Le,Ea=Gt,ka=fi,Ta=jo,Ia=Re([].push),Aa=function(e){var t=1==e,r=2==e,n=3==e,i=4==e,o=6==e,a=7==e,s=5==e||o;return function(c,u,d,l){for(var h,f,p=Ea(c),v=ba(p),_=Sa(u,d),m=ka(v),y=0,g=l||Ta,S=t?g(c,m):r||a?g(c,0):void 0;m>y;y++)if((s||y in v)&&(f=_(h=v[y],y,p),e))if(t)S[y]=f;else if(f)switch(e){case 3:return!0;case 5:return h;case 6:return y;case 2:Ia(S,h)}else switch(e){case 4:return!1;case 7:Ia(S,h)}return o?-1:n||i?i:S}},Ra={forEach:Aa(0),map:Aa(1),filter:Aa(2),some:Aa(3),every:Aa(4),find:Aa(5),findIndex:Aa(6),filterReject:Aa(7)},wa=de,Ca=function(e,t){var r=[][e];return!!r&&wa((function(){r.call(null,t||function(){return 1},1)}))},Oa=Ra.forEach,xa=Ca("forEach")?[].forEach:function(e){return Oa(this,e,arguments.length>1?arguments[1]:void 0)},Da=ce,Na=ua,Pa=ha,Ma=xa,La=$r,Ua=function(e){if(e&&e.forEach!==Ma)try{La(e,"forEach",Ma)}catch(t){e.forEach=Ma}};for(var Va in Na)Na[Va]&&Ua(Da[Va]&&Da[Va].prototype);Ua(Pa);var Fa={},Ba=Ti,ja=Ii,Ga=Object.keys||function(e){return Ba(e,ja)},Ha=le,za=Mr,Xa=Pr,Ka=Fr,qa=He,Wa=Ga;Fa.f=Ha&&!za?Object.defineProperties:function(e,t){Ka(e);for(var r,n=qa(t),i=Wa(t),o=i.length,a=0;o>a;)Xa.f(e,r=i[a++],n[r]);return e};var Ya,Ja=et("document","documentElement"),Qa=Fr,Za=Fa,$a=Ii,es=En,ts=Ja,rs=Er,ns=bn("IE_PROTO"),is=function(){},os=function(e){return"<script>"+e+"</"+"script>"},as=function(e){e.write(os("")),e.close();var t=e.parentWindow.Object;return e=null,t},ss=function(){try{Ya=new ActiveXObject("htmlfile")}catch(n){}var e,t;ss="undefined"!=typeof document?document.domain&&Ya?as(Ya):((t=rs("iframe")).style.display="none",ts.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(os("document.F=Object")),e.close(),e.F):as(Ya);for(var r=$a.length;r--;)delete ss.prototype[$a[r]];return ss()};es[ns]=!0;var cs=Object.create||function(e,t){var r;return null!==e?(is.prototype=Qa(e),r=new is,is.prototype=null,r[ns]=e):r=ss(),void 0===t?r:Za.f(r,t)},us=sr,ds=cs,ls=Pr.f,hs=us("unscopables"),fs=Array.prototype;null==fs[hs]&&ls(fs,hs,{configurable:!0,value:ds(null)});var ps=function(e){fs[hs][e]=!0},vs=yi.includes,_s=ps;ro({target:"Array",proto:!0,forced:de((function(){return!Array(1).includes()}))},{includes:function(e){return vs(this,e,arguments.length>1?arguments[1]:void 0)}}),_s("includes");var ms=Je,ys=xe,gs=sr("match"),Ss=function(e){var t;return ms(e)&&(void 0!==(t=e[gs])?!!t:"RegExp"==ys(e))},bs=Ss,Es=TypeError,ks=function(e){if(bs(e))throw Es("The method doesn't accept regular expressions");return e},Ts=So,Is=String,As=function(e){if("Symbol"===Ts(e))throw TypeError("Cannot convert a Symbol value to a string");return Is(e)},Rs=sr("match"),ws=function(e){var t=/./;try{"/./"[e](t)}catch(r){try{return t[Rs]=!1,"/./"[e](t)}catch(n){}}return!1},Cs=ro,Os=ks,xs=Be,Ds=As,Ns=ws,Ps=Re("".indexOf);Cs({target:"String",proto:!0,forced:!Ns("includes")},{includes:function(e){return!!~Ps(Ds(xs(this)),Ds(Os(e)),arguments.length>1?arguments[1]:void 0)}});var Ms,Ls,Us=Fr,Vs=function(){var e=Us(this),t="";return e.hasIndices&&(t+="d"),e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.unicodeSets&&(t+="v"),e.sticky&&(t+="y"),t},Fs=de,Bs=ce.RegExp,js=Fs((function(){var e=Bs("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),Gs=js||Fs((function(){return!Bs("a","y").sticky})),Hs=js||Fs((function(){var e=Bs("^r","gy");return e.lastIndex=2,null!=e.exec("str")})),zs={BROKEN_CARET:Hs,MISSED_STICKY:Gs,UNSUPPORTED_Y:js},Xs=de,Ks=ce.RegExp,qs=Xs((function(){var e=Ks(".","s");return!(e.dotAll&&e.exec("\n")&&"s"===e.flags)})),Ws=de,Ys=ce.RegExp,Js=Ws((function(){var e=Ys("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")})),Qs=ve,Zs=Re,$s=As,ec=Vs,tc=zs,rc=Dt.exports,nc=cs,ic=Ln.get,oc=qs,ac=Js,sc=rc("native-string-replace",String.prototype.replace),cc=RegExp.prototype.exec,uc=cc,dc=Zs("".charAt),lc=Zs("".indexOf),hc=Zs("".replace),fc=Zs("".slice),pc=(Ls=/b*/g,Qs(cc,Ms=/a/,"a"),Qs(cc,Ls,"a"),0!==Ms.lastIndex||0!==Ls.lastIndex),vc=tc.BROKEN_CARET,_c=void 0!==/()??/.exec("")[1];(pc||_c||vc||oc||ac)&&(uc=function(e){var t,r,n,i,o,a,s,c=this,u=ic(c),d=$s(e),l=u.raw;if(l)return l.lastIndex=c.lastIndex,t=Qs(uc,l,d),c.lastIndex=l.lastIndex,t;var h=u.groups,f=vc&&c.sticky,p=Qs(ec,c),v=c.source,_=0,m=d;if(f&&(p=hc(p,"y",""),-1===lc(p,"g")&&(p+="g"),m=fc(d,c.lastIndex),c.lastIndex>0&&(!c.multiline||c.multiline&&"\n"!==dc(d,c.lastIndex-1))&&(v="(?: "+v+")",m=" "+m,_++),r=new RegExp("^(?:"+v+")",p)),_c&&(r=new RegExp("^"+v+"$(?!\\s)",p)),pc&&(n=c.lastIndex),i=Qs(cc,f?r:c,m),f?i?(i.input=fc(i.input,_),i[0]=fc(i[0],_),i.index=c.lastIndex,c.lastIndex+=i[0].length):c.lastIndex=0:pc&&i&&(c.lastIndex=c.global?i.index+i[0].length:n),_c&&i&&i.length>1&&Qs(sc,i[0],r,(function(){for(o=1;o<arguments.length-2;o++)void 0===arguments[o]&&(i[o]=void 0)})),i&&h)for(i.groups=a=nc(null),o=0;o<h.length;o++)a[(s=h[o])[0]]=i[s[1]];return i});var mc=uc;ro({target:"RegExp",proto:!0,forced:/./.exec!==mc},{exec:mc});var yc=va,gc=$n,Sc=mc,bc=de,Ec=sr,kc=$r,Tc=Ec("species"),Ic=RegExp.prototype,Ac=function(e,t,r,n){var i=Ec(e),o=!bc((function(){var t={};return t[i]=function(){return 7},7!=""[e](t)})),a=o&&!bc((function(){var t=!1,r=/a/;return"split"===e&&((r={}).constructor={},r.constructor[Tc]=function(){return r},r.flags="",r[i]=/./[i]),r.exec=function(){return t=!0,null},r[i](""),!t}));if(!o||!a||r){var s=yc(/./[i]),c=t(i,""[e],(function(e,t,r,n,i){var a=yc(e),c=t.exec;return c===Sc||c===Ic.exec?o&&!i?{done:!0,value:s(t,r,n)}:{done:!0,value:a(r,t,n)}:{done:!1}}));gc(String.prototype,e,c[0]),gc(Ic,i,c[1])}n&&kc(Ic[i],"sham",!0)},Rc=Object.is||function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t},wc=ve,Cc=Fr,Oc=qe,xc=xe,Dc=mc,Nc=TypeError,Pc=function(e,t){var r=e.exec;if(Oc(r)){var n=wc(r,e,t);return null!==n&&Cc(n),n}if("RegExp"===xc(e))return wc(Dc,e,t);throw Nc("RegExp#exec called on incompatible receiver")},Mc=ve,Lc=Fr,Uc=Ue,Vc=Be,Fc=Rc,Bc=As,jc=Rt,Gc=Pc;Ac("search",(function(e,t,r){return[function(t){var r=Vc(this),n=Uc(t)?void 0:jc(t,e);return n?Mc(n,t,r):new RegExp(t)[e](Bc(r))},function(e){var n=Lc(this),i=Bc(e),o=r(t,n,i);if(o.done)return o.value;var a=n.lastIndex;Fc(a,0)||(n.lastIndex=0);var s=Gc(n,i);return Fc(n.lastIndex,a)||(n.lastIndex=a),null===s?-1:s.index}]}));var Hc=Re,zc=ii,Xc=As,Kc=Be,qc=Hc("".charAt),Wc=Hc("".charCodeAt),Yc=Hc("".slice),Jc=function(e){return function(t,r){var n,i,o=Xc(Kc(t)),a=zc(r),s=o.length;return a<0||a>=s?e?"":void 0:(n=Wc(o,a))<55296||n>56319||a+1===s||(i=Wc(o,a+1))<56320||i>57343?e?qc(o,a):n:e?Yc(o,a,a+2):i-56320+(n-55296<<10)+65536}},Qc={codeAt:Jc(!1),charAt:Jc(!0)},Zc=Qc.charAt,$c=function(e,t,r){return t+(r?Zc(e,t).length:1)},eu=ve,tu=Fr,ru=Ue,nu=li,iu=As,ou=Be,au=Rt,su=$c,cu=Pc;Ac("match",(function(e,t,r){return[function(t){var r=ou(this),n=ru(t)?void 0:au(t,e);return n?eu(n,t,r):new RegExp(t)[e](iu(r))},function(e){var n=tu(this),i=iu(e),o=r(t,n,i);if(o.done)return o.value;if(!n.global)return cu(n,i);var a=n.unicode;n.lastIndex=0;for(var s,c=[],u=0;null!==(s=cu(n,i));){var d=iu(s[0]);c[u]=d,""===d&&(n.lastIndex=su(i,nu(n.lastIndex),a)),u++}return 0===u?null:c}]}));var uu="\t\n\v\f\r \u2028\u2029\ufeff",du=Be,lu=As,hu=Re("".replace),fu="[\t\n\v\f\r \u2028\u2029\ufeff]",pu=RegExp("^"+fu+fu+"*"),vu=RegExp(fu+fu+"*$"),_u=function(e){return function(t){var r=lu(du(t));return 1&e&&(r=hu(r,pu,"")),2&e&&(r=hu(r,vu,"")),r}},mu={start:_u(1),end:_u(2),trim:_u(3)},yu=ce,gu=de,Su=Re,bu=As,Eu=mu.trim,ku=uu,Tu=yu.parseInt,Iu=yu.Symbol,Au=Iu&&Iu.iterator,Ru=/^[+-]?0x/i,wu=Su(Ru.exec),Cu=8!==Tu(ku+"08")||22!==Tu(ku+"0x16")||Au&&!gu((function(){Tu(Object(Au))}))?function(e,t){var r=Eu(bu(e));return Tu(r,t>>>0||(wu(Ru,r)?16:10))}:Tu;ro({global:!0,forced:parseInt!=Cu},{parseInt:Cu});var Ou,xu,Du,Nu={},Pu=!de((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),Mu=Xt,Lu=qe,Uu=Gt,Vu=Pu,Fu=bn("IE_PROTO"),Bu=Object,ju=Bu.prototype,Gu=Vu?Bu.getPrototypeOf:function(e){var t=Uu(e);if(Mu(t,Fu))return t[Fu];var r=t.constructor;return Lu(r)&&t instanceof r?r.prototype:t instanceof Bu?ju:null},Hu=de,zu=qe,Xu=Je,Ku=Gu,qu=$n,Wu=sr("iterator"),Yu=!1;[].keys&&("next"in(Du=[].keys())?(xu=Ku(Ku(Du)))!==Object.prototype&&(Ou=xu):Yu=!0),(!Xu(Ou)||Hu((function(){var e={};return Ou[Wu].call(e)!==e})))&&(Ou={}),zu(Ou[Wu])||qu(Ou,Wu,(function(){return this}));var Ju={IteratorPrototype:Ou,BUGGY_SAFARI_ITERATORS:Yu},Qu=Pr.f,Zu=Xt,$u=sr("toStringTag"),ed=function(e,t,r){e&&!r&&(e=e.prototype),e&&!Zu(e,$u)&&Qu(e,$u,{configurable:!0,value:t})},td=Ju.IteratorPrototype,rd=cs,nd=Ee,id=ed,od=Nu,ad=function(){return this},sd=function(e,t,r,n){var i=t+" Iterator";return e.prototype=rd(td,{next:nd(+!n,r)}),id(e,i,!1),od[i]=ad,e},cd=qe,ud=String,dd=TypeError,ld=Re,hd=Fr,fd=function(e){if("object"==typeof e||cd(e))return e;throw dd("Can't set "+ud(e)+" as a prototype")},pd=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=ld(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(r,[]),t=r instanceof Array}catch(n){}return function(r,n){return hd(r),fd(n),t?e(r,n):r.__proto__=n,r}}():void 0),vd=ro,_d=ve,md=qe,yd=sd,gd=Gu,Sd=pd,bd=ed,Ed=$r,kd=$n,Td=Nu,Id=sn.PROPER,Ad=sn.CONFIGURABLE,Rd=Ju.IteratorPrototype,wd=Ju.BUGGY_SAFARI_ITERATORS,Cd=sr("iterator"),Od="keys",xd="values",Dd="entries",Nd=function(){return this},Pd=function(e,t,r,n,i,o,a){yd(r,t,n);var s,c,u,d=function(e){if(e===i&&v)return v;if(!wd&&e in f)return f[e];switch(e){case Od:case xd:case Dd:return function(){return new r(this,e)}}return function(){return new r(this)}},l=t+" Iterator",h=!1,f=e.prototype,p=f[Cd]||f["@@iterator"]||i&&f[i],v=!wd&&p||d(i),_="Array"==t&&f.entries||p;if(_&&(s=gd(_.call(new e)))!==Object.prototype&&s.next&&(gd(s)!==Rd&&(Sd?Sd(s,Rd):md(s[Cd])||kd(s,Cd,Nd)),bd(s,l,!0)),Id&&i==xd&&p&&p.name!==xd&&(Ad?Ed(f,"name",xd):(h=!0,v=function(){return _d(p,this)})),i)if(c={values:d(xd),keys:o?v:d(Od),entries:d(Dd)},a)for(u in c)(wd||h||!(u in f))&&kd(f,u,c[u]);else vd({target:t,proto:!0,forced:wd||h},c);return f[Cd]!==v&&kd(f,Cd,v,{name:i}),Td[t]=v,c},Md=function(e,t){return{value:e,done:t}},Ld=He,Ud=ps,Vd=Nu,Fd=Ln,Bd=Pr.f,jd=Pd,Gd=Md,Hd=le,zd="Array Iterator",Xd=Fd.set,Kd=Fd.getterFor(zd),qd=jd(Array,"Array",(function(e,t){Xd(this,{type:zd,target:Ld(e),index:0,kind:t})}),(function(){var e=Kd(this),t=e.target,r=e.kind,n=e.index++;return!t||n>=t.length?(e.target=void 0,Gd(void 0,!0)):Gd("keys"==r?n:"values"==r?t[n]:[n,t[n]],!1)}),"values"),Wd=Vd.Arguments=Vd.Array;if(Ud("keys"),Ud("values"),Ud("entries"),Hd&&"values"!==Wd.name)try{Bd(Wd,"name",{value:"values"})}catch(T0){}var Yd={exports:{}},Jd={},Qd=ci,Zd=fi,$d=lo,el=Array,tl=Math.max,rl=function(e,t,r){for(var n=Zd(e),i=Qd(t,n),o=Qd(void 0===r?n:r,n),a=el(tl(o-i,0)),s=0;i<o;i++,s++)$d(a,s,e[i]);return a.length=s,a},nl=xe,il=He,ol=ei.f,al=rl,sl="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];Jd.f=function(e){return sl&&"Window"==nl(e)?function(e){try{return ol(e)}catch(T0){return al(sl)}}(e):ol(il(e))};var cl=de((function(){if("function"==typeof ArrayBuffer){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}})),ul=de,dl=Je,ll=xe,hl=cl,fl=Object.isExtensible,pl=ul((function(){fl(1)}))||hl?function(e){return!!dl(e)&&((!hl||"ArrayBuffer"!=ll(e))&&(!fl||fl(e)))}:fl,vl=!de((function(){return Object.isExtensible(Object.preventExtensions({}))})),_l=ro,ml=Re,yl=En,gl=Je,Sl=Xt,bl=Pr.f,El=ei,kl=Jd,Tl=pl,Il=vl,Al=!1,Rl=Jt("meta"),wl=0,Cl=function(e){bl(e,Rl,{value:{objectID:"O"+wl++,weakData:{}}})},Ol=Yd.exports={enable:function(){Ol.enable=function(){},Al=!0;var e=El.f,t=ml([].splice),r={};r[Rl]=1,e(r).length&&(El.f=function(r){for(var n=e(r),i=0,o=n.length;i<o;i++)if(n[i]===Rl){t(n,i,1);break}return n},_l({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:kl.f}))},fastKey:function(e,t){if(!gl(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!Sl(e,Rl)){if(!Tl(e))return"F";if(!t)return"E";Cl(e)}return e[Rl].objectID},getWeakData:function(e,t){if(!Sl(e,Rl)){if(!Tl(e))return!0;if(!t)return!1;Cl(e)}return e[Rl].weakData},onFreeze:function(e){return Il&&Al&&Tl(e)&&!Sl(e,Rl)&&Cl(e),e}};yl[Rl]=!0;var xl=Nu,Dl=sr("iterator"),Nl=Array.prototype,Pl=function(e){return void 0!==e&&(xl.Array===e||Nl[Dl]===e)},Ml=So,Ll=Rt,Ul=Ue,Vl=Nu,Fl=sr("iterator"),Bl=function(e){if(!Ul(e))return Ll(e,Fl)||Ll(e,"@@iterator")||Vl[Ml(e)]},jl=ve,Gl=Tt,Hl=Fr,zl=St,Xl=Bl,Kl=TypeError,ql=function(e,t){var r=arguments.length<2?Xl(e):t;if(Gl(r))return Hl(jl(r,e));throw Kl(zl(e)+" is not iterable")},Wl=ve,Yl=Fr,Jl=Rt,Ql=function(e,t,r){var n,i;Yl(e);try{if(!(n=Jl(e,"return"))){if("throw"===t)throw r;return r}n=Wl(n,e)}catch(T0){i=!0,n=T0}if("throw"===t)throw r;if(i)throw n;return Yl(n),r},Zl=ga,$l=ve,eh=Fr,th=St,rh=Pl,nh=fi,ih=tt,oh=ql,ah=Bl,sh=Ql,ch=TypeError,uh=function(e,t){this.stopped=e,this.result=t},dh=uh.prototype,lh=function(e,t,r){var n,i,o,a,s,c,u,d=r&&r.that,l=!(!r||!r.AS_ENTRIES),h=!(!r||!r.IS_RECORD),f=!(!r||!r.IS_ITERATOR),p=!(!r||!r.INTERRUPTED),v=Zl(t,d),_=function(e){return n&&sh(n,"normal",e),new uh(!0,e)},m=function(e){return l?(eh(e),p?v(e[0],e[1],_):v(e[0],e[1])):p?v(e,_):v(e)};if(h)n=e.iterator;else if(f)n=e;else{if(!(i=ah(e)))throw ch(th(e)+" is not iterable");if(rh(i)){for(o=0,a=nh(e);a>o;o++)if((s=m(e[o]))&&ih(dh,s))return s;return new uh(!1)}n=oh(e,i)}for(c=h?e.next:n.next;!(u=$l(c,n)).done;){try{s=m(u.value)}catch(T0){sh(n,"throw",T0)}if("object"==typeof s&&s&&ih(dh,s))return s}return new uh(!1)},hh=tt,fh=TypeError,ph=function(e,t){if(hh(t,e))return e;throw fh("Incorrect invocation")},vh=sr("iterator"),_h=!1;try{var mh=0,yh={next:function(){return{done:!!mh++}},return:function(){_h=!0}};yh[vh]=function(){return this},Array.from(yh,(function(){throw 2}))}catch(T0){}var gh=function(e,t){if(!t&&!_h)return!1;var r=!1;try{var n={};n[vh]=function(){return{next:function(){return{done:r=!0}}}},e(n)}catch(T0){}return r},Sh=qe,bh=Je,Eh=pd,kh=function(e,t,r){var n,i;return Eh&&Sh(n=t.constructor)&&n!==r&&bh(i=n.prototype)&&i!==r.prototype&&Eh(e,i),e},Th=ro,Ih=ce,Ah=Re,Rh=Wi,wh=$n,Ch=Yd.exports,Oh=lh,xh=ph,Dh=qe,Nh=Ue,Ph=Je,Mh=de,Lh=gh,Uh=ed,Vh=kh,Fh=function(e,t,r){var n=-1!==e.indexOf("Map"),i=-1!==e.indexOf("Weak"),o=n?"set":"add",a=Ih[e],s=a&&a.prototype,c=a,u={},d=function(e){var t=Ah(s[e]);wh(s,e,"add"==e?function(e){return t(this,0===e?0:e),this}:"delete"==e?function(e){return!(i&&!Ph(e))&&t(this,0===e?0:e)}:"get"==e?function(e){return i&&!Ph(e)?void 0:t(this,0===e?0:e)}:"has"==e?function(e){return!(i&&!Ph(e))&&t(this,0===e?0:e)}:function(e,r){return t(this,0===e?0:e,r),this})};if(Rh(e,!Dh(a)||!(i||s.forEach&&!Mh((function(){(new a).entries().next()})))))c=r.getConstructor(t,e,n,o),Ch.enable();else if(Rh(e,!0)){var l=new c,h=l[o](i?{}:-0,1)!=l,f=Mh((function(){l.has(1)})),p=Lh((function(e){new a(e)})),v=!i&&Mh((function(){for(var e=new a,t=5;t--;)e[o](t,t);return!e.has(-0)}));p||((c=t((function(e,t){xh(e,s);var r=Vh(new a,e,c);return Nh(t)||Oh(t,r[o],{that:r,AS_ENTRIES:n}),r}))).prototype=s,s.constructor=c),(f||v)&&(d("delete"),d("has"),n&&d("get")),(v||h)&&d(o),i&&s.clear&&delete s.clear}return u[e]=c,Th({global:!0,constructor:!0,forced:c!=a},u),Uh(c,e),i||r.setStrong(c,e,n),c},Bh=$n,jh=function(e,t,r){for(var n in t)Bh(e,n,t[n],r);return e},Gh=et,Hh=Pr,zh=le,Xh=sr("species"),Kh=function(e){var t=Gh(e),r=Hh.f;zh&&t&&!t[Xh]&&r(t,Xh,{configurable:!0,get:function(){return this}})},qh=Pr.f,Wh=cs,Yh=jh,Jh=ga,Qh=ph,Zh=Ue,$h=lh,ef=Pd,tf=Md,rf=Kh,nf=le,of=Yd.exports.fastKey,af=Ln.set,sf=Ln.getterFor,cf={getConstructor:function(e,t,r,n){var i=e((function(e,i){Qh(e,o),af(e,{type:t,index:Wh(null),first:void 0,last:void 0,size:0}),nf||(e.size=0),Zh(i)||$h(i,e[n],{that:e,AS_ENTRIES:r})})),o=i.prototype,a=sf(t),s=function(e,t,r){var n,i,o=a(e),s=c(e,t);return s?s.value=r:(o.last=s={index:i=of(t,!0),key:t,value:r,previous:n=o.last,next:void 0,removed:!1},o.first||(o.first=s),n&&(n.next=s),nf?o.size++:e.size++,"F"!==i&&(o.index[i]=s)),e},c=function(e,t){var r,n=a(e),i=of(t);if("F"!==i)return n.index[i];for(r=n.first;r;r=r.next)if(r.key==t)return r};return Yh(o,{clear:function(){for(var e=a(this),t=e.index,r=e.first;r;)r.removed=!0,r.previous&&(r.previous=r.previous.next=void 0),delete t[r.index],r=r.next;e.first=e.last=void 0,nf?e.size=0:this.size=0},delete:function(e){var t=this,r=a(t),n=c(t,e);if(n){var i=n.next,o=n.previous;delete r.index[n.index],n.removed=!0,o&&(o.next=i),i&&(i.previous=o),r.first==n&&(r.first=i),r.last==n&&(r.last=o),nf?r.size--:t.size--}return!!n},forEach:function(e){for(var t,r=a(this),n=Jh(e,arguments.length>1?arguments[1]:void 0);t=t?t.next:r.first;)for(n(t.value,t.key,this);t&&t.removed;)t=t.previous},has:function(e){return!!c(this,e)}}),Yh(o,r?{get:function(e){var t=c(this,e);return t&&t.value},set:function(e,t){return s(this,0===e?0:e,t)}}:{add:function(e){return s(this,e=0===e?0:e,e)}}),nf&&qh(o,"size",{get:function(){return a(this).size}}),i},setStrong:function(e,t,r){var n=t+" Iterator",i=sf(t),o=sf(n);ef(e,t,(function(e,t){af(this,{type:n,target:e,state:i(e),kind:t,last:void 0})}),(function(){for(var e=o(this),t=e.kind,r=e.last;r&&r.removed;)r=r.previous;return e.target&&(e.last=r=r?r.next:e.state.first)?tf("keys"==t?r.key:"values"==t?r.value:[r.key,r.value],!1):(e.target=void 0,tf(void 0,!0))}),r?"entries":"values",!r,!0),rf(t)}};Fh("Map",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),cf);var uf=Qc.charAt,df=As,lf=Ln,hf=Pd,ff=Md,pf="String Iterator",vf=lf.set,_f=lf.getterFor(pf);hf(String,"String",(function(e){vf(this,{type:pf,string:df(e),index:0})}),(function(){var e,t=_f(this),r=t.string,n=t.index;return n>=r.length?ff(void 0,!0):(e=uf(r,n),t.index+=e.length,ff(e,!1))}));var mf=ce,yf=ua,gf=ha,Sf=qd,bf=$r,Ef=sr,kf=Ef("iterator"),Tf=Ef("toStringTag"),If=Sf.values,Af=function(e,t){if(e){if(e[kf]!==If)try{bf(e,kf,If)}catch(T0){e[kf]=If}if(e[Tf]||bf(e,Tf,t),yf[t])for(var r in Sf)if(e[r]!==Sf[r])try{bf(e,r,Sf[r])}catch(T0){e[r]=Sf[r]}}};for(var Rf in yf)Af(mf[Rf]&&mf[Rf].prototype,Rf);Af(gf,"DOMTokenList");var wf=Gt,Cf=Ga;ro({target:"Object",stat:!0,forced:de((function(){Cf(1)}))},{keys:function(e){return Cf(wf(e))}});var Of=ro,xf=le,Df=Pr.f;Of({target:"Object",stat:!0,forced:Object.defineProperty!==Df,sham:!xf},{defineProperty:Df});var Nf=he,Pf=Function.prototype,Mf=Pf.apply,Lf=Pf.call,Uf="object"==typeof Reflect&&Reflect.apply||(Nf?Lf.bind(Mf):function(){return Lf.apply(Mf,arguments)}),Vf=Pr.f,Ff=function(e,t,r){r in e||Vf(e,r,{configurable:!0,get:function(){return t[r]},set:function(e){t[r]=e}})},Bf=As,jf=function(e,t){return void 0===e?arguments.length<2?"":t:Bf(e)},Gf=Je,Hf=$r,zf=Error,Xf=Re("".replace),Kf=String(zf("zxcasd").stack),qf=/\n\s*at [^:]*:[^\n]*/,Wf=qf.test(Kf),Yf=function(e,t){if(Wf&&"string"==typeof e&&!zf.prepareStackTrace)for(;t--;)e=Xf(e,qf,"");return e},Jf=Ee,Qf=!de((function(){var e=Error("a");return!("stack"in e)||(Object.defineProperty(e,"stack",Jf(1,7)),7!==e.stack)})),Zf=et,$f=Xt,ep=$r,tp=tt,rp=pd,np=Fi,ip=Ff,op=kh,ap=jf,sp=function(e,t){Gf(t)&&"cause"in t&&Hf(e,"cause",t.cause)},cp=Yf,up=Qf,dp=le,lp=ro,hp=Uf,fp=function(e,t,r,n){var i="stackTraceLimit",o=n?2:1,a=e.split("."),s=a[a.length-1],c=Zf.apply(null,a);if(c){var u=c.prototype;if($f(u,"cause")&&delete u.cause,!r)return c;var d=Zf("Error"),l=t((function(e,t){var r=ap(n?t:e,void 0),i=n?new c(e):new c;return void 0!==r&&ep(i,"message",r),up&&ep(i,"stack",cp(i.stack,2)),this&&tp(u,this)&&op(i,this,l),arguments.length>o&&sp(i,arguments[o]),i}));l.prototype=u,"Error"!==s?rp?rp(l,d):np(l,d,{name:!0}):dp&&i in c&&(ip(l,c,i),ip(l,c,"prepareStackTrace")),np(l,c);try{u.name!==s&&ep(u,"name",s),u.constructor=l}catch(T0){}return l}},pp="WebAssembly",vp=ce.WebAssembly,_p=7!==Error("e",{cause:7}).cause,mp=function(e,t){var r={};r[e]=fp(e,t,_p),lp({global:!0,constructor:!0,arity:1,forced:_p},r)},yp=function(e,t){if(vp&&vp[e]){var r={};r[e]=fp("WebAssembly."+e,t,_p),lp({target:pp,stat:!0,constructor:!0,arity:1,forced:_p},r)}};mp("Error",(function(e){return function(t){return hp(e,this,arguments)}})),mp("EvalError",(function(e){return function(t){return hp(e,this,arguments)}})),mp("RangeError",(function(e){return function(t){return hp(e,this,arguments)}})),mp("ReferenceError",(function(e){return function(t){return hp(e,this,arguments)}})),mp("SyntaxError",(function(e){return function(t){return hp(e,this,arguments)}})),mp("TypeError",(function(e){return function(t){return hp(e,this,arguments)}})),mp("URIError",(function(e){return function(t){return hp(e,this,arguments)}})),yp("CompileError",(function(e){return function(t){return hp(e,this,arguments)}})),yp("LinkError",(function(e){return function(t){return hp(e,this,arguments)}})),yp("RuntimeError",(function(e){return function(t){return hp(e,this,arguments)}}));var gp=Tt,Sp=Gt,bp=Le,Ep=fi,kp=TypeError,Tp=function(e){return function(t,r,n,i){gp(r);var o=Sp(t),a=bp(o),s=Ep(o),c=e?s-1:0,u=e?-1:1;if(n<2)for(;;){if(c in a){i=a[c],c+=u;break}if(c+=u,e?c<0:s<=c)throw kp("Reduce of empty array with no initial value")}for(;e?c>=0:s>c;c+=u)c in a&&(i=r(i,a[c],c,o));return i}},Ip={left:Tp(!1),right:Tp(!0)},Ap="process"==xe(ce.process),Rp=Ip.left,wp=ut,Cp=Ap;ro({target:"Array",proto:!0,forced:!Ca("reduce")||!Cp&&wp>79&&wp<83},{reduce:function(e){var t=arguments.length;return Rp(this,e,t,t>1?arguments[1]:void 0)}});var Op=le,xp=Re,Dp=ve,Np=de,Pp=Ga,Mp=wi,Lp=_e,Up=Gt,Vp=Le,Fp=Object.assign,Bp=Object.defineProperty,jp=xp([].concat),Gp=!Fp||Np((function(){if(Op&&1!==Fp({b:1},Fp(Bp({},"a",{enumerable:!0,get:function(){Bp(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},r=Symbol(),n="abcdefghijklmnopqrst";return e[r]=7,n.split("").forEach((function(e){t[e]=e})),7!=Fp({},e)[r]||Pp(Fp({},t)).join("")!=n}))?function(e,t){for(var r=Up(e),n=arguments.length,i=1,o=Mp.f,a=Lp.f;n>i;)for(var s,c=Vp(arguments[i++]),u=o?jp(Pp(c),o(c)):Pp(c),d=u.length,l=0;d>l;)s=u[l++],Op&&!Dp(a,c,s)||(r[s]=c[s]);return r}:Fp,Hp=Gp;ro({target:"Object",stat:!0,arity:2,forced:Object.assign!==Hp},{assign:Hp});var zp,Xp=ro,Kp=va,qp=ue.f,Wp=li,Yp=As,Jp=ks,Qp=Be,Zp=ws,$p=Kp("".endsWith),ev=Kp("".slice),tv=Math.min,rv=Zp("endsWith");Xp({target:"String",proto:!0,forced:!!(rv||(zp=qp(String.prototype,"endsWith"),!zp||zp.writable))&&!rv},{endsWith:function(e){var t=Yp(Qp(this));Jp(e);var r=arguments.length>1?arguments[1]:void 0,n=t.length,i=void 0===r?n:tv(Wp(r),n),o=Yp(e);return $p?$p(t,o,i):ev(t,i-o.length,i)===o}});var nv=le,iv=io,ov=TypeError,av=Object.getOwnPropertyDescriptor,sv=nv&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(T0){return T0 instanceof TypeError}}()?function(e,t){if(iv(e)&&!av(e,"length").writable)throw ov("Cannot set read only .length");return e.length=t}:function(e,t){return e.length=t},cv=ro,uv=Gt,dv=fi,lv=sv,hv=ao,fv=de((function(){return 4294967297!==[].push.call({length:4294967296},1)})),pv=!function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(T0){return T0 instanceof TypeError}}();cv({target:"Array",proto:!0,arity:1,forced:fv||pv},{push:function(e){var t=uv(this),r=dv(t),n=arguments.length;hv(r+n);for(var i=0;i<n;i++)t[r]=arguments[i],r++;return lv(t,r),r}});var vv=!0,_v=!0;function mv(e,t,r){var n=e.match(t);return n&&n.length>=r&&parseInt(n[r],10)}function yv(e,t,r){if(e.RTCPeerConnection){var n=e.RTCPeerConnection.prototype,i=n.addEventListener;n.addEventListener=function(e,n){if(e!==t)return i.apply(this,arguments);var o=function(e){var t=r(e);t&&(n.handleEvent?n.handleEvent(t):n(t))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(n,o),i.apply(this,[e,o])};var o=n.removeEventListener;n.removeEventListener=function(e,r){if(e!==t||!this._eventMap||!this._eventMap[t])return o.apply(this,arguments);if(!this._eventMap[t].has(r))return o.apply(this,arguments);var n=this._eventMap[t].get(r);return this._eventMap[t].delete(r),0===this._eventMap[t].size&&delete this._eventMap[t],0===Object.keys(this._eventMap).length&&delete this._eventMap,o.apply(this,[e,n])},Object.defineProperty(n,"on"+t,{get:function(){return this["_on"+t]},set:function(e){this["_on"+t]&&(this.removeEventListener(t,this["_on"+t]),delete this["_on"+t]),e&&this.addEventListener(t,this["_on"+t]=e)},enumerable:!0,configurable:!0})}}function gv(e){return"boolean"!=typeof e?new Error("Argument type: "+a(e)+". Please use a boolean."):(vv=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function Sv(e){return"boolean"!=typeof e?new Error("Argument type: "+a(e)+". Please use a boolean."):(_v=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function bv(){if("object"===("undefined"==typeof window?"undefined":a(window))){if(vv)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function Ev(e,t){_v&&console.warn(e+" is deprecated, please use "+t+" instead.")}function kv(e){var t={browser:null,version:null};if(void 0===e||!e.navigator)return t.browser="Not a browser.",t;var r=e.navigator;if(r.mozGetUserMedia)t.browser="firefox",t.version=mv(r.userAgent,/Firefox\/(\d+)\./,1);else if(r.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection)t.browser="chrome",t.version=mv(r.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else{if(!e.RTCPeerConnection||!r.userAgent.match(/AppleWebKit\/(\d+)\./))return t.browser="Not a supported browser.",t;t.browser="safari",t.version=mv(r.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return t}function Tv(e){return"[object Object]"===Object.prototype.toString.call(e)}function Iv(e){return Tv(e)?Object.keys(e).reduce((function(t,r){var n=Tv(e[r]),i=n?Iv(e[r]):e[r],o=n&&!Object.keys(i).length;return void 0===i||o?t:Object.assign(t,h({},r,i))}),{}):e}function Av(e,t,r){t&&!r.has(t.id)&&(r.set(t.id,t),Object.keys(t).forEach((function(n){n.endsWith("Id")?Av(e,e.get(t[n]),r):n.endsWith("Ids")&&t[n].forEach((function(t){Av(e,e.get(t),r)}))})))}function Rv(e,t,r){var n=r?"outbound-rtp":"inbound-rtp",i=new Map;if(null===t)return i;var o=[];return e.forEach((function(e){"track"===e.type&&e.trackIdentifier===t.id&&o.push(e)})),o.forEach((function(t){e.forEach((function(r){r.type===n&&r.trackId===t.id&&Av(e,r,i)}))})),i}var wv=ro,Cv=Ra.find,Ov=ps,xv="find",Dv=!0;xv in[]&&Array(1).find((function(){Dv=!1})),wv({target:"Array",proto:!0,forced:Dv},{find:function(e){return Cv(this,e,arguments.length>1?arguments[1]:void 0)}}),Ov(xv);var Nv=Re([].slice),Pv=ro,Mv=io,Lv=Po,Uv=Je,Vv=ci,Fv=fi,Bv=He,jv=lo,Gv=sr,Hv=Nv,zv=Xo("slice"),Xv=Gv("species"),Kv=Array,qv=Math.max;Pv({target:"Array",proto:!0,forced:!zv},{slice:function(e,t){var r,n,i,o=Bv(this),a=Fv(o),s=Vv(e,a),c=Vv(void 0===t?a:t,a);if(Mv(o)&&(r=o.constructor,(Lv(r)&&(r===Kv||Mv(r.prototype))||Uv(r)&&null===(r=r[Xv]))&&(r=void 0),r===Kv||void 0===r))return Hv(o,s,c);for(n=new(void 0===r?Kv:r)(qv(c-s,0)),i=0;s<c;s++,i++)s in o&&jv(n,i,o[s]);return n.length=i,n}});var Wv=ro,Yv=yi.indexOf,Jv=Ca,Qv=va([].indexOf),Zv=!!Qv&&1/Qv([1],1,-0)<0,$v=Jv("indexOf");Wv({target:"Array",proto:!0,forced:Zv||!$v},{indexOf:function(e){var t=arguments.length>1?arguments[1]:void 0;return Zv?Qv(this,e,t)||0:Yv(this,e,t)}});var e_=St,t_=TypeError,r_=function(e,t){if(!delete e[t])throw t_("Cannot delete property "+e_(t)+" of "+e_(e))},n_=ro,i_=Gt,o_=ci,a_=ii,s_=fi,c_=sv,u_=ao,d_=jo,l_=lo,h_=r_,f_=Xo("splice"),p_=Math.max,v_=Math.min;n_({target:"Array",proto:!0,forced:!f_},{splice:function(e,t){var r,n,i,o,a,s,c=i_(this),u=s_(c),d=o_(e,u),l=arguments.length;for(0===l?r=n=0:1===l?(r=0,n=u-d):(r=l-2,n=v_(p_(a_(t),0),u-d)),u_(u+r-n),i=d_(c,n),o=0;o<n;o++)(a=d+o)in c&&l_(i,o,c[a]);if(i.length=n,r<n){for(o=d;o<u-n;o++)s=o+r,(a=o+n)in c?c[s]=c[a]:h_(c,s);for(o=u;o>u-n+r;o--)h_(c,o-1)}else if(r>n)for(o=u-n;o>d;o--)s=o+r-1,(a=o+n-1)in c?c[s]=c[a]:h_(c,s);for(o=0;o<r;o++)c[o+d]=arguments[o+2];return c_(c,u-n+r),i}});var __=Ra.map;ro({target:"Array",proto:!0,forced:!Xo("map")},{map:function(e){return __(this,e,arguments.length>1?arguments[1]:void 0)}});var m_,y_,g_,S_,b_=Po,E_=St,k_=TypeError,T_=function(e){if(b_(e))return e;throw k_(E_(e)+" is not a constructor")},I_=Fr,A_=T_,R_=Ue,w_=sr("species"),C_=function(e,t){var r,n=I_(e).constructor;return void 0===n||R_(r=I_(n)[w_])?t:A_(r)},O_=TypeError,x_=function(e,t){if(e<t)throw O_("Not enough arguments");return e},D_=/(?:ipad|iphone|ipod).*applewebkit/i.test(rt),N_=ce,P_=Uf,M_=ga,L_=qe,U_=Xt,V_=de,F_=Ja,B_=Nv,j_=Er,G_=x_,H_=D_,z_=Ap,X_=N_.setImmediate,K_=N_.clearImmediate,q_=N_.process,W_=N_.Dispatch,Y_=N_.Function,J_=N_.MessageChannel,Q_=N_.String,Z_=0,$_={},em="onreadystatechange";try{m_=N_.location}catch(T0){}var tm=function(e){if(U_($_,e)){var t=$_[e];delete $_[e],t()}},rm=function(e){return function(){tm(e)}},nm=function(e){tm(e.data)},im=function(e){N_.postMessage(Q_(e),m_.protocol+"//"+m_.host)};X_&&K_||(X_=function(e){G_(arguments.length,1);var t=L_(e)?e:Y_(e),r=B_(arguments,1);return $_[++Z_]=function(){P_(t,void 0,r)},y_(Z_),Z_},K_=function(e){delete $_[e]},z_?y_=function(e){q_.nextTick(rm(e))}:W_&&W_.now?y_=function(e){W_.now(rm(e))}:J_&&!H_?(S_=(g_=new J_).port2,g_.port1.onmessage=nm,y_=M_(S_.postMessage,S_)):N_.addEventListener&&L_(N_.postMessage)&&!N_.importScripts&&m_&&"file:"!==m_.protocol&&!V_(im)?(y_=im,N_.addEventListener("message",nm,!1)):y_=em in j_("script")?function(e){F_.appendChild(j_("script")).onreadystatechange=function(){F_.removeChild(this),tm(e)}}:function(e){setTimeout(rm(e),0)});var om,am,sm,cm,um,dm,lm,hm,fm={set:X_,clear:K_},pm=ce,vm=/ipad|iphone|ipod/i.test(rt)&&void 0!==pm.Pebble,_m=/web0s(?!.*chrome)/i.test(rt),mm=ce,ym=ga,gm=ue.f,Sm=fm.set,bm=D_,Em=vm,km=_m,Tm=Ap,Im=mm.MutationObserver||mm.WebKitMutationObserver,Am=mm.document,Rm=mm.process,wm=mm.Promise,Cm=gm(mm,"queueMicrotask"),Om=Cm&&Cm.value;Om||(om=function(){var e,t;for(Tm&&(e=Rm.domain)&&e.exit();am;){t=am.fn,am=am.next;try{t()}catch(T0){throw am?cm():sm=void 0,T0}}sm=void 0,e&&e.enter()},bm||Tm||km||!Im||!Am?!Em&&wm&&wm.resolve?((lm=wm.resolve(void 0)).constructor=wm,hm=ym(lm.then,lm),cm=function(){hm(om)}):Tm?cm=function(){Rm.nextTick(om)}:(Sm=ym(Sm,mm),cm=function(){Sm(om)}):(um=!0,dm=Am.createTextNode(""),new Im(om).observe(dm,{characterData:!0}),cm=function(){dm.data=um=!um}));var xm=Om||function(e){var t={fn:e,next:void 0};sm&&(sm.next=t),am||(am=t,cm()),sm=t},Dm=ce,Nm=function(e){try{return{error:!1,value:e()}}catch(T0){return{error:!0,value:T0}}},Pm=function(){this.head=null,this.tail=null};Pm.prototype={add:function(e){var t={item:e,next:null};this.head?this.tail.next=t:this.head=t,this.tail=t},get:function(){var e=this.head;if(e)return this.head=e.next,this.tail===e&&(this.tail=null),e.item}};var Mm=Pm,Lm=ce.Promise,Um="object"==typeof Deno&&Deno&&"object"==typeof Deno.version,Vm=!Um&&!Ap&&"object"==typeof window&&"object"==typeof document,Fm=ce,Bm=Lm,jm=qe,Gm=Wi,Hm=pn,zm=sr,Xm=Vm,Km=Um,qm=ut;Bm&&Bm.prototype;var Wm=zm("species"),Ym=!1,Jm=jm(Fm.PromiseRejectionEvent),Qm={CONSTRUCTOR:Gm("Promise",(function(){var e=Hm(Bm),t=e!==String(Bm);if(!t&&66===qm)return!0;if(!qm||qm<51||!/native code/.test(e)){var r=new Bm((function(e){e(1)})),n=function(e){e((function(){}),(function(){}))};if((r.constructor={})[Wm]=n,!(Ym=r.then((function(){}))instanceof n))return!0}return!t&&(Xm||Km)&&!Jm})),REJECTION_EVENT:Jm,SUBCLASSING:Ym},Zm={},$m=Tt,ey=TypeError,ty=function(e){var t,r;this.promise=new e((function(e,n){if(void 0!==t||void 0!==r)throw ey("Bad Promise constructor");t=e,r=n})),this.resolve=$m(t),this.reject=$m(r)};Zm.f=function(e){return new ty(e)};var ry,ny,iy,oy=ro,ay=Ap,sy=ce,cy=ve,uy=$n,dy=pd,ly=ed,hy=Kh,fy=Tt,py=qe,vy=Je,_y=ph,my=C_,yy=fm.set,gy=xm,Sy=function(e,t){var r=Dm.console;r&&r.error&&(1==arguments.length?r.error(e):r.error(e,t))},by=Nm,Ey=Mm,ky=Ln,Ty=Lm,Iy=Zm,Ay="Promise",Ry=Qm.CONSTRUCTOR,wy=Qm.REJECTION_EVENT,Cy=Qm.SUBCLASSING,Oy=ky.getterFor(Ay),xy=ky.set,Dy=Ty&&Ty.prototype,Ny=Ty,Py=Dy,My=sy.TypeError,Ly=sy.document,Uy=sy.process,Vy=Iy.f,Fy=Vy,By=!!(Ly&&Ly.createEvent&&sy.dispatchEvent),jy="unhandledrejection",Gy=function(e){var t;return!(!vy(e)||!py(t=e.then))&&t},Hy=function(e,t){var r,n,i,o=t.value,a=1==t.state,s=a?e.ok:e.fail,c=e.resolve,u=e.reject,d=e.domain;try{s?(a||(2===t.rejection&&Wy(t),t.rejection=1),!0===s?r=o:(d&&d.enter(),r=s(o),d&&(d.exit(),i=!0)),r===e.promise?u(My("Promise-chain cycle")):(n=Gy(r))?cy(n,r,c,u):c(r)):u(o)}catch(T0){d&&!i&&d.exit(),u(T0)}},zy=function(e,t){e.notified||(e.notified=!0,gy((function(){for(var r,n=e.reactions;r=n.get();)Hy(r,e);e.notified=!1,t&&!e.rejection&&Ky(e)})))},Xy=function(e,t,r){var n,i;By?((n=Ly.createEvent("Event")).promise=t,n.reason=r,n.initEvent(e,!1,!0),sy.dispatchEvent(n)):n={promise:t,reason:r},!wy&&(i=sy["on"+e])?i(n):e===jy&&Sy("Unhandled promise rejection",r)},Ky=function(e){cy(yy,sy,(function(){var t,r=e.facade,n=e.value;if(qy(e)&&(t=by((function(){ay?Uy.emit("unhandledRejection",n,r):Xy(jy,r,n)})),e.rejection=ay||qy(e)?2:1,t.error))throw t.value}))},qy=function(e){return 1!==e.rejection&&!e.parent},Wy=function(e){cy(yy,sy,(function(){var t=e.facade;ay?Uy.emit("rejectionHandled",t):Xy("rejectionhandled",t,e.value)}))},Yy=function(e,t,r){return function(n){e(t,n,r)}},Jy=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=2,zy(e,!0))},Qy=function(e,t,r){if(!e.done){e.done=!0,r&&(e=r);try{if(e.facade===t)throw My("Promise can't be resolved itself");var n=Gy(t);n?gy((function(){var r={done:!1};try{cy(n,t,Yy(Qy,r,e),Yy(Jy,r,e))}catch(T0){Jy(r,T0,e)}})):(e.value=t,e.state=1,zy(e,!1))}catch(T0){Jy({done:!1},T0,e)}}};if(Ry&&(Py=(Ny=function(e){_y(this,Py),fy(e),cy(ry,this);var t=Oy(this);try{e(Yy(Qy,t),Yy(Jy,t))}catch(T0){Jy(t,T0)}}).prototype,(ry=function(e){xy(this,{type:Ay,done:!1,notified:!1,parent:!1,reactions:new Ey,rejection:!1,state:0,value:void 0})}).prototype=uy(Py,"then",(function(e,t){var r=Oy(this),n=Vy(my(this,Ny));return r.parent=!0,n.ok=!py(e)||e,n.fail=py(t)&&t,n.domain=ay?Uy.domain:void 0,0==r.state?r.reactions.add(n):gy((function(){Hy(n,r)})),n.promise})),ny=function(){var e=new ry,t=Oy(e);this.promise=e,this.resolve=Yy(Qy,t),this.reject=Yy(Jy,t)},Iy.f=Vy=function(e){return e===Ny||undefined===e?new ny(e):Fy(e)},py(Ty)&&Dy!==Object.prototype)){iy=Dy.then,Cy||uy(Dy,"then",(function(e,t){var r=this;return new Ny((function(e,t){cy(iy,r,e,t)})).then(e,t)}),{unsafe:!0});try{delete Dy.constructor}catch(T0){}dy&&dy(Dy,Py)}oy({global:!0,constructor:!0,wrap:!0,forced:Ry},{Promise:Ny}),ly(Ny,Ay,!1),hy(Ay);var Zy=Lm,$y=Qm.CONSTRUCTOR||!gh((function(e){Zy.all(e).then(void 0,(function(){}))})),eg=ve,tg=Tt,rg=Zm,ng=Nm,ig=lh;ro({target:"Promise",stat:!0,forced:$y},{all:function(e){var t=this,r=rg.f(t),n=r.resolve,i=r.reject,o=ng((function(){var r=tg(t.resolve),o=[],a=0,s=1;ig(e,(function(e){var c=a++,u=!1;s++,eg(r,t,e).then((function(e){u||(u=!0,o[c]=e,--s||n(o))}),i)})),--s||n(o)}));return o.error&&i(o.value),r.promise}});var og=ro,ag=Qm.CONSTRUCTOR,sg=Lm,cg=et,ug=qe,dg=$n,lg=sg&&sg.prototype;if(og({target:"Promise",proto:!0,forced:ag,real:!0},{catch:function(e){return this.then(void 0,e)}}),ug(sg)){var hg=cg("Promise").prototype.catch;lg.catch!==hg&&dg(lg,"catch",hg,{unsafe:!0})}var fg=ve,pg=Tt,vg=Zm,_g=Nm,mg=lh;ro({target:"Promise",stat:!0,forced:$y},{race:function(e){var t=this,r=vg.f(t),n=r.reject,i=_g((function(){var i=pg(t.resolve);mg(e,(function(e){fg(i,t,e).then(r.resolve,n)}))}));return i.error&&n(i.value),r.promise}});var yg=ve,gg=Zm;ro({target:"Promise",stat:!0,forced:Qm.CONSTRUCTOR},{reject:function(e){var t=gg.f(this);return yg(t.reject,void 0,e),t.promise}});var Sg=Fr,bg=Je,Eg=Zm,kg=function(e,t){if(Sg(e),bg(t)&&t.constructor===e)return t;var r=Eg.f(e);return(0,r.resolve)(t),r.promise},Tg=ro,Ig=Qm.CONSTRUCTOR,Ag=kg;et("Promise"),Tg({target:"Promise",stat:!0,forced:Ig},{resolve:function(e){return Ag(this,e)}});var Rg=Ap,wg=en.exports,Cg=Pr,Og=function(e,t,r){return r.get&&wg(r.get,t,{getter:!0}),r.set&&wg(r.set,t,{setter:!0}),Cg.f(e,t,r)},xg=le,Dg=de,Ng=Fr,Pg=cs,Mg=jf,Lg=Error.prototype.toString,Ug=Dg((function(){if(xg){var e=Pg(Object.defineProperty({},"name",{get:function(){return this===e}}));if("true"!==Lg.call(e))return!0}return"2: 1"!==Lg.call({message:1,name:2})||"Error"!==Lg.call({})}))?function(){var e=Ng(this),t=Mg(e.name,"Error"),r=Mg(e.message);return t?r?t+": "+r:t:r}:Lg,Vg={IndexSizeError:{s:"INDEX_SIZE_ERR",c:1,m:1},DOMStringSizeError:{s:"DOMSTRING_SIZE_ERR",c:2,m:0},HierarchyRequestError:{s:"HIERARCHY_REQUEST_ERR",c:3,m:1},WrongDocumentError:{s:"WRONG_DOCUMENT_ERR",c:4,m:1},InvalidCharacterError:{s:"INVALID_CHARACTER_ERR",c:5,m:1},NoDataAllowedError:{s:"NO_DATA_ALLOWED_ERR",c:6,m:0},NoModificationAllowedError:{s:"NO_MODIFICATION_ALLOWED_ERR",c:7,m:1},NotFoundError:{s:"NOT_FOUND_ERR",c:8,m:1},NotSupportedError:{s:"NOT_SUPPORTED_ERR",c:9,m:1},InUseAttributeError:{s:"INUSE_ATTRIBUTE_ERR",c:10,m:1},InvalidStateError:{s:"INVALID_STATE_ERR",c:11,m:1},SyntaxError:{s:"SYNTAX_ERR",c:12,m:1},InvalidModificationError:{s:"INVALID_MODIFICATION_ERR",c:13,m:1},NamespaceError:{s:"NAMESPACE_ERR",c:14,m:1},InvalidAccessError:{s:"INVALID_ACCESS_ERR",c:15,m:1},ValidationError:{s:"VALIDATION_ERR",c:16,m:0},TypeMismatchError:{s:"TYPE_MISMATCH_ERR",c:17,m:1},SecurityError:{s:"SECURITY_ERR",c:18,m:1},NetworkError:{s:"NETWORK_ERR",c:19,m:1},AbortError:{s:"ABORT_ERR",c:20,m:1},URLMismatchError:{s:"URL_MISMATCH_ERR",c:21,m:1},QuotaExceededError:{s:"QUOTA_EXCEEDED_ERR",c:22,m:1},TimeoutError:{s:"TIMEOUT_ERR",c:23,m:1},InvalidNodeTypeError:{s:"INVALID_NODE_TYPE_ERR",c:24,m:1},DataCloneError:{s:"DATA_CLONE_ERR",c:25,m:1}},Fg=ro,Bg=function(e){try{if(Rg)return Function('return require("'+e+'")')()}catch(T0){}},jg=et,Gg=de,Hg=cs,zg=Ee,Xg=Pr.f,Kg=$n,qg=Og,Wg=Xt,Yg=ph,Jg=Fr,Qg=Ug,Zg=jf,$g=Vg,eS=Yf,tS=Ln,rS=le,nS="DOMException",iS="DATA_CLONE_ERR",oS=jg("Error"),aS=jg(nS)||function(){try{(new(jg("MessageChannel")||Bg("worker_threads").MessageChannel)).port1.postMessage(new WeakMap)}catch(T0){if(T0.name==iS&&25==T0.code)return T0.constructor}}(),sS=aS&&aS.prototype,cS=oS.prototype,uS=tS.set,dS=tS.getterFor(nS),lS="stack"in oS(nS),hS=function(e){return Wg($g,e)&&$g[e].m?$g[e].c:0},fS=function(){Yg(this,pS);var e=arguments.length,t=Zg(e<1?void 0:arguments[0]),r=Zg(e<2?void 0:arguments[1],"Error"),n=hS(r);if(uS(this,{type:nS,name:r,message:t,code:n}),rS||(this.name=r,this.message=t,this.code=n),lS){var i=oS(t);i.name=nS,Xg(this,"stack",zg(1,eS(i.stack,1)))}},pS=fS.prototype=Hg(cS),vS=function(e){return{enumerable:!0,configurable:!0,get:e}},_S=function(e){return vS((function(){return dS(this)[e]}))};rS&&(qg(pS,"code",_S("code")),qg(pS,"message",_S("message")),qg(pS,"name",_S("name"))),Xg(pS,"constructor",zg(1,fS));var mS=Gg((function(){return!(new aS instanceof oS)})),yS=mS||Gg((function(){return cS.toString!==Qg||"2: 1"!==String(new aS(1,2))})),gS=mS||Gg((function(){return 25!==new aS(1,"DataCloneError").code}));mS||25!==aS.DATA_CLONE_ERR||sS.DATA_CLONE_ERR;Fg({global:!0,constructor:!0,forced:mS},{DOMException:mS?fS:aS});var SS=jg(nS),bS=SS.prototype;for(var ES in yS&&aS===SS&&Kg(bS,"toString",Qg),gS&&rS&&aS===SS&&qg(bS,"code",vS((function(){return hS(Jg(this).name)}))),$g)if(Wg($g,ES)){var kS=$g[ES],TS=kS.s,IS=zg(6,kS.c);Wg(SS,TS)||Xg(SS,TS,IS),Wg(bS,TS)||Xg(bS,TS,IS)}var AS=ro,RS=ce,wS=et,CS=Ee,OS=Pr.f,xS=Xt,DS=ph,NS=kh,PS=jf,MS=Vg,LS=Yf,US=le,VS="DOMException",FS=wS("Error"),BS=wS(VS),jS=function(){DS(this,GS);var e=arguments.length,t=PS(e<1?void 0:arguments[0]),r=PS(e<2?void 0:arguments[1],"Error"),n=new BS(t,r),i=FS(t);return i.name=VS,OS(n,"stack",CS(1,LS(i.stack,1))),NS(n,this,jS),n},GS=jS.prototype=BS.prototype,HS="stack"in FS(VS),zS="stack"in new BS(1,2),XS=BS&&US&&Object.getOwnPropertyDescriptor(RS,VS),KS=!(!XS||XS.writable&&XS.configurable),qS=HS&&!KS&&!zS;AS({global:!0,constructor:!0,forced:qS},{DOMException:qS?jS:BS});var WS=wS(VS),YS=WS.prototype;if(YS.constructor!==WS)for(var JS in OS(YS,"constructor",CS(1,WS)),MS)if(xS(MS,JS)){var QS=MS[JS],ZS=QS.s;xS(WS,ZS)||OS(WS,ZS,CS(6,QS.c))}var $S="DOMException";ed(et($S),$S);var eb=Ra.filter;ro({target:"Array",proto:!0,forced:!Xo("filter")},{filter:function(e){return eb(this,e,arguments.length>1?arguments[1]:void 0)}});var tb=Re,rb=Gt,nb=Math.floor,ib=tb("".charAt),ob=tb("".replace),ab=tb("".slice),sb=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,cb=/\$([$&'`]|\d{1,2})/g,ub=Uf,db=ve,lb=Re,hb=Ac,fb=de,pb=Fr,vb=qe,_b=Ue,mb=ii,yb=li,gb=As,Sb=Be,bb=$c,Eb=Rt,kb=function(e,t,r,n,i,o){var a=r+e.length,s=n.length,c=cb;return void 0!==i&&(i=rb(i),c=sb),ob(o,c,(function(o,c){var u;switch(ib(c,0)){case"$":return"$";case"&":return e;case"`":return ab(t,0,r);case"'":return ab(t,a);case"<":u=i[ab(c,1,-1)];break;default:var d=+c;if(0===d)return o;if(d>s){var l=nb(d/10);return 0===l?o:l<=s?void 0===n[l-1]?ib(c,1):n[l-1]+ib(c,1):o}u=n[d-1]}return void 0===u?"":u}))},Tb=Pc,Ib=sr("replace"),Ab=Math.max,Rb=Math.min,wb=lb([].concat),Cb=lb([].push),Ob=lb("".indexOf),xb=lb("".slice),Db="$0"==="a".replace(/./,"$0"),Nb=!!/./[Ib]&&""===/./[Ib]("a","$0"),Pb=!fb((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")}));hb("replace",(function(e,t,r){var n=Nb?"$":"$0";return[function(e,r){var n=Sb(this),i=_b(e)?void 0:Eb(e,Ib);return i?db(i,e,n,r):db(t,gb(n),e,r)},function(e,i){var o=pb(this),a=gb(e);if("string"==typeof i&&-1===Ob(i,n)&&-1===Ob(i,"$<")){var s=r(t,o,a,i);if(s.done)return s.value}var c=vb(i);c||(i=gb(i));var u=o.global;if(u){var d=o.unicode;o.lastIndex=0}for(var l=[];;){var h=Tb(o,a);if(null===h)break;if(Cb(l,h),!u)break;""===gb(h[0])&&(o.lastIndex=bb(a,yb(o.lastIndex),d))}for(var f,p="",v=0,_=0;_<l.length;_++){for(var m=gb((h=l[_])[0]),y=Ab(Rb(mb(h.index),a.length),0),g=[],S=1;S<h.length;S++)Cb(g,void 0===(f=h[S])?f:String(f));var b=h.groups;if(c){var E=wb([m],g,y,a);void 0!==b&&Cb(E,b);var k=gb(ub(i,void 0,E))}else k=kb(m,a,y,g,b,i);y>=v&&(p+=xb(a,v,y)+k,v=y+m.length)}return p+xb(a,v)}]}),!Pb||!Db||Nb);var Mb=ve,Lb=Xt,Ub=tt,Vb=Vs,Fb=RegExp.prototype,Bb=function(e){var t=e.flags;return void 0!==t||"flags"in Fb||Lb(e,"flags")||!Ub(Fb,e)?t:Mb(Vb,e)},jb=le,Gb=ce,Hb=Re,zb=Wi,Xb=kh,Kb=$r,qb=ei.f,Wb=tt,Yb=Ss,Jb=As,Qb=Bb,Zb=zs,$b=Ff,eE=$n,tE=de,rE=Xt,nE=Ln.enforce,iE=Kh,oE=qs,aE=Js,sE=sr("match"),cE=Gb.RegExp,uE=cE.prototype,dE=Gb.SyntaxError,lE=Hb(uE.exec),hE=Hb("".charAt),fE=Hb("".replace),pE=Hb("".indexOf),vE=Hb("".slice),_E=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,mE=/a/g,yE=/a/g,gE=new cE(mE)!==mE,SE=Zb.MISSED_STICKY,bE=Zb.UNSUPPORTED_Y,EE=jb&&(!gE||SE||oE||aE||tE((function(){return yE[sE]=!1,cE(mE)!=mE||cE(yE)==yE||"/a/i"!=cE(mE,"i")})));if(zb("RegExp",EE)){for(var kE=function(e,t){var r,n,i,o,a,s,c=Wb(uE,this),u=Yb(e),d=void 0===t,l=[],h=e;if(!c&&u&&d&&e.constructor===kE)return e;if((u||Wb(uE,e))&&(e=e.source,d&&(t=Qb(h))),e=void 0===e?"":Jb(e),t=void 0===t?"":Jb(t),h=e,oE&&"dotAll"in mE&&(n=!!t&&pE(t,"s")>-1)&&(t=fE(t,/s/g,"")),r=t,SE&&"sticky"in mE&&(i=!!t&&pE(t,"y")>-1)&&bE&&(t=fE(t,/y/g,"")),aE&&(o=function(e){for(var t,r=e.length,n=0,i="",o=[],a={},s=!1,c=!1,u=0,d="";n<=r;n++){if("\\"===(t=hE(e,n)))t+=hE(e,++n);else if("]"===t)s=!1;else if(!s)switch(!0){case"["===t:s=!0;break;case"("===t:lE(_E,vE(e,n+1))&&(n+=2,c=!0),i+=t,u++;continue;case">"===t&&c:if(""===d||rE(a,d))throw new dE("Invalid capture group name");a[d]=!0,o[o.length]=[d,u],c=!1,d="";continue}c?d+=t:i+=t}return[i,o]}(e),e=o[0],l=o[1]),a=Xb(cE(e,t),c?this:uE,kE),(n||i||l.length)&&(s=nE(a),n&&(s.dotAll=!0,s.raw=kE(function(e){for(var t,r=e.length,n=0,i="",o=!1;n<=r;n++)"\\"!==(t=hE(e,n))?o||"."!==t?("["===t?o=!0:"]"===t&&(o=!1),i+=t):i+="[\\s\\S]":i+=t+hE(e,++n);return i}(e),r)),i&&(s.sticky=!0),l.length&&(s.groups=l)),e!==h)try{Kb(a,"source",""===h?"(?:)":h)}catch(T0){}return a},TE=qb(cE),IE=0;TE.length>IE;)$b(kE,cE,TE[IE++]);uE.constructor=kE,kE.prototype=uE,eE(Gb,"RegExp",kE,{constructor:!0})}iE("RegExp");var AE=le,RE=qs,wE=xe,CE=Og,OE=Ln.get,xE=RegExp.prototype,DE=TypeError;AE&&RE&&CE(xE,"dotAll",{configurable:!0,get:function(){if(this!==xE){if("RegExp"===wE(this))return!!OE(this).dotAll;throw DE("Incompatible receiver, RegExp required")}}});var NE=le,PE=zs.MISSED_STICKY,ME=xe,LE=Og,UE=Ln.get,VE=RegExp.prototype,FE=TypeError;NE&&PE&&LE(VE,"sticky",{configurable:!0,get:function(){if(this!==VE){if("RegExp"===ME(this))return!!UE(this).sticky;throw FE("Incompatible receiver, RegExp required")}}});var BE=sn.PROPER,jE=$n,GE=Fr,HE=As,zE=de,XE=Bb,KE="toString",qE=RegExp.prototype.toString,WE=zE((function(){return"/a/b"!=qE.call({source:"a",flags:"b"})})),YE=BE&&qE.name!=KE;(WE||YE)&&jE(RegExp.prototype,KE,(function(){var e=GE(this);return"/"+HE(e.source)+"/"+HE(XE(e))}),{unsafe:!0});var JE=ro,QE=de,ZE=He,$E=ue.f,ek=le,tk=QE((function(){$E(1)}));JE({target:"Object",stat:!0,forced:!ek||tk,sham:!ek},{getOwnPropertyDescriptor:function(e,t){return $E(ZE(e),t)}});var rk=ro,nk=et,ik=Uf,ok=ve,ak=Re,sk=de,ck=io,uk=qe,dk=Je,lk=yt,hk=Nv,fk=ht,pk=nk("JSON","stringify"),vk=ak(/./.exec),_k=ak("".charAt),mk=ak("".charCodeAt),yk=ak("".replace),gk=ak(1..toString),Sk=/[\uD800-\uDFFF]/g,bk=/^[\uD800-\uDBFF]$/,Ek=/^[\uDC00-\uDFFF]$/,kk=!fk||sk((function(){var e=nk("Symbol")();return"[null]"!=pk([e])||"{}"!=pk({a:e})||"{}"!=pk(Object(e))})),Tk=sk((function(){return'"\\udf06\\ud834"'!==pk("\udf06\ud834")||'"\\udead"'!==pk("\udead")})),Ik=function(e,t){var r=hk(arguments),n=t;if((dk(t)||void 0!==e)&&!lk(e))return ck(t)||(t=function(e,t){if(uk(n)&&(t=ok(n,this,e,t)),!lk(t))return t}),r[1]=t,ik(pk,null,r)},Ak=function(e,t,r){var n=_k(r,t-1),i=_k(r,t+1);return vk(bk,e)&&!vk(Ek,i)||vk(Ek,e)&&!vk(bk,n)?"\\u"+gk(mk(e,0),16):e};pk&&rk({target:"JSON",stat:!0,arity:3,forced:kk||Tk},{stringify:function(e,t,r){var n=hk(arguments),i=ik(kk?Ik:pk,null,n);return Tk&&"string"==typeof i?yk(i,Sk,Ak):i}});var Rk=bv;function wk(e,t){var r=e&&e.navigator;if(r.mediaDevices){var n=function(e){if("object"!==a(e)||e.mandatory||e.optional)return e;var t={};return Object.keys(e).forEach((function(r){if("require"!==r&&"advanced"!==r&&"mediaSource"!==r){var n="object"===a(e[r])?e[r]:{ideal:e[r]};void 0!==n.exact&&"number"==typeof n.exact&&(n.min=n.max=n.exact);var i=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):"deviceId"===t?"sourceId":t};if(void 0!==n.ideal){t.optional=t.optional||[];var o={};"number"==typeof n.ideal?(o[i("min",r)]=n.ideal,t.optional.push(o),(o={})[i("max",r)]=n.ideal,t.optional.push(o)):(o[i("",r)]=n.ideal,t.optional.push(o))}void 0!==n.exact&&"number"!=typeof n.exact?(t.mandatory=t.mandatory||{},t.mandatory[i("",r)]=n.exact):["min","max"].forEach((function(e){void 0!==n[e]&&(t.mandatory=t.mandatory||{},t.mandatory[i(e,r)]=n[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"===a(e.audio)){var o=function(e,t,r){t in e&&!(r in e)&&(e[r]=e[t],delete e[t])};o((e=JSON.parse(JSON.stringify(e))).audio,"autoGainControl","googAutoGainControl"),o(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=n(e.audio)}if(e&&"object"===a(e.video)){var s=e.video.facingMode;s=s&&("object"===a(s)?s:{ideal:s});var c,u=t.version<66;if(s&&("user"===s.exact||"environment"===s.exact||"user"===s.ideal||"environment"===s.ideal)&&(!r.mediaDevices.getSupportedConstraints||!r.mediaDevices.getSupportedConstraints().facingMode||u))if(delete e.video.facingMode,"environment"===s.exact||"environment"===s.ideal?c=["back","rear"]:"user"!==s.exact&&"user"!==s.ideal||(c=["front"]),c)return r.mediaDevices.enumerateDevices().then((function(t){var r=(t=t.filter((function(e){return"videoinput"===e.kind}))).find((function(e){return c.some((function(t){return e.label.toLowerCase().includes(t)}))}));return!r&&t.length&&c.includes("back")&&(r=t[t.length-1]),r&&(e.video.deviceId=s.exact?{exact:r.deviceId}:{ideal:r.deviceId}),e.video=n(e.video),Rk("chrome: "+JSON.stringify(e)),i(e)}));e.video=n(e.video)}return Rk("chrome: "+JSON.stringify(e)),i(e)},o=function(e){return t.version>=64?e:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[e.name]||e.name,message:e.message,constraint:e.constraint||e.constraintName,toString:function(){return this.name+(this.message&&": ")+this.message}}};if(r.getUserMedia=function(e,t,n){i(e,(function(e){r.webkitGetUserMedia(e,t,(function(e){n&&n(o(e))}))}))}.bind(r),r.mediaDevices.getUserMedia){var s=r.mediaDevices.getUserMedia.bind(r.mediaDevices);r.mediaDevices.getUserMedia=function(e){return i(e,(function(e){return s(e).then((function(t){if(e.audio&&!t.getAudioTracks().length||e.video&&!t.getVideoTracks().length)throw t.getTracks().forEach((function(e){e.stop()})),new DOMException("","NotFoundError");return t}),(function(e){return Promise.reject(o(e))}))}))}}}}function Ck(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function Ok(e){if("object"===a(e)&&e.RTCPeerConnection&&!("ontrack"in e.RTCPeerConnection.prototype)){Object.defineProperty(e.RTCPeerConnection.prototype,"ontrack",{get:function(){return this._ontrack},set:function(e){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=e)},enumerable:!0,configurable:!0});var t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){var r=this;return this._ontrackpoly||(this._ontrackpoly=function(t){t.stream.addEventListener("addtrack",(function(n){var i;i=e.RTCPeerConnection.prototype.getReceivers?r.getReceivers().find((function(e){return e.track&&e.track.id===n.track.id})):{track:n.track};var o=new Event("track");o.track=n.track,o.receiver=i,o.transceiver={receiver:i},o.streams=[t.stream],r.dispatchEvent(o)})),t.stream.getTracks().forEach((function(n){var i;i=e.RTCPeerConnection.prototype.getReceivers?r.getReceivers().find((function(e){return e.track&&e.track.id===n.id})):{track:n};var o=new Event("track");o.track=n,o.receiver=i,o.transceiver={receiver:i},o.streams=[t.stream],r.dispatchEvent(o)}))},this.addEventListener("addstream",this._ontrackpoly)),t.apply(this,arguments)}}else yv(e,"track",(function(e){return e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e}))}function xk(e){if("object"===a(e)&&e.RTCPeerConnection&&!("getSenders"in e.RTCPeerConnection.prototype)&&"createDTMFSender"in e.RTCPeerConnection.prototype){var t=function(e,t){return{track:t,get dtmf(){return void 0===this._dtmf&&("audio"===t.kind?this._dtmf=e.createDTMFSender(t):this._dtmf=null),this._dtmf},_pc:e}};if(!e.RTCPeerConnection.prototype.getSenders){e.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};var r=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,n){var i=r.apply(this,arguments);return i||(i=t(this,e),this._senders.push(i)),i};var n=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){n.apply(this,arguments);var t=this._senders.indexOf(e);-1!==t&&this._senders.splice(t,1)}}var i=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){var r=this;this._senders=this._senders||[],i.apply(this,[e]),e.getTracks().forEach((function(e){r._senders.push(t(r,e))}))};var o=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;this._senders=this._senders||[],o.apply(this,[e]),e.getTracks().forEach((function(e){var r=t._senders.find((function(t){return t.track===e}));r&&t._senders.splice(t._senders.indexOf(r),1)}))}}else if("object"===a(e)&&e.RTCPeerConnection&&"getSenders"in e.RTCPeerConnection.prototype&&"createDTMFSender"in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)){var s=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){var e=this,t=s.apply(this,[]);return t.forEach((function(t){return t._pc=e})),t},Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get:function(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function Dk(e){if(e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){var e=this,r=Array.prototype.slice.call(arguments),n=r[0],i=r[1],o=r[2];if(arguments.length>0&&"function"==typeof n)return t.apply(this,arguments);if(0===t.length&&(0===arguments.length||"function"!=typeof n))return t.apply(this,[]);var a=function(e){var t={};return e.result().forEach((function(e){var r={id:e.id,timestamp:e.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[e.type]||e.type};e.names().forEach((function(t){r[t]=e.stat(t)})),t[r.id]=r})),t},s=function(e){return new Map(Object.keys(e).map((function(t){return[t,e[t]]})))};if(arguments.length>=2){var c=function(e){i(s(a(e)))};return t.apply(this,[c,n])}return new Promise((function(r,n){t.apply(e,[function(e){r(s(a(e)))},n])})).then(i,o)}}}function Nk(e){if("object"===a(e)&&e.RTCPeerConnection&&e.RTCRtpSender&&e.RTCRtpReceiver){if(!("getStats"in e.RTCRtpSender.prototype)){var t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){var e=this,r=t.apply(this,[]);return r.forEach((function(t){return t._pc=e})),r});var r=e.RTCPeerConnection.prototype.addTrack;r&&(e.RTCPeerConnection.prototype.addTrack=function(){var e=r.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){var e=this;return this._pc.getStats().then((function(t){return Rv(t,e.track,!0)}))}}if(!("getStats"in e.RTCRtpReceiver.prototype)){var n=e.RTCPeerConnection.prototype.getReceivers;n&&(e.RTCPeerConnection.prototype.getReceivers=function(){var e=this,t=n.apply(this,[]);return t.forEach((function(t){return t._pc=e})),t}),yv(e,"track",(function(e){return e.receiver._pc=e.srcElement,e})),e.RTCRtpReceiver.prototype.getStats=function(){var e=this;return this._pc.getStats().then((function(t){return Rv(t,e.track,!1)}))}}if("getStats"in e.RTCRtpSender.prototype&&"getStats"in e.RTCRtpReceiver.prototype){var i=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof e.MediaStreamTrack){var t,r,n,o=arguments[0];return this.getSenders().forEach((function(e){e.track===o&&(t?n=!0:t=e)})),this.getReceivers().forEach((function(e){return e.track===o&&(r?n=!0:r=e),e.track===o})),n||t&&r?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):t?t.getStats():r?r.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return i.apply(this,arguments)}}}}function Pk(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){var e=this;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map((function(t){return e._shimmedLocalStreams[t][0]}))};var t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,r){if(!r)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};var n=t.apply(this,arguments);return this._shimmedLocalStreams[r.id]?-1===this._shimmedLocalStreams[r.id].indexOf(n)&&this._shimmedLocalStreams[r.id].push(n):this._shimmedLocalStreams[r.id]=[r,n],n};var r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){var t=this;this._shimmedLocalStreams=this._shimmedLocalStreams||{},e.getTracks().forEach((function(e){if(t.getSenders().find((function(t){return t.track===e})))throw new DOMException("Track already exists.","InvalidAccessError")}));var n=this.getSenders();r.apply(this,arguments);var i=this.getSenders().filter((function(e){return-1===n.indexOf(e)}));this._shimmedLocalStreams[e.id]=[e].concat(i)};var n=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],n.apply(this,arguments)};var i=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){var t=this;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},e&&Object.keys(this._shimmedLocalStreams).forEach((function(r){var n=t._shimmedLocalStreams[r].indexOf(e);-1!==n&&t._shimmedLocalStreams[r].splice(n,1),1===t._shimmedLocalStreams[r].length&&delete t._shimmedLocalStreams[r]})),i.apply(this,arguments)}}function Mk(e,t){if(e.RTCPeerConnection){if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return Pk(e);var r=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){var e=this,t=r.apply(this);return this._reverseStreams=this._reverseStreams||{},t.map((function(t){return e._reverseStreams[t.id]}))};var n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(t){var r=this;if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},t.getTracks().forEach((function(e){if(r.getSenders().find((function(t){return t.track===e})))throw new DOMException("Track already exists.","InvalidAccessError")})),!this._reverseStreams[t.id]){var i=new e.MediaStream(t.getTracks());this._streams[t.id]=i,this._reverseStreams[i.id]=t,t=i}n.apply(this,[t])};var i=e.RTCPeerConnection.prototype.removeStream;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,r){var n=this;if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");var i=[].slice.call(arguments,1);if(1!==i.length||!i[0].getTracks().find((function(e){return e===t})))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");var o=this.getSenders().find((function(e){return e.track===t}));if(o)throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};var a=this._streams[r.id];if(a)a.addTrack(t),Promise.resolve().then((function(){n.dispatchEvent(new Event("negotiationneeded"))}));else{var s=new e.MediaStream([t]);this._streams[r.id]=s,this._reverseStreams[s.id]=r,this.addStream(s)}return this.getSenders().find((function(e){return e.track===t}))},["createOffer","createAnswer"].forEach((function(t){var r=e.RTCPeerConnection.prototype[t],n=h({},t,(function(){var e=this,t=arguments,n=arguments.length&&"function"==typeof arguments[0];return n?r.apply(this,[function(r){var n=s(e,r);t[0].apply(null,[n])},function(e){t[1]&&t[1].apply(null,e)},arguments[2]]):r.apply(this,arguments).then((function(t){return s(e,t)}))}));e.RTCPeerConnection.prototype[t]=n[t]}));var o=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=c(this,arguments[0]),o.apply(this,arguments)):o.apply(this,arguments)};var a=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(e.RTCPeerConnection.prototype,"localDescription",{get:function(){var e=a.get.apply(this);return""===e.type?e:s(this,e)}}),e.RTCPeerConnection.prototype.removeTrack=function(e){var t,r=this;if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!e._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(!(e._pc===this))throw new DOMException("Sender was not created by this connection.","InvalidAccessError");this._streams=this._streams||{},Object.keys(this._streams).forEach((function(n){r._streams[n].getTracks().find((function(t){return e.track===t}))&&(t=r._streams[n])})),t&&(1===t.getTracks().length?this.removeStream(this._reverseStreams[t.id]):t.removeTrack(e.track),this.dispatchEvent(new Event("negotiationneeded")))}}function s(e,t){var r=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((function(t){var n=e._reverseStreams[t],i=e._streams[n.id];r=r.replace(new RegExp(i.id,"g"),n.id)})),new RTCSessionDescription({type:t.type,sdp:r})}function c(e,t){var r=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((function(t){var n=e._reverseStreams[t],i=e._streams[n.id];r=r.replace(new RegExp(n.id,"g"),i.id)})),new RTCSessionDescription({type:t.type,sdp:r})}}function Lk(e,t){!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=e.webkitRTCPeerConnection),e.RTCPeerConnection&&t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){var r=e.RTCPeerConnection.prototype[t],n=h({},t,(function(){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}));e.RTCPeerConnection.prototype[t]=n[t]}))}function Uk(e,t){yv(e,"negotiationneeded",(function(e){var r=e.target;if(!(t.version<72||r.getConfiguration&&"plan-b"===r.getConfiguration().sdpSemantics)||"stable"===r.signalingState)return e}))}var Vk,Fk,Bk=Object.freeze(Object.defineProperty({__proto__:null,shimMediaStream:Ck,shimOnTrack:Ok,shimGetSendersWithDtmf:xk,shimGetStats:Dk,shimSenderReceiverGetStats:Nk,shimAddTrackRemoveTrackWithNative:Pk,shimAddTrackRemoveTrack:Mk,shimPeerConnection:Lk,fixNegotiationNeeded:Uk,shimGetUserMedia:wk,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&("function"==typeof t?e.navigator.mediaDevices.getDisplayMedia=function(r){return t(r).then((function(t){var n=r.video&&r.video.width,i=r.video&&r.video.height,o=r.video&&r.video.frameRate;return r.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:t,maxFrameRate:o||3}},n&&(r.video.mandatory.maxWidth=n),i&&(r.video.mandatory.maxHeight=i),e.navigator.mediaDevices.getUserMedia(r)}))}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))}},Symbol.toStringTag,{value:"Module"})),jk=ro,Gk=ve,Hk=qe,zk=Fr,Xk=As,Kk=(Vk=!1,(Fk=/[ac]/).exec=function(){return Vk=!0,/./.exec.apply(this,arguments)},!0===Fk.test("abc")&&Vk),qk=/./.test;jk({target:"RegExp",proto:!0,forced:!Kk},{test:function(e){var t=zk(this),r=Xk(e),n=t.exec;if(!Hk(n))return Gk(qk,t,r);var i=Gk(n,t,r);return null!==i&&(zk(i),!0)}});var Wk=ce,Yk=de,Jk=As,Qk=mu.trim,Zk=Re("".charAt),$k=Wk.parseFloat,eT=Wk.Symbol,tT=eT&&eT.iterator,rT=1/$k("\t\n\v\f\r \u2028\u2029\ufeff-0")!=-1/0||tT&&!Yk((function(){$k(Object(tT))}))?function(e){var t=Qk(Jk(e)),r=$k(t);return 0===r&&"-"==Zk(t,0)?-0:r}:$k;ro({global:!0,forced:parseFloat!=rT},{parseFloat:rT});var nT=ro,iT=Lm,oT=de,aT=et,sT=qe,cT=C_,uT=kg,dT=$n,lT=iT&&iT.prototype;if(nT({target:"Promise",proto:!0,real:!0,forced:!!iT&&oT((function(){lT.finally.call({then:function(){}},(function(){}))}))},{finally:function(e){var t=cT(this,aT("Promise")),r=sT(e);return this.then(r?function(r){return uT(t,e()).then((function(){return r}))}:e,r?function(r){return uT(t,e()).then((function(){throw r}))}:e)}}),sT(iT)){var hT=aT("Promise").prototype.finally;lT.finally!==hT&&dT(lT,"finally",hT,{unsafe:!0})}function fT(e,t){var r=e&&e.navigator,n=e&&e.MediaStreamTrack;if(r.getUserMedia=function(e,t,n){Ev("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),r.mediaDevices.getUserMedia(e).then(t,n)},!(t.version>55&&"autoGainControl"in r.mediaDevices.getSupportedConstraints())){var i=function(e,t,r){t in e&&!(r in e)&&(e[r]=e[t],delete e[t])},o=r.mediaDevices.getUserMedia.bind(r.mediaDevices);if(r.mediaDevices.getUserMedia=function(e){return"object"===a(e)&&"object"===a(e.audio)&&(e=JSON.parse(JSON.stringify(e)),i(e.audio,"autoGainControl","mozAutoGainControl"),i(e.audio,"noiseSuppression","mozNoiseSuppression")),o(e)},n&&n.prototype.getSettings){var s=n.prototype.getSettings;n.prototype.getSettings=function(){var e=s.apply(this,arguments);return i(e,"mozAutoGainControl","autoGainControl"),i(e,"mozNoiseSuppression","noiseSuppression"),e}}if(n&&n.prototype.applyConstraints){var c=n.prototype.applyConstraints;n.prototype.applyConstraints=function(e){return"audio"===this.kind&&"object"===a(e)&&(e=JSON.parse(JSON.stringify(e)),i(e,"autoGainControl","mozAutoGainControl"),i(e,"noiseSuppression","mozNoiseSuppression")),c.apply(this,[e])}}}}function pT(e){"object"===a(e)&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get:function(){return{receiver:this.receiver}}})}function vT(e,t){if("object"===a(e)&&(e.RTCPeerConnection||e.mozRTCPeerConnection)){!e.RTCPeerConnection&&e.mozRTCPeerConnection&&(e.RTCPeerConnection=e.mozRTCPeerConnection),t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){var r=e.RTCPeerConnection.prototype[t],n=h({},t,(function(){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}));e.RTCPeerConnection.prototype[t]=n[t]}));var r={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},n=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){var e=Array.prototype.slice.call(arguments),i=e[0],o=e[1],a=e[2];return n.apply(this,[i||null]).then((function(e){if(t.version<53&&!o)try{e.forEach((function(e){e.type=r[e.type]||e.type}))}catch(n){if("TypeError"!==n.name)throw n;e.forEach((function(t,n){e.set(n,Object.assign({},t,{type:r[t.type]||t.type}))}))}return e})).then(o,a)}}}function _T(e){if("object"===a(e)&&e.RTCPeerConnection&&e.RTCRtpSender&&(!e.RTCRtpSender||!("getStats"in e.RTCRtpSender.prototype))){var t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){var e=this,r=t.apply(this,[]);return r.forEach((function(t){return t._pc=e})),r});var r=e.RTCPeerConnection.prototype.addTrack;r&&(e.RTCPeerConnection.prototype.addTrack=function(){var e=r.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 mT(e){if("object"===a(e)&&e.RTCPeerConnection&&e.RTCRtpSender&&(!e.RTCRtpSender||!("getStats"in e.RTCRtpReceiver.prototype))){var t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){var e=this,r=t.apply(this,[]);return r.forEach((function(t){return t._pc=e})),r}),yv(e,"track",(function(e){return e.receiver._pc=e.srcElement,e})),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}}function yT(e){e.RTCPeerConnection&&!("removeStream"in e.RTCPeerConnection.prototype)&&(e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;Ev("removeStream","removeTrack"),this.getSenders().forEach((function(r){r.track&&e.getTracks().includes(r.track)&&t.removeTrack(r)}))})}function gT(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function ST(e){if("object"===a(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.addTransceiver;t&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];var e=arguments[1]&&arguments[1].sendEncodings;void 0===e&&(e=[]);var r=(e=k(e)).length>0;r&&e.forEach((function(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")}));var n=t.apply(this,arguments);if(r){var i=n.sender,o=i.getParameters();(!("encodings"in o)||1===o.encodings.length&&0===Object.keys(o.encodings[0]).length)&&(o.encodings=e,i.sendEncodings=e,this.setParametersPromises.push(i.setParameters(o).then((function(){delete i.sendEncodings})).catch((function(){delete i.sendEncodings}))))}return n})}}function bT(e){if("object"===a(e)&&e.RTCRtpSender){var t=e.RTCRtpSender.prototype.getParameters;t&&(e.RTCRtpSender.prototype.getParameters=function(){var e=t.apply(this,arguments);return"encodings"in e||(e.encodings=[].concat(this.sendEncodings||[{}])),e})}}function ET(e){if("object"===a(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(){var e=arguments,r=this;return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((function(){return t.apply(r,e)})).finally((function(){r.setParametersPromises=[]})):t.apply(this,arguments)}}}function kT(e){if("object"===a(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.createAnswer;e.RTCPeerConnection.prototype.createAnswer=function(){var e=arguments,r=this;return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((function(){return t.apply(r,e)})).finally((function(){r.setParametersPromises=[]})):t.apply(this,arguments)}}}var TT=Object.freeze(Object.defineProperty({__proto__:null,shimOnTrack:pT,shimPeerConnection:vT,shimSenderGetStats:_T,shimReceiverGetStats:mT,shimRemoveStream:yT,shimRTCDataChannel:gT,shimAddTransceiver:ST,shimGetParameters:bT,shimCreateOffer:ET,shimCreateAnswer:kT,shimGetUserMedia:fT,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&(e.navigator.mediaDevices.getDisplayMedia=function(r){if(!r||!r.video){var n=new DOMException("getDisplayMedia without video constraints is undefined");return n.name="NotFoundError",n.code=8,Promise.reject(n)}return!0===r.video?r.video={mediaSource:t}:r.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(r)})}},Symbol.toStringTag,{value:"Module"}));function IT(e){if("object"===a(e)&&e.RTCPeerConnection){if("getLocalStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in e.RTCPeerConnection.prototype)){var t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addStream=function(e){var r=this;this._localStreams||(this._localStreams=[]),this._localStreams.includes(e)||this._localStreams.push(e),e.getAudioTracks().forEach((function(n){return t.call(r,n,e)})),e.getVideoTracks().forEach((function(n){return t.call(r,n,e)}))},e.RTCPeerConnection.prototype.addTrack=function(e){for(var r=this,n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];return i&&i.forEach((function(e){r._localStreams?r._localStreams.includes(e)||r._localStreams.push(e):r._localStreams=[e]})),t.apply(this,arguments)}}"removeStream"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;this._localStreams||(this._localStreams=[]);var r=this._localStreams.indexOf(e);if(-1!==r){this._localStreams.splice(r,1);var n=e.getTracks();this.getSenders().forEach((function(e){n.includes(e.track)&&t.removeTrack(e)}))}})}}function AT(e){if("object"===a(e)&&e.RTCPeerConnection&&("getRemoteStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in e.RTCPeerConnection.prototype))){Object.defineProperty(e.RTCPeerConnection.prototype,"onaddstream",{get:function(){return this._onaddstream},set:function(e){var t=this;this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=e),this.addEventListener("track",this._onaddstreampoly=function(e){e.streams.forEach((function(e){if(t._remoteStreams||(t._remoteStreams=[]),!t._remoteStreams.includes(e)){t._remoteStreams.push(e);var r=new Event("addstream");r.stream=e,t.dispatchEvent(r)}}))})}});var t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){var e=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(t){t.streams.forEach((function(t){if(e._remoteStreams||(e._remoteStreams=[]),!(e._remoteStreams.indexOf(t)>=0)){e._remoteStreams.push(t);var r=new Event("addstream");r.stream=t,e.dispatchEvent(r)}}))}),t.apply(e,arguments)}}}function RT(e){if("object"===a(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype,r=t.createOffer,n=t.createAnswer,i=t.setLocalDescription,o=t.setRemoteDescription,s=t.addIceCandidate;t.createOffer=function(e,t){var n=arguments.length>=2?arguments[2]:arguments[0],i=r.apply(this,[n]);return t?(i.then(e,t),Promise.resolve()):i},t.createAnswer=function(e,t){var r=arguments.length>=2?arguments[2]:arguments[0],i=n.apply(this,[r]);return t?(i.then(e,t),Promise.resolve()):i};var c=function(e,t,r){var n=i.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n};t.setLocalDescription=c,c=function(e,t,r){var n=o.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n},t.setRemoteDescription=c,c=function(e,t,r){var n=s.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n},t.addIceCandidate=c}}function wT(e){var t=e&&e.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){var r=t.mediaDevices,n=r.getUserMedia.bind(r);t.mediaDevices.getUserMedia=function(e){return n(CT(e))}}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,r,n){t.mediaDevices.getUserMedia(e).then(r,n)}.bind(t))}function CT(e){return e&&void 0!==e.video?Object.assign({},e,{video:Iv(e.video)}):e}function OT(e){if(e.RTCPeerConnection){var t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,r){if(e&&e.iceServers){for(var n=[],i=0;i<e.iceServers.length;i++){var o=e.iceServers[i];!o.hasOwnProperty("urls")&&o.hasOwnProperty("url")?(Ev("RTCIceServer.url","RTCIceServer.urls"),(o=JSON.parse(JSON.stringify(o))).urls=o.url,delete o.url,n.push(o)):n.push(e.iceServers[i])}e.iceServers=n}return new t(e,r)},e.RTCPeerConnection.prototype=t.prototype,"generateCertificate"in t&&Object.defineProperty(e.RTCPeerConnection,"generateCertificate",{get:function(){return t.generateCertificate}})}}function xT(e){"object"===a(e)&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get:function(){return{receiver:this.receiver}}})}function DT(e){var t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(e){if(e){void 0!==e.offerToReceiveAudio&&(e.offerToReceiveAudio=!!e.offerToReceiveAudio);var r=this.getTransceivers().find((function(e){return"audio"===e.receiver.track.kind}));!1===e.offerToReceiveAudio&&r?"sendrecv"===r.direction?r.setDirection?r.setDirection("sendonly"):r.direction="sendonly":"recvonly"===r.direction&&(r.setDirection?r.setDirection("inactive"):r.direction="inactive"):!0!==e.offerToReceiveAudio||r||this.addTransceiver("audio",{direction:"recvonly"}),void 0!==e.offerToReceiveVideo&&(e.offerToReceiveVideo=!!e.offerToReceiveVideo);var n=this.getTransceivers().find((function(e){return"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",{direction:"recvonly"})}return t.apply(this,arguments)}}function NT(e){"object"!==a(e)||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var PT=Object.freeze(Object.defineProperty({__proto__:null,shimLocalStreamsAPI:IT,shimRemoteStreamsAPI:AT,shimCallbacksAPI:RT,shimGetUserMedia:wT,shimConstraints:CT,shimRTCIceServerUrls:OT,shimTrackEventTransceiver:xT,shimCreateOfferLegacy:DT,shimAudioContext:NT},Symbol.toStringTag,{value:"Module"})),MT=ve;ro({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return MT(URL.prototype.toString,this)}});var LT=Re(1..valueOf),UT=le,VT=ce,FT=Re,BT=Wi,jT=$n,GT=Xt,HT=kh,zT=tt,XT=yt,KT=vr,qT=de,WT=ei.f,YT=ue.f,JT=Pr.f,QT=LT,ZT=mu.trim,$T="Number",eI=VT.Number,tI=eI.prototype,rI=VT.TypeError,nI=FT("".slice),iI=FT("".charCodeAt),oI=function(e){var t=KT(e,"number");return"bigint"==typeof t?t:aI(t)},aI=function(e){var t,r,n,i,o,a,s,c,u=KT(e,"number");if(XT(u))throw rI("Cannot convert a Symbol value to a number");if("string"==typeof u&&u.length>2)if(u=ZT(u),43===(t=iI(u,0))||45===t){if(88===(r=iI(u,2))||120===r)return NaN}else if(48===t){switch(iI(u,1)){case 66:case 98:n=2,i=49;break;case 79:case 111:n=8,i=55;break;default:return+u}for(a=(o=nI(u,2)).length,s=0;s<a;s++)if((c=iI(o,s))<48||c>i)return NaN;return parseInt(o,n)}return+u};if(BT($T,!eI(" 0o1")||!eI("0b1")||eI("+0x1"))){for(var sI,cI=function(e){var t=arguments.length<1?0:eI(oI(e)),r=this;return zT(tI,r)&&qT((function(){QT(r)}))?HT(Object(t),r,cI):t},uI=UT?WT(eI):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,isFinite,isInteger,isNaN,isSafeInteger,parseFloat,parseInt,fromString,range".split(","),dI=0;uI.length>dI;dI++)GT(eI,sI=uI[dI])&&!GT(cI,sI)&&JT(cI,sI,YT(eI,sI));cI.prototype=tI,tI.constructor=cI,jT(VT,$T,cI,{constructor:!0})}var lI=sn.PROPER,hI=de,fI=uu,pI=mu.trim;ro({target:"String",proto:!0,forced:function(e){return hI((function(){return!!fI[e]()||"
"!=="
"[e]()||lI&&fI[e].name!==e}))}("trim")},{trim:function(){return pI(this)}});var vI,_I,mI={exports:{}};vI=mI,(_I={generateIdentifier:function(){return Math.random().toString(36).substr(2,10)}}).localCName=_I.generateIdentifier(),_I.splitLines=function(e){return e.trim().split("\n").map((function(e){return e.trim()}))},_I.splitSections=function(e){return e.split("\nm=").map((function(e,t){return(t>0?"m="+e:e).trim()+"\r\n"}))},_I.getDescription=function(e){var t=_I.splitSections(e);return t&&t[0]},_I.getMediaSections=function(e){var t=_I.splitSections(e);return t.shift(),t},_I.matchPrefix=function(e,t){return _I.splitLines(e).filter((function(e){return 0===e.indexOf(t)}))},_I.parseCandidate=function(e){for(var t,r={foundation:(t=0===e.indexOf("a=candidate:")?e.substring(12).split(" "):e.substring(10).split(" "))[0],component:{1:"rtp",2:"rtcp"}[t[1]]||t[1],protocol:t[2].toLowerCase(),priority:parseInt(t[3],10),ip:t[4],address:t[4],port:parseInt(t[5],10),type:t[7]},n=8;n<t.length;n+=2)switch(t[n]){case"raddr":r.relatedAddress=t[n+1];break;case"rport":r.relatedPort=parseInt(t[n+1],10);break;case"tcptype":r.tcpType=t[n+1];break;case"ufrag":r.ufrag=t[n+1],r.usernameFragment=t[n+1];break;default:void 0===r[t[n]]&&(r[t[n]]=t[n+1])}return r},_I.writeCandidate=function(e){var t=[];t.push(e.foundation);var r=e.component;"rtp"===r?t.push(1):"rtcp"===r?t.push(2):t.push(r),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(" ")},_I.parseIceOptions=function(e){return e.substr(14).split(" ")},_I.parseRtpMap=function(e){var t=e.substr(9).split(" "),r={payloadType:parseInt(t.shift(),10)};return t=t[0].split("/"),r.name=t[0],r.clockRate=parseInt(t[1],10),r.channels=3===t.length?parseInt(t[2],10):1,r.numChannels=r.channels,r},_I.writeRtpMap=function(e){var t=e.payloadType;void 0!==e.preferredPayloadType&&(t=e.preferredPayloadType);var r=e.channels||e.numChannels||1;return"a=rtpmap:"+t+" "+e.name+"/"+e.clockRate+(1!==r?"/"+r:"")+"\r\n"},_I.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]}},_I.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+"\r\n"},_I.parseFmtp=function(e){for(var t,r={},n=e.substr(e.indexOf(" ")+1).split(";"),i=0;i<n.length;i++)r[(t=n[i].trim().split("="))[0].trim()]=t[1];return r},_I.writeFmtp=function(e){var t="",r=e.payloadType;if(void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.parameters&&Object.keys(e.parameters).length){var n=[];Object.keys(e.parameters).forEach((function(t){void 0!==e.parameters[t]?n.push(t+"="+e.parameters[t]):n.push(t)})),t+="a=fmtp:"+r+" "+n.join(";")+"\r\n"}return t},_I.parseRtcpFb=function(e){var t=e.substr(e.indexOf(" ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},_I.writeRtcpFb=function(e){var t="",r=e.payloadType;return void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach((function(e){t+="a=rtcp-fb:"+r+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+"\r\n"})),t},_I.parseSsrcMedia=function(e){var t=e.indexOf(" "),r={ssrc:parseInt(e.substr(7,t-7),10)},n=e.indexOf(":",t);return n>-1?(r.attribute=e.substr(t+1,n-t-1),r.value=e.substr(n+1)):r.attribute=e.substr(t+1),r},_I.parseSsrcGroup=function(e){var t=e.substr(13).split(" ");return{semantics:t.shift(),ssrcs:t.map((function(e){return parseInt(e,10)}))}},_I.getMid=function(e){var t=_I.matchPrefix(e,"a=mid:")[0];if(t)return t.substr(6)},_I.parseFingerprint=function(e){var t=e.substr(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1].toUpperCase()}},_I.getDtlsParameters=function(e,t){return{role:"auto",fingerprints:_I.matchPrefix(e+t,"a=fingerprint:").map(_I.parseFingerprint)}},_I.writeDtlsParameters=function(e,t){var r="a=setup:"+t+"\r\n";return e.fingerprints.forEach((function(e){r+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"})),r},_I.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)}},_I.writeCryptoLine=function(e){return"a=crypto:"+e.tag+" "+e.cryptoSuite+" "+("object"===a(e.keyParams)?_I.writeCryptoKeyParams(e.keyParams):e.keyParams)+(e.sessionParams?" "+e.sessionParams.join(" "):"")+"\r\n"},_I.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}},_I.writeCryptoKeyParams=function(e){return e.keyMethod+":"+e.keySalt+(e.lifeTime?"|"+e.lifeTime:"")+(e.mkiValue&&e.mkiLength?"|"+e.mkiValue+":"+e.mkiLength:"")},_I.getCryptoParameters=function(e,t){return _I.matchPrefix(e+t,"a=crypto:").map(_I.parseCryptoLine)},_I.getIceParameters=function(e,t){var r=_I.matchPrefix(e+t,"a=ice-ufrag:")[0],n=_I.matchPrefix(e+t,"a=ice-pwd:")[0];return r&&n?{usernameFragment:r.substr(12),password:n.substr(10)}:null},_I.writeIceParameters=function(e){var t="a=ice-ufrag:"+e.usernameFragment+"\r\na=ice-pwd:"+e.password+"\r\n";return e.iceLite&&(t+="a=ice-lite\r\n"),t},_I.parseRtpParameters=function(e){for(var t={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},r=_I.splitLines(e)[0].split(" "),n=3;n<r.length;n++){var i=r[n],o=_I.matchPrefix(e,"a=rtpmap:"+i+" ")[0];if(o){var a=_I.parseRtpMap(o),s=_I.matchPrefix(e,"a=fmtp:"+i+" ");switch(a.parameters=s.length?_I.parseFmtp(s[0]):{},a.rtcpFeedback=_I.matchPrefix(e,"a=rtcp-fb:"+i+" ").map(_I.parseRtcpFb),t.codecs.push(a),a.name.toUpperCase()){case"RED":case"ULPFEC":t.fecMechanisms.push(a.name.toUpperCase())}}}return _I.matchPrefix(e,"a=extmap:").forEach((function(e){t.headerExtensions.push(_I.parseExtmap(e))})),t},_I.writeRtpDescription=function(e,t){var r="";r+="m="+e+" ",r+=t.codecs.length>0?"9":"0",r+=" UDP/TLS/RTP/SAVPF ",r+=t.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",t.codecs.forEach((function(e){r+=_I.writeRtpMap(e),r+=_I.writeFmtp(e),r+=_I.writeRtcpFb(e)}));var n=0;return t.codecs.forEach((function(e){e.maxptime>n&&(n=e.maxptime)})),n>0&&(r+="a=maxptime:"+n+"\r\n"),t.headerExtensions&&t.headerExtensions.forEach((function(e){r+=_I.writeExtmap(e)})),r},_I.parseRtpEncodingParameters=function(e){var t,r=[],n=_I.parseRtpParameters(e),i=-1!==n.fecMechanisms.indexOf("RED"),o=-1!==n.fecMechanisms.indexOf("ULPFEC"),a=_I.matchPrefix(e,"a=ssrc:").map((function(e){return _I.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute})),s=a.length>0&&a[0].ssrc,c=_I.matchPrefix(e,"a=ssrc-group:FID").map((function(e){return e.substr(17).split(" ").map((function(e){return parseInt(e,10)}))}));c.length>0&&c[0].length>1&&c[0][0]===s&&(t=c[0][1]),n.codecs.forEach((function(e){if("RTX"===e.name.toUpperCase()&&e.parameters.apt){var n={ssrc:s,codecPayloadType:parseInt(e.parameters.apt,10)};s&&t&&(n.rtx={ssrc:t}),r.push(n),i&&((n=JSON.parse(JSON.stringify(n))).fec={ssrc:s,mechanism:o?"red+ulpfec":"red"},r.push(n))}})),0===r.length&&s&&r.push({ssrc:s});var u=_I.matchPrefix(e,"b=");return u.length&&(u=0===u[0].indexOf("b=TIAS:")?parseInt(u[0].substr(7),10):0===u[0].indexOf("b=AS:")?1e3*parseInt(u[0].substr(5),10)*.95-16e3:void 0,r.forEach((function(e){e.maxBitrate=u}))),r},_I.parseRtcpParameters=function(e){var t={},r=_I.matchPrefix(e,"a=ssrc:").map((function(e){return _I.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute}))[0];r&&(t.cname=r.value,t.ssrc=r.ssrc);var n=_I.matchPrefix(e,"a=rtcp-rsize");t.reducedSize=n.length>0,t.compound=0===n.length;var i=_I.matchPrefix(e,"a=rtcp-mux");return t.mux=i.length>0,t},_I.writeRtcpParameters=function(e){var t="";return e.reducedSize&&(t+="a=rtcp-rsize\r\n"),e.mux&&(t+="a=rtcp-mux\r\n"),void 0!==e.ssrc&&e.cname&&(t+="a=ssrc:"+e.ssrc+" cname:"+e.cname+"\r\n"),t},_I.parseMsid=function(e){var t,r=_I.matchPrefix(e,"a=msid:");if(1===r.length)return{stream:(t=r[0].substr(7).split(" "))[0],track:t[1]};var n=_I.matchPrefix(e,"a=ssrc:").map((function(e){return _I.parseSsrcMedia(e)})).filter((function(e){return"msid"===e.attribute}));return n.length>0?{stream:(t=n[0].value.split(" "))[0],track:t[1]}:void 0},_I.parseSctpDescription=function(e){var t,r=_I.parseMLine(e),n=_I.matchPrefix(e,"a=max-message-size:");n.length>0&&(t=parseInt(n[0].substr(19),10)),isNaN(t)&&(t=65536);var i=_I.matchPrefix(e,"a=sctp-port:");if(i.length>0)return{port:parseInt(i[0].substr(12),10),protocol:r.fmt,maxMessageSize:t};var o=_I.matchPrefix(e,"a=sctpmap:");if(o.length>0){var a=o[0].substr(10).split(" ");return{port:parseInt(a[0],10),protocol:a[1],maxMessageSize:t}}},_I.writeSctpDescription=function(e,t){var r=[];return r="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&&r.push("a=max-message-size:"+t.maxMessageSize+"\r\n"),r.join("")},_I.generateSessionId=function(){return Math.random().toString().substr(2,21)},_I.writeSessionBoilerplate=function(e,t,r){var n=void 0!==t?t:2;return"v=0\r\no="+(r||"thisisadapterortc")+" "+(e||_I.generateSessionId())+" "+n+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},_I.getDirection=function(e,t){for(var r=_I.splitLines(e),n=0;n<r.length;n++)switch(r[n]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return r[n].substr(2)}return t?_I.getDirection(t):"sendrecv"},_I.getKind=function(e){return _I.splitLines(e)[0].split(" ")[0].substr(2)},_I.isRejected=function(e){return"0"===e.split(" ",2)[1]},_I.parseMLine=function(e){var t=_I.splitLines(e)[0].substr(2).split(" ");return{kind:t[0],port:parseInt(t[1],10),protocol:t[2],fmt:t.slice(3).join(" ")}},_I.parseOLine=function(e){var t=_I.matchPrefix(e,"o=")[0].substr(2).split(" ");return{username:t[0],sessionId:t[1],sessionVersion:parseInt(t[2],10),netType:t[3],addressType:t[4],address:t[5]}},_I.isValidSDP=function(e){if("string"!=typeof e||0===e.length)return!1;for(var t=_I.splitLines(e),r=0;r<t.length;r++)if(t[r].length<2||"="!==t[r].charAt(1))return!1;return!0},vI.exports=_I;var yI=mI.exports,gI=e({__proto__:null,default:yI},[mI.exports]);function SI(e){if(!(!e.RTCIceCandidate||e.RTCIceCandidate&&"foundation"in e.RTCIceCandidate.prototype)){var t=e.RTCIceCandidate;e.RTCIceCandidate=function(e){if("object"===a(e)&&e.candidate&&0===e.candidate.indexOf("a=")&&((e=JSON.parse(JSON.stringify(e))).candidate=e.candidate.substr(2)),e.candidate&&e.candidate.length){var r=new t(e),n=yI.parseCandidate(e.candidate),i=Object.assign(r,n);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,yv(e,"icecandidate",(function(t){return t.candidate&&Object.defineProperty(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t}))}}function bI(e){!e.RTCIceCandidate||e.RTCIceCandidate&&"relayProtocol"in e.RTCIceCandidate.prototype||yv(e,"icecandidate",(function(e){if(e.candidate){var t=yI.parseCandidate(e.candidate.candidate);"relay"===t.type&&(e.candidate.relayProtocol={0:"tls",1:"tcp",2:"udp"}[t.priority>>24])}return e}))}function EI(e,t){if(e.RTCPeerConnection){"sctp"in e.RTCPeerConnection.prototype||Object.defineProperty(e.RTCPeerConnection.prototype,"sctp",{get:function(){return void 0===this._sctp?null:this._sctp}});var r=function(e){if(!e||!e.sdp)return!1;var t=yI.splitSections(e.sdp);return t.shift(),t.some((function(e){var t=yI.parseMLine(e);return t&&"application"===t.kind&&-1!==t.protocol.indexOf("SCTP")}))},n=function(e){var t=e.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===t||t.length<2)return-1;var r=parseInt(t[1],10);return r!=r?-1:r},i=function(e){var r=65536;return"firefox"===t.browser&&(r=t.version<57?-1===e?16384:2147483637:t.version<60?57===t.version?65535:65536:2147483637),r},o=function(e,r){var n=65536;"firefox"===t.browser&&57===t.version&&(n=65535);var i=yI.matchPrefix(e.sdp,"a=max-message-size:");return i.length>0?n=parseInt(i[0].substr(19),10):"firefox"===t.browser&&-1!==r&&(n=2147483637),n},a=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,"chrome"===t.browser&&t.version>=76){var e=this.getConfiguration(),s=e.sdpSemantics;"plan-b"===s&&Object.defineProperty(this,"sctp",{get:function(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0})}if(r(arguments[0])){var c,u=n(arguments[0]),d=i(u),l=o(arguments[0],u);c=0===d&&0===l?Number.POSITIVE_INFINITY:0===d||0===l?Math.max(d,l):Math.min(d,l);var h={};Object.defineProperty(h,"maxMessageSize",{get:function(){return c}}),this._sctp=h}return a.apply(this,arguments)}}}function kI(e){if(e.RTCPeerConnection&&"createDataChannel"in e.RTCPeerConnection.prototype){var t=e.RTCPeerConnection.prototype.createDataChannel;e.RTCPeerConnection.prototype.createDataChannel=function(){var e=t.apply(this,arguments);return r(e,this),e},yv(e,"datachannel",(function(e){return r(e.channel,e.target),e}))}function r(e,t){var r=e.send;e.send=function(){var n=arguments[0],i=n.length||n.size||n.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 r.apply(e,arguments)}}}function TI(e){if(e.RTCPeerConnection&&!("connectionState"in e.RTCPeerConnection.prototype)){var t=e.RTCPeerConnection.prototype;Object.defineProperty(t,"connectionState",{get:function(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(t,"onconnectionstatechange",{get:function(){return this._onconnectionstatechange||null},set:function(e){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),e&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=e)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach((function(e){var r=t[e];t[e]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=function(e){var t=e.target;if(t._lastConnectionState!==t.connectionState){t._lastConnectionState=t.connectionState;var r=new Event("connectionstatechange",e);t.dispatchEvent(r)}return e},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),r.apply(this,arguments)}}))}}function II(e,t){if(e.RTCPeerConnection&&!("chrome"===t.browser&&t.version>=71||"safari"===t.browser&&t.version>=605)){var r=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(t){if(t&&t.sdp&&-1!==t.sdp.indexOf("\na=extmap-allow-mixed")){var n=t.sdp.split("\n").filter((function(e){return"a=extmap-allow-mixed"!==e.trim()})).join("\n");e.RTCSessionDescription&&t instanceof e.RTCSessionDescription?arguments[0]=new e.RTCSessionDescription({type:t.type,sdp:n}):t.sdp=n}return r.apply(this,arguments)}}}function AI(e,t){if(e.RTCPeerConnection&&e.RTCPeerConnection.prototype){var r=e.RTCPeerConnection.prototype.addIceCandidate;r&&0!==r.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():r.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}}function RI(e,t){if(e.RTCPeerConnection&&e.RTCPeerConnection.prototype){var r=e.RTCPeerConnection.prototype.setLocalDescription;r&&0!==r.length&&(e.RTCPeerConnection.prototype.setLocalDescription=function(){var e=this,t=arguments[0]||{};if("object"!==a(t)||t.type&&t.sdp)return r.apply(this,arguments);if(!(t={type:t.type,sdp:t.sdp}).type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":t.type="offer";break;default:t.type="answer"}if(t.sdp||"offer"!==t.type&&"answer"!==t.type)return r.apply(this,[t]);var n="offer"===t.type?this.createOffer:this.createAnswer;return n.apply(this).then((function(t){return r.apply(e,[t])}))})}}var wI=Object.freeze(Object.defineProperty({__proto__:null,shimRTCIceCandidate:SI,shimRTCIceCandidateRelayProtocol:bI,shimMaxMessageSize:EI,shimSendThrowTypeError:kI,shimConnectionState:TI,removeExtmapAllowMixed:II,shimAddIceCandidateNullOrEmpty:AI,shimParameterlessSetLocalDescription:RI},Symbol.toStringTag,{value:"Module"}));!function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.window,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{shimChrome:!0,shimFirefox:!0,shimSafari:!0},n=bv,i=kv(t),o={browserDetails:i,commonShim:wI,extractVersion:mv,disableLog:gv,disableWarnings:Sv,sdp:gI};switch(i.browser){case"chrome":if(!Bk||!Lk||!r.shimChrome)return n("Chrome shim is not included in this adapter release."),o;if(null===i.version)return n("Chrome shim can not determine version, not shimming."),o;n("adapter.js shimming chrome."),o.browserShim=Bk,AI(t,i),RI(t),wk(t,i),Ck(t),Lk(t,i),Ok(t),Mk(t,i),xk(t),Dk(t),Nk(t),Uk(t,i),SI(t),bI(t),TI(t),EI(t,i),kI(t),II(t,i);break;case"firefox":if(!TT||!vT||!r.shimFirefox)return n("Firefox shim is not included in this adapter release."),o;n("adapter.js shimming firefox."),o.browserShim=TT,AI(t,i),RI(t),fT(t,i),vT(t,i),pT(t),yT(t),_T(t),mT(t),gT(t),ST(t),bT(t),ET(t),kT(t),SI(t),TI(t),EI(t,i),kI(t);break;case"safari":if(!PT||!r.shimSafari)return n("Safari shim is not included in this adapter release."),o;n("adapter.js shimming safari."),o.browserShim=PT,AI(t,i),RI(t),OT(t),DT(t),RT(t),IT(t),AT(t),xT(t),wT(t),NT(t),SI(t),bI(t),EI(t,i),kI(t),II(t,i);break;default:n("Unsupported browser!")}}({window:"undefined"==typeof window?void 0:window});var CI=rl,OI=Math.floor,xI=function(e,t){var r=e.length,n=OI(r/2);return r<8?DI(e,t):NI(e,xI(CI(e,0,n),t),xI(CI(e,n),t),t)},DI=function(e,t){for(var r,n,i=e.length,o=1;o<i;){for(n=o,r=e[o];n&&t(e[n-1],r)>0;)e[n]=e[--n];n!==o++&&(e[n]=r)}return e},NI=function(e,t,r,n){for(var i=t.length,o=r.length,a=0,s=0;a<i||s<o;)e[a+s]=a<i&&s<o?n(t[a],r[s])<=0?t[a++]:r[s++]:a<i?t[a++]:r[s++];return e},PI=xI,MI=rt.match(/firefox\/(\d+)/i),LI=!!MI&&+MI[1],UI=/MSIE|Trident/.test(rt),VI=rt.match(/AppleWebKit\/(\d+)\./),FI=!!VI&&+VI[1],BI=ro,jI=Re,GI=Tt,HI=Gt,zI=fi,XI=r_,KI=As,qI=de,WI=PI,YI=Ca,JI=LI,QI=UI,ZI=ut,$I=FI,eA=[],tA=jI(eA.sort),rA=jI(eA.push),nA=qI((function(){eA.sort(void 0)})),iA=qI((function(){eA.sort(null)})),oA=YI("sort"),aA=!qI((function(){if(ZI)return ZI<70;if(!(JI&&JI>3)){if(QI)return!0;if($I)return $I<603;var e,t,r,n,i="";for(e=65;e<76;e++){switch(t=String.fromCharCode(e),e){case 66:case 69:case 70:case 72:r=3;break;case 68:case 71:r=4;break;default:r=2}for(n=0;n<47;n++)eA.push({k:t+n,v:r})}for(eA.sort((function(e,t){return t.v-e.v})),n=0;n<eA.length;n++)t=eA[n].k.charAt(0),i.charAt(i.length-1)!==t&&(i+=t);return"DGBEFHACIJK"!==i}}));BI({target:"Array",proto:!0,forced:nA||!iA||!oA||!aA},{sort:function(e){void 0!==e&&GI(e);var t=HI(this);if(aA)return void 0===e?tA(t):tA(t,e);var r,n,i=[],o=zI(t);for(n=0;n<o;n++)n in t&&rA(i,t[n]);for(WI(i,function(e){return function(t,r){return void 0===r?-1:void 0===t?1:void 0!==e?+e(t,r)||0:KI(t)>KI(r)?1:-1}}(e)),r=zI(i),n=0;n<r;)t[n]=i[n++];for(;n<o;)XI(t,n++);return t}});var sA,cA,uA,dA={exports:{}},lA="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView,hA=lA,fA=le,pA=ce,vA=qe,_A=Je,mA=Xt,yA=So,gA=St,SA=$r,bA=$n,EA=Pr.f,kA=tt,TA=Gu,IA=pd,AA=sr,RA=Jt,wA=Ln.enforce,CA=Ln.get,OA=pA.Int8Array,xA=OA&&OA.prototype,DA=pA.Uint8ClampedArray,NA=DA&&DA.prototype,PA=OA&&TA(OA),MA=xA&&TA(xA),LA=Object.prototype,UA=pA.TypeError,VA=AA("toStringTag"),FA=RA("TYPED_ARRAY_TAG"),BA="TypedArrayConstructor",jA=hA&&!!IA&&"Opera"!==yA(pA.opera),GA=!1,HA={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},zA={BigInt64Array:8,BigUint64Array:8},XA=function(e){var t=TA(e);if(_A(t)){var r=CA(t);return r&&mA(r,BA)?r.TypedArrayConstructor:XA(t)}},KA=function(e){if(!_A(e))return!1;var t=yA(e);return mA(HA,t)||mA(zA,t)};for(sA in HA)(uA=(cA=pA[sA])&&cA.prototype)?wA(uA).TypedArrayConstructor=cA:jA=!1;for(sA in zA)(uA=(cA=pA[sA])&&cA.prototype)&&(wA(uA).TypedArrayConstructor=cA);if((!jA||!vA(PA)||PA===Function.prototype)&&(PA=function(){throw UA("Incorrect invocation")},jA))for(sA in HA)pA[sA]&&IA(pA[sA],PA);if((!jA||!MA||MA===LA)&&(MA=PA.prototype,jA))for(sA in HA)pA[sA]&&IA(pA[sA].prototype,MA);if(jA&&TA(NA)!==MA&&IA(NA,MA),fA&&!mA(MA,VA))for(sA in GA=!0,EA(MA,VA,{get:function(){return _A(this)?this[FA]:void 0}}),HA)pA[sA]&&SA(pA[sA],FA,sA);var qA={NATIVE_ARRAY_BUFFER_VIEWS:jA,TYPED_ARRAY_TAG:GA&&FA,aTypedArray:function(e){if(KA(e))return e;throw UA("Target is not a typed array")},aTypedArrayConstructor:function(e){if(vA(e)&&(!IA||kA(PA,e)))return e;throw UA(gA(e)+" is not a typed array constructor")},exportTypedArrayMethod:function(e,t,r,n){if(fA){if(r)for(var i in HA){var o=pA[i];if(o&&mA(o.prototype,e))try{delete o.prototype[e]}catch(T0){try{o.prototype[e]=t}catch(a){}}}MA[e]&&!r||bA(MA,e,r?t:jA&&xA[e]||t,n)}},exportTypedArrayStaticMethod:function(e,t,r){var n,i;if(fA){if(IA){if(r)for(n in HA)if((i=pA[n])&&mA(i,e))try{delete i[e]}catch(T0){}if(PA[e]&&!r)return;try{return bA(PA,e,r?t:jA&&PA[e]||t)}catch(T0){}}for(n in HA)!(i=pA[n])||i[e]&&!r||bA(i,e,t)}},getTypedArrayConstructor:XA,isView:function(e){if(!_A(e))return!1;var t=yA(e);return"DataView"===t||mA(HA,t)||mA(zA,t)},isTypedArray:KA,TypedArray:PA,TypedArrayPrototype:MA},WA=ce,YA=de,JA=gh,QA=qA.NATIVE_ARRAY_BUFFER_VIEWS,ZA=WA.ArrayBuffer,$A=WA.Int8Array,eR=!QA||!YA((function(){$A(1)}))||!YA((function(){new $A(-1)}))||!JA((function(e){new $A,new $A(null),new $A(1.5),new $A(e)}),!0)||YA((function(){return 1!==new $A(new ZA(2),1,void 0).length})),tR=ii,rR=li,nR=RangeError,iR=function(e){if(void 0===e)return 0;var t=tR(e),r=rR(t);if(t!==r)throw nR("Wrong length or index");return r},oR=Array,aR=Math.abs,sR=Math.pow,cR=Math.floor,uR=Math.log,dR=Math.LN2,lR=Gt,hR=ci,fR=fi,pR=function(e){for(var t=lR(this),r=fR(t),n=arguments.length,i=hR(n>1?arguments[1]:void 0,r),o=n>2?arguments[2]:void 0,a=void 0===o?r:hR(o,r);a>i;)t[i++]=e;return t},vR=ce,_R=Re,mR=le,yR=lA,gR=sn,SR=$r,bR=jh,ER=de,kR=ph,TR=ii,IR=li,AR=iR,RR={pack:function(e,t,r){var n,i,o,a=oR(r),s=8*r-t-1,c=(1<<s)-1,u=c>>1,d=23===t?sR(2,-24)-sR(2,-77):0,l=e<0||0===e&&1/e<0?1:0,h=0;for((e=aR(e))!=e||e===1/0?(i=e!=e?1:0,n=c):(n=cR(uR(e)/dR),e*(o=sR(2,-n))<1&&(n--,o*=2),(e+=n+u>=1?d/o:d*sR(2,1-u))*o>=2&&(n++,o/=2),n+u>=c?(i=0,n=c):n+u>=1?(i=(e*o-1)*sR(2,t),n+=u):(i=e*sR(2,u-1)*sR(2,t),n=0));t>=8;)a[h++]=255&i,i/=256,t-=8;for(n=n<<t|i,s+=t;s>0;)a[h++]=255&n,n/=256,s-=8;return a[--h]|=128*l,a},unpack:function(e,t){var r,n=e.length,i=8*n-t-1,o=(1<<i)-1,a=o>>1,s=i-7,c=n-1,u=e[c--],d=127&u;for(u>>=7;s>0;)d=256*d+e[c--],s-=8;for(r=d&(1<<-s)-1,d>>=-s,s+=t;s>0;)r=256*r+e[c--],s-=8;if(0===d)d=1-a;else{if(d===o)return r?NaN:u?-1/0:1/0;r+=sR(2,t),d-=a}return(u?-1:1)*r*sR(2,d-t)}},wR=Gu,CR=pd,OR=ei.f,xR=Pr.f,DR=pR,NR=rl,PR=ed,MR=gR.PROPER,LR=gR.CONFIGURABLE,UR=Ln.get,VR=Ln.set,FR="ArrayBuffer",BR="DataView",jR="Wrong index",GR=vR.ArrayBuffer,HR=GR,zR=HR&&HR.prototype,XR=vR.DataView,KR=XR&&XR.prototype,qR=Object.prototype,WR=vR.Array,YR=vR.RangeError,JR=_R(DR),QR=_R([].reverse),ZR=RR.pack,$R=RR.unpack,ew=function(e){return[255&e]},tw=function(e){return[255&e,e>>8&255]},rw=function(e){return[255&e,e>>8&255,e>>16&255,e>>24&255]},nw=function(e){return e[3]<<24|e[2]<<16|e[1]<<8|e[0]},iw=function(e){return ZR(e,23,4)},ow=function(e){return ZR(e,52,8)},aw=function(e,t){xR(e.prototype,t,{get:function(){return UR(this)[t]}})},sw=function(e,t,r,n){var i=AR(r),o=UR(e);if(i+t>o.byteLength)throw YR(jR);var a=UR(o.buffer).bytes,s=i+o.byteOffset,c=NR(a,s,s+t);return n?c:QR(c)},cw=function(e,t,r,n,i,o){var a=AR(r),s=UR(e);if(a+t>s.byteLength)throw YR(jR);for(var c=UR(s.buffer).bytes,u=a+s.byteOffset,d=n(+i),l=0;l<t;l++)c[u+l]=d[o?l:t-l-1]};if(yR){var uw=MR&&GR.name!==FR;if(ER((function(){GR(1)}))&&ER((function(){new GR(-1)}))&&!ER((function(){return new GR,new GR(1.5),new GR(NaN),1!=GR.length||uw&&!LR})))uw&&LR&&SR(GR,"name",FR);else{(HR=function(e){return kR(this,zR),new GR(AR(e))}).prototype=zR;for(var dw,lw=OR(GR),hw=0;lw.length>hw;)(dw=lw[hw++])in HR||SR(HR,dw,GR[dw]);zR.constructor=HR}CR&&wR(KR)!==qR&&CR(KR,qR);var fw=new XR(new HR(2)),pw=_R(KR.setInt8);fw.setInt8(0,2147483648),fw.setInt8(1,2147483649),!fw.getInt8(0)&&fw.getInt8(1)||bR(KR,{setInt8:function(e,t){pw(this,e,t<<24>>24)},setUint8:function(e,t){pw(this,e,t<<24>>24)}},{unsafe:!0})}else zR=(HR=function(e){kR(this,zR);var t=AR(e);VR(this,{bytes:JR(WR(t),0),byteLength:t}),mR||(this.byteLength=t)}).prototype,KR=(XR=function(e,t,r){kR(this,KR),kR(e,zR);var n=UR(e).byteLength,i=TR(t);if(i<0||i>n)throw YR("Wrong offset");if(i+(r=void 0===r?n-i:IR(r))>n)throw YR("Wrong length");VR(this,{buffer:e,byteLength:r,byteOffset:i}),mR||(this.buffer=e,this.byteLength=r,this.byteOffset=i)}).prototype,mR&&(aw(HR,"byteLength"),aw(XR,"buffer"),aw(XR,"byteLength"),aw(XR,"byteOffset")),bR(KR,{getInt8:function(e){return sw(this,1,e)[0]<<24>>24},getUint8:function(e){return sw(this,1,e)[0]},getInt16:function(e){var t=sw(this,2,e,arguments.length>1?arguments[1]:void 0);return(t[1]<<8|t[0])<<16>>16},getUint16:function(e){var t=sw(this,2,e,arguments.length>1?arguments[1]:void 0);return t[1]<<8|t[0]},getInt32:function(e){return nw(sw(this,4,e,arguments.length>1?arguments[1]:void 0))},getUint32:function(e){return nw(sw(this,4,e,arguments.length>1?arguments[1]:void 0))>>>0},getFloat32:function(e){return $R(sw(this,4,e,arguments.length>1?arguments[1]:void 0),23)},getFloat64:function(e){return $R(sw(this,8,e,arguments.length>1?arguments[1]:void 0),52)},setInt8:function(e,t){cw(this,1,e,ew,t)},setUint8:function(e,t){cw(this,1,e,ew,t)},setInt16:function(e,t){cw(this,2,e,tw,t,arguments.length>2?arguments[2]:void 0)},setUint16:function(e,t){cw(this,2,e,tw,t,arguments.length>2?arguments[2]:void 0)},setInt32:function(e,t){cw(this,4,e,rw,t,arguments.length>2?arguments[2]:void 0)},setUint32:function(e,t){cw(this,4,e,rw,t,arguments.length>2?arguments[2]:void 0)},setFloat32:function(e,t){cw(this,4,e,iw,t,arguments.length>2?arguments[2]:void 0)},setFloat64:function(e,t){cw(this,8,e,ow,t,arguments.length>2?arguments[2]:void 0)}});PR(HR,FR),PR(XR,BR);var vw={ArrayBuffer:HR,DataView:XR},_w=Je,mw=Math.floor,yw=Number.isInteger||function(e){return!_w(e)&&isFinite(e)&&mw(e)===e},gw=ii,Sw=RangeError,bw=function(e){var t=gw(e);if(t<0)throw Sw("The argument can't be less than 0");return t},Ew=RangeError,kw=function(e,t){var r=bw(e);if(r%t)throw Ew("Wrong offset");return r},Tw=So,Iw=Re("".slice),Aw=function(e){return"Big"===Iw(Tw(e),0,3)},Rw=vr,ww=TypeError,Cw=function(e){var t=Rw(e,"number");if("number"==typeof t)throw ww("Can't convert number to bigint");return BigInt(t)},Ow=ga,xw=ve,Dw=T_,Nw=Gt,Pw=fi,Mw=ql,Lw=Bl,Uw=Pl,Vw=Aw,Fw=qA.aTypedArrayConstructor,Bw=Cw,jw=ro,Gw=ce,Hw=ve,zw=le,Xw=eR,Kw=qA,qw=vw,Ww=ph,Yw=Ee,Jw=$r,Qw=yw,Zw=li,$w=iR,eC=kw,tC=yr,rC=Xt,nC=So,iC=Je,oC=yt,aC=cs,sC=tt,cC=pd,uC=ei.f,dC=function(e){var t,r,n,i,o,a,s,c,u=Dw(this),d=Nw(e),l=arguments.length,h=l>1?arguments[1]:void 0,f=void 0!==h,p=Lw(d);if(p&&!Uw(p))for(c=(s=Mw(d,p)).next,d=[];!(a=xw(c,s)).done;)d.push(a.value);for(f&&l>2&&(h=Ow(h,arguments[2])),r=Pw(d),n=new(Fw(u))(r),i=Vw(n),t=0;r>t;t++)o=f?h(d[t],t):d[t],n[t]=i?Bw(o):+o;return n},lC=Ra.forEach,hC=Kh,fC=Pr,pC=ue,vC=kh,_C=Ln.get,mC=Ln.set,yC=Ln.enforce,gC=fC.f,SC=pC.f,bC=Math.round,EC=Gw.RangeError,kC=qw.ArrayBuffer,TC=kC.prototype,IC=qw.DataView,AC=Kw.NATIVE_ARRAY_BUFFER_VIEWS,RC=Kw.TYPED_ARRAY_TAG,wC=Kw.TypedArray,CC=Kw.TypedArrayPrototype,OC=Kw.aTypedArrayConstructor,xC=Kw.isTypedArray,DC="BYTES_PER_ELEMENT",NC="Wrong length",PC=function(e,t){OC(e);for(var r=0,n=t.length,i=new e(n);n>r;)i[r]=t[r++];return i},MC=function(e,t){gC(e,t,{get:function(){return _C(this)[t]}})},LC=function(e){var t;return sC(TC,e)||"ArrayBuffer"==(t=nC(e))||"SharedArrayBuffer"==t},UC=function(e,t){return xC(e)&&!oC(t)&&t in e&&Qw(+t)&&t>=0},VC=function(e,t){return t=tC(t),UC(e,t)?Yw(2,e[t]):SC(e,t)},FC=function(e,t,r){return t=tC(t),!(UC(e,t)&&iC(r)&&rC(r,"value"))||rC(r,"get")||rC(r,"set")||r.configurable||rC(r,"writable")&&!r.writable||rC(r,"enumerable")&&!r.enumerable?gC(e,t,r):(e[t]=r.value,e)};zw?(AC||(pC.f=VC,fC.f=FC,MC(CC,"buffer"),MC(CC,"byteOffset"),MC(CC,"byteLength"),MC(CC,"length")),jw({target:"Object",stat:!0,forced:!AC},{getOwnPropertyDescriptor:VC,defineProperty:FC}),dA.exports=function(e,t,r){var n=e.match(/\d+$/)[0]/8,i=e+(r?"Clamped":"")+"Array",o="get"+e,a="set"+e,s=Gw[i],c=s,u=c&&c.prototype,d={},l=function(e,t){gC(e,t,{get:function(){return function(e,t){var r=_C(e);return r.view[o](t*n+r.byteOffset,!0)}(this,t)},set:function(e){return function(e,t,i){var o=_C(e);r&&(i=(i=bC(i))<0?0:i>255?255:255&i),o.view[a](t*n+o.byteOffset,i,!0)}(this,t,e)},enumerable:!0})};AC?Xw&&(c=t((function(e,t,r,i){return Ww(e,u),vC(iC(t)?LC(t)?void 0!==i?new s(t,eC(r,n),i):void 0!==r?new s(t,eC(r,n)):new s(t):xC(t)?PC(c,t):Hw(dC,c,t):new s($w(t)),e,c)})),cC&&cC(c,wC),lC(uC(s),(function(e){e in c||Jw(c,e,s[e])})),c.prototype=u):(c=t((function(e,t,r,i){Ww(e,u);var o,a,s,d=0,h=0;if(iC(t)){if(!LC(t))return xC(t)?PC(c,t):Hw(dC,c,t);o=t,h=eC(r,n);var f=t.byteLength;if(void 0===i){if(f%n)throw EC(NC);if((a=f-h)<0)throw EC(NC)}else if((a=Zw(i)*n)+h>f)throw EC(NC);s=a/n}else s=$w(t),o=new kC(a=s*n);for(mC(e,{buffer:o,byteOffset:h,byteLength:a,length:s,view:new IC(o)});d<s;)l(e,d++)})),cC&&cC(c,wC),u=c.prototype=aC(CC)),u.constructor!==c&&Jw(u,"constructor",c),yC(u).TypedArrayConstructor=c,RC&&Jw(u,RC,i);var h=c!=s;d[i]=c,jw({global:!0,constructor:!0,forced:h,sham:!AC},d),DC in c||Jw(c,DC,n),DC in u||Jw(u,DC,n),hC(i)}):dA.exports=function(){},(0,dA.exports)("Uint8",(function(e){return function(t,r,n){return e(this,t,r,n)}}));var BC=fi,jC=ii,GC=qA.aTypedArray;(0,qA.exportTypedArrayMethod)("at",(function(e){var t=GC(this),r=BC(t),n=jC(e),i=n>=0?n:r+n;return i<0||i>=r?void 0:t[i]}));var HC=Gt,zC=ci,XC=fi,KC=r_,qC=Math.min,WC=[].copyWithin||function(e,t){var r=HC(this),n=XC(r),i=zC(e,n),o=zC(t,n),a=arguments.length>2?arguments[2]:void 0,s=qC((void 0===a?n:zC(a,n))-o,n-i),c=1;for(o<i&&i<o+s&&(c=-1,o+=s-1,i+=s-1);s-- >0;)o in r?r[i]=r[o]:KC(r,i),i+=c,o+=c;return r},YC=qA,JC=Re(WC),QC=YC.aTypedArray;(0,YC.exportTypedArrayMethod)("copyWithin",(function(e,t){return JC(QC(this),e,t,arguments.length>2?arguments[2]:void 0)}));var ZC=Ra.every,$C=qA.aTypedArray;(0,qA.exportTypedArrayMethod)("every",(function(e){return ZC($C(this),e,arguments.length>1?arguments[1]:void 0)}));var eO=pR,tO=Cw,rO=So,nO=ve,iO=de,oO=qA.aTypedArray,aO=qA.exportTypedArrayMethod,sO=Re("".slice),cO=iO((function(){var e=0;return new Int8Array(2).fill({valueOf:function(){return e++}}),1!==e}));aO("fill",(function(e){var t=arguments.length;oO(this);var r="Big"===sO(rO(this),0,3)?tO(e):+e;return nO(eO,this,r,t>1?arguments[1]:void 0,t>2?arguments[2]:void 0)}),cO);var uO=fi,dO=function(e,t){for(var r=0,n=uO(t),i=new e(n);n>r;)i[r]=t[r++];return i},lO=C_,hO=qA.aTypedArrayConstructor,fO=qA.getTypedArrayConstructor,pO=function(e){return hO(lO(e,fO(e)))},vO=dO,_O=pO,mO=Ra.filter,yO=function(e,t){return vO(_O(e),t)},gO=qA.aTypedArray;(0,qA.exportTypedArrayMethod)("filter",(function(e){var t=mO(gO(this),e,arguments.length>1?arguments[1]:void 0);return yO(this,t)}));var SO=Ra.find,bO=qA.aTypedArray;(0,qA.exportTypedArrayMethod)("find",(function(e){return SO(bO(this),e,arguments.length>1?arguments[1]:void 0)}));var EO=Ra.findIndex,kO=qA.aTypedArray;(0,qA.exportTypedArrayMethod)("findIndex",(function(e){return EO(kO(this),e,arguments.length>1?arguments[1]:void 0)}));var TO=ga,IO=Le,AO=Gt,RO=fi,wO=function(e){var t=1==e;return function(r,n,i){for(var o,a=AO(r),s=IO(a),c=TO(n,i),u=RO(s);u-- >0;)if(c(o=s[u],u,a))switch(e){case 0:return o;case 1:return u}return t?-1:void 0}},CO={findLast:wO(0),findLastIndex:wO(1)},OO=CO.findLast,xO=qA.aTypedArray;(0,qA.exportTypedArrayMethod)("findLast",(function(e){return OO(xO(this),e,arguments.length>1?arguments[1]:void 0)}));var DO=CO.findLastIndex,NO=qA.aTypedArray;(0,qA.exportTypedArrayMethod)("findLastIndex",(function(e){return DO(NO(this),e,arguments.length>1?arguments[1]:void 0)}));var PO=Ra.forEach,MO=qA.aTypedArray;(0,qA.exportTypedArrayMethod)("forEach",(function(e){PO(MO(this),e,arguments.length>1?arguments[1]:void 0)}));var LO=yi.includes,UO=qA.aTypedArray;(0,qA.exportTypedArrayMethod)("includes",(function(e){return LO(UO(this),e,arguments.length>1?arguments[1]:void 0)}));var VO=yi.indexOf,FO=qA.aTypedArray;(0,qA.exportTypedArrayMethod)("indexOf",(function(e){return VO(FO(this),e,arguments.length>1?arguments[1]:void 0)}));var BO=ce,jO=de,GO=Re,HO=qA,zO=qd,XO=sr("iterator"),KO=BO.Uint8Array,qO=GO(zO.values),WO=GO(zO.keys),YO=GO(zO.entries),JO=HO.aTypedArray,QO=HO.exportTypedArrayMethod,ZO=KO&&KO.prototype,$O=!jO((function(){ZO[XO].call([1])})),ex=!!ZO&&ZO.values&&ZO[XO]===ZO.values&&"values"===ZO.values.name,tx=function(){return qO(JO(this))};QO("entries",(function(){return YO(JO(this))}),$O),QO("keys",(function(){return WO(JO(this))}),$O),QO("values",tx,$O||!ex,{name:"values"}),QO(XO,tx,$O||!ex,{name:"values"});var rx=qA.aTypedArray,nx=qA.exportTypedArrayMethod,ix=Re([].join);nx("join",(function(e){return ix(rx(this),e)}));var ox=Uf,ax=He,sx=ii,cx=fi,ux=Ca,dx=Math.min,lx=[].lastIndexOf,hx=!!lx&&1/[1].lastIndexOf(1,-0)<0,fx=ux("lastIndexOf"),px=hx||!fx?function(e){if(hx)return ox(lx,this,arguments)||0;var t=ax(this),r=cx(t),n=r-1;for(arguments.length>1&&(n=dx(n,sx(arguments[1]))),n<0&&(n=r+n);n>=0;n--)if(n in t&&t[n]===e)return n||0;return-1}:lx,vx=Uf,_x=px,mx=qA.aTypedArray;(0,qA.exportTypedArrayMethod)("lastIndexOf",(function(e){var t=arguments.length;return vx(_x,mx(this),t>1?[e,arguments[1]]:[e])}));var yx=Ra.map,gx=pO,Sx=qA.aTypedArray;(0,qA.exportTypedArrayMethod)("map",(function(e){return yx(Sx(this),e,arguments.length>1?arguments[1]:void 0,(function(e,t){return new(gx(e))(t)}))}));var bx=Ip.left,Ex=qA.aTypedArray;(0,qA.exportTypedArrayMethod)("reduce",(function(e){var t=arguments.length;return bx(Ex(this),e,t,t>1?arguments[1]:void 0)}));var kx=Ip.right,Tx=qA.aTypedArray;(0,qA.exportTypedArrayMethod)("reduceRight",(function(e){var t=arguments.length;return kx(Tx(this),e,t,t>1?arguments[1]:void 0)}));var Ix=qA.aTypedArray,Ax=qA.exportTypedArrayMethod,Rx=Math.floor;Ax("reverse",(function(){for(var e,t=this,r=Ix(t).length,n=Rx(r/2),i=0;i<n;)e=t[i],t[i++]=t[--r],t[r]=e;return t}));var wx=ce,Cx=ve,Ox=qA,xx=fi,Dx=kw,Nx=Gt,Px=de,Mx=wx.RangeError,Lx=wx.Int8Array,Ux=Lx&&Lx.prototype,Vx=Ux&&Ux.set,Fx=Ox.aTypedArray,Bx=Ox.exportTypedArrayMethod,jx=!Px((function(){var e=new Uint8ClampedArray(2);return Cx(Vx,e,{length:1,0:3},1),3!==e[1]})),Gx=jx&&Ox.NATIVE_ARRAY_BUFFER_VIEWS&&Px((function(){var e=new Lx(2);return e.set(1),e.set("2",1),0!==e[0]||2!==e[1]}));Bx("set",(function(e){Fx(this);var t=Dx(arguments.length>1?arguments[1]:void 0,1),r=Nx(e);if(jx)return Cx(Vx,this,r,t);var n=this.length,i=xx(r),o=0;if(i+t>n)throw Mx("Wrong length");for(;o<i;)this[t+o]=r[o++]}),!jx||Gx);var Hx=pO,zx=Nv,Xx=qA.aTypedArray;(0,qA.exportTypedArrayMethod)("slice",(function(e,t){for(var r=zx(Xx(this),e,t),n=Hx(this),i=0,o=r.length,a=new n(o);o>i;)a[i]=r[i++];return a}),de((function(){new Int8Array(1).slice()})));var Kx=Ra.some,qx=qA.aTypedArray;(0,qA.exportTypedArrayMethod)("some",(function(e){return Kx(qx(this),e,arguments.length>1?arguments[1]:void 0)}));var Wx=va,Yx=de,Jx=Tt,Qx=PI,Zx=LI,$x=UI,eD=ut,tD=FI,rD=qA.aTypedArray,nD=qA.exportTypedArrayMethod,iD=ce.Uint16Array,oD=iD&&Wx(iD.prototype.sort),aD=!(!oD||Yx((function(){oD(new iD(2),null)}))&&Yx((function(){oD(new iD(2),{})}))),sD=!!oD&&!Yx((function(){if(eD)return eD<74;if(Zx)return Zx<67;if($x)return!0;if(tD)return tD<602;var e,t,r=new iD(516),n=Array(516);for(e=0;e<516;e++)t=e%4,r[e]=515-e,n[e]=e-2*t+3;for(oD(r,(function(e,t){return(e/4|0)-(t/4|0)})),e=0;e<516;e++)if(r[e]!==n[e])return!0}));nD("sort",(function(e){return void 0!==e&&Jx(e),sD?oD(this,e):Qx(rD(this),function(e){return function(t,r){return void 0!==e?+e(t,r)||0:r!=r?-1:t!=t?1:0===t&&0===r?1/t>0&&1/r<0?1:-1:t>r}}(e))}),!sD||aD);var cD=Uf,uD=qA,dD=de,lD=Nv,hD=ce.Int8Array,fD=uD.aTypedArray,pD=uD.exportTypedArrayMethod,vD=[].toLocaleString,_D=!!hD&&dD((function(){vD.call(new hD(1))}));pD("toLocaleString",(function(){return cD(vD,_D?lD(fD(this)):fD(this),lD(arguments))}),dD((function(){return[1,2].toLocaleString()!=new hD([1,2]).toLocaleString()}))||!dD((function(){hD.prototype.toLocaleString.call([1,2])})));var mD=qA.exportTypedArrayMethod,yD=de,gD=Re,SD=ce.Uint8Array,bD=SD&&SD.prototype||{},ED=[].toString,kD=gD([].join);yD((function(){ED.call({})}))&&(ED=function(){return kD(this)});var TD=bD.toString!=ED;mD("toString",ED,TD);var ID=fi,AD=function(e,t){for(var r=ID(e),n=new t(r),i=0;i<r;i++)n[i]=e[r-i-1];return n},RD=qA.aTypedArray,wD=qA.getTypedArrayConstructor;(0,qA.exportTypedArrayMethod)("toReversed",(function(){return AD(RD(this),wD(this))}));var CD=Tt,OD=dO,xD=qA.aTypedArray,DD=qA.getTypedArrayConstructor,ND=qA.exportTypedArrayMethod,PD=Re(qA.TypedArrayPrototype.sort);ND("toSorted",(function(e){void 0!==e&&CD(e);var t=xD(this),r=OD(DD(t),t);return PD(r,e)}));var MD=fi,LD=ii,UD=RangeError,VD=function(e,t,r,n){var i=MD(e),o=LD(r),a=o<0?i+o:o;if(a>=i||a<0)throw UD("Incorrect index");for(var s=new t(i),c=0;c<i;c++)s[c]=c===a?n:e[c];return s},FD=Aw,BD=ii,jD=Cw,GD=qA.aTypedArray,HD=qA.getTypedArrayConstructor,zD=qA.exportTypedArrayMethod,XD=!!function(){try{new Int8Array(1).with(2,{valueOf:function(){throw 8}})}catch(T0){return 8===T0}}();zD("with",{with:function(e,t){var r=GD(this),n=BD(e),i=FD(r)?jD(t):+t;return VD(r,HD(r),n,i)}}.with,!XD);var KD=ro,qD=Ra.findIndex,WD=ps,YD="findIndex",JD=!0;YD in[]&&Array(1).findIndex((function(){JD=!1})),KD({target:"Array",proto:!0,forced:JD},{findIndex:function(e){return qD(this,e,arguments.length>1?arguments[1]:void 0)}}),WD(YD);var QD=ro,ZD=va,$D=ue.f,eN=li,tN=As,rN=ks,nN=Be,iN=ws,oN=ZD("".startsWith),aN=ZD("".slice),sN=Math.min,cN=iN("startsWith"),uN=!cN&&!!function(){var e=$D(String.prototype,"startsWith");return e&&!e.writable}();QD({target:"String",proto:!0,forced:!uN&&!cN},{startsWith:function(e){var t=tN(nN(this));rN(e);var r=eN(sN(arguments.length>1?arguments[1]:void 0,t.length)),n=tN(e);return oN?oN(t,n,r):aN(t,r,r+n.length)===n}});var dN=function(e){return e.INVALID_ENGINE="INVALID_ENGINE",e.INVALID_PARAMS="INVALID_PARAMS",e.INVOKED_BEFORE_JOIN_ROOM="INVOKED_BEFORE_JOIN_ROOM",e.INVALID_TOKEN="INVALID_TOKEN",e.EXPIRED_TOKEN="EXPIRED_TOKEN",e.JOIN_ROOM_FAILED="JOIN_ROOM_FAILED",e.UPDATE_TOKEN_WITH_INVALID_TOKEN="UPDATE_TOKEN_WITH_INVALID_TOKEN",e.UPDATE_TOKEN_BEFORE_JOIN="UPDATE_TOKEN_BEFORE_JOIN",e.REPEAT_JOIN="REPEAT_JOIN",e.REPEAT_PUBLISH="REPEAT_PUBLISH",e.REPEAT_PUSH="REPEAT_PUSH",e.REPEAT_PLAY="REPEAT_PLAY",e.PUBLISH_BEFORE_JOIN="PUBLISH_BEFORE_JOIN",e.UNPUBLISH_BEFORE_JOIN="UNPUBLISH_BEFORE_JOIN",e.SUBSCRIBE_BEFORE_JOIN="SUBSCRIBE_BEFORE_JOIN",e.UNSUBSCRIBE_BEFORE_JOIN="UNSUBSCRIBE_BEFORE_JOIN",e.NO_PUBLISH_PERMISSION="NO_PUBLISH_PERMISSION",e.STREAM_NOT_EXIST="STREAM_NOT_EXIST",e.EMPTY_STREAM="EMPTY_STREAM",e.NOT_CONNECTED_YET="NOT_CONNECTED_YET",e.IM_BEFORE_JOIN="IM_BEFORE_JOIN",e.USER_NOT_EXIST="USER_NOT_EXIST",e.ALREADY_IN_ROOM="ALREADY_IN_ROOM",e.KICKED_OUT="KICKED_OUT",e.ROOM_DISMISS="ROOM_DISMISS",e.TOKEN_EXPIRED="TOKEN_EXPIRED",e.DUPLICATE_LOGIN="DUPLICATE_LOGIN",e.INVOKED_BEFORE_CAPTURE="INVOKED_BEFORE_CAPTURE",e.REPEAT_CAPTURE="REPEAT_CAPTURE",e.GET_VIDEO_TRACK_FAILED="GET_VIDEO_TRACK_FAILED",e.GET_AUDIO_TRACK_FAILED="GET_AUDIO_TRACK_FAILED",e.GET_SCREEN_TRACK_FAILED="GET_SCREEN_TRACK_FAILED",e.STREAM_TYPE_NOT_MATCH="STREAM_TYPE_NOT_MATCH",e.CANT_FIND_DOM="CANT_FIND_DOM",e.INVALID_DEVICE_ID="INVALID_DEVICE_ID",e.NO_PERMISSION="NO_PERMISSION",e.NOT_SUPPORTED="NOT_SUPPORTED",e.INTERRUPT="INTERRUPT",e.ICE_SERVER_WRONG="ICE_SERVER_WRONG",e.ESTABLISH_DATACHANNEL_FAILED="ESTABLISH_DATACHANNEL_FAILED",e.LOAD_RESOURCES_FAILED="LOAD_RESOURCES_FAILED",e.SIGNALING_CHANNEL_NOT_OPEN="SIGNALING_CHANNEL_NOT_OPEN",e.TIME_OUT="TIME_OUT",e.REFUSE_OPERATION_IN_DISCONNECT="REFUSE_OPERATION_IN_DISCONNECT",e.ADD_TRANSCEIVER_FAILED="ADD_TRANSCEIVER_FAILED",e.UPDATE_TRACK_FAILED="UPDATE_TRACK_FAILED",e.PUBLISH_FAILED="PUBLISH_FAILED",e.UNPUBLISH_FAILED="UNPUBLISH_FAILED",e.SUBSCRIBE_FAILED="SUBSCRIBE_FAILED",e.UNSUBSCRIBE_FAILED="UNSUBSCRIBE_FAILED",e.OPERATION_CANCEL="OPERATION_CANCEL",e.START_CLOUD_PROXY_AFTER_JOIN="START_CLOUD_PROXY_AFTER_JOIN",e.STOP_CLOUD_PROXY_BEFORE_LEAVE="STOP_CLOUD_PROXY_BEFORE_LEAVE",e.UNEXPECTED_ERROR="UNEXPECTED_ERROR",e.REPEAT_DEVICE_TEST="REPEAT_DEVICE_TEST",e.AUDIO_DEVICE_TEST_FAILED="AUDIO_DEVICE_RECORD_FAILED",e.ALREADY_LOGIN="ALREADY_LOGIN",e.LOGIN_FAILED="LOGIN_FAILED",e.NOT_LOGIN="NOT_LOGIN",e.RTM_DUPLICATE_LOGIN="RTM_DUPLICATE_LOGIN",e.RTM_TOKEN_ERROR="RTM_TOKEN_ERROR",e.USER_MESSAGE_TIMEOUT="USER_MESSAGE_TIMEOUT",e.USER_MESSAGE_BROKEN="USER_MESSAGE_BROKEN",e.USER_MESSAGE_NO_RECEIVER="USER_MESSAGE_NO_RECEIVER",e.USER_MESSAGE_NO_RELAYPATH="USER_MESSAGE_NO_RELAYPATH",e.USER_MESSAGE_SEND_TO_SERVER_ERROR="USER_MESSAGE_SEND_TO_SERVER_ERROR",e.USER_MESSAGE_SERVER_RESPONSE_ERROR="USER_MESSAGE_SERVER_RESPONSE_ERROR",e.USER_MESSAGE_NOT_JOIN="USER_MESSAGE_NOT_JOIN",e.USER_MESSAGE_INIT="USER_MESSAGE_INIT",e.USER_MESSAGE_NO_CONNECTION="USER_MESSAGE_NO_CONNECTION",e.USER_MESSAGE_NOT_LOGIN="USER_MESSAGE_NOT_LOGIN",e.USER_MESSAGE_SERVER_PARAMS_NOTSET="USER_MESSAGE_SERVER_PARAMS_NOTSET",e.USER_MESSAGE_UNKNOWN="USER_MESSAGE_UNKNOWN",e.START_PUBLIC_STREAM_BEFORE_JOIN="START_PUBLIC_STREAM_BEFORE_JOIN",e.RECONNECT_FAILED="RECONNECT_FAILED",e}(dN||{}),lN=function(e){return e[e.AUDIO_MIXING_ERROR_OK=0]="AUDIO_MIXING_ERROR_OK",e[e.AUDIO_MIXING_ERROR_PRELOAD_FAILED=1]="AUDIO_MIXING_ERROR_PRELOAD_FAILED",e[e.AUDIO_MIXING_ERROR_START_FAILED=2]="AUDIO_MIXING_ERROR_START_FAILED",e[e.AUDIO_MIXING_ERROR_ID_NOT_FOUND=3]="AUDIO_MIXING_ERROR_ID_NOT_FOUND",e[e.AUDIO_MIXING_ERROR_SET_POSITION_FAILED=4]="AUDIO_MIXING_ERROR_SET_POSITION_FAILED",e[e.AUDIO_MIXING_ERROR_INVALID_VOLUME=5]="AUDIO_MIXING_ERROR_INVALID_VOLUME",e[e.AUDIO_MIXING_ERROR_LOAD_CONFLICT=6]="AUDIO_MIXING_ERROR_LOAD_CONFLICT",e[e.AUDIO_MIXING_ERROR_ID_TYPE_NOT_MATCH=7]="AUDIO_MIXING_ERROR_ID_TYPE_NOT_MATCH",e[e.AUDIO_MIXING_ERROR_ID_TYPE_INVALID_PITCH=8]="AUDIO_MIXING_ERROR_ID_TYPE_INVALID_PITCH",e[e.AUDIO_MIXING_ERROR_INVALID_AUDIO_TRACK=9]="AUDIO_MIXING_ERROR_INVALID_AUDIO_TRACK",e}(lN||{}),hN=l((function e(t,r,n){u(this,e),h(this,"code",void 0),h(this,"message",void 0),h(this,"error",void 0),this.code=t,this.message=r,this.error=n})),fN=le,pN=Re,vN=Ga,_N=He,mN=pN(_e.f),yN=pN([].push),gN=function(e){return function(t){for(var r,n=_N(t),i=vN(n),o=i.length,a=0,s=[];o>a;)r=i[a++],fN&&!mN(n,r)||yN(s,e?[r,n[r]]:n[r]);return s}},SN={entries:gN(!0),values:gN(!1)}.entries;ro({target:"Object",stat:!0},{entries:function(e){return SN(e)}});var bN=ii,EN=As,kN=Be,TN=RangeError,IN=Re,AN=li,RN=As,wN=function(e){var t=EN(kN(this)),r="",n=bN(e);if(n<0||n==1/0)throw TN("Wrong number of repetitions");for(;n>0;(n>>>=1)&&(t+=t))1&n&&(r+=t);return r},CN=Be,ON=IN(wN),xN=IN("".slice),DN=Math.ceil,NN=function(e){return function(t,r,n){var i,o,a=RN(CN(t)),s=AN(r),c=a.length,u=void 0===n?" ":RN(n);return s<=c||""==u?a:((o=ON(u,DN((i=s-c)/u.length))).length>i&&(o=xN(o,0,i)),e?a+o:o+a)}},PN={start:NN(!1),end:NN(!0)},MN=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(rt),LN=PN.end;ro({target:"String",proto:!0,forced:MN},{padEnd:function(e){return LN(this,e,arguments.length>1?arguments[1]:void 0)}});var UN=Cu;ro({target:"Number",stat:!0,forced:Number.parseInt!=UN},{parseInt:UN});var VN=Fr,FN=Ql,BN=ga,jN=ve,GN=Gt,HN=function(e,t,r,n){try{return n?t(VN(r)[0],r[1]):t(r)}catch(T0){FN(e,"throw",T0)}},zN=Pl,XN=Po,KN=fi,qN=lo,WN=ql,YN=Bl,JN=Array,QN=function(e){var t=GN(e),r=XN(this),n=arguments.length,i=n>1?arguments[1]:void 0,o=void 0!==i;o&&(i=BN(i,n>2?arguments[2]:void 0));var a,s,c,u,d,l,h=YN(t),f=0;if(!h||this===JN&&zN(h))for(a=KN(t),s=r?new this(a):JN(a);a>f;f++)l=o?i(t[f],f):t[f],qN(s,f,l);else for(d=(u=WN(t,h)).next,s=r?new this:[];!(c=jN(d,u)).done;f++)l=o?HN(u,i,[c.value,f],!0):c.value,qN(s,f,l);return s.length=f,s},ZN=QN;ro({target:"Array",stat:!0,forced:!gh((function(e){Array.from(e)}))},{from:ZN});var $N,eP=Math.log,tP=Math.LOG10E;ro({target:"Math",stat:!0},{log10:Math.log10||function(e){return eP(e)*tP}});var rP=new Uint8Array(16);function nP(){if(!$N&&!($N="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return $N(rP)}var iP=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function oP(e){return"string"==typeof e&&iP.test(e)}for(var aP,sP=[],cP=0;cP<256;++cP)sP.push((cP+256).toString(16).substr(1));function uP(e,t,r){var n=(e=e||{}).random||(e.rng||nP)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){r=r||0;for(var i=0;i<16;++i)t[r+i]=n[i];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=(sP[e[t+0]]+sP[e[t+1]]+sP[e[t+2]]+sP[e[t+3]]+"-"+sP[e[t+4]]+sP[e[t+5]]+"-"+sP[e[t+6]]+sP[e[t+7]]+"-"+sP[e[t+8]]+sP[e[t+9]]+"-"+sP[e[t+10]]+sP[e[t+11]]+sP[e[t+12]]+sP[e[t+13]]+sP[e[t+14]]+sP[e[t+15]]).toLowerCase();if(!oP(r))throw TypeError("Stringified UUID is invalid");return r}(n)}var dP=new TextDecoder,lP=new TextEncoder,hP=function(){return uP()},fP=function(){return Date.now()};function pP(e){for(var t=0,r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];for(var o=0,a=n;o<a.length;o++){var s=a[o];t+=s.length}for(var c=new e(t),u=0,d=0,l=n;d<l.length;d++){var h=l[d];c.set(h,u),u+=h.length}return c}var vP=function(){return"undefined"==typeof window},_P=function(){function e(){u(this,e)}var t,r;return l(e,null,[{key:"token2auth",value:function(t,r,n,i){return i?"Bearer ".concat(i):"Basic ".concat(e.createUnsafeToken(t,r,n))}},{key:"createUnsafeToken",value:function(e,t,r){return window.btoa([e,t,r].filter((function(e){return null!==e})).join(":"))}},{key:"merge",value:function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=0,i=Object.entries(t);n<i.length;n++){var o=E(i[n],2),s=o[0],c=o[1];null!==c&&"object"===a(c)?e.merge(t[s],r[s]):void 0!==r[s]&&(t[s]=r[s])}}},{key:"ab2str",value:function(e){return dP.decode(e)}},{key:"ab2obj",value:function(t){try{var r=e.ab2str(t);return JSON.parse(r)}catch(n){return{}}}},{key:"str2ab",value:function(e){return lP.encode(e).buffer}},{key:"ab2b64str",value:(r=c(o().mark((function e(t){var r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,new Promise((function(e){var r=new FileReader;r.onload=function(){return e(r.result)},r.readAsDataURL(new Blob([t]))}));case 2:return r=e.sent,e.abrupt("return",r.split(",",2)[1]);case 4:case"end":return e.stop()}}),e)}))),function(e){return r.apply(this,arguments)})},{key:"b64str2ab",value:(t=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",fetch("data:application/octet;base64,"+t).then((function(e){return e.arrayBuffer()})));case 1:case"end":return e.stop()}}),e)}))),function(e){return t.apply(this,arguments)})}]),e}();function mP(e){return new Promise((function(t,r){window.setTimeout(r,e)}))}function yP(){var e="none";return vP()||(null!==window.navigator.userAgent.match("Firefox")?e="mozilla":null!==window.navigator.userAgent.match("Chrome")?(e="chrome-stable",null!==window.navigator.userAgent.match("Electron")&&(e="electron")):(null!==window.navigator.userAgent.match("Safari")||null!==window.navigator.userAgent.match("AppleWebKit"))&&(e="safari")),e}var gP="mozilla"===yP(),SP="safari"===yP(),bP=0,EP=!vP()&&(null===(aP=navigator.userAgent.match(/version\/(\d+)/i))||void 0===aP?void 0:aP[1]);SP&&EP&&(bP=+EP);var kP=bP,TP=!vP()&&!!/(iPhone|iPad|iPod)/i.exec(navigator.userAgent);!vP()&&/(iPhone|iPod)/i.exec(navigator.userAgent);var IP=!vP()&&(!!/(iPad)/i.exec(navigator.userAgent)||/Macintosh/i.test(navigator.userAgent)&&"ontouchend"in document),AP=!vP()&&/MicroMessenger/i.test(navigator.userAgent),RP=!vP()&&/Android/i.test(navigator.userAgent),wP=!vP()&&navigator.userAgent.toLowerCase().includes("mobile"),CP=!vP()&&/chrome\/(86)|(87)|(88)|(89)|(90)|(91)|(92)/i.test(navigator.userAgent);function OP(){for(var e=(+"".concat(Math.random()).slice(-7).padEnd(7,"0")).toString(2).padEnd(28,"1").split(""),t=[];e.length;)t.push(e.splice(0,7));return t.map((function(e,r){var n=r===t.length-1?"0":"1";return Number.parseInt(n+e.join(""),2)}))}var xP=function(){return Math.floor(65535*Math.random())};function DP(e){return"string"==typeof e&&e.indexOf("__web__rtc__rtt__")>-1}function NP(e){return e.map((function e(t){if(null!=t&&t._reportName)return t._reportName;if(t instanceof HTMLElement)return t.toString();if(t instanceof ArrayBuffer||ArrayBuffer.isView(t)){var r=ArrayBuffer.isView(t)?t.buffer:t,n=r.byteLength,i=[];if(n>10){var o=new DataView(r),a=Array.from({length:5}).map((function(e,t){return o.getUint8(t)})),s=Array.from({length:5}).map((function(e,t){return n-1-t})).reverse().map((function(e){return o.getUint8(e)}));i=[].concat(k(a),["..."],k(s))}else i=Array.from(new Uint8Array(r));return"".concat(t.constructor.name,"(").concat(n,") [").concat(i.join(", "),"]")}if(t instanceof ImageData)return"ImageData";if(Array.isArray(t))return t.map(e);if("[object Object]"===Object.prototype.toString.call(t)){var c={};for(var u in t)c[u]=e(t[u]);return c}return t}))}var PP=function(){var e=c(o().mark((function e(){var t,r,n,i=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=i.length>0&&void 0!==i[0]&&i[0],e.prev=1,(r=new RTCPeerConnection({iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan"})).createDataChannel("default"),r.addTransceiver("audio",{direction:"recvonly"}),r.addTransceiver("video",{direction:"recvonly"}),t&&(r.addTransceiver("audio",{direction:"sendonly"}),r.addTransceiver("video",{direction:"sendonly"})),e.next=9,r.createOffer();case 9:return n=e.sent,r.close(),e.abrupt("return",n.sdp);case 14:e.prev=14,e.t0=e.catch(1);case 16:case"end":return e.stop()}}),e,null,[[1,14]])})));return function(){return e.apply(this,arguments)}}(),MP=function(e){return new Promise((function(t,r){var n=(e=Array.isArray(e)?e:[]).length,i=[];0===n?r([]):e.forEach((function(e){e.then((function(e){t(e)}),(function(e){n--,i.push(e),0===n&&r(i)}))}))}))};function LP(e){return+Math.max(-127,10*Math.log10(Math.pow(e/255,2))).toFixed(2)}function UP(e){return(e&U.AUDIO)===U.AUDIO}function VP(e){return(e&U.VIDEO)===U.VIDEO}function FP(e){var t={};return Object.keys(e).forEach((function(r){"object"===a(e[r])?t[r]=FP(e[r]):r.startsWith("_")||(t[r]=e[r])})),t}function BP(e){var t=new DataView(e.buffer);if(t.byteLength<=4||65535!==t.getUint16(0))return{seiCount:1,seis:[e]};for(var r={seiCount:0,seis:[]},n=!1,i=2;i<t.byteLength;){var o=t.getUint16(i);if(i+=2,t.byteLength-i<o){n=!0;break}var a=new Uint8Array(e.buffer,i,o);if(i+=o,t.byteLength-i>0&&t.byteLength-i<=2){n=!0;break}r.seiCount++,r.seis.push(a)}return n&&(r.seiCount=1,r.seis=[e]),r}function jP(e){return null==e?"undefined | null":"string"==typeof e?e:JSON.stringify({contentHint:e.contentHint,enabled:e.enabled,id:e.id,kind:e.kind,label:e.label,muted:e.muted,readyState:e.readyState})}function GP(e,t){if("boolean"!=typeof e)throw new hN(dN.INVALID_PARAMS,"Invalid ".concat(t,": The value should be boolean type."))}function HP(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Number.POSITIVE_INFINITY;if(e<r||e>n||"number"!=typeof e){var i=new hN(dN.INVALID_PARAMS,"Invalid ".concat(t,": the value range is [").concat(r,", ").concat(n,"]. integer only"));throw i}}function zP(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Number.POSITIVE_INFINITY;if(null==e)throw new hN(dN.INVALID_PARAMS,"".concat(t," cannot be empty"));if(!JP(e,r,n))throw new hN(dN.INVALID_PARAMS,"Invalid ".concat(t,": The value should be string type. Length of the string: [").concat(r,",").concat(n,"]"))}function XP(e,t,r){if(!r.includes(e))throw new hN(dN.INVALID_PARAMS,"Invalid ".concat(t,": The value can only be set as ").concat(JSON.stringify(r)))}function KP(e){if(!(e instanceof MediaStreamTrack))throw new hN(dN.INVALID_PARAMS,"Invalid track, The value should be MediaStreamTrack type.")}function qP(e,t){if(QP(e))throw new hN(dN.INVALID_PARAMS,"Invalid ".concat(t,", should not be empty"))}function WP(e,t){if(!(e instanceof ArrayBuffer))throw new hN(dN.INVALID_PARAMS,"Invalid ".concat(t,", should be ArrayBuffer"))}function YP(e){try{for(var t=navigator.mediaDevices.getSupportedConstraints(),r=0,n=Object.keys(e);r<n.length;r++){var i=n[r];t[i]||delete e[i]}}catch(o){}}function JP(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Number.POSITIVE_INFINITY;return"string"==typeof e&&e.length<=r&&e.length>=t}function QP(e){return null==e}function ZP(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new hN(dN.INVALID_PARAMS,"The RoomId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function $P(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new hN(dN.INVALID_PARAMS,"The userId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function eM(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new hN(dN.INVALID_PARAMS,"The publicStreamId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function tM(e){qP(e,"userInfo"),$P(e.userId),QP(e.extraInfo)||zP(e.extraInfo,"userInfo.extraInfo",1,200)}function rM(e){qP(e,"roomConfig"),GP(e.isAutoPublish,"roomConfig.isAutoPublish"),GP(e.isAutoSubscribeAudio,"roomConfig.isAutoSubscribeAudio"),GP(e.isAutoSubscribeVideo,"roomConfig.isAutoSubscribeVideo")}function nM(e){qP(e,"videoPlayerOption")}function iM(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:64;if(!e||0===(null==e?void 0:e.byteLength))throw new hN(dN.INVALID_PARAMS,"The message cannot be empty");if((null===(t=e instanceof ArrayBuffer?e:_P.str2ab(JSON.stringify(e)))||void 0===t?void 0:t.byteLength)>1e3*r)throw new hN(dN.INVALID_PARAMS,"The message length must be less than ".concat(r,"K"))}function oM(e){return![oe.onRemoteStreamStats,oe.onLocalStreamStats,oe.onAudioVolumeIndication,oe.onLocalAudioPropertiesReport,oe.onRemoteAudioPropertiesReport].includes(e)}function aM(e){if("number"!=typeof(null==e?void 0:e.width)||"number"!=typeof(null==e?void 0:e.height))throw new hN(dN.INVALID_PARAMS,"remoteVideoConfig must contain width, height, frameRate")}var sM={},cM=sr;sM.f=cM;var uM=ce,dM=Xt,lM=sM,hM=Pr.f,fM=function(e){var t=uM.Symbol||(uM.Symbol={});dM(t,e)||hM(t,e,{value:lM.f(e)})},pM=ve,vM=et,_M=sr,mM=$n,yM=ro,gM=ce,SM=ve,bM=Re,EM=le,kM=ht,TM=de,IM=Xt,AM=tt,RM=Fr,wM=He,CM=yr,OM=As,xM=Ee,DM=cs,NM=Ga,PM=ei,MM=Jd,LM=wi,UM=ue,VM=Pr,FM=Fa,BM=_e,jM=$n,GM=Dt.exports,HM=En,zM=Jt,XM=sr,KM=sM,qM=fM,WM=function(){var e=vM("Symbol"),t=e&&e.prototype,r=t&&t.valueOf,n=_M("toPrimitive");t&&!t[n]&&mM(t,n,(function(e){return pM(r,this)}),{arity:1})},YM=ed,JM=Ln,QM=Ra.forEach,ZM=bn("hidden"),$M="Symbol",eL=JM.set,tL=JM.getterFor($M),rL=Object.prototype,nL=gM.Symbol,iL=nL&&nL.prototype,oL=gM.TypeError,aL=gM.QObject,sL=UM.f,cL=VM.f,uL=MM.f,dL=BM.f,lL=bM([].push),hL=GM("symbols"),fL=GM("op-symbols"),pL=GM("wks"),vL=!aL||!aL.prototype||!aL.prototype.findChild,_L=EM&&TM((function(){return 7!=DM(cL({},"a",{get:function(){return cL(this,"a",{value:7}).a}})).a}))?function(e,t,r){var n=sL(rL,t);n&&delete rL[t],cL(e,t,r),n&&e!==rL&&cL(rL,t,n)}:cL,mL=function(e,t){var r=hL[e]=DM(iL);return eL(r,{type:$M,tag:e,description:t}),EM||(r.description=t),r},yL=function(e,t,r){e===rL&&yL(fL,t,r),RM(e);var n=CM(t);return RM(r),IM(hL,n)?(r.enumerable?(IM(e,ZM)&&e[ZM][n]&&(e[ZM][n]=!1),r=DM(r,{enumerable:xM(0,!1)})):(IM(e,ZM)||cL(e,ZM,xM(1,{})),e[ZM][n]=!0),_L(e,n,r)):cL(e,n,r)},gL=function(e,t){RM(e);var r=wM(t),n=NM(r).concat(kL(r));return QM(n,(function(t){EM&&!SM(SL,r,t)||yL(e,t,r[t])})),e},SL=function(e){var t=CM(e),r=SM(dL,this,t);return!(this===rL&&IM(hL,t)&&!IM(fL,t))&&(!(r||!IM(this,t)||!IM(hL,t)||IM(this,ZM)&&this[ZM][t])||r)},bL=function(e,t){var r=wM(e),n=CM(t);if(r!==rL||!IM(hL,n)||IM(fL,n)){var i=sL(r,n);return!i||!IM(hL,n)||IM(r,ZM)&&r[ZM][n]||(i.enumerable=!0),i}},EL=function(e){var t=uL(wM(e)),r=[];return QM(t,(function(e){IM(hL,e)||IM(HM,e)||lL(r,e)})),r},kL=function(e){var t=e===rL,r=uL(t?fL:wM(e)),n=[];return QM(r,(function(e){!IM(hL,e)||t&&!IM(rL,e)||lL(n,hL[e])})),n};kM||(nL=function(){if(AM(iL,this))throw oL("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?OM(arguments[0]):void 0,t=zM(e),r=function(e){this===rL&&SM(r,fL,e),IM(this,ZM)&&IM(this[ZM],t)&&(this[ZM][t]=!1),_L(this,t,xM(1,e))};return EM&&vL&&_L(rL,t,{configurable:!0,set:r}),mL(t,e)},jM(iL=nL.prototype,"toString",(function(){return tL(this).tag})),jM(nL,"withoutSetter",(function(e){return mL(zM(e),e)})),BM.f=SL,VM.f=yL,FM.f=gL,UM.f=bL,PM.f=MM.f=EL,LM.f=kL,KM.f=function(e){return mL(XM(e),e)},EM&&(cL(iL,"description",{configurable:!0,get:function(){return tL(this).description}}),jM(rL,"propertyIsEnumerable",SL,{unsafe:!0}))),yM({global:!0,constructor:!0,wrap:!0,forced:!kM,sham:!kM},{Symbol:nL}),QM(NM(pL),(function(e){qM(e)})),yM({target:$M,stat:!0,forced:!kM},{useSetter:function(){vL=!0},useSimple:function(){vL=!1}}),yM({target:"Object",stat:!0,forced:!kM,sham:!EM},{create:function(e,t){return void 0===t?DM(e):gL(DM(e),t)},defineProperty:yL,defineProperties:gL,getOwnPropertyDescriptor:bL}),yM({target:"Object",stat:!0,forced:!kM},{getOwnPropertyNames:EL}),WM(),YM(nL,$M),HM[ZM]=!0;var TL=ht&&!!Symbol.for&&!!Symbol.keyFor,IL=ro,AL=et,RL=Xt,wL=As,CL=Dt.exports,OL=TL,xL=CL("string-to-symbol-registry"),DL=CL("symbol-to-string-registry");IL({target:"Symbol",stat:!0,forced:!OL},{for:function(e){var t=wL(e);if(RL(xL,t))return xL[t];var r=AL("Symbol")(t);return xL[t]=r,DL[r]=t,r}});var NL=ro,PL=Xt,ML=yt,LL=St,UL=TL,VL=(0,Dt.exports)("symbol-to-string-registry");NL({target:"Symbol",stat:!0,forced:!UL},{keyFor:function(e){if(!ML(e))throw TypeError(LL(e)+" is not a symbol");if(PL(VL,e))return VL[e]}});var FL=wi,BL=Gt;ro({target:"Object",stat:!0,forced:!ht||de((function(){FL.f(1)}))},{getOwnPropertySymbols:function(e){var t=FL.f;return t?t(BL(e)):[]}});var jL={exports:{}};!function(e){var t=Object.prototype.hasOwnProperty,r="~";function n(){}function i(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function o(e,t,n,o,a){if("function"!=typeof n)throw new TypeError("The listener must be a function");var s=new i(n,o||e,a),c=r?r+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 a(e,t){0==--e._eventsCount?e._events=new n:delete e._events[t]}function s(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(r=!1)),s.prototype.eventNames=function(){var e,n,i=[];if(0===this._eventsCount)return i;for(n in e=this._events)t.call(e,n)&&i.push(r?n.slice(1):n);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},s.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,o=n.length,a=new Array(o);i<o;i++)a[i]=n[i].fn;return a},s.prototype.listenerCount=function(e){var t=r?r+e:e,n=this._events[t];return n?n.fn?1:n.length:0},s.prototype.emit=function(e,t,n,i,o,a){var s=r?r+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,n),!0;case 4:return d.fn.call(d.context,t,n,i),!0;case 5:return d.fn.call(d.context,t,n,i,o),!0;case 6:return d.fn.call(d.context,t,n,i,o,a),!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,f=d.length;for(u=0;u<f;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,n);break;case 4:d[u].fn.call(d[u].context,t,n,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,r){return o(this,e,t,r,!1)},s.prototype.once=function(e,t,r){return o(this,e,t,r,!0)},s.prototype.removeListener=function(e,t,n,i){var o=r?r+e:e;if(!this._events[o])return this;if(!t)return a(this,o),this;var s=this._events[o];if(s.fn)s.fn!==t||i&&!s.once||n&&s.context!==n||a(this,o);else{for(var c=0,u=[],d=s.length;c<d;c++)(s[c].fn!==t||i&&!s[c].once||n&&s[c].context!==n)&&u.push(s[c]);u.length?this._events[o]=1===u.length?u[0]:u:a(this,o)}return this},s.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&a(this,t)):(this._events=new n,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=r,s.EventEmitter=s,e.exports=s}(jL);var GL=jL.exports,HL="@byted/ve-rtc",zL="@byted/ve-rtc-cache-size",XL=function(){function e(){u(this,e),h(this,"storeKey",void 0),h(this,"logLevel",void 0),h(this,"LogfileSize",void 0),h(this,"db",void 0),h(this,"logId",void 0),h(this,"cacheLog",void 0),h(this,"cachedSize",void 0),h(this,"preCacheTime",void 0),h(this,"timer",void 0),h(this,"_getSize",(function(e){return new Blob(e).size/1048576})),this.storeKey="",this.logId=1,this.cacheLog="",this.logLevel="none",this.LogfileSize=100,this._createStore()}return l(e,[{key:"_createStore",value:function(){var e=this;if(!vP()){var t=indexedDB.open("@byted/ve-rtc");t.onupgradeneeded=function(){t.result.createObjectStore(HL);try{localStorage.removeItem(zL)}catch(T0){}},t.onerror=function(e){},t.onsuccess=function(){e.db=t.result,e._getCachedSize()}}}},{key:"_getCachedSize",value:function(){var e=this;try{var t=localStorage.getItem(zL);t?this.cachedSize=+t:this.values().then((function(t){e.cachedSize=e._getSize(t),e._setCachedSize()}))}catch(T0){}}},{key:"_setCachedSize",value:function(){try{localStorage.setItem(zL,"".concat(this.cachedSize))}catch(T0){}}},{key:"_getStore",value:function(e){if(this.db)return this.db.transaction(HL,e).objectStore(HL)}},{key:"set",value:function(e){var t=this;return new Promise((function(r,n){if("none"===t.logLevel)return r();if(e&&t.preCacheTime&&t.preCacheTime-Date.now()<1e3)return t.cacheLog+="\n\n".concat(t.logId,": ").concat(e),t.logId++,t.timer||(t.timer=setTimeout((function(){t.set("")}),1e3-(t.preCacheTime-Date.now()))),r();clearTimeout(t.timer),t.timer=null;var i=t._getStore("readwrite");if(!i)return n("get store fail");t.cachedSize&&t.cachedSize>t.LogfileSize&&t.keyEarliest().then((function(e){t.get(e).then((function(r){t.del(e).then((function(){t.cachedSize=t.cachedSize-t._getSize(["".concat(r)]),t._setCachedSize()}))}))}));var o=i.get(t.storeKey);o.onsuccess=function(){try{var a="".concat(o.result||"").concat(t.cacheLog),s=e?"".concat(a?"\n\n":"").concat(t.logId,": ").concat(e):"";i.put("".concat(a).concat(s),t.storeKey),e&&t.logId++,t.cacheLog="",t.cachedSize=(t.cachedSize||0)+t._getSize(["".concat(t.cacheLog).concat(s)]),t._setCachedSize(),t.preCacheTime=Date.now(),r()}catch(c){if(!e)return n(c);t.cacheLog+="\n\n".concat(t.logId,": ").concat(e),t.logId++,n(c)}},o.onerror=function(r){if(!e)return n(r);t.cacheLog+="\n\n".concat(t.logId,": ").concat(e),t.logId++,n(r)}}))}},{key:"get",value:function(e){var t=this;return new Promise((function(r,n){var i=t._getStore("readonly");if(!i)return n();var o=i.get(e);o.onsuccess=function(){r(o.result)},o.onerror=function(e){n(e)}}))}},{key:"del",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.storeKey;return new Promise((function(r,n){var i=e._getStore("readwrite");if(!i)return n();var o=i.delete(t);o.onsuccess=function(){return r(o.result)},o.onerror=function(e){return n(e)}}))}},{key:"keyEarliest",value:function(){return this.keys().then((function(e){var t,r=Date.now();return e.forEach((function(e){if(e&&e.length){var n=e.split("-")[0];Number(n)<r&&(r=Number(n),t=e)}})),t}))}},{key:"keys",value:function(){var e=this;return new Promise((function(t,r){var n=e._getStore("readonly");if(!n)return r();if(n.getAllKeys){var i=n.getAllKeys();return i.onsuccess=function(){t(i.result)},void(i.onerror=function(){r()})}var o=[];n.openCursor().onsuccess=function(){this.result&&(o.push(this.result.key),this.result.continue())},n.transaction.oncomplete=function(){return t(o)}}))}},{key:"values",value:function(){var e=this;return new Promise((function(t,r){var n=e._getStore("readonly");if(!n)return r();if(n.getAll){var i=n.getAll();return i.onsuccess=function(){t(i.result)},void(i.onerror=function(){r()})}var o=[];n.openCursor().onsuccess=function(){this.result&&(o.push(this.result.value),this.result.continue())},n.transaction.oncomplete=function(){return t(o)}}))}},{key:"download",value:function(e){e=e||this.storeKey,this.get(e).then((function(t){var r=document.createElement("a");r.download="".concat(e,".txt"),r.href="data:text/paint;utf-8,"+(t||""),r.click()}))}}]),e}(),KL=new XL,qL="[VERTC]",WL=["#0050b3","#0050b3","#0050b3","#0050b3","#0050b3"],YL=!vP()&&window.location.search.includes("_rtc_debug_"),JL=function(){function e(t,r,n){u(this,e),h(this,"_indent",void 0),h(this,"_module",void 0),h(this,"_id",void 0),this._module=t,this._indent=r}return l(e,[{key:"print",value:function(e){for(var t,r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];var o=n.shift();try{var a=[].concat(n),s="".concat(o).replace(/\%o/gi,(function(){var e=a.shift();return JSON.stringify(e)}));KL.set("".concat(qL,"[").concat(this._module,".").concat(e,"] ").concat(s," ").concat(a.map((function(e){return JSON.stringify(e)})).join(", ")))}catch(T0){}if(YL){for(var c="",u=0;u<this._indent;u++)c+=" ";(t=console).log.apply(t,["%c".concat(QL(),"-").concat(qL).concat(c,"[").concat(this._module,".").concat(e,"] ").concat(o),"color:".concat(WL[this._indent],";")].concat(n))}}}]),e}(),QL=function(){var e=new Date;return e.toTimeString().split(" ")[0]+":"+e.getMilliseconds()},ZL=new JL("VERTC",0),$L=function(e){f(r,e);var t=g(r);function r(){return u(this,r),t.apply(this,arguments)}return l(r,[{key:"safeEmit",value:function(e){var t=this.listenerCount(e);try{for(var n,i=arguments.length,o=new Array(i>1?i-1:0),a=1;a<i;a++)o[a-1]=arguments[a];return(n=b(p(r.prototype),"emit",this)).call.apply(n,[this,e].concat(o))}catch(T0){return ZL.print("safaEmit","safeEmit() | event listener threw an error [event:%s]:%o",e,T0),console.error(T0),Boolean(t)}}}]),r}(jL.exports.EventEmitter),eU=Xt,tU=function(e){return void 0!==e&&(eU(e,"value")||eU(e,"writable"))},rU=ve,nU=Je,iU=Fr,oU=tU,aU=ue,sU=Gu;ro({target:"Reflect",stat:!0},{get:function e(t,r){var n,i,o=arguments.length<3?t:arguments[2];return iU(t)===o?t[r]:(n=aU.f(t,r))?oU(n)?n.value:void 0===n.get?void 0:rU(n.get,o):nU(i=sU(t))?e(i,r,o):void 0}});var cU=ce,uU=ed;ro({global:!0},{Reflect:{}}),uU(cU.Reflect,"Reflect",!0);var dU=ve,lU=Fr,hU=Je,fU=tU,pU=Pr,vU=ue,_U=Gu,mU=Ee;ro({target:"Reflect",stat:!0,forced:de((function(){var e=function(){},t=pU.f(new e,"a",{configurable:!0});return!1!==Reflect.set(e.prototype,"a",1,t)}))},{set:function e(t,r,n){var i,o,a,s=arguments.length<4?t:arguments[3],c=vU.f(lU(t),r);if(!c){if(hU(o=_U(t)))return e(o,r,n,s);c=mU(0)}if(fU(c)){if(!1===c.writable||!hU(s))return!1;if(i=vU.f(s,r)){if(i.get||i.set||!1===i.writable)return!1;i.value=n,pU.f(s,r,i)}else pU.f(s,r,mU(0,n))}else{if(void 0===(a=c.set))return!1;dU(a,s,n)}return!0}});var yU=ro,gU=Gt,SU=fi,bU=sv,EU=r_,kU=ao,TU=1!==[].unshift(0),IU=!function(){try{Object.defineProperty([],"length",{writable:!1}).unshift()}catch(T0){return T0 instanceof TypeError}}();yU({target:"Array",proto:!0,arity:1,forced:TU||IU},{unshift:function(e){var t=gU(this),r=SU(t),n=arguments.length;if(n){kU(r+n);for(var i=r;i--;){var o=i+n;i in t?t[o]=t[i]:EU(t,o)}for(var a=0;a<n;a++)t[a]=arguments[a]}return bU(t,r+n)}}),(0,dA.exports)("Uint16",(function(e){return function(t,r,n){return e(this,t,r,n)}})),(0,dA.exports)("Int32",(function(e){return function(t,r,n){return e(this,t,r,n)}}));var AU={};!function(e){var t="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;function r(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var n=t.shift();if(n){if("object"!==a(n))throw new TypeError(n+"must be non-object");for(var i in n)r(n,i)&&(e[i]=n[i])}}return e},e.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var n={arraySet:function(e,t,r,n,i){if(t.subarray&&e.subarray)e.set(t.subarray(r,r+n),i);else for(var o=0;o<n;o++)e[i+o]=t[r+o]},flattenChunks:function(e){var t,r,n,i,o,a;for(n=0,t=0,r=e.length;t<r;t++)n+=e[t].length;for(a=new Uint8Array(n),i=0,t=0,r=e.length;t<r;t++)o=e[t],a.set(o,i),i+=o.length;return a}},i={arraySet:function(e,t,r,n,i){for(var o=0;o<n;o++)e[i+o]=t[r+o]},flattenChunks:function(e){return[].concat.apply([],e)}};e.setTyped=function(t){t?(e.Buf8=Uint8Array,e.Buf16=Uint16Array,e.Buf32=Int32Array,e.assign(e,n)):(e.Buf8=Array,e.Buf16=Array,e.Buf32=Array,e.assign(e,i))},e.setTyped(t)}(AU);var RU={},wU={},CU={},OU=AU;function xU(e){for(var t=e.length;--t>=0;)e[t]=0}var DU=256,NU=286,PU=30,MU=15,LU=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],UU=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],VU=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],FU=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],BU=new Array(576);xU(BU);var jU=new Array(60);xU(jU);var GU=new Array(512);xU(GU);var HU=new Array(256);xU(HU);var zU=new Array(29);xU(zU);var XU,KU,qU,WU=new Array(PU);function YU(e,t,r,n,i){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=n,this.max_length=i,this.has_stree=e&&e.length}function JU(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function QU(e){return e<256?GU[e]:GU[256+(e>>>7)]}function ZU(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function $U(e,t,r){e.bi_valid>16-r?(e.bi_buf|=t<<e.bi_valid&65535,ZU(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=r-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=r)}function eV(e,t,r){$U(e,r[2*t],r[2*t+1])}function tV(e,t){var r=0;do{r|=1&e,e>>>=1,r<<=1}while(--t>0);return r>>>1}function rV(e,t,r){var n,i,o=new Array(16),a=0;for(n=1;n<=MU;n++)o[n]=a=a+r[n-1]<<1;for(i=0;i<=t;i++){var s=e[2*i+1];0!==s&&(e[2*i]=tV(o[s]++,s))}}function nV(e){var t;for(t=0;t<NU;t++)e.dyn_ltree[2*t]=0;for(t=0;t<PU;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function iV(e){e.bi_valid>8?ZU(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function oV(e,t,r,n){var i=2*t,o=2*r;return e[i]<e[o]||e[i]===e[o]&&n[t]<=n[r]}function aV(e,t,r){for(var n=e.heap[r],i=r<<1;i<=e.heap_len&&(i<e.heap_len&&oV(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!oV(t,n,e.heap[i],e.depth));)e.heap[r]=e.heap[i],r=i,i<<=1;e.heap[r]=n}function sV(e,t,r){var n,i,o,a,s=0;if(0!==e.last_lit)do{n=e.pending_buf[e.d_buf+2*s]<<8|e.pending_buf[e.d_buf+2*s+1],i=e.pending_buf[e.l_buf+s],s++,0===n?eV(e,i,t):(eV(e,(o=HU[i])+DU+1,t),0!==(a=LU[o])&&$U(e,i-=zU[o],a),eV(e,o=QU(--n),r),0!==(a=UU[o])&&$U(e,n-=WU[o],a))}while(s<e.last_lit);eV(e,256,t)}function cV(e,t){var r,n,i,o=t.dyn_tree,a=t.stat_desc.static_tree,s=t.stat_desc.has_stree,c=t.stat_desc.elems,u=-1;for(e.heap_len=0,e.heap_max=573,r=0;r<c;r++)0!==o[2*r]?(e.heap[++e.heap_len]=u=r,e.depth[r]=0):o[2*r+1]=0;for(;e.heap_len<2;)o[2*(i=e.heap[++e.heap_len]=u<2?++u:0)]=1,e.depth[i]=0,e.opt_len--,s&&(e.static_len-=a[2*i+1]);for(t.max_code=u,r=e.heap_len>>1;r>=1;r--)aV(e,o,r);i=c;do{r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],aV(e,o,1),n=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=n,o[2*i]=o[2*r]+o[2*n],e.depth[i]=(e.depth[r]>=e.depth[n]?e.depth[r]:e.depth[n])+1,o[2*r+1]=o[2*n+1]=i,e.heap[1]=i++,aV(e,o,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],function(e,t){var r,n,i,o,a,s,c=t.dyn_tree,u=t.max_code,d=t.stat_desc.static_tree,l=t.stat_desc.has_stree,h=t.stat_desc.extra_bits,f=t.stat_desc.extra_base,p=t.stat_desc.max_length,v=0;for(o=0;o<=MU;o++)e.bl_count[o]=0;for(c[2*e.heap[e.heap_max]+1]=0,r=e.heap_max+1;r<573;r++)(o=c[2*c[2*(n=e.heap[r])+1]+1]+1)>p&&(o=p,v++),c[2*n+1]=o,n>u||(e.bl_count[o]++,a=0,n>=f&&(a=h[n-f]),s=c[2*n],e.opt_len+=s*(o+a),l&&(e.static_len+=s*(d[2*n+1]+a)));if(0!==v){do{for(o=p-1;0===e.bl_count[o];)o--;e.bl_count[o]--,e.bl_count[o+1]+=2,e.bl_count[p]--,v-=2}while(v>0);for(o=p;0!==o;o--)for(n=e.bl_count[o];0!==n;)(i=e.heap[--r])>u||(c[2*i+1]!==o&&(e.opt_len+=(o-c[2*i+1])*c[2*i],c[2*i+1]=o),n--)}}(e,t),rV(o,u,e.bl_count)}function uV(e,t,r){var n,i,o=-1,a=t[1],s=0,c=7,u=4;for(0===a&&(c=138,u=3),t[2*(r+1)+1]=65535,n=0;n<=r;n++)i=a,a=t[2*(n+1)+1],++s<c&&i===a||(s<u?e.bl_tree[2*i]+=s:0!==i?(i!==o&&e.bl_tree[2*i]++,e.bl_tree[32]++):s<=10?e.bl_tree[34]++:e.bl_tree[36]++,s=0,o=i,0===a?(c=138,u=3):i===a?(c=6,u=3):(c=7,u=4))}function dV(e,t,r){var n,i,o=-1,a=t[1],s=0,c=7,u=4;for(0===a&&(c=138,u=3),n=0;n<=r;n++)if(i=a,a=t[2*(n+1)+1],!(++s<c&&i===a)){if(s<u)do{eV(e,i,e.bl_tree)}while(0!=--s);else 0!==i?(i!==o&&(eV(e,i,e.bl_tree),s--),eV(e,16,e.bl_tree),$U(e,s-3,2)):s<=10?(eV(e,17,e.bl_tree),$U(e,s-3,3)):(eV(e,18,e.bl_tree),$U(e,s-11,7));s=0,o=i,0===a?(c=138,u=3):i===a?(c=6,u=3):(c=7,u=4)}}xU(WU);var lV=!1;function hV(e,t,r,n){$U(e,0+(n?1:0),3),function(e,t,r,n){iV(e),n&&(ZU(e,r),ZU(e,~r)),OU.arraySet(e.pending_buf,e.window,t,r,e.pending),e.pending+=r}(e,t,r,!0)}CU._tr_init=function(e){lV||(!function(){var e,t,r,n,i,o=new Array(16);for(r=0,n=0;n<28;n++)for(zU[n]=r,e=0;e<1<<LU[n];e++)HU[r++]=n;for(HU[r-1]=n,i=0,n=0;n<16;n++)for(WU[n]=i,e=0;e<1<<UU[n];e++)GU[i++]=n;for(i>>=7;n<PU;n++)for(WU[n]=i<<7,e=0;e<1<<UU[n]-7;e++)GU[256+i++]=n;for(t=0;t<=MU;t++)o[t]=0;for(e=0;e<=143;)BU[2*e+1]=8,e++,o[8]++;for(;e<=255;)BU[2*e+1]=9,e++,o[9]++;for(;e<=279;)BU[2*e+1]=7,e++,o[7]++;for(;e<=287;)BU[2*e+1]=8,e++,o[8]++;for(rV(BU,287,o),e=0;e<PU;e++)jU[2*e+1]=5,jU[2*e]=tV(e,5);XU=new YU(BU,LU,257,NU,MU),KU=new YU(jU,UU,0,PU,MU),qU=new YU(new Array(0),VU,0,19,7)}(),lV=!0),e.l_desc=new JU(e.dyn_ltree,XU),e.d_desc=new JU(e.dyn_dtree,KU),e.bl_desc=new JU(e.bl_tree,qU),e.bi_buf=0,e.bi_valid=0,nV(e)},CU._tr_stored_block=hV,CU._tr_flush_block=function(e,t,r,n){var i,o,a=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=function(e){var t,r=4093624447;for(t=0;t<=31;t++,r>>>=1)if(1&r&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<DU;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0}(e)),cV(e,e.l_desc),cV(e,e.d_desc),a=function(e){var t;for(uV(e,e.dyn_ltree,e.l_desc.max_code),uV(e,e.dyn_dtree,e.d_desc.max_code),cV(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*FU[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),i=e.opt_len+3+7>>>3,(o=e.static_len+3+7>>>3)<=i&&(i=o)):i=o=r+5,r+4<=i&&-1!==t?hV(e,t,r,n):4===e.strategy||o===i?($U(e,2+(n?1:0),3),sV(e,BU,jU)):($U(e,4+(n?1:0),3),function(e,t,r,n){var i;for($U(e,t-257,5),$U(e,r-1,5),$U(e,n-4,4),i=0;i<n;i++)$U(e,e.bl_tree[2*FU[i]+1],3);dV(e,e.dyn_ltree,t-1),dV(e,e.dyn_dtree,r-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),sV(e,e.dyn_ltree,e.dyn_dtree)),nV(e),n&&iV(e)},CU._tr_tally=function(e,t,r){return e.pending_buf[e.d_buf+2*e.last_lit]=t>>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&r,e.last_lit++,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(HU[r]+DU+1)]++,e.dyn_dtree[2*QU(t)]++),e.last_lit===e.lit_bufsize-1},CU._tr_align=function(e){$U(e,2,3),eV(e,256,BU),function(e){16===e.bi_valid?(ZU(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}(e)};var fV=function(e,t,r,n){for(var i=65535&e|0,o=e>>>16&65535|0,a=0;0!==r;){r-=a=r>2e3?2e3:r;do{o=o+(i=i+t[n++]|0)|0}while(--a);i%=65521,o%=65521}return i|o<<16|0};var pV=function(){for(var e,t=[],r=0;r<256;r++){e=r;for(var n=0;n<8;n++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t}();var vV,_V=function(e,t,r,n){var i=pV,o=n+r;e^=-1;for(var a=n;a<o;a++)e=e>>>8^i[255&(e^t[a])];return-1^e},mV={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},yV=AU,gV=CU,SV=fV,bV=_V,EV=mV,kV=-2,TV=258,IV=262,AV=103,RV=113,wV=666;function CV(e,t){return e.msg=EV[t],t}function OV(e){return(e<<1)-(e>4?9:0)}function xV(e){for(var t=e.length;--t>=0;)e[t]=0}function DV(e){var t=e.state,r=t.pending;r>e.avail_out&&(r=e.avail_out),0!==r&&(yV.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))}function NV(e,t){gV._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,DV(e.strm)}function PV(e,t){e.pending_buf[e.pending++]=t}function MV(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function LV(e,t){var r,n,i=e.max_chain_length,o=e.strstart,a=e.prev_length,s=e.nice_match,c=e.strstart>e.w_size-IV?e.strstart-(e.w_size-IV):0,u=e.window,d=e.w_mask,l=e.prev,h=e.strstart+TV,f=u[o+a-1],p=u[o+a];e.prev_length>=e.good_match&&(i>>=2),s>e.lookahead&&(s=e.lookahead);do{if(u[(r=t)+a]===p&&u[r+a-1]===f&&u[r]===u[o]&&u[++r]===u[o+1]){o+=2,r++;do{}while(u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&o<h);if(n=TV-(h-o),o=h-TV,n>a){if(e.match_start=t,a=n,n>=s)break;f=u[o+a-1],p=u[o+a]}}}while((t=l[t&d])>c&&0!=--i);return a<=e.lookahead?a:e.lookahead}function UV(e){var t,r,n,i,o,a,s,c,u,d,l=e.w_size;do{if(i=e.window_size-e.lookahead-e.strstart,e.strstart>=l+(l-IV)){yV.arraySet(e.window,e.window,l,l,0),e.match_start-=l,e.strstart-=l,e.block_start-=l,t=r=e.hash_size;do{n=e.head[--t],e.head[t]=n>=l?n-l:0}while(--r);t=r=l;do{n=e.prev[--t],e.prev[t]=n>=l?n-l:0}while(--r);i+=l}if(0===e.strm.avail_in)break;if(a=e.strm,s=e.window,c=e.strstart+e.lookahead,u=i,d=void 0,(d=a.avail_in)>u&&(d=u),r=0===d?0:(a.avail_in-=d,yV.arraySet(s,a.input,a.next_in,d,c),1===a.state.wrap?a.adler=SV(a.adler,s,d,c):2===a.state.wrap&&(a.adler=bV(a.adler,s,d,c)),a.next_in+=d,a.total_in+=d,d),e.lookahead+=r,e.lookahead+e.insert>=3)for(o=e.strstart-e.insert,e.ins_h=e.window[o],e.ins_h=(e.ins_h<<e.hash_shift^e.window[o+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[o+3-1])&e.hash_mask,e.prev[o&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=o,o++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<IV&&0!==e.strm.avail_in)}function VV(e,t){for(var r,n;;){if(e.lookahead<IV){if(UV(e),e.lookahead<IV&&0===t)return 1;if(0===e.lookahead)break}if(r=0,e.lookahead>=3&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==r&&e.strstart-r<=e.w_size-IV&&(e.match_length=LV(e,r)),e.match_length>=3)if(n=gV._tr_tally(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart}while(0!=--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else n=gV._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(n&&(NV(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,4===t?(NV(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(NV(e,!1),0===e.strm.avail_out)?1:2}function FV(e,t){for(var r,n,i;;){if(e.lookahead<IV){if(UV(e),e.lookahead<IV&&0===t)return 1;if(0===e.lookahead)break}if(r=0,e.lookahead>=3&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==r&&e.prev_length<e.max_lazy_match&&e.strstart-r<=e.w_size-IV&&(e.match_length=LV(e,r),e.match_length<=5&&(1===e.strategy||3===e.match_length&&e.strstart-e.match_start>4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-3,n=gV._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=i&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart)}while(0!=--e.prev_length);if(e.match_available=0,e.match_length=2,e.strstart++,n&&(NV(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if((n=gV._tr_tally(e,0,e.window[e.strstart-1]))&&NV(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(n=gV._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,4===t?(NV(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(NV(e,!1),0===e.strm.avail_out)?1:2}function BV(e,t,r,n,i){this.good_length=e,this.max_lazy=t,this.nice_length=r,this.max_chain=n,this.func=i}function jV(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=8,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new yV.Buf16(1146),this.dyn_dtree=new yV.Buf16(122),this.bl_tree=new yV.Buf16(78),xV(this.dyn_ltree),xV(this.dyn_dtree),xV(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new yV.Buf16(16),this.heap=new yV.Buf16(573),xV(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new yV.Buf16(573),xV(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function GV(e){var t;return e&&e.state?(e.total_in=e.total_out=0,e.data_type=2,(t=e.state).pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?42:RV,e.adler=2===t.wrap?0:1,t.last_flush=0,gV._tr_init(t),0):CV(e,kV)}function HV(e){var t,r=GV(e);return 0===r&&((t=e.state).window_size=2*t.w_size,xV(t.head),t.max_lazy_match=vV[t.level].max_lazy,t.good_match=vV[t.level].good_length,t.nice_match=vV[t.level].nice_length,t.max_chain_length=vV[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=2,t.match_available=0,t.ins_h=0),r}function zV(e,t,r,n,i,o){if(!e)return kV;var a=1;if(-1===t&&(t=6),n<0?(a=0,n=-n):n>15&&(a=2,n-=16),i<1||i>9||8!==r||n<8||n>15||t<0||t>9||o<0||o>4)return CV(e,kV);8===n&&(n=9);var s=new jV;return e.state=s,s.strm=e,s.wrap=a,s.gzhead=null,s.w_bits=n,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=i+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+3-1)/3),s.window=new yV.Buf8(2*s.w_size),s.head=new yV.Buf16(s.hash_size),s.prev=new yV.Buf16(s.w_size),s.lit_bufsize=1<<i+6,s.pending_buf_size=4*s.lit_bufsize,s.pending_buf=new yV.Buf8(s.pending_buf_size),s.d_buf=1*s.lit_bufsize,s.l_buf=3*s.lit_bufsize,s.level=t,s.strategy=o,s.method=r,HV(e)}vV=[new BV(0,0,0,0,(function(e,t){var r=65535;for(r>e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(UV(e),0===e.lookahead&&0===t)return 1;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+r;if((0===e.strstart||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,NV(e,!1),0===e.strm.avail_out))return 1;if(e.strstart-e.block_start>=e.w_size-IV&&(NV(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(NV(e,!0),0===e.strm.avail_out?3:4):(e.strstart>e.block_start&&(NV(e,!1),e.strm.avail_out),1)})),new BV(4,4,8,4,VV),new BV(4,5,16,8,VV),new BV(4,6,32,32,VV),new BV(4,4,16,16,FV),new BV(8,16,32,32,FV),new BV(8,16,128,128,FV),new BV(8,32,128,256,FV),new BV(32,128,258,1024,FV),new BV(32,258,258,4096,FV)],wU.deflateInit=function(e,t){return zV(e,t,8,15,8,0)},wU.deflateInit2=zV,wU.deflateReset=HV,wU.deflateResetKeep=GV,wU.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?kV:(e.state.gzhead=t,0):kV},wU.deflate=function(e,t){var r,n,i,o;if(!e||!e.state||t>5||t<0)return e?CV(e,kV):kV;if(n=e.state,!e.output||!e.input&&0!==e.avail_in||n.status===wV&&4!==t)return CV(e,0===e.avail_out?-5:kV);if(n.strm=e,r=n.last_flush,n.last_flush=t,42===n.status)if(2===n.wrap)e.adler=0,PV(n,31),PV(n,139),PV(n,8),n.gzhead?(PV(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),PV(n,255&n.gzhead.time),PV(n,n.gzhead.time>>8&255),PV(n,n.gzhead.time>>16&255),PV(n,n.gzhead.time>>24&255),PV(n,9===n.level?2:n.strategy>=2||n.level<2?4:0),PV(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(PV(n,255&n.gzhead.extra.length),PV(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=bV(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(PV(n,0),PV(n,0),PV(n,0),PV(n,0),PV(n,0),PV(n,9===n.level?2:n.strategy>=2||n.level<2?4:0),PV(n,3),n.status=RV);else{var a=8+(n.w_bits-8<<4)<<8;a|=(n.strategy>=2||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(a|=32),a+=31-a%31,n.status=RV,MV(n,a),0!==n.strstart&&(MV(n,e.adler>>>16),MV(n,65535&e.adler)),e.adler=1}if(69===n.status)if(n.gzhead.extra){for(i=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>i&&(e.adler=bV(e.adler,n.pending_buf,n.pending-i,i)),DV(e),i=n.pending,n.pending!==n.pending_buf_size));)PV(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(e.adler=bV(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=bV(e.adler,n.pending_buf,n.pending-i,i)),DV(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}o=n.gzindex<n.gzhead.name.length?255&n.gzhead.name.charCodeAt(n.gzindex++):0,PV(n,o)}while(0!==o);n.gzhead.hcrc&&n.pending>i&&(e.adler=bV(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=bV(e.adler,n.pending_buf,n.pending-i,i)),DV(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}o=n.gzindex<n.gzhead.comment.length?255&n.gzhead.comment.charCodeAt(n.gzindex++):0,PV(n,o)}while(0!==o);n.gzhead.hcrc&&n.pending>i&&(e.adler=bV(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.status=AV)}else n.status=AV;if(n.status===AV&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&DV(e),n.pending+2<=n.pending_buf_size&&(PV(n,255&e.adler),PV(n,e.adler>>8&255),e.adler=0,n.status=RV)):n.status=RV),0!==n.pending){if(DV(e),0===e.avail_out)return n.last_flush=-1,0}else if(0===e.avail_in&&OV(t)<=OV(r)&&4!==t)return CV(e,-5);if(n.status===wV&&0!==e.avail_in)return CV(e,-5);if(0!==e.avail_in||0!==n.lookahead||0!==t&&n.status!==wV){var s=2===n.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(UV(e),0===e.lookahead)){if(0===t)return 1;break}if(e.match_length=0,r=gV._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(NV(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(NV(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(NV(e,!1),0===e.strm.avail_out)?1:2}(n,t):3===n.strategy?function(e,t){for(var r,n,i,o,a=e.window;;){if(e.lookahead<=TV){if(UV(e),e.lookahead<=TV&&0===t)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(n=a[i=e.strstart-1])===a[++i]&&n===a[++i]&&n===a[++i]){o=e.strstart+TV;do{}while(n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&i<o);e.match_length=TV-(o-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(r=gV._tr_tally(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=gV._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(NV(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(NV(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(NV(e,!1),0===e.strm.avail_out)?1:2}(n,t):vV[n.level].func(n,t);if(3!==s&&4!==s||(n.status=wV),1===s||3===s)return 0===e.avail_out&&(n.last_flush=-1),0;if(2===s&&(1===t?gV._tr_align(n):5!==t&&(gV._tr_stored_block(n,0,0,!1),3===t&&(xV(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),DV(e),0===e.avail_out))return n.last_flush=-1,0}return 4!==t?0:n.wrap<=0?1:(2===n.wrap?(PV(n,255&e.adler),PV(n,e.adler>>8&255),PV(n,e.adler>>16&255),PV(n,e.adler>>24&255),PV(n,255&e.total_in),PV(n,e.total_in>>8&255),PV(n,e.total_in>>16&255),PV(n,e.total_in>>24&255)):(MV(n,e.adler>>>16),MV(n,65535&e.adler)),DV(e),n.wrap>0&&(n.wrap=-n.wrap),0!==n.pending?0:1)},wU.deflateEnd=function(e){var t;return e&&e.state?42!==(t=e.state.status)&&69!==t&&73!==t&&91!==t&&t!==AV&&t!==RV&&t!==wV?CV(e,kV):(e.state=null,t===RV?CV(e,-3):0):kV},wU.deflateSetDictionary=function(e,t){var r,n,i,o,a,s,c,u,d=t.length;if(!e||!e.state)return kV;if(2===(o=(r=e.state).wrap)||1===o&&42!==r.status||r.lookahead)return kV;for(1===o&&(e.adler=SV(e.adler,t,d,0)),r.wrap=0,d>=r.w_size&&(0===o&&(xV(r.head),r.strstart=0,r.block_start=0,r.insert=0),u=new yV.Buf8(r.w_size),yV.arraySet(u,t,d-r.w_size,r.w_size,0),t=u,d=r.w_size),a=e.avail_in,s=e.next_in,c=e.input,e.avail_in=d,e.next_in=0,e.input=t,UV(r);r.lookahead>=3;){n=r.strstart,i=r.lookahead-2;do{r.ins_h=(r.ins_h<<r.hash_shift^r.window[n+3-1])&r.hash_mask,r.prev[n&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=n,n++}while(--i);r.strstart=n,r.lookahead=2,UV(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=2,r.match_available=0,e.next_in=s,e.input=c,e.avail_in=a,r.wrap=o,0},wU.deflateInfo="pako deflate (from Nodeca project)";var XV={},KV=AU,qV=!0,WV=!0;try{String.fromCharCode.apply(null,[0])}catch(I0){qV=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(I0){WV=!1}for(var YV=new KV.Buf8(256),JV=0;JV<256;JV++)YV[JV]=JV>=252?6:JV>=248?5:JV>=240?4:JV>=224?3:JV>=192?2:1;function QV(e,t){if(t<65534&&(e.subarray&&WV||!e.subarray&&qV))return String.fromCharCode.apply(null,KV.shrinkBuf(e,t));for(var r="",n=0;n<t;n++)r+=String.fromCharCode(e[n]);return r}YV[254]=YV[254]=1,XV.string2buf=function(e){var t,r,n,i,o,a=e.length,s=0;for(i=0;i<a;i++)55296==(64512&(r=e.charCodeAt(i)))&&i+1<a&&56320==(64512&(n=e.charCodeAt(i+1)))&&(r=65536+(r-55296<<10)+(n-56320),i++),s+=r<128?1:r<2048?2:r<65536?3:4;for(t=new KV.Buf8(s),o=0,i=0;o<s;i++)55296==(64512&(r=e.charCodeAt(i)))&&i+1<a&&56320==(64512&(n=e.charCodeAt(i+1)))&&(r=65536+(r-55296<<10)+(n-56320),i++),r<128?t[o++]=r:r<2048?(t[o++]=192|r>>>6,t[o++]=128|63&r):r<65536?(t[o++]=224|r>>>12,t[o++]=128|r>>>6&63,t[o++]=128|63&r):(t[o++]=240|r>>>18,t[o++]=128|r>>>12&63,t[o++]=128|r>>>6&63,t[o++]=128|63&r);return t},XV.buf2binstring=function(e){return QV(e,e.length)},XV.binstring2buf=function(e){for(var t=new KV.Buf8(e.length),r=0,n=t.length;r<n;r++)t[r]=e.charCodeAt(r);return t},XV.buf2string=function(e,t){var r,n,i,o,a=t||e.length,s=new Array(2*a);for(n=0,r=0;r<a;)if((i=e[r++])<128)s[n++]=i;else if((o=YV[i])>4)s[n++]=65533,r+=o-1;else{for(i&=2===o?31:3===o?15:7;o>1&&r<a;)i=i<<6|63&e[r++],o--;o>1?s[n++]=65533:i<65536?s[n++]=i:(i-=65536,s[n++]=55296|i>>10&1023,s[n++]=56320|1023&i)}return QV(s,n)},XV.utf8border=function(e,t){var r;for((t=t||e.length)>e.length&&(t=e.length),r=t-1;r>=0&&128==(192&e[r]);)r--;return r<0||0===r?t:r+YV[e[r]]>t?r:t};var ZV=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0},$V=wU,eF=AU,tF=XV,rF=mV,nF=ZV,iF=Object.prototype.toString;function oF(e){if(!(this instanceof oF))return new oF(e);this.options=eF.assign({level:-1,method:8,chunkSize:16384,windowBits:15,memLevel:8,strategy:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new nF,this.strm.avail_out=0;var r=$V.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(0!==r)throw new Error(rF[r]);if(t.header&&$V.deflateSetHeader(this.strm,t.header),t.dictionary){var n;if(n="string"==typeof t.dictionary?tF.string2buf(t.dictionary):"[object ArrayBuffer]"===iF.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,0!==(r=$V.deflateSetDictionary(this.strm,n)))throw new Error(rF[r]);this._dict_set=!0}}function aF(e,t){var r=new oF(t);if(r.push(e,!0),r.err)throw r.msg||rF[r.err];return r.result}oF.prototype.push=function(e,t){var r,n,i=this.strm,o=this.options.chunkSize;if(this.ended)return!1;n=t===~~t?t:!0===t?4:0,"string"==typeof e?i.input=tF.string2buf(e):"[object ArrayBuffer]"===iF.call(e)?i.input=new Uint8Array(e):i.input=e,i.next_in=0,i.avail_in=i.input.length;do{if(0===i.avail_out&&(i.output=new eF.Buf8(o),i.next_out=0,i.avail_out=o),1!==(r=$V.deflate(i,n))&&0!==r)return this.onEnd(r),this.ended=!0,!1;0!==i.avail_out&&(0!==i.avail_in||4!==n&&2!==n)||("string"===this.options.to?this.onData(tF.buf2binstring(eF.shrinkBuf(i.output,i.next_out))):this.onData(eF.shrinkBuf(i.output,i.next_out)))}while((i.avail_in>0||0===i.avail_out)&&1!==r);return 4===n?(r=$V.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,0===r):2!==n||(this.onEnd(0),i.avail_out=0,!0)},oF.prototype.onData=function(e){this.chunks.push(e)},oF.prototype.onEnd=function(e){0===e&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=eF.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},RU.Deflate=oF,RU.deflate=aF,RU.deflateRaw=function(e,t){return(t=t||{}).raw=!0,aF(e,t)},RU.gzip=function(e,t){return(t=t||{}).gzip=!0,aF(e,t)};var sF={},cF=le,uF=Og,dF=Vs,lF=de,hF=ce.RegExp,fF=hF.prototype;cF&&lF((function(){var e=!0;try{hF(".","d")}catch(T0){e=!1}var t={},r="",n=e?"dgimsy":"gimsy",i=function(e,n){Object.defineProperty(t,e,{get:function(){return r+=n,!0}})},o={dotAll:"s",global:"g",ignoreCase:"i",multiline:"m",sticky:"y"};for(var a in e&&(o.hasIndices="d"),o)i(a,o[a]);return Object.getOwnPropertyDescriptor(fF,"flags").get.call(t)!==n||r!==n}))&&uF(fF,"flags",{configurable:!0,get:dF});var pF={},vF=AU,_F=15,mF=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],yF=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],gF=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],SF=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64],bF=AU,EF=fV,kF=_V,TF=function(e,t){var r,n,i,o,a,s,c,u,d,l,h,f,p,v,_,m,y,g,S,b,E,k,T,I,A;r=e.state,n=e.next_in,I=e.input,i=n+(e.avail_in-5),o=e.next_out,A=e.output,a=o-(t-e.avail_out),s=o+(e.avail_out-257),c=r.dmax,u=r.wsize,d=r.whave,l=r.wnext,h=r.window,f=r.hold,p=r.bits,v=r.lencode,_=r.distcode,m=(1<<r.lenbits)-1,y=(1<<r.distbits)-1;e:do{p<15&&(f+=I[n++]<<p,p+=8,f+=I[n++]<<p,p+=8),g=v[f&m];t:for(;;){if(f>>>=S=g>>>24,p-=S,0===(S=g>>>16&255))A[o++]=65535&g;else{if(!(16&S)){if(0==(64&S)){g=v[(65535&g)+(f&(1<<S)-1)];continue t}if(32&S){r.mode=12;break e}e.msg="invalid literal/length code",r.mode=30;break e}b=65535&g,(S&=15)&&(p<S&&(f+=I[n++]<<p,p+=8),b+=f&(1<<S)-1,f>>>=S,p-=S),p<15&&(f+=I[n++]<<p,p+=8,f+=I[n++]<<p,p+=8),g=_[f&y];r:for(;;){if(f>>>=S=g>>>24,p-=S,!(16&(S=g>>>16&255))){if(0==(64&S)){g=_[(65535&g)+(f&(1<<S)-1)];continue r}e.msg="invalid distance code",r.mode=30;break e}if(E=65535&g,p<(S&=15)&&(f+=I[n++]<<p,(p+=8)<S&&(f+=I[n++]<<p,p+=8)),(E+=f&(1<<S)-1)>c){e.msg="invalid distance too far back",r.mode=30;break e}if(f>>>=S,p-=S,E>(S=o-a)){if((S=E-S)>d&&r.sane){e.msg="invalid distance too far back",r.mode=30;break e}if(k=0,T=h,0===l){if(k+=u-S,S<b){b-=S;do{A[o++]=h[k++]}while(--S);k=o-E,T=A}}else if(l<S){if(k+=u+l-S,(S-=l)<b){b-=S;do{A[o++]=h[k++]}while(--S);if(k=0,l<b){b-=S=l;do{A[o++]=h[k++]}while(--S);k=o-E,T=A}}}else if(k+=l-S,S<b){b-=S;do{A[o++]=h[k++]}while(--S);k=o-E,T=A}for(;b>2;)A[o++]=T[k++],A[o++]=T[k++],A[o++]=T[k++],b-=3;b&&(A[o++]=T[k++],b>1&&(A[o++]=T[k++]))}else{k=o-E;do{A[o++]=A[k++],A[o++]=A[k++],A[o++]=A[k++],b-=3}while(b>2);b&&(A[o++]=A[k++],b>1&&(A[o++]=A[k++]))}break}}break}}while(n<i&&o<s);n-=b=p>>3,f&=(1<<(p-=b<<3))-1,e.next_in=n,e.next_out=o,e.avail_in=n<i?i-n+5:5-(n-i),e.avail_out=o<s?s-o+257:257-(o-s),r.hold=f,r.bits=p},IF=function(e,t,r,n,i,o,a,s){var c,u,d,l,h,f,p,v,_,m=s.bits,y=0,g=0,S=0,b=0,E=0,k=0,T=0,I=0,A=0,R=0,w=null,C=0,O=new vF.Buf16(16),x=new vF.Buf16(16),D=null,N=0;for(y=0;y<=_F;y++)O[y]=0;for(g=0;g<n;g++)O[t[r+g]]++;for(E=m,b=_F;b>=1&&0===O[b];b--);if(E>b&&(E=b),0===b)return i[o++]=20971520,i[o++]=20971520,s.bits=1,0;for(S=1;S<b&&0===O[S];S++);for(E<S&&(E=S),I=1,y=1;y<=_F;y++)if(I<<=1,(I-=O[y])<0)return-1;if(I>0&&(0===e||1!==b))return-1;for(x[1]=0,y=1;y<_F;y++)x[y+1]=x[y]+O[y];for(g=0;g<n;g++)0!==t[r+g]&&(a[x[t[r+g]]++]=g);if(0===e?(w=D=a,f=19):1===e?(w=mF,C-=257,D=yF,N-=257,f=256):(w=gF,D=SF,f=-1),R=0,g=0,y=S,h=o,k=E,T=0,d=-1,l=(A=1<<E)-1,1===e&&A>852||2===e&&A>592)return 1;for(;;){p=y-T,a[g]<f?(v=0,_=a[g]):a[g]>f?(v=D[N+a[g]],_=w[C+a[g]]):(v=96,_=0),c=1<<y-T,S=u=1<<k;do{i[h+(R>>T)+(u-=c)]=p<<24|v<<16|_|0}while(0!==u);for(c=1<<y-1;R&c;)c>>=1;if(0!==c?(R&=c-1,R+=c):R=0,g++,0==--O[y]){if(y===b)break;y=t[r+a[g]]}if(y>E&&(R&l)!==d){for(0===T&&(T=E),h+=S,I=1<<(k=y-T);k+T<b&&!((I-=O[k+T])<=0);)k++,I<<=1;if(A+=1<<k,1===e&&A>852||2===e&&A>592)return 1;i[d=R&l]=E<<24|k<<16|h-o|0}}return 0!==R&&(i[h+R]=y-T<<24|64<<16|0),s.bits=E,0},AF=-2,RF=12,wF=30;function CF(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function OF(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new bF.Buf16(320),this.work=new bF.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function xF(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=1,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new bF.Buf32(852),t.distcode=t.distdyn=new bF.Buf32(592),t.sane=1,t.back=-1,0):AF}function DF(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,xF(e)):AF}function NF(e,t){var r,n;return e&&e.state?(n=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?AF:(null!==n.window&&n.wbits!==t&&(n.window=null),n.wrap=r,n.wbits=t,DF(e))):AF}function PF(e,t){var r,n;return e?(n=new OF,e.state=n,n.window=null,0!==(r=NF(e,t))&&(e.state=null),r):AF}var MF,LF,UF=!0;function VF(e){if(UF){var t;for(MF=new bF.Buf32(512),LF=new bF.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(IF(1,e.lens,0,288,MF,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;IF(2,e.lens,0,32,LF,0,e.work,{bits:5}),UF=!1}e.lencode=MF,e.lenbits=9,e.distcode=LF,e.distbits=5}function FF(e,t,r,n){var i,o=e.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new bF.Buf8(o.wsize)),n>=o.wsize?(bF.arraySet(o.window,t,r-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):((i=o.wsize-o.wnext)>n&&(i=n),bF.arraySet(o.window,t,r-n,i,o.wnext),(n-=i)?(bF.arraySet(o.window,t,r-n,n,0),o.wnext=n,o.whave=o.wsize):(o.wnext+=i,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=i))),0}pF.inflateReset=DF,pF.inflateReset2=NF,pF.inflateResetKeep=xF,pF.inflateInit=function(e){return PF(e,15)},pF.inflateInit2=PF,pF.inflate=function(e,t){var r,n,i,o,a,s,c,u,d,l,h,f,p,v,_,m,y,g,S,b,E,k,T,I,A=0,R=new bF.Buf8(4),w=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&0!==e.avail_in)return AF;(r=e.state).mode===RF&&(r.mode=13),a=e.next_out,i=e.output,c=e.avail_out,o=e.next_in,n=e.input,s=e.avail_in,u=r.hold,d=r.bits,l=s,h=c,k=0;e:for(;;)switch(r.mode){case 1:if(0===r.wrap){r.mode=13;break}for(;d<16;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(2&r.wrap&&35615===u){r.check=0,R[0]=255&u,R[1]=u>>>8&255,r.check=kF(r.check,R,2,0),u=0,d=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",r.mode=wF;break}if(8!=(15&u)){e.msg="unknown compression method",r.mode=wF;break}if(d-=4,E=8+(15&(u>>>=4)),0===r.wbits)r.wbits=E;else if(E>r.wbits){e.msg="invalid window size",r.mode=wF;break}r.dmax=1<<E,e.adler=r.check=1,r.mode=512&u?10:RF,u=0,d=0;break;case 2:for(;d<16;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(r.flags=u,8!=(255&r.flags)){e.msg="unknown compression method",r.mode=wF;break}if(57344&r.flags){e.msg="unknown header flags set",r.mode=wF;break}r.head&&(r.head.text=u>>8&1),512&r.flags&&(R[0]=255&u,R[1]=u>>>8&255,r.check=kF(r.check,R,2,0)),u=0,d=0,r.mode=3;case 3:for(;d<32;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}r.head&&(r.head.time=u),512&r.flags&&(R[0]=255&u,R[1]=u>>>8&255,R[2]=u>>>16&255,R[3]=u>>>24&255,r.check=kF(r.check,R,4,0)),u=0,d=0,r.mode=4;case 4:for(;d<16;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}r.head&&(r.head.xflags=255&u,r.head.os=u>>8),512&r.flags&&(R[0]=255&u,R[1]=u>>>8&255,r.check=kF(r.check,R,2,0)),u=0,d=0,r.mode=5;case 5:if(1024&r.flags){for(;d<16;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}r.length=u,r.head&&(r.head.extra_len=u),512&r.flags&&(R[0]=255&u,R[1]=u>>>8&255,r.check=kF(r.check,R,2,0)),u=0,d=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&((f=r.length)>s&&(f=s),f&&(r.head&&(E=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),bF.arraySet(r.head.extra,n,o,f,E)),512&r.flags&&(r.check=kF(r.check,n,f,o)),s-=f,o+=f,r.length-=f),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===s)break e;f=0;do{E=n[o+f++],r.head&&E&&r.length<65536&&(r.head.name+=String.fromCharCode(E))}while(E&&f<s);if(512&r.flags&&(r.check=kF(r.check,n,f,o)),s-=f,o+=f,E)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=8;case 8:if(4096&r.flags){if(0===s)break e;f=0;do{E=n[o+f++],r.head&&E&&r.length<65536&&(r.head.comment+=String.fromCharCode(E))}while(E&&f<s);if(512&r.flags&&(r.check=kF(r.check,n,f,o)),s-=f,o+=f,E)break e}else r.head&&(r.head.comment=null);r.mode=9;case 9:if(512&r.flags){for(;d<16;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(u!==(65535&r.check)){e.msg="header crc mismatch",r.mode=wF;break}u=0,d=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=RF;break;case 10:for(;d<32;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}e.adler=r.check=CF(u),u=0,d=0,r.mode=11;case 11:if(0===r.havedict)return e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,r.hold=u,r.bits=d,2;e.adler=r.check=1,r.mode=RF;case RF:if(5===t||6===t)break e;case 13:if(r.last){u>>>=7&d,d-=7&d,r.mode=27;break}for(;d<3;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}switch(r.last=1&u,d-=1,3&(u>>>=1)){case 0:r.mode=14;break;case 1:if(VF(r),r.mode=20,6===t){u>>>=2,d-=2;break e}break;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=wF}u>>>=2,d-=2;break;case 14:for(u>>>=7&d,d-=7&d;d<32;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if((65535&u)!=(u>>>16^65535)){e.msg="invalid stored block lengths",r.mode=wF;break}if(r.length=65535&u,u=0,d=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(f=r.length){if(f>s&&(f=s),f>c&&(f=c),0===f)break e;bF.arraySet(i,n,o,f,a),s-=f,o+=f,c-=f,a+=f,r.length-=f;break}r.mode=RF;break;case 17:for(;d<14;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(r.nlen=257+(31&u),u>>>=5,d-=5,r.ndist=1+(31&u),u>>>=5,d-=5,r.ncode=4+(15&u),u>>>=4,d-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=wF;break}r.have=0,r.mode=18;case 18:for(;r.have<r.ncode;){for(;d<3;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}r.lens[w[r.have++]]=7&u,u>>>=3,d-=3}for(;r.have<19;)r.lens[w[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,T={bits:r.lenbits},k=IF(0,r.lens,0,19,r.lencode,0,r.work,T),r.lenbits=T.bits,k){e.msg="invalid code lengths set",r.mode=wF;break}r.have=0,r.mode=19;case 19:for(;r.have<r.nlen+r.ndist;){for(;m=(A=r.lencode[u&(1<<r.lenbits)-1])>>>16&255,y=65535&A,!((_=A>>>24)<=d);){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(y<16)u>>>=_,d-=_,r.lens[r.have++]=y;else{if(16===y){for(I=_+2;d<I;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(u>>>=_,d-=_,0===r.have){e.msg="invalid bit length repeat",r.mode=wF;break}E=r.lens[r.have-1],f=3+(3&u),u>>>=2,d-=2}else if(17===y){for(I=_+3;d<I;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}d-=_,E=0,f=3+(7&(u>>>=_)),u>>>=3,d-=3}else{for(I=_+7;d<I;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}d-=_,E=0,f=11+(127&(u>>>=_)),u>>>=7,d-=7}if(r.have+f>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=wF;break}for(;f--;)r.lens[r.have++]=E}}if(r.mode===wF)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=wF;break}if(r.lenbits=9,T={bits:r.lenbits},k=IF(1,r.lens,0,r.nlen,r.lencode,0,r.work,T),r.lenbits=T.bits,k){e.msg="invalid literal/lengths set",r.mode=wF;break}if(r.distbits=6,r.distcode=r.distdyn,T={bits:r.distbits},k=IF(2,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,T),r.distbits=T.bits,k){e.msg="invalid distances set",r.mode=wF;break}if(r.mode=20,6===t)break e;case 20:r.mode=21;case 21:if(s>=6&&c>=258){e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,r.hold=u,r.bits=d,TF(e,h),a=e.next_out,i=e.output,c=e.avail_out,o=e.next_in,n=e.input,s=e.avail_in,u=r.hold,d=r.bits,r.mode===RF&&(r.back=-1);break}for(r.back=0;m=(A=r.lencode[u&(1<<r.lenbits)-1])>>>16&255,y=65535&A,!((_=A>>>24)<=d);){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(m&&0==(240&m)){for(g=_,S=m,b=y;m=(A=r.lencode[b+((u&(1<<g+S)-1)>>g)])>>>16&255,y=65535&A,!(g+(_=A>>>24)<=d);){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}u>>>=g,d-=g,r.back+=g}if(u>>>=_,d-=_,r.back+=_,r.length=y,0===m){r.mode=26;break}if(32&m){r.back=-1,r.mode=RF;break}if(64&m){e.msg="invalid literal/length code",r.mode=wF;break}r.extra=15&m,r.mode=22;case 22:if(r.extra){for(I=r.extra;d<I;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}r.length+=u&(1<<r.extra)-1,u>>>=r.extra,d-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;m=(A=r.distcode[u&(1<<r.distbits)-1])>>>16&255,y=65535&A,!((_=A>>>24)<=d);){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(0==(240&m)){for(g=_,S=m,b=y;m=(A=r.distcode[b+((u&(1<<g+S)-1)>>g)])>>>16&255,y=65535&A,!(g+(_=A>>>24)<=d);){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}u>>>=g,d-=g,r.back+=g}if(u>>>=_,d-=_,r.back+=_,64&m){e.msg="invalid distance code",r.mode=wF;break}r.offset=y,r.extra=15&m,r.mode=24;case 24:if(r.extra){for(I=r.extra;d<I;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}r.offset+=u&(1<<r.extra)-1,u>>>=r.extra,d-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=wF;break}r.mode=25;case 25:if(0===c)break e;if(f=h-c,r.offset>f){if((f=r.offset-f)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=wF;break}f>r.wnext?(f-=r.wnext,p=r.wsize-f):p=r.wnext-f,f>r.length&&(f=r.length),v=r.window}else v=i,p=a-r.offset,f=r.length;f>c&&(f=c),c-=f,r.length-=f;do{i[a++]=v[p++]}while(--f);0===r.length&&(r.mode=21);break;case 26:if(0===c)break e;i[a++]=r.length,c--,r.mode=21;break;case 27:if(r.wrap){for(;d<32;){if(0===s)break e;s--,u|=n[o++]<<d,d+=8}if(h-=c,e.total_out+=h,r.total+=h,h&&(e.adler=r.check=r.flags?kF(r.check,i,h,a-h):EF(r.check,i,h,a-h)),h=c,(r.flags?u:CF(u))!==r.check){e.msg="incorrect data check",r.mode=wF;break}u=0,d=0}r.mode=28;case 28:if(r.wrap&&r.flags){for(;d<32;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(u!==(4294967295&r.total)){e.msg="incorrect length check",r.mode=wF;break}u=0,d=0}r.mode=29;case 29:k=1;break e;case wF:k=-3;break e;case 31:return-4;default:return AF}return e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,r.hold=u,r.bits=d,(r.wsize||h!==e.avail_out&&r.mode<wF&&(r.mode<27||4!==t))&&FF(e,e.output,e.next_out,h-e.avail_out),l-=e.avail_in,h-=e.avail_out,e.total_in+=l,e.total_out+=h,r.total+=h,r.wrap&&h&&(e.adler=r.check=r.flags?kF(r.check,i,h,e.next_out-h):EF(r.check,i,h,e.next_out-h)),e.data_type=r.bits+(r.last?64:0)+(r.mode===RF?128:0)+(20===r.mode||15===r.mode?256:0),(0===l&&0===h||4===t)&&0===k&&(k=-5),k},pF.inflateEnd=function(e){if(!e||!e.state)return AF;var t=e.state;return t.window&&(t.window=null),e.state=null,0},pF.inflateGetHeader=function(e,t){var r;return e&&e.state?0==(2&(r=e.state).wrap)?AF:(r.head=t,t.done=!1,0):AF},pF.inflateSetDictionary=function(e,t){var r,n=t.length;return e&&e.state?0!==(r=e.state).wrap&&11!==r.mode?AF:11===r.mode&&EF(1,t,n,0)!==r.check?-3:FF(e,t,n,n)?(r.mode=31,-4):(r.havedict=1,0):AF},pF.inflateInfo="pako inflate (from Nodeca project)";var BF={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};var jF=pF,GF=AU,HF=XV,zF=BF,XF=mV,KF=ZV,qF=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1},WF=Object.prototype.toString;function YF(e){if(!(this instanceof YF))return new YF(e);this.options=GF.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new KF,this.strm.avail_out=0;var r=jF.inflateInit2(this.strm,t.windowBits);if(r!==zF.Z_OK)throw new Error(XF[r]);if(this.header=new qF,jF.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=HF.string2buf(t.dictionary):"[object ArrayBuffer]"===WF.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(r=jF.inflateSetDictionary(this.strm,t.dictionary))!==zF.Z_OK))throw new Error(XF[r])}function JF(e,t){var r=new YF(t);if(r.push(e,!0),r.err)throw r.msg||XF[r.err];return r.result}YF.prototype.push=function(e,t){var r,n,i,o,a,s=this.strm,c=this.options.chunkSize,u=this.options.dictionary,d=!1;if(this.ended)return!1;n=t===~~t?t:!0===t?zF.Z_FINISH:zF.Z_NO_FLUSH,"string"==typeof e?s.input=HF.binstring2buf(e):"[object ArrayBuffer]"===WF.call(e)?s.input=new Uint8Array(e):s.input=e,s.next_in=0,s.avail_in=s.input.length;do{if(0===s.avail_out&&(s.output=new GF.Buf8(c),s.next_out=0,s.avail_out=c),(r=jF.inflate(s,zF.Z_NO_FLUSH))===zF.Z_NEED_DICT&&u&&(r=jF.inflateSetDictionary(this.strm,u)),r===zF.Z_BUF_ERROR&&!0===d&&(r=zF.Z_OK,d=!1),r!==zF.Z_STREAM_END&&r!==zF.Z_OK)return this.onEnd(r),this.ended=!0,!1;s.next_out&&(0!==s.avail_out&&r!==zF.Z_STREAM_END&&(0!==s.avail_in||n!==zF.Z_FINISH&&n!==zF.Z_SYNC_FLUSH)||("string"===this.options.to?(i=HF.utf8border(s.output,s.next_out),o=s.next_out-i,a=HF.buf2string(s.output,i),s.next_out=o,s.avail_out=c-o,o&&GF.arraySet(s.output,s.output,i,o,0),this.onData(a)):this.onData(GF.shrinkBuf(s.output,s.next_out)))),0===s.avail_in&&0===s.avail_out&&(d=!0)}while((s.avail_in>0||0===s.avail_out)&&r!==zF.Z_STREAM_END);return r===zF.Z_STREAM_END&&(n=zF.Z_FINISH),n===zF.Z_FINISH?(r=jF.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===zF.Z_OK):n!==zF.Z_SYNC_FLUSH||(this.onEnd(zF.Z_OK),s.avail_out=0,!0)},YF.prototype.onData=function(e){this.chunks.push(e)},YF.prototype.onEnd=function(e){e===zF.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=GF.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},sF.Inflate=YF,sF.inflate=JF,sF.inflateRaw=function(e,t){return(t=t||{}).raw=!0,JF(e,t)},sF.ungzip=JF;var QF={};(0,AU.assign)(QF,RU,sF,BF);var ZF=QF,$F=function(e){return e.RTC="rtc",e}($F||{}),eB=function(e){return e.W_5="5",e}(eB||{}),tB=function(e){return e.IOS="ios",e.ANDROID="android",e.WEB="web",e.WINDOWS="windows",e.MAC="mac",e.LINUX="linux",e}(tB||{}),rB=function(e){return e.REQUEST="request",e.RESPONSE="response",e}(rB||{}),nB=function(e){return e.WEBSOCKET_RECONNECTING="websocket reconnecting",e.PEERCONNECTION_RECONNECTING="peerconnection reconnecting",e.DISCONNECTED="DISCONNECTED",e.LAN="LAN",e.WIFI="WIFI",e.W_2="2G",e.W_3="3G",e.W_4="4G",e.W_5="5G",e.UNKNOWN="UNKNOWN",e}(nB||{}),iB=function(e){return e.WEBSOCKET="websocket",e.NETWORKCHANGED="networkChanged",e.PEERCONNECTION="peerconnection",e}(iB||{}),oB=function(e){return e.WEBSOCKET_RECONNECTED="websocket reconnected",e.PEERCONNECTION_RECONNECTED="peerconnection reconnected",e}(oB||{}),aB=function(e){return e.WEBSOCKET="websocket",e.NETWORKCHANGED="networkChanged",e.PEERCONNECTION="peerconnection",e}(aB||{}),sB=function(e){return e.REQUEST="request",e.RESPONSE="response",e.KCP_REQUEST="kcp request",e.KCP_RESPONSE="kcp response",e.QUIC_REQUEST="quic request",e.QUIC_RESPONSE="quic response",e}(sB||{}),cB=function(e){return e.NEW="NEW",e.CHECKING="CHECKING",e.CONNECTED="CONNECTED",e.COMPLETED="COMPLETED",e.FAILED="FAILED",e.DISCONNECTED="DISCONNECTED",e.CLOSED="CLOSED",e.DATACHANNEL_CONNECTING="DATACHANNEL_CONNECTING",e.DATACHANNEL_OPEN="DATACHANNEL_OPEN",e.DATACHANNEL_CLOSING="DATACHANNEL_CLOSING",e.DATACHANNEL_CLOSED="DATACHANNEL_CLOSED",e}(cB||{}),uB=function(e){return e.SUCCEED="succeed",e.MESSAGE_ID_ERROR="message id error",e.ZIP_FAILED="zip failed",e.UNZIP_FAILED="unzip failed",e.MESSAGE_KEY_EMPTY="message key empty",e.MESSAGE_KEY_PARSE_FAILED="message key parse failed",e.MESSAGE_KEY_INVALID="message key invalid",e.ENCRYPT_FAILED="encrypt failed",e.DECRYPT_FAILED="decrypt failed",e.MESSAGE_TOO_BIG="message too big",e.INVALID_DATA="invalid data",e.MESSAGE_PARSE_FAILED="message parse failed",e}(uB||{}),dB=function(e){return e.UP="up",e.DOWN="down",e.DIRECT="direct",e}(dB||{}),lB=function(e){return e.UP="up",e.DOWN="down",e.PRE="pre",e}(lB||{}),hB=function(e){return e.UP="up",e.DOWN="down",e.PRE="pre",e}(hB||{}),fB=function(e){return e.W_0="0",e.W_1="1",e}(fB||{}),pB=function(e){return e.UP="up",e.DOWN="down",e}(pB||{}),vB=function(e){return e.ANSWER="answer",e.INCRANSWER="incranswer",e}(vB||{}),_B=function(e){return e.UP="up",e.DOWN="down",e}(_B||{}),mB=function(e){return e.SUCCESS="success",e.FAIL="fail",e}(mB||{}),yB=function(e){return e.W_0="0",e.W_1="1",e}(yB||{}),gB=function(e){return e.LEAVE_ROOM="leave room",e.ACK_FAILED="ack failed",e.SET_ANSWER_SDP_FAILED="set answer sdp failed",e.ICE_FAILED="ice failed",e.STREAM_FAILED="stream failed",e.NETWORK_RECONNECTED="network reconnected",e.JOIN_ROOM_ACK_FAILED="join room ack failed",e.UNKNOWN="unknown",e}(gB||{}),SB=function(e){return e.SUCCESS="success",e.FAIL="fail",e.IGNORE="ignore",e}(SB||{}),bB=function(e){return e.LEAVE_ROOM="leave room",e.ACK_FAILED="ack failed",e.SET_ANSWER_SDP_FAILED="set answer sdp failed",e.ICE_FAILED="ice failed",e.STREAM_FAILED="stream failed",e.NETWORK_RECONNECTED="network reconnected",e.ON_STREAM_REMOVE="on stream remove",e.PUBLISH_MUTE="publish mute",e.UNKNOWN="unknown",e.ON_STREAM_REMOVE_CLIENT_UNPUBLISHED="on stream remove:client unpublished",e.ON_STREAM_REMOVE_PUBLISH_FAILED="on stream remove:publish failed",e.ON_STREAM_REMOVE_STREAM_REMOVED="on stream remove:stream removed",e.ON_STREAM_REMOVE_CLIENT_DISCONNECTED="on stream remove:client disconnected",e.ON_STREAM_REMOVE_CLIENT_REPUBLISH="on stream remove:client republish",e}(bB||{}),EB=function(e){return e.PLAYOUT_DEVICE_SWITCH="playout_device_switch",e.RECORD_DEVICE_SWITCH="record_device_switch",e.UNKNOWN="unknown",e}(EB||{}),kB=function(e){return e.BEGIN_SEND="begin_send",e.SENT_END="sent_end",e.BEGIN_RECV="begin_recv",e.RECV_END="recv_end",e}(kB||{}),TB=function(e){return e.AUDIO="audio",e.VIDEO="video",e.SCREEN_VIDEO="screen_video",e.SCREEN_AUDIO="screen_audio",e}(TB||{}),IB=function(e){return e.LOGIN="login",e.PUBLISHER="publisher",e.UNMUTE="unmute",e.ENABLE="enable",e.PUSH="push",e.PUBLISH="publish",e.ONDEMAND="ondemand",e.SUBSCRIBE="subscribe",e.PUSH_TRACK="push_track",e.REMOTE_UNMUTE="remote_unmute",e.P2P="p2p",e}(IB||{}),AB=function(e){return e.TIMEOUT="timeout",e.AUDIENCE="audience",e.MUTE="mute",e.DISABLE="disable",e.STOP_PUSH="stop_push",e.UNPUBLISH="unpublish",e.NO_DEMAND="no_demand",e.LEAVE_ROOM="leave_room",e.UNSUBSCRIBE="unsubscribe",e.REMOVE_TRACK="remove_track",e.REMOTE_MUTE="remote_mute",e.USER_LEAVE="user_leave",e}(AB||{}),RB=function(e){return e.BEGIN="begin",e.END="end",e}(RB||{}),wB=function(e){return e.BEGIN="begin",e.END="end",e}(wB||{}),CB=function(e){return e.LEAVE_ROOM="leave_room",e.ACK_FAILED="ack_failed",e.TOKEN_ERROR="token_error",e.SIGNALING_ERROR="signaling_error",e.TIMEOUT_10="timeout_10",e.TIMEOUT_60="timeout_60",e}(CB||{}),OB=function(e){return e.P2P="p2p",e.P2P_OUTSIDE_ROOM="p2p_outside_room",e.P2SERVER="p2server",e}(OB||{}),xB=function(e){return e.START="start",e.START_CAPTURE_RESULT="start_capture_result",e.STARTED="started",e.RUNNING_FAILED="running_failed",e.STOP="stop",e.STOPPED="stopped",e}(xB||{}),DB=function(e){return e.SUCCESS="success",e.CAMERA_DEVICE_NO_PERMISSION="camera_device_no_permission",e.CAMERA_DEVICE_BUSY="camera_device_busy",e.CAMERA_DEVICE_FAILURE="camera_device_failure",e.CAMERA_DEVICE_NOT_FOUND="camera_device_not_found",e.CAMERA_DEVICE_DISCONNECTED="camera_device_disconnected",e.TIMEOUT="timeout",e.ABORT="abort",e}(DB||{}),NB=function(){function e(t){u(this,e),h(this,"_event_key",void 0),h(this,"_device_id",void 0),h(this,"_rtc_app_id",void 0),h(this,"_product_line",void 0),h(this,"_report_version",void 0),h(this,"_os",void 0),h(this,"_rtc_sdk_version",void 0),h(this,"_rtc_timestamp",void 0),h(this,"_rtc_sdk_git_commit",void 0),h(this,"_report_id",void 0),h(this,"_connection_id",void 0),h(this,"_rtc_sid",void 0),h(this,"_engine_session_id",void 0),h(this,"_rtc_business_id",void 0),h(this,"_app_sate",void 0),h(this,"_project_key",void 0),h(this,"_network_type",void 0),h(this,"_app_version",void 0),h(this,"_aid",void 0),h(this,"_device_model",void 0),h(this,"_device_brand",void 0),h(this,"_common_extra_info",void 0),h(this,"_had_selected_p2p",void 0),h(this,"_rtc_env_type",void 0),h(this,"_room_id",void 0),h(this,"_user_id",void 0),h(this,"_rtc_session_id",void 0),h(this,"_user_agent",void 0),h(this,"_auto_play_policy",void 0),h(this,"_platform",void 0),h(this,"_product",void 0),h(this,"_log_cache_key",void 0),h(this,"_overSea","0"),this.monitor=t}return l(e,[{key:"setStats",value:function(e){var t=this;Object.keys(e).forEach((function(r){t["_"+r]=e[r]})),this.monitor.StartUp()}},{key:"event_key",get:function(){return this._event_key}},{key:"device_id",get:function(){return this._device_id}},{key:"rtc_app_id",get:function(){return this._rtc_app_id}},{key:"product_line",get:function(){return this._product_line}},{key:"report_version",get:function(){return this._report_version}},{key:"os",get:function(){return this._os}},{key:"rtc_sdk_version",get:function(){return this._rtc_sdk_version}},{key:"rtc_timestamp",get:function(){return this._rtc_timestamp}},{key:"rtc_sdk_git_commit",get:function(){return this._rtc_sdk_git_commit}},{key:"report_id",get:function(){return this._report_id}},{key:"connection_id",get:function(){return this._connection_id}},{key:"rtc_sid",get:function(){return this._rtc_sid}},{key:"engine_session_id",get:function(){return this._engine_session_id}},{key:"rtc_business_id",get:function(){return this._rtc_business_id}},{key:"app_sate",get:function(){return this._app_sate}},{key:"project_key",get:function(){return this._project_key}},{key:"network_type",get:function(){return this._network_type}},{key:"app_version",get:function(){return this._app_version}},{key:"aid",get:function(){return this._aid}},{key:"device_model",get:function(){return this._device_model}},{key:"device_brand",get:function(){return this._device_brand}},{key:"common_extra_info",get:function(){return this._common_extra_info}},{key:"had_selected_p2p",get:function(){return this._had_selected_p2p}},{key:"rtc_env_type",get:function(){return this._rtc_env_type}},{key:"room_id",get:function(){return this._room_id}},{key:"user_id",get:function(){return this._user_id}},{key:"rtc_session_id",get:function(){return this._rtc_session_id}},{key:"user_agent",get:function(){return this._user_agent}},{key:"auto_play_policy",get:function(){return this._auto_play_policy}},{key:"platform",get:function(){return this._platform||"web"}},{key:"product",get:function(){return this._product||"webrtc"}},{key:"log_cache_key",get:function(){return this._log_cache_key}},{key:"overSea",get:function(){return this._overSea}}]),e}(),PB=function(e){f(r,e);var t=g(r);function r(){var e;return u(this,r),h(m(e=t.call(this)),"report_id",void 0),h(m(e),"report_common",void 0),h(m(e),"modify_ids",void 0),h(m(e),"dataBuffer",void 0),h(m(e),"posting",void 0),h(m(e),"sucSendTimer",void 0),h(m(e),"preSucTime",void 0),h(m(e),"errSendTimer",void 0),h(m(e),"errSendDelay",void 0),h(m(e),"commonStats",void 0),e.report_id=0,e.dataBuffer=[],e.posting=!1,e.report_common={},e.modify_ids={},e.preSucTime=0,e.errSendDelay=100,e.commonStats=new NB(m(e)),vP()||window.addEventListener("beforeunload",(function(){clearTimeout(e.errSendTimer),clearTimeout(e.sucSendTimer),e.send(null,!0)})),e}return l(r,[{key:"push",value:function(e,t){t?this.send(e):(this.dataBuffer.push(e),!this.posting&&!this.errSendTimer&&Date.now()-this.preSucTime>2e3&&(clearTimeout(this.sucSendTimer),this.send()))}},{key:"unshift",value:function(e){this.dataBuffer=e.concat(this.dataBuffer)}},{key:"send",value:function(e,t){var r=this;if(e||this.dataBuffer.length){var n={data:e||this.dataBuffer.splice(0,4e3),header:this.report_common,from:"web",os:"web",version:"1"},i=new XMLHttpRequest;i.timeout=1e4,i.onreadystatechange=function(){if(4===i.readyState){var o;if(e||(r.posting=!1),200===i.status||304===i.status)try{o=JSON.parse(i.responseText)}catch(T0){}o&&0===o.StatusCode?e||t||(!vP()&&location.search.includes("_rtc_autotest_")&&r.safeEmit("report_event",n),r.sucSend()):e?r.send(e):(r.unshift(n.data),t?r.send():r.errSend())}};var o=oj.LOG_SERVER_URL;if(i.open("POST",o,!0),e||(this.posting=!0),!vP()&&location.search.includes("_rtc_debug_"))i.send(JSON.stringify(n));else{var a=ZF.gzip(JSON.stringify(n));i.setRequestHeader("Content-Encoding","gzip"),i.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"),i.send(a)}}}},{key:"sucSend",value:function(){this.errSendDelay=100,this.preSucTime=Date.now(),this.sucSendTimer=setTimeout(this.send.bind(this),2e3)}},{key:"errSend",value:function(){var e=this;this.errSendTimer=setTimeout((function(){e.send(),e.errSendTimer=null}),this.errSendDelay),this.errSendDelay*=2}},{key:"StartUp",value:function(){var e=this.report_common,t=this.commonStats,r=t.event_key,n=t.device_id,i=t.rtc_app_id,o=t.product_line,a=t.report_version,s=t.os,c=t.rtc_sdk_version,u=t.rtc_timestamp,d=t.rtc_sdk_git_commit,l=t.report_id,h=t.rtc_sid,f=t.engine_session_id,p=t.rtc_business_id,v=t.project_key,_=t.network_type,m=t.app_version,y=t.aid,g=t.device_model,S=t.device_brand,b=t.common_extra_info,E=t.had_selected_p2p,k=t.rtc_env_type,T=t.user_agent,I=t.auto_play_policy,A=t.platform,R=t.product,w=t.log_cache_key,C=t.overSea;Object.assign(e,{event_key:r,device_id:n,rtc_app_id:i,product_line:o,report_version:a,os:s,rtc_sdk_version:c,rtc_timestamp:u,rtc_sdk_git_commit:d,report_id:l,rtc_sid:h,engine_session_id:f,rtc_business_id:p,project_key:v,network_type:_,app_version:m,aid:y,device_model:g,device_brand:S,common_extra_info:b,had_selected_p2p:E,rtc_env_type:k,user_agent:T,auto_play_policy:I,platform:A,product:R,log_cache_key:w,extra_is_oversea:C}),this.modify_ids.room_id=this.commonStats.room_id,this.modify_ids.user_id=this.commonStats.user_id,this.modify_ids.rtc_session_id=this.commonStats.rtc_session_id,this.modify_ids.connection_id=this.commonStats.connection_id,this.modify_ids.app_sate=this.commonStats.app_sate}},{key:"rtcSdkApiCall",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=i(i({event_key:"rtc_sdk_api_call",report_id:this.report_id++,rtc_timestamp:Date.now(),sdk_api_name:e,error_code:t,message:r},this.modify_ids),{},{common_extra_info:JSON.stringify(n)});n.streamId&&(o.stream_id=n.streamId),this.push(o)}},{key:"rtcSdkCallback",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=i(i({event_key:"rtc_sdk_callback",report_id:this.report_id++,rtc_timestamp:Date.now(),sdk_callback_name:e,error_code:t,message:r},this.modify_ids),{},{common_extra_info:JSON.stringify(n)});this.push(o)}},{key:"rtcGetConfig",value:function(e,t,r,n,o,a,s){var c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:{},u=i(i({event_key:"rtc_get_config",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,elapse:r,host:n,type:o,config_id:a,enable_cloud_proxy:s},this.modify_ids),{},{common_extra_info:JSON.stringify(c)});this.push(u)}},{key:"rtcReconnect",value:function(e,t,r,n){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},a=i(i({event_key:"rtc_reconnect",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,reconnect_id:r,reconnect_type:n},this.modify_ids),{},{common_extra_info:JSON.stringify(o)});this.push(a)}},{key:"rtcReconnected",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i({event_key:"rtc_reconnected",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,reconnect_type:t},this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}},{key:"rtcGetAccess",value:function(e,t,r,n,o,a){var s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:{},c=i(i({event_key:"rtc_get_access",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,elapse:r,type:n,host:o,connect_session_id:a},this.modify_ids),{},{common_extra_info:JSON.stringify(s)});this.push(c)}},{key:"rtcPreIceState",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i({event_key:"rtc_pre_ice_state",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,ice_state:t},this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}},{key:"rtcNodeChange",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=i(i({event_key:"rtc_node_change",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,reason:r},this.modify_ids),{},{common_extra_info:JSON.stringify(n)});this.push(o)}},{key:"rtcSignalingMsgError",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=i(i({event_key:"rtc_signaling_msg_error",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,reason:r},this.modify_ids),{},{common_extra_info:JSON.stringify(n)});this.push(o)}},{key:"rtcSignaling",value:function(e,t,r,n,o,a,s){var c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:{},u=i(i({event_key:"rtc_signaling",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,signaling_event:r,signaling_type:n,stream_id:o,stream_user_id:a,direction:s},this.modify_ids),{},{common_extra_info:JSON.stringify(c)});this.push(u)}},{key:"rtcJoinRoom",value:function(e,t,r,n){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},a=i(i({event_key:"rtc_join_room",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,deviceModel:t,deviceManufacturer:r,elapse:n},this.modify_ids),{},{common_extra_info:JSON.stringify(o)});this.push(a)}},{key:"rtcLeaveRoom",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=i(i({event_key:"rtc_leave_room",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,elapse:r},this.modify_ids),{},{common_extra_info:JSON.stringify(n)});this.push(o)}},{key:"rtcBeginCreateOffer",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=i(i({event_key:"rtc_begin_create_offer",report_id:this.report_id++,rtc_timestamp:Date.now(),direction:e,stream_id:t,stream_user_id:r},this.modify_ids),{},{common_extra_info:JSON.stringify(n)});this.push(o)}},{key:"rtcCreateOffer",value:function(e,t,r,n,o){var a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},s=i(i({event_key:"rtc_create_offer",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,direction:t,stream_id:r,stream_user_id:n,elapse:o},this.modify_ids),{},{common_extra_info:JSON.stringify(a)});this.push(s)}},{key:"rtcSetDescription",value:function(e,t,r,n,o,a,s){var c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:{},u=i(i({event_key:"rtc_set_description",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,is_local:r,direction:n,stream_id:o,stream_user_id:a,elapse:s},this.modify_ids),{},{common_extra_info:JSON.stringify(c)});this.push(u)}},{key:"rtcRecvAnswer",value:function(e,t,r,n,o,a,s){var c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:{},u=i(i({event_key:"rtc_recv_answer",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,answer_type:t,sequence_id:r,message:n,direction:o,stream_id:a,stream_user_id:s},this.modify_ids),{},{common_extra_info:JSON.stringify(c)});this.push(u)}},{key:"firstRemoteAudioRender",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i({event_key:"first_remote_audio_render",report_id:this.report_id++,rtc_timestamp:Date.now(),stream_id:e,stream_user_id:t},this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}},{key:"firstRemoteVideoRender",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i({event_key:"first_remote_video_render",report_id:this.report_id++,rtc_timestamp:Date.now(),stream_id:e,stream_user_id:t},this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}},{key:"rtcPublishStat",value:function(e,t,r,n){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},a=i(i({event_key:"rtc_publish_stat",report_id:this.report_id++,rtc_timestamp:Date.now(),result:e,is_screen:t,start:r,message:n},this.modify_ids),{},{common_extra_info:JSON.stringify(o)});this.push(a)}},{key:"rtcSubscribeStat",value:function(e,t,r,n){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},a=i(i({event_key:"rtc_subscribe_stat",report_id:this.report_id++,rtc_timestamp:Date.now(),result:e,start:t,message:r,stream_user_id:n},this.modify_ids),{},{common_extra_info:JSON.stringify(o)});this.push(a)}},{key:"rtcAudioDevice",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=i(i({event_key:"rtc_audio_device",report_id:this.report_id++,rtc_timestamp:Date.now(),audio_event:e,message:t,error_code:r},this.modify_ids),{},{common_extra_info:JSON.stringify(n)});this.push(o)}},{key:"rtcMediaStatistics",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i(i(i({event_key:"rtc_media_statistics",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}},{key:"rtcMessageStatistics",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=i(i({event_key:"rtc_message_statistics",report_id:this.report_id++,rtc_timestamp:Date.now(),dc_user_message:e,dc_room_message:t,media_server_ip:r},this.modify_ids),{},{common_extra_info:JSON.stringify(n)});this.push(o)}},{key:"rtcError",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i({event_key:"rtc_error",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,error_code:t},this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}},{key:"rtcInvokeStatus",value:function(e,t,r,n,o){var a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},s=i(i({event_key:"rtc_invoke_status",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,error_code:t,sdk_api_name:r,stream_id:n,elapse:o},this.modify_ids),{},{common_extra_info:JSON.stringify(a),direction:a.direction});this.push(s)}},{key:"rtcFirstFrame",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=i(i(i({event_key:"rtc_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),this.modify_ids),{},{common_extra_info:JSON.stringify(t)});this.push(r)}},{key:"rtcMuteRemote",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i({event_key:"rtc_mute_remote",report_id:this.report_id++,rtc_timestamp:Date.now(),mute_info:e,media_type:t},this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}},{key:"sdkInitEngine",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i({event_key:"sdk_init_engine",report_id:this.report_id++,rtc_timestamp:Date.now(),start:e,type:t},this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}},{key:"joinRoom",value:function(e,t,r,n){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},a=i(i({event_key:"join_room",report_id:this.report_id++,rtc_timestamp:Date.now(),type:e,start:t,result:r,reason:n},this.modify_ids),{},{common_extra_info:JSON.stringify(o)});this.push(a)}},{key:"p2pConnectionStatus",value:function(e,t,r,n,o){var a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},s=i(i({event_key:"p2p_connection_status",report_id:this.report_id++,rtc_timestamp:Date.now(),room_id:e,user_id:t,peer_user_id:r,status:n,elapse:o},this.modify_ids),{},{common_extra_info:JSON.stringify(a)});this.push(s)}},{key:"p2pConnectClosed",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=i(i({event_key:"p2p_connect_closed",report_id:this.report_id++,rtc_timestamp:Date.now(),p2p_selected:e},this.modify_ids),{},{common_extra_info:JSON.stringify(t)});this.push(r)}},{key:"rtcDeviceError",value:function(e,t,r,n,o,a,s,c,u,d,l,h,f,p,v,_){var m=arguments.length>16&&void 0!==arguments[16]?arguments[16]:{},y=i(i({event_key:"rtc_device_error",report_id:this.report_id++,rtc_timestamp:Date.now(),device_type:e,device_stage:t,error_code:r,system_error_code:n,system_api:o,call_parameters:a,location:s,message:c,media_device_id:u,media_device_name:d,elapse:l,scenario:h,event_session_id:f,device_pid:p,device_vid:v,media_mode:_},this.modify_ids),{},{common_extra_info:JSON.stringify(m)});this.push(y)}},{key:"rtcVideoDevice",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i({event_key:"rtc_video_device",report_id:this.report_id++,rtc_timestamp:Date.now(),media_device_id:e,media_device_name:t},this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}},{key:"rtcVideoCaptureEvent",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=i(i(i({event_key:"rtc_video_capture_event",report_id:this.report_id++,rtc_timestamp:Date.now()},e),this.modify_ids),{},{common_extra_info:JSON.stringify(t)});this.push(r)}},{key:"rtcEncodeFirstFrame",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i(i(i({event_key:"rtc_encode_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}},{key:"rtcFirstFrameEncoded",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i(i(i({event_key:"rtc_first_frame_encoded",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}},{key:"rtcSendFirstPacket",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i(i(i({event_key:"rtc_send_first_packet",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}},{key:"rtcRecvFirstPacket",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i(i(i({event_key:"rtc_recv_first_packet",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}},{key:"rtcRecvFirstFrame",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i(i(i({event_key:"rtc_recv_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}},{key:"rtcDecodeFirstFrame",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i(i(i({event_key:"rtc_decode_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}}]),r}($L),MB=new PB,LB=new PB,UB=new PB,VB=MB.commonStats,FB=LB.commonStats,BB=UB.commonStats;function jB(e){VB.setStats({app_sate:e}),FB.setStats({app_sate:e}),BB.setStats({app_sate:e})}!vP()&&(jB("active"),document.addEventListener("visibilitychange",(function(){"visible"===document.visibilityState?jB("active"):"hidden"===document.visibilityState&&jB("background")})));var GB={default:MB,rtm:LB,outsideRoom:UB};function HB(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default",t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return function(t,n,i){if("function"==typeof i.value){var o=i.value;i.value=function(){for(var t=arguments.length,i=new Array(t),a=0;a<t;a++)i[a]=arguments[a];var s={};r.forEach((function(e,t){s[e]=i[t]})),"joinRoom"===n&&VB.setStats({room_id:i[1]}),GB[e].rtcSdkApiCall(n,0,JSON.stringify(NP(i)),s);var c=o.apply(this,i);return"function"==typeof(null==c?void 0:c.then)?c.then((function(t){return GB[e].rtcSdkCallback(n,0,JSON.stringify(NP([t||{}]))),t})).catch((function(t){throw GB[e].rtcSdkCallback(n,t.code,JSON.stringify(t.message)),t})):(GB[e].rtcSdkCallback(n,0,JSON.stringify(NP([c||{}]))),c)}}}}function zB(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=e===oe.onUserMessageReceivedOutsideRoom||e===oe.onUserBinaryMessageReceivedOutsideRoom;(n?LB:MB).rtcSdkCallback(e,r,JSON.stringify(t))}function XB(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];(n?LB:MB).rtcInvokeStatus(JSON.stringify(t),r,e,"",0)}var KB="BytePlus",qB="RTC_DEVICE_ID",WB="RTC_ACCESS_NODE",YB="RTC_ACCESS_URLS",JB="RTC_H264_BLACK_LIST",QB="engine_BAC",ZB=function(){function e(){u(this,e)}return l(e,[{key:"get",value:function(e){var t=localStorage.getItem(e);if(!t)return null;try{var r=JSON.parse(t);return r.ttl>0&&Date.now()-r.saveTime>r.ttl?(this.delete(e),null):r.message}catch(n){return null}}},{key:"set",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,n={ttl:r,saveTime:Date.now(),message:t};try{return localStorage.setItem(e,JSON.stringify(n)),!0}catch(i){return!1}}},{key:"delete",value:function(e){try{return localStorage.removeItem(e),!0}catch(t){return!1}}}]),e}(),$B=function(e){f(r,e);var t=g(r);function r(){return u(this,r),t.apply(this,arguments)}return l(r,[{key:"getDeviceId",value:function(){if(vP())return"";var e=this.get(qB);return e&&!/^[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}$/.test(e)||(e=function(e){for(var t="",r=0;r<e;r++)t+=Math.floor(10*Math.random());return t}(30)),this.setDeviceId(e),e}},{key:"setDeviceId",value:function(e){return[VB,FB,BB].forEach((function(t){return t.setStats({device_id:e})})),this.set(qB,e),e}},{key:"getAccessNode",value:function(e){return this.get("".concat(WB,"_").concat(e,"-").concat(KB))}},{key:"setAccessNode",value:function(e,t,r){return this.set("".concat(WB,"_").concat(e,"-").concat(KB),t,1e3*r)}},{key:"clearAccessNode",value:function(e){this.delete("".concat(WB,"_").concat(e,"-").concat(KB))}},{key:"getAccessUrls",value:function(){return this.get("".concat(YB,"-").concat(KB))}},{key:"setAccessUrls",value:function(e){var t=e.map((function(e){var t=e.host,r=e.path;return"https://".concat(t).concat(r)}));return this.set("".concat(YB,"-").concat(KB),t)}},{key:"clearAccessUrls",value:function(){this.delete("".concat(YB,"-").concat(KB))}},{key:"getH264BlackList",value:function(){return this.get(JB)}},{key:"setH264BlackList",value:function(e){return this.set(JB,e)}},{key:"getAudioProfile",value:function(){return this.get(QB)}},{key:"setAudioProfile",value:function(e){return this.set(QB,e)}}]),r}(ZB),ej=new $B,tj="rtc-access.rtcplus.com,rtc-access-sg.rtcplus.com,rtc-access-va.rtcplus.com,rtc-access-fr.rtcplus.com".split(",");function rj(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return/^https?:\/\/.+/.test(e)||(e="https://"+e),"".concat(e,"/dispatch/v1/AccessInfo?Action=GetAccessInfo")}var nj="https://web-log-report.rtcplus.com/video/v1/webrtc_log/",ij="rtc.rtcplus.com".split(","),oj={VERSION:"4.49.0",ICE_CONFIG_REQUEST_URLS_INTERNAL:tj.map(rj),ICE_CONFIG_REQUEST_URLS:[],EXPECTED_ADDR:"",LOG_SERVER_URL:nj,CONFIG_REQUEST_DOMAINS:ij,DEVICE_ID:"",OVERSEA:!1,PLATFORM:"",PRODUCT:""};function aj(e,t){if(MB.rtcSdkApiCall("setParameter",0,"key: ".concat(e,", value: ").concat(t)),"VERSION"!==e){if("ICE_CONFIG_REQUEST_URLS"===e)return"string"==typeof t&&(t=[t]),void(oj.ICE_CONFIG_REQUEST_URLS=t.map(rj));if("PLATFORM"!==e||"string"!=typeof t)if("PRODUCT"!==e||"string"!=typeof t)if("LOG_SERVER_URL"!==e||t!==j.overseas)if("LOG_SERVER_URL"!==e||t!==j.domestic)if("LOG_SERVER_URL"!==e||"string"!=typeof t){if("OVERSEA"===e)return VB.setStats({overSea:t?"1":"0"}),void(oj.OVERSEA=t);"DEVICE_ID"===e&&ej.setDeviceId(t),oj[e]=t}else oj.LOG_SERVER_URL=t;else oj.LOG_SERVER_URL=nj;else oj.LOG_SERVER_URL="https://web-log-report.rtcplus.com/video/v1/webrtc_log/";else VB.setStats({product:t});else VB.setStats({platform:t})}}function sj(e){return"DEVICE_ID"===e?ej.getDeviceId():oj[e]}function cj(e,t,r){var n,i,o,a,s,c,u,d,l;return{type:"publicstream",action:t,publicStreamID:e,publicStreamMeta:{audio:{},video:{fps:(null===(n=r.video)||void 0===n?void 0:n.fps)||15,bitrate:1e3*((null===(i=r.video)||void 0===i?void 0:i.kBitRate)||40),width:(null===(o=r.video)||void 0===o?void 0:o.width)||640,height:(null===(a=r.video)||void 0===a?void 0:a.height)||360},layout:{layoutMode:2,interpolationMode:(null===(s=r.layout)||void 0===s?void 0:s.interpolationMode)||z.PREV_FRAME,canvas:{bgColor:(null===(c=r.layout)||void 0===c?void 0:c.backgroundColor)||"#000000",bgImage:(null===(u=r.layout)||void 0===u?void 0:u.backgroundImage)||""},regions:(null===(d=r.layout)||void 0===d||null===(l=d.regions)||void 0===l?void 0:l.map((function(e){return{roomId:e.roomId,userId:e.userId,alterImage:e.alertImage||"",alpha:!e.alpha||+e.alpha>1||+e.alpha<=0?1:+e.alpha,x:!e.x||+e.x>=1||+e.x<0?0:+e.x,y:!e.y||+e.y>=1||+e.y<0?0:+e.y,w:!e.w||+e.w>1||+e.w<=0?1:+e.w,h:!e.h||+e.h>1||+e.h<=0?1:+e.h,zorder:!e.zorder||+e.zorder<0||+e.zorder>100?0:+e.zorder,renderMode:void 0===e.renderMode?1:e.renderMode,streamType:e.isScreenStream?1:0,mediaType:e.mediaType||0,sourceCrop:e.sourceCrop}})))||[]}}}}var uj,dj={width:640,height:360,frameRate:15,maxKbps:600},lj={width:1920,height:1080,frameRate:15,maxKbps:3e3},hj=function(e){return e.streamRemovedBySchedule308="stream removed",e.clientRePublish="client republish",e.publishStreamFaied="publish failed",e.clientUnPublish="client unpublished",e.clientDisconnected="client disconnected",e.videoMuted="video muted",e}(hj||{}),fj=function(e){return e.PushLimitWarn="PushLimitWarn",e}(fj||{}),pj=function(e){return e.ON_ADD_STREAM="onAddStream",e.ON_ADD_STREAM_LIST="onAddStreamList",e.ON_REMOVE_STREAM="onRemoveStream",e.ON_REMOVE_STREAM_LIST="onRemoveStreamList",e.USER_DISCONNECTION="userDisconnection",e.USER_DISCONNECTION_LIST="userDisconnectionList",e.USER_CONNECTION="userConnection",e.USER_CONNECTION_LIST="userConnectionList",e.ON_UPDATE_STREAM_ATTRIBUTES="onUpdateStreamAttributes",e.ON_UPDATE_ROOM_ATTRIBUTES="onUpdateRoomAttributes",e.ON_UPDATE_USER_ATTRIBUTES="onUpdateUserAttributes",e.ON_PUSH_TRACK="onPushTrack",e.ON_REMOVE_TRACK="onRemoveTrack",e.ON_CUSTOM_MESSAGE="onCustomMessage",e.NODE_CHANGE="nodeChange",e.USER_MESSAGE_RECEIVED="userMessageReceived",e.USER_BINARY_MESSAGE_RECEIVED="userBinaryMessageReceived",e.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM="userMessageReceivedOutsideRoom",e.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM="userBinaryMessageReceivedOutsideRoom",e.POST_PROCESSING_MESSAGE="postProcessingMessage",e.ON_USER_TOKEN_WILL_EXPIRE="onUserTokenWillExpire",e.STREAM_CONTROL_MESSAGE="streamControlMessage",e.ON_SCENE_CONFIG="onSceneConfig",e.ON_SPEAKER_CHANGE="onSpeakerChange",e.ON_STREAM_FAILED="streamFailed",e}(pj||{}),vj=function(e){return e.RSCP="RSCP",e.RTT="RTT",e}(vj||{}),_j=function(e){return e.ON_CONNECTION_STATE_CHANGE="onConnectionStateChange",e.ABNORMAL_DISCONNECTION="normalConnection",e}(_j||{}),mj=function(e){return e.userLeave="userLeave",e.connectionLost="connectionLost",e.userDuplicateLogin="userDuplicateLogin",e.kickedByAdmin="kickedByAdmin",e.roleChanged="roleChanged",e.onUserTokenDidExpire="onUserTokenDidExpire",e}(mj||{}),yj=function(e){return e[e.roomDismissByAdmin=2]="roomDismissByAdmin",e}(yj||{}),gj=function(e){return e[e.SEND=0]="SEND",e[e.FEEDBACK=1]="FEEDBACK",e}(gj||{}),Sj=function(e){return e[e.P2P=0]="P2P",e[e.SIGNAL=1]="SIGNAL",e[e.BROADCAST=2]="BROADCAST",e[e.BUSINESS_SERVER=3]="BUSINESS_SERVER",e}(Sj||{}),bj=function(e){return e[e.SUCCESS=0]="SUCCESS",e[e.TIMEOUT=1]="TIMEOUT",e[e.BROKEN=2]="BROKEN",e[e.NO_RECEIVER=3]="NO_RECEIVER",e[e.NO_RELAYPATH=4]="NO_RELAYPATH",e[e.SEND_TO_SERVER_ERROR=17]="SEND_TO_SERVER_ERROR",e[e.SERVER_RESPONSE_ERROR=18]="SERVER_RESPONSE_ERROR",e[e.NOT_JOIN=100]="NOT_JOIN",e[e.INIT=101]="INIT",e[e.NO_CONNECTION=102]="NO_CONNECTION",e[e.NOT_LOGIN=105]="NOT_LOGIN",e[e.SERVER_PARAMS_NOTSET=106]="SERVER_PARAMS_NOTSET",e[e.UNKNOWN=1e3]="UNKNOWN",e}(bj||{}),Ej=(h(uj={},0,[0,"success"]),h(uj,1,[dN.USER_MESSAGE_TIMEOUT,"timeout, failed to send."]),h(uj,2,[dN.USER_MESSAGE_BROKEN,"dataChannel broken, failed to send."]),h(uj,3,[dN.USER_MESSAGE_NO_RECEIVER,"cannot find the receiver."]),h(uj,4,[dN.USER_MESSAGE_NO_RELAYPATH,"cannot find relay path."]),h(uj,17,[dN.USER_MESSAGE_SEND_TO_SERVER_ERROR,"failed to send to business server."]),h(uj,18,[dN.USER_MESSAGE_SERVER_RESPONSE_ERROR,"business server response error."]),h(uj,100,[dN.USER_MESSAGE_NOT_JOIN,"not join room"]),h(uj,101,[dN.USER_MESSAGE_INIT,"not init."]),h(uj,102,[dN.USER_MESSAGE_NO_CONNECTION,"no connection."]),h(uj,105,[dN.USER_MESSAGE_NOT_LOGIN,"not login."]),h(uj,106,[dN.USER_MESSAGE_SERVER_PARAMS_NOTSET,"server param is not set."]),h(uj,1e3,[dN.USER_MESSAGE_UNKNOWN,"unknown."]),uj),kj=["msg"],Tj=new JL("DataChannelSignaling",3),Ij=["onSpeakerChange"],Aj=function(e){return e[e.C2S=0]="C2S",e[e.C2C=1]="C2C",e[e.C2GW=2]="C2GW",e[e.C2CDirect=3]="C2CDirect",e[e.C2RTM=4]="C2RTM",e}(Aj||{}),Rj=6e4,wj=function(e){f(a,e);var t,r,n=g(a);function a(e){var t;return u(this,a),h(m(t=n.call(this)),"_singlingCache",new Map),h(m(t),"_p2pCache",new Map),h(m(t),"_rttIds",{}),h(m(t),"_p2pMessageId",0),h(m(t),"_clearDataChannelListener",void 0),t._dataChannel=e,t._clearDataChannelListener=t._handleHandler(),window.__rtc_mock_signaling__=t.emit.bind(m(t)),t}return l(a,[{key:"destroy",value:function(){this._dataChannel&&(this._clearDataChannelListener(),this._dataChannel.close()),this._singlingCache.clear(),this._p2pCache.clear(),this._p2pMessageId=0,this._rttIds={}}},{key:"sendSignaling",value:function(e,t,r){var n=this;return MB.rtcSignaling(0,JSON.stringify(t),"call-".concat(e),"Send",t.streamId,t.streamUserId,dB.UP),new Promise((function(i,o){var a=n._genHeader(r);a.id=OP();var s=a.id.join("-"),c=setTimeout((function(){n._singlingCache.delete(s),o(new hN(dN.TIME_OUT,"".concat(e," message time out")))}),Rj);n._singlingCache.set(s,{signalingType:e,success:function(e){clearTimeout(c),i(e)},error:function(e){clearTimeout(c),o(e)}}),Tj.print("Signal",">>>>>> [".concat(e,"][").concat(s,"]"),t),n._sendMessage(e,a,t)}))}},{key:"sendPingSignaling",value:function(){return this.sendSignaling("CheckConnectivity",{ts:Date.now()},{functionType:2})}},{key:"sendP2PMessage",value:(r=c(o().mark((function e(t,r){var n,a,s;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.msg,a=_(t,kj),s=n instanceof ArrayBuffer,e.t0=this,e.t1=i,e.t2=i({ver:1,id:this._p2pMessageId++,time:Date.now(),dir:gj.SEND,type:Sj.P2P,err:bj.SUCCESS},a),e.t3={},e.t4=s,!s){e.next=13;break}return e.next=10,_P.ab2b64str(n);case 10:e.t5=e.sent,e.next=14;break;case 13:e.t5=n;case 14:return e.t6=e.t5,e.t7={binary:e.t4,msg:e.t6},e.t8=(0,e.t1)(e.t2,e.t3,e.t7),e.t9=r,e.abrupt("return",e.t0._sendP2PMessage.call(e.t0,e.t8,e.t9));case 19:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"_sendP2PMessage",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return DP(e.msg)?this._rttIds[e.id]=e.id:e.dir===gj.SEND&&Tj.print("_sendP2PMessage [DC Signaling p2p >>]",JSON.stringify(e)),new Promise((function(n,o){var a=t._genHeader(i(i({needAck:!0,functionType:1},r),{},{id:OP()}));if(e.dir===gj.SEND){var s=setTimeout((function(){t._p2pCache.delete(e.id),o(new hN(dN.TIME_OUT,"P2P message timeout"))}),Rj);t._p2pCache.set(e.id,{success:function(e,t){clearTimeout(s),n(t)},error:function(e){clearTimeout(s);var t=E(Ej[e.err]||[dN.USER_MESSAGE_UNKNOWN,"err: ".concat(e.err,", msg: ").concat(e.msg)],2),r=t[0],n=t[1];o({err:e.err,code:r,message:e.msg||n})}})}t._sendMessage("p2p",a,e)}))}},{key:"_sendMessage",value:function(e,t,r){if(!this._dataChannel||"open"!==this._dataChannel.readyState)throw new hN(dN.SIGNALING_CHANNEL_NOT_OPEN,"DataChannel not open");var n=t.version+(+t.zip<<5)+(+t.encrypt<<6),i=+t.needAck+(+t.direction<<1)+(+t.functionType<<2)+(+t.binary<<6),o=_P.str2ab(JSON.stringify([e,r])),a=pP(Uint8Array,[n,i].concat(k(t.id||[])),new Uint8Array(o));this._dataChannel.send(a.buffer)}},{key:"_dispartData",value:function(e){var t=new Uint8Array(e),r=0,n=t[r++],i=t[r++],o={version:15&n,zip:16==(16&n),encrypt:32==(32&n),needAck:1==(1&i),direction:(2&i)>>1,functionType:(60&i)>>2,binary:64==(64&i)};if(o.needAck||1===o.direction){for(;r<=6;r++)if(128!=(128&t[r])){r++;break}o.id=Array.from(t.slice(2,r))}return{header:o,data:t.slice(r)}}},{key:"_feedbackSignaling",value:function(e,t,r){var n=this._genHeader({needAck:!0,direction:1,id:e.split("-").map((function(e){return+e}))});Ij.includes(t)||Tj.print("Signal",">>>>>> [".concat(t,"-res][").concat(e,"]")),this._sendMessage("".concat(t,"-res"),n,r)}},{key:"_handleMessage",value:(t=c(o().mark((function e(t){var r,n,a,s,c,u,d,l,h,f,p,v,_,m,y,g,S,b,k,T,I,A,R,w,C,O,x,D,N,P,M,L;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:u=this._dispartData(t),d=u.data,(l=u.header).zip&&((h=new ZF.Inflate).push(d,!0),d=h.result),f=_P.ab2str(d),p=[],e.prev=6,p=JSON.parse(f),e.next=14;break;case 10:return e.prev=10,e.t0=e.catch(6),e.t0 instanceof Error&&MB.rtcSignalingMsgError(-1,e.t0.message,uB.MESSAGE_PARSE_FAILED),e.abrupt("return");case 14:e.t1=l.functionType,e.next=0===e.t1?17:1===e.t1?34:2===e.t1?83:101;break;case 17:if(v=(null===(r=l.id)||void 0===r?void 0:r.join("-"))||"",1!==l.direction){e.next=22;break}this._handleAckMessage(v,p[0]||{},f),e.next=33;break;case 22:if(!Array.isArray(p)){e.next=33;break}if(_=p[0],p=p[1],Ij.includes(_)||Tj.print("Signal","<<<<<< ".concat(_),p,v),this._feedbackSignaling(v,_,_===pj.ON_CUSTOM_MESSAGE?i(i({},p),{},{message:""}):""),!p.binary||"string"!=typeof p.message){e.next=31;break}return e.next=30,_P.b64str2ab(p.message);case 30:p.message=e.sent;case 31:this.emit(_,i({},p)),MB.rtcSignaling(0,f,"on-".concat(_),"Recv",p.streamId,p.clientId,dB.DOWN);case 33:return e.abrupt("break",102);case 34:Array.isArray(p)&&(p=p[1]),m=null===(n=p)||void 0===n?void 0:n.id,this._rttIds[m]||(null===(a=p)||void 0===a?void 0:a.dir)===gj.FEEDBACK||DP(null===(s=p)||void 0===s?void 0:s.msg)?delete this._rttIds[m]:Tj.print("Signal","<<<<<< p2p response",p),e.t2=p.dir,e.next=e.t2===gj.SEND?40:e.t2===gj.FEEDBACK?78:81;break;case 40:if(DP(null===(c=p)||void 0===c?void 0:c.msg)){e.next=76;break}if(g=(y=p).binary,S=y.msg,b=y.room,k=y.to,T=y.from,I=""===b?g?pj.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM:pj.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM:g?pj.USER_BINARY_MESSAGE_RECEIVED:pj.USER_MESSAGE_RECEIVED,k){e.next=60;break}if(e.t3=this,e.t4=pj.ON_CUSTOM_MESSAGE,e.t5=T,e.t6=g,!g){e.next=54;break}return e.next=51,_P.b64str2ab(S);case 51:e.t7=e.sent,e.next=55;break;case 54:e.t7=S;case 55:e.t8=e.t7,e.t9={clientId:e.t5,binary:e.t6,message:e.t8},e.t3.emit.call(e.t3,e.t4,e.t9),e.next=76;break;case 60:if(e.t10=this,e.t11=I,e.t12=i,e.t13=i({},p),e.t14={},!g){e.next=71;break}return e.next=68,_P.b64str2ab(S);case 68:e.t15=e.sent,e.next=72;break;case 71:e.t15=S;case 72:e.t16=e.t15,e.t17={msg:e.t16},e.t18=(0,e.t12)(e.t13,e.t14,e.t17),e.t10.emit.call(e.t10,e.t11,e.t18);case 76:return this._sendP2PMessage(i(i({},p),{},{dir:gj.FEEDBACK,msg:""})),e.abrupt("break",82);case 78:return(A=this._p2pCache.get(p.id))&&(this._p2pCache.delete(p.id),p.err===bj.SUCCESS?A.success(p.id,p):A.error(p)),e.abrupt("break",82);case 81:return e.abrupt("break",82);case 82:return e.abrupt("break",102);case 83:if(1!==l.direction){e.next=88;break}w=(null===(R=l.id)||void 0===R?void 0:R.join("-"))||"",this._handleAckMessage(w,p[0]||{},f),e.next=100;break;case 88:if(C=E(p,2),O=C[0],x=C[1],D=void 0===x?{}:x,"RXMediaMsg"!==O){e.next=100;break}N=D.type,P=D.data,MB.rtcSignaling(0,f,"on-".concat(N),"Recv","","",dB.DOWN),e.t19=N,e.next="RSCP"===e.t19?95:"RTT"===e.t19?97:99;break;case 95:try{M=JSON.parse(P),Array.isArray(M)&&this.emit(N,M)}catch(o){}return e.abrupt("break",100);case 97:try{(L=JSON.parse(P)).length&&this.emit(N,L[0])}catch(o){}return e.abrupt("break",100);case 99:return e.abrupt("break",100);case 100:case 101:return e.abrupt("break",102);case 102:case"end":return e.stop()}}),e,this,[[6,10]])}))),function(e){return t.apply(this,arguments)})},{key:"_handleHandler",value:function(){var e=this,t=function(t){Tj.print("_handleHandler","dataChannel close",t),e.emit("close",t)},r=function(t){Tj.print("_handleHandler","dataChannel error",t),e.emit("close",t)},n=function(t){e._handleMessage(t.data)};return this._dataChannel.addEventListener("close",t),this._dataChannel.addEventListener("error",r),this._dataChannel.addEventListener("message",n),function(){e._dataChannel.removeEventListener("close",t),e._dataChannel.removeEventListener("error",r),e._dataChannel.removeEventListener("message",n)}}},{key:"_genHeader",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return i({version:2,zip:!1,encrypt:!1,needAck:!0,direction:0,functionType:0,binary:!1},e)}},{key:"_handleAckMessage",value:function(e,t,r){var n=this._singlingCache.get(e);n&&(this._singlingCache.delete(e),200===t.code?n.success(t):n.error(t),Tj.print("Signal","<<<<<< [".concat(n.signalingType,"-ack] ").concat(e),t)),MB.rtcSignaling(0,r,null==n?void 0:n.signalingType,"Ack","","",dB.DOWN)}}]),a}(jL.exports.EventEmitter),Cj=function(){function e(){u(this,e),h(this,"xhr",void 0),h(this,"isSending",void 0),h(this,"timeout",void 0),this.isSending=!1}return l(e,[{key:"ajax",value:function(e){var t=this,r=e.method,n=e.url,i=e.body,o=void 0===i?{}:i,a=e.headers,s=void 0===a?{}:a,c=e.stringify,u=void 0===c||c;return new Promise((function(e,i){t.isSending=!0;var a=new XMLHttpRequest;a.open(r,n,!0);for(var c=0,d=Object.entries(s);c<d.length;c++){var l=E(d[c],2),h=l[0],f=l[1];a.setRequestHeader(h,f)}a.onreadystatechange=function(){if(4===a.readyState)if(t.isSending=!1,200===a.status)e(JSON.parse(a.responseText));else{var r=a.statusText,n=a.status;if(a.responseText)try{var o=JSON.parse(a.responseText);o.errMessage&&(r=o.errMessage),o.code&&(n=o.code)}catch(s){}i({message:r,code:n})}0===a.status&&i({code:0,message:"Request abort"})},a.onerror=function(e){t.isSending=!1,i({code:-1,message:a.responseText||"unknown"})},t.timeout&&(a.timeout=t.timeout),u&&(o=JSON.stringify(o)),a.send(o),t.xhr=a}))}},{key:"get",value:function(e,t){return this.ajax({method:"GET",url:e,headers:t})}},{key:"post",value:function(e,t,r,n){return this.ajax({method:"POST",url:e,body:t,headers:r,stringify:n})}},{key:"abort",value:function(){var e;null===(e=this.xhr)||void 0===e||e.abort()}}]),e}(),Oj=new JL("ICE Request",3),xj=function(){function e(){u(this,e),h(this,"_request",void 0),this._request=new Cj}var t,r,n;return l(e,[{key:"getAccessNode",value:(n=c(o().mark((function e(t,r,n,i,a,s,c,u){var d;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(d=ej.getAccessNode(t))){e.next=9;break}if(this.getAccessNodeFromServer(t,r,n,i,a,s,c,u),XB("es.R.node.cache",d),!Array.isArray(d)){e.next=8;break}return e.abrupt("return",Promise.resolve(d));case 8:return e.abrupt("return",Promise.resolve([d]));case 9:return e.abrupt("return",this.getAccessNodeFromServer(t,r,n,i,a,s,c,u));case 10:case"end":return e.stop()}}),e,this)}))),function(e,t,r,i,o,a,s,c){return n.apply(this,arguments)})},{key:"getAccessNodeFromServer",value:(r=c(o().mark((function e(t,r,n,i,a,s,c,u){var d,l,h,f,p=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return h=ej.getAccessUrls(),f=!0,XB("es.R.req.cache.urls",h),(null===(d=h)||void 0===d?void 0:d.length)>0||(h=oj.ICE_CONFIG_REQUEST_URLS,f=!1,XB("es.R.req.external.urls",h)),(null===(l=h)||void 0===l?void 0:l.length)>0||(h=oj.ICE_CONFIG_REQUEST_URLS_INTERNAL,f=!1,XB("es.R.req.internal.urls",h)),e.abrupt("return",this.getICEConfigFromServer(h,t,r,n,i,a,s,c,u).then((function(e){var r=e.nodes;return ej.setAccessNode(t,r,e.ttl||11200),e.dispatchDomains&&ej.setAccessUrls(e.dispatchDomains),r})).catch((function(e){if(f)return XB("es.R.req.fallback",""),ej.clearAccessUrls(),p.getAccessNodeFromServer(t,r,n,i,a,s,c);throw e})));case 6:case"end":return e.stop()}}),e,this)}))),function(e,t,n,i,o,a,s,c){return r.apply(this,arguments)})},{key:"getICEConfigFromServer",value:(t=c(o().mark((function e(t,r,n,i,a,s,u,d,l){var h,f,p,v,_=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return h={appID:r,userID:i,deviceID:a,connectSessionID:hP(),os:"web",sdkVersion:oj.VERSION,isOversea:oj.OVERSEA,expectedAddr:sj("EXPECTED_ADDR"),productPlatform:"BytePlus",enableCloudProxy:d,expectedIDC:l},s&&u&&(h.feedbackInfo=[{feedbackIP:null===(f=u.publicIPs[0])||void 0===f?void 0:f.ip,feedbackReason:{type:"NODE_CHANGED",reason:s}}],delete h.expectedAddr),p=Date.now(),MB.rtcGetAccess(0,JSON.stringify(h),0,sB.REQUEST,t.join(","),h.connectSessionID),v=t.map(function(){var e=c(o().mark((function e(t,r){var n,i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,_._request.post(t,h);case 3:n=e.sent,e.next=9;break;case 6:throw e.prev=6,e.t0=e.catch(0),new hN(dN.ICE_SERVER_WRONG,"get ICE config failed",e.t0);case 9:if(200===n.code){e.next=11;break}throw new hN(dN.ICE_SERVER_WRONG,"get ICE config failed",{server_code:n.code,message:JSON.stringify(n)});case 11:if(i=n.nodes[0]){e.next=14;break}throw new hN(dN.ICE_SERVER_WRONG,"ICE config server return empty nodes",{code:n.code,message:JSON.stringify(n)});case 14:return e.abrupt("return",{result:n,firstNode:i,index:r});case 15:case"end":return e.stop()}}),e,null,[[0,6]])})));return function(t,r){return e.apply(this,arguments)}}()),e.abrupt("return",MP(v).then((function(e){var r=e.result;e.firstNode;var n=e.index;return MB.rtcGetAccess(200,JSON.stringify(r),Date.now()-p,sB.RESPONSE,t[n],h.connectSessionID),r})).catch((function(e){var r,n,i=null===(r=e[0])||void 0===r?void 0:r.error;throw MB.rtcGetAccess(+((null==i?void 0:i.code)||(null==i?void 0:i.server_code)),null===(n=e[0])||void 0===n?void 0:n.message,Date.now()-p,sB.RESPONSE,t.join(","),h.connectSessionID,{error:JSON.stringify(i)}),i})));case 6:case"end":return e.stop()}}),e)}))),function(e,r,n,i,o,a,s,c,u){return t.apply(this,arguments)})},{key:"abort",value:function(){this._request.isSending&&(Oj.print("abort","HTTP Request of [getICEConfigFromServer] abort"),this._request.abort())}}]),e}(),Dj=function(){function e(){u(this,e),h(this,"_request",void 0),this._request=new Cj}var t;return l(e,[{key:"getH264BlackList",value:(t=c(o().mark((function e(){var t;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=ej.getH264BlackList(),!Array.isArray(t)){e.next=6;break}return this._getH264BlackList(),e.abrupt("return",t);case 6:return e.abrupt("return",this._getH264BlackList());case 7:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"_getH264BlackList",value:function(){var e=this,t={keys:["web_h264_black_list"],labelSelector:"",sdkVersion:"4.49.0",deviceType:"web"};this._request.timeout=800;var r=oj.CONFIG_REQUEST_DOMAINS.map((function(e){return"https://".concat(e,"/decision/v1/multi")}));MB.rtcGetConfig(0,JSON.stringify(t),0,r.join(","),rB.REQUEST,"",!1);var n=r.map(function(){var r=c(o().mark((function r(n,i){var a,s;return o().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,r.next=3,e._request.post(n,t);case 3:s=r.sent,r.next=9;break;case 6:throw r.prev=6,r.t0=r.catch(0),new hN(dN.ICE_SERVER_WRONG,"get config failed");case 9:if(Array.isArray(null===(a=s)||void 0===a?void 0:a.web_h264_black_list)){r.next=11;break}throw new hN(dN.ICE_SERVER_WRONG,"get config failed");case 11:return r.abrupt("return",{result:s,index:i});case 12:case"end":return r.stop()}}),r,null,[[0,6]])})));return function(e,t){return r.apply(this,arguments)}}());return new Promise((function(e){MP(n).then((function(t){var n=t.result,i=t.index;ej.setH264BlackList(n.web_h264_black_list),MB.rtcGetConfig(200,JSON.stringify(n),0,r[i],rB.RESPONSE,"",!1),e(n.web_h264_black_list)})).catch((function(t){MB.rtcGetConfig(500,t.message,0,"",rB.RESPONSE,"",!1),e(ej.getH264BlackList()||[])}))}))}},{key:"getAudioProfile",value:function(){var e=this,t={keys:["engine_BAC"],labelSelector:"",sdkVersion:"4.49.0",deviceType:"web"},r=oj.CONFIG_REQUEST_DOMAINS.map((function(e){return"https://".concat(e,"/decision/v1/multi")}));MB.rtcGetConfig(0,JSON.stringify(t),0,r.join(","),rB.REQUEST,"",!1);var n=r.map(function(){var r=c(o().mark((function r(n,i){var a,s;return o().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,r.next=3,e._request.post(n,t);case 3:s=r.sent,r.next=9;break;case 6:throw r.prev=6,r.t0=r.catch(0),new hN(dN.ICE_SERVER_WRONG,"get config failed");case 9:if(Array.isArray(null===(a=s)||void 0===a?void 0:a.engine_BAC)){r.next=11;break}throw new hN(dN.ICE_SERVER_WRONG,"get config failed");case 11:return r.abrupt("return",{result:s,index:i});case 12:case"end":return r.stop()}}),r,null,[[0,6]])})));return function(e,t){return r.apply(this,arguments)}}());return new Promise((function(e){MP(n).then((function(t){var n=t.result,i=t.index;ej.setAudioProfile(n.engine_BAC),MB.rtcGetConfig(200,JSON.stringify(n),0,r[i],rB.RESPONSE,"",!1),e(n.engine_BAC)})).catch((function(t){MB.rtcGetConfig(500,t.message,0,"",rB.RESPONSE,"",!1),e(ej.getAudioProfile()||[])}))}))}}]),e}();function Nj(e,t){var r=1,n=e;(e.width>t.width||e.height>t.height)&&(r=e.width/e.height>t.width/t.height?e.width/t.width:e.height/t.height,n={width:Math.floor(e.width/r),height:Math.floor(e.height/r)});return i(i({},n),{},{scaleResolutionDownBy:r})}var Pj=[{sub_index:0,video_index:0,framerate:30,height:1080,maxkbps:3e3,width:1920},{sub_index:1,video_index:0,framerate:30,height:720,maxkbps:1200,width:1280},{sub_index:2,video_index:0,framerate:30,height:630,maxkbps:1100,width:1120},{sub_index:3,video_index:0,framerate:30,height:540,maxkbps:1e3,width:960},{sub_index:4,video_index:1,framerate:30,height:450,maxkbps:800,width:800},{sub_index:5,video_index:1,framerate:30,height:360,maxkbps:600,width:640},{sub_index:6,video_index:1,framerate:30,height:270,maxkbps:400,width:480},{sub_index:7,video_index:2,framerate:15,height:180,maxkbps:300,width:320},{sub_index:8,video_index:2,framerate:15,height:144,maxkbps:200,width:256},{sub_index:9,video_index:3,framerate:15,height:90,maxkbps:100,width:160}],Mj=[{width:1920,height:1080,maxLayers:3,totalPixels:2073600},{width:1280,height:720,maxLayers:3,totalPixels:921600},{width:960,height:540,maxLayers:3,totalPixels:518400},{width:640,height:360,maxLayers:2,totalPixels:230400},{width:480,height:270,maxLayers:2,totalPixels:129600},{width:320,height:180,maxLayers:1,totalPixels:57600},{width:0,height:0,maxLayers:1,totalPixels:0}];var Lj={width:160,height:90,frameRate:15,maxkbps:100},Uj={width:480,height:270,frameRate:15,maxkbps:400};Fh("Set",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),cf);var Vj=new Map,Fj=function(){var e=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e,r){if("chrome-stable"===yP()&&void 0===window.InstallTrigger)try{t.getStats((function(t){var r=[];t.result().forEach((function(e){if(!zj.includes(e.type)){var t={};e.names().forEach((function(r){t[r]=e.stat(r)})),r.push(i(i({},t),{},{id:e.id,type:e.type,timestamp:e.timestamp}))}})),e({all:r,getTrackStats:function(e){return r.filter((function(t){return"ssrc"!==t.type||t.googTrackId===e}))}})}))}catch(T0){r(T0)}else e({all:[],getTrackStats:function(){return[]}})})));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),Bj=function(){var e=c(o().mark((function e(t){var r,n,i,a,s,c;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getStats();case 2:return i=e.sent,a={all:[]},s=new Map,i.forEach((function(e){var t=s.get(e.type)||new Map;t.set(e.id,e),s.set(e.type,t),a.all.push(e)})),c=function(e,t){e.forEach((function(e){var r,n,i,o,a,c,u=e.codecId,d=e.transportId,l=e.trackId,h=e.playoutId;if(null===(r=s.get(Hj.codec))||void 0===r||r.forEach((function(e){e.id===u&&t.add(e)})),null===(n=s.get(Hj.transport))||void 0===n||n.forEach((function(e){e.id===d&&(a=e,t.add(e))})),null===(i=s.get(Hj.track))||void 0===i||i.forEach((function(e){e.id===l&&t.add(e)})),null===(o=s.get(Hj.mediaPlayout))||void 0===o||o.forEach((function(e){e.id===h&&t.add(e)})),a){var f,p,v=a,_=v.localCertificateId,m=v.remoteCertificateId,y=v.selectedCandidatePairId;null===(f=s.get(Hj.certificate))||void 0===f||f.forEach((function(e){(e.id===_||e.id===m)&&t.add(e)})),null===(p=s.get(Hj.candidatePair))||void 0===p||p.forEach((function(e){e.id===y&&(c=e,t.add(e))}))}if(c){var g,S,b=c,E=b.localCandidateId,k=b.remoteCandidateId;null===(g=s.get(Hj.localCandidate))||void 0===g||g.forEach((function(e){e.id===E&&t.add(e)})),null===(S=s.get(Hj.remoteCandidate))||void 0===S||S.forEach((function(e){e.id===k&&t.add(e)}))}}))},null===(r=s.get(Hj.mediaSource))||void 0===r||r.forEach((function(e){var t,r=new Set;r.add(e);var n=[];null===(t=s.get(Hj.outboundRtp))||void 0===t||t.forEach((function(t){var i;t.mediaSourceId===e.id&&(r.add(t),n.push(t),null===(i=s.get(Hj.remoteInboundRtp))||void 0===i||i.forEach((function(e){e.localId===t.id&&r.add(e)})))})),c(n,r),a[e.trackIdentifier]=Array.from(r)})),null===(n=s.get(Hj.inboundRtp))||void 0===n||n.forEach((function(e){var t,r=new Set;r.add(e),null===(t=s.get(Hj.remoteOutboundRtp))||void 0===t||t.forEach((function(t){t.localId===e.id&&r.add(t)})),c([e],r);var n,i=e.trackIdentifier;i||(null===(n=s.get(Hj.track))||void 0===n||n.forEach((function(t){t.id===e.trackId&&(i=t.trackIdentifier)})));a[i]=Array.from(r)})),e.abrupt("return",a);case 10:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),jj=function(){var e=c(o().mark((function e(t,r,n){var i,a,s,c,u,d;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=null==r?void 0:r.id,t instanceof RTCPeerConnection){e.next=3;break}return e.abrupt("return",[]);case 3:if(!gP&&!SP){e.next=10;break}return a=[],e.next=7,t.getStats(r);case 7:return e.sent.forEach((function(e){a.push(e)})),e.abrupt("return",a);case 10:return(!(s=Vj.get(t))||Date.now()-s.timestamp>150)&&(s={timestamp:Date.now(),statsPromise:Bj(t),extraStatsPromise:Fj(t)},Vj.set(t,s)),e.next=14,s.statsPromise;case 14:if(c=e.sent,u=(i?c[i]:c.all)||[],n){e.next=21;break}return e.next=19,s.extraStatsPromise;case 19:d=e.sent,u=u.concat((i?d.getTrackStats(i):d.all)||[]);case 21:return e.abrupt("return",u);case 22:case"end":return e.stop()}}),e)})));return function(t,r,n){return e.apply(this,arguments)}}();yP();var Gj,Hj=function(e){return e.codec="codec",e.inboundRtp="inbound-rtp",e.outboundRtp="outbound-rtp",e.remoteInboundRtp="remote-inbound-rtp",e.remoteOutboundRtp="remote-outbound-rtp",e.mediaSource="media-source",e.csrc="csrc",e.peerConnection="peer-connection",e.dataChannel="data-channel",e.stream="stream",e.track="track",e.transceiver="transceiver",e.sender="sender",e.receiver="receiver",e.transport="transport",e.sctpTransport="sctp-transport",e.candidatePair="candidate-pair",e.localCandidate="local-candidate",e.remoteCandidate="remote-candidate",e.certificate="certificate",e.iceServer="ice-server",e.mediaPlayout="media-playout",e}(Hj||{}),zj=["codec","inbound-rtp","outbound-rtp","remote-inbound-rtp","remote-outbound-rtp","media-source","csrc","peer-connection","data-channel","stream","track","transceiver","sender","receiver","transport","sctp-transport","candidate-pair","local-candidate","remote-candidate","certificate","ice-server"],Xj=new JL("isSupported",0),Kj=function(){var e=c(o().mark((function e(){var t;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,!vP()&&window.RTCPeerConnection&&window.RTCPeerConnection.prototype.addTransceiver&&window.RTCPeerConnection.prototype.createDataChannel){e.next=3;break}return e.abrupt("return",!1);case 3:return e.next=5,qj();case 5:return t=e.sent,e.abrupt("return",(null==t?void 0:t.includes("H264"))||(null==t?void 0:t.includes("vp8")));case 9:return e.prev=9,e.t0=e.catch(0),e.abrupt("return",!1);case 12:case"end":return e.stop()}}),e,null,[[0,9]])})));return function(){return e.apply(this,arguments)}}(),qj=function(){var e=c(o().mark((function e(){var t,r,n,i,a,s,c,u,d,l;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Xj.print("internalGetSupportedCodecs()","Invoke, cachedSupportedCodecs: %o",Gj),!Gj){e.next=3;break}return e.abrupt("return",Gj);case 3:if(t=[],e.prev=4,!navigator.userAgent.includes("VivoBrowser")){e.next=8;break}return e.next=8,PP();case 8:return e.next=10,PP();case 10:if(r=e.sent){e.next=13;break}return e.abrupt("return",t);case 13:if(!["level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f","profile-level-id=42e01f;level-asymmetry-allowed=1;packetization-mode=1","packetization-mode=1;profile-level-id=42e01f;level-asymmetry-allowed=1"].find((function(e){var t=null==r?void 0:r.includes(e);return Xj.print("internalGetSupportedCodecs()","".concat(t?"includes":"not found",": ").concat(e)),t}))){e.next=28;break}return n=navigator.userAgent.toLowerCase(),i=!1,a=["heytapbrowser","mqqbrowser","miuibrowser"],s=new Dj,e.next=21,s.getH264BlackList();case 21:for(c=e.sent,a.push.apply(a,k(c)),Xj.print("internalGetSupportedCodecs()","blackList: %o",a),u=0,d=a;u<d.length;u++)l=d[u],n.includes(l)&&(i=!0);!i&&t.push("H264"),e.next=29;break;case 28:Xj.print("internalGetSupportedCodecs()","sdp: %s",r);case 29:return null!=r&&r.includes("VP8")&&t.push("vp8"),Gj=t,e.abrupt("return",t);case 34:return e.prev=34,e.t0=e.catch(4),e.abrupt("return",t);case 37:case"end":return e.stop()}}),e,null,[[4,34]])})));return function(){return e.apply(this,arguments)}}(),Wj=function(){var e=c(o().mark((function e(){var t;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,qj();case 2:return t=e.sent,e.abrupt("return",t.map((function(e){return e.toUpperCase()})));case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Yj=function(){return"undefined"!=typeof TransformStream&&"undefined"!=typeof RTCRtpSender&&"undefined"!=typeof RTCRtpReceiver&&void 0!==RTCRtpSender.prototype.createEncodedStreams&&void 0!==RTCRtpReceiver.prototype.createEncodedStreams},Jj={},Qj=Uf,Zj=ve,$j=Re,eG=Ac,tG=Fr,rG=Ue,nG=Ss,iG=Be,oG=C_,aG=$c,sG=li,cG=As,uG=Rt,dG=rl,lG=Pc,hG=mc,fG=de,pG=zs.UNSUPPORTED_Y,vG=4294967295,_G=Math.min,mG=[].push,yG=$j(/./.exec),gG=$j(mG),SG=$j("".slice),bG=!fG((function(){var e=/(?:)/,t=e.exec;e.exec=function(){return t.apply(this,arguments)};var r="ab".split(e);return 2!==r.length||"a"!==r[0]||"b"!==r[1]}));eG("split",(function(e,t,r){var n;return n="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,r){var n=cG(iG(this)),i=void 0===r?vG:r>>>0;if(0===i)return[];if(void 0===e)return[n];if(!nG(e))return Zj(t,n,e,i);for(var o,a,s,c=[],u=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.unicode?"u":"")+(e.sticky?"y":""),d=0,l=new RegExp(e.source,u+"g");(o=Zj(hG,l,n))&&!((a=l.lastIndex)>d&&(gG(c,SG(n,d,o.index)),o.length>1&&o.index<n.length&&Qj(mG,c,dG(o,1)),s=o[0].length,d=a,c.length>=i));)l.lastIndex===o.index&&l.lastIndex++;return d===n.length?!s&&yG(l,"")||gG(c,""):gG(c,SG(n,d)),c.length>i?dG(c,0,i):c}:"0".split(void 0,0).length?function(e,r){return void 0===e&&0===r?[]:Zj(t,this,e,r)}:t,[function(t,r){var i=iG(this),o=rG(t)?void 0:uG(t,e);return o?Zj(o,t,i,r):Zj(n,cG(i),t,r)},function(e,i){var o=tG(this),a=cG(e),s=r(n,o,a,i,n!==t);if(s.done)return s.value;var c=oG(o,RegExp),u=o.unicode,d=(o.ignoreCase?"i":"")+(o.multiline?"m":"")+(o.unicode?"u":"")+(pG?"g":"y"),l=new c(pG?"^(?:"+o.source+")":o,d),h=void 0===i?vG:i>>>0;if(0===h)return[];if(0===a.length)return null===lG(l,a)?[a]:[];for(var f=0,p=0,v=[];p<a.length;){l.lastIndex=pG?0:p;var _,m=lG(l,pG?SG(a,p):a);if(null===m||(_=_G(sG(l.lastIndex+(pG?p:0)),a.length))===f)p=aG(a,p,u);else{if(gG(v,SG(a,f,p)),v.length===h)return v;for(var y=1;y<=m.length-1;y++)if(gG(v,m[y]),v.length===h)return v;p=f=_}}return gG(v,SG(a,f)),v}]}),!bG,pG);var EG={},kG={exports:{}},TG=kG.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(TG).forEach((function(e){TG[e].forEach((function(e){e.reg||(e.reg=/(.*)/),e.format||(e.format="%s")}))})),function(e){var t=function(e){return String(Number(e))===e?Number(e):e},r=function(e,r,n){var i=e.name&&e.names;e.push&&!r[e.push]?r[e.push]=[]:i&&!r[e.name]&&(r[e.name]={});var o=e.push?{}:i?r[e.name]:r;!function(e,r,n,i){if(i&&!n)r[i]=t(e[1]);else for(var o=0;o<n.length;o+=1)null!=e[o+1]&&(r[n[o]]=t(e[o+1]))}(n.match(e.reg),o,e.names,e.name),e.push&&r[e.push].push(o)},n=kG.exports,i=RegExp.prototype.test.bind(/^([a-z])=(.*)/);e.parse=function(e){var t={},o=[],a=t;return e.split(/(\r\n|\r|\n)/).filter(i).forEach((function(e){var t=e[0],i=e.slice(2);"m"===t&&(o.push({rtp:[],fmtp:[]}),a=o[o.length-1]);for(var s=0;s<(n[t]||[]).length;s+=1){var c=n[t][s];if(c.reg.test(i))return r(c,a,i)}})),t.media=o,t};var o=function(e,r){var n=r.split(/=(.+)/,2);return 2===n.length?e[n[0]]=t(n[1]):1===n.length&&r.length>1&&(e[n[0]]=void 0),e};e.parseParams=function(e){return e.split(/;\s?/).reduce(o,{})},e.parseFmtpConfig=e.parseParams,e.parsePayloads=function(e){return e.toString().split(" ").map(Number)},e.parseRemoteCandidates=function(e){for(var r=[],n=e.split(" ").map(t),i=0;i<n.length;i+=3)r.push({component:n[i],ip:n[i+1],port:n[i+2]});return r},e.parseImageAttributes=function(e){return e.split(" ").map((function(e){return e.substring(1,e.length-1).split(",").reduce(o,{})}))},e.parseSimulcastStreamList=function(e){return e.split(";").map((function(e){return e.split(",").map((function(e){var r,n=!1;return"~"!==e[0]?r=t(e):(r=t(e.substring(1,e.length)),n=!0),{scid:r,paused:n}}))}))}}(EG);var IG=kG.exports,AG=/%[sdv%]/g,RG=function(e){var t=1,r=arguments,n=r.length;return e.replace(AG,(function(e){if(t>=n)return e;var i=r[t];switch(t+=1,e){case"%%":return"%";case"%s":return String(i);case"%d":return Number(i);case"%v":return""}}))},wG=function(e,t,r){var n=[e+"="+(t.format instanceof Function?t.format(t.push?r:r[t.name]):t.format)];if(t.names)for(var i=0;i<t.names.length;i+=1){var o=t.names[i];t.name?n.push(r[t.name][o]):n.push(r[t.names[i]])}else n.push(r[t.name]);return RG.apply(null,n)},CG=["v","o","s","i","u","e","p","c","b","t","r","z","a"],OG=["i","c","b","a"],xG=EG,DG=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 r=t.outerOrder||CG,n=t.innerOrder||OG,i=[];return r.forEach((function(t){IG[t].forEach((function(r){r.name in e&&null!=e[r.name]?i.push(wG(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){i.push(wG(t,r,e))}))}))})),e.media.forEach((function(e){i.push(wG("m",IG.m[0],e)),n.forEach((function(t){IG[t].forEach((function(r){r.name in e&&null!=e[r.name]?i.push(wG(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){i.push(wG(t,r,e))}))}))}))})),i.join("\r\n")+"\r\n"};Jj.write=DG,Jj.parse=xG.parse,Jj.parseParams=xG.parseParams,Jj.parseFmtpConfig=xG.parseFmtpConfig,Jj.parsePayloads=xG.parsePayloads,Jj.parseRemoteCandidates=xG.parseRemoteCandidates,Jj.parseImageAttributes=xG.parseImageAttributes,Jj.parseSimulcastStreamList=xG.parseSimulcastStreamList;var NG=new JL("FirefoxHandler",3),PG=Math.pow(2,32),MG="kp34Za0H+aVf862l",LG="o/i14u9pJrxRKAsu";function UG(e){return e>PG-18?(NG.print("generateAllSsrc","reset start id",e),UG(e=e-PG+1e4+18)):{audio:e,audioFec:e+1,audioRtx:e+2,video:e+3,videoFec:e+4,videoRtx:e+5,next:e+18}}var VG=function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:LG;return[{id:r,attribute:"cname",value:n},{id:r,attribute:"msid",value:"".concat(e," ").concat(e,"-").concat(t)},{id:r,attribute:"mslabel",value:"".concat(e)},{id:r,attribute:"label",value:"".concat(e,"-").concat(t)}]},FG=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=t.video,i=t.videoRtx,o=t.videoFec,a=[n,i],s=r.cname,c=r.flexfec;c&&a.push(o);var u=a.reduce((function(t,r){return t.concat(VG(e,"video",r,s))}),[]),d=[{semantics:"FID",ssrcs:"".concat(n," ").concat(i)}];return c&&d.push({semantics:"FEC-FR",ssrcs:"".concat(n," ").concat(o)}),{ssrcs:u,ssrcGroups:d}};function BG(e){return e.direction="inactive",e.port=0,delete e.ext,delete e.ssrcs,delete e.ssrcGroups,delete e.simulcast,delete e.simulcast_03,delete e.rids,delete e.extmapAllowMixed,delete e.bundleOnly,e}var jG=function(e,t,r){var n=i(i({},e),{},{invalid:[{value:"realx-exts:rscp"}],media:[]});return t&&n.media.push(t),r&&n.media.push(r),delete n.groups,delete n.msidSemantic,Jj.write(n)};function GG(e){return HG.apply(this,arguments)}function HG(){return(HG=c(o().mark((function e(t){var r,n,i,a;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r={},n=t.publicIPs,i=t.certFingerprint,a=t.iceParams,r.fingerprint={type:"sha-256",hash:i},r.icePwd=a.serverIcePwd,e.next=6,KG(a.serverIceUfrag);case 6:return r.iceUfrag=e.sent,VB.setStats({connection_id:r.iceUfrag}),r.candidates=zG(n),r.setup="active",r.iceOptions="renomination",e.abrupt("return",r);case 12:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function zG(e){if(!Array.isArray(e))return[];var t=0,r=2130706431,n=[];return e.forEach((function(e){var o={component:1,ip:e.ip,type:"host",generation:e.generation};e.udpPorts&&e.udpPorts.forEach((function(e){n.push(i(i({},o),{},{foundation:t++,transport:"udp",port:e,priority:r}))})),e.tcpPorts&&e.tcpPorts.forEach((function(e){n.push(i(i({},o),{},{foundation:t++,transport:"tcp",port:e,tcptype:"passive",priority:2130705431}))}))})),n}var XG,KG=function(){var e=c(o().mark((function e(t){var r,n,i,a,s,c,u;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=new TextEncoder,n=r.encode("PREC"),e.t0=Uint8Array,e.next=5,_P.b64str2ab(t);case 5:return e.t1=e.sent,i=new e.t0(e.t1),a=r.encode(Date.now().toString()).slice(-4),(s=new Uint8Array(2))[0]=0,s[1]=1,c=pP(Uint8Array,n,i,a,s),e.next=14,_P.ab2b64str(c.buffer);case 14:return u=e.sent,e.abrupt("return",u);case 16:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),qG=function(e,t){var r=0;if(Array.isArray(e.fmtp)&&Array.isArray(e.rtp)){var n,i=A(e.fmtp);try{for(i.s();!(n=i.n()).done;){var o=n.value;if(o.config.includes("level-asymmetry-allowed=1")&&o.config.includes("packetization-mode=1")&&o.config.includes("profile-level-id=42e01f")){r=o.payload;break}}}catch(u){i.e(u)}finally{i.f()}for(var a=0;a<e.rtp.length;a++){var s=e.rtp[a];if("H264"===t){if(s.payload===r){e.rtp.unshift(e.rtp.splice(a,1)[0]);break}}else if(s.codec===t){e.rtp.unshift(e.rtp.splice(a,1)[0]);break}}var c=[];e.rtp.forEach((function(e){return c.push(e.payload)})),e.payloads=c.join(" ")}},WG=new JL("BasicHandler",3),YG={iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan",encodedInsertableStreams:!!Yj()||void 0};function JG(e){if(void 0===XG){var t=navigator.userAgent.toLowerCase();XG=t.includes("mobile")}return XG?Math.ceil(e):e}var QG=function(e){f(d,e);var t,r,n,a,s=g(d);function d(e,t){var r;return u(this,d),h(m(r=s.call(this)),"_peerConnection",void 0),h(m(r),"_dataChannel",void 0),h(m(r),"_context",void 0),h(m(r),"monitor",void 0),h(m(r),"_offerIce",{}),h(m(r),"_answerIce",{}),h(m(r),"_initSctpEvents",!1),h(m(r),"_nextSsrc",Math.floor(Math.random()*PG+1e4)),h(m(r),"_aSendonlyAnswerTpl",void 0),h(m(r),"_vSendonlyAnswerTpl",void 0),h(m(r),"_enableSubFlexfec",!1),h(m(r),"audioTrack4ff",void 0),r.monitor=e,r._peerConnection=new RTCPeerConnection(YG),r._dataChannel=r._peerConnection.createDataChannel("signaling",{negotiated:!0,id:100}),r._context=t,r._dataChannel.binaryType="arraybuffer",r._peerConnection.ontrack=function(e){var t,n,i=null===(t=e.streams)||void 0===t||null===(n=t[0])||void 0===n?void 0:n.id;WG.print("constructor","pc.ontrack ".concat(e.track.kind," ").concat(e.track.id," ").concat(i)),"ff-stream"===i&&(r.audioTrack4ff=e.track),r.emit("ontrack",e)},r._peerConnection.onconnectionstatechange=function(e){WG.print("constructor","onconnectionstatechange ".concat(r._peerConnection.iceConnectionState," -> ").concat(r._peerConnection.connectionState)),"failed"!==r._peerConnection.iceConnectionState&&"closed"!==r._peerConnection.iceConnectionState&&"failed"!==r._peerConnection.connectionState||r.emit("disconnect")},r._peerConnection.oniceconnectionstatechange=function(){var t=r._peerConnection.iceConnectionState;e.rtcPreIceState(t,cB["".concat(t.toUpperCase())])},r}return l(d,[{key:"disconnect",value:function(){this._peerConnection.close(),this._dataChannel.close(),this._peerConnection.ontrack=null}},{key:"destroy",value:function(){WG.print("destroy"),this.disconnect(),this._context=void 0}},{key:"getTransceivers",value:function(){return this._peerConnection.getTransceivers()}},{key:"_simulcast",value:function(e,t,r,n,o){var a=[];1===e.videoEncodeConfig.length?(a=function(e,t){var r=[];if(t<=1)return r;var n=1,i=1;return e.width/e.height>16/9?(n=e.width/Lj.width,i=e.width/Uj.width):(n=e.height/Lj.height,i=e.height/Uj.height),r.push({maxkbps:Lj.maxkbps,scaleResolutionDownBy:n,frameRate:Lj.frameRate,width:Math.floor(e.width/n),height:Math.floor(e.height/n)}),t<=2||n>2&&r.unshift({maxkbps:Uj.maxkbps,scaleResolutionDownBy:i,frameRate:Uj.frameRate,width:Math.floor(e.width/i),height:Math.floor(e.height/i)}),r}(t,o),WG.print("simulcast() ","simulcastLayers: %o",a)):(a=e.videoEncodeConfig.slice(1).slice(1-o).map((function(e){return i({frameRate:e.frameRate||15,maxkbps:e.maxKbps||600},Nj(t,e))})),WG.print("simulcast() ","simulcastLayers2: %o",a)),a.forEach((function(e,t){var i,o={maxBitrate:1e3*e.maxkbps,scaleResolutionDownBy:JG(e.scaleResolutionDownBy),rid:"".concat(t+1),maxFramerate:e.frameRate};null===(i=r.sendEncodings)||void 0===i||i.unshift(o),n.push({width:e.width,height:e.height,framerate:e.frameRate,maxkbps:e.maxkbps,rid:"".concat(t+1)})}))}},{key:"internalPublish",value:function(e){var t=e.stream,r=e.videoTrack,n=e.audioTrack,o=e.enableSimulcast,a=e.pubAudio,s=e.pubVideo,c={direction:"sendonly",streams:[t]},u={direction:"sendonly",streams:[t]},d=[],l=[];if(Array.isArray(null==e?void 0:e.videoEncodeConfig)&&e.videoEncodeConfig.length){var h=null==r?void 0:r.getTrack(),f={width:640,height:360,frameRate:30};if(h){var p=null==h?void 0:h.getSettings();f={width:Math.floor(p.width),height:Math.floor(p.height),frameRate:Math.floor(p.frameRate)}}var v=null==e?void 0:e.videoEncodeConfig[0],_=Nj(f,v);e.prevScaleResolutionDownBy=_.scaleResolutionDownBy,e.videoInputConfig=f;var m={maxBitrate:1e3*v.maxKbps,scaleResolutionDownBy:JG(_.scaleResolutionDownBy),rid:"0",maxFramerate:v.frameRate||15};if(u.sendEncodings=[m],d.push({width:_.width,height:_.height,framerate:v.frameRate,maxkbps:v.maxKbps,rid:"0"}),o){var y,g,S=function(e){for(var t=0,r=e.width*e.height,n=0;n<Mj.length;n++)if(r>=Mj[n].totalPixels){t=n;break}if(0===t)return Mj[t].maxLayers;var i=Mj[t-1].totalPixels;return(i-r)/(i-Mj[t].totalPixels)<.1?Mj[t-1].maxLayers:Mj[t].maxLayers}(_);if(WG.print("simulcast() ","maxLayers: %o",S),S>1)this._simulcast(e,f,u,d,S),null!==(y=this._context)&&void 0!==y&&null!==(g=y.serverConfig)&&void 0!==g&&g.simulcastOnDemand&&(l=function(e){if(!e.length)return[];var t=e.shift(),r=t.width/t.height,n=0,o=0,a=i(i({},t),{},{video_index:o,sub_index:n++});delete a.rid;for(var s=[a],c=0,u=0;u<Pj.length;u++)if(Pj[u].height<t.height){c=u;break}for(var d=e.shift(),l=c;l<Pj.length;l++){var h,f=Pj[l];if(d&&f.height<=(null===(h=d)||void 0===h?void 0:h.height)){var p,v=f.height===(null===(p=d)||void 0===p?void 0:p.height),_=i(i({},d),{},{video_index:++o,sub_index:n++});if(delete _.rid,s.push(_),d=e.shift(),v)continue}s.push(i(i({},f),{},{width:Math.floor(f.height*r),video_index:o,sub_index:n++}))}return s}([].concat(d))),WG.print("subVideoDesc","desc: %o ",l)}}WG.print("publish videoTransceiverInit videoDescriptions","",u,d);var b=null==n?void 0:n.getTrack("preprocessing");(null==n?void 0:n.mixType)!==re.PLAYOUT&&null!=n&&n.mixedAudioTrack&&(b=null==n?void 0:n.mixedAudioTrack),b=a&&b?b:"audio";var E=null==r?void 0:r.getTrack("preprocessing");E=s&&E?E:"video";try{this.monitor.rtcInvokeStatus(JSON.stringify({aTrack:jP(b),vTrack:jP(E),audioTransceiverInit:c,videoTransceiverInit:u}),0,"Handler.internalPublish","",0)}catch(T0){}return{semantics:"unified-plan",videoDescriptions:d,subVideoDescriptions:l,audioTransceiverInit:{track:b,init:c},videoTransceiverInit:{track:E,init:u}}}},{key:"updateMaxBitrate",value:function(e){var t,r;WG.print("updateMaxBitrate()");var n=null===(t=e.videoTrack)||void 0===t?void 0:t.getTrack(),i=e.videoTransceiver;if(n&&e.pubVideo&&i){var o=null===(r=i.sender)||void 0===r?void 0:r.getParameters();if(o){var a;o.encodings=null==o||null===(a=o.encodings)||void 0===a?void 0:a.map((function(t){var r,n=+t.rid||0,i=null===(r=e.videoEncodeConfig[n])||void 0===r?void 0:r.maxKbps;return"number"==typeof i&&(t.maxBitrate=1e3*i),t})),null==i||i.sender.setParameters(o);try{this.monitor.rtcInvokeStatus(JSON.stringify(o.encodings),0,"Handler.updateScaleResolutionDownBy","",0)}catch(T0){}}}else WG.print("updateMaxBitrate()","no pub")}},{key:"updateScaleResolutionDownBy",value:(a=c(o().mark((function e(t){var r,n,i,a,s,c,u,d,l,h;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(WG.print("updateScaleResolutionDownBy()"),i=null===(r=t.videoTrack)||void 0===r?void 0:r.getTrack(),a=t.videoTransceiver,i&&t.pubVideo&&a){e.next=6;break}return WG.print("updateScaleResolutionDownBy()","no pub"),e.abrupt("return");case 6:if(s=null==i?void 0:i.getSettings(),c={width:Math.floor(s.width),height:Math.floor(s.height),frameRate:Math.floor(s.frameRate)},(u=Nj(c,t.videoEncodeConfig[0])).scaleResolutionDownBy===t.prevScaleResolutionDownBy&&WG.print("updateScaleResolutionDownBy()","no change %o",t.prevScaleResolutionDownBy),d=null===(n=a.sender)||void 0===n?void 0:n.getParameters()){h=u.scaleResolutionDownBy/t.prevScaleResolutionDownBy,d.encodings=null==d||null===(l=d.encodings)||void 0===l?void 0:l.map((function(e){var r;Math.max(e.scaleResolutionDownBy=(e.scaleResolutionDownBy||1)*h,1);var n=+e.rid||0;return e.maxFramerate=(null===(r=t.videoEncodeConfig[n])||void 0===r?void 0:r.frameRate)||e.maxFramerate,e})),t.prevScaleResolutionDownBy=u.scaleResolutionDownBy,t.videoInputConfig=c,null==a||a.sender.setParameters(d);try{this.monitor.rtcInvokeStatus(JSON.stringify(d.encodings),0,"Handler.updateScaleResolutionDownBy","",0)}catch(T0){}}case 12:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"getStats",value:function(e,t){return jj(this._peerConnection,e,t)}},{key:"setLocalDescription",value:(n=c(o().mark((function e(t,r){var n,i,a,s=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=fP(),e.prev=1,e.next=4,this._peerConnection.setLocalDescription(new RTCSessionDescription({type:"offer",sdp:t}));case 4:this.monitor.rtcSetDescription(0,t,fB.W_1,"local"===(null==r?void 0:r.streamUserId)?pB.UP:pB.DOWN,(null==r?void 0:r.streamId)||"",(null==r?void 0:r.streamUserId)||"",fP()-n,{type:"offer"}),this._initSctpEvents||(this._initSctpEvents=!0,(a=null===(i=this._peerConnection)||void 0===i?void 0:i.sctp)&&(a.onstatechange=function(){s.monitor.rtcInvokeStatus("sctp state change TO: ".concat(a.state),0,"sctp","",0)},a.transport&&(a.transport.onstatechange=function(){var e;s.monitor.rtcInvokeStatus("dtls state change TO: ".concat(null==a||null===(e=a.transport)||void 0===e?void 0:e.state),0,"dtls","",0)}))),e.next=12;break;case 8:e.prev=8,e.t0=e.catch(1),console.error("setLocal",e.t0),this.monitor.rtcSetDescription(-1,e.t0.message+t,fB.W_1,"local"===(null==r?void 0:r.streamUserId)?pB.UP:pB.DOWN,"","",fP()-n,{type:"offer"});case 12:case"end":return e.stop()}}),e,this,[[1,8]])}))),function(e,t){return n.apply(this,arguments)})},{key:"setRemoteDescription",value:(r=c(o().mark((function e(t,r){var n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=fP(),e.prev=1,e.next=4,this._peerConnection.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:t}));case 4:this.monitor.rtcSetDescription(0,t,fB.W_0,"local"===(null==r?void 0:r.streamUserId)?pB.UP:pB.DOWN,(null==r?void 0:r.streamId)||"",(null==r?void 0:r.streamUserId)||"",fP()-n,{type:"answer"}),e.next=11;break;case 7:e.prev=7,e.t0=e.catch(1),console.error("setRemote",e.t0),this.monitor.rtcSetDescription(-1,e.t0.message+t,fB.W_1,"local"===(null==r?void 0:r.streamUserId)?pB.UP:pB.DOWN,(null==r?void 0:r.streamId)||"",(null==r?void 0:r.streamUserId)||"",fP()-n,{type:"answer"});case 11:case"end":return e.stop()}}),e,this,[[1,7]])}))),function(e,t){return r.apply(this,arguments)})},{key:"setCurrentDescription",value:(t=c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}}),e)}))),function(){return t.apply(this,arguments)})},{key:"createAVMlineAnswerTpl",value:function(e){var t=this;Jj.parse(e).media.forEach((function(e){if("audio"===e.type){if("sendonly"===e.direction){var r=null==e?void 0:e.rtp.find((function(e){return"opus"===e.codec}));if(r&&null!=e&&e.fmtp){var n=null==e?void 0:e.fmtp.find((function(e){return e.payload===r.payload}));n&&t._context&&(n.config+=";stereo=1;sprop-stereo=1")}t._aSendonlyAnswerTpl=e}}else"video"===e.type&&("sendonly"===e.direction&&(t._vSendonlyAnswerTpl=e),Array.isArray(e.rtp)&&e.rtp.forEach((function(e){var r;null!==(r=e.codec)&&void 0!==r&&r.includes("flexfec")&&(t._enableSubFlexfec=!0)})))}))}},{key:"pc",get:function(){return this._peerConnection}},{key:"addBitrateLimit",value:function(e,t){null==e||e.rtp.forEach((function(r){var n=r.codec,i=r.payload;if(["vp8","h264"].includes(n.toLocaleLowerCase())){var o=e.fmtp.find((function(e){return e.payload===i}));o?o.config=[].concat(k(o.config.split(";")),["x-google-min-bitrate=100","x-google-start-bitrate=".concat(t)]).join(";"):e.fmtp.push({payload:i,config:"x-google-min-bitrate=100;x-google-start-bitrate=".concat(t)})}}))}}]),d}(jL.exports.EventEmitter),ZG=Re,$G=jh,eH=Yd.exports.getWeakData,tH=ph,rH=Fr,nH=Ue,iH=Je,oH=lh,aH=Xt,sH=Ln.set,cH=Ln.getterFor,uH=Ra.find,dH=Ra.findIndex,lH=ZG([].splice),hH=0,fH=function(e){return e.frozen||(e.frozen=new pH)},pH=function(){this.entries=[]},vH=function(e,t){return uH(e.entries,(function(e){return e[0]===t}))};pH.prototype={get:function(e){var t=vH(this,e);if(t)return t[1]},has:function(e){return!!vH(this,e)},set:function(e,t){var r=vH(this,e);r?r[1]=t:this.entries.push([e,t])},delete:function(e){var t=dH(this.entries,(function(t){return t[0]===e}));return~t&&lH(this.entries,t,1),!!~t}};var _H,mH={getConstructor:function(e,t,r,n){var i=e((function(e,i){tH(e,o),sH(e,{type:t,id:hH++,frozen:void 0}),nH(i)||oH(i,e[n],{that:e,AS_ENTRIES:r})})),o=i.prototype,a=cH(t),s=function(e,t,r){var n=a(e),i=eH(rH(t),!0);return!0===i?fH(n).set(t,r):i[n.id]=r,e};return $G(o,{delete:function(e){var t=a(this);if(!iH(e))return!1;var r=eH(e);return!0===r?fH(t).delete(e):r&&aH(r,t.id)&&delete r[t.id]},has:function(e){var t=a(this);if(!iH(e))return!1;var r=eH(e);return!0===r?fH(t).has(e):r&&aH(r,t.id)}}),$G(o,r?{get:function(e){var t=a(this);if(iH(e)){var r=eH(e);return!0===r?fH(t).get(e):r?r[t.id]:void 0}},set:function(e,t){return s(this,e,t)}}:{add:function(e){return s(this,e,!0)}}),i}},yH=ce,gH=Re,SH=jh,bH=Yd.exports,EH=Fh,kH=mH,TH=Je,IH=pl,AH=Ln.enforce,RH=mn,wH=!yH.ActiveXObject&&"ActiveXObject"in yH,CH=function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}},OH=EH("WeakMap",CH,kH);if(RH&&wH){_H=kH.getConstructor(CH,"WeakMap",!0),bH.enable();var xH=OH.prototype,DH=gH(xH.delete),NH=gH(xH.has),PH=gH(xH.get),MH=gH(xH.set);SH(xH,{delete:function(e){if(TH(e)&&!IH(e)){var t=AH(this);return t.frozen||(t.frozen=new _H),DH(this,e)||t.frozen.delete(e)}return DH(this,e)},has:function(e){if(TH(e)&&!IH(e)){var t=AH(this);return t.frozen||(t.frozen=new _H),NH(this,e)||t.frozen.has(e)}return NH(this,e)},get:function(e){if(TH(e)&&!IH(e)){var t=AH(this);return t.frozen||(t.frozen=new _H),NH(this,e)?PH(this,e):t.frozen.get(e)}return PH(this,e)},set:function(e,t){if(TH(e)&&!IH(e)){var r=AH(this);r.frozen||(r.frozen=new _H),NH(this,e)?MH(this,e,t):r.frozen.set(e,t)}else MH(this,e,t);return this}})}var LH=function(e){f(b,e);var t,r,n,i,a,s,d,p,v,_,y,S=g(b);function b(){var e,t,r;return u(this,b),h(m(r=S.call(this)),"inited",!1),h(m(r),"deviceMap",{audioinput:new Map,audiooutput:new Map,videoinput:new Map}),h(m(r),"checkDeviceChangeTimer",null),h(m(r),"isSupportedPermissionsQuery",!1),h(m(r),"isGrantedMicrophonePermission",!1),h(m(r),"isGrantedCameraPermission",!1),r.isSupportedPermissionsQuery=!vP()&&!(null===(e=navigator)||void 0===e||null===(t=e.permissions)||void 0===t||!t.query),r._handleDeviceChange=r._handleDeviceChange.bind(m(r)),!vP()&&r.refreshDevices(),r}return l(b,[{key:"refreshDevices",value:(y=c(o().mark((function e(){var t,r,n=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(navigator.mediaDevices){e.next=2;break}return e.abrupt("return");case 2:if(t=void 0,!gP){e.next=12;break}return e.prev=4,e.next=7,navigator.mediaDevices.getUserMedia({audio:!0});case 7:t=e.sent,e.next=12;break;case 10:e.prev=10,e.t0=e.catch(4);case 12:return e.next=14,navigator.mediaDevices.enumerateDevices();case 14:r=e.sent,t&&t.getTracks().forEach((function(e){return e.stop()})),r.forEach((function(e){var t;e.deviceId&&(null===(t=n.deviceMap[e.kind])||void 0===t||t.set(e.deviceId,e))})),this.inited||this.initListener(),this.inited=!0;case 19:case"end":return e.stop()}}),e,this,[[4,10]])}))),function(){return y.apply(this,arguments)})},{key:"initListener",value:(_=c(o().mark((function e(){var t,r,n,i,a=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0!==(null===(t=navigator.mediaDevices)||void 0===t?void 0:t.ondevicechange)&&"function"==typeof(null===(r=navigator.mediaDevices)||void 0===r?void 0:r.addEventListener)?navigator.mediaDevices.addEventListener("devicechange",(function(){a._handleDeviceChange(),setTimeout((function(){a._handleDeviceChange()}),300)})):this.checkDeviceChangeTimer=window.setInterval((function(){a._handleDeviceChange()}),3e3),!this.isSupportedPermissionsQuery){e.next=22;break}return e.prev=2,e.next=5,navigator.permissions.query({name:"microphone"});case 5:n=e.sent,this.isGrantedMicrophonePermission="granted"===n.state,n.addEventListener("change",(function(){a.isGrantedMicrophonePermission="granted"===n.state})),e.next=12;break;case 10:e.prev=10,e.t0=e.catch(2);case 12:return e.prev=12,e.next=15,navigator.permissions.query({name:"camera"});case 15:i=e.sent,this.isGrantedCameraPermission="granted"===i.state,i.addEventListener("change",(function(){a.isGrantedCameraPermission="granted"===i.state})),e.next=22;break;case 20:e.prev=20,e.t1=e.catch(12);case 22:case"end":return e.stop()}}),e,this,[[2,10],[12,20]])}))),function(){return _.apply(this,arguments)})},{key:"_handleDeviceChange",value:(v=c(o().mark((function e(){var t,r,n,i=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=void 0,!gP){e.next=5;break}return e.next=4,navigator.mediaDevices.getUserMedia({audio:!0});case 4:t=e.sent;case 5:return e.next=7,navigator.mediaDevices.enumerateDevices();case 7:r=(r=e.sent).filter((function(e){return!!e.deviceId})),t&&t.getTracks().forEach((function(e){return e.stop()})),n=Array.from([].concat(k(this.deviceMap.audioinput.values()),k(this.deviceMap.videoinput.values()),k(this.deviceMap.audiooutput.values()))),r.forEach((function(e){var t=i.deviceMap[e.kind].get(e.deviceId);i.deviceMap[e.kind].set(e.deviceId,e),t||(e.kind.includes("video")?i.emit(oe.onVideoDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"active"}):e.kind.includes("audio")&&i.emit(oe.onAudioDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"active"}))})),n.forEach((function(e){r.find((function(t){return t.deviceId===e.deviceId&&t.kind===e.kind}))||(i.deviceMap[e.kind].delete(e.deviceId),e.kind.includes("video")?i.emit(oe.onVideoDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"inactive"}):e.kind.includes("audio")&&i.emit(oe.onAudioDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"inactive"}))}));case 13:case"end":return e.stop()}}),e,this)}))),function(){return v.apply(this,arguments)})},{key:"getUserMedia",value:(p=c(o().mark((function e(t){var r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,navigator.mediaDevices.getUserMedia(t);case 2:return r=e.sent,null!=t&&t.audio&&(this.isGrantedMicrophonePermission=!0),null!=t&&t.video&&(this.isGrantedCameraPermission=!0),this.refreshDevices(),e.abrupt("return",r);case 7:case"end":return e.stop()}}),e,this)}))),function(e){return p.apply(this,arguments)})},{key:"checkPermissionsByDevices",value:(d=c(o().mark((function e(){var t,r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t={audio:!1,video:!1},navigator.mediaDevices){e.next=3;break}return e.abrupt("return",t);case 3:return e.next=5,navigator.mediaDevices.enumerateDevices();case 5:return r=e.sent,t.audio=r.filter((function(e){return"audioinput"===e.kind&&e.label&&e.deviceId})).length>0,t.video=r.filter((function(e){return"videoinput"===e.kind&&e.label&&e.deviceId})).length>0,e.abrupt("return",t);case 9:case"end":return e.stop()}}),e)}))),function(){return d.apply(this,arguments)})},{key:"getPermissions",value:(s=c(o().mark((function e(){var t,r,n,i,a,s,c,u=this,d=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=d.length>0&&void 0!==d[0]?d[0]:{},n=r.audio,i=r.video,a=r.force,n||i||(n=!0,i=!0),s={audio:!1,video:!1},a){e.next=30;break}if(!this.isSupportedPermissionsQuery){e.next=20;break}if(!n||!i){e.next=14;break}if(!this.isGrantedMicrophonePermission||!this.isGrantedCameraPermission){e.next=12;break}return s.audio=!0,s.video=!0,e.abrupt("return",s);case 12:e.next=18;break;case 14:if(!(n&&this.isGrantedMicrophonePermission||i&&this.isGrantedCameraPermission)){e.next=18;break}return s.audio=this.isGrantedMicrophonePermission,s.video=this.isGrantedCameraPermission,e.abrupt("return",s);case 18:case 26:e.next=30;break;case 20:return e.next=22,this.checkPermissionsByDevices();case 22:if(c=e.sent,!n||!i){e.next=28;break}if(!c.audio||!c.video){e.next=26;break}return e.abrupt("return",c);case 28:if(!(n&&c.audio||i&&c.video)){e.next=30;break}return e.abrupt("return",c);case 30:if(null===(t=navigator.mediaDevices)||void 0===t||!t.getUserMedia){e.next=33;break}return e.next=33,navigator.mediaDevices.getUserMedia({audio:n,video:i}).then((function(e){e&&(e.getTracks().forEach((function(e){return e.stop()})),n&&(s.audio=!0,u.isGrantedMicrophonePermission=!0),i&&(s.video=!0,u.isGrantedCameraPermission=!0))})).catch((function(){}));case 33:return e.next=35,this.refreshDevices();case 35:return e.abrupt("return",s);case 36:case"end":return e.stop()}}),e,this)}))),function(){return s.apply(this,arguments)})},{key:"enumerateDevices",value:(a=c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getPermissions();case 2:return e.next=4,this.refreshDevices();case 4:return e.abrupt("return",Array.from([].concat(k(this.deviceMap.audioinput.values()),k(this.deviceMap.videoinput.values()),k(this.deviceMap.audiooutput.values()))));case 5:case"end":return e.stop()}}),e,this)}))),function(){return a.apply(this,arguments)})},{key:"enumerateAudioCaptureDevices",value:(i=c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getPermissions({audio:!0});case 2:return e.next=4,this.refreshDevices();case 4:return e.abrupt("return",Array.from(this.deviceMap.audioinput.values()));case 5:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"enumerateVideoCaptureDevices",value:(n=c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getPermissions({video:!0});case 2:return e.next=4,this.refreshDevices();case 4:return e.abrupt("return",Array.from(this.deviceMap.videoinput.values()));case 5:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"enumerateAudioPlaybackDevices",value:(r=c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getPermissions({audio:!0});case 2:return e.next=4,this.refreshDevices();case 4:return e.abrupt("return",Array.from(this.deviceMap.audiooutput.values()));case 5:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"getDeviceById",value:(t=c(o().mark((function e(t){var r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.enumerateDevices();case 2:return r=e.sent,e.abrupt("return",r.find((function(e){return e.deviceId===t})));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})}]),b}($L),UH=new LH;!vP()&&(window.__rtc_dd__=UH);var VH=function(){function e(){u(this,e),h(this,"_audioContextInstance",void 0)}return l(e,[{key:"getAudioContextInstance",value:function(){if(!this._audioContextInstance){var e=window.AudioContext||window.webkitAudioContext;this._audioContextInstance=new e}return this._audioContextInstance}}]),e}(),FH=function(){function e(t){u(this,e),h(this,"_ctx",void 0),h(this,"_analyserNode",void 0),h(this,"_audioSource",void 0);var r=BH.getAudioContextInstance();if(t instanceof MediaStreamTrack){var n=new MediaStream;n.addTrack(t),this._audioSource=r.createMediaStreamSource(n)}else this._audioSource=r.createMediaElementSource(t),this._audioSource.connect(r.destination);var i=r.createAnalyser();this._audioSource.connect(i),this._analyserNode=i,this._ctx=r}var t;return l(e,[{key:"getAudioLevel",value:function(){var e;"suspended"===(null===(e=this._ctx)||void 0===e?void 0:e.state)&&this._ctx.resume();var t=new Uint8Array(2048);this._analyserNode.getByteTimeDomainData(t);var r=0;return t.forEach((function(e){return r=Math.max(r,Math.abs(e-128))})),r/128*255}},{key:"resume",value:(t=c(o().mark((function e(){var t;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,null===(t=this._ctx)||void 0===t?void 0:t.resume();case 2:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"destroy",value:function(){this._audioSource.disconnect(),this._analyserNode.disconnect()}}]),e}(),BH=new VH,jH=function(e){return e[e.CAPTURE=0]="CAPTURE",e[e.PRE_PROCESSING=1]="PRE_PROCESSING",e[e.ENCODE=2]="ENCODE",e[e.TRANSFER=3]="TRANSFER",e[e.POST_PROCESSING=4]="POST_PROCESSING",e[e.DECODE=5]="DECODE",e[e.RENDERING=6]="RENDERING",e}(jH||{}),GH=function(){function e(){u(this,e),h(this,"_plugins",new Map),h(this,"_monitor",void 0)}var t;return l(e,[{key:"setMinotor",value:function(e){this._monitor=e}},{key:"register",value:function(e){e.monitor=this._monitor;var t=this._plugins.get(e.type)||[];if(t.findIndex((function(t){return t.name===e.name}))>-1)throw new Error("Failed to register ".concat(e.name,": name is repeated."));t.push(e),this._plugins.set(e.type,t)}},{key:"getPluginsByType",value:function(e){return this._plugins.get(e)||[]}},{key:"getPluginByName",value:function(e,t){return(this._plugins.get(e)||[]).find((function(e){return e.name===t}))}},{key:"getPreProcessingTrack",value:(t=c(o().mark((function e(t){var r,n,i,a,s;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=this._plugins.get(1)||[],n=t.getTrack(),i=A(r),e.prev=3,i.s();case 5:if((a=i.n()).done){e.next=12;break}return s=a.value,e.next=9,s.effect(t,n);case 9:n=e.sent;case 10:e.next=5;break;case 12:e.next=17;break;case 14:e.prev=14,e.t0=e.catch(3),i.e(e.t0);case 17:return e.prev=17,i.f(),e.finish(17);case 20:return e.abrupt("return",n);case 21:case"end":return e.stop()}}),e,this,[[3,14,17,20]])}))),function(e){return t.apply(this,arguments)})},{key:"destroy",value:function(){this._plugins.forEach((function(e){e.forEach((function(e){return e.destroy()}))})),this._plugins.clear()}}]),e}(),HH=new JL("VERTC",0),zH=new WeakMap,XH=function(e){f(r,e);var t=g(r);function r(e,n){var i;return u(this,r),h(m(i=t.call(this)),"sourceType",1),h(m(i),"mediaType",void 0),h(m(i),"_trackId",void 0),i._trackId=e,i.mediaType=n,i}return l(r,[{key:"getId",value:function(){return this._trackId}}]),r}($L),KH=function(e){f(n,e);var t,r=g(n);function n(e,t,i){var o;return u(this,n),h(m(o=r.call(this,t,i)),"_mediaTrack",void 0),h(m(o),"_preProcessingTrack",void 0),h(m(o),"handleTrackEnded",(function(){MB.rtcError("track-ended mediaType: ".concat(o._mediaTrack.kind),-1001),o.emit("track-ended",m(o))})),o._mediaTrack=e,o._initListeners(),o}return l(n,[{key:"getTrack",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"origin";return"origin"===e?this._mediaTrack:this._preProcessingTrack||this._mediaTrack}},{key:"setTrack",value:function(e,t){this._mediaTrack=e,t&&this.generatePreProcessingTrack(t)}},{key:"generatePreProcessingTrack",value:(t=c(o().mark((function e(t){var r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,t.getPreProcessingTrack(this);case 3:(r=e.sent)instanceof MediaStreamTrack&&(this._preProcessingTrack=r),e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),console.error(e.t0);case 10:case"end":return e.stop()}}),e,this,[[0,7]])}))),function(e){return t.apply(this,arguments)})},{key:"close",value:function(){var e,t,r;return this._mediaTrack.onended=null,this._mediaTrack.onmute=null,this._mediaTrack.onunmute=null,null===(e=this._mediaTrack)||void 0===e||e.removeEventListener("ended",this.handleTrackEnded),null===(t=this._preProcessingTrack)||void 0===t||t.stop(),null===(r=this._mediaTrack)||void 0===r?void 0:r.stop()}},{key:"_initListeners",value:function(){this._mediaTrack instanceof MediaStreamTrack&&this._mediaTrack.addEventListener("ended",this.handleTrackEnded)}}]),n}(XH),qH=function(e){f(r,e);var t=g(r);function r(e,n,i){var o;return u(this,r),h(m(o=t.call(this,n,i)),"_mediaTrack",void 0),o._mediaTrack=e,o}return l(r,[{key:"getTrack",value:function(){return this._mediaTrack}}]),r}(XH),WH=function(e){f(n,e);var t,r=g(n);function n(e,t){var i;return u(this,n),h(m(i=r.call(this,e,t,"video")),"resolution",void 0),h(m(i),"dummy",!1),i.resolution={width:0,height:0},i}return l(n,[{key:"updateVideoCaptureConfig",value:(t=c(o().mark((function e(t){var r,n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.getTrack()){e.next=2;break}return e.abrupt("return");case 2:return HH.print("updateVideoEncoderConfig","update localVideoTrack: ",t),delete(r=i({},t)).contentHint,e.next=7,this.getTrack().applyConstraints(r);case 7:((n=this.getTrack().getSettings()).width&&n.width!==this.resolution.width||n.height&&n.height!==this.resolution.height)&&(this.resolution={width:n.width,height:n.height},this.emit("resolution-change",this.resolution));case 9:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"replaceTrack",value:function(e){this.setTrack(e)}},{key:"setContentHint",value:function(e){this._mediaTrack&&"contentHint"in this._mediaTrack&&["text","motion","detail"].includes(e)&&(this._mediaTrack.contentHint=e)}}]),n}(KH),YH=function(e){f(n,e);var t,r=g(n);function n(e,t){var i;return u(this,n),h(m(i=r.call(this,e,t,"audio")),"audioCaptureConfig",void 0),h(m(i),"_audioLevelFetcher",void 0),h(m(i),"mixedAudioTrack",void 0),h(m(i),"mixType",re.PLAYOUT_AND_PUBLISH),i}return l(n,[{key:"getAudioLevel",value:function(){return this._audioLevelFetcher||(this._audioLevelFetcher=new FH(this.getTrack("preprocessing"))),this._audioLevelFetcher.getAudioLevel()}},{key:"updateAudioCaptureConfig",value:(t=c(o().mark((function e(){var t;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.audioCaptureConfig){e.next=2;break}return e.abrupt("return");case 2:return HH.print("updateAudioCaptureConfig","update localAudioTrack: ",this.audioCaptureConfig),e.next=5,null===(t=this.getTrack())||void 0===t?void 0:t.applyConstraints(this.audioCaptureConfig);case 5:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}]),n}(KH),JH=function(e){f(r,e);var t=g(r);function r(e,n){return u(this,r),t.call(this,e,n,"video")}return l(r)}(qH),QH=function(e){f(r,e);var t=g(r);function r(e,n){var i;return u(this,r),h(m(i=t.call(this,e,n,"audio")),"_audioLevelFetcher",void 0),i}return l(r,[{key:"getAudioLevel",value:function(){return this._audioLevelFetcher||(this._audioLevelFetcher=new FH(this.getTrack())),this._audioLevelFetcher.getAudioLevel()}}]),r}(qH),ZH=function(e){f(r,e);var t=g(r);function r(){var e;u(this,r);for(var n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];return h(m(e=t.call.apply(t,[this].concat(i))),"streamIndex",L.STREAM_INDEX_MAIN),e}return l(r)}(YH),$H=function(e){f(r,e);var t=g(r);function r(){var e;u(this,r);for(var n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];return h(m(e=t.call.apply(t,[this].concat(i))),"streamIndex",L.STREAM_INDEX_MAIN),e}return l(r)}(WH),ez=function(e){f(r,e);var t=g(r);function r(){var e;u(this,r);for(var n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];return h(m(e=t.call.apply(t,[this].concat(i))),"streamIndex",L.STREAM_INDEX_MAIN),h(m(e),"sourceType",0),e}return l(r)}(WH),tz=function(e){f(r,e);var t=g(r);function r(){var e;u(this,r);for(var n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];return h(m(e=t.call.apply(t,[this].concat(i))),"streamIndex",L.STREAM_INDEX_MAIN),h(m(e),"sourceType",0),e}return l(r)}(YH),rz=function(e){f(r,e);var t=g(r);function r(){var e;u(this,r);for(var n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];return h(m(e=t.call.apply(t,[this].concat(i))),"streamIndex",L.STREAM_INDEX_SCREEN),e}return l(r)}(WH),nz=function(e){f(r,e);var t=g(r);function r(){var e;u(this,r);for(var n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];return h(m(e=t.call.apply(t,[this].concat(i))),"streamIndex",L.STREAM_INDEX_SCREEN),e}return l(r)}(YH),iz=function(e){f(r,e);var t=g(r);function r(){var e;u(this,r);for(var n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];return h(m(e=t.call.apply(t,[this].concat(i))),"streamIndex",L.STREAM_INDEX_SCREEN),h(m(e),"sourceType",0),e}return l(r)}(WH),oz=function(e){f(r,e);var t=g(r);function r(){var e;u(this,r);for(var n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];return h(m(e=t.call.apply(t,[this].concat(i))),"streamIndex",L.STREAM_INDEX_SCREEN),h(m(e),"sourceType",0),e}return l(r)}(YH);function az(e,t){return sz.apply(this,arguments)}function sz(){return(sz=c(o().mark((function e(t,r){var n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=new $H(t,hP())).dummy=!0,e.next=4,n.generatePreProcessingTrack(r);case 4:return e.abrupt("return",n);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function cz(e,t){return uz.apply(this,arguments)}function uz(){return(uz=c(o().mark((function e(t,r){var n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=new rz(t,hP())).dummy=!0,e.next=4,n.generatePreProcessingTrack(r);case 4:return e.abrupt("return",n);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function dz(e,t){return lz.apply(this,arguments)}function lz(){return(lz=c(o().mark((function e(t,r){var n,i,a,s,c,u;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=(null==t||null===(n=t.deviceId)||void 0===n?void 0:n.exact)||"default",e.prev=1,HH.print("createCameraVideoTrack","constraints:",t),MB.rtcVideoCaptureEvent({event_type:xB.START,media_device_id:a}),s=fP(),e.next=7,UH.getUserMedia({video:t});case 7:i=e.sent,MB.rtcVideoCaptureEvent({event_type:xB.START_CAPTURE_RESULT,media_device_id:a,reason:DB.SUCCESS,elapse:fP()-s}),e.next=15;break;case 11:throw e.prev=11,e.t0=e.catch(1),MB.rtcVideoCaptureEvent({event_type:xB.RUNNING_FAILED,media_device_id:a,error_code:e.t0.code,reason:e.t0.name+e.t0.message}),new hN(dN.GET_VIDEO_TRACK_FAILED,"throw error from getUserMedia. [".concat(e.t0.name||"unknown name","]: ").concat(e.t0.message||"unknown message","."),e.t0);case 15:return c=i.getVideoTracks()[0],zH.set(c,i),u=new $H(c,hP()),e.next=20,u.generatePreProcessingTrack(r);case 20:return e.abrupt("return",u);case 21:case"end":return e.stop()}}),e,null,[[1,11]])})))).apply(this,arguments)}function hz(e,t,r){return fz.apply(this,arguments)}function fz(){return(fz=c(o().mark((function e(t,r,n){var i,a,s,c,u,d,l,h,f,p,v,_;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return HH.print("createMicrophoneAudioTrack","constraints:",t),s=(null==t||null===(i=t.deviceId)||void 0===i?void 0:i.exact)||"default",c=(null==n?void 0:n.config)||{},u=c.sampleRate,d=c.channel,l=c.agc,h=c.ans,f=c.aec,void 0===t.sampleRate&&(t.sampleRate=u),void 0===t.channelCount&&(t.channelCount=d),void 0===t.autoGainControl&&(t.autoGainControl=l),void 0===t.noiseSuppression&&(t.noiseSuppression=h),void 0===t.echoCancellation&&(t.echoCancellation=f),e.prev=8,MB.rtcVideoCaptureEvent({event_type:xB.START,media_device_id:s}),p=fP(),r.getPluginByName(jH.PRE_PROCESSING,"RTCAIAnsExtension")&&(t.autoGainControl=!0,t.noiseSuppression=!1),e.next=14,UH.getUserMedia({audio:t});case 14:a=e.sent,MB.rtcVideoCaptureEvent({event_type:xB.START_CAPTURE_RESULT,media_device_id:s,reason:DB.SUCCESS,elapse:fP()-p}),e.next=22;break;case 18:throw e.prev=18,e.t0=e.catch(8),MB.rtcVideoCaptureEvent({event_type:xB.RUNNING_FAILED,media_device_id:s,error_code:e.t0.code,reason:e.t0.name+e.t0.message}),new hN(dN.GET_AUDIO_TRACK_FAILED,"throw error from getUserMedia. [".concat(e.t0.name||"unknown name","]: ").concat(e.t0.message||"unknown message","."),e.t0);case 22:return v=a.getAudioTracks()[0],zH.set(v,a),_=new ZH(v,hP()),e.next=27,_.generatePreProcessingTrack(r);case 27:return e.abrupt("return",_);case 28:case"end":return e.stop()}}),e,null,[[8,18]])})))).apply(this,arguments)}function pz(){return vz.apply(this,arguments)}function vz(){return vz=c(o().mark((function e(){var t,r,n,i,a,s,c,u,d,l=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=l.length>0&&void 0!==l[0]&&l[0],r=l.length>1?l[1]:void 0,n=l.length>2?l[2]:void 0,HH.print("createScreenTracks","withAudio: %o, constraints: %o",t,n),e.prev=4,MB.rtcVideoCaptureEvent({event_type:xB.START,media_device_id:"screen"}),a=fP(),e.next=9,navigator.mediaDevices.getDisplayMedia({video:!(n&&(!SP||16!==kP))||n,audio:!!t&&{channelCount:2,noiseSuppression:!1,echoCancellation:!1,autoGainControl:!1}});case 9:i=e.sent,MB.rtcVideoCaptureEvent({event_type:xB.START_CAPTURE_RESULT,media_device_id:"screen",reason:DB.SUCCESS,elapse:fP()-a}),e.next=17;break;case 13:throw e.prev=13,e.t0=e.catch(4),MB.rtcVideoCaptureEvent({event_type:xB.RUNNING_FAILED,media_device_id:"screen",error_code:e.t0.code,reason:e.t0.name+e.t0.message}),new hN(dN.GET_SCREEN_TRACK_FAILED,"throw error from getDisplayMedia",e.t0);case 17:return s=i.getVideoTracks()[0],c=new rz(s,hP()),e.next=21,c.generatePreProcessingTrack(r);case 21:if(!(u=i.getAudioTracks()[0])){e.next=27;break}return d=new nz(u,hP()),e.next=26,d.generatePreProcessingTrack(r);case 26:return e.abrupt("return",[c,d]);case 27:return e.abrupt("return",[c,void 0]);case 28:case"end":return e.stop()}}),e,null,[[4,13]])}))),vz.apply(this,arguments)}function _z(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:hP();return new QH(e,t)}function mz(e,t){return yz.apply(this,arguments)}function yz(){return(yz=c(o().mark((function e(t,r){var n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new ez(t,hP()),e.next=3,n.generatePreProcessingTrack(r);case 3:return e.abrupt("return",n);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function gz(e,t){return Sz.apply(this,arguments)}function Sz(){return(Sz=c(o().mark((function e(t,r){var n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new tz(t,hP()),e.next=3,n.generatePreProcessingTrack(r);case 3:return e.abrupt("return",n);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function bz(e,t){return Ez.apply(this,arguments)}function Ez(){return(Ez=c(o().mark((function e(t,r){var n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new iz(t,hP()),e.next=3,n.generatePreProcessingTrack(r);case 3:return e.abrupt("return",n);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function kz(e,t){return Tz.apply(this,arguments)}function Tz(){return(Tz=c(o().mark((function e(t,r){var n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new oz(t,hP()),e.next=3,n.generatePreProcessingTrack(r);case 3:return e.abrupt("return",n);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Iz=YH,Az=function(e){return e[e.NONE=0]="NONE",e}(Az||{}),Rz=function(){function e(){u(this,e)}return l(e,null,[{key:"getNalunits",value:function(t){if(t.length-t.position<4)return[];var r=t.position;return 1===t.getInt32(r)||0===t.getInt16(r)&&1===t.getInt8(r+2)?e.getAnnexbNals(t):e.getAvccNals(t)}},{key:"getAnnexbNals",value:function(t){for(var r=[],n=e.getHeaderPositionAnnexB(t),i=n.pos,o=i;i<t.length-4;){var a=new Uint8Array(t.buffer.slice(i,i+n.headerLength));n.pos===t.position&&t.skip(n.headerLength),o=(n=e.getHeaderPositionAnnexB(t)).pos;var s={header:a,body:new Uint8Array(t.buffer.slice(i+a.byteLength,o)),type:-1};e.analyseNal(s),s.type<=9&&0!==s.type&&r.push(s),t.skip(o-t.position),i=o}return r}},{key:"getAvccNals",value:function(t){for(var r=[];t.position<t.length-4;){var n=t.getInt32(t.position);if(!(t.length-t.position>=n))break;var i=new Uint8Array(t.buffer.slice(t.position,t.position+4));t.skip(4);var o=new Uint8Array(t.buffer.slice(t.position,t.position+n));t.skip(n);var a={header:i,body:o,type:-1};e.analyseNal(a),a.type<=9&&0!==a.type&&r.push(a)}return r}},{key:"analyseNal",value:function(e){var t=31&e.body[0];switch(e.type=t,t){case 1:e.ndr=!0;break;case 5:e.idr=!0;break;case 6:e.sei=!0;break;case 7:e.sps=!0;break;case 8:e.pps=!0}}},{key:"getHeaderPositionAnnexB",value:function(e){for(var t=e.position,r=0,n=e.length;3!==r&&4!==r&&t<n-4;)0===e.getInt16(t)?1===e.getInt16(t+2)?r=4:1===e.getInt8(t+2)?r=3:t++:t++;return t===n-4&&(0===e.getInt16(t)?1===e.getInt16(t+2)?r=4:t=n:(t++,0===e.getInt16(t)&&1===e.getInt8(t)?r=3:t=n)),{pos:t,headerLength:r}}}]),e}(),wz=function(){function e(t){u(this,e),h(this,"_position",0),h(this,"_dataview",void 0),this._dataview=new DataView(t)}return l(e,[{key:"length",get:function(){return this.buffer.byteLength}},{key:"buffer",get:function(){return this._dataview.buffer}},{key:"position",get:function(){return this._position},set:function(e){this._position=e}},{key:"back",value:function(e){this.position-=e}},{key:"getUint8",value:function(e){return this._dataview.getUint8(e)}},{key:"getInt8",value:function(e){return this._dataview.getInt8(e)}},{key:"getInt16",value:function(e){return this._dataview.getInt16(e)}},{key:"getUint16",value:function(e){return this._dataview.getUint16(e)}},{key:"getUint32",value:function(e){return this._dataview.getUint32(e)}},{key:"getInt32",value:function(e){return this._dataview.getInt32(e)}},{key:"skip",value:function(t){for(var r=Math.floor(t/4),n=t%4,i=0;i<r;i++)e.readByte(this,4);n>0&&e.readByte(this,n)}},{key:"readUint8",value:function(){return e.readByte(this,1)}},{key:"readUint16",value:function(){return e.readByte(this,2)}},{key:"readUint24",value:function(){return e.readByte(this,3)}},{key:"readUint32",value:function(){return e.readByte(this,4)}},{key:"readUint64",value:function(){return e.readByte(this,8)}},{key:"readInt8",value:function(){return e.readByte(this,1,!0)}},{key:"readInt16",value:function(){return e.readByte(this,2,!0)}},{key:"readInt32",value:function(){return e.readByte(this,4,!0)}},{key:"writeUint32",value:function(e){return new Uint8Array([e>>>24&255,e>>>16&255,e>>>8&255,255&e])}}],[{key:"readByte",value:function(e,t,r){var n;switch(t){case 1:n=r?e.getInt8(e.position):e.getUint8(e.position);break;case 2:n=r?e.getInt16(e.position):e.getUint16(e.position);break;case 3:if(r)throw new Error("not supported for readByte 3");n=e.getUint8(e.position)<<16,n|=e.getUint8(e.position+1)<<8,n|=e.getUint8(e.position+2);break;case 4:n=r?e.getInt32(e.position):e.getUint32(e.position);break;case 8:if(r)throw new Error("not supported for readBody 8");n=e.getUint32(e.position)<<32,n|=e.getUint32(e.position+4);break;default:n=""}return e.position+=t,n}}]),e}(),Cz=function(e){return e[e.internal=0]="internal",e[e.external=1]="external",e[e.bypass=2]="bypass",e}(Cz||{}),Oz=new Uint8Array([109,167,53,190,103,90,72,1,170,89,63,164,194,199,19,85]),xz=new Uint8Array([109,167,53,190,103,90,72,1,170,89,63,164,194,199,19,84]),Dz=function(e){for(var t=[],r=0;r<e.length;r++)e[r]<=3&&0===e[r-1]&&0===e[r-2]&&t.push(3),t.push(e[r]);return new Uint8Array(t)};function Nz(e){for(var t=[];e>=255;)e-=255,t.push(255);return t.push(e),new Uint8Array(t)}function Pz(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=0;255===e[t]&&t<e.byteLength;)t++,r+=255;return t<e.byteLength&&(r+=e[t++]),[r,t]}var Mz=function(){function e(){u(this,e)}return l(e,null,[{key:"generateSEI",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=new Uint8Array([0,0,0,1]),n=new Uint8Array([6]),i=new Uint8Array([5]),o=t?Oz:xz,a=Nz(e.byteLength+o.byteLength),s=Dz(e);return new Uint8Array([].concat(k(r),k(n),k(i),k(a),k(o),k(s),[128]))}},{key:"decodeSeiBody",value:function(e){var t=function(e){for(var t=[],r=0;r<e.length;r++)e[r]<=3&&0===e[r-1]&&0===e[r-2]||t.push(e[r]);return new Uint8Array(t)}(e=e.slice(0,e.length-1));if(!(t.byteLength<2)){var r=0;if(5===t[1]||100===t[1]){var n=E(Pz(t,r+=2),2),i=n[0],o=2,a=(r=n[1])+i;return t.byteLength>=xz.byteLength&&i>=xz.byteLength&&t.slice(r,r+xz.byteLength).toString()===xz.toString()?(r+=xz.byteLength,o=1):t.byteLength>=xz.byteLength&&i>=xz.byteLength&&t.slice(r,r+Oz.byteLength).toString()===Oz.toString()&&(r+=Oz.byteLength,o=0),{type:o,payload:t.slice(r,a)}}}}},{key:"parseInternalSEI",value:function(e){var t=new Map,r=0;if(0===e.type){for(;e.payload.byteLength-r>=2;){var n=E(Pz(e.payload,r),2),i=n[0];r=n[1];var o=E(Pz(e.payload,r),2),a=o[0];if(r=o[1],t.get(i)||!(a<=e.payload.byteLength-r))break;t.set(i,e.payload.slice(r,r+a)),r+=a}return t}}},{key:"makeInternalSei",value:function(e){var t,r=[],n=A(e);try{for(n.s();!(t=n.n()).done;){var i=E(t.value,2),o=i[0],a=i[1],s=Nz(o),c=Nz(a.byteLength);r.push(s,c,a)}}catch(l){n.e(l)}finally{n.f()}var u=r.reduce((function(e,t){return e+t.byteLength}),0),d=new Uint8Array(u);return r.reduce((function(e,t){return d.set(t,e),e+t.byteLength}),0),d}}]),e}(),Lz=function(){function e(t){u(this,e),h(this,"_stream",void 0),h(this,"_timer",void 0),h(this,"client",void 0),h(this,"handler",void 0),h(this,"monitor",void 0),this._stream=t}return l(e,[{key:"setVar",value:function(e,t,r){this.client=e,this.handler=t,this.monitor=r}},{key:"delStatsEvtInterval",value:function(){clearTimeout(this._timer),this._timer=void 0}},{key:"filterIllegal",value:function(e){var t={};return Object.keys(e).forEach((function(r){null===e[r]||void 0===e[r]||Number.isNaN(e[r])||(t[r]=e[r])})),t}},{key:"destroy",value:function(){this.delStatsEvtInterval()}}]),e}(),Uz=function(e){f(i,e);var t,r,n=g(i);function i(e){var t;return u(this,i),(t=n.call(this,e))._stream=e,t}return l(i,[{key:"setLocalStreamStatsEvtInterval",value:function(e,t,r){var n,i,a,s=this;if(!this._timer){this.setVar(e,t,r),e.once(_j.ABNORMAL_DISCONNECTION,(function(){s.destroy()}));var u={audio:{},video:{}},d=this._stream,l=null===(n=d.audioTrack)||void 0===n?void 0:n.getTrack("preprocessing"),h=null===(i=d.videoTrack)||void 0===i?void 0:i.getTrack("preprocessing");this.getAudioStats(l,u,null===(a=d.audioTrack)||void 0===a?void 0:a.getAudioLevel()),this.getVideoStats(h,u),this.delStatsEvtInterval();var f=function(){var e=c(o().mark((function e(){var t,r,n,i,a,c,l;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=null===(t=d.audioTrack)||void 0===t?void 0:t.getTrack("preprocessing"),a=null===(r=d.videoTrack)||void 0===r?void 0:r.getTrack("preprocessing"),e.next=4,s.getAudioStats(i,u,null===(n=d.audioTrack)||void 0===n?void 0:n.getAudioLevel());case 4:return c=e.sent,e.next=7,s.getVideoStats(a,u);case 7:return l=e.sent,e.abrupt("return",{audioStats:c,videoStats:l,isScreen:d.isScreen});case 9:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),p=function(){var e=c(o().mark((function e(){var t,r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,f();case 2:r=e.sent,null===(t=s.client)||void 0===t||t.emit("onLocalStreamStats",r),s._timer&&clearTimeout(s._timer),s._timer=setTimeout(p,2e3);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();this._timer&&clearTimeout(this._timer),this._timer=setTimeout(p,2e3)}}},{key:"unpublish",value:function(){this.delStatsEvtInterval()}},{key:"getAudioStats",value:(r=c(o().mark((function e(t,r,n){var i,a,s,c,u,d,l,h,f,p,v;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i={},a={timestamp:Date.now()},s=this._stream,c=s.streamId,u=s.audioMid,d=s.isScreen,l=s.pubAttributes,h=s.pubAudio,f={media_type:"audio",is_screen:!!d,direction:"up",stream_id:c,vid:u,connection_status:navigator.onLine,track_enabled:null==t?void 0:t.enabled,capture_state:l.localaudio?"capture_state_on":"capture_state_off",mute_state:h?"mute_state_off":"mute_state_on"},t&&this.handler){e.next=6;break}return e.abrupt("return",i);case 6:return e.next=8,this.handler.getStats(t);case 8:if((p=e.sent).length){e.next=11;break}return e.abrupt("return",i);case 11:if(p.forEach((function(e){var t=e.type,r=e.packetsSent,n=e.packetsLost,o=e.bytesSent,s=e.clockRate,c=e.roundTripTime,u=e.channels,d=e.audioLevel;e.googRtt;var l=e.mimeType,h=e.availableIncomingBitrate,p=e.availableOutgoingBitrate,v=e.bytesReceived,_=e.nominated,m=e.id,y=e.currentRoundTripTime,g=e.state,S=e.writable,b=e.requestsReceived,E=e.responsesReceived,k=e.requestsSent,T=e.consentRequestsSent,I=e.responsesSent,A=e.jitter,R=e.candidateType,w=e.ip,C=e.address,O=e.networkType,x=e.port,D=e.protocol,N=e.nackCount,P=e.retransmittedBytesSent,M=e.retransmittedPacketsSent,L=e.audioInputLevel,U=e.ssrc,V=e.totalAudioEnergy,F=e.totalSamplesDuration,B=e.mediaType,j=e.fractionLost;"outbound-rtp"===t?(a.packetsSent=r,a.bytesSent=o,f.bytes=o,f.packetsSent=r,f.nackCount=N,f.ssrc=U,f.retransmitted_bytes_sent=P,f.retransmitted_packets_sent=M,a.retransmittedBytesSent=P,a.retransmittedPacketsSent=M):"remote-inbound-rtp"===t?(a.packetsLost=n,f.packetsLost=n,f.net_jitter=1e3*A,i.rtt=1e3*c,f.rtt=i.rtt,i._fractionLost=j||0):"codec"===t?(i.recordSampleRate=s,i.numChannels=u,f.codecName=l):"media-source"===t&&void 0!==d?(f.audio_level=d?-10*Math.log10(Math.pow(d,2)):d,f.volume=255*d,f.total_audio_energy=V,f.totalInputDuration=F):"ssrc"===t&&"audio"===B?f.send_level=L:"candidate-pair"===t?(f.ice_available_incoming_bitrate=h,f.ice_available_outgoing_bitrate=p,f.ice_bytes_received=v,f.ice_bytes_sent=o,f.ice_nominated=+_,f.ice_pair_id=m,f.ice_pair_rtt=y,f.ice_pair_state=g,f.ice_pair_writable=S,f.recv_ping_requests=b,f.recv_ping_responses=E,f.sent_ping_requests_before_first_response=k,f.sent_ping_requests_total=k+(T||0),f.sent_ping_responses=I):"local-candidate"===t?(f.local_candidate_type=R,f.local_ip=w||C,f.local_network_type=O,f.local_port=x,f.protocol=D):"remote-candidate"===t&&(f.remote_candidate_type=R,f.remote_ip=w||C,f.remote_port=x)})),void 0===f.volume&&void 0!==n&&(f.volume=n,f.audio_level=n?-10*Math.log10(Math.pow(n/255,2)):n),(v=r.audio).timestamp){e.next=17;break}return r.audio=a,e.abrupt("return",this.filterIllegal(i));case 17:return void 0!==a.packetsLost&&(i.audioLossRate=(a.packetsLost-v.packetsLost)/(a.packetsSent-v.packetsSent),i.audioLossRate=Number.isNaN(i.audioLossRate)?0:i.audioLossRate,f.fraction_lost=i.audioLossRate),i.statsInterval=a.timestamp-v.timestamp,f.stats_interval=i.statsInterval,i.sendKBitrate=(a.bytesSent-v.bytesSent||0)/i.statsInterval*8,f.mediaBitratebps=Math.round(1e3*i.sendKBitrate),f.bandwidth=Math.round(f.mediaBitratebps/1024),void 0!==a.retransmittedBytesSent&&(f.retransmitBitratebps=(a.retransmittedBytesSent-v.retransmittedBytesSent||0)/i.statsInterval),r.audio=a,this.monitor.rtcMediaStatistics(f,{}),i._retransmittedRate=(a.retransmittedPacketsSent-v.retransmittedPacketsSent)/(a.packetsSent-v.packetsSent),void 0===i.audioLossRate&&(i.audioLossRate=i._retransmittedRate,f.fraction_lost=i.audioLossRate),i._fractionLost=Math.max(i._fractionLost,i.audioLossRate),e.abrupt("return",this.filterIllegal(i));case 30:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return r.apply(this,arguments)})},{key:"getVideoStats",value:(t=c(o().mark((function e(t,r){var n,i,a,s,c,u,d,l,h,f,p,v,_,m,y;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n={},i={timestamp:Date.now(),simulcast:{}},a=this._stream,s=a.streamId,c=a.videoMid,u=a.isScreen,d=a.pubAttributes,l=a.enableSimulcast,h=a.pubVideo,f={media_type:"video",is_screen:!!u,direction:"up",stream_id:s,vid:c,connection_status:navigator.onLine,track_enabled:null==t?void 0:t.enabled,capture_state:d.localvideo?"capture_state_on":"capture_state_off",mute_state:h?"mute_state_off":"mute_state_on"},t&&this.handler){e.next=6;break}return e.abrupt("return",n);case 6:return f.cap_frame_width=t.getSettings().width,f.cap_frame_height=t.getSettings().height,n.isScreen=u,e.next=11,this.handler.getStats(t);case 11:if((p=e.sent).length){e.next=14;break}return e.abrupt("return",n);case 14:if(v=0,p.forEach((function(e){var t=e.type,r=e.framesEncoded,o=e.packetsLost,a=e.bytesSent,s=e.framesSent,c=e.roundTripTime,u=e.mimeType,d=e.frameWidth,h=e.frameHeight,p=e.packetsSent,_=e.googActualEncBitrate,m=e.googAvailableReceiveBandwidth,y=e.googAvailableSendBandwidth,g=e.googAvgEncodeMs,S=e.googBucketDelay,b=e.googEncodeUsagePercent,E=e.googFrameRateInput,k=e.availableIncomingBitrate,T=e.availableOutgoingBitrate,I=e.bytesReceived,A=e.nominated,R=e.id,w=e.currentRoundTripTime,C=e.state,O=e.writable,x=e.candidateType,D=e.ip,N=e.address,P=e.networkType,M=e.port,L=e.nackCount,U=e.pliCount,V=e.protocol,F=e.qpSum,B=e.requestsReceived,j=e.responsesReceived,G=e.googRetransmitBitrate,H=e.requestsSent,z=e.consentRequestsSent,X=e.responsesSent,K=e.ssrc,q=e.googTargetEncBitrate,W=e.googTransmitBitrate,Y=e.retransmittedPacketsSent,J=e.encoderImplementation,Q=e.jitter,Z=e.rid,$=e.fractionLost,ee=e.googAdaptationChanges,te=e.qualityLimitationReason,re=e.qualityLimitationDurations,ne=e.googFirsReceived,ie=e.googFrameRateSent,oe=e.keyFramesEncoded;"outbound-rtp"===t?(l&&(Z?i.simulcast[Z]=e:i.simulcast[v]=e,v++),i.framesEncoded=r||i.framesEncoded||0,f.key_frames_encoded=oe||0,i.bytesSent=a||i.bytesSent||0,i.framesSent=s||i.framesSent||0,f.bytes=a||f.bytes||0,i.packetsSent=p||i.packetsSent||0,f.packetsSent=p||f.packetsSent||0,f.nackCount=L||f.nackCount||0,f.pli_count=U||f.pli_count||0,f.qp_sum=F||f.qp_sum||0,f.ssrc=K||f.ssrc||0,f.retransmitted_packets_sent=Y,i.retransmittedPacketsSent=Y,f.encoder_implementation=J,f.qualityLimitationReason=te,f.qualityLimitationDurations=re,void 0!==d&&((!n.encodedFrameWidth||d>n.encodedFrameWidth)&&(n.encodedFrameWidth=d),(!n.encodedFrameHeight||h>n.encodedFrameHeight)&&(n.encodedFrameHeight=h),f.frame_size_height=h,f.frame_size_width=d)):"track"===t?(n.encodedFrameWidth=d,n.encodedFrameHeight=h,f.frame_size_height=h,f.frame_size_width=d):"remote-inbound-rtp"===t?(i.packetsLost=o,n.rtt=1e3*c,f.rtt=n.rtt,f.jitter=Q,f.packetsLost=o,n._fractionLost=$||0):"codec"===t?(n.codecType=u,f.codecName=u):"candidate-pair"===t?(f.ice_available_incoming_bitrate=k,f.ice_available_outgoing_bitrate=T,f.ice_bytes_received=I,f.ice_bytes_sent=a,f.ice_nominated=+A,f.ice_pair_id=R,f.ice_pair_rtt=w,f.ice_pair_state=C,f.ice_pair_writable=O,f.recv_ping_requests=B,f.recv_ping_responses=j,f.sent_ping_requests_before_first_response=H,f.sent_ping_requests_total=H+z,f.sent_ping_responses=X):"local-candidate"===t?(f.local_candidate_type=x,f.local_ip=D||N,f.local_network_type=P,f.local_port=M,f.protocol=V):"remote-candidate"===t?(f.remote_candidate_type=x,f.remote_ip=D||N,f.remote_port=M):"VideoBwe"===t?(f.encBitratebps=_,f.available_receive_bandwidth=m,f.available_send_bandwidth=y,f.bucket_delay=S,f.retransmitBitratebps=G,f.targetEncBitratebps=q,f.transmit_bitrate=W,n._sendBandWidth=+y):"ssrc"===t&&(f.avg_encode_ms=g,f.encodeUsage=b,f.frame_rate_input=E,f.orignal_input_Framerate=+E,f.ddaptationChanges=ee,f.firsReceived=ne,f.frameRateSent=ie)})),(_=r.video).timestamp){e.next=20;break}return r.video=i,e.abrupt("return",this.filterIllegal(n));case 20:return n.statsInterval=i.timestamp-_.timestamp,f.stats_interval=n.statsInterval,m=Object.keys(i.simulcast),l?(f.sim_enc_width=[],f.sim_enc_height=[],f.sim_enc_bps=[],f.sim_enc_framerate=[],f.sim_enc_key_frames=[],f.sim_rids=[],f.sim_enc_bandwidth=[],f.sim_sent_framerate=[],f.sim_fraction_lost=[],f.sim_keyencoded=[],f.active_sim_streams=[],f.sim_retransmittedRate=[],y=!1,m.sort((function(e,t){return+e-+t})).forEach((function(e){var t=i.simulcast[e],r=t.frameWidth,o=t.frameHeight,a=t.bytesSent,s=t.framesEncoded,c=t.framesSent,u=t.packetsLost,d=t.packetsSent,l=t.qualityLimitationReason,h=t.qualityLimitationDurations,p=t.qualityLimitationResolutionChanges,v=t.retransmittedPacketsSent,m=t.pliCount,g=t.keyFramesEncoded;void 0!==l&&(f.sim_qualityLimitationReason||(f.sim_qualityLimitationReason=[],f.sim_qualityLimitationDurations=[],f.sim_qualityLimitationResolutionChanges=[]),f.sim_qualityLimitationReason.push(l),f.sim_qualityLimitationDurations.push(h),f.sim_qualityLimitationResolutionChanges.push(p));var S=_.simulcast[e];if(f.sim_enc_width.push(r||0),f.sim_enc_height.push(o||0),f.sim_enc_key_frames.push(g||0),S){var b=(a-S.bytesSent||0)/n.statsInterval;f.sim_enc_bps.push(Math.round(8e3*b)),f.sim_enc_bandwidth.push(Math.round(8e3*b/1024));var E=1e3*(s-S.framesEncoded)/n.statsInterval;f.sim_enc_framerate.push(Math.round(E)),f.sim_rids.push(e);var k=void 0!==c?c-S.framesSent:s-S.framesEncoded,T=1e3*k/n.statsInterval;f.sim_sent_framerate.push(Math.round(T));var I=(u-S.packetsLost)/(d-S.packetsSent);n._retransmittedRate=(v-S.retransmittedPacketsSent)/(d-S.packetsSent),I=Number.isNaN(I)?0:I,f.sim_fraction_lost.push(I),f.sim_keyencoded.push(m-S.pliCount>0),f.active_sim_streams.push(b>=0),f.sim_retransmittedRate.push(n._retransmittedRate),r>0&&!y&&(n.sentKBitrate=8*b,n.encoderOutputFrameRate=E,n.encodedFrameCount=k,n.sentFrameRate=T,n.videoLossRate=I,y=!0)}})),this.monitor.rtcMediaStatistics(f,{})):(n.encodedFrameCount=void 0!==i.framesSent?i.framesSent-_.framesSent:i.framesEncoded-_.framesEncoded,n.sentKBitrate=(i.bytesSent-_.bytesSent||0)/n.statsInterval*8,f.bitrate=Math.round(1e3*n.sentKBitrate),f.bandwidth=Math.round(f.bitrate/1024),n.encoderOutputFrameRate=1e3*(i.framesEncoded-_.framesEncoded)/n.statsInterval,f.frame_rate_encoded=Math.round(n.encoderOutputFrameRate),n.sentFrameRate=1e3*n.encodedFrameCount/n.statsInterval,f.frame_rate_sent=Math.round(n.sentFrameRate),n.videoLossRate=(i.packetsLost-_.packetsLost)/(i.packetsSent-_.packetsSent),n.videoLossRate=Number.isNaN(n.videoLossRate)?0:n.videoLossRate,f.fraction_lost=n.videoLossRate,n._retransmittedRate=(i.retransmittedPacketsSent-_.retransmittedPacketsSent)/(i.packetsSent-_.packetsSent),this.monitor.rtcMediaStatistics(f,{})),r.video=i,n._fractionLost=Math.max(n._fractionLost,n.videoLossRate),e.abrupt("return",this.filterIllegal(n));case 27:case"end":return e.stop()}}),e,this)}))),function(e,r){return t.apply(this,arguments)})}]),i}(Lz),Vz=function(e){f(a,e);var t,r,n,i=g(a);function a(e){var t;return u(this,a),h(m(t=i.call(this,e)),"_audioStallCount",void 0),h(m(t),"_setAudioStallCount",void 0),h(m(t),"_audioStallTimer",void 0),h(m(t),"_audioStallInterval",void 0),h(m(t),"_audioStallRatio",void 0),h(m(t),"_videoInWaiting",void 0),h(m(t),"_context",void 0),t._videoInWaiting=!1,t}return l(a,[{key:"setRemoteStreamStatsEvtInterval",value:(n=c(o().mark((function e(t,r,n,i){var s,u,d,l,h,f,p,v,_,m,y,g,S,b,E=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._timer){e.next=2;break}return e.abrupt("return");case 2:return this.setVar(t,r,n),this._context=i,t.once(_j.ABNORMAL_DISCONNECTION,(function(){E.destroy()})),this._audioStallInterval=a.audioStallInterval||100,this._audioStallRatio=a.audioStallRatio||.6,d={audio:{},video:{}},l=this._stream,h=null===(s=l.audioTrack)||void 0===s?void 0:s.getTrack(),f=null===(u=l.videoTrack)||void 0===u?void 0:u.getTrack(),this.getRemoteVideoStats(f,d),e.next=14,this.getRemoteAudioStats(h,d);case 14:this.delStatsEvtInterval(),p=0,v=0,m=[],y=0,g=fP(),this._setAudioStallCount=function(){if(E._audioStallInterval>0&&void 0!==d.audio.concealedSamples){var e=d.audio.concealedSamples,t=d.audio.totalSamplesReceived;g=fP();var r={isStall:!1,counted:!1,diff:0},n=.5*E._audioStallInterval;E._audioStallCount=c(o().mark((function i(){var a,s,c,u,d,h,f,_,S,b,k,T,I,A,R;return o().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(s=l.hasAudio,c=l.subAudio,s&&c){i.next=7;break}return r.isStall=!1,r.counted=!1,m.push({reason:"hasAudio: ".concat(s,", subAudio: ").concat(c)}),g=fP(),i.abrupt("return",{stall_count:p,stall_duration:v,stall_list:m,stats_count:y});case 7:return u=null===(a=l.audioTrack)||void 0===a?void 0:a.getTrack(),d=Date.now(),i.next=11,E.handler.getStats(u,!0);case 11:if(h=i.sent,f=Date.now(),_=fP(),!((S=_-g)<n)){i.next=18;break}return m.push({diff:S,start:g,end:_,get_stats_cost:f-d,get_stats_start:d,get_stats_end:f,reason:"diff(".concat(S,") < minInterval(").concat(n,")")}),i.abrupt("return",{stall_count:p,stall_duration:v,stall_list:m,stats_count:y});case 18:if(b=h.length,k=h.find((function(e){return"inbound-rtp"===e.type}))){i.next=23;break}return m.push({diff:S,start:g,end:_,get_stats_cost:f-d,get_stats_start:d,get_stats_end:f,reason:b?"no inbound-rtp":"no report"}),i.abrupt("return",{stall_count:p,stall_duration:v,stall_list:m,stats_count:y});case 23:return T=k.concealedSamples,I=k.totalSamplesReceived,R=I-t,(A=T-e)>=0&&R>=0&&A>=E._audioStallRatio*R?(m.push({concealed:A,received:R,diff:S,start:g,end:_,get_stats_cost:f-d,get_stats_start:d,get_stats_end:f,is_stall:!0}),r.isStall?(r.counted?v+=S:(v=v+r.diff+S,p++),r.counted=!0):S>=200?(v+=S,p++,r.counted=!0):(r.counted=!1,r.diff=S),r.isStall=!0):(m.push({concealed:A,received:R,diff:S,start:g,end:_,get_stats_cost:f-d,get_stats_start:d,get_stats_end:f}),r.isStall=!1,r.counted=!1),e=T,t=I,g=_,y++,i.abrupt("return",{stall_count:p,stall_duration:v,stall_list:m,stats_count:y});case 32:case"end":return i.stop()}}),i)}))),_=function(){var e=c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!E._audioStallCount&&E._setAudioStallCount&&E._setAudioStallCount(),!E._audioStallCount){e.next=6;break}return e.next=4,E._audioStallCount();case 4:E._audioStallTimer&&clearTimeout(E._audioStallTimer),E._audioStallTimer=setTimeout(_,E._audioStallInterval);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),E._audioStallTimer&&clearTimeout(E._audioStallTimer),E._audioStallTimer=setTimeout(_,E._audioStallInterval)}},this._setAudioStallCount(),S=function(){var e=c(o().mark((function e(){var t,r,n,i,a,s;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=null===(t=l.audioTrack)||void 0===t?void 0:t.getTrack(),i=null===(r=l.videoTrack)||void 0===r?void 0:r.getTrack(),e.next=4,E.getRemoteAudioStats(n,d);case 4:return a=e.sent,p=0,v=0,m=[],y=0,e.next=11,E.getRemoteVideoStats(i,d);case 11:return s=e.sent,e.abrupt("return",{audioStats:a,videoStats:s,isScreen:l.isScreen,userId:l.userId});case 13:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),b=function(){var e=c(o().mark((function e(){var t,r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,S();case 2:r=e.sent,null===(t=E.client)||void 0===t||t.emit("onRemoteStreamStats",r),_&&(g=fP(),E._audioStallTimer&&clearTimeout(E._audioStallTimer),E._audioStallTimer=setTimeout(_,E._audioStallInterval)),E._timer&&clearTimeout(E._timer),E._timer=setTimeout(b,2e3);case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),this._timer&&clearTimeout(this._timer),this._timer=setTimeout(b,2e3);case 26:case"end":return e.stop()}}),e,this)}))),function(e,t,r,i){return n.apply(this,arguments)})},{key:"delStatsEvtInterval",value:function(){b(p(a.prototype),"delStatsEvtInterval",this).call(this),clearTimeout(this._audioStallTimer),this._audioStallCount=void 0,this._setAudioStallCount=void 0}},{key:"unsubscribe",value:function(){this.delStatsEvtInterval(),this._videoInWaiting=!1}},{key:"getRemoteAudioStats",value:(r=c(o().mark((function e(t,r){var n,i,a,s,c,u,d,l,h,f,p,v,_,m,y,g,S,b,E,k=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n={},i={},a=this._stream,s=a.streamId,c=a.userId,u=a.isScreen,d=a.audioMid,l=a.subMediaType,h=a._attributes,f=a.virtual,p={media_type:"audio",is_screen:!!u,direction:"down",stream_id:s,stream_user_id:c,vid:d,audio_mux:f,connection_status:navigator.onLine,track_enabled:null==t?void 0:t.enabled,mute_state:UP(l)?"mute_state_off":"mute_state_on",remote_user_capture_state:h.localaudio?"capture_state_on":"capture_state_off",remote_user_mute_state:h.localaudio&&h.audiostream?"mute_state_off":"mute_state_on"},t&&this.handler){e.next=6;break}return e.abrupt("return",n);case 6:return e.next=8,this.handler.getStats(t);case 8:if((v=e.sent).length){e.next=11;break}return e.abrupt("return",n);case 11:if(v.forEach((function(e){var t=e.type,r=e.packetsLost,o=e.packetsReceived,a=e.bytesReceived,c=e.jitterBufferDelay,u=e.jitterBufferEmittedCount,d=e.clockRate,l=e.channels,h=e.totalSamplesReceived,f=e.concealedSamples,v=e.silentConcealedSamples,_=e.concealmentEvents,m=e.totalRoundTripTime,y=e.packetsDiscarded,g=e.state,S=e.currentRoundTripTime,b=e.audioLevel,E=e.totalAudioEnergy,T=e.totalSamplesDuration,I=e.mimeType,A=e.googDecodingNormal,R=e.googDecodingMuted,w=e.availableIncomingBitrate,C=e.availableOutgoingBitrate,O=e.bytesSent,x=e.nominated,D=e.id,N=e.writable,P=e.jitter,M=e.candidateType,L=e.ip,U=e.address,V=e.networkType,F=e.port,B=e.protocol,j=e.audioOutputLevel,G=e.requestsReceived,H=e.responsesReceived,z=e.requestsSent,X=e.consentRequestsSent,K=e.responsesSent,q=e.ssrc;e.kind;var W=e.nackCount,Y=e.lastPacketReceivedTimestamp,J=e.concealmentevents,Q=e.fecPacketsReceived;if("inbound-rtp"===t)i.packetsLost=r,i.packetsReceived=o,p.packetsReceived=o,p.packetsDiscarded=y,p.nackCount=W,p.lastPacketReceivedTimestamp=Y,p.concealmentevents=J,i.bytesReceived=a,void 0!==c&&(n.jitterBufferDelay=c/u*1e3,p.average_jitter_buffer_delay_ms=n.jitterBufferDelay),void 0!==h&&(i.totalSamplesReceived=h,n.concealedSamples=f,i.concealedSamples=f,i.silentConcealedSamples=v,p.concealedSamples=f,n.concealmentEvents=_,p.totalSamplesReceived=h),void 0!==Q&&(p.fec_packets_received=Q,i.fecPacketsReceived=Q),p.jitter=1e3*P,p.ssrc=q,void 0!==b&&(p.audio_level=b?-10*Math.log10(Math.pow(b,2)):b),void 0!==b&&(p.volume=255*b),void 0!==E&&(p.total_audio_energy=E),void 0!==T&&(p.totalAudioDuration=T);else if("codec"===t)n.recordSampleRate=d,l&&(n.numChannels=l),p.codecName=I;else if("candidate-pair"===t){var Z,$,ee;p.ice_available_incoming_bitrate=w,p.ice_available_outgoing_bitrate=C,p.ice_bytes_received=a,p.ice_bytes_sent=O,p.ice_nominated=+x,p.ice_pair_id=D,p.ice_pair_rtt=S,p.rtt=1e3*S,p.rtt&&null!==(Z=k._context)&&void 0!==Z&&null!==($=Z.streamRTT)&&void 0!==$&&null!==(ee=$[s])&&void 0!==ee&&ee.audio&&(p.total_rtt_ms=p.rtt+k._context.streamRTT[s].audio),p.ice_pair_state=g,p.ice_pair_writable=N,p.recv_ping_requests=G,p.recv_ping_responses=H,p.sent_ping_requests_before_first_response=z,p.sent_ping_requests_total=z+(X||0),p.sent_ping_responses=K,"succeeded"===g&&(n.rtt=1e3*S,n.total_rtt=1e3*m)}else"track"===t&&void 0!==b?(p.audio_level=b?-10*Math.log10(Math.pow(b,2)):b,p.volume=255*b,p.total_audio_energy=E,p.totalAudioDuration=T):"ssrc"===t?(p.decodingNormal=A,p.recvAudioLevel=j,p.decodingMuted=R):"local-candidate"===t?(p.local_candidate_type=M,p.local_ip=L||U,p.local_network_type=V,p.local_port=F,p.protocol=B):"remote-candidate"===t&&(p.remote_candidate_type=M,p.remote_ip=L||U,p.remote_port=F)})),(_=r.audio).timestamp){e.next=17;break}return i.timestamp=Date.now(),r.audio=i,e.abrupt("return",this.filterIllegal(n));case 17:if(m={},void 0!==i.concealedSamples&&(p.interval_concealed_samples=i.concealedSamples-_.concealedSamples,p.interval_samples_received=i.totalSamplesReceived-_.totalSamplesReceived,p.interval_silent_concealed_samples=i.silentConcealedSamples-_.silentConcealedSamples),!(this._audioStallInterval>0&&void 0!==_.concealedSamples)){e.next=35;break}if(!this._audioStallCount&&this._setAudioStallCount&&this._setAudioStallCount(),clearTimeout(this._audioStallTimer),!this._audioStallCount){e.next=35;break}return e.next=25,this._audioStallCount();case 25:y=e.sent,g=y.stall_count,S=y.stall_duration,b=y.stall_list,E=y.stats_count,m.stall_list=b,m.stats_count=E,p.concealedSamples===p.interval_concealed_samples&&p.totalSamplesReceived===p.interval_samples_received?(p.stall_count=0,p.stall_duration=0):(p.stall_count=g,p.stall_duration=S),n.stallCount=p.stall_count,n.stallDuration=p.stall_duration;case 35:return i.timestamp=Date.now(),n.audioLossRate=(i.packetsLost-_.packetsLost)/(i.packetsReceived-_.packetsReceived+(i.packetsLost-_.packetsLost)),n.audioLossRate=Number.isNaN(n.audioLossRate)?0:n.audioLossRate,p.packetsLost=Math.round(i.packetsLost-_.packetsLost),p.fraction_lost=n.audioLossRate,n.statsInterval=i.timestamp-_.timestamp,p.stats_interval=n.statsInterval,n.receivedKBitrate=(i.bytesReceived-_.bytesReceived||0)/n.statsInterval*8,p.bandwidth=Math.round(1e3*n.receivedKBitrate/1024),void 0!==i.concealedSamples&&(n.receivedSampleRate=1e3*p.interval_samples_received/n.statsInterval),void 0!==i.fecPacketsReceived&&(p.fecBitratebps=(i.fecPacketsReceived-_.fecPacketsReceived||0)/n.statsInterval),r.audio=i,this.monitor.rtcMediaStatistics(p,{},m),e.abrupt("return",this.filterIllegal(n));case 49:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"getRemoteVideoStats",value:(t=c(o().mark((function e(t,r){var n,i,a,s,c,u,d,l,h,f,p,v=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n={},i={timestamp:Date.now()},a=this._stream,s=a.streamId,c=a.userId,u=a.isScreen,d=a.subMediaType,l=a._attributes,h={media_type:"video",is_screen:!!u,direction:"down",stream_id:s,stream_user_id:c,vid:this._stream.videoMid,connection_status:navigator.onLine,track_enabled:null==t?void 0:t.enabled,mute_state:VP(d)?"mute_state_off":"mute_state_on",remote_user_capture_state:l.localvideo?"capture_state_on":"capture_state_off",remote_user_mute_state:l.localvideo&&l.videostream?"mute_state_off":"mute_state_on"},t&&this.handler){e.next=6;break}return e.abrupt("return",n);case 6:return n.isScreen=u,e.next=9,this.handler.getStats(t);case 9:if((f=e.sent).length){e.next=12;break}return e.abrupt("return",n);case 12:if(f.forEach((function(e){var t=e.type,r=e.frameHeight,o=e.frameWidth,a=e.packetsLost,c=e.packetsReceived,u=e.bytesReceived,d=e.framesDecoded,l=e.jitterBufferDelay,f=e.jitterBufferEmittedCount,p=e.mimeType,_=e.firCount,m=e.availableIncomingBitrate,y=e.availableOutgoingBitrate,g=e.bytesSent,S=e.nominated,b=e.id,E=e.currentRoundTripTime,k=e.state,T=e.writable,I=e.candidateType,A=e.ip,R=e.address,w=e.networkType,C=e.port,O=e.nackCount,x=e.pliCount,D=e.protocol,N=e.requestsReceived,P=e.responsesReceived,M=e.requestsSent,L=e.consentRequestsSent,U=e.responsesSent,V=e.ssrc,F=e.jitter,B=e.framesReceived,j=e.keyFramesDecoded,G=e.decoderImplementation,H=e.lastPacketReceivedTimestamp;if("inbound-rtp"===t)i.packetsLost=a,h.packetsLost=a,i.packetsReceived=c,h.packetsReceived=c,i.bytesReceived=u,h.bytes=u,i.framesDecoded=d,void 0!==l&&(i.jitterBufferDelay=l/f*1e3,h.average_jitter_buffer_delay_ms=i.jitterBufferDelay),h.fir_count=_,h.nackCount=O,i.nackCount=O,h.pli_count=x,h.ssrc=V,h.jitter=F,h.framesReceived=B,i.framesReceived=B,h.framesDecoded=d,h.key_frames_decoded=j,h.decoder_name=G,h.last_packet_received_timestamp=H,void 0!==o&&(n.width=o,h.frame_size_width=o,n.height=r,h.frame_size_height=r);else if("track"===t&&void 0!==o)n.width=o,h.frame_size_width=o,n.height=r,h.frame_size_height=r,void 0!==B&&(h.framesReceived=B,i.framesReceived=B);else if("codec"===t)h.codecName=p;else if("candidate-pair"===t){var z,X,K;h.ice_available_incoming_bitrate=m,h.ice_available_outgoing_bitrate=y,h.ice_bytes_received=u,h.ice_bytes_sent=g,h.ice_nominated=+S,h.ice_pair_id=b,h.ice_pair_rtt=E,h.rtt=1e3*E,h.rtt&&null!==(z=v._context)&&void 0!==z&&null!==(X=z.streamRTT)&&void 0!==X&&null!==(K=X[s])&&void 0!==K&&K.video&&(h.total_rtt_ms=h.rtt+v._context.streamRTT[s].video),n.rtt=h.rtt,h.ice_pair_state=k,h.ice_pair_writable=T,h.recv_ping_requests=N,h.recv_ping_responses=P,h.sent_ping_requests_before_first_response=M,h.sent_ping_requests_total=M+(L||0),h.sent_ping_responses=U}else"local-candidate"===t?(h.local_candidate_type=I,h.local_ip=A||R,h.local_network_type=w,h.local_port=C,h.protocol=D):"remote-candidate"===t&&(h.remote_candidate_type=I,h.remote_ip=A||R,h.remote_port=C)})),(p=r.video).timestamp){e.next=17;break}return r.video=i,e.abrupt("return",this.filterIllegal(n));case 17:return n.videoLossRate=(i.packetsLost-p.packetsLost)/(i.packetsReceived-p.packetsReceived+(i.packetsLost-p.packetsLost)),n._retransmittedRate=(i.nackCount-p.nackCount)/(i.packetsReceived-p.packetsReceived+(i.packetsLost-p.packetsLost)),n.videoLossRate=Number.isNaN(n.videoLossRate)?0:n.videoLossRate,h.fraction_lost=n.videoLossRate,n.statsInterval=i.timestamp-p.timestamp,h.stats_interval=n.statsInterval,n.receivedKBitrate=(i.bytesReceived-p.bytesReceived||0)/n.statsInterval*8,h.bitrate=Math.round(1e3*n.receivedKBitrate),h.bandwidth=Math.round(h.bitrate/1024),n.decoderOutputFrameRate=1e3*(i.framesDecoded-p.framesDecoded)/n.statsInterval,n.receivedFrameRate=1e3*(i.framesReceived-p.framesReceived)/n.statsInterval,h.frame_rate_decoded=Math.round(n.decoderOutputFrameRate),h.frame_rate_received=Math.round(n.receivedFrameRate),r.video=i,this.processStall(this._stream,h,n,u),this.monitor.rtcMediaStatistics(h,{}),e.abrupt("return",this.filterIllegal(n));case 34:case"end":return e.stop()}}),e,this)}))),function(e,r){return t.apply(this,arguments)})},{key:"processStall",value:function(e,t,r,n){var i=0,o=0,a=0;if(e.recordedVideoFrames){e.recordedVideoFrames.forEach((function(e){e.isStall&&(i+=e.stallCount,o+=e.stallDuration),a=e.playTime})),e.recordedVideoFrames.length||(o=2e3,i=this._videoInWaiting?0:1,this._videoInWaiting=!0);var s=e.recordedVideoFrames.pop();s&&(s.isStall?this._videoInWaiting=!0:this._videoInWaiting=!1),e.recordedVideoFrames=[]}t.stall_count=i,n?(t.stuck_length=o,t.stall_duration=void 0):(t.stall_duration=o,t.stuck_length=void 0),t.play_time=a,r.stallCount=i,r.stallDuration=o}},{key:"destroy",value:function(){b(p(a.prototype),"destroy",this).call(this),this.delStatsEvtInterval(),this._videoInWaiting=!1}}],[{key:"audioStallConfig",set:function(e){a.audioStallInterval=((null==e?void 0:e.audio_stall_interval)||200)/2,a.audioStallRatio=null==e?void 0:e.audio_stall_ratio}}]),a}(Lz);h(Vz,"audioStallInterval",void 0),h(Vz,"audioStallRatio",void 0);var Fz,Bz,jz,Gz=function(e){return e.RESUBSCRIBE="resubscribe",e.STREAM_FAILED="stream_failed",e.SUBSCRIBE_PUSH_TRACK="subscribe_push_track",e.REMOVE_PUSH_TRACK="remove_push_track",e.VIDEO_FIRST_FRAME="video_first_frame",e.ON_USER_PUBLISH_STATE_CHANGE="on_user_publish_state_change",e.ON_USER_START_AUDIO_CAPTURE="on_user_start_audio_capture",e.ON_USER_STOP_AUDIO_CAPTURE="on_user_stop_audio_capture",e.ON_USER_START_VIDEO_CAPTURE="on_user_start_video_capture",e.ON_USER_STOP_VIDEO_CAPTURE="on_user_stop_video_capture",e.ON_SEI_MESSAGED_RECEIVED="on_sei_messaged_received",e.ON_PUBLISH_RESULT="on_publish_result",e.ON_UPDATE_TOKEN_SUCCESS="on_update_token_success",e.ON_REMOTE_STREAM_STATS="ON_REMOTE_STREAM_STATS",e.ON_LOCAL_STREAM_STATS="ON_LOCAL_STREAM_STATS",e.ON_USER_LEAVE="on_user_leave",e.ON_ROOM_ERROR="on_room_error",e.ON_NETWORK_QUALITY="on_network_quality",e.ON_SIMULCAST_SUBSCRIBE_FALLBACK="on_simulcast_subscribe_fallback",e.ON_REMOTE_VIDEO_SIZE_CHANGED="on_remote_video_size_changed",e.RECONNECT_FAILED="reconnect_failed",e.ON_VIDEO_STREAM_BANNED="ON_VIDEO_STREAM_BANNED",e.ON_AUDIO_STREAM_BANNED="ON_AUDIO_STREAM_BANNED",e}(Gz||{}),Hz=function(e){return e[e.START=1]="START",e[e.START_SUCCESS=2]="START_SUCCESS",e[e.START_FAILED=3]="START_FAILED",e[e.UPDATE=4]="UPDATE",e[e.UPDATE_SUCCESS=5]="UPDATE_SUCCESS",e[e.UPDATE_FAILED=6]="UPDATE_FAILED",e[e.STOP=7]="STOP",e[e.STOP_SUCCESS=8]="STOP_SUCCESS",e[e.STOP_FAILED=9]="STOP_FAILED",e}(Hz||{}),zz=function(e){return e[e.PUB=0]="PUB",e[e.UNPUB=1]="UNPUB",e}(zz||{}),Xz=function(e){return e[e.SUB=0]="SUB",e[e.UNSUB=1]="UNSUB",e}(Xz||{}),Kz=new JL("Stream",0),qz=function(e){return e[e.INIT=0]="INIT",e[e.SUB_ING=1]="SUB_ING",e[e.SUB_ED=2]="SUB_ED",e}(qz||{}),Wz=function(){function e(){u(this,e),h(this,"isScreen",!1),h(this,"stream",void 0),h(this,"streamId",void 0),h(this,"audioMid",void 0),h(this,"videoMid",void 0),h(this,"seiList",[]),h(this,"videoTrack",void 0),h(this,"audioTrack",void 0),h(this,"videoTransceiver",void 0),h(this,"audioTransceiver",void 0),h(this,"videoInputConfig",void 0),h(this,"videoEncodeConfig",[dj]),h(this,"subVideoDescriptions",[]),h(this,"enableSimulcast",!1),h(this,"observer",void 0),h(this,"statsReport",void 0),h(this,"prevScaleResolutionDownBy",1),h(this,"pubAudio",!1),h(this,"pubVideo",!1),h(this,"pubAttributes",void 0),this.stream=new MediaStream,this.videoInputConfig={width:640,height:360,frameRate:30},this.pubAttributes={localaudio:!1,localvideo:!1,videostream:!1,audiostream:!1,extvideo:!1,extaudio:!1},this.statsReport=new Uz(this)}return l(e,[{key:"hasPublished",get:function(){return this.audioMid&&this.videoMid}},{key:"isEmptyStream",get:function(){return!this.audioTrack&&!this.videoTrack}},{key:"initStreamId",get:function(){return this.stream.id}},{key:"initVideoEncodedTransform",value:function(){var e=this;if(this.videoTransceiver&&this.videoTransceiver.sender){var t=this.videoTransceiver.sender;if(Yj()){var r=t.createEncodedStreams(),n=r.readable,i=r.writable,o=new TransformStream({transform:function(t,r){var n=e.seiList[0];if(n){var i=Mz.generateSEI(n.content),o=new Uint8Array(i.byteLength+t.data.byteLength);0===n.repeatCount&&e.seiList.splice(0,1),n.repeatCount--,o.set(new Uint8Array(t.data)),o.set(i,t.data.byteLength),t.data=o.buffer,r.enqueue(t)}else r.enqueue(t)}});n.pipeThrough(o).pipeTo(i)}}else Kz.print("no sender found when trying to bind encodedTransform")}},{key:"initAudioEncodedTransform",value:function(){if(this.audioTransceiver&&this.audioTransceiver.sender){var e=this.audioTransceiver.sender.createEncodedStreams(),t=e.readable,r=e.writable;t.pipeThrough(new TransformStream({transform:function(e,t){t.enqueue(e)}})).pipeTo(r)}else Kz.print("no sender found when trying to bind encodedTransform")}},{key:"clean",value:function(){var e;this.audioMid=void 0,this.videoMid=void 0,this.videoTransceiver=void 0,this.audioTransceiver=void 0,null===(e=this.observer)||void 0===e||e.reset(),this.statsReport.destroy(),this.prevScaleResolutionDownBy=1,this.subVideoDescriptions=[]}},{key:"switchTrackEnableState",value:function(e,t){var r,n;"audio"===e?n=this.audioTrack:"video"===e&&(n=this.videoTrack);var i=null===(r=n)||void 0===r?void 0:r.getTrack();return!(!i||(null==i?void 0:i.enabled)===t)&&(i.enabled=t,!0)}}]),e}(),Yz=function(e){f(r,e);var t=g(r);function r(e,n,i,o){var a,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:K.LOW;return u(this,r),h(m(a=t.call(this)),"streamId",void 0),h(m(a),"userId",void 0),h(m(a),"isScreen",void 0),h(m(a),"hasVideo",void 0),h(m(a),"hasAudio",void 0),h(m(a),"_attributes",void 0),h(m(a),"streamState",void 0),h(m(a),"observer",void 0),h(m(a),"statsReport",void 0),h(m(a),"subVideo",void 0),h(m(a),"subAudio",void 0),h(m(a),"subMediaType",void 0),h(m(a),"subLayer",void 0),h(m(a),"audioMid",void 0),h(m(a),"videoMid",void 0),h(m(a),"_sequenceId",void 0),h(m(a),"stream",void 0),h(m(a),"videoTrack",void 0),h(m(a),"audioTrack",void 0),h(m(a),"videoTransceiver",void 0),h(m(a),"audioTransceiver",void 0),h(m(a),"recordedVideoFrames",void 0),h(m(a),"stillExist",void 0),h(m(a),"originalMediaType",void 0),h(m(a),"originalStreamIndex",0),h(m(a),"virtual",void 0),a.userPriority=s,a.virtual=!1,a.userId=e,a.isScreen=i,a.streamId=n,a.hasAudio=o.audiostream&&o.localaudio,a.hasVideo=o.videostream&&o.localvideo,a._attributes=o,a.subVideo=!1,a.subAudio=!1,a._sequenceId=0,a.subMediaType=Az.NONE,a.subLayer={spatialLayer:0,spatialSubLayer:-1},a.streamState=0,a.statsReport=new Vz(m(a)),a}return l(r,[{key:"sequenceId",get:function(){return this._sequenceId||-1},set:function(e){"number"==typeof e&&(this._sequenceId=e)}},{key:"hasSubscribed",get:function(){return 2===this.streamState}},{key:"attributes",get:function(){return this._attributes},set:function(e){this.hasVideo=e.localvideo&&e.videostream,this.hasAudio=e.localaudio&&e.audiostream,this._attributes=e}},{key:"initVideoEncodedTransform",value:function(){var e=this;if(this.videoTransceiver&&this.videoTransceiver.receiver){var t=this.videoTransceiver.receiver.createEncodedStreams(),r=t.readable,n=t.writable;r.pipeThrough(new TransformStream({transform:function(t,r){Rz.getNalunits(new wz(t.data)).forEach((function(t){if(t.sei){var r=Mz.decodeSeiBody(t.body);r&&r.type!==Cz.internal&&e.safeEmit("onSEIMessage",r.payload)}})),r.enqueue(t)}})).pipeTo(n)}else Kz.print("no receiver found when trying to bind encodedTransform")}},{key:"initAudioEncodedTransform",value:function(){if(this.audioTransceiver&&this.audioTransceiver.receiver){var e=this.audioTransceiver.receiver.createEncodedStreams(),t=e.readable,r=e.writable;t.pipeThrough(new TransformStream({transform:function(e,t){t.enqueue(e)}})).pipeTo(r)}else Kz.print("no receiver found when trying to bind encodedTransform")}},{key:"ontrack",value:function(e){var t,r,n,i,o;try{MB.rtcInvokeStatus(JSON.stringify({uid:this.userId,streamId:this.streamId,streams:e.streams.reduce((function(e,t){return e+(null==(r=t)?"undefined | null":"string"==typeof r?r:JSON.stringify({id:r.id,active:r.active}));var r}),""),transceiver:(n=e.transceiver,null==n?"undefined | null":"string"==typeof n?n:JSON.stringify({currentDirection:n.currentDirection,direction:n.direction,mid:n.mid,stopped:n.stopped,receiver:(o=n.receiver,null==o?"undefined | null":"string"==typeof o?o:JSON.stringify({track:jP(o.track)})),sender:(i=n.sender,null==i?"undefined | null":"string"==typeof i?i:JSON.stringify({track:jP(i.track)}))})),track:jP(e.track)}),0,"Stream.ontrack","",0)}catch(T0){}if((null===(t=e.streams)||void 0===t||null===(r=t[0])||void 0===r?void 0:r.id)===this.streamId){var a,s=e.track;"video"===(null==s?void 0:s.kind)?this._setVideoTrack(s):"audio"===(null===(a=e.track)||void 0===a?void 0:a.kind)&&this._setAudioTrack(s),this._setStream(e.streams[0])}this.safeEmit("ontrack",e)}},{key:"clean",value:function(){var e;Kz.print("clean","exec stream.clean ".concat(this.streamId," ").concat(this.userId)),this.subAudio=!1,this.subVideo=!1,this.audioMid=void 0,this.videoMid=void 0,this.sequenceId=0,this.videoTrack=void 0,this.audioTrack=void 0,this.stream=void 0,this.videoTransceiver=void 0,this.audioTransceiver=void 0,this.recordedVideoFrames=void 0,null===(e=this.observer)||void 0===e||e.reset(),this.statsReport.destroy()}},{key:"resetHasSubscribed",value:function(){this.streamState=0}},{key:"setRemoteUserPriority",value:function(e){this.userPriority=e}},{key:"getStreamPriority",value:function(){var e=this.isScreen?20:this.hasAudio||this.hasVideo?this.attributes.videoDescriptions.length>1?10-this.subLayer.spatialLayer:9:0;return 1e4*this.userPriority+100*e}},{key:"getSubscribeFallbackParams",value:function(e){if(e!==X.DISABLE&&this.subVideo){if(this.attributes.videoDescriptions.length-1>this.subLayer.spatialLayer)return[this.originalMediaType,Xz.SUB,this._getSubLayerBySpatialLayer(this.subLayer.spatialLayer+1)];if(e===X.AUDIO_ONLY)return[U.VIDEO,Xz.UNSUB]}return null}},{key:"getSubscribeRecoverParams",value:function(){if(this.originalMediaType&&VP(this.originalMediaType)){if(!1===this.subVideo)return[this.originalMediaType,Xz.SUB,this.subLayer];if("number"==typeof this.originalStreamIndex&&this.subLayer.spatialLayer>this.originalStreamIndex)return[this.originalMediaType,Xz.SUB,this._getSubLayerBySpatialLayer(this.subLayer.spatialLayer-1)]}return null}},{key:"_setStream",value:function(e){var t=this;this.stream=e,e.onaddtrack=function(e){"video"===e.track.kind?t._setVideoTrack(e.track):"audio"===e.track.kind&&t._setAudioTrack(e.track)}}},{key:"_setAudioTrack",value:function(e){var t,r;(null===(t=this.audioTrack)||void 0===t||null===(r=t.getTrack())||void 0===r?void 0:r.id)!==(null==e?void 0:e.id)&&(this.audioTrack=_z(e),this.emit("ontrack",this.audioTrack))}},{key:"_setVideoTrack",value:function(e){var t,r;(null===(t=this.videoTrack)||void 0===t||null===(r=t.getTrack())||void 0===r?void 0:r.id)!==(null==e?void 0:e.id)&&(this.videoTrack=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:hP();return new JH(e,t)}(e),this.emit("ontrack",this.videoTrack))}},{key:"_getSubLayerBySpatialLayer",value:function(e){var t=this._attributes,r=t.videoDescriptions,n=t.subVideoDescriptions,i=void 0===n?[]:n,o=r[e],a=o.width,s=o.height,c=i.find((function(e){return e.width===a&&e.height===s}));return{spatialLayer:e,spatialSubLayer:(null==c?void 0:c.sub_index)||-1}}}]),r}($L),Jz=new JL("queue",4),Qz=function(e){return e[e.ADD=0]="ADD",e[e.CLOSE=1]="CLOSE",e}(Qz||{}),Zz=function(e){return e.publish="publish",e.unpublish="unpublish",e.subscribe="subscribe",e.unsubscribe="unsubscribe",e.pushtrack="pushtrack",e.removetrack="removetrack",e}(Zz||{}),$z=(h(Fz={},"publish","unpublish"),h(Fz,"subscribe","unsubscribe"),h(Fz,"pushtrack","removetrack"),Fz),eX=(h(Bz={},"publish",0),h(Bz,"subscribe",0),h(Bz,"pushtrack",0),h(Bz,"unpublish",1),h(Bz,"unsubscribe",1),h(Bz,"removetrack",1),Bz),tX=function(e){f(r,e);var t=g(r);function r(){var e;return u(this,r),h(m(e=t.call(this)),"_queue",void 0),e._queue=[],e}return l(r,[{key:"queue",get:function(){return this._queue}},{key:"enqueue",value:function(e){var t=this._queue.length,r="";return this._queue=this._queue.filter((function(t){return t.streamId!==e.streamId||e.action!==$z[t.action]||(r=t.streamId,Jz.print("offsetStreamId",r),!1)})),this._queue.length===t&&this._queue.push(e),this.emit("start"),r}},{key:"dequeue",value:function(){if(!this._queue.length)return null;var e=this._queue.length;CP&&(e=Math.min(this._queue.length,5));for(var t=eX[this._queue[0].action],r=1;r<e;r++)if(eX[this._queue[r].action]!==t)return{sdpStrategy:t,items:this._queue.splice(0,r)};return{sdpStrategy:t,items:this._queue.splice(0,e)}}}]),r}(GL),rX=new JL("ChromeHandler",3),nX=Yj(),iX=function(e){f(k,e);var r,n,a,s,d,v,_,y,S=g(k);function k(e,t){var r;return u(this,k),h(m(r=S.call(this,e,t)),"name","chrome"),h(m(r),"_queueBusy",!1),h(m(r),"_sdpQueue",void 0),h(m(r),"_aSendonlyOfferTpl",void 0),h(m(r),"_vSendonlyOfferTpl",void 0),h(m(r),"_aRecvonlyOfferTpl",void 0),h(m(r),"_vRecvonlyOfferTpl",void 0),h(m(r),"_mid",10),h(m(r),"_offerSession",void 0),h(m(r),"_answerSession",void 0),h(m(r),"_offerMlines",[]),h(m(r),"_answerMlines",[]),h(m(r),"_inactiveMlineIndex",[]),h(m(r),"_mlinesCache",{}),r._sdpQueue=new tX,r._sdpQueue.on("start",(function(){r._queueBusy||"stable"!==r._peerConnection.signalingState||(rX.print("dequeue start"),r.dequeue())})),r}return l(k,[{key:"connect",value:(y=c(o().mark((function e(t){var r,n,a,s,c,u,d=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return rX.print("connect","invoke connect"),this._offerIce={iceUfrag:null===(r=t.iceParams)||void 0===r?void 0:r.clientIceUfrag,icePwd:null===(n=t.iceParams)||void 0===n?void 0:n.clientIcePwd,iceOptions:"renomination"},e.next=4,GG(t);case 4:return this._answerIce=e.sent,e.next=7,this._peerConnection.createOffer();case 7:return a=e.sent,s=Jj.parse(a.sdp),c=E(s.media,1),u=c[0],this._offerIce.fingerprint=s.fingerprint||u.fingerprint,delete s.media,this._offerSession=i({},s),this._answerSession=i({},s),this._answerSession.fingerprint&&(this._answerSession.fingerprint=this._answerIce.fingerprint),this._offerMlines=[i(i(i({},u),this._offerIce),{},{mid:"".concat(0)})],this._answerMlines=[i(i(i({},u),this._answerIce),{},{sctpmap:{sctpmapNumber:5e3,app:"webrtc-datachannel",maxMessageSize:262144},mid:"".concat(0)})],this.setDescription(),e.next=21,new Promise((function(e,t){d._dataChannel.onopen=function(){rX.print("connect","dataChannel open"),XB("es.dc.open",""),e("")},d._dataChannel.onerror=function(e){MB.rtcSignalingMsgError(e.error.sdpLineNumber,e.error.errorDetail,uB.INVALID_DATA),XB("es.dc.error",""),t(e)},d._dataChannel.onclose=function(e){XB("es.dc.close",""),t(e)},d._peerConnection.addEventListener("connectionstatechange",(function(e){"failed"!==d._peerConnection.iceConnectionState&&"closed"!==d._peerConnection.iceConnectionState&&"failed"!==d._peerConnection.connectionState||t(e)}))}));case 21:return rX.print("connect","dataChannel establish success"),e.abrupt("return",this._dataChannel);case 23:case"end":return e.stop()}}),e,this)}))),function(e){return y.apply(this,arguments)})},{key:"disconnect",value:function(){this._peerConnection.close(),this._dataChannel.close(),this._peerConnection.ontrack=null}},{key:"destroy",value:function(){b(p(k.prototype),"destroy",this).call(this),this._mlinesCache={}}},{key:"publish",value:(_=c(o().mark((function e(t){var r,n,a,s,c,u,d,l,h,f,v,_,m,y,g,S,T,I,A,R,w,C,O,x,D,N,P,M,L,U;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return c=t.stream,u=t.enableSimulcast,d=b(p(k.prototype),"internalPublish",this).call(this,t),l=d.videoDescriptions,h=d.subVideoDescriptions,f=d.audioTransceiverInit,v=d.videoTransceiverInit,_=UG(this._nextSsrc),this._nextSsrc=_.next,m="".concat(this._mid++),y="".concat(this._mid++),g=i(i(i({},this._aSendonlyOfferTpl),this._offerIce),{},{mid:m,msid:"".concat(c.id," ").concat(c.id,"-audio"),ssrcs:VG(c.id,"audio",_.audio,MG)}),S=i(i(i({},this._vSendonlyOfferTpl),this._offerIce),{},{mid:y,msid:"".concat(c.id," ").concat(c.id,"-video")}),u?(rX.print("subVideoDesc","desc: %o ",h),delete S.ssrcGroups,delete S.ssrcs,T=[],S.rids=l.map((function(e){var t=e.rid;return T.unshift(t),{id:t,direction:"send"}})),S.simulcast={dir1:"send",list1:T.join(";")}):(I=FG(c.id,_,{cname:MG}),A=I.ssrcs,R=I.ssrcGroups,S.ssrcs=A,S.ssrcGroups=R),null!==(r=this._context)&&void 0!==r&&null!==(n=r.serverConfig)&&void 0!==n&&n.audioRed&&Array.isArray(g.rtp)&&(-1!==(w=g.rtp.findIndex((function(e){return"red"===e.codec})))&&(C=g.rtp.splice(w,1),O=E(C,1),x=O[0],g.rtp.unshift(x)),D=[],g.rtp.forEach((function(e){return D.push(e.payload)})),g.payloads=D.join(" ")),null!==(a=this._context)&&void 0!==a&&null!==(s=a.serverConfig)&&void 0!==s&&s.videoCodec&&qG(S,null===(N=this._context)||void 0===N||null===(P=N.serverConfig)||void 0===P?void 0:P.videoCodec),(SP||TP)&&Array.isArray(S.ext)&&(S.ext=S.ext.filter((function(e){var t;return!(null!=e&&null!==(t=e.uri)&&void 0!==t&&t.includes("video-orientation"))}))),(M=null==g?void 0:g.rtp.find((function(e){return"opus"===e.codec})))&&g.fmtp&&(U=g.fmtp.find((function(e){return e.payload===M.payload})))&&null!==(L=this._context)&&void 0!==L&&L.audioProfileManager&&(U.config+=this._context.audioProfileManager.getOpusConfigStr()),u||SP||this.addBitrateLimit(S,t.videoEncodeConfig[0].maxKbps),this._mlinesCache[t.stream.id]=[g,S],e.abrupt("return",{partialSdp:jG(this._offerSession,g,S),audioMid:m,videoMid:y,type:"incroffer",semantics:"unified-plan",videoDescriptions:l,subVideoDescriptions:h,audioTransceiverInit:f,videoTransceiverInit:v});case 17:case"end":return e.stop()}}),e,this)}))),function(e){return _.apply(this,arguments)})},{key:"subscribe",value:(v=c(o().mark((function e(t,r){var n,a,s,c,u,d,l,h,f,p,v,_,m,y,g,S,b,E,k,T,I,A,R=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(rX.print("subscribe"),s="incroffer",c="unified-plan",this._aRecvonlyOfferTpl&&this._vRecvonlyOfferTpl){e.next=11;break}return e.next=6,PP(!0);case 6:if(u=e.sent){e.next=9;break}throw new hN(dN.NOT_SUPPORTED,"Get offer Error");case 9:return e.next=11,this.createAVMlineOfferTpl(u);case 11:if(d="",l="",h=!1,f=!1,p=void 0,v=void 0,this._mlinesCache[t.streamId]=[p,v],t.virtual?(d="".concat(this._mid++),h=!0):r.multiChatMode?(d="".concat(this._mid++),l="".concat(this._mid++),f=!0):(h=!0,f=!0,d="".concat(this._mid++),l="".concat(this._mid++)),d&&(p=i(i({},this._aRecvonlyOfferTpl),{},{mid:d})),h&&(this._mlinesCache[t.streamId][0]=p,_={track:"audio",init:{direction:"recvonly"}}),l&&(v=i(i({},this._vRecvonlyOfferTpl),{},{mid:l})),f&&(this._mlinesCache[t.streamId][1]=v,m={track:"video",init:{direction:"recvonly"}}),y=jG(this._offerSession,p,v),g=void 0,r.multiChatMode||t.virtual||!this._aSendonlyAnswerTpl||!this._aSendonlyAnswerTpl){e.next=34;break}return g=UG(this._nextSsrc),this._nextSsrc=g.next,b=i(i(i({},this._aSendonlyAnswerTpl),this._answerIce),{},{mid:d,msid:"".concat(t.streamId," ").concat(t.streamId,"-audio"),ssrcs:VG(t.streamId,"audio",g.audio)}),E=i(i(i({},this._vSendonlyAnswerTpl),this._answerIce),{},{mid:l,msid:"".concat(t.streamId," ").concat(t.streamId,"-video")},FG(t.streamId,g,{flexfec:this._enableSubFlexfec})),k=new Promise((function(e){R._sdpQueue.enqueue({action:Zz.subscribe,streamId:t.streamId,audioMid:d,videoMid:l,audioTransceiverInit:_,videoTransceiverInit:m,signalingAck:{sdp:Jj.write(i(i({},R._answerSession),{},{media:[b,E]})),sequenceId:t.sequenceId?++t.sequenceId:0},stream:t,sdp:y,onSuccess:function(){rX.print("subscribe()","sub success"),e(0)}})})),e.next=33,k;case 33:null===(S=g)||void 0===S||delete S.next;case 34:return(T=null===(n=p)||void 0===n?void 0:n.rtp.find((function(e){return"opus"===e.codec})))&&null!==(a=p)&&void 0!==a&&a.fmtp&&(A=null===(I=p)||void 0===I?void 0:I.fmtp.find((function(e){return e.payload===T.payload})))&&this._context&&(A.config+=";stereo=1;sprop-stereo=1"),e.abrupt("return",{partialSdp:y,audioMid:d,videoMid:l,type:s,semantics:c,audioTransceiverInit:_,videoTransceiverInit:m,allSsrc:g});case 37:case"end":return e.stop()}}),e,this)}))),function(e,t){return v.apply(this,arguments)})},{key:"handleAck",value:(d=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(rX.print("handleAck()","item: %o",t),!t.generatorSsrc){e.next=4;break}return rX.print("already set remote"),e.abrupt("return","");case 4:return e.abrupt("return",this._sdpQueue.enqueue(t));case 5:case"end":return e.stop()}}),e,this)}))),function(e){return d.apply(this,arguments)})},{key:"dequeue",value:(s=c(o().mark((function e(){var r,n,a,s,c,u,d,l,h,f,p,v,_=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._queueBusy=!0,r=this._sdpQueue.dequeue(),rX.print("dequeue()","ret: %o",r),r){e.next=6;break}return this._queueBusy=!1,e.abrupt("return");case 6:if(e.prev=6,n=r.items,a=r.sdpStrategy,s=[],c=[],u=[],a!==Qz.ADD){e.next=15;break}return e.delegateYield(o().mark((function e(){var r,a;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:delete(r=i({},_._answerIce)).candidates,d=!1,l=!1,e.prev=4,f=t(n);case 6:return e.next=8,f.next();case 8:if(!(d=!(p=e.sent).done)){e.next=16;break}if(a=p.value,"break"!==function(){var e=a.audioMid,t=a.videoMid,n=a.action,o=a.audioTransceiverInit,d=a.videoTransceiverInit,l=a.signalingAck,h=a.stream,f=h instanceof Yz;if(a.onSuccess&&u.push(a.onSuccess),f&&(null==l?void 0:l.sequenceId)<h.sequenceId)return"break";var p={},v={},m=Jj.parse(l.sdp);Array.isArray(m.media)&&m.media.sort((function(e,t){var r;return null==e||null===(r=e.type)||void 0===r?void 0:r.localeCompare(null==t?void 0:t.type)})).forEach((function(n){"audio"===(n=i(i({},n),r)).type?(p=n).mid=e:(v=n).mid=t}));var y,g=h.streamId;if(n===Zz.publish&&(g=null===(y=h.stream)||void 0===y?void 0:y.id),!_._mlinesCache[g])return"break";var S=E(_._mlinesCache[g],2),b=S[0],k=S[1];if(o&&b){h.audioTransceiver=_._peerConnection.addTransceiver(o.track,o.init),_.monitor.rtcInvokeStatus(JSON.stringify({audioStreamTrack:jP(o.track)}),0,"chromeHandler.addTrack","",0);var T=_._inactiveMlineIndex.shift();T||(T=_._offerMlines.length),_._offerMlines[T]=i({},b),_._answerMlines[T]=p,nX&&h.initAudioEncodedTransform()}if(d&&k){var I;n===Zz.publish&&wP&&(null==d||null===(I=d.init)||void 0===I||delete I.sendEncodings),h.videoTransceiver=_._peerConnection.addTransceiver(d.track,d.init),_.monitor.rtcInvokeStatus(JSON.stringify({videoStreamTrack:jP(d.track)}),0,"chromeHandler.addTrack","",0);var A=_._inactiveMlineIndex.shift();A||(A=_._offerMlines.length),_._offerMlines[A]=i({},k),_._answerMlines[A]=v,nX&&h.initVideoEncodedTransform()}s.push(h.streamId||""),c.push(f?h.userId:"local"),f&&(h.sequenceId=null==l?void 0:l.sequenceId),delete _._mlinesCache[g]}()){e.next=13;break}return e.abrupt("break",16);case 13:d=!1,e.next=6;break;case 16:e.next=22;break;case 18:e.prev=18,e.t0=e.catch(4),l=!0,h=e.t0;case 22:if(e.prev=22,e.prev=23,!d||null==f.return){e.next=27;break}return e.next=27,f.return();case 27:if(e.prev=27,!l){e.next=30;break}throw h;case 30:return e.finish(27);case 31:return e.finish(22);case 32:case"end":return e.stop()}}),e,null,[[4,18,22,32],[23,,27,31]])}))(),"t0",13);case 13:e.next=20;break;case 15:v={},n.forEach((function(e){var t=e.audioMid,r=e.videoMid,n=e.action;v[t]=t,n!==Zz.removetrack&&(v[r]=r),v[t]=t})),this._offerMlines=this._offerMlines.map((function(e,t){return v[e.mid]&&(e=BG(e),_._inactiveMlineIndex.push(t)),e})),this._inactiveMlineIndex.sort((function(e,t){return e-t})),this._answerMlines=this._answerMlines.map((function(e){return v[e.mid]&&(e=BG(e)),e}));case 20:return e.next=22,this.setDescription(s.length?{streamId:s.join(","),streamUserId:c.join(",")}:void 0);case 22:try{u.forEach((function(e){return e()}))}catch(T0){}rX.print("dequeue","loop"),e.next=29;break;case 26:e.prev=26,e.t1=e.catch(6),rX.print("dequeue","unknown error: %o",e.t1);case 29:return e.prev=29,this.dequeue(),e.finish(29);case 32:case"end":return e.stop()}}),e,this,[[6,26,29,32]])}))),function(){return s.apply(this,arguments)})},{key:"setDescription",value:(a=c(o().mark((function e(t){var r,n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return rX.print("setDescription"),this._offerSession.media=this._offerMlines,this._answerSession.media=this._answerMlines,r=[],this._offerMlines.forEach((function(e){"inactive"!==e.direction&&r.push(e.mid)})),this._offerSession.groups&&this._answerSession.groups&&(this._offerSession.groups[0].mids=r.join(" "),this._answerSession.groups[0].mids=r.join(" ")),n=fP(),t&&MB.rtcBeginCreateOffer("local"===t.streamUserId?lB.UP:lB.DOWN,t.streamId,t.streamUserId),e.next=10,this._peerConnection.createOffer();case 10:return t&&MB.rtcCreateOffer(0,"local"===t.streamUserId?hB.UP:hB.DOWN,t.streamId,t.streamUserId,fP()-n),e.next=13,this.setLocalDescription(Jj.write(this._offerSession),t);case 13:return e.next=15,this.setRemoteDescription(Jj.write(this._answerSession),t);case 15:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"getDefaultSdp",value:(n=c(o().mark((function e(){var t,r,n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,PP(!0);case 2:if(t=e.sent){e.next=5;break}throw new hN(dN.NOT_SUPPORTED,"Get offer Error");case 5:return this.createAVMlineOfferTpl(t),r=Jj.parse(t),n=[],r.media=r.media.filter((function(e){return"recvonly"===e.direction&&(Array.isArray(e.ext)&&(e.ext=e.ext.filter((function(e){return"urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id"!==e.uri}))),n.push(e.mid+""),!0)})),r.groups=[{mids:n.join(" "),type:"BUNDLE"}],e.abrupt("return",{sdp:Jj.write(r),semantics:"unified-plan",type:"incroffer"});case 11:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"rollback",value:(r=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:delete this._mlinesCache[t];case 1:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"createAVMlineOfferTpl",value:function(e){var t=this;Jj.parse(e).media.forEach((function(e){"audio"===e.type?"sendonly"===e.direction?t._aSendonlyOfferTpl=e:(Array.isArray(e.ext)&&(e.ext=e.ext.filter((function(e){return"urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id"!==e.uri}))),t._aRecvonlyOfferTpl=e):"video"===e.type&&("sendonly"===e.direction?t._vSendonlyOfferTpl=e:(Array.isArray(e.ext)&&(e.ext=e.ext.filter((function(e){return"urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id"!==e.uri}))),t._vRecvonlyOfferTpl=e))}))}}]),k}(QG),oX=new JL("FirefoxHandler",3),aX=function(e){f(k,e);var t,r,n,a,s,d,v,_,y,S=g(k);function k(){var e;u(this,k);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return h(m(e=S.call.apply(S,[this].concat(r))),"name","firefox"),h(m(e),"_aRecvonlyOfferTpl",void 0),e}return l(k,[{key:"connect",value:(y=c(o().mark((function e(t){var r,n,a,s,c,u,d,l=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return oX.print("connect","invoke connect"),this._offerIce={iceUfrag:null===(r=t.iceParams)||void 0===r?void 0:r.clientIceUfrag,icePwd:null===(n=t.iceParams)||void 0===n?void 0:n.clientIcePwd,iceOptions:"renomination"},e.next=4,GG(t);case 4:return this._answerIce=e.sent,this._peerConnection.addTransceiver("audio",{direction:"recvonly"}),this._peerConnection.addTransceiver("video",{direction:"recvonly"}),e.next=9,this._peerConnection.createOffer();case 9:return a=e.sent,s=Jj.parse(a.sdp),c=E(s.media,1),u=c[0],this._offerIce.fingerprint=s.fingerprint||u.fingerprint,s.media=s.media.map((function(e){return i(i({},e),l._offerIce)})),s.media.map((function(e){var t,r;"video"===e.type&&(e.ext=null===(t=e.ext)||void 0===t?void 0:t.filter((function(e){return-1===e.uri.indexOf("abs-send-time")})),e.rtcpFb=null===(r=e.rtcpFb)||void 0===r?void 0:r.filter((function(e){return"goog-remb"!==e.type})))})),(d=i({},s)).fingerprint=this._answerIce.fingerprint,d.media=d.media.map((function(e){return delete(e=i(i({},e),l._answerIce)).bundleOnly,e.port=9,"application"===e.type?e.sctpmap={sctpmapNumber:5e3,app:"webrtc-datachannel",maxMessageSize:262144}:("audio"===e.type&&(e.msid="ff-stream ff-stream-audio"),e.direction="sendonly"),e})),e.next=20,this.setLocalDescription(Jj.write(s));case 20:return e.next=22,this.setRemoteDescription(Jj.write(d));case 22:return e.next=24,new Promise((function(e,t){l._dataChannel.onopen=function(){oX.print("connect","dataChannel open"),XB("es.dc.open",""),e("")},l._dataChannel.onerror=function(e){MB.rtcSignalingMsgError(e.error.sdpLineNumber,e.error.errorDetail,uB.INVALID_DATA),XB("es.dc.error",""),t(e)},l._dataChannel.onclose=function(e){XB("es.dc.close",""),t(e)},l._peerConnection.addEventListener("connectionstatechange",(function(e){"failed"!==l._peerConnection.iceConnectionState&&"closed"!==l._peerConnection.iceConnectionState&&"failed"!==l._peerConnection.connectionState||t(e)}))}));case 24:return oX.print("connect","dataChannel establish success"),e.abrupt("return",this._dataChannel);case 26:case"end":return e.stop()}}),e,this)}))),function(e){return y.apply(this,arguments)})},{key:"publish",value:(_=c(o().mark((function e(t){var r,n,a,s,c,u,d,l,h,f,v,_,m,y,g=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=b(p(k.prototype),"internalPublish",this).call(this,t),s=a.videoDescriptions,c=a.subVideoDescriptions,u=a.audioTransceiverInit,d=a.videoTransceiverInit,t.audioTransceiver=this._peerConnection.addTransceiver(u.track,u.init),t.videoTransceiver=this._peerConnection.addTransceiver(d.track,d.init),l=fP(),MB.rtcBeginCreateOffer(lB.UP,"",""),e.next=7,this._peerConnection.createOffer();case 7:return h=e.sent,MB.rtcCreateOffer(0,hB.UP,"","",fP()-l),(f=Jj.parse(h.sdp)).media=null===(r=f.media)||void 0===r?void 0:r.map((function(e){return i(i({},e),g._offerIce)})),e.next=13,this.setLocalDescription(Jj.write(f));case 13:return v=t.audioTransceiver.mid,_=t.videoTransceiver.mid,m=null,y=null,f.media=null===(n=f.media)||void 0===n?void 0:n.map((function(e){if("".concat(e.mid)===v){var t,r=null===(t=m=e)||void 0===t?void 0:t.rtp.find((function(e){return"opus"===e.codec}));if(r&&m.fmtp){var n,i=m.fmtp.find((function(e){return e.payload===r.payload}));i&&null!==(n=g._context)&&void 0!==n&&n.audioProfileManager&&(i.config+=g._context.audioProfileManager.getOpusConfigStr())}}else if("".concat(e.mid)===_){var o,a,s,c;null!==(o=g._context)&&void 0!==o&&null!==(a=o.serverConfig)&&void 0!==a&&a.videoCodec&&qG(e,null===(s=g._context)||void 0===s||null===(c=s.serverConfig)||void 0===c?void 0:c.videoCodec),y=e}return e})),this.addBitrateLimit(y,t.videoEncodeConfig[0].maxKbps),e.next=21,this.setLocalDescription(Jj.write(f));case 21:return e.abrupt("return",{partialSdp:jG(f,m,y),audioMid:v,videoMid:_,type:"incroffer",semantics:"unified-plan",videoDescriptions:s,subVideoDescriptions:c,audioTransceiverInit:u,videoTransceiverInit:d});case 22:case"end":return e.stop()}}),e,this)}))),function(e){return _.apply(this,arguments)})},{key:"subscribe",value:(v=c(o().mark((function e(t,r){var n,a,s,c,u,d,l,h,f,p,v,_,m,y,g,S,b,E=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return oX.print("subscribe()"),u="",d="",l=!1,h=!1,f=void 0,p=void 0,t.virtual?l=!0:(r.multiChatMode||(l=!0),h=!0),l&&(t.audioTransceiver=this._peerConnection.addTransceiver("audio",{direction:"recvonly"})),h&&(t.videoTransceiver=this._peerConnection.addTransceiver("video",{direction:"recvonly"})),v=fP(),MB.rtcBeginCreateOffer(lB.UP,t.streamId,t.userId),e.next=14,this._peerConnection.createOffer();case 14:return _=e.sent,MB.rtcCreateOffer(0,hB.UP,t.streamId,t.userId,fP()-v),(m=Jj.parse(_.sdp)).media=null===(n=m.media)||void 0===n?void 0:n.map((function(e){return i(i({},e),E._offerIce)})),m.media.map((function(e){var t,r;"video"===e.type&&(e.ext=null===(t=e.ext)||void 0===t?void 0:t.filter((function(e){return-1===e.uri.indexOf("abs-send-time")})),e.rtcpFb=null===(r=e.rtcpFb)||void 0===r?void 0:r.filter((function(e){return"goog-remb"!==e.type})))})),e.next=21,this.setLocalDescription(Jj.write(m),{streamId:t.streamId||"",streamUserId:t.userId});case 21:if(u=null===(a=t.audioTransceiver)||void 0===a?void 0:a.mid,d=null===(s=t.videoTransceiver)||void 0===s?void 0:s.mid,null===(c=m.media)||void 0===c||c.forEach((function(e){"".concat(e.mid)===u?f=e:"".concat(e.mid)===d&&(p=e)})),u&&f||(u="audio_".concat(d),f=i(i({},this._aRecvonlyOfferTpl),{},{mid:u})),t.audioMid=u,t.videoMid=d,y=void 0,r.multiChatMode||t.virtual||!this._aSendonlyAnswerTpl||!this._aSendonlyAnswerTpl){e.next=36;break}return y=UG(this._nextSsrc),this._nextSsrc=y.next,S=i(i(i({},this._aSendonlyAnswerTpl),this._answerIce),{},{mid:u,msid:"".concat(t.streamId," ").concat(t.streamId,"-audio"),ssrcs:VG(t.streamId,"audio",y.audio)}),b=i(i(i({},this._vSendonlyAnswerTpl),this._answerIce),{},{mid:d,msid:"".concat(t.streamId," ").concat(t.streamId,"-video")},FG(t.streamId,y,{flexfec:this._enableSubFlexfec})),e.next=35,this._internalSetRemoteDescription([S,b],t);case 35:null===(g=y)||void 0===g||delete g.next;case 36:return e.abrupt("return",{partialSdp:jG(m,f,p),audioMid:u,videoMid:d,type:"incroffer",semantics:"unified-plan",audioTransceiverInit:t.audioTransceiver?{track:"audio",init:{direction:"recvonly"}}:void 0,videoTransceiverInit:t.videoTransceiver?{track:"video",init:{direction:"recvonly"}}:void 0,allSsrc:y});case 37:case"end":return e.stop()}}),e,this)}))),function(e,t){return v.apply(this,arguments)})},{key:"handleAck",value:(d=c(o().mark((function e(t){var r,n,i,a;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.signalingAck,n=t.stream,(i=t.action)!==Zz.unpublish&&i!==Zz.unsubscribe&&i!==Zz.removetrack){e.next=5;break}return e.next=4,this.close(n);case 4:return e.abrupt("return",n.streamId||"");case 5:if(!t.generatorSsrc){e.next=8;break}return oX.print("already set remote"),e.abrupt("return","");case 8:return a=Jj.parse(null==r?void 0:r.sdp),e.next=11,this._internalSetRemoteDescription(a.media,n);case 11:return e.abrupt("return","");case 12:case"end":return e.stop()}}),e,this)}))),function(e){return d.apply(this,arguments)})},{key:"_internalSetRemoteDescription",value:(s=c(o().mark((function e(t,r){var n,a,s,c,u,d,l=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s={},(c=Jj.parse(null===(n=this._peerConnection.remoteDescription)||void 0===n?void 0:n.sdp)).media.forEach((function(e){void 0!==e.mid&&(s[e.mid]=e)})),t.forEach((function(e){"audio"===(e=i(i({},e),l._answerIce)).type&&(r.audioMid?(e.mid=r.audioMid,s[r.audioMid]=e):s[e.mid]=e),"video"===e.type&&(r.videoMid?(e.mid=r.videoMid,s[r.videoMid]=e):s[e.mid]=e)})),u=Jj.parse(null===(a=this._peerConnection.localDescription)||void 0===a?void 0:a.sdp),d=u.media.map((function(e){var t=s[e.mid];return"inactive"===e.direction?e:t})),c.groups=u.groups,c.media=d,c.media.map((function(e){var t,r;"video"===e.type&&(e.ext=null===(t=e.ext)||void 0===t?void 0:t.filter((function(e){return-1===e.uri.indexOf("abs-send-time")})),e.rtcpFb=null===(r=e.rtcpFb)||void 0===r?void 0:r.filter((function(e){return"goog-remb"!==e.type})))})),e.next=11,this.setRemoteDescription(Jj.write(c));case 11:case"end":return e.stop()}}),e,this)}))),function(e,t){return s.apply(this,arguments)})},{key:"getDefaultSdp",value:(a=c(o().mark((function e(){var t,r,n,i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=Jj.parse(null===(t=this._peerConnection.localDescription)||void 0===t?void 0:t.sdp),this.createAVMlineOfferTpl(null===(r=this._peerConnection.localDescription)||void 0===r?void 0:r.sdp),i=[],n.media=n.media.filter((function(e){return"recvonly"===e.direction&&(e.mid=e.mid+1,i.push(e.mid+""),!0)})),n.groups=[{mids:i.join(" "),type:"BUNDLE"}],e.abrupt("return",{sdp:Jj.write(n),semantics:"unified-plan",type:"incroffer"});case 6:case"end":return e.stop()}}),e,this)}))),function(){return a.apply(this,arguments)})},{key:"rollback",value:(n=c(o().mark((function e(t,r,n){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return oX.print("rollback()"),e.abrupt("return",this.close(r));case 2:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return n.apply(this,arguments)})},{key:"close",value:(r=c(o().mark((function e(t,r){var n,a,s,c,u,d,l,h=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return oX.print("close()"),a={},t.audioTransceiver&&t.audioMid&&(t.audioTransceiver.stop(),a[t.audioMid]=t.audioMid),t.videoTransceiver&&t.videoMid&&!r&&(t.videoTransceiver.stop(),a[t.videoMid]=t.videoMid),s=[],e.next=7,this._peerConnection.createOffer();case 7:return c=e.sent,(u=Jj.parse(null==c?void 0:c.sdp)).media=u.media.map((function(e){return a[e.mid]&&(e=BG(e)),"inactive"!==e.direction&&s.push(e.mid),i(i({},e),h._offerIce)})),d=Jj.parse(null===(n=this._peerConnection.remoteDescription)||void 0===n?void 0:n.sdp),l={},d.media.forEach((function(e){void 0!==e.mid&&(l[e.mid]=e)})),d.media=u.media.map((function(e){return"inactive"===e.direction?e:l[e.mid]})),u.groups&&d.groups&&(u.groups[0].mids=s.join(" "),d.groups[0].mids=s.join(" ")),e.next=17,this.setLocalDescription(Jj.write(u));case 17:return e.next=19,this.setRemoteDescription(Jj.write(d));case 19:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"setCurrentDescription",value:(t=c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._peerConnection.createOffer();case 2:if(!this._peerConnection.localDescription||!this._peerConnection.remoteDescription){e.next=7;break}return e.next=5,this._peerConnection.setLocalDescription(this._peerConnection.localDescription);case 5:return e.next=7,this._peerConnection.setRemoteDescription(this._peerConnection.remoteDescription);case 7:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"createAVMlineOfferTpl",value:function(e){var t=this;Jj.parse(e).media.forEach((function(e){"audio"===e.type&&(t._aRecvonlyOfferTpl=e)}))}}]),k}(QG),sX=function(e,t){return gP?new aX(e,t):new iX(e,t)},cX=new JL("Locker",2),uX=1,dX=function(){function e(t){u(this,e),h(this,"lockingPromise",Promise.resolve()),h(this,"locks",0),h(this,"name",""),h(this,"lockId",void 0),this.lockId=uX++,t&&(this.name=t),cX.print("[lock-".concat(this.name,"-").concat(this.lockId,"] is created."))}return l(e,[{key:"isLocked",get:function(){return this.locks>0}},{key:"lock",value:function(){var e,t=this;this.locks+=1,cX.print("[lock-".concat(this.name,"-").concat(this.lockId,"] locked, current queue ").concat(this.locks,"."));var r=new Promise((function(r){e=function(){t.locks-=1,cX.print("[lock-".concat(t.name,"-").concat(t.lockId,"] unlocked, current queue ").concat(t.locks,".")),r()}})),n=this.lockingPromise.then((function(){return e}));return this.lockingPromise=this.lockingPromise.then((function(){return r})),n}}]),e}(),lX=(h(jz={},Y.communication,[0]),h(jz,Y.chat,[0]),h(jz,Y.chatRoom,[1,"IES_chatroom"]),h(jz,Y.coHost,[1,"IES_PK"]),h(jz,Y.meeting,[16]),h(jz,Y.classRoom,[0]),jz),hX=Object.defineProperty,fX=Object.getOwnPropertyDescriptor,pX=function(e,t,r,n){for(var i,o=n>1?void 0:n?fX(t,r):t,a=e.length-1;a>=0;a--)(i=e[a])&&(o=(n?i(t,r,o):i(o))||o);return n&&o&&hX(t,r,o),o},vX=new JL("MediaServerClient",2),_X=6e4,mX=function(e){return e.DISCONNECTED="disconnected",e.DISCONNECTING="disconnecting",e.CONNECTED="connected",e.CONNECTING="connecting",e}(mX||{}),yX=function(e,t){vX.print(e,"userId: %o, subAudio: %o, subVideo: %o, audioMid: %o, videoMid: %o, sequenceId: %o",t.userId,t.subAudio,t.subVideo,t.audioMid,t.videoMid,t.sequenceId)},gX=function(e){f(D,e);var t,r,n,a,s,d,p,v,_,y,S,b,k,T,I,A,R,w,C,O,x=g(D);function D(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:MB;return u(this,D),h(m(t=x.call(this)),"_token",void 0),h(m(t),"_appId",void 0),h(m(t),"_roomId",void 0),h(m(t),"_roomAttributes",void 0),h(m(t),"_clientId",void 0),h(m(t),"_businessId",void 0),h(m(t),"_userInfo",void 0),h(m(t),"_useCloudProxy",void 0),h(m(t),"_expectedIDC",void 0),h(m(t),"_authorization",void 0),h(m(t),"_sessionId",void 0),h(m(t),"_iceConfigRequestManager",void 0),h(m(t),"_ontrackCallbackMap",new Map),h(m(t),"_subResolves",{}),h(m(t),"supportConcurrent",!1),h(m(t),"_handler",void 0),h(m(t),"_pubSubLock",void 0),h(m(t),"_joinLeaveLock",void 0),h(m(t),"_state",void 0),h(m(t),"_dataChannelSignal",void 0),h(m(t),"_subConfig",{}),h(m(t),"monitor",void 0),h(m(t),"_roomProfile",Y.communication),h(m(t),"_context",void 0),h(m(t),"_subStreamQueue",{}),t.monitor=r,t._pubSubLock=new dX("pubSubLock"),t._joinLeaveLock=new dX("joinLeaveLock"),t._state="disconnected",t._roomAttributes={multiChatMode:!1,bigRoomMode:!1},t._context=e,t.on("SUB_END",(function(e){return t._handleSubStreamQueue(e)})),t}return l(D,[{key:"_addHandlerEvents",value:function(){var e,t=this;null===(e=this._handler)||void 0===e||e.once("disconnect",(function(){vX.print("emit ABNORMAL_DISCONNECTION ice"),t.safeEmit(_j.ABNORMAL_DISCONNECTION)}))}},{key:"_addSignalEventHandler",value:function(){var e,t=this;[pj.ON_ADD_STREAM,pj.ON_ADD_STREAM_LIST,pj.ON_REMOVE_STREAM,pj.ON_REMOVE_STREAM_LIST,pj.USER_CONNECTION,pj.USER_CONNECTION_LIST,pj.USER_DISCONNECTION,pj.USER_DISCONNECTION_LIST,pj.ON_UPDATE_STREAM_ATTRIBUTES,pj.ON_UPDATE_ROOM_ATTRIBUTES,pj.ON_PUSH_TRACK,pj.NODE_CHANGE,pj.ON_CUSTOM_MESSAGE,pj.USER_MESSAGE_RECEIVED,pj.USER_BINARY_MESSAGE_RECEIVED,pj.POST_PROCESSING_MESSAGE,pj.ON_USER_TOKEN_WILL_EXPIRE,pj.STREAM_CONTROL_MESSAGE,pj.ON_SCENE_CONFIG,pj.ON_UPDATE_USER_ATTRIBUTES,pj.ON_SPEAKER_CHANGE,vj.RSCP,vj.RTT,pj.ON_STREAM_FAILED].forEach((function(e){var r;null===(r=t._dataChannelSignal)||void 0===r||r.on(e,(function(r){t.safeEmit(e,r)}))})),null===(e=this._dataChannelSignal)||void 0===e||e.once("close",(function(){vX.print("emit ABNORMAL_DISCONNECTION datachannel"),t.safeEmit(_j.ABNORMAL_DISCONNECTION)}))}},{key:"_removeSignalEventHandler",value:function(){var e,t;null===(e=this._dataChannelSignal)||void 0===e||e.removeAllListeners(),null===(t=this._handler)||void 0===t||t.removeAllListeners()}},{key:"connectionState",get:function(){return this._state},set:function(e){this._state!==e&&(this.safeEmit(_j.ON_CONNECTION_STATE_CHANGE,{prev:this._state,next:e}),this._state=e)}},{key:"connect",value:(O=c(o().mark((function e(t){var r,n,i,a,s,c,u,d,l=this,h=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=h.length>1&&void 0!==h[1]?h[1]:"",n=h.length>2&&void 0!==h[2]?h[2]:"",i=h.length>3&&void 0!==h[3]?h[3]:{},this.connectionState="connecting",this._appId=t,this._handler&&(this._removeSignalEventHandler(),this._handler.destroy()),!i.node){e.next=11;break}a=[i.node],XB("es.join.nodeChange",i),e.next=20;break;case 11:return Promise.resolve().then((function(){return l.emit("onGetIceConfigHook")})),this._iceConfigRequestManager=new xj,e.next=15,null===(s=this._iceConfigRequestManager)||void 0===s?void 0:s.getAccessNode(t,r,n,ej.getDeviceId(),null==i?void 0:i.reason,null==i?void 0:i.feedbackNode,this._useCloudProxy,this._expectedIDC);case 15:if(a=e.sent){e.next=19;break}throw XB("es.join.getNodeFailed",""),new hN(dN.ICE_SERVER_WRONG,"get ICE config failed");case 19:XB("es.join.getNodeSuccess",a);case 20:return Promise.resolve().then((function(){return l.emit("onEstablishConnectionHook")})),e.prev=21,u=!1,d=a.map((function(e){var t=sX(l.monitor,l._context);return t.connect(e).then((function(r){u?t.destroy():(u=!0,c=r,l.safeEmit("prevIceNode",e),l._handler=t,l.supportConcurrent="chrome"===t.name,l._addHandlerEvents())})).catch((function(){t.destroy()}))})),e.next=26,MP(d);case 26:vX.print("join","establish peerConnection success"),e.next=33;break;case 29:throw e.prev=29,e.t0=e.catch(21),this.connectionState="disconnected",new hN(dN.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed",e.t0);case 33:if(!c){e.next=39;break}this._dataChannelSignal=new wj(c),this._addSignalEventHandler(),this._dataChannelSignal.sendPingSignaling(),e.next=41;break;case 39:throw this.connectionState="disconnected",new hN(dN.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed");case 41:case"end":return e.stop()}}),e,this,[[21,29]])}))),function(e){return O.apply(this,arguments)})},{key:"join",value:(C=c(o().mark((function e(t){var r,n,i,a,s,c,u,d,l,h,f,p,v,_,m,y,g,S,b,E,k,T,I,A,R=this,w=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=w.length>1&&void 0!==w[1]?w[1]:{},i=w.length>2&&void 0!==w[2]&&w[2],a=w.length>3?w[3]:void 0,vX.print("join()","info: %o, params: %o, reconnect: %o, controlMessage: %o",t,n,i,a),this._appId=t.appId,this._token=t.token,this._roomId=t.roomId,this._clientId=t.userInfo.userId,this._businessId=t.userInfo.businessId,this._userInfo=t.userInfo,this._useCloudProxy=t.useCloudProxy,this._expectedIDC=t.expectedIDC,this._roomProfile=t.roomProfile,this._sessionId=n.sessionId,e.next=16,this.connect(this._appId,this._roomId,this._clientId,n);case 16:return e.t0=_P.token2auth(this._appId,this._roomId,this._clientId,this._token),e.t1=this._sessionId||"",e.t2=Date.now(),e.t3=a,e.t4={extra_info:this._userInfo.extraInfo,role:this._userInfo.role},e.next=23,null===(r=this._handler)||void 0===r?void 0:r.getDefaultSdp();case 23:return e.t5=e.sent,e.next=26,qj();case 26:return e.t6=e.sent,e.t7=window.navigator.userAgent,e.t8=oj.VERSION,e.t9=ej.getDeviceId(),e.t10=this._appId,e.t11=this._roomId,e.t12=this._clientId,e.t13=this._businessId,e.t14=this._useCloudProxy,e.t15=lX[this._roomProfile]?lX[this._roomProfile][0]+"":"0",e.t16={supportedCodecs:e.t6,deviceType:"web",userAgent:e.t7,sdkVersion:e.t8,deviceId:e.t9,appId:e.t10,roomId:e.t11,userId:e.t12,businessId:e.t13,enableCloudProxy:e.t14,channelProfile:e.t15},e.t17={supportTokenExpireCallBack:!0,enableSceneConfigV2:!0,enableUnBundleMode:!0,enableAudioMux:!0,enableBigRoomMode:!0,needNegotiateSDP:!0},s={Authorization:e.t0,sessionId:e.t1,timestamp:e.t2,controlMessage:e.t3,userAttributes:e.t4,sdpInfo:e.t5,params:e.t16,options:e.t17},Promise.resolve().then((function(){return R.emit("onSendingJoinMessageHook")})),e.prev=40,_=i?"reconnected":"joinRoom",e.next=44,this._dataChannelSignal.sendSignaling(_,s);case 44:return m=e.sent,vX.print("join","send join message success"),this._authorization=s.Authorization,this.connectionState="connected",this._context&&(this._context.serverConfig={videoCodec:(null===(y=m.config)||void 0===y||null===(g=y.engine_WEB)||void 0===g?void 0:g.video_codec)||"H264",audioRed:!(null===(S=m.config)||void 0===S||null===(b=S.engine_WEB)||void 0===b||!b.pub_audio_red),muteReplaceUnsub:!(null===(E=m.config)||void 0===E||!E.mute_replace_unsub),simulcastOnDemand:!(!1===(null===(k=m.config)||void 0===k||null===(T=k.engine_VPM)||void 0===T||null===(I=T.ondemand)||void 0===I?void 0:I.enable))}),Vz.audioStallConfig=null===(c=m.config)||void 0===c?void 0:c.engine_WEB,null===(u=this._context)||void 0===u||null===(d=u.audioProfileManager)||void 0===d||d.updateEngineBAC(null===(l=m.config)||void 0===l?void 0:l.engine_BAC),null===(h=this._context)||void 0===h||null===(f=h.audioProfileManager)||void 0===f||f.updateEngineANM(null===(p=m.config)||void 0===p?void 0:p.engine_ANM),null!=m&&null!==(v=m.relayMessage)&&void 0!==v&&v.sdp&&(null===(A=this._handler)||void 0===A||A.createAVMlineAnswerTpl(m.relayMessage.sdp)),e.abrupt("return",m);case 56:if(e.prev=56,e.t18=e.catch(40),this.connectionState="disconnected",!((null===e.t18||void 0===e.t18?void 0:e.t18.code)>=700&&(null===e.t18||void 0===e.t18?void 0:e.t18.code)<800)){e.next=61;break}throw new hN(dN.INVALID_TOKEN,(null===e.t18||void 0===e.t18?void 0:e.t18.message)||"Invalid token");case 61:if(200===(null===e.t18||void 0===e.t18?void 0:e.t18.code)){e.next=63;break}throw new hN(dN.JOIN_ROOM_FAILED,(null===e.t18||void 0===e.t18?void 0:e.t18.message)||"Join room failed");case 63:case"end":return e.stop()}}),e,this,[[40,56]])}))),function(e){return C.apply(this,arguments)})},{key:"publish",value:(w=c(o().mark((function e(t){var r,n,a,s,c,u,d,l,h,f,p,v,_,m,y,g,S,b=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return vX.print("publish()","localStream: %o",t),r=t.videoTrack,n=t.audioTrack,a=fP(),s="",c="",e.prev=6,e.next=9,null===(u=this._handler)||void 0===u?void 0:u.publish(t);case 9:if(_=e.sent){e.next=12;break}throw new hN(dN.ADD_TRANSCEIVER_FAILED,"add transceiver failed");case 12:return s=_.audioMid,c=_.videoMid,t.pubAttributes={localaudio:!!n,localvideo:!!r,videostream:t.pubVideo,audiostream:t.pubAudio,extvideo:!!(r instanceof ez),extaudio:!!(n instanceof tz)},m={attributes:i({videoDescriptions:_.videoDescriptions},t.pubAttributes),audio:!0,video:!0,screen:t.isScreen,audioMid:s,videoMid:c,sdpInfo:{msid:t.stream.id,type:_.type,sdp:_.partialSdp,semantics:_.semantics}},t.enableSimulcast&&null!==(d=this._context)&&void 0!==d&&null!==(l=d.serverConfig)&&void 0!==l&&l.simulcastOnDemand&&null!==(h=_.subVideoDescriptions)&&void 0!==h&&h.length&&(m.attributes.subVideoDescriptions=_.subVideoDescriptions),e.next=19,null===(f=this._dataChannelSignal)||void 0===f?void 0:f.sendSignaling("publish",m);case 19:if(200===(null==(y=e.sent)?void 0:y.code)){e.next=22;break}throw new hN(dN.PUBLISH_FAILED,(null==y?void 0:y.message)||"publish failed");case 22:if(MB.rtcRecvAnswer(0,vB.INCRANSWER,(null==y||null===(p=y.relayMessage)||void 0===p?void 0:p.sequenceId)||0,null==y||null===(v=y.relayMessage)||void 0===v?void 0:v.sdp,_B.UP,"",""),g=new Promise((function(e,r){var n,i,o;null===(n=b._handler)||void 0===n||n.handleAck({action:Zz.publish,streamId:y.streamId,audioMid:s,videoMid:c,audioTransceiverInit:null==_?void 0:_.audioTransceiverInit,videoTransceiverInit:null==_?void 0:_.videoTransceiverInit,signalingAck:{sdp:null==y||null===(i=y.relayMessage)||void 0===i?void 0:i.sdp,sequenceId:null==y||null===(o=y.relayMessage)||void 0===o?void 0:o.sequenceId},sdp:_.sdp,stream:t,onSuccess:function(){vX.print("publish()","publish success"),e(0)}})})),e.t0=!gP,!e.t0){e.next=28;break}return e.next=28,g;case 28:return t.streamId=y.streamId,t.videoMid=c,t.audioMid=s,t.subVideoDescriptions=_.subVideoDescriptions,this.monitor.rtcPublishStat(mB.SUCCESS,yB.W_0,a,gB.UNKNOWN),t.statsReport.setLocalStreamStatsEvtInterval(this,this._handler,this.monitor),e.abrupt("return");case 37:return e.prev=37,e.t1=e.catch(6),e.t1 instanceof Error&&this.monitor.rtcPublishStat(mB.FAIL,yB.W_0,a,e.t1.message),e.next=42,null===(S=this._handler)||void 0===S?void 0:S.rollback(t.stream.id,t);case 42:throw e.t1;case 43:case"end":return e.stop()}}),e,this,[[6,37]])}))),function(e){return w.apply(this,arguments)})},{key:"updatePubTrack",value:(R=c(o().mark((function e(t){var r,n,i,a,s,c,u,d,l,h,f,p,v,_,m,y,g,S,b,k,T,I,A,R,w,C,O,x,D,N,P,M;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:vX.print("updatePubTrack()","localStream: %o",t),i=t.videoTrack,a=t.audioTrack,s=t.pubAudio,c=t.pubVideo,u=null==a?void 0:a.getTrack("preprocessing"),d=null==i?void 0:i.getTrack("preprocessing"),c&&d?null===(l=t.videoTransceiver)||void 0===l||l.sender.replaceTrack(d):null===(h=t.videoTransceiver)||void 0===h||h.sender.replaceTrack(null),wP||null===(f=this._handler)||void 0===f||f.updateScaleResolutionDownBy(t),null===(r=this._handler)||void 0===r||r.updateMaxBitrate(t),s&&u?(v=a.mixType,(_=a.mixedAudioTrack)&&v!==re.PLAYOUT&&!0===u.enabled&&(u=_),null===(p=t.audioTransceiver)||void 0===p||p.sender.replaceTrack(u)):(null===(m=t.audioTransceiver)||void 0===m||m.sender.replaceTrack(null),this.monitor.rtcInvokeStatus("null",0,"MediaClient.updatePubTrack(audio)","",0));try{this.monitor.rtcInvokeStatus(JSON.stringify({audioStreamTrack:jP(u),videoStreamTrack:jP(d)}),0,"MediaClient.updatePubTrack","",0)}catch(T0){}for(y={localaudio:!!a,localvideo:!!i,videostream:c,audiostream:s,extvideo:!!(i instanceof ez),extaudio:!!(a instanceof tz)},g={},S=0,b=Object.entries(y);S<b.length;S++)k=E(b[S],2),T=k[0],(I=k[1])!==Reflect.get(t.pubAttributes,T)&&Reflect.set(g,T,I);if(Object.keys(g).length){e.next=14;break}return e.abrupt("return");case 14:return t.observer&&(A=t.observer,R=g.audiostream,w=g.videostream,C=g.localaudio,O=g.localvideo,x=g.extaudio,D=g.extvideo,void 0!==O?void 0!==D?A.setPushVideo(D):A.setEnableVideo(O):void 0!==w&&A.setUnmuteVideo(w),void 0!==C?void 0!==x?A.setPushAudio(x):A.setEnableAudio(C):void 0!==R&&A.setUnmuteAudio(R)),t.pubAttributes=y,N={roomId:this._roomId,streamId:t.streamId,attributes:g},e.next=19,null===(n=this._dataChannelSignal)||void 0===n?void 0:n.sendSignaling("updateStreamAttributes",N);case 19:if(200===(null==(P=e.sent)?void 0:P.code)){e.next=22;break}throw new hN(dN.UPDATE_TRACK_FAILED,(null==P?void 0:P.message)||"update track failed");case 22:if(!gP){e.next=25;break}return e.next=25,null===(M=this._handler)||void 0===M?void 0:M.setCurrentDescription();case 25:case"end":return e.stop()}}),e,this)}))),function(e){return R.apply(this,arguments)})},{key:"updateToken",value:(A=c(o().mark((function e(t){var r,n,i,a,s;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(vX.print("updateToken()","newToken: %o",t),this._token=t,this._appId&&null!==(r=this._userInfo)&&void 0!==r&&r.userId&&this._roomId){e.next=4;break}return e.abrupt("return");case 4:return i={roomId:this._roomId,userId:null===(n=this._userInfo)||void 0===n?void 0:n.userId,appId:this._appId,token:"Bearer ".concat(t)},e.prev=5,e.next=8,null===(a=this._dataChannelSignal)||void 0===a?void 0:a.sendSignaling("updateToken",i);case 8:if(200===(null==(s=e.sent)?void 0:s.code)){e.next=11;break}throw new hN(dN.UPDATE_TOKEN_WITH_INVALID_TOKEN,"invoke updateToken with an invalid token");case 11:e.next=16;break;case 13:throw e.prev=13,e.t0=e.catch(5),new hN(dN.UPDATE_TOKEN_WITH_INVALID_TOKEN,"invoke updateToken with an invalid token");case 16:case"end":return e.stop()}}),e,this,[[5,13]])}))),function(e){return A.apply(this,arguments)})},{key:"unpublish",value:(I=c(o().mark((function e(t){var r,n,i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return vX.print("unpublish()","localStream: %o",t),i={roomId:this._roomId,initStreamId:t.initStreamId,streamId:t.streamId},null===(r=this._dataChannelSignal)||void 0===r||r.sendSignaling("unpublish",i),e.next=5,null===(n=this._handler)||void 0===n?void 0:n.handleAck({action:Zz.unpublish,audioMid:t.audioMid,videoMid:t.videoMid,stream:t,streamId:t.streamId});case 5:t.statsReport.unpublish();case 6:case"end":return e.stop()}}),e,this)}))),function(e){return I.apply(this,arguments)})},{key:"subscribe",value:(T=c(o().mark((function e(t,r,n){var i=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise(function(){var e=c(o().mark((function e(a,s){var c,u,d,l,f,p,v,_,m,y,g,S,b,E,k,T,I,A,R,w,C,O,x,D,N,P,M;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.streamState!==qz.SUB_ED){e.next=2;break}return e.abrupt("return",i._updateSubTrack(t,r,Xz.SUB).then(a,s));case 2:if(t.streamState!==qz.SUB_ING){e.next=7;break}return i._subStreamQueue[t.streamId]||(i._subStreamQueue[t.streamId]=[]),vX.print("_subStreamQueue","streamId: %o, enqueue",t.streamId),i._subStreamQueue[t.streamId].push({fn:i.subscribe,args:[t,r,n],resolve:a,reject:s}),e.abrupt("return");case 7:if(vX.print("subscribe()","mediaType: %o",r),yX("subscribe()",t),t.streamState=qz.SUB_ING,u=!1,d=!1,UP(r)&&(d=!0),VP(r)&&(u=!0),u||!i.multiChatMode()){e.next=17;break}return t.streamState=qz.INIT,i.emit("SUB_END",t.streamId),e.abrupt("return",a(null));case 17:return l=fP(),f=t.subVideo,p=[],v=!i.multiChatMode(),i._subResolves[t.streamId]||(i._subResolves[t.streamId]=[]),p.push(new Promise((function(e,r){i._subResolves[t.streamId].push(e);var n=setTimeout((function(){return r(new hN(dN.TIME_OUT,"wait video timeout for userId: ".concat(t.userId)))}),_X);t.on("ontrack",(function r(i){"video"===i.mediaType&&(vX.print("remoteStream ".concat(t.userId," received video track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),v&&p.push(new Promise((function(e,r){i._subResolves[t.streamId].push(e);var n=setTimeout((function(){return r(new hN(dN.TIME_OUT,"wait audio timeout for userId: ".concat(t.userId)))}),_X);t.on("ontrack",(function r(i){"audio"===i.mediaType&&(vX.print("remoteStream ".concat(t.userId," received audio track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),_=function(e){t.ontrack(e)},null===(c=i._handler)||void 0===c||c.on("ontrack",_),i._ontrackCallbackMap.set(t,_),e.prev=27,e.next=30,null===(m=i._handler)||void 0===m?void 0:m.subscribe(t,{multiChatMode:i.multiChatMode()});case 30:if(I=e.sent){e.next=33;break}throw new hN(dN.ADD_TRANSCEIVER_FAILED,"add transceiver failed");case 33:return A=I.audioMid,R=I.videoMid,t.subVideo=u,w={spatialLayer:(null==n?void 0:n.spatialLayer)||0,temporalLayer:0,spatialSubLayer:(null==n?void 0:n.spatialSubLayer)||-1},C={audio:!i.multiChatMode(),video:!0,data:!0,screen:t.isScreen,browser:"chrome-stable",videoMid:R,audioMid:A,sdpInfo:{sdp:null==I?void 0:I.partialSdp,semantics:null==I?void 0:I.semantics,type:null==I?void 0:I.type},streamUserId:t.userId,streamId:t.streamId,config:{enableMediaType:{audio:!!i.multiChatMode()||d,video:u},qualityLayer:w},extra:{enableSendRTT:!0}},null!=I&&I.allSsrc&&(C.extra.subscribeSSRC=I.allSsrc),e.next=41,null===(y=i._dataChannelSignal)||void 0===y?void 0:y.sendSignaling("subscribe",C);case 41:if(200===(null==(O=e.sent)?void 0:O.code)){e.next=44;break}throw new hN(dN.SUBSCRIBE_FAILED,(null==O?void 0:O.message)||"subscribe failed");case 44:return x=null==O?void 0:O.relayMessage,D=x.audioMid,N=x.videoMid,h(g={},A,D),h(g,R,N),P=g,vX.print("sub midmap",t.userId,P),t.videoMid=R,t.audioMid=A,t.subMediaType=r,t.streamState=qz.SUB_ED,t.subLayer=w,MB.rtcRecvAnswer(0,vB.INCRANSWER,(null==O||null===(S=O.relayMessage)||void 0===S?void 0:S.sequenceId)||0,null==O||null===(b=O.relayMessage)||void 0===b?void 0:b.sdp,_B.DOWN,t.streamId,t.userId),e.next=55,null===(E=i._handler)||void 0===E?void 0:E.handleAck({action:Zz.subscribe,streamId:t.streamId,audioMid:A,videoMid:R,audioTransceiverInit:null==I?void 0:I.audioTransceiverInit,videoTransceiverInit:null==I?void 0:I.videoTransceiverInit,signalingAck:{sdp:null==O||null===(k=O.relayMessage)||void 0===k?void 0:k.sdp,sequenceId:null==O||null===(T=O.relayMessage)||void 0===T?void 0:T.sequenceId},stream:t,sdp:I.sdp,generatorSsrc:!!I.allSsrc});case 55:return e.next=57,Promise.all(p);case 57:i.multiChatMode()||(t.subAudio=d),i.monitor.rtcSubscribeStat(SB.SUCCESS,l,bB.UNKNOWN,t.userId),i._context&&t.statsReport.setRemoteStreamStatsEvtInterval(i,i._handler,i.monitor,i._context),a(null),i.emit("SUB_END",t.streamId),e.next=73;break;case 64:return e.prev=64,e.t0=e.catch(27),e.t0 instanceof Error&&i.monitor.rtcSubscribeStat(SB.FAIL,l,e.t0.message,t.userId),t.subVideo=f,t.streamState=qz.INIT,e.next=71,null===(M=i._handler)||void 0===M?void 0:M.rollback(t.streamId,t);case 71:s(e.t0),i.emit("SUB_END",t.streamId);case 73:case"end":return e.stop()}}),e,null,[[27,64]])})));return function(t,r){return e.apply(this,arguments)}}()));case 1:case"end":return e.stop()}}),e)}))),function(e,t,r){return T.apply(this,arguments)})},{key:"_handleSubStreamQueue",value:function(e){var t,r=this;if(null!==(t=this._subStreamQueue[e])&&void 0!==t&&t.length){vX.print("_subStreamQueue","streamId: %o, exec",e);var n=this._subStreamQueue[e].shift(),i=n.fn,o=n.args,a=n.resolve,s=n.reject;i.apply(this,o).then(a,s).finally((function(){return r._handleSubStreamQueue(e)}))}else vX.print("_subStreamQueue","streamId: %o, END",e)}},{key:"controlMessage",value:(k=c(o().mark((function e(t){var r,n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return vX.print("controlMessage()","params: %o",t),n=t,"transcode"===t.type&&(n.roomId=this._roomId),e.next=5,null===(r=this._dataChannelSignal)||void 0===r?void 0:r.sendSignaling("controlMessage",n);case 5:case"end":return e.stop()}}),e,this)}))),function(e){return k.apply(this,arguments)})},{key:"updateUserAttributes",value:(b=c(o().mark((function e(t){var r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return vX.print("updateUserAttributes()","attributes: %o",t),e.next=3,null===(r=this._dataChannelSignal)||void 0===r?void 0:r.sendSignaling("updateUserAttributes",{roomId:this._roomId,sessionId:this._sessionId,attributes:t});case 3:case"end":return e.stop()}}),e,this)}))),function(e){return b.apply(this,arguments)})},{key:"updateSubTrack",value:(S=c(o().mark((function e(t,r,n){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._updateSubTrack(t,r,n));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return S.apply(this,arguments)})},{key:"updateSubTrackLayer",value:(y=c(o().mark((function e(t,r){var n,i,a;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(vX.print("updateSubTrack()","subLayer: %o",r),t.subLayer.spatialLayer!==r.spatialLayer||t.subLayer.spatialSubLayer!==r.spatialSubLayer){e.next=4;break}return vX.print("updateSubTrack()","subLayer no change"),e.abrupt("return");case 4:return i={roomId:this._roomId,streamList:[t.streamId],streamId:t.streamId,streamUserId:t.userId,config:{qualityLayer:r}},e.next=7,null===(n=this._dataChannelSignal)||void 0===n?void 0:n.sendSignaling("updateSubscribe",i);case 7:if(200===(null==(a=e.sent)?void 0:a.code)){e.next=10;break}throw new hN(dN.UPDATE_TRACK_FAILED,(null==a?void 0:a.message)||"update track failed");case 10:return t.subLayer=r,e.abrupt("return",t);case 12:case"end":return e.stop()}}),e,this)}))),function(e,t){return y.apply(this,arguments)})},{key:"_updateSubTrack",value:(_=c(o().mark((function e(t,r,n){var i,a,s,c,u,d,l,h;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(vX.print("updateSubTrack()","mediaType: %o",r),yX("updateSubTrack()",t),!this.multiChatMode()||r!==U.AUDIO){e.next=5;break}return vX.print("updateSubTrack","multiChatMode mediaType only audio"),e.abrupt("return",t);case 5:return s=0,s=n===Xz.SUB?t.subMediaType|r:t.subMediaType-(t.subMediaType&r),vX.print("updateSubTrack","prev: %o, direction: %o, mediaType: %o, newMediaType: %o",t.subMediaType,n,r,s),t.subMediaType===s&&vX.print("updateSubTrack","mediaType no change"),c=!1,u=!1,UP(s)&&(u=!0),VP(s)&&(c=!0),d={roomId:this._roomId,streamList:[t.streamId],config:{enableMediaType:{video:c,audio:!!this.multiChatMode()||u}}},e.next=15,null===(i=this._dataChannelSignal)||void 0===i?void 0:i.sendSignaling("updateSubscribe",d);case 15:if(200===(null==(l=e.sent)?void 0:l.code)){e.next=18;break}throw new hN(dN.UPDATE_TRACK_FAILED,(null==l?void 0:l.message)||"update track failed");case 18:return this.multiChatMode()||(null===(h=t.observer)||void 0===h||h.setUnmuteAudio(u),t.subAudio=u),null===(a=t.observer)||void 0===a||a.setUnmuteVideo(c),t.subVideo=c,t.subMediaType=s,e.abrupt("return",t);case 23:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return _.apply(this,arguments)})},{key:"subscribe4pushTrack",value:(v=c(o().mark((function e(t,r){var n,i,a,s,c,u,d,l,h;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return vX.print("subscribe4pushTrack()","streamInfo: %o",r),yX("subscribe4pushTrack()",t),t.subAudio=!0,null===(n=t.observer)||void 0===n||n.setPushTrack(!0),e.next=6,null===(i=this._handler)||void 0===i?void 0:i.subscribe(t,{multiChatMode:this.multiChatMode()});case 6:if(c=e.sent){e.next=9;break}throw new hN(dN.ADD_TRANSCEIVER_FAILED,"add transceiver failed");case 9:return u=c.audioMid,d=c.videoMid,(l=[]).push(new Promise((function(e,r){var n=setTimeout((function(){return r(new hN(dN.TIME_OUT,"wait audio timeout for userId: ".concat(t.userId)))}),_X);t.on("ontrack",(function r(i){"audio"===i.mediaType&&(vX.print("remoteStream ".concat(t.userId," received audio track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),h=function(e){t.ontrack(e)},null===(a=this._handler)||void 0===a||a.on("ontrack",h),this._ontrackCallbackMap.set(t,h),e.next=18,null===(s=this._handler)||void 0===s?void 0:s.handleAck({action:Zz.pushtrack,streamId:t.streamId,audioMid:u,videoMid:d,stream:t,audioTransceiverInit:null==c?void 0:c.audioTransceiverInit,videoTransceiverInit:null==c?void 0:c.videoTransceiverInit,signalingAck:null==r?void 0:r.message,sdp:c.sdp});case 18:return e.next=20,Promise.all(l);case 20:this._context&&t.statsReport.setRemoteStreamStatsEvtInterval(this,this._handler,this.monitor,this._context);case 21:case"end":return e.stop()}}),e,this)}))),function(e,t){return v.apply(this,arguments)})},{key:"unsubscribe4removeTrack",value:(p=c(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:yX("unsubscribe4removeTrack()",t),vX.print("unsubscribe4removeTrack()","sequenceId: ",r.sequenceId);case 2:case"end":return e.stop()}}),e)}))),function(e,t){return p.apply(this,arguments)})},{key:"unsubscribe",value:(d=c(o().mark((function e(t,r){var n,i,a=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=a.length>2&&void 0!==a[2]&&a[2],yX("unsubscribe()",t),!n){e.next=4;break}return e.abrupt("return",this._unsubscribe(t,r));case 4:if(!this.multiChatMode()||!VP(r)){e.next=6;break}return e.abrupt("return",this._unsubscribe(t,r));case 6:if(i=t.subMediaType-(t.subMediaType&r),this.multiChatMode()||i!==Az.NONE){e.next=9;break}return e.abrupt("return",this._unsubscribe(t,r));case 9:return e.abrupt("return",this._updateSubTrack(t,r,Xz.UNSUB));case 10:case"end":return e.stop()}}),e,this)}))),function(e,t){return d.apply(this,arguments)})},{key:"_unsubscribe",value:(s=c(o().mark((function e(t,r){var n,i,a,s,c,u;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.hasSubscribed){e.next=2;break}return e.abrupt("return");case 2:if(!this._subConfig.muteReplaceUnsub){e.next=4;break}return e.abrupt("return",this._updateSubTrack(t,r,Xz.UNSUB));case 4:return c={roomId:this._roomId,streamId:t.streamId,userId:t.userId},null===(n=this._dataChannelSignal)||void 0===n||n.sendSignaling("unsubscribe",c).catch((function(){})),t.streamState=qz.INIT,this._subStreamQueue[t.streamId]&&(this._subStreamQueue[t.streamId].forEach((function(e){return(0,e.resolve)(null)})),delete this._subStreamQueue[t.streamId]),t.subVideo=!1,null===(i=t.observer)||void 0===i||i.setSubscribeVideo(!1),null===(a=t.observer)||void 0===a||a.setSubscribeAudio(!1),e.next=13,null===(s=this._handler)||void 0===s?void 0:s.handleAck({action:Zz.unsubscribe,streamId:t.streamId,audioMid:t.audioMid,videoMid:t.videoMid,stream:t});case 13:u=e.sent,this._subResolves[u]&&this._subResolves[u].forEach((function(e){return e(0)})),vX.print("unsubscribe","clean unsub ".concat(t.userId)),t.clean(),this.removeOnTrackListener(t),t.statsReport.unsubscribe();case 19:case"end":return e.stop()}}),e,this)}))),function(e,t){return s.apply(this,arguments)})},{key:"removeOnTrackListener",value:function(e){var t,r=this._ontrackCallbackMap.get(e);r&&(null===(t=this._handler)||void 0===t||t.off("ontrack",r),this._ontrackCallbackMap.delete(e))}},{key:"handleRemoveStream",value:(a=c(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(yX("handleRemoveStream()",t),t.subVideo=!1,t.hasSubscribed){e.next=4;break}return e.abrupt("return");case 4:this.unsubscribe(t,U.AUDIO_AND_VIDEO,!0);case 5:case"end":return e.stop()}}),e,this)}))),function(e,t){return a.apply(this,arguments)})},{key:"leave",value:(n=c(o().mark((function e(){var t,r,n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(vX.print("leave()"),"connected"!==this.connectionState){e.next=22;break}return this.connectionState="disconnecting",t={Authorization:this._authorization,roomId:this._roomId,sessionId:this._sessionId},e.next=6,this._joinLeaveLock.lock();case 6:return r=e.sent,e.prev=7,e.next=10,null===(n=this._dataChannelSignal)||void 0===n?void 0:n.sendSignaling("leaveRoom",t);case 10:this.connectionState="disconnected",e.next=17;break;case 13:throw e.prev=13,e.t0=e.catch(7),this.connectionState="connected",e.t0;case 17:return e.prev=17,r(),e.finish(17);case 20:e.next=23;break;case 22:return e.abrupt("return",Promise.reject(new hN(dN.NOT_CONNECTED_YET,"server not connected")));case 23:case"end":return e.stop()}}),e,this,[[7,13,17,20]])}))),function(){return n.apply(this,arguments)})},{key:"subscribePublicStream",value:(r=c(o().mark((function e(t){var r,n,i,a,s,c,u,d,l,h,f,p,v,_,m,y=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,null===(r=this._handler)||void 0===r?void 0:r.subscribe(t,{multiChatMode:!1});case 2:if(s=e.sent){e.next=5;break}throw new hN(dN.ADD_TRANSCEIVER_FAILED,"add transceiver failed");case 5:return c=fP(),u=s.audioMid,d=s.videoMid,e.t0=this._appId,e.t1=t.streamId,e.t2=u,e.t3=d,e.t4={sdp:null==s?void 0:s.partialSdp,semantics:null==s?void 0:s.semantics,type:null==s?void 0:s.type},e.next=15,qj();case 15:return e.t5=e.sent,e.t6=window.navigator.userAgent,e.t7=oj.VERSION,e.t8=ej.getDeviceId(),e.t9=this._appId,e.t10=this._businessId,e.t11=this._useCloudProxy,e.t12={supportedCodecs:e.t5,deviceType:"web",userAgent:e.t6,sdkVersion:e.t7,deviceId:e.t8,appId:e.t9,businessId:e.t10,enableCloudProxy:e.t11},e.t13={enableMediaType:{audio:!0,video:!0},qualityLayer:{spatialLayer:0,temporalLayer:0}},l={appId:e.t0,streamId:e.t1,audio:!0,video:!0,data:!0,audioMid:e.t2,videoMid:e.t3,sdpInfo:e.t4,params:e.t12,config:e.t13},e.next=27,null===(n=this._dataChannelSignal)||void 0===n?void 0:n.sendSignaling("startPullStream",l);case 27:return h=e.sent,f=[],this._subResolves[t.streamId]=[],f.push(new Promise((function(e,r){y._subResolves[t.streamId].push(e);var n=setTimeout((function(){return r(new hN(dN.TIME_OUT,"wait video timeout for streamId: ".concat(t.streamId)))}),_X);t.on("ontrack",(function r(i){"video"===i.mediaType&&(vX.print("remoteStream ".concat(t.userId," received video track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),f.push(new Promise((function(e,r){y._subResolves[t.streamId].push(e);var n=setTimeout((function(){return r(new hN(dN.TIME_OUT,"wait audio timeout for streamId: ".concat(t.streamId)))}),_X);t.on("ontrack",(function r(i){"audio"===i.mediaType&&(vX.print("remoteStream ".concat(t.userId," received audio track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),p=function(e){t.ontrack(e)},null===(i=this._handler)||void 0===i||i.on("ontrack",p),this._ontrackCallbackMap.set(t,p),v=null==h?void 0:h.relayMessage,_=v.sequenceId,m=v.sdp,t.videoMid=d,t.audioMid=u,t.sequenceId=_,t.streamState=qz.SUB_ED,t.subAudio=!0,t.subVideo=!0,e.next=44,null===(a=this._handler)||void 0===a?void 0:a.handleAck({action:Zz.subscribe,streamId:t.streamId,audioMid:u,videoMid:d,audioTransceiverInit:null==s?void 0:s.audioTransceiverInit,videoTransceiverInit:null==s?void 0:s.videoTransceiverInit,signalingAck:{sdp:m,sequenceId:_},stream:t});case 44:return e.next=46,Promise.all(f);case 46:this.monitor.rtcSubscribeStat(SB.SUCCESS,c,bB.UNKNOWN,t.userId),this._context&&t.statsReport.setRemoteStreamStatsEvtInterval(this,this._handler,this.monitor,this._context);case 48:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"unsubscribePublicStream",value:(t=c(o().mark((function e(t){var r,n,i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return yX("unsubscribePublicStream()",t),n={appId:this._appId,streamId:t.streamId},e.prev=2,e.next=5,null===(i=this._dataChannelSignal)||void 0===i?void 0:i.sendSignaling("stopPullStream",n);case 5:e.next=9;break;case 7:e.prev=7,e.t0=e.catch(2);case 9:return t.streamState=qz.INIT,t.subVideo=!1,t.subAudio=!1,e.next=14,null===(r=this._handler)||void 0===r?void 0:r.handleAck({action:Zz.unsubscribe,streamId:t.streamId,audioMid:t.audioMid,videoMid:t.videoMid,stream:t});case 14:t.clean(),this.removeOnTrackListener(t),t.statsReport.unsubscribe();case 17:case"end":return e.stop()}}),e,this,[[2,7]])}))),function(e){return t.apply(this,arguments)})},{key:"destroy",value:function(){var e,t,r;vX.print("destroy()"),this._token=void 0,this._appId=void 0,this._roomId=void 0,this._clientId=void 0,this._authorization=void 0,this._sessionId=void 0,this._context=void 0,null===(e=this._handler)||void 0===e||e.destroy(),null===(t=this._dataChannelSignal)||void 0===t||t.destroy(),null===(r=this._iceConfigRequestManager)||void 0===r||r.abort(),this._handler=void 0,this._dataChannelSignal=void 0,this._iceConfigRequestManager=void 0,this._removeSignalEventHandler(),this.connectionState="disconnected",this.emit("INTERRUPT")}},{key:"sendUserMessage",value:function(e,t){var r;return null===(r=this._dataChannelSignal)||void 0===r?void 0:r.sendP2PMessage({to:e,from:this._userInfo.userId,room:this._roomId,app:this._appId,msg:t})}},{key:"sendRoomMessage",value:function(e){var t;return null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("customMessage",e)}},{key:"multiChatMode",value:function(){var e;return null===(e=this._roomAttributes)||void 0===e?void 0:e.multiChatMode}},{key:"handler",get:function(){return this._handler}},{key:"roomAttributes",get:function(){return this._roomAttributes},set:function(e){this._roomAttributes=e}}]),D}($L);function SX(e,t,r){var n=r.value;return r.value=c(o().mark((function e(){var r,i,a,s=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._handler||"connected"!==this._state){e.next=6;break}for(r=s.length,i=new Array(r),a=0;a<r;a++)i[a]=s[a];return e.next=4,n.apply(this,i);case 4:e.next=7;break;case 6:throw new hN(dN.NOT_CONNECTED_YET,"error in ".concat(t,": try again after joined"));case 7:case"end":return e.stop()}}),e,this)}))),r}function bX(e,t,r){var n=r.value;return r.value=c(o().mark((function e(){var t,r,i,a,s=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._pubSubLock.lock();case 2:for(t=e.sent,this.supportConcurrent&&t(),e.prev=4,r=s.length,i=new Array(r),a=0;a<r;a++)i[a]=s[a];return e.next=8,n.apply(this,i);case 8:return e.abrupt("return",e.sent);case 9:return e.prev=9,this.supportConcurrent||t(),e.finish(9);case 12:case"end":return e.stop()}}),e,this,[[4,,9,12]])}))),r}pX([function(e,t,r){var n=r.value;return r.value=c(o().mark((function e(){var t,r,i,a,s=this,u=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(t=u.length,r=new Array(t),i=0;i<t;i++)r[i]=u[i];return a=!1,e.abrupt("return",new Promise(function(){var e=c(o().mark((function e(t,i){var c;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s.on("INTERRUPT",(function(){a=!0,i(new hN(dN.OPERATION_CANCEL,"operation not finish when leave"))})),e.prev=1,e.next=4,n.apply(s,r);case 4:c=e.sent,t(c),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(1),a||i(e.t0);case 11:case"end":return e.stop()}}),e,null,[[1,8]])})));return function(t,r){return e.apply(this,arguments)}}()));case 3:case"end":return e.stop()}}),e)}))),r}],gX.prototype,"join",1),pX([bX,SX],gX.prototype,"publish",1),pX([bX,SX],gX.prototype,"updatePubTrack",1),pX([bX,SX],gX.prototype,"unpublish",1),pX([bX,SX],gX.prototype,"subscribe",1),pX([SX],gX.prototype,"controlMessage",1),pX([SX],gX.prototype,"updateUserAttributes",1),pX([SX],gX.prototype,"updateSubTrack",1),pX([SX],gX.prototype,"updateSubTrackLayer",1),pX([bX,SX],gX.prototype,"subscribe4pushTrack",1),pX([bX,SX],gX.prototype,"unsubscribe4removeTrack",1),pX([bX,SX],gX.prototype,"unsubscribe",1),pX([SX],gX.prototype,"handleRemoveStream",1),pX([bX],gX.prototype,"subscribePublicStream",1),pX([bX],gX.prototype,"unsubscribePublicStream",1);var EX=ro,kX=le,TX=ce,IX=Re,AX=Xt,RX=qe,wX=tt,CX=As,OX=Pr.f,xX=Fi,DX=TX.Symbol,NX=DX&&DX.prototype;if(kX&&RX(DX)&&(!("description"in NX)||void 0!==DX().description)){var PX={},MX=function(){var e=arguments.length<1||void 0===arguments[0]?void 0:CX(arguments[0]),t=wX(NX,this)?new DX(e):void 0===e?DX():DX(e);return""===e&&(PX[t]=!0),t};xX(MX,DX),MX.prototype=NX,NX.constructor=MX;var LX="Symbol(test)"==String(DX("test")),UX=IX(NX.valueOf),VX=IX(NX.toString),FX=/^Symbol\((.*)\)[^)]+$/,BX=IX("".replace),jX=IX("".slice);OX(NX,"description",{configurable:!0,get:function(){var e=UX(this);if(AX(PX,e))return"";var t=VX(e),r=LX?jX(t,7,-1):BX(t,FX,"$1");return""===r?void 0:r}}),EX({global:!0,constructor:!0,forced:!0},{Symbol:MX})}fM("iterator");var GX=Ip.right,HX=ut,zX=Ap;ro({target:"Array",proto:!0,forced:!Ca("reduceRight")||!zX&&HX>79&&HX<83},{reduceRight:function(e){return GX(this,e,arguments.length,arguments.length>1?arguments[1]:void 0)}});var XX={};Object.defineProperty(XX,"__esModule",{value:!0});var KX=function(){return(KX=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function qX(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(n=o.next()).done;)a.push(n.value)}catch(s){i={error:s}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a}function WX(e){return"object"==a(e)&&null!==e}function YX(e){return"function"==typeof e}function JX(){if("object"==("undefined"==typeof window?"undefined":a(window))&&WX(window))return window}function QX(){if("object"==("undefined"==typeof document?"undefined":a(document))&&WX(document))return document}var ZX=function(e){if(e)return e.__SLARDAR_REGISTRY__||(e.__SLARDAR_REGISTRY__={Slardar:{plugins:[],errors:[],subject:{}}}),e.__SLARDAR_REGISTRY__.Slardar},$X=function(e,t,r,n){void 0===t&&(t={}),void 0===n&&(n=[]);try{var i=e.apply(void 0,function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||((n=n||Array.prototype.slice.call(t,0,i))[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}([],qX(n),!1));return i&&i(t,r)||[]}catch(o){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=ZX(JX());r&&(r.errors||(r.errors=[]),r.errors.push(e))}(o),[]}},eK=function(e){return e.requestIdleCallback||function(t){return e.setTimeout(t,1)}},tK=function(){return Date.now()};var rK=function(e,t){return WX(e)?KX(KX({},t),e):!!e&&t};var nK=["SCRIPT","STYLE","META","HEAD"],iK=["js_error","http","resource_error"],oK=["performance","performance_longtask","performance_timing","custom"],aK=function e(t,r,n,i,o){if(void 0===r&&(r=0),void 0===n&&(n=0),void 0===i&&(i=1.5),void 0===o&&(o=nK),!t||-1<o.indexOf(t.tagName)||i<=n||4<r)return n;var a=function(){if(!r)return 0;var e=(n=t.getBoundingClientRect()).top,n=n.height;return e>innerHeight||n<=0?0:1/Math.pow(2,r-1)}();return[].reduceRight.call(t.children,(function(t,n){return e(n,r+1,t,i,o)}),n+a)},sK=function(e,t,r,n){if(function(){if(JX()&&"Promise"in window)return Promise}()&&r&&n){if(r.html2canvas)return o();var i=n.createElement("script");i.src=t,null!==(t=n.head)&&void 0!==t&&t.appendChild(i),i.onload=o}function o(){eK(r)((function(){r.html2canvas&&r.html2canvas(n.body,{scale:360/r.innerWidth}).then((function(t){e(t.toDataURL("image/jpeg",.1))}))}))}},cK=function(e,t,r,n,i){if(void 0===e&&(e=JX()),void 0===t&&(t=QX()),void 0===r&&(r=function(){if(JX()&&YX(window.PerformanceObserver))return window.PerformanceObserver}()),void 0===n&&(n=function(){if(JX()&&YX(window.MutationObserver))return window.MutationObserver}()),void 0===i&&(i=function(){if(JX()&&WX(window.performance))return window.performance}()),t&&e)return function(o,a){var s,c,u,d,l,h,f=o.threshold,p=o.screenshot,v=o.rootSelector,_=o.autoDetect,m=o.ssUrl,y=eK(e),g=qX(function(e){var t=e&&e.timing||void 0;return[t,function(){return e&&e.now?e.now():(Date.now?Date.now():+new Date)-(t&&t.navigationStart||0)},function(t){var r=(e||{}).getEntriesByType;return YX(r)&&r.call(e,t)||[]},function(){var t=(e||{}).clearResourceTimings;YX(t)&&t.call(e)},function(t){var r=(e||{}).getEntriesByName;return YX(r)&&r.call(e,t)||[]}]}(i),2)[1],S=0,b=!1,E=function(e){s&&a&&a({ev_type:"blank_screen",payload:{timestamp:s[0],score:s[1],screenshot:e,error:c}})},k=(d=function(){s&&!b&&(b=!0,I(),p?sK(E,m,e,t):E())},function(){l||(h=tK(),l=e.setTimeout((function(){l=0,h<S||d()}),g()>1e4?2e3:8e3))});function T(){u&&clearTimeout(u),u=e.setTimeout((function(){y((function(){e.requestAnimationFrame((function(){var e=v?t.querySelector(v):t.body;e&&((e=aK(e,0,0,f))<f?(s=[tK(),e],k()):s=void 0)}))}))}),1e3)}!function(e){var t=qX(function(e){var t=!1;return[function(r){t||(t=!0,e&&e(r))}]}(e),1)[0];["unload","beforeunload","pagehide"].forEach((function(e){addEventListener(e,t)}))}((function(){!b&&c&&E()}));var I=function(){clearTimeout(u),R&&R(),C&&C()},A=(o=qX(function(e,t){var r=e&&new e(t);return[function(e,t){r&&e&&r.observe(e,t)},function(){return r&&r.disconnect()}]}(n,T),2),o[0]),R=o[1],w=(o=qX(function(e,t,r,n){var i=e&&new e((function(e,i){e.getEntries?e.getEntries().forEach((function(e,r,n){return t(e,r,n,i)})):n&&n(),r&&i.disconnect()}));return[function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];if(!e||!i)return n&&n();try{t.forEach((function(t){-1<e.supportedEntryTypes.indexOf(t)&&i.observe({type:t,buffered:!1})}))}catch(o){try{i.observe({entryTypes:t})}catch(a){return n&&n()}}},function(){return i&&i.disconnect()}]}(r,(function(e,t,r){return u&&1<r.length&&T()})),2),o[0]),C=o[1];return _&&function(e){var t=JX(),r=QX();t&&r&&("loading"!==r.readyState?e():t.addEventListener("DOMContentLoaded",(function(){setTimeout((function(){e()}),0)}),!1))}((function(){var e;A(null===(e=QX())||void 0===e?void 0:e.body,{subtree:!0,childList:!0}),w("longtask","resource"),T()})),[I,function(e){b||function(e){return~oK.indexOf(e.ev_type)}(e)||(S=tK(),c&&S-c.timestamp>1e4&&(c=void 0),c=function(e,t){if(-1===iK.indexOf(t.ev_type))return e;if("http"===t.ev_type&&t.payload.response.status<400)return e;if(e&&iK.indexOf(e.type)<iK.indexOf(t.ev_type))return e;var r="";switch(t.ev_type){case"js_error":r=t.payload.error.message;break;case"http":r=t.payload.request.url;break;case"resource_error":r=t.payload.url}return{type:t.ev_type,message:r,timestamp:tK()}}(c,e))},T]}},uK="blankScreen";function dK(e,t,r){e.on("init",(function(){var n,i,o,a=function(e,t,r){return t=null===(e=e.config())||void 0===e?void 0:e.plugins[t],rK(t,r)}(e,uK,t)||rK(r,t);a&&(a=qX($X(cK,a,e.report.bind(e)),3),n=a[0],i=a[1],a=a[2],e.on("report",o=function(e){return i(e),e}),e.on("beforeDestroy",(function(){n(),e.off("report",o)})),e.provide("detectBlankScreen",a))}))}var lK={autoDetect:!0,threshold:1.5,screenshot:!0,ssUrl:"https://apm.volccdn.com/mars-web/apmplus/web/html2canvas.min.js"};var hK=XX.blankScreenPlugin=function(e){return{name:uK,setup:function(t){!function(e,t){dK(e,lK,t)}(t,e)}}},fK=Gt,pK=Gu,vK=Pu;ro({target:"Object",stat:!0,forced:de((function(){pK(1)})),sham:!vK},{getPrototypeOf:function(e){return pK(fK(e))}});var _K=PN.start;ro({target:"String",proto:!0,forced:MN},{padStart:function(e){return _K(this,e,arguments.length>1?arguments[1]:void 0)}});var mK,yK={};Object.defineProperty(yK,"__esModule",{value:!0});var gK=function(){return(gK=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function SK(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(n=o.next()).done;)a.push(n.value)}catch(s){i={error:s}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a}function bK(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||((n=n||Array.prototype.slice.call(t,0,i))[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}var EK=function(e){return JSON.stringify({ev_type:"batch",list:e})};var kK=["init","start","config","beforeDestroy","provide","beforeReport","report","beforeBuild","build","beforeSend","send","beforeConfig"],TK=function(){return{}};function IK(e){return"object"==a(e)&&null!==e}var AK=Object.prototype;function RK(e){return!!IK(e)&&("function"!=typeof Object.getPrototypeOf?"[object Object]"===AK.toString.call(e):(e=Object.getPrototypeOf(e))===AK||null===e)}function wK(e){return"[object Array]"===AK.toString.call(e)}function CK(e){return"function"==typeof e}function OK(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function xK(e,t){var r,n=gK({},e);for(r in t)OK(t,r)&&void 0!==t[r]&&(IK(t[r])&&RK(t[r])?n[r]=xK(IK(e[r])?e[r]:{},t[r]):wK(t[r])&&wK(e[r])?n[r]=DK(e[r],t[r]):n[r]=t[r]);return n}function DK(e,t){return e=wK(e)?e:[],t=wK(t)?t:[],Array.prototype.concat.call(e,t).map((function(e){return e instanceof RegExp?e:IK(e)&&RK(e)?xK({},e):wK(e)?DK([],e):e}))}function NK(e,t){if(!wK(e))return!1;if(0===e.length)return!1;for(var r=0;r<e.length;){if(e[r]===t)return!0;r++}return!1}var PK=function(e,t){if(!wK(e))return e;var r=e.indexOf(t);return 0<=r?((t=e.slice()).splice(r,1),t):e},MK=function(e,t,r){return function(e,t,r){for(var n,i=(t=SK(t.split(".")))[0],o=t.slice(1);e&&0<o.length;)e=e[i],i=(n=SK(o))[0],o=n.slice(1);if(e)return r(e,i)}(e,t,(function(e,t){if(e&&t in e&&CK(e[t]))try{return e[t].apply(e,r)}catch(n){return}}))};function LK(e){try{return function(e){return"string"==typeof e}(e)?e:JSON.stringify(e)}catch(t){return"[FAILED_TO_STRINGIFY]:"+String(t)}}var UK=0,VK=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];console.error.apply(console,bK(["[SDK]",Date.now(),(""+UK++).padStart(8," ")],SK(e),!1))},FK=0,BK=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];console.warn.apply(console,bK(["[SDK]",Date.now(),(""+FK++).padStart(8," ")],SK(e),!1))},jK=function(e){return function(t){for(var r=t,n=0;n<e.length&&r;n++)try{r=e[n](r)}catch(i){VK(i)}return r}};function GK(){var e=function(){for(var e=new Array(16),t=0,r=0;r<16;r++)0==(3&r)&&(t=4294967296*Math.random()),e[r]=t>>>((3&r)<<3)&255;return e}();return e[6]=15&e[6]|64,e[8]=63&e[8]|128,function(e){for(var t=[],r=0;r<256;++r)t[r]=(r+256).toString(16).substr(1);var n=0,i=t;return[i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]],i[e[14]],i[e[15]]].join("")}(e)}var HK=function e(t,r){var n=r.reduce((function(e,r){try{var n=r(t);"function"==typeof n&&e.push(n)}catch(i){}return e}),[]);return function(t){return e(t,n)}},zK=function(e){function t(e){n=PK(n,e),o||a()}var r,n=[],i=[],o=!1,a=function(e,t,r){var n=0;return function(){if(e())return n&&clearTimeout(n),void(n=0);0===n&&(n=setTimeout(t,r))}}((function(){return!!n.length}),(function(){o=!0,r&&r[0](),i.forEach((function(e){return e()})),i.length=0,r=void 0}),e=void 0===e?3e5:e);return{next:function(e){return HK(e,n)},complete:function(e){i.push(e)},attach:function(e,t){r=[e,t]},subscribe:function(e){if(o)throw new Error("Observer is closed");return n.push(e),r&&r[1]&&r[1](e),a(),function(){return t(e)}},unsubscribe:t}};var XK=function(e){var t,r,n,i=(t={},r={},n={set:function(e,i){return t[e]=i,r[e]=LK(i),n},merge:function(e){return t=gK(gK({},t),e),Object.keys(e).forEach((function(t){r[t]=LK(e[t])})),n},delete:function(e){return delete t[e],delete r[e],n},clear:function(){return t={},r={},n},get:function(e){return r[e]},toString:function(){return gK({},r)}},n);e.provide("context",i),e.on("report",(function(e){return e.extra||(e.extra={}),e.extra.context=i.toString(),e}))},KK=function(e,t,r){function n(){for(var r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];if(c=r[0]){var a=c.split(".")[0];if(a in n)return MK(n,c,[].slice.call(r,1));var s=o[a]||[],c=null!==(c=null==t?void 0:t(e))&&void 0!==c?c:{};s.push(bK([c],SK(r),!1)),o[a]=s}}var i,o={};for(i in function(e,t,r,n){return void 0===n&&(n=!0),function(){for(var i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];if(!e)return TK;var a=e[t],s=r.apply(void 0,bK([a],SK(i),!1)),c=s;return CK(c)&&n&&(c=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];try{return s.apply(this,e)}catch(r){return CK(a)&&a.apply(this,e)}}),e[t]=c,function(r){r||(c===e[t]?e[t]=a:s=a)}}}(e,"provide",(function(t){return function(r,i){n[r]=i,t.call(e,r,i)}}))(),e)Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i]);return e.on("provide",(function(t){o[t]&&(o[t].forEach((function(t){t=(n=SK(t))[0];var n=n.slice(1);null!=r&&r(e,t,n)})),o[t]=null)})),n};function qK(e,t){var r=t||{};e.provide("initSubject",(function(e){var t=(e=SK(e,2))[0];e=e[1];return r[t]||(r[t]=function(t,r){var n=zK();try{t(n.next,n.attach),r&&n.complete(r)}catch(e){}return[n.subscribe,n.unsubscribe]}(e,(function(){r[t]=void 0}))),r[t]})),e.provide("getSubject",(function(e){return r[e]}))}function WK(){if("object"==("undefined"==typeof window?"undefined":a(window))&&IK(window))return window}function YK(){var e=function(){if(WK()&&"navigator"in window)return window.navigator}();if(e)return e.connection||e.mozConnection||e.webkitConnection}function JK(){var e=WK()&&WK()&&window.location;return null==e?void 0:e.href}var QK=function(e){var t={url:JK(),timestamp:Date.now()},r=e.config();return null!=r&&r.pid&&(t.pid=r.pid),null!=e&&e.context&&(t.context=e.context.toString()),t};function ZK(e){return(null==e?void 0:e.effectiveType)||(null==e?void 0:e.type)||""}var $K=function(e,t,r){var n,i=t.url,o=t.data,a=void 0===(n=t.success)?TK:n,s=void 0===(n=t.fail)?TK:n,c=void 0===(n=t.getResponseText)?TK:n;t=void 0!==(t=t.withCredentials)&&t;(r=new r).withCredentials=t,r.open(e,i,!0),r.setRequestHeader("Content-Type","application/json"),r.onload=function(){null!=c&&c(this.responseText);try{var e;this.responseText?(e=JSON.parse(this.responseText),a(e)):a({})}catch(t){s(t)}},r.onerror=function(){s(new Error("Network request failed"))},r.onabort=function(){s(new Error("Network request aborted"))},r.send(o)},eq=function(){var e=function(){if("function"==typeof XMLHttpRequest&&CK(XMLHttpRequest))return XMLHttpRequest}();return e?{get:function(t){$K("GET",t,e)},post:function(t){$K("POST",t,e)}}:{get:TK,post:TK}};function tq(e){function t(e){n.post(r.getEndpoint(),EK([e]))}var r=function(e){var t=e.transport,r=e.endpoint,n=e.size,i=void 0===n?10:n,o=void 0===(e=e.wait)?1e3:e,a=[],s=0;function c(){a.length&&(t.post({url:r,data:this.getBatchData()}),a=[])}return{getSize:function(){return i},getWait:function(){return o},setSize:function(e){i=e},setWait:function(e){o=e},getEndpoint:function(){return r},setEndpoint:function(e){r=e},send:function(e){a.push(e),a.length>=i&&c.call(this),clearTimeout(s),s=setTimeout(c.bind(this),o)},flush:function(){clearTimeout(s),c.call(this)},getBatchData:function(){return a.length?EK(a):""},clear:function(){clearTimeout(s),a=[]}}}(e),n=function(){var e=WK();return e&&e.navigator.sendBeacon?{get:function(){},post:function(t,r){e.navigator.sendBeacon(t,r)}}:{get:TK,post:TK}}();return function(e){var t=SK(function(e){var t=!1;return[function(r){t||(t=!0,e&&e(r))}]}(e),1)[0];["unload","beforeunload","pagehide"].forEach((function(e){addEventListener(e,t)}))}((function(){var e=r.getBatchData();e&&(n.post(r.getEndpoint(),e),r.clear()),r.send=t})),r}var rq={build:function(e){return{ev_type:e.ev_type,payload:e.payload,common:gK(gK({},e.extra||{}),e.overrides||{})}}};function nq(e){var t,r=e.plugins||{};for(t in r)r[t]&&!IK(r[t])&&(r[t]={});return gK(gK({},e),{plugins:r})}function iq(e){return IK(e)&&"aid"in e}function oq(e){return gK({},e)}var aq="/settings/get/webpro",sq="/monitor_web/collect",cq=[sq,aq,"/monitor_browser/collect"],uq={sample_rate:1,include_users:[],sample_granularity:"session",rules:{}},dq=function(e,t){return void 0===t&&(t=sq),(e&&0<=e.indexOf("//")?"":"https://")+e+t},lq=function(e,t){return void 0===t&&(t=aq),(e&&0<=e.indexOf("//")?"":"https://")+e+t},hq=function(e){return e+"_"+Date.now()},fq=function(e){return"APMPLUS"+e},pq=function(e){return function(e){try{var t=localStorage.getItem(e),r=t;return t&&"string"==typeof t?JSON.parse(t):r}catch(n){return}}(e=fq(e))||{userId:GK(),deviceId:GK(),r:Math.random()}},vq=function(e){var t=e.aid,r=e.userId,n=e.deviceId;e=e.sample;!function(e,t){try{var r="string"==typeof t?t:JSON.stringify(t);localStorage.setItem(e,r)}catch(n){}}(t=fq(t),{userId:r,deviceId:n,r:e.r})},_q=function(e){var t,r,n,i=e,o={},a=TK,s=TK;return{getConfig:function(){return i},setConfig:function(e){return o=gK(gK({},o),e||{}),c(),t||(t=e,i.useLocalConfig?(n={},a()):r?u():function(e,t,r,n){e.get({withCredentials:!0,url:lq(t)+"?aid="+r,success:function(e){n(e.data||{})},fail:function(){n()}})}(i.transport,i.domain,i.aid,(function(e){r=e,u()}))),i},onChange:function(e){s=e},onReady:function(t){a=function(){e.userId!==i.userId&&(e.sample.r=Math.random(),c()),vq(i),t()},n&&a()}};function c(){var t=gK(gK(gK({},e),n||{}),o);t.plugins=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var r={},n=0;n<e.length;)r=xK(r,e[n++]);return r}(e.plugins,(null==n?void 0:n.plugins)||{},o.plugins||{}),t.sample=mq(mq(e.sample,null==n?void 0:n.sample),o.sample),i=t,s()}function u(){n=function(e){if(!e)return{};var t=e.sample,r=e.timestamp,n=e.status;if(!t)return{};var i=t.sample_rate;return e=t.sample_granularity,{sample:{include_users:t.include_users,sample_rate:n&&4===n?0:i,sample_granularity:e,rules:t.rules.reduce((function(e,t){var r=t.name,n=t.enable,i=t.sample_rate;return t=t.conditional_sample_rules,e[r]={enable:n,sample_rate:i,conditional_sample_rules:t},e}),{})},serverTimestamp:r}}(r),c(),a()}};function mq(e,t){if(!e||!t)return e||t;var r=gK(gK({},e),t);return r.include_users=bK(bK([],SK(e.include_users||[]),!1),SK(t.include_users||[]),!1),r.rules=bK(bK([],SK(Object.keys(e.rules||{})),!1),SK(Object.keys(t.rules||{})),!1).reduce((function(r,n){var i;return n in r||(n in(e.rules||{})&&n in(t.rules||{})?(r[n]=gK(gK({},e.rules[n]),t.rules[n]),r[n].conditional_sample_rules=bK(bK([],SK(e.rules[n].conditional_sample_rules||[]),!1),SK(t.rules[n].conditional_sample_rules||[]),!1)):r[n]=(null===(i=e.rules)||void 0===i?void 0:i[n])||(null===(i=t.rules)||void 0===i?void 0:i[n])),r}),{}),r}var yq=function(e){e.on("report",(function(e){return function(e){var t={url:JK(),timestamp:Date.now()};return gK(gK({},e),{extra:gK(gK({},t),e.extra||{})})}(e)}))},gq=function(e){e.on("beforeBuild",(function(t){return function(e,t){var r={};return r.aid=t.aid,r.pid=t.pid,r.view_id=t.viewId,r.user_id=t.userId,gK(gK({},e),{extra:gK(gK({},r),e.extra||{})})}(t,e.config())}))},Sq=function(e){e.on("start",(function(){var t,r={did:(t=e.config()).deviceId,sid:t.sessionId,release:t.release,env:t.env,sname:"APM_PLUS_WEB",sversion:"1.7.0",soffset:t.offset||0,biz_id:r=t.aid,x_auth_token:t=t.token};(t=e.getSender()).setEndpoint(t.getEndpoint()+function(e){return IK(e)?Object.keys(e).reduce((function(t,r){return t+"&"+r+"="+e[r]}),"").replace("&","?"):""}(r))}))},bq=function(e){return e=pq(e.aid),{aid:0,pid:"",token:"",viewId:hq("_"),userId:e.userId,deviceId:e.deviceId,sessionId:GK(),domain:"apmplus.volces.com",plugins:{ajax:{ignoreUrls:cq},fetch:{ignoreUrls:cq},breadcrumb:{},pageview:{},jsError:{},resource:{},resourceError:{},performance:{},tti:{},fmp:{},blankScreen:!1},release:"",env:"production",sample:gK(gK({},uq),{r:e.r}),transport:eq()}};mK=yK.createMinimalBrowserClient=function(e){var t=(r=void 0===e?{}:e).createSender,r=(e=r.builder,r.createDefaultConfig),n=function(e){var t,r,n=e.builder,i=e.createSender,o=e.createDefaultConfig,a=e.createConfigManager,s=e.userConfigNormalizer,c=e.initConfigNormalizer,u=e.validateInitConfig,d={};kK.forEach((function(e){return d[e]=[]}));var l=!1,h=!1,f=!1,p=[],v=[],_={getBuilder:function(){return n},getSender:function(){return t},getPreStartQueue:function(){return p},init:function(e){if(l)BK("already inited");else{if(!(e&&IK(e)&&u(e)))throw new Error("invalid InitConfig, init failed");var n=o(e);if(!n)throw new Error("defaultConfig missing");if(e=c(e),(r=a(n)).setConfig(e),r.onChange((function(){m("config")})),!(t=i(r.getConfig())))throw new Error("sender missing");m("init",l=!0)}},set:function(e){l&&e&&IK(e)&&(m("beforeConfig",!1,e),null!=r&&r.setConfig(e))},config:function(e){if(l)return e&&IK(e)&&(m("beforeConfig",!1,e),null!=r&&r.setConfig(s(e))),null==r?void 0:r.getConfig()},provide:function(e,t){NK(v,e)?BK("cannot provide "+e+", reserved"):(_[e]=t,m("provide",!1,e))},start:function(){var e=this;l&&(h||null!=r&&r.onReady((function(){m("start",h=!0),p.forEach((function(t){return e.build(t)})),p=[]})))},report:function(e){e&&(!(e=jK(d.beforeReport)(e))||(e=jK(d.report)(e))&&(h?this.build(e):p.push(e)))},build:function(e){!h||(e=jK(d.beforeBuild)(e))&&(!(e=n.build(e))||(e=jK(d.build)(e))&&this.send(e))},send:function(e){!h||(e=jK(d.beforeSend)(e))&&(t.send(e),m("send",!1,e))},destroy:function(){m("beforeDestroy",f=!0)},on:function(e,t){"init"===e&&l||"start"===e&&h||"beforeDestroy"===e&&f?t():d[e]&&d[e].push(t)},off:function(e,t){d[e]&&(d[e]=PK(d[e],t))}};return v=Object.keys(_),_;function m(e,t){void 0===t&&(t=!1);for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];d[e].forEach((function(e){try{e.apply(void 0,bK([],SK(r),!1))}catch(t){}})),t&&(d[e].length=0)}}({validateInitConfig:iq,initConfigNormalizer:nq,userConfigNormalizer:oq,createSender:void 0===t?function(e){return tq({size:20,endpoint:dq(e.domain),transport:e.transport})}:t,builder:void 0===e?rq:e,createDefaultConfig:void 0===r?bq:r,createConfigManager:_q});return XK(n),r=function(e){if(e)return e.__SLARDAR_REGISTRY__||(e.__SLARDAR_REGISTRY__={Slardar:{plugins:[],errors:[],subject:{}}}),e.__SLARDAR_REGISTRY__.Slardar}(WK()),qK(n,r&&r.subject),function(e){var t,r=!1;e.on("init",(function(){t=(new Date).getTime(),e.on("config",(function(){var n,i=null===(n=e.config())||void 0===n?void 0:n.serverTimestamp;isNaN(i)||Number(i)<=0||r||(r=!0,(n=(new Date).getTime())-t<700&&i&&(n=i-(n+t)/2,!isNaN(n)&&(0<n||n<-6e5)&&e.set({offset:n})))}))}))}(n),gq(n),yq(n),function(e){var t=YK(),r=ZK(t);t&&(t.onchange=function(){r=ZK(t)}),e.on("report",(function(e){return gK(gK({},e),{extra:gK(gK({},e.extra||{}),{network_type:r})})}))}(n),Sq(n),r=KK(n,QK,(function(e,t,r){return function(e,t){return function(r){function n(e){return e.overrides=t,e}e.on("report",n),r(),e.off("report",n)}}(e,t)((function(){var e=(t=SK(r))[0],t=t.slice(1);n[e].apply(n,bK([],SK(t),!1))}))})),function(e){e.on("init",(function(){var t=[],r=e.config();r&&r.integrations&&r.integrations.forEach((function(r){NK(t,r.name)||(t.push(r.name),r.setup(e),r.tearDown&&e.on("beforeDestroy",r.tearDown))}))}))}(r),r},yK.getDefaultConfig=bq;var Eq={};Object.defineProperty(Eq,"__esModule",{value:!0});var kq=function(){return(kq=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function Tq(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(n=o.next()).done;)a.push(n.value)}catch(s){i={error:s}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a}function Iq(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||((n=n||Array.prototype.slice.call(t,0,i))[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}var Aq=function(){return{}};function Rq(e){return"object"==a(e)&&null!==e}var wq=Object.prototype;function Cq(e){return"function"==typeof e}function Oq(e){return"string"==typeof e}function xq(e){return function(e){return"[object Array]"===wq.toString.call(e)}(e)&&e.length?function(e){for(var t=[],r=e.length,n=0;n<r;n++){var i=e[n];Oq(i)?t.push(i.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")):i&&i.source&&t.push(i.source)}return new RegExp(t.join("|"),"i")}(e):null}function Dq(e){try{return Oq(e)?e:JSON.stringify(e)}catch(t){return"[FAILED_TO_STRINGIFY]:"+String(t)}}var Nq=function(e,t,r,n){return void 0===n&&(n=!0),function(){for(var i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];if(!e)return Aq;var a=e[t],s=r.apply(void 0,Iq([a],Tq(i),!1)),c=s;return Cq(c)&&n&&(c=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];try{return s.apply(this,e)}catch(r){return Cq(a)&&a.apply(this,e)}}),e[t]=c,function(r){r||(c===e[t]?e[t]=a:s=a)}}};function Pq(){if("object"==("undefined"==typeof window?"undefined":a(window))&&Rq(window))return window}var Mq=function(e){if(e)return e.__SLARDAR_REGISTRY__||(e.__SLARDAR_REGISTRY__={Slardar:{plugins:[],errors:[],subject:{}}}),e.__SLARDAR_REGISTRY__.Slardar},Lq=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=Mq(Pq());r&&(r.errors||(r.errors=[]),r.errors.push(e))};function Uq(e,t,r){return function(e,t){return Rq(e)?kq(kq({},t),e):!!e&&t}(t=null===(e=e.config())||void 0===e?void 0:e.plugins[t],r)}var Vq=["name","message","stack","filename","lineno","colno"],Fq=function(e){var t;return function(e){switch(Object.prototype.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMError]":case"[object DOMException]":return!0;default:return e instanceof Error}}(e)?t=function(e,t){return e&&Rq(e)?t.reduce((function(t,r){return t[r]=e[r],t}),{}):e}(e,Vq):(function(e){return!!Rq(e)&&("function"!=typeof Object.getPrototypeOf?"[object Object]"===wq.toString.call(e):(e=Object.getPrototypeOf(e))===wq||null===e)}(e)||function(e){return"undefined"!=typeof Event&&function(e,t){try{return e instanceof t}catch(r){return!1}}(e,Event)}(e)||Oq(e))&&(t={message:Dq(e)}),t},Bq=function(e){return Fq(e.error)},jq=function(e){var t;try{var r=void 0;if("reason"in e?r=e.reason:"detail"in e&&"reason"in e.detail&&(r=e.detail.reason),r){var n=Fq(r);return kq(kq({},n),{name:null!==(t=n&&n.name)&&void 0!==t?t:"UnhandledRejection"})}}catch(i){}},Gq=function(e){return(function(e){return"[object ErrorEvent]"===Object.prototype.toString.call(e)}(e)?Bq:function(e){return"[object PromiseRejectionEvent]"===Object.prototype.toString.call(e)}(e)?jq:Fq)(e)},Hq=["EventTarget","Window","Node","ApplicationCache","ChannelMergerNode","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","MessagePort","Notification","SVGElementInstance","Screen","TextTrack","TextTrackCue","TextTrackList","WebSocket","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],zq=["setTimeout","setInterval","requestAnimationFrame","requestIdleCallback"],Xq=["onload","onerror","onprogress","onreadystatechange"],Kq="addEventListener",qq=function(e,t,r){function n(t,r){if(!Cq(t))return t;var i={type:"capture-global",data:kq({},r)},o=t._w_||(t._w_=function(){try{return(t.handleEvent&&Cq(t.handleEvent)?t.handleEvent:t).apply(this,[].map.call(arguments,(function(e){return n(e,r)})))}catch(a){var o=Fq(a);throw o&&e({error:o,source:i}),a}});return o._hook_=!0,o}void 0===t&&(t=Pq()),void 0===r&&(r=function(){if("function"==typeof XMLHttpRequest&&Cq(XMLHttpRequest))return XMLHttpRequest}());var i=[];return t&&i.push.apply(i,Iq([],Tq(zq.filter((function(e){return t[e]})).map((function(e){return Nq(t,e,(function(t){return function(r){for(var i=[],o=1;o<arguments.length;o++)i[o-1]=arguments[o];return t&&t.call.apply(t,Iq([this,n(r,{function:e})],Tq(i),!1))}}),!1)()}))),!1)),r&&r.prototype&&i.push(Nq(r.prototype,"send",(function(e){return function(){for(var t=this,r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];return i.push.apply(i,Iq([],Tq(Xq.filter((function(e){return t[e]&&!t[e]._hook_})).map((function(e){var r=Nq(t,e,(function(t){return n(t,{function:e})}),!1)();return function(){r(),t[e]._hook_=void 0}}))),!1)),e.apply(this,r)}}),!1)()),Hq.forEach((function(e){var r=t[e]&&t[e].prototype;r&&r.addEventListener&&(i.push(Nq(r,Kq,(function(t){return function(r,i,o){try{var a=i.handleEvent;Cq(a)&&(i.handleEvent=n(a,{function:"handleEvent",target:e}))}catch(s){}return t&&t.call(this,r,n(i,{function:Kq,target:e}),o)}}),!1)()),i.push(Nq(r,"removeEventListener",(function(e){return function(t,r,n){return null!=r&&r._w_&&e.call(this,t,r._w_,n),e.call(this,t,r,n)}}),!1)()))})),i},Wq=function(e,t){return e&&t&&e===t},Yq=function(){var e;return function(t){try{if(function(e,t){return!!(e&&t&&Wq(e.message,t.message)&&Wq(e.stack,t.stack))}(t,e))return void(e=t)}catch(r){Lq(r)}return e=t}},Jq=function(e){if(e=void 0===e?Pq():e)return function(t,r){var n,i,o=t.ignoreErrors,a=t.onerror,s=t.onunhandledrejection,c=t.dedupe,u=(t=t.captureGlobalAsync,xq(o)),d=[],l=Yq(),h=function(e){var t=e.error,n=e.extra,i=e.react;e=e.source,t=c?l(t):t;r&&t&&(u&&u.test(t.message)||r({ev_type:"js_error",payload:{error:t,breadcrumbs:[],extra:n,react:i,source:e}}))};return a&&(e.addEventListener("error",n=function(e){return h({error:Bq(e),source:{type:"onerror"}})}),d.push((function(){return e.removeEventListener("error",n)}))),s&&(e.addEventListener("unhandledrejection",i=function(e){return h({error:jq(e),source:{type:"onunhandledrejection"}})}),d.push((function(){return e.removeEventListener("unhandledrejection",i)}))),t&&d.push.apply(d,Iq([],Tq(qq(h)),!1)),[function(e,t,r){return h({error:Gq(e),extra:t,react:r,source:{type:"manual"}})},function(){d.forEach((function(e){return e()}))}]}},Qq="jsError",Zq={ignoreErrors:[],onerror:!0,onunhandledrejection:!0,captureGlobalAsync:!1,dedupe:!0};function $q(e){e.on("init",(function(){window.removeEventListener("error",e.pcErr,!0),window.removeEventListener("unhandledrejection",e.pcRej,!0);var t,r=Uq(e,Qq,Zq);r&&(r=(t=Tq(function(e,t,r,n){void 0===t&&(t={}),void 0===n&&(n=[]);try{var i=e.apply(void 0,Iq([],Tq(n),!1));return i&&i(t,r)||[]}catch(o){return Lq(o),[]}}(Jq,r,(function(t){e.getBreadcrumbs&&(t.payload.breadcrumbs=e.getBreadcrumbs()),e.report(t)})),2))[0],t=t[1],e.on("beforeDestroy",t),e.provide("captureException",r))}))}var eW=Eq.jsErrorPlugin=function(){return{name:Qq,setup:function(e){$q(e)}}},tW={};Object.defineProperty(tW,"__esModule",{value:!0});var rW=function(){return(rW=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function nW(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(n=o.next()).done;)a.push(n.value)}catch(s){i={error:s}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a}function iW(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||((n=n||Array.prototype.slice.call(t,0,i))[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}var oW=function(){return{}};function aW(e){return"object"==a(e)&&null!==e}function sW(e){return"function"==typeof e}var cW=function(e,t,r,n){return void 0===n&&(n=!0),function(){for(var i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];if(!e)return oW;var a=e[t],s=r.apply(void 0,iW([a],nW(i),!1)),c=s;return sW(c)&&n&&(c=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];try{return s.apply(this,e)}catch(r){return sW(a)&&a.apply(this,e)}}),e[t]=c,function(r){r||(c===e[t]?e[t]=a:s=a)}}};function uW(){if("object"==("undefined"==typeof window?"undefined":a(window))&&aW(window))return window}var dW=function(e){if(e)return e.__SLARDAR_REGISTRY__||(e.__SLARDAR_REGISTRY__={Slardar:{plugins:[],errors:[],subject:{}}}),e.__SLARDAR_REGISTRY__.Slardar},lW=function(e,t,r,n){void 0===t&&(t={}),void 0===n&&(n=[]);try{var i=e.apply(void 0,iW([],nW(n),!1));return i&&i(t,r)||[]}catch(o){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=dW(uW());r&&(r.errors||(r.errors=[]),r.errors.push(e))}(o),[]}};function hW(e){var t=function(){if("object"==("undefined"==typeof document?"undefined":a(document))&&aW(document))return document}();return t&&e?((t=t.createElement("a")).href=e,"/"!==(e=t.pathname||"/")[0]&&(e="/"+e),{url:t.href,protocol:t.protocol.slice(0,-1),domain:t.hostname,query:t.search.substring(1),path:e,hash:t.hash}):{url:e,protocol:"",domain:"",query:"",path:"",hash:""}}function fW(e,t,r){return function(e,t){return aW(e)?rW(rW({},t),e):!!e&&t}(t=null===(e=e.config())||void 0===e?void 0:e.plugins[t],r)}var pW=["hash_0",function(e,t){var r,n=uW();n&&(n.addEventListener("hashchange",r=function(){return e(location.href)},!0),t((function(){return n.removeEventListener("hashchange",r,!0)})))}],vW=["history_0",function(e,t){var r,n,i,o=uW()&&window.history;o&&(n=function(){return e(location.href)},(r=[]).push(cW(o,"pushState",i=function(e){return function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];try{e.apply(o,t)}finally{n()}}})(),cW(o,"replaceState",i)()),window.addEventListener("popstate",n,!0),r.push((function(){return window.removeEventListener("popstate",n,!0)})),t((function(){r.forEach((function(e){return e()}))})))}],_W=function(e,t){if(void 0===e&&(e=uW()),void 0===t&&(t=uW()&&window.location),e&&t)return function(e,r){var n,i,o,a=e.sendInit,s=e.initPid,c=e.routeMode,u=e.extractPid,d=e.onPidUpdate,l=(e=e.createObserver,[]),h="manual"===c?function(){return""}:function(e){return function(t){var r;return"hash"===e?(null===(r=hW(t).hash)||void 0===r?void 0:r.replace(/^#/,""))||"/":hW(t).path}}(c),f=u||function(){},p=(s=nW(function(e,t,r,n){var i=r,o=t;return n&&n(t),[function(t,r,a){"user_set"!==t&&r!==i?(i=r,o=null!=a?a:i,n&&n(o),e(t,o)):"user_set"===t&&r!==o&&(o=r,n&&n(o),e(t,o))},function(){t&&e("init",t)}]}((function(e,t){r&&r({ev_type:"pageview",payload:{pid:t,source:e}})}),s||(n=t.href,null!==(i=f(n))&&void 0!==i?i:h(n)),h(t.href),d),2),s[0]);d=s[1],s=p.bind(null,"user_set");return"manual"!==c&&(o=nW(function(e,t){var r=t;return[function(t,n){n!==r&&e(t,r=n)}]}((function(e,t){return p(e,h(t),f(t))}),""),1)[0],e=nW(e(c),1)[0],l.push(e((function(e){return o(c,e)})))),a&&d(),[s,function(){l.forEach((function(e){return e()}))}]}},mW="pageview",yW={sendInit:!0,routeMode:"history"};var gW=tW.pageviewPlugin=function(){return{name:mW,setup:function(e){var t;(t=e).on("init",(function(){var e,r=fW(t,mW,yW);r&&(r=nW(lW(_W,rW(rW({},r),{initPid:null===(r=t.config())||void 0===r?void 0:r.pid,onPidUpdate:function(e){t.set({pid:e,viewId:e+"_"+Date.now(),actionId:void 0})},createObserver:function(e){return t.initSubject("hash"===e?pW:vW)}}),t.report.bind(t)),2),e=r[0],r=r[1],t.on("config",(function(){e(t.config().pid)})),t.on("beforeDestroy",r),t.provide("sendPageview",e))}))}}};if(!vP()&&!window.__rtc_slardar__){var SW=mK();SW("init",{aid:432410,token:"d7271e1eac254529abcffc63e36b02c3",integrations:[gW(),eW(),hK({screenshot:!1})]}),SW("start"),window.__rtc_slardar__=SW}var bW,EW=new(function(){function e(){u(this,e)}return l(e,[{key:"setStats",value:function(e){!vP()&&window.__rtc_slardar__&&Object.keys(e).forEach((function(t){window.__rtc_slardar__("context.set",t,e[t])}))}}]),e}()),kW=function(){function e(t,r){u(this,e),h(this,"_audioEventSessionId",xP()),h(this,"_videoEventSessionId",xP()),h(this,"_handler",void 0),h(this,"_stream",void 0),h(this,"_firstAudioFrameTimer",void 0),h(this,"_firstVideoFrameTimer",void 0),h(this,"_transportDelayInterval",void 0),h(this,"_transportDelay",void 0),h(this,"_firstVideoFrameInterval",void 0),h(this,"_firstAudioFrameInterval",void 0),h(this,"_isScreen",!1),h(this,"_audioFirstFrameState",0),h(this,"_videoFirstFrameState",0),h(this,"_timeout",1e4),h(this,"_currentAudioRecv",{startTime:0,eventSessionId:0,type:IB.LOGIN}),h(this,"_currentVideoRecv",{startTime:0,eventSessionId:0,type:IB.LOGIN}),h(this,"_login",!1),h(this,"_unMuteAudio",!1),h(this,"_enableAudio",!1),h(this,"_unMuteVideo",!1),h(this,"_enableVideo",!1),h(this,"_remoteUnmuteAudio",!1),h(this,"_remoteUnmuteVideo",!1),h(this,"_audioExternal",!1),h(this,"_pushAudio",!1),h(this,"_videoExternal",!1),h(this,"_pushVideo",!1),h(this,"_autoSubscribeVideo",!1),h(this,"_autoSubscribeAudio",!1),h(this,"_autoSubscribe",!1),h(this,"_publishVideo",!1),h(this,"_publishAudio",!1),h(this,"_subscribeAudio",!1),h(this,"_subscribeVideo",!1),h(this,"_subscribe",!1),h(this,"_pushTrack",!1),h(this,"_multiChatMode",!1),this._stream=t,this._handler=r,this.getTransportDelay()}var t,r,n,i;return l(e,[{key:"beginRecvFrame",value:(i=c(o().mark((function e(t,r){var n,i,a,s,c,u,d,l,h,f,p,v,_,m=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getTransportDelay();case 2:n=this._transportDelay,i=!0,a=IB.LOGIN,s=IB.UNMUTE,c=IB.SUBSCRIBE,u=IB.PUSH_TRACK,[a,s,c,u].indexOf(r)>=0&&(n=0,i=!1),t===TB.AUDIO?(i||this._audioEventSessionId++,this._currentAudioRecv={startTime:Date.now(),eventSessionId:this._audioEventSessionId,type:r},h={media_type:t,event_type:kB.BEGIN_RECV,type:r,start:null===(d=this._currentAudioRecv)||void 0===d?void 0:d.startTime,event_session_id:this._audioEventSessionId,stream_user_id:null===(l=this._stream)||void 0===l?void 0:l.userId,transport_delay:n},this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),this._firstAudioFrameTimer=window.setTimeout((function(){m.stopRecvFrame(TB.AUDIO,AB.TIMEOUT),m._firstAudioFrameInterval&&window.clearInterval(m._firstAudioFrameInterval)}),this._timeout),MB.rtcFirstFrame(h),this._watchForFirstAudioFrameRecv(),this._audioFirstFrameState=1,this._login=!0,this._unMuteAudio=!0,this._enableAudio=!0,this._remoteUnmuteAudio=!0):t===TB.VIDEO&&(i||this._videoEventSessionId++,this._currentVideoRecv={startTime:Date.now(),eventSessionId:this._videoEventSessionId,type:r},_={media_type:null!==(f=this._stream)&&void 0!==f&&f.isScreen?TB.SCREEN_VIDEO:t,event_type:kB.BEGIN_RECV,type:r,start:null===(p=this._currentVideoRecv)||void 0===p?void 0:p.startTime,event_session_id:this._videoEventSessionId,stream_user_id:null===(v=this._stream)||void 0===v?void 0:v.userId,transport_delay:n},this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),this._firstVideoFrameTimer=window.setTimeout((function(){m.stopRecvFrame(TB.VIDEO,AB.TIMEOUT),m._firstVideoFrameInterval&&window.clearInterval(m._firstVideoFrameInterval)}),this._timeout),this._watchForFirstVideoFrameRecv(),MB.rtcFirstFrame(_),this._videoFirstFrameState=1,this._login=!0,this._unMuteVideo=!0,this._enableVideo=!0,this._remoteUnmuteVideo=!0);case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return i.apply(this,arguments)})},{key:"stopRecvFrame",value:function(e,t){if(e===TB.AUDIO){var r,n,i;if(1!==this._audioFirstFrameState)return;var o={event_type:kB.RECV_END,media_type:e,start:null===(r=this._currentAudioRecv)||void 0===r?void 0:r.startTime,reason:t,result:!1,stream_user_id:null===(n=this._stream)||void 0===n?void 0:n.userId,event_session_id:this._audioEventSessionId,type:null===(i=this._currentAudioRecv)||void 0===i?void 0:i.type};this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),delete this._currentAudioRecv,MB.rtcFirstFrame(o),this._audioFirstFrameState=2}else if(e===TB.VIDEO){var a,s,c,u;if(1!==this._videoFirstFrameState)return;var d={event_type:kB.RECV_END,media_type:null!==(a=this._stream)&&void 0!==a&&a.isScreen?TB.SCREEN_VIDEO:e,start:null===(s=this._currentVideoRecv)||void 0===s?void 0:s.startTime,reason:t,result:!1,stream_user_id:null===(c=this._stream)||void 0===c?void 0:c.userId,event_session_id:this._videoEventSessionId,type:null===(u=this._currentVideoRecv)||void 0===u?void 0:u.type};this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),delete this._currentVideoRecv,MB.rtcFirstFrame(d),this._videoFirstFrameState=2}}},{key:"recvFrameFinish",value:(n=c(o().mark((function e(t){var r,n,i,a,s,c,u,d,l,h,f,p,v,_,m,y;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getTransportDelay();case 2:if(r=this._transportDelay,n=IB.LOGIN,i=IB.UNMUTE,a=IB.SUBSCRIBE,s=IB.PUSH_TRACK,t!==TB.AUDIO){e.next=18;break}if(1===this._audioFirstFrameState){e.next=7;break}return e.abrupt("return");case 7:if(this._currentAudioRecv){e.next=9;break}return e.abrupt("return");case 9:u=this._currentAudioRecv,d=u.type,l=u.startTime,[n,i,a,s].indexOf(d)>=0&&(r=0),h={event_type:kB.RECV_END,media_type:t,start:l,result:!0,stream_user_id:null===(c=this._stream)||void 0===c?void 0:c.userId,event_session_id:this._audioEventSessionId,type:d,transport_delay:r},delete this._currentAudioRecv,this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),MB.rtcFirstFrame(h),this._audioFirstFrameState=3,e.next=30;break;case 18:if(t!==TB.VIDEO){e.next=30;break}if(1===this._videoFirstFrameState){e.next=21;break}return e.abrupt("return");case 21:if(this._currentVideoRecv){e.next=23;break}return e.abrupt("return");case 23:v=this._currentVideoRecv,_=v.type,m=v.startTime,[n,i,a,s].indexOf(_)>=0&&(r=0),y={event_type:kB.RECV_END,media_type:null!==(f=this._stream)&&void 0!==f&&f.isScreen?TB.SCREEN_VIDEO:t,start:m,result:!0,stream_user_id:null===(p=this._stream)||void 0===p?void 0:p.userId,event_session_id:this._videoEventSessionId,type:_,transport_delay:r},delete this._currentVideoRecv,this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),MB.rtcFirstFrame(y),this._videoFirstFrameState=3;case 30:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"setLogin",value:function(e){var t,r,n,i,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{audio:!0,video:!0};this._login!==e&&(this._login=e,e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&o.audio&&this.beginRecvFrame(TB.AUDIO,IB.LOGIN),e&&null!==(r=this._stream)&&void 0!==r&&r.hasVideo&&o.video&&this.beginRecvFrame(TB.VIDEO,IB.LOGIN),!e&&null!==(n=this._stream)&&void 0!==n&&n.hasAudio&&this.stopRecvFrame(TB.AUDIO,AB.LEAVE_ROOM),!e&&null!==(i=this._stream)&&void 0!==i&&i.hasVideo&&this.stopRecvFrame(TB.VIDEO,AB.LEAVE_ROOM))}},{key:"setUnmuteAudio",value:function(e){var t;this._unMuteAudio!==e&&(this._unMuteAudio=e,this._unMuteAudio?this.beginRecvFrame(TB.AUDIO,IB.UNMUTE):null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(TB.AUDIO,AB.MUTE))}},{key:"setRemoteUnmuteAudio",value:function(e){var t;this._remoteUnmuteAudio!==e&&(this._remoteUnmuteAudio=e,this._remoteUnmuteAudio?this.beginRecvFrame(TB.AUDIO,IB.REMOTE_UNMUTE):null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(TB.AUDIO,AB.REMOTE_MUTE))}},{key:"setEnableAudio",value:function(e){var t;this._enableAudio!==e&&(this._enableAudio=e,this._enableAudio?this.beginRecvFrame(TB.AUDIO,IB.ENABLE):null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(TB.AUDIO,AB.DISABLE))}},{key:"setUnmuteVideo",value:function(e){var t;this._unMuteVideo!==e&&(this._unMuteVideo=e,this._unMuteVideo?this.beginRecvFrame(TB.VIDEO,IB.UNMUTE):null!==(t=this._stream)&&void 0!==t&&t.hasVideo&&this.stopRecvFrame(TB.VIDEO,AB.MUTE))}},{key:"setRemoteUnmuteVideo",value:function(e){var t;this._remoteUnmuteVideo!==e&&(this._remoteUnmuteVideo=e,this._remoteUnmuteVideo?this.beginRecvFrame(TB.VIDEO,IB.REMOTE_UNMUTE):null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(TB.VIDEO,AB.REMOTE_MUTE))}},{key:"setEnableVideo",value:function(e){this._enableVideo!==e&&(this._enableVideo=e,this._enableVideo?this.beginRecvFrame(TB.VIDEO,IB.ENABLE):this.stopRecvFrame(TB.VIDEO,AB.DISABLE))}},{key:"setExternalAudioSource",value:function(e){this._audioExternal=e}},{key:"setPushAudio",value:function(e){var t;this._audioExternal&&this._pushAudio!==e&&(this._pushAudio=e),this._pushAudio&&this.beginRecvFrame(TB.AUDIO,IB.PUSH),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.beginRecvFrame(TB.AUDIO,IB.PUSH)}},{key:"setExternalVideoSource",value:function(e){this._videoExternal=e}},{key:"setPushVideo",value:function(e){var t;this._videoExternal&&this._pushVideo!==e&&(this._pushVideo=e),this._pushVideo&&this.beginRecvFrame(TB.VIDEO,IB.PUSH),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasVideo&&this.beginRecvFrame(TB.VIDEO,IB.PUSH)}},{key:"setPublishVideo",value:function(e){var t;this._publishVideo!==e&&(this._publishVideo=e),this._publishVideo&&this.beginRecvFrame(TB.VIDEO,IB.PUBLISH),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasVideo&&this.stopRecvFrame(TB.VIDEO,AB.UNPUBLISH)}},{key:"setPublishAudio",value:function(e){var t;this._publishAudio!==e&&(this._publishAudio=e),this._publishAudio&&this.beginRecvFrame(TB.AUDIO,IB.PUBLISH),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(TB.AUDIO,AB.UNPUBLISH)}},{key:"setAutoSubscribe",value:function(e){this._autoSubscribe=e}},{key:"setAutoSubscribeVideo",value:function(e){this._autoSubscribeVideo=e}},{key:"setAutoSubscribeAudio",value:function(e){this._autoSubscribeAudio=e}},{key:"setSubscribeAudio",value:function(e){var t,r;this._autoSubscribeAudio||this._subscribeAudio===e||(this._subscribe=e,e&&null!==(r=this._stream)&&void 0!==r&&r.hasAudio&&this.beginRecvFrame(TB.AUDIO,IB.SUBSCRIBE));!e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(TB.AUDIO,AB.UNSUBSCRIBE)}},{key:"setSubscribeVideo",value:function(e){var t,r;this._autoSubscribeVideo||this._subscribeVideo===e||(this._subscribeVideo=e,e&&null!==(r=this._stream)&&void 0!==r&&r.hasVideo&&this.beginRecvFrame(TB.VIDEO,IB.SUBSCRIBE));!e&&null!==(t=this._stream)&&void 0!==t&&t.hasVideo&&this.stopRecvFrame(TB.VIDEO,AB.UNSUBSCRIBE)}},{key:"setPushTrack",value:function(e){var t;this._pushTrack!==e&&(e&&!this._isScreen&&this.beginRecvFrame(TB.AUDIO,IB.PUSH_TRACK),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(TB.AUDIO,AB.REMOVE_TRACK))}},{key:"setMultiChatMode",value:function(e){this._multiChatMode=e}},{key:"setTimeout",value:function(e){this._timeout=e}},{key:"_watchForFirstVideoFrameRecv",value:function(){var e=this,t=-1,r=-1;this._firstVideoFrameInterval&&window.clearInterval(this._firstVideoFrameInterval),this._firstVideoFrameInterval=window.setInterval(c(o().mark((function n(){var i,a,s,c,u,d,l,h;return o().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(null===(i=e._handler)||void 0===i||!i.pc||null===(a=e._stream)||void 0===a||null===(s=a.videoTrack)||void 0===s||!s.getTrack()){n.next=12;break}return n.next=3,jj(null===(c=e._handler)||void 0===c?void 0:c.pc,null===(u=e._stream)||void 0===u||null===(d=u.videoTrack)||void 0===d?void 0:d.getTrack());case 3:if(l=n.sent,!(h=l.find((function(e){return"inbound-rtp"===e.type})))||!(h.framesReceived>t||h.packetsReceived>r)){n.next=12;break}if(-1!==t||-1!==r){n.next=10;break}return t=h.framesReceived,r=h.packetsReceived,n.abrupt("return");case 10:e.recvFrameFinish(TB.VIDEO),window.clearInterval(e._firstVideoFrameInterval);case 12:case"end":return n.stop()}}),n)}))),200)}},{key:"_watchForFirstAudioFrameRecv",value:function(){var e=this,t=-1,r=-1;this._firstAudioFrameInterval&&window.clearInterval(this._firstAudioFrameInterval),this._firstAudioFrameInterval=window.setInterval(c(o().mark((function n(){var i,a,s,c,u,d,l,h;return o().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(null===(i=e._handler)||void 0===i||!i.pc||null===(a=e._stream)||void 0===a||null===(s=a.audioTrack)||void 0===s||!s.getTrack()){n.next=12;break}return n.next=3,jj(null===(c=e._handler)||void 0===c?void 0:c.pc,null===(u=e._stream)||void 0===u||null===(d=u.audioTrack)||void 0===d?void 0:d.getTrack());case 3:if(l=n.sent,!(h=l.find((function(e){return"inbound-rtp"===e.type})))||!(h.totalSamplesReceived>t||h.packetsReceived>r)){n.next=12;break}if(-1!==t||-1!==r){n.next=10;break}return t=h.totalSamplesReceived,r=h.packetsReceived,n.abrupt("return");case 10:e.recvFrameFinish(TB.AUDIO),window.clearInterval(e._firstAudioFrameInterval);case 12:case"end":return n.stop()}}),n)}))),200)}},{key:"getTransportDelay",value:(r=c(o().mark((function e(){var t=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getTransportDelayIntl();case 2:window.clearInterval(this._transportDelayInterval),this._transportDelayInterval=window.setInterval(c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getTransportDelayIntl();case 2:case"end":return e.stop()}}),e)}))),2e3);case 4:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"getTransportDelayIntl",value:(t=c(o().mark((function e(){var t,r,n,i,a;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null===(t=this._handler)||void 0===t||!t.pc){e.next=7;break}return e.next=3,jj(null===(r=this._handler)||void 0===r?void 0:r.pc);case 3:n=e.sent,i=n.find((function(e){return"transport"===e.type&&"connected"===e.dtlsState})),(a=n.find((function(e){return"candidate-pair"===e.type&&"succeeded"===e.state&&e.id===(null==i?void 0:i.selectedCandidatePairId)})))&&(this._transportDelay=Math.round(1e3*a.currentRoundTripTime/2));case 7:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"reset",value:function(){this._currentAudioRecv={startTime:0,eventSessionId:0,type:IB.LOGIN},this._currentVideoRecv={startTime:0,eventSessionId:0,type:IB.LOGIN},this._login=!1,this._unMuteAudio=!1,this._enableAudio=!1,this._unMuteVideo=!1,this._remoteUnmuteAudio=!1,this._remoteUnmuteVideo=!1,this._enableVideo=!1,this._audioExternal=!1,this._pushAudio=!1,this._videoExternal=!1,this._pushVideo=!1,this._autoSubscribeVideo=!1,this._autoSubscribeAudio=!1,this._autoSubscribe=!1,this._subscribeAudio=!1,this._subscribeVideo=!1,this._subscribe=!1,this._pushTrack=!1,this._multiChatMode=!1,this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),this._firstAudioFrameInterval&&window.clearInterval(this._firstAudioFrameInterval),this._firstVideoFrameInterval&&window.clearInterval(this._firstVideoFrameInterval),this._transportDelayInterval&&window.clearInterval(this._transportDelayInterval)}}]),e}(),TW=function(){function e(t,r){u(this,e),h(this,"_audioEventSessionId",xP()),h(this,"_videoEventSessionId",xP()),h(this,"_pcSessionId",void 0),h(this,"_handler",void 0),h(this,"_firstAudioFrameTimer",void 0),h(this,"_firstVideoFrameTimer",void 0),h(this,"_stream",void 0),h(this,"_firstVideoFrameInterval",void 0),h(this,"_firstAudioFrameInterval",void 0),h(this,"_currentAudioSend",{startTime:0,eventSessionId:0,type:IB.LOGIN}),h(this,"_currentVideoSend",{startTime:0,eventSessionId:0,type:IB.LOGIN}),h(this,"_login",!1),h(this,"_publisher",!1),h(this,"_unMuteAudio",!1),h(this,"_enableAudio",!1),h(this,"_unMuteVideo",!1),h(this,"_enableVideo",!1),h(this,"_audioExternal",!1),h(this,"_pushAudio",!1),h(this,"_videoExternal",!1),h(this,"_pushVideo",!1),h(this,"_autoPublish",!1),h(this,"_publish",!1),h(this,"_timeout",1e4),h(this,"_audioFirstFrameState",0),h(this,"_videoFirstFrameState",0),this._stream=t,this._handler=r}var t,r;return l(e,[{key:"beginSendFrame",value:function(e,t){var r=this;if(e===TB.AUDIO){var n;this._audioEventSessionId++,this._currentAudioSend={startTime:Date.now(),eventSessionId:this._audioEventSessionId,type:t};var i={media_type:e,event_type:kB.BEGIN_SEND,type:t,start:null===(n=this._currentAudioSend)||void 0===n?void 0:n.startTime,event_session_id:this._audioEventSessionId};this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),this._firstAudioFrameTimer=window.setTimeout((function(){r.stopSendFrame(TB.AUDIO,AB.TIMEOUT),r._firstAudioFrameInterval&&window.clearInterval(r._firstAudioFrameInterval)}),this._timeout),MB.rtcFirstFrame(i),this._watchForFirstAudioFrameSend(),this._audioFirstFrameState=1,this._login=!0,this._publisher=!0,this._publish=!0,this._unMuteAudio=!0,this._pushAudio||(this._enableAudio=!0)}else if(e===TB.VIDEO){var o,a;this._videoEventSessionId++,this._currentVideoSend={startTime:Date.now(),eventSessionId:this._videoEventSessionId,type:t};var s={media_type:null!==(o=this._stream)&&void 0!==o&&o.isScreen?TB.SCREEN_VIDEO:e,event_type:kB.BEGIN_SEND,type:t,start:null===(a=this._currentVideoSend)||void 0===a?void 0:a.startTime,event_session_id:this._videoEventSessionId};this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),this._firstVideoFrameTimer=window.setTimeout((function(){r.stopSendFrame(TB.VIDEO,AB.TIMEOUT),r._firstVideoFrameInterval&&window.clearInterval(r._firstVideoFrameInterval)}),this._timeout),this._watchForFirstVideoFrameSend(),MB.rtcFirstFrame(s),this._videoFirstFrameState=1,this._login=!0,this._publisher=!0,this._publish=!0,this._unMuteVideo=!0,this._pushVideo||(this._enableVideo=!0)}}},{key:"stopSendFrame",value:function(e,t){if(e===TB.AUDIO){var r,n;if(1!==this._audioFirstFrameState)return;var i={event_type:kB.SENT_END,media_type:e,start:null===(r=this._currentAudioSend)||void 0===r?void 0:r.startTime,reason:t,result:!1,event_session_id:this._audioEventSessionId,type:null===(n=this._currentAudioSend)||void 0===n?void 0:n.type};this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),delete this._currentAudioSend,MB.rtcFirstFrame(i),this._audioFirstFrameState=2}else if(e===TB.VIDEO){var o,a,s;if(1!==this._videoFirstFrameState)return;var c={event_type:kB.SENT_END,media_type:null!==(o=this._stream)&&void 0!==o&&o.isScreen?TB.SCREEN_VIDEO:e,start:null===(a=this._currentVideoSend)||void 0===a?void 0:a.startTime,reason:t,result:!1,event_session_id:this._videoEventSessionId,type:null===(s=this._currentVideoSend)||void 0===s?void 0:s.type};this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),delete this._currentVideoSend,MB.rtcFirstFrame(c),this._videoFirstFrameState=2}}},{key:"sendFrameFinish",value:function(e){if(e===TB.AUDIO){if(1!==this._audioFirstFrameState)return;if(!this._currentAudioSend)return;var t=this._currentAudioSend,r=t.type,n=t.startTime,i={event_type:kB.SENT_END,media_type:e,start:n,result:!0,event_session_id:this._audioEventSessionId,type:r};delete this._currentAudioSend,this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),MB.rtcFirstFrame(i),this._audioFirstFrameState=3}else if(e===TB.VIDEO){var o;if(1!==this._videoFirstFrameState)return;if(!this._currentVideoSend)return;var a=this._currentVideoSend,s=a.type,c=a.startTime,u={event_type:kB.SENT_END,media_type:null!==(o=this._stream)&&void 0!==o&&o.isScreen?TB.SCREEN_VIDEO:e,start:c,result:!0,event_session_id:this._videoEventSessionId,type:s};delete this._currentVideoSend,this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),MB.rtcFirstFrame(u),this._videoFirstFrameState=3}}},{key:"setLogin",value:function(e){if(this._login!==e){var t,r;if(this._login=e,e)null!==(t=this._stream)&&void 0!==t&&t.videoTrack&&this.beginSendFrame(TB.VIDEO,IB.LOGIN),null!==(r=this._stream)&&void 0!==r&&r.audioTrack&&this.beginSendFrame(TB.AUDIO,IB.LOGIN);!e&&this._audioSending&&this.stopSendFrame(TB.AUDIO,AB.LEAVE_ROOM),!e&&this._videoSending&&this.stopSendFrame(TB.VIDEO,AB.LEAVE_ROOM)}}},{key:"setPublish",value:function(e){if(this._publish!==e){var t,r;if(this._publish=e,e)(null===(t=this._stream)||void 0===t?void 0:t.videoTrack)&&this.beginSendFrame(TB.VIDEO,IB.PUBLISH),(null===(r=this._stream)||void 0===r?void 0:r.audioTrack)&&this.beginSendFrame(TB.AUDIO,IB.PUBLISH);!e&&this._audioSending&&this.stopSendFrame(TB.AUDIO,AB.UNPUBLISH),!e&&this._videoSending&&this.stopSendFrame(TB.VIDEO,AB.UNPUBLISH)}}},{key:"setUnmuteAudio",value:function(e){this._unMuteAudio!==e&&(this._unMuteAudio=e,e&&this.beginSendFrame(TB.AUDIO,IB.UNMUTE),!e&&this._audioSending&&this.stopSendFrame(TB.AUDIO,AB.MUTE))}},{key:"setEnableAudio",value:function(e){this._enableAudio!==e&&(this._enableAudio=e,e&&this.beginSendFrame(TB.AUDIO,IB.ENABLE),!e&&this._audioSending&&this.stopSendFrame(TB.AUDIO,AB.DISABLE))}},{key:"setUnmuteVideo",value:function(e){this._unMuteVideo!==e&&(this._unMuteVideo=e,e&&this.beginSendFrame(TB.VIDEO,IB.UNMUTE),!e&&this._videoSending&&this.stopSendFrame(TB.VIDEO,AB.MUTE))}},{key:"setEnableVideo",value:function(e){this._enableVideo!==e&&(this._enableVideo=e,e&&this.beginSendFrame(TB.VIDEO,IB.ENABLE),!e&&this._videoSending&&this.stopSendFrame(TB.VIDEO,AB.DISABLE))}},{key:"setExternalAudioSource",value:function(e){this._audioExternal!==e&&(this._audioExternal=e,e&&(this._audioSending&&this.stopSendFrame(TB.AUDIO,AB.DISABLE),this._enableAudio=!1),e||(this._audioSending&&this.stopSendFrame(TB.AUDIO,AB.STOP_PUSH),this._pushAudio=!1))}},{key:"setPushAudio",value:function(e){this._pushAudio!==e&&(this._pushAudio=e,e&&this.beginSendFrame(TB.AUDIO,IB.PUSH),!e&&this._audioSending&&this.stopSendFrame(TB.AUDIO,AB.STOP_PUSH))}},{key:"setExternalVideoSource",value:function(e){this._videoExternal!==e&&(this._videoExternal=e,e&&(this._videoSending&&this.stopSendFrame(TB.VIDEO,AB.DISABLE),this._enableVideo=!1),e||(this._videoSending&&this.stopSendFrame(TB.VIDEO,AB.STOP_PUSH),this._pushVideo=!1))}},{key:"setPushVideo",value:function(e){this._pushVideo!==e&&(this._pushVideo=e,e&&this.beginSendFrame(TB.VIDEO,IB.PUSH),!e&&this._videoSending&&this.stopSendFrame(TB.VIDEO,AB.STOP_PUSH))}},{key:"setAutoPublish",value:function(e){this._autoPublish=e}},{key:"setPublisher",value:function(e){this._publisher!==e&&(this._publisher=e,!e&&this._audioSending&&this.stopSendFrame(TB.AUDIO,AB.AUDIENCE),!e&&this._videoSending&&this.stopSendFrame(TB.VIDEO,AB.AUDIENCE))}},{key:"setTimeout",value:function(e){this._timeout=e}},{key:"setPCSessionId",value:function(e){this._pcSessionId=e}},{key:"setHandler",value:function(e){this._handler=e}},{key:"_getFirstVideoFrameStats",value:(r=c(o().mark((function e(){var t,r,n,i,a,s,c,u;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null===(t=this._handler)||void 0===t||!t.pc||null===(r=this._stream)||void 0===r||null===(n=r.videoTrack)||void 0===n||!n.getTrack("preprocessing")){e.next=6;break}return e.next=3,jj(null===(i=this._handler)||void 0===i?void 0:i.pc,null===(a=this._stream)||void 0===a||null===(s=a.videoTrack)||void 0===s?void 0:s.getTrack("preprocessing"));case 3:return c=e.sent,u=c.find((function(e){return"outbound-rtp"===e.type})),e.abrupt("return",u);case 6:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"_getFirstAudioFrameStats",value:(t=c(o().mark((function e(){var t,r,n,i,a,s,c,u;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null===(t=this._handler)||void 0===t||!t.pc||null===(r=this._stream)||void 0===r||null===(n=r.audioTrack)||void 0===n||!n.getTrack("preprocessing")){e.next=6;break}return e.next=3,jj(null===(i=this._handler)||void 0===i?void 0:i.pc,null===(a=this._stream)||void 0===a||null===(s=a.audioTrack)||void 0===s?void 0:s.getTrack("preprocessing"));case 3:return c=e.sent,u=c.find((function(e){return"outbound-rtp"===e.type})),e.abrupt("return",u);case 6:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"_watchForFirstVideoFrameSend",value:function(){var e=this,t=-1,r=-1;this._firstVideoFrameInterval&&window.clearInterval(this._firstVideoFrameInterval),this._firstVideoFrameInterval=window.setInterval(c(o().mark((function n(){var i;return o().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,e._getFirstVideoFrameStats();case 2:if(!(i=n.sent)||!(i.framesSent>t||i.packetsSent>r)){n.next=10;break}if(-1!==t||-1!==r){n.next=8;break}return t=i.framesSent,r=i.packetsSent,n.abrupt("return");case 8:e.sendFrameFinish(TB.VIDEO),window.clearInterval(e._firstVideoFrameInterval);case 10:case"end":return n.stop()}}),n)}))),100)}},{key:"_watchForFirstAudioFrameSend",value:function(){var e=this,t=-1;this._firstAudioFrameInterval&&window.clearInterval(this._firstAudioFrameInterval),this._firstAudioFrameInterval=window.setInterval(c(o().mark((function r(){var n;return o().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,e._getFirstAudioFrameStats();case 2:if(!((n=r.sent)&&n.packetsSent>t)){r.next=9;break}if(-1!==t){r.next=7;break}return t=n.packetsSent,r.abrupt("return");case 7:e.sendFrameFinish(TB.AUDIO),window.clearInterval(e._firstAudioFrameInterval);case 9:case"end":return r.stop()}}),r)}))),100)}},{key:"reset",value:function(){this._login=!1,this._publisher=!1,this._unMuteAudio=!1,this._enableAudio=!1,this._unMuteVideo=!1,this._enableVideo=!1,this._audioExternal=!1,this._pushAudio=!1,this._videoExternal=!1,this._pushVideo=!1,this._autoPublish=!1,this._publish=!1,this._audioFirstFrameState=0,this._videoFirstFrameState=0,this._currentAudioSend={startTime:0,eventSessionId:0,type:IB.LOGIN},this._currentVideoSend={startTime:0,eventSessionId:0,type:IB.LOGIN},window.clearTimeout(this._firstAudioFrameTimer),window.clearTimeout(this._firstVideoFrameTimer),window.clearInterval(this._firstAudioFrameInterval),window.clearInterval(this._firstVideoFrameInterval)}},{key:"destroy",value:function(){this.reset(),delete this._stream,delete this._handler}},{key:"_audioSending",get:function(){return 1===this._audioFirstFrameState}},{key:"_videoSending",get:function(){return 1===this._videoFirstFrameState}}]),e}(),IW=(h(bW={},"audio",{delay:1200,stallRadio:.3}),h(bW,"video",{delay:1200,stallRadio:.6}),h(bW,"screen_audio",{delay:1600,stallRadio:.8}),h(bW,"screen_video",{delay:1600,stallRadio:.8}),bW),AW=function(){function e(){u(this,e),h(this,"_preUplinkStats",new Map),h(this,"_preDownlinkStats",new Map),h(this,"_timer",void 0),h(this,"_delayTimer",void 0),h(this,"_connectionState",mX.CONNECTED),h(this,"reportor",void 0)}return l(e,[{key:"updateUplinkStats",value:function(e){var t=e.audioStats,r=e.videoStats,n=e.isScreen;if(t.sendKBitrate>0&&t.rtt){var i=n?"screen_audio":"audio",o=t.rtt,a=t._fractionLost,s=t._retransmittedRate,c=this._getQosLevel(o,a||0,s||0),u=this._preUplinkStats.get(i)||[c];this._preUplinkStats.set(i,[].concat(k(u),[c]).slice(-2))}if(r.sentKBitrate>0&&r.rtt){var d=n?"screen_video":"video",l=r._fractionLost,h=r.rtt,f=r._sendBandWidth,p=r._retransmittedRate;0===f&&(l=Math.max(.65,l));var v=this._getQosLevel(h,l||0,p||0),_=this._preUplinkStats.get(d)||[v];this._preUplinkStats.set(d,[].concat(k(_),[v]).slice(-2))}this._startNetworkQualityReport()}},{key:"updateDownlinkStats",value:function(e,t){if(t){var r,n,i=this._getStreamActiveState(t),o=i.audioActive,a=i.videoActive,s=e.audioStats,c=e.videoStats,u=e.isScreen,d=e.userId;if(o)if(0===s.receivedKBitrate)r=q.VBAD;else{var l=s.rtt,h=s.audioLossRate,f=s.stallDuration,p=s.statsInterval,v=s.e2eDelay,_=f/p,m=u?"screen_audio":"audio",y=this._getQosLevel(l,h||0,c._retransmittedRate||0),g=this._getDownlinkQoE(m,_,v);r=this._getNetworkQuality(y,g)}if(a)if(0===c.receivedKBitrate||0===c.rtt)n=q.VBAD;else{var S=c.rtt,b=c.videoLossRate,E=c.stallDuration,T=c.statsInterval,I=c.e2eDelay,A=c._retransmittedRate,R=E/T,w=u?"screen_video":"video",C=this._getQosLevel(S,b||0,A||0),O=this._getDownlinkQoE(w,R,I);n=this._getNetworkQuality(C,O)}var x=r&&n?Math.ceil((r+n)/2):r||n;if(x){var D="".concat(d).concat(u?"_screen":""),N=this._preDownlinkStats.get(D)||[x];this._preDownlinkStats.set(D,[].concat(k(N),[x]).slice(-2)),this._startNetworkQualityReport()}}}},{key:"setConnectionState",value:function(e){this._connectionState=e}},{key:"destroy",value:function(){this._timer&&(window.clearInterval(this._timer),delete this._timer),this._delayTimer&&(window.clearTimeout(this._delayTimer),delete this._delayTimer),this._preUplinkStats.clear(),this._preDownlinkStats.clear()}},{key:"_startNetworkQualityReport",value:function(){var e=this;this._delayTimer||this._timer||(this._preUplinkStats.size>0||this._preDownlinkStats.size>0)&&(this._delayTimer=window.setTimeout((function(){delete e._delayTimer,e._reportNetworkQuality(),e._timer=window.setInterval((function(){e._reportNetworkQuality()}),2e3)}),300))}},{key:"_reportNetworkQuality",value:function(){var e,t,r=this;if(this._connectionState!==mX.CONNECTED)e=t=q.VBAD;else{var n=this._getBetterQualityAndRemoveOldest("audio","up"),i=this._getBetterQualityAndRemoveOldest("video","up");e=n&&i?Math.ceil((n+i)/2):n||i||this._getBetterQualityAndRemoveOldest("screen_video","up")||this._getBetterQualityAndRemoveOldest("screen_audio","up")||q.EXCELLENT;var o=Array.from(this._preDownlinkStats.keys()).map((function(e){return r._getBetterQualityAndRemoveOldest(e,"down")})).filter((function(e){return e}));t=Math.ceil(o.reduce((function(e,t){return t+e}),0)/o.length)||q.UNKNOWN}"function"==typeof this.reportor&&this.reportor(e,t)}},{key:"_getNetworkQuality",value:function(e,t){return 1===t?Math.max(e-2,1):2===t?e:Math.min(e+1,5)}},{key:"_getQosLevel",value:function(e,t,r){var n;return n=(!e||e<=250)&&t<=.15?1:(!e||e<=500)&&t<=.3?2:(!e||e<=750)&&t<=.45?3:(!e||e<=1e3)&&t<=.6?4:5,r>.5?n=Math.max(n,4):r>.35?n=Math.max(n,3):r>.15&&(n=Math.max(n,2)),n}},{key:"_getUplinkQoE",value:function(e,t){var r=0;switch(e){case"audio":case"video":r=t<.05?1:t<.1?2:3;break;case"screen_video":case"screen_audio":r=t<.04?1:t<.08?2:3}return r}},{key:"_getDownlinkQoE",value:function(e,t,r){var n=IW[e];return t>n.stallRadio||r>n.delay||t>n.stallRadio/2&&r>n.delay/2?3:(t>n.stallRadio/2||n.delay,2)}},{key:"_getBetterQualityAndRemoveOldest",value:function(e,t){var r=q.UNKNOWN,n="up"===t?this._preUplinkStats:this._preDownlinkStats,i=n.get(e);if(i){var o=i.filter((function(e){return e}));o.length>0&&(r=Math.min.apply(Math,k(o))),i.shift(),0===i.length&&n.delete(e)}return r}},{key:"_getStreamActiveState",value:function(e){var t=e.subMediaType,r=e._attributes,n=e.subVideo;return{audioActive:e.subAudio&&UP(t)&&r.localaudio&&r.audiostream,videoActive:n&&VP(t)&&r.localvideo&&r.videostream}}}]),e}(),RW=function(){function e(t){u(this,e),h(this,"_timer",void 0),h(this,"_remoteVideoSizeCache",{}),h(this,"_remoteScreenSizeCache",{}),h(this,"onchange",void 0),this._room=t,this._start()}return l(e,[{key:"destroy",value:function(){this._timer&&(window.clearInterval(this._timer),delete this._timer),this._remoteVideoSizeCache={},this._remoteScreenSizeCache={}}},{key:"_start",value:function(){var e=this;this._timer||(this._timer=window.setInterval((function(){var t={},r={};e._room.remoteStreams.forEach((function(n,i){n.forEach((function(n){var o,a=null===(o=n.videoTrack)||void 0===o?void 0:o.getTrack();if(a){var s=n.isScreen?e._remoteScreenSizeCache:e._remoteVideoSizeCache,c=s[i]||{},u=c.width,d=void 0===u?0:u,l=c.height,h=void 0===l?0:l,f=a.getSettings(),p=f.width,v=void 0===p?0:p,_=f.height,m=void 0===_?0:_;h===m&&d===v||"function"==typeof e.onchange&&e.onchange(i,n.isScreen,v,m),delete s[i],(n.isScreen?r:t)[i]={width:v,height:m}}}))})),Object.keys(e._remoteVideoSizeCache).forEach((function(t){"function"==typeof e.onchange&&e.onchange(t,!1,0,0)})),Object.keys(e._remoteScreenSizeCache).forEach((function(t){"function"==typeof e.onchange&&e.onchange(t,!0,0,0)})),e._remoteVideoSizeCache=t,e._remoteScreenSizeCache=r}),1e3))}}]),e}(),wW=new JL("SubscribeFallbackManager",2),CW=1e4,OW=function(){function e(t){u(this,e),h(this,"_preDownlinkNetworkQuality",[]),h(this,"_isSubscribeFallbackOrRecover",!1),h(this,"_inSubscribeRecoverChecking",!1),h(this,"_subRecoverCheckTimer",void 0),h(this,"_forbidSubRecover",!1),h(this,"_forbidSubRecoverTimer",void 0),h(this,"_forbidSubRecoverDuration",CW),h(this,"onSubscribeFallback",void 0),this._room=t}var t;return l(e,[{key:"updateNetworkQuality",value:function(e,t){this._preDownlinkNetworkQuality.push(t),this._preDownlinkNetworkQuality=this._preDownlinkNetworkQuality.slice(-10),this._inSubscribeRecoverChecking&&this._preDownlinkNetworkQuality.find((function(e){return e===q.BAD||e===q.VBAD}))&&this._startForbidSubRecover(),this._preDownlinkNetworkQuality.slice(-3).reduce((function(e,t){return e+t}),0)>3*q.POOR&&this._subscribeFallbackOrRecover("fallback"),!this._forbidSubRecover&&10===this._preDownlinkNetworkQuality.length&&this._preDownlinkNetworkQuality.every((function(e){return e===q.EXCELLENT}))&&this._subscribeFallbackOrRecover("recover")}},{key:"destroy",value:function(){this._stopSubscribeRecoverCheck(),this._stopForbidSubRecover(),delete this.onSubscribeFallback}},{key:"_subscribeFallbackOrRecover",value:(t=c(o().mark((function e(t){var r,n,i,a,s,c,u,d,l,h,f=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._isSubscribeFallbackOrRecover&&this._room.connectionState===mX.CONNECTED){e.next=2;break}return e.abrupt("return");case 2:if(this._room.subscribeFallbackOption!==X.AUDIO_ONLY&&this._room.subscribeFallbackOption!==X.VIDEO_STREAM_LOW){e.next=24;break}if(r=new Map,this._room.remoteStreams.forEach((function(e){e.forEach((function(e){if(e.hasSubscribed){var n="fallback"===t?e.getSubscribeFallbackParams(f._room.subscribeFallbackOption):e.getSubscribeRecoverParams();if(n){var i=e.getStreamPriority(),o=r.get(i)||[];o.push({stream:e,fallbackOrRecoverOption:n}),r.set(i,o)}}}))})),!(r.size>0)){e.next=24;break}if(wW.print("_subscribeFallbackOrRecover()","start subscribe ".concat(t,".")),n=Array.from(r.keys()).sort((function(e,t){return e-t}))["fallback"===t?0:r.size-1],i=r.get(n)||[],a=E(i,1),!(s=a[0])){e.next=24;break}return c=s.stream,u=s.fallbackOrRecoverOption,this._isSubscribeFallbackOrRecover=!0,d=c.subLayer.spatialLayer,l=c.subVideo,wW.print("_subscribeFallbackOrRecover()","".concat(c.userId,"'s stream will be ").concat(t," to: MediaType=").concat(u[0]," subState=").concat(u[1]," subLayer=%o"),u[2]),e.prev=15,e.next=18,MP([(h=this._room).updateSubTrack.apply(h,[c].concat(k(u))),mP(4e3)]).then((function(){"recover"===t?f._startSubscribeRecoverCheck():wW.print("_subscribeFallbackOrRecover()","fallback success."),"function"==typeof f.onSubscribeFallback&&f.onSubscribeFallback({userId:c.userId,isScreen:c.isScreen,beforeEnable:l,beforeVideoIndex:d,afterEnable:c.subVideo,afterVideoIndex:c.subLayer.spatialLayer,reason:"fallback"===t?W.SubscribeFallbackByBandwidth:W.SubscribeRecoverByBandwidth})}));case 18:e.next=22;break;case 20:e.prev=20,e.t0=e.catch(15);case 22:this._preDownlinkNetworkQuality=[],this._isSubscribeFallbackOrRecover=!1;case 24:case"end":return e.stop()}}),e,this,[[15,20]])}))),function(e){return t.apply(this,arguments)})},{key:"_startSubscribeRecoverCheck",value:function(){var e=this;this._stopSubscribeRecoverCheck(),this._inSubscribeRecoverChecking=!0,this._subRecoverCheckTimer=window.setTimeout((function(){e._inSubscribeRecoverChecking=!1,e._forbidSubRecoverDuration=CW,delete e._subRecoverCheckTimer,wW.print("_subscribeFallbackOrRecover()","recover success.")}),2e4)}},{key:"_stopSubscribeRecoverCheck",value:function(){this._subRecoverCheckTimer&&(window.clearTimeout(this._subRecoverCheckTimer),delete this._subRecoverCheckTimer),this._inSubscribeRecoverChecking=!1}},{key:"_startForbidSubRecover",value:function(){var e=this;this._stopSubscribeRecoverCheck(),this._stopForbidSubRecover(),this._forbidSubRecoverDuration=Math.min(this._forbidSubRecoverDuration+2e4,12e4),wW.print("_subscribeFallbackOrRecover()","subscribe-recover failed, and subscribe-recover not allowed within ".concat(this._forbidSubRecoverDuration/1e3,"s")),this._forbidSubRecover=!0,this._forbidSubRecoverTimer=window.setTimeout((function(){e._forbidSubRecover=!1,delete e._forbidSubRecoverTimer}),this._forbidSubRecoverDuration)}},{key:"_stopForbidSubRecover",value:function(){this._forbidSubRecoverTimer&&(window.clearTimeout(this._forbidSubRecoverTimer),delete this._forbidSubRecoverTimer)}}]),e}(),xW=new JL("Room",1),DW={audiostream:!0,extaudio:!1,extvideo:!1,localaudio:!0,localvideo:!1,videoDescriptions:[],videostream:!1},NW=function(e){f(P,e);var t,r,n,a,s,d,p,v,_,y,S,b,k,T,I,R,w,O,x,D=g(P);function P(e,t){var r;return u(this,P),h(m(r=D.call(this)),"_mediaServerClient",void 0),h(m(r),"_localStream",void 0),h(m(r),"_localScreenStream",void 0),h(m(r),"_remoteUsers",new Map),h(m(r),"_remoteStreams",new Map),h(m(r),"_remoteStreamStreamIdUserIdMap",{}),h(m(r),"_virtualStreams",[]),h(m(r),"_joinResolveCallback",void 0),h(m(r),"_joinRejectCallback",void 0),h(m(r),"_getAccessNode",void 0),h(m(r),"_getAccessFeedback",void 0),h(m(r),"_getAccessFeedbackIceNode",void 0),h(m(r),"_reconnectTimer",void 0),h(m(r),"_isReconnecting",void 0),h(m(r),"_context",void 0),h(m(r),"_sessionId",void 0),h(m(r),"_reconnectRecord",void 0),h(m(r),"_connectionLostTimer",void 0),h(m(r),"_liveControlMessage",void 0),h(m(r),"_serverConfig",void 0),h(m(r),"_liveTranscodingOnceSucc",!1),h(m(r),"_roomConfig",void 0),h(m(r),"_roomInfo",void 0),h(m(r),"_waitForNewToken",!1),h(m(r),"_userDuplicateLoginTimerMap",new Map),h(m(r),"_networkQualityManager",void 0),h(m(r),"userPriorityMap",void 0),h(m(r),"subscribeFallbackOption",void 0),h(m(r),"_videoSizeObserver",void 0),h(m(r),"_subFallbackManager",void 0),h(m(r),"_hasPublished",!1),h(m(r),"_csrcUserIdMap",void 0),r._roomConfig=e,r._mediaServerClient=new gX(t),r._reconnectRecord=new PW,r._addHandlerEventHandler(),r._isReconnecting=!1,r._networkQualityManager=new AW,r._networkQualityManager.reportor=r._reportNetworkQuality.bind(m(r)),r._videoSizeObserver=new RW(m(r)),r._videoSizeObserver.onchange=r._emitVideoSizeChange.bind(m(r)),r._subFallbackManager=new OW(m(r)),r._subFallbackManager.onSubscribeFallback=r._emitSubscribeFallback.bind(m(r)),r._context=t,r._csrcUserIdMap={},r}return l(P,[{key:"hasScreenPublished",get:function(){var e;return null===(e=this._localScreenStream)||void 0===e?void 0:e.hasPublished}},{key:"hasPublished",get:function(){var e;return null===(e=this._localStream)||void 0===e?void 0:e.hasPublished}},{key:"connectionState",get:function(){return this._mediaServerClient.connectionState}},{key:"remoteUsers",get:function(){return this._remoteUsers}},{key:"remoteStreams",get:function(){return this._remoteStreams}},{key:"localStream",get:function(){return this._localStream}},{key:"localScreenStream",get:function(){return this._localScreenStream}},{key:"roomInfo",get:function(){return this._roomInfo}},{key:"_addHandlerEventHandler",value:function(){var e,t,r,n,i,o,a,s,c,u,d,l,h,f,p,v,_,m,y,g,S,b,E,k,T,I,A,R,w,C,O,x=this;null===(e=this._mediaServerClient)||void 0===e||e.on(pj.ON_ADD_STREAM,this._onAddStream.bind(this)),null===(t=this._mediaServerClient)||void 0===t||t.on(pj.ON_ADD_STREAM_LIST,(function(e){Array.isArray(null==e?void 0:e.streamList)&&e.streamList.forEach((function(e){return x._onAddStream(e)}))})),null===(r=this._mediaServerClient)||void 0===r||r.on(pj.ON_REMOVE_STREAM,this._onRemoveStream.bind(this)),null===(n=this._mediaServerClient)||void 0===n||n.on(pj.ON_REMOVE_STREAM_LIST,(function(e){Array.isArray(null==e?void 0:e.streamList)&&e.streamList.forEach((function(e){return x._onRemoveStream(e)}))})),null===(i=this._mediaServerClient)||void 0===i||i.on(pj.USER_CONNECTION,this._onUserConnection.bind(this)),null===(o=this._mediaServerClient)||void 0===o||o.on(pj.USER_CONNECTION_LIST,(function(e){Array.isArray(null==e?void 0:e.userList)&&e.userList.forEach((function(e){return x._onUserConnection(e)}))})),null===(a=this._mediaServerClient)||void 0===a||a.on(pj.USER_DISCONNECTION,this._onUserDisconnection.bind(this)),null===(s=this._mediaServerClient)||void 0===s||s.on(pj.USER_DISCONNECTION_LIST,(function(e){Array.isArray(null==e?void 0:e.userList)&&e.userList.forEach((function(e){return x._onUserDisconnection(e)}))})),null===(c=this._mediaServerClient)||void 0===c||c.on(pj.ON_UPDATE_ROOM_ATTRIBUTES,this._onUpdateRoomAttributes.bind(this)),null===(u=this._mediaServerClient)||void 0===u||u.on(pj.ON_UPDATE_USER_ATTRIBUTES,this._onUpdateUserAttributes.bind(this)),null===(d=this._mediaServerClient)||void 0===d||d.on(pj.ON_UPDATE_STREAM_ATTRIBUTES,this._onUpdateStreamAttributes.bind(this)),null===(l=this._mediaServerClient)||void 0===l||l.on(pj.ON_PUSH_TRACK,this._onPushTrack.bind(this)),null===(h=this._mediaServerClient)||void 0===h||h.on(pj.ON_REMOVE_TRACK,this._onRemoveTrack.bind(this)),null===(f=this._mediaServerClient)||void 0===f||f.on(pj.NODE_CHANGE,this._nodeChange.bind(this)),null===(p=this._mediaServerClient)||void 0===p||p.on(pj.ON_CUSTOM_MESSAGE,this._onCustomMessage.bind(this)),null===(v=this._mediaServerClient)||void 0===v||v.on(pj.USER_MESSAGE_RECEIVED,this._onUserMessageReceived.bind(this)),null===(_=this._mediaServerClient)||void 0===_||_.on(pj.USER_BINARY_MESSAGE_RECEIVED,this._onUserBinaryMessageReceived.bind(this)),null===(m=this._mediaServerClient)||void 0===m||m.on(pj.POST_PROCESSING_MESSAGE,this._onPostProcessingMessage.bind(this)),null===(y=this._mediaServerClient)||void 0===y||y.on(pj.ON_USER_TOKEN_WILL_EXPIRE,this._onUserTokenWillExpire.bind(this)),null===(g=this._mediaServerClient)||void 0===g||g.on(pj.STREAM_CONTROL_MESSAGE,this._onStreamControlMessage.bind(this)),null===(S=this._mediaServerClient)||void 0===S||S.on(pj.ON_SCENE_CONFIG,this._onSceneConfig.bind(this)),null===(b=this._mediaServerClient)||void 0===b||b.on(pj.ON_STREAM_FAILED,this._onStreamFailed.bind(this)),null===(E=this._mediaServerClient)||void 0===E||E.on(vj.RSCP,this._onPublishOnDemand.bind(this)),null===(k=this._mediaServerClient)||void 0===k||k.on(vj.RTT,this._onRTT.bind(this)),null===(T=this._mediaServerClient)||void 0===T||T.on(_j.ON_CONNECTION_STATE_CHANGE,this._onConnectionStateChange.bind(this)),null===(I=this._mediaServerClient)||void 0===I||I.on(_j.ABNORMAL_DISCONNECTION,this._handleAbnormalDisconnection.bind(this)),null===(A=this._mediaServerClient)||void 0===A||A.on(pj.ON_SPEAKER_CHANGE,this._onMeetingSpeakerChange.bind(this)),null===(R=this._mediaServerClient)||void 0===R||R.on("onRemoteStreamStats",(function(e){x._networkQualityManager.updateDownlinkStats(e,x._findRemoteStreamByScreen(e.userId,e.isScreen)),x.emit(Gz.ON_REMOTE_STREAM_STATS,FP(e))})),null===(w=this._mediaServerClient)||void 0===w||w.on("onLocalStreamStats",(function(e){x._networkQualityManager.updateUplinkStats(e),x.emit(Gz.ON_LOCAL_STREAM_STATS,FP(e))})),null===(C=this._mediaServerClient)||void 0===C||C.on("prevIceNode",(function(e){x._getAccessFeedbackIceNode=e})),null===(O=this._mediaServerClient)||void 0===O||O.on("prevIceNode",(function(e){x._getAccessFeedbackIceNode=e}))}},{key:"_removeHandlerEventHandler",value:function(){var e;null===(e=this._mediaServerClient)||void 0===e||e.removeAllListeners()}},{key:"join",value:(x=c(o().mark((function e(t,r,n,i,a,s,c){var u=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return VB.setStats({rtc_app_id:t,room_id:r,user_id:i.userId}),EW.setStats({rtc_session_id:t,rtc_room_id:r}),xW.print("join()"),e.abrupt("return",new Promise((function(e,o){var d,l,h=fP();u._joinResolveCallback=function(t){var r;MB.joinRoom(wB.END,h,!0,"",{enable_cloud_proxy:null===(r=u._roomInfo)||void 0===r?void 0:r.useCloudProxy}),e(t)},u._joinRejectCallback=function(e){var t;MB.joinRoom(wB.END,h,!1,e.message,{enable_cloud_proxy:null===(t=u._roomInfo)||void 0===t?void 0:t.useCloudProxy}),o(e)},u._liveControlMessage=a,u._roomInfo={appId:t,roomId:r,token:n,userInfo:i,useCloudProxy:s,roomProfile:u._roomConfig.roomProfileType,expectedIDC:c},u.setSessionId(),MB.joinRoom(wB.BEGIN,h,!1,"",{enable_cloud_proxy:null===(d=u._roomInfo)||void 0===d?void 0:d.useCloudProxy,expectedIDC:null===(l=u._roomInfo)||void 0===l?void 0:l.expectedIDC}),u._join(u._joinResolveCallback,u._joinRejectCallback,!1)})));case 4:case"end":return e.stop()}}),e)}))),function(e,t,r,n,i,o,a){return x.apply(this,arguments)})},{key:"_join",value:(O=c(o().mark((function e(t,r){var n,i,a,s,c=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=c.length>2&&void 0!==c[2]&&c[2],i=fP(),xW.print("_join()"),e.prev=3,e.next=6,this._mediaServerClient.join(this._roomInfo,{node:this._getAccessNode,reason:this._getAccessFeedback,sessionId:this._sessionId,feedbackNode:this._getAccessFeedbackIceNode},n,this._liveControlMessage);case 6:s=e.sent,this._mediaServerClient.roomAttributes=s.roomAttributes,null!==(a=s.roomAttributes)&&void 0!==a&&a.multiChatMode&&this._handleFFAudioTrack(),this._reconnectRecord.clear(),this._joinResolveCallback=void 0,this._joinRejectCallback=void 0,this._getAccessFeedback=void 0,this._getAccessNode=void 0,"function"==typeof t&&t({users:s.clients,streams:s.streams}),this._isReconnecting=!1,MB.rtcJoinRoom(0,"web","web",fP()-i),this._onJoinSucc(s,n),e.next=24;break;case 20:if(e.prev=20,e.t0=e.catch(3),e.t0.code===dN.OPERATION_CANCEL||"function"!=typeof r){e.next=24;break}return e.abrupt("return",r(e.t0));case 24:case"end":return e.stop()}}),e,this,[[3,20]])}))),function(e,t){return O.apply(this,arguments)})},{key:"publishScreen",value:(w=c(o().mark((function e(t,r,n,i,a){var s,c,u,d,l,h,f,p,v,_;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(xW.print("publishScreen()"),this._localScreenStream||(this._localScreenStream=new Wz,this._localScreenStream.isScreen=!0,this._mediaServerClient.handler&&(this._localScreenStream.observer=new TW(this._localScreenStream,this._mediaServerClient.handler))),s=!1,c=!1,u=!1,d=!1,!this._localScreenStream.videoTrack&&r?(r instanceof ez&&(c=!0),s=!0):this._localScreenStream.videoTrack&&!r&&(s=!1),!this._localScreenStream.audioTrack&&n?(n instanceof tz&&(d=!0),u=!0):this._localScreenStream.audioTrack&&!n&&(u=!1),this._localScreenStream.videoTrack=r,this._localScreenStream.audioTrack=n,this._localScreenStream.videoEncodeConfig=t,i&&(UP(i)&&(this._localScreenStream.pubAudio=a===zz.PUB),VP(i)&&(this._localScreenStream.pubVideo=a===zz.PUB),xW.print("publishScreen mediaType","pubAudio: %o, pubVideo: %o",this._localScreenStream.pubAudio,this._localScreenStream.pubVideo)),this._localScreenStream.pubAudio||this._localScreenStream.pubVideo){e.next=18;break}if(null===(l=this._localScreenStream)||void 0===l||!l.hasPublished){e.next=17;break}return e.abrupt("return",this.unpublishScreen());case 17:return e.abrupt("return");case 18:if(this._localScreenStream.hasPublished){e.next=24;break}return null===(h=this._localScreenStream.observer)||void 0===h||h.setPublish(!0),e.next=22,this._mediaServerClient.publish(this._localScreenStream);case 22:e.next=28;break;case 24:return c?null===(f=this._localScreenStream.observer)||void 0===f||f.setPushVideo(s):null===(p=this._localScreenStream.observer)||void 0===p||p.setEnableVideo(s),d?null===(v=this._localScreenStream.observer)||void 0===v||v.setPushAudio(u):null===(_=this._localScreenStream.observer)||void 0===_||_.setEnableAudio(u),e.next=28,this.updatePubScreenTrack();case 28:case"end":return e.stop()}}),e,this)}))),function(e,t,r,n,i){return w.apply(this,arguments)})},{key:"updatePubScreenTrack",value:(R=c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(xW.print("updatePubScreenTrack","Invoke updatePubScreenTrack"),!this._localScreenStream){e.next=4;break}return e.next=4,this._mediaServerClient.updatePubTrack(this._localScreenStream);case 4:case"end":return e.stop()}}),e,this)}))),function(){return R.apply(this,arguments)})},{key:"unpublishScreen",value:(I=c(o().mark((function e(){var t;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(xW.print("unpublish","Invoke unpublishScreen"),!this._localScreenStream){e.next=7;break}return null===(t=this._localScreenStream.observer)||void 0===t||t.setPublish(!1),e.next=5,this._mediaServerClient.unpublish(this._localScreenStream);case 5:this._localScreenStream.clean(),this._localScreenStream=void 0;case 7:case"end":return e.stop()}}),e,this)}))),function(){return I.apply(this,arguments)})},{key:"liveControlMessage",value:(T=c(o().mark((function e(t){var r,n=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return xW.print("controlMessage","Invoke controlMessage"),null===(r=t.transcodeMeta)||void 0===r||r.layout.regions.forEach((function(e){n.roomInfo&&(e.roomID=n.roomInfo.roomId)})),this._liveControlMessage=t,e.next=5,this._mediaServerClient.controlMessage(t);case 5:"stopped"===t.action&&(delete this._liveControlMessage,this._liveTranscodingOnceSucc=!1),this._liveTranscodingOnceSucc=!0;case 7:case"end":return e.stop()}}),e,this)}))),function(e){return T.apply(this,arguments)})},{key:"publicStreamControlMessage",value:(k=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"stopped"===t.action&&delete t.publicStreamMeta,e.next=3,this._mediaServerClient.controlMessage(t);case 3:case"end":return e.stop()}}),e,this)}))),function(e){return k.apply(this,arguments)})},{key:"updateUserAttributes",value:(b=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return xW.print("updateUserAttributes","Invoke updateUserAttributes"),t.role&&this._roomInfo&&(this._roomInfo.userInfo.role=t.role),e.next=4,this._mediaServerClient.updateUserAttributes(t);case 4:case"end":return e.stop()}}),e,this)}))),function(e){return b.apply(this,arguments)})},{key:"publish",value:(S=c(o().mark((function e(t,r,n,i,a,s){var c,u,d,l,h,f,p,v,_,m,y,g,S=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c=S.length>6&&void 0!==S[6]&&S[6],xW.print("publish","Invoke publish"),u=!1,this._localStream||(this._localStream=new Wz,this._mediaServerClient.handler&&(this._localStream.observer=new TW(this._localStream,this._mediaServerClient.handler)),u=!0),this._localStream.videoTrack=n,this._localStream.audioTrack=i,this._localStream.videoEncodeConfig=t,this._localStream.enableSimulcast=r,a&&(UP(a)&&(this._localStream.pubAudio=s===zz.PUB),VP(a)&&(this._localStream.pubVideo=s===zz.PUB),xW.print("publish mediaType","pubAudio: %o, pubVideo: %o",this._localStream.pubAudio,this._localStream.pubVideo)),this._localStream.hasPublished){e.next=26;break}if(this._localStream.pubAudio||this._localStream.pubVideo){e.next=12;break}return e.abrupt("return");case 12:return e.prev=12,c?null===(d=this._localStream.observer)||void 0===d||d.setLogin(!0):u&&(l=!!this._localStream.videoTrack,h=!!this._localStream.audioTrack,f=this._localStream.videoTrack instanceof ez,p=this._localStream.audioTrack instanceof tz,this._roomConfig.isAutoPublish&&!this._hasPublished?(l&&(f?null===(v=this._localStream.observer)||void 0===v||v.setPushVideo(!0):null===(_=this._localStream.observer)||void 0===_||_.setEnableVideo(!0)),h&&(p?null===(m=this._localStream.observer)||void 0===m||m.setPushAudio(!0):null===(y=this._localStream.observer)||void 0===y||y.setEnableAudio(!0))):null===(g=this._localStream.observer)||void 0===g||g.setPublish(!0)),e.next=16,this._mediaServerClient.publish(this._localStream);case 16:this._hasPublished=!0,this.emit(Gz.ON_PUBLISH_RESULT,{isScreen:!1,state:N.PUBLISH_SUCC}),e.next=24;break;case 20:throw e.prev=20,e.t0=e.catch(12),this.emit(Gz.ON_PUBLISH_RESULT,{isScreen:!1,state:N.PUBLISH_FAIL}),e.t0;case 24:e.next=28;break;case 26:return e.next=28,this.updatePubTrack();case 28:case"end":return e.stop()}}),e,this,[[12,20]])}))),function(e,t,r,n,i,o){return S.apply(this,arguments)})},{key:"updatePubTrack",value:(y=c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(xW.print("updatePubTrack","Invoke updatePubTrack"),!this._localStream){e.next=4;break}return e.next=4,this._mediaServerClient.updatePubTrack(this._localStream);case 4:case"end":return e.stop()}}),e,this)}))),function(){return y.apply(this,arguments)})},{key:"unpublish",value:(_=c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(xW.print("unpublish","Invoke unpublish"),!this._localStream){e.next=6;break}return e.next=4,this._mediaServerClient.unpublish(this._localStream);case 4:this._localStream.clean(),this._localStream=void 0;case 6:case"end":return e.stop()}}),e,this)}))),function(){return _.apply(this,arguments)})},{key:"subscribe",value:(v=c(o().mark((function e(t,r,n){var i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return xW.print("subscribe","remoteStream %o",t),i=void 0,n&&(i=this._getSubLayer(n,t)),e.next=5,this._mediaServerClient.subscribe(t,r,i);case 5:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return v.apply(this,arguments)})},{key:"updateSubTrack",value:(p=c(o().mark((function e(t,r,n,i){var a,s;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(xW.print("updateSubTrack","Invoke updateSubTrack"),!i){e.next=4;break}return e.next=4,null===(s=this._mediaServerClient)||void 0===s?void 0:s.updateSubTrackLayer(t,i);case 4:return e.abrupt("return",null===(a=this._mediaServerClient)||void 0===a?void 0:a.updateSubTrack(t,r,n));case 5:case"end":return e.stop()}}),e,this)}))),function(e,t,r,n){return p.apply(this,arguments)})},{key:"updateSubVideoConfig",value:(d=c(o().mark((function e(t,r){var n,i,a,s,c;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((s=this._findRemoteStreamByScreen(t,!1))&&s.hasSubscribed&&!((null==s||null===(n=s.attributes)||void 0===n||null===(i=n.videoDescriptions)||void 0===i?void 0:i.length)<=1)){e.next=3;break}return e.abrupt("return");case 3:return c=this._getSubLayer(r,s),s.originalStreamIndex=c.spatialLayer,e.abrupt("return",null===(a=this._mediaServerClient)||void 0===a?void 0:a.updateSubTrackLayer(s,c));case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return d.apply(this,arguments)})},{key:"_getSubLayer",value:function(e,t){for(var r,n,i,o,a,s=null==t?void 0:t.attributes,c=s.videoDescriptions,u=s.subVideoDescriptions,d=Array.isArray(u)?u:c,l=-1,h=e.width*e.height,f=0;f<(null==d?void 0:d.length);f++){var p,v;if(h>=(null===(p=d[f])||void 0===p?void 0:p.width)*(null===(v=d[f])||void 0===v?void 0:v.height)){l=f;break}}var _=d[0];if(-1===l)_=d[l=d.length-1];else if(0!==l){var m=d[l-1].width*d[l-1].height,y=(m-h)/(m-d[l].width*d[l].height);_=y<.1?d[l-1]:d[l],l=y<.1?l-1:l}return a=null!==(r=null===(n=_)||void 0===n?void 0:n.sub_index)&&void 0!==r?r:-1,{spatialLayer:null!==(i=null===(o=_)||void 0===o?void 0:o.video_index)&&void 0!==i?i:l,spatialSubLayer:a}}},{key:"unsubscribe",value:(s=c(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return xW.print("unsubscribe","Invoke unsubscribe"),e.next=3,this._mediaServerClient.unsubscribe(t,r);case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return s.apply(this,arguments)})},{key:"leave",value:(a=c(o().mark((function e(){var t,r,n,i,a,s,c=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=c.length>0&&void 0!==c[0]&&c[0],xW.print("leave","Invoke leave"),r=fP(),e.prev=3,clearTimeout(this._reconnectTimer),n=A(this._remoteStreams.values());try{for(n.s();!(i=n.n()).done;)a=i.value,Array.isArray(a)&&a.forEach((function(e){var t;null===(t=e.observer)||void 0===t||t.setLogin(!1)}))}catch(o){n.e(o)}finally{n.f()}return this._localStream&&(null===(s=this._localStream.observer)||void 0===s||s.setLogin(!1)),e.next=10,this._mediaServerClient.leave();case 10:this.destroy(),MB.rtcLeaveRoom(0,"",fP()-r),VB.setStats({room_id:void 0,user_id:void 0,rtc_session_id:void 0}),EW.setStats({rtc_room_id:void 0}),e.next=25;break;case 16:if(e.prev=16,e.t0=e.catch(3),e.t0 instanceof hN&&e.t0.code===dN.NOT_CONNECTED_YET&&this._joinRejectCallback&&this._joinRejectCallback(new Error(CB.LEAVE_ROOM)),!t){e.next=23;break}throw e.t0;case 23:this.destroy();case 24:e.t0 instanceof Error&&MB.rtcLeaveRoom(-1,e.t0.message,fP()-r);case 25:case"end":return e.stop()}}),e,this,[[3,16]])}))),function(){return a.apply(this,arguments)})},{key:"setRemoteUserPriority",value:function(e,t){var r,n;null===(r=this.remoteStreams.get(e))||void 0===r||r.forEach((function(e){return e.setRemoteUserPriority(t)})),null===(n=this.userPriorityMap)||void 0===n||n.set(e,t)}},{key:"destroy",value:function(){xW.print("destroy","Invoke destroy"),this._destroyAndInitMediaServerClient(),this._roomInfo=void 0,this._remoteUsers=new Map;var e,t,r,n=A(this._remoteStreams);try{for(n.s();!(e=n.n()).done;){var i=E(e.value,2)[1];Array.isArray(i)&&i.forEach((function(e){e&&e.clean()}))}}catch(o){n.e(o)}finally{n.f()}(this._virtualStreams.forEach((function(e){null==e||e.clean()})),this._remoteStreams=new Map,this._localStream)&&(null===(t=this._localStream)||void 0===t||t.clean(),this._localStream=void 0);this._localScreenStream&&(null===(r=this._localScreenStream)||void 0===r||r.clean(),this._localScreenStream=void 0);this._context=void 0,this._reconnectRecord=new PW,this._removeHandlerEventHandler(),clearTimeout(this._connectionLostTimer),this._userDuplicateLoginTimerMap.forEach((function(e){clearTimeout(e)})),this._userDuplicateLoginTimerMap.clear(),this._networkQualityManager.destroy(),this._videoSizeObserver.destroy(),this._subFallbackManager.destroy(),this._csrcUserIdMap={},this._virtualStreams=[],this._remoteStreamStreamIdUserIdMap={}}},{key:"updateToken",value:(n=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return xW.print("updateToken","Invoke updateToken"),this._roomInfo&&(this._roomInfo.token=t),e.next=4,this._mediaServerClient.updateToken(t);case 4:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"sendUserMessage",value:function(e,t){var r;return null===(r=this._mediaServerClient)||void 0===r?void 0:r.sendUserMessage(e,t)}},{key:"setSessionId",value:function(){this._sessionId=uP(),VB.setStats({rtc_session_id:this._sessionId}),EW.setStats({rtc_session_id:this._sessionId})}},{key:"sendRoomMessage",value:(r=c(o().mark((function e(t){var r,n,i,a,s=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=s.length>1&&void 0!==s[1]&&s[1],a={clientId:null===(r=this._roomInfo)||void 0===r?void 0:r.userInfo.userId,binary:i,message:""},!i){e.next=8;break}return e.next=5,_P.ab2b64str(t);case 5:a.message=e.sent,e.next=9;break;case 8:a.message=t;case 9:return e.abrupt("return",null===(n=this._mediaServerClient)||void 0===n?void 0:n.sendRoomMessage(a));case 10:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"_destroyAndInitMediaServerClient",value:function(){xW.print("_destroyAndInitMediaServerClient()"),this._mediaServerClient&&(this._mediaServerClient.destroy(),this._removeHandlerEventHandler()),this._mediaServerClient=new gX(this._context),this._addHandlerEventHandler()}},{key:"_onJoinSucc",value:function(e,t){var r,n=this;xW.print("JoinSuccess()"),this._serverConfig=e.config;var i=[],o=[],a=[],s=[],c=[];null===(r=e.clientsDetail)||void 0===r||r.forEach((function(t){if(t.attributes&&(t.attributes.serverMuteVideo&&n.safeEmit(Gz.ON_VIDEO_STREAM_BANNED,{uid:t.clientId,banned:1===t.attributes.serverMuteVideo}),t.attributes.serverMuteAudio&&n.safeEmit(Gz.ON_AUDIO_STREAM_BANNED,{uid:t.clientId,banned:1===t.attributes.serverMuteAudio})),t.clientId!==e.clientId){var r=n._remoteUsers.get(t.clientId);r?r._stillExist=!0:i.push(t)}}));var u,d=A(this._remoteUsers.values());try{for(d.s();!(u=d.n()).done;){var l=u.value;l._stillExist||o.push({clientId:l.userId}),delete l._stillExist}}catch(v){d.e(v)}finally{d.f()}e.streams.forEach((function(e){var t=n._findRemoteStreamByScreen(e.clientId,e.screen);t?(t.stillExist=!0,t.streamId=e.streamId,c.push(e)):s.push(e)}));var h,f=A(this._remoteStreams.values());try{for(f.s();!(h=f.n()).done;){var p=h.value;Array.isArray(p)&&p.forEach((function(e){e.stillExist?delete e.stillExist:a.push({clientId:e.userId,streamId:e.streamId,message:hj.clientDisconnected})}))}}catch(v){f.e(v)}finally{f.f()}setTimeout((function(){o.forEach((function(e){return n._onUserDisconnection(e)})),i.forEach((function(e){return n._onUserConnection(e)})),a.forEach((function(e){return n._onRemoveStream(e)})),s.forEach((function(e){return n._onAddStream(e,{fromSignal:!1})})),c.forEach((function(e){return n._onUpdateStreamAttributes(e)})),t&&n._handleSendOrRecvStreamAfterReconnect()}))}},{key:"_handleSendOrRecvStreamAfterReconnect",value:function(){var e=this;this._localStream&&(this._localStream.clean(),this._mediaServerClient.publish(this._localStream).catch((function(e){}))),this._localScreenStream&&(this._localScreenStream.clean(),this._mediaServerClient.publish(this._localScreenStream).catch((function(e){})));var t,r=A(this._remoteStreams.values());try{for(r.s();!(t=r.n()).done;){var n=t.value;Array.isArray(n)&&n.forEach(function(){var t=c(o().mark((function t(r){return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!r.hasSubscribed){t.next=15;break}return r.resetHasSubscribed(),t.prev=2,xW.print("start resubscribe ".concat(r.userId," with ").concat(r.subMediaType)),t.next=6,e._mediaServerClient.subscribe(r,r.subMediaType);case 6:xW.print("success resubscribe ".concat(r.userId," with ").concat(r.subMediaType)),e.safeEmit(Gz.RESUBSCRIBE,{stream:r}),t.next=15;break;case 10:t.prev=10,t.t0=t.catch(2),xW.print("failed resubscribe ".concat(r.userId," with ").concat(r.subMediaType,", error:").concat(t.t0)),r.clean(),null==r||r.resetHasSubscribed();case 15:case"end":return t.stop()}}),t,null,[[2,10]])})));return function(e){return t.apply(this,arguments)}}())}}catch(i){r.e(i)}finally{r.f()}}},{key:"_handleFFAudioTrack",value:function(){var e,t,r,n,i=null===(e=this._mediaServerClient)||void 0===e||null===(t=e.handler)||void 0===t?void 0:t.audioTrack4ff,o=null===(r=this._mediaServerClient)||void 0===r||null===(n=r.handler)||void 0===n?void 0:n.getTransceivers();if(i&&Array.isArray(o)){var a=o.find((function(e){var t;return(null==e||null===(t=e.receiver)||void 0===t?void 0:t.track)===i}));if(a){var s=new Yz("ff-stream","ff-stream",!1,DW);s.virtual=!0,s.audioTransceiver=a,s.audioMid="0",s.audioTrack=_z(i),this._virtualStreams.push(s),this.safeEmit(Gz.SUBSCRIBE_PUSH_TRACK,{stream:s})}}}},{key:"_findRemoteStream",value:function(e,t){var r=this._remoteStreams.get(e);return Array.isArray(r)?r.find((function(e){return e.streamId===t})):null}},{key:"_findRemoteStreamByScreen",value:function(e,t){var r=this._remoteStreams.get(e);return Array.isArray(r)?r.find((function(e){return e.isScreen===t})):null}},{key:"_onAddStream",value:function(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.needEmit,i=void 0===n||n,o=r.fromSignal,a=void 0===o||o,s=r.virtual,c=void 0!==s&&s;if(e.clientId!==(null===(t=this._roomInfo)||void 0===t?void 0:t.userInfo.userId)){var u=this._roomConfig,d=u.isAutoSubscribeAudio,l=u.isAutoSubscribeVideo,h=this._findRemoteStreamByScreen(e.clientId,e.screen);if(h&&h.streamId!==e.streamId){var f,p=null===(f=this._remoteStreams.get(e.clientId))||void 0===f?void 0:f.filter((function(e){return e.streamId!==h.streamId}));h.clean(),this._remoteStreams.set(e.clientId,p||[])}var v,_=this._findRemoteStream(e.clientId,e.streamId);if(this._remoteStreamStreamIdUserIdMap[e.streamId]=e.clientId,_)_.attributes=e.attributes;else if((_=new Yz(e.clientId,e.streamId,e.screen,e.attributes,null===(v=this.userPriorityMap)||void 0===v?void 0:v.get(e.clientId))).virtual=c,this._initStreamListeners(_),!c){var m=this._remoteStreams.get(e.clientId);m?m.push(_):this._remoteStreams.set(e.clientId,[_])}if(this._mediaServerClient.handler&&(_.observer=new kW(_,this._mediaServerClient.handler)),!_.isScreen&&l){var y,g,S,b,E,k,T,I;if(a&&_.hasVideo)if(_.attributes.extvideo)null===(y=_.observer)||void 0===y||y.setExternalVideoSource(!0),null===(g=_.observer)||void 0===g||g.setPushVideo(!0);else null===(S=_.observer)||void 0===S||S.setExternalVideoSource(!1),null===(b=_.observer)||void 0===b||b.setPublishVideo(!0);if(a&&_.hasAudio&&d&&!this._mediaServerClient.roomAttributes.multiChatMode)if(_.attributes.extaudio)null===(E=_.observer)||void 0===E||E.setExternalAudioSource(!0),null===(k=_.observer)||void 0===k||k.setPushAudio(!0);else null===(T=_.observer)||void 0===T||T.setExternalAudioSource(!1),null===(I=_.observer)||void 0===I||I.setPublishAudio(!0);if(!0===i&&!1===a){var A,R=this._roomConfig,w=R.isAutoSubscribeAudio,C=R.isAutoSubscribeVideo;null===(A=_.observer)||void 0===A||A.setLogin(!0,{audio:!!w,video:!!C})}}return i&&this.safeEmit(pj.ON_ADD_STREAM,{stream:_}),_}}},{key:"_onUserConnection",value:function(e){var t;if(e.clientId!==(null===(t=this._roomInfo)||void 0===t?void 0:t.userInfo.userId)){var r=this._userDuplicateLoginTimerMap.get(e.clientId);if("number"==typeof r)return this._userDuplicateLoginTimerMap.delete(e.clientId),void self.clearTimeout(r);var n={userId:e.clientId,extraInfo:e.attributes.extra_info};this._remoteUsers.set(e.clientId,i({},n)),this.safeEmit(pj.USER_CONNECTION,{userInfo:n}),e.attributes&&(e.attributes.serverMuteVideo&&this.safeEmit(Gz.ON_VIDEO_STREAM_BANNED,{uid:e.clientId,banned:1===e.attributes.serverMuteVideo}),e.attributes.serverMuteAudio&&this.safeEmit(Gz.ON_AUDIO_STREAM_BANNED,{uid:e.clientId,banned:1===e.attributes.serverMuteAudio}))}}},{key:"_onUserDisconnection",value:function(e){var t,r=this,n=e.clientId,i=e.tag,o=e.code;if(n)if(n===(null===(t=this.roomInfo)||void 0===t?void 0:t.userInfo.userId)){var a=null;i===mj.kickedByAdmin?a=dN.KICKED_OUT:i===mj.onUserTokenDidExpire?a=dN.TOKEN_EXPIRED:i===mj.userDuplicateLogin&&(a=dN.DUPLICATE_LOGIN),o===yj.roomDismissByAdmin&&(a=dN.ROOM_DISMISS),a&&this.safeEmit(Gz.ON_ROOM_ERROR,{errorCode:a})}else{var s=C.DROPPED;i===mj.userLeave?s=C.QUIT:i===mj.kickedByAdmin?s=C.KICKED_BY_ADMIN:i===mj.roleChanged&&(s=C.SWITCH_TO_INVISIBLE);var c=function(){var e;r._remoteUsers.delete(n),null===(e=r._remoteStreams.get(n))||void 0===e||e.forEach((function(e){e.clean(),r._onRemoveStream({clientId:e.userId,streamId:e.streamId,message:hj.clientDisconnected})})),r._remoteStreams.delete(n),r.safeEmit(Gz.ON_USER_LEAVE,{userInfo:{userId:n},reason:s})};if(i===mj.userDuplicateLogin){var u=this._userDuplicateLoginTimerMap.get(n);u&&self.clearTimeout(u);var d=self.setTimeout(c,5e3);this._userDuplicateLoginTimerMap.set(n,d)}else c()}}},{key:"_onRemoveStream",value:function(e){var t,r=this;if(e.clientId!==(null===(t=this._roomInfo)||void 0===t?void 0:t.userInfo.userId)){var n=this._remoteStreams.get(e.clientId);if(n){var i=n.find((function(t){return t.streamId===e.streamId}));if(i){var o,a,s;if(null===(o=this._mediaServerClient)||void 0===o||o.handleRemoveStream(i,e).then((function(){var t=r._remoteStreams.get(e.clientId);t&&(t=t.filter((function(t){return t.streamId!==e.streamId||(t.clean(),!1)})),r._remoteStreams.set(e.clientId,t))})).finally((function(){r.safeEmit(pj.ON_REMOVE_STREAM,{stream:i,reason:e.message})})),i.hasVideo)null===(a=i.observer)||void 0===a||a.setPublishVideo(!1);if(i.hasAudio&&!this._mediaServerClient.roomAttributes.multiChatMode)null===(s=i.observer)||void 0===s||s.setPublishAudio(!1)}}}}},{key:"_onUpdateUserAttributes",value:function(e){e.attributes&&(e.attributes.serverMuteVideo&&this.safeEmit(Gz.ON_VIDEO_STREAM_BANNED,{uid:e.clientId,banned:1===e.attributes.serverMuteVideo}),e.attributes.serverMuteAudio&&this.safeEmit(Gz.ON_AUDIO_STREAM_BANNED,{uid:e.clientId,banned:1===e.attributes.serverMuteAudio}))}},{key:"_onUpdateRoomAttributes",value:function(e){var t;e.roomAttributes&&(this._mediaServerClient.roomAttributes=i(i({},this._mediaServerClient.roomAttributes),e.roomAttributes)),null!==(t=e.roomAttributes)&&void 0!==t&&t.multiChatMode&&this._handleFFAudioTrack()}},{key:"_onUpdateStreamAttributes",value:function(e){var t=this._roomConfig,r=t.isAutoSubscribeAudio,n=t.isAutoSubscribeVideo,o=e.clientId,a=e.streamId,s=e.attributes,c=this._findRemoteStream(o,a);if(c){var u,d,l=c.attributes,h=i(i({},l),s),f=!1,p=h.localaudio!==l.localaudio,v=!1,_=!1,m=h.localvideo!==l.localvideo,y=!1,g=Az.NONE,S=Az.NONE;if(h.audiostream!==l.audiostream&&(f=h.localaudio,v=!!h.audiostream,h.audiostream?g|=U.AUDIO:S|=U.AUDIO),h.videostream!==l.videostream&&(_=h.localvideo,y=!!h.videostream,h.videostream?g|=U.VIDEO:S|=U.VIDEO),g&&this.safeEmit(Gz.ON_USER_PUBLISH_STATE_CHANGE,{userId:o,mediaType:g,isScreen:c.isScreen,pubState:zz.PUB,remoteStream:c}),S&&this.safeEmit(Gz.ON_USER_PUBLISH_STATE_CHANGE,{userId:o,mediaType:S,isScreen:c.isScreen,pubState:zz.UNPUB,remoteStream:c}),c.attributes=h,h.localaudio!==l.localaudio)if(h.localaudio&&r){var b,E,k,T;if(h.extaudio)null===(b=c.observer)||void 0===b||b.setExternalAudioSource(!0),null===(E=c.observer)||void 0===E||E.setPushAudio(!0);else null===(k=c.observer)||void 0===k||k.setExternalAudioSource(!1),null===(T=c.observer)||void 0===T||T.setEnableAudio(!0);this.safeEmit(Gz.ON_USER_START_AUDIO_CAPTURE,{userId:o},c)}else{var I,A,R,w;if(h.extaudio)null===(I=c.observer)||void 0===I||I.setExternalAudioSource(!0),null===(A=c.observer)||void 0===A||A.setPushAudio(!1);else null===(R=c.observer)||void 0===R||R.setExternalAudioSource(!1),null===(w=c.observer)||void 0===w||w.setEnableAudio(!1);!c.isScreen&&this.safeEmit(Gz.ON_USER_STOP_AUDIO_CAPTURE,{userId:o})}if(h.localvideo!==l.localvideo)if(h.localvideo&&n){var C,O,x,D;if(h.extvideo)null===(C=c.observer)||void 0===C||C.setExternalVideoSource(!0),null===(O=c.observer)||void 0===O||O.setPushVideo(!0);else null===(x=c.observer)||void 0===x||x.setExternalVideoSource(!1),null===(D=c.observer)||void 0===D||D.setEnableVideo(!0);this.safeEmit(Gz.ON_USER_START_VIDEO_CAPTURE,{userId:o})}else{var N,P,M,L;if(h.extvideo)null===(N=c.observer)||void 0===N||N.setExternalVideoSource(!0),null===(P=c.observer)||void 0===P||P.setPushVideo(!1);else null===(M=c.observer)||void 0===M||M.setExternalVideoSource(!1),null===(L=c.observer)||void 0===L||L.setEnableVideo(!1);!c.isScreen&&this.safeEmit(Gz.ON_USER_STOP_VIDEO_CAPTURE,{userId:o})}if(f&&!p)null===(u=c.observer)||void 0===u||u.setRemoteUnmuteAudio(v);if(_&&!m)null===(d=c.observer)||void 0===d||d.setRemoteUnmuteVideo(y)}}},{key:"_onPushTrack",value:function(e){var t=this,r=this._onAddStream(i(i({},e),{},{attributes:DW}),{needEmit:!1,fromSignal:!1,virtual:!0});r&&this._mediaServerClient.subscribe4pushTrack(r,e).then((function(){t.safeEmit(Gz.SUBSCRIBE_PUSH_TRACK,{stream:r}),t._virtualStreams.push(r)})).catch((function(e){xW.print("subscribe","push track failed %o",e)}))}},{key:"_onRemoveTrack",value:function(e){var t,r=e.clientId,n=e.streamId,i=e.message;xW.print("_onRemoveTrack","remove track: %o",r);var o=this._findRemoteStream(r,n);o&&(null===(t=this._mediaServerClient)||void 0===t||t.unsubscribe4removeTrack(o,i))}},{key:"_onMeetingSpeakerChange",value:function(e){if(Array.isArray(null==e?void 0:e.speakerCsrcInfo)){var t={};null==e||e.speakerCsrcInfo.forEach((function(e){var r=e.csrc,n=e.userId;e.isScreen||(t[r]=n)})),this._csrcUserIdMap=t}}},{key:"getActiveSpeakerInMultiChatMode",value:function(){var e=this,t=[];return this._virtualStreams.forEach((function(r){var n,i=null===(n=r.audioTransceiver)||void 0===n?void 0:n.receiver;if(i){var o=E(i.getContributingSources()||[],1)[0];if(o){var a=o.audioLevel,s=o.source;e._csrcUserIdMap[s]&&t.push({userId:e._csrcUserIdMap[s],audioLevel:a})}}})),t.length&&t.sort((function(e,t){return e.audioLevel-t.audioLevel})),t}},{key:"_nodeChange",value:function(e){var t,r=e.nodes,n=e.reason;ej.clearAccessNode(null===(t=this._roomInfo)||void 0===t?void 0:t.appId),this._destroyAndInitMediaServerClient(),Array.isArray(r)&&r.length?this._getAccessNode=r[0]:this._getAccessFeedback=n,MB.rtcNodeChange(0,JSON.stringify(e),JSON.stringify(n)),this._joinResolveCallback&&this._joinRejectCallback?this._join(this._joinResolveCallback,this._joinRejectCallback):this._reconnect()}},{key:"_reconnect",value:function(){var e=this;this._isReconnecting=!0;var t,r=A(this._remoteStreams.values());try{for(r.s();!(t=r.n()).done;){var n=t.value;Array.isArray(n)&&n.forEach((function(e){return e.clean()}))}}catch(i){r.e(i)}finally{r.f()}MB.rtcReconnect(1002,nB.PEERCONNECTION_RECONNECTING,this._roomInfo.userInfo.userId,iB.PEERCONNECTION),this._liveTranscodingOnceSucc||delete this._liveControlMessage,this._join((function(){MB.rtcReconnected(oB.PEERCONNECTION_RECONNECTED,aB.PEERCONNECTION)}),(function(t){e._reconnectRecord.record(t),e._reconnectRecord.shouldReconnect?(xW.print("Reconnecting error, will reconnect after 3s",t),e._reconnectTimer=window.setTimeout(e._reconnect.bind(e),3e3)):(e.safeEmit(Gz.RECONNECT_FAILED),e.destroy())}),!0)}},{key:"_handleAbnormalDisconnection",value:function(){xW.print("on ABNORMAL_DISCONNECTION"),this._destroyAndInitMediaServerClient(),navigator.onLine?this._reconnect():this._reconnectTimer=window.setTimeout(this._reconnect.bind(this),3e3)}},{key:"_onConnectionStateChange",value:function(e){var t,r=this;if(e.next===mX.DISCONNECTED)t=F.CONNECTION_STATE_DISCONNECTED;else if(e.next===mX.CONNECTED)clearTimeout(this._connectionLostTimer),t=this._isReconnecting?F.CONNECTION_STATE_RECONNECTED:F.CONNECTION_STATE_CONNECTED;else{if(e.next!==mX.CONNECTING)return;t=this._isReconnecting?F.CONNECTION_STATE_RECONNECTING:F.CONNECTION_STATE_CONNECTING}e.prev===mX.CONNECTED&&e.next===mX.DISCONNECTED&&(this._connectionLostTimer=window.setTimeout((function(){r.safeEmit(_j.ON_CONNECTION_STATE_CHANGE,{state:F.CONNECTION_STATE_LOST})}),1e4)),this._networkQualityManager.setConnectionState(e.next),this.safeEmit(_j.ON_CONNECTION_STATE_CHANGE,{state:t})}},{key:"_initStreamListeners",value:function(e){var t=this;e.on("ontrack",(function(e){e.track})),e.on("onSEIMessage",(function(r){var n;t.emit(Gz.ON_SEI_MESSAGED_RECEIVED,{sei:r,remoteStreamKey:{userId:e.userId,roomId:null===(n=t._roomInfo)||void 0===n?void 0:n.roomId,streamIndex:e.isScreen?L.STREAM_INDEX_SCREEN:L.STREAM_INDEX_MAIN}})}))}},{key:"_onCustomMessage",value:function(e){this.safeEmit(pj.ON_CUSTOM_MESSAGE,e)}},{key:"_onUserMessageReceived",value:function(e){this.safeEmit(pj.USER_MESSAGE_RECEIVED,{userId:e.from,message:e.msg})}},{key:"_onUserBinaryMessageReceived",value:function(e){this.safeEmit(pj.USER_BINARY_MESSAGE_RECEIVED,{userId:e.from,message:e.msg})}},{key:"_onPostProcessingMessage",value:function(e){if(e.body){var t=e.body,r=t.error||0,n=Hz.START,i=["success","parameter error","subscription timeout","ffmpeg error","cdn error","publish error"];if("2.0"===t.protocol){switch(t.eventType){case"TranscodeStarted":0!==t.error&&(n=Hz.START_FAILED);break;case"TranscodeStateChanged":n=0!==t.error?Hz.START_FAILED:Hz.START_SUCCESS;break;case"TranscodeStopped":n=0!==t.error?Hz.STOP_FAILED:Hz.STOP_SUCCESS;break;case"TranscodeUpdated":n=0!==t.error?Hz.UPDATE_FAILED:Hz.UPDATE_SUCCESS}this.safeEmit(pj.POST_PROCESSING_MESSAGE,{code:r,protocol:t.protocol,error:t.error,eventType:n,message:i[r]})}this.safeEmit(pj.POST_PROCESSING_MESSAGE,{code:r,message:i[r],type:e.type})}}},{key:"_onUserTokenWillExpire",value:function(){this.safeEmit(pj.ON_USER_TOKEN_WILL_EXPIRE,null)}},{key:"_onSceneConfig",value:function(e){try{var t=e.multiSceneConfig,r=lX[this._roomConfig.roomProfileType][1];if(t){var n,i,o,a,s=t[r];if(null!=s&&s.engine_BAC)null===(n=this._context)||void 0===n||null===(i=n.audioProfileManager)||void 0===i||i.updateEngineBAC(s.engine_BAC);if(null!=s&&s.engine_ANM)null===(o=this._context)||void 0===o||null===(a=o.audioProfileManager)||void 0===a||a.updateEngineANM(s.engine_ANM)}}catch(c){}}},{key:"_onStreamFailed",value:(t=c(o().mark((function e(t){var r,n,i,a,s,c,u,d,l,h;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("publish"!==t.type){e.next=11;break}if(c=void 0,(null===(r=this.localStream)||void 0===r?void 0:r.streamId)===t.streamId?c=this.localStream:(null===(n=this.localScreenStream)||void 0===n?void 0:n.streamId)===t.streamId&&(c=this.localScreenStream),c){e.next=5;break}return e.abrupt("return");case 5:return null===(i=c)||void 0===i||i.clean(),e.next=8,null===(a=this._mediaServerClient)||void 0===a?void 0:a.unpublish(c).catch((function(){}));case 8:null===(s=this._mediaServerClient)||void 0===s||s.publish(c).catch((function(){})),e.next=20;break;case 11:if("subscribe"!==t.type){e.next=20;break}if(u=this._remoteStreamStreamIdUserIdMap[t.streamId],!(d=this._findRemoteStream(u,t.streamId))){e.next=20;break}return e.next=17,null===(l=this._mediaServerClient)||void 0===l?void 0:l.unsubscribe(d,U.AUDIO_AND_VIDEO);case 17:return e.next=19,null===(h=this._mediaServerClient)||void 0===h?void 0:h.subscribe(d,d.subMediaType,d.subLayer);case 19:this.safeEmit(Gz.RESUBSCRIBE,{stream:d});case 20:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"_onStreamControlMessage",value:function(e){var t,r;e.type===fj.PushLimitWarn&&(null!==(t=this._localStream)&&void 0!==t&&t.pubAudio||null!==(r=this._localStream)&&void 0!==r&&r.pubVideo||this.unpublish())}},{key:"_onPublishOnDemand",value:function(e){var t,r,n,i,o;if(!1!==(null===(t=this._serverConfig)||void 0===t||null===(r=t.engine_VPM)||void 0===r||null===(n=r.ondemand)||void 0===n?void 0:n.enable)&&null!==(i=this._localStream)&&void 0!==i&&i.enableSimulcast&&null!==(o=this._localStream)&&void 0!==o&&o.videoTransceiver){var a,s,c=null===(a=this._localStream)||void 0===a?void 0:a.stream.id,u=null===(s=this._localStream)||void 0===s?void 0:s.videoTransceiver.sender,d=u.getParameters();if(Array.isArray(d.encodings)&&Array.isArray(e)){var l,h,f,p,v={};xW.print("_onPublishOnDemand","usedDescriptions: %o",e),e.forEach((function(e){var t;if(null!=e&&null!==(t=e.StreamIds)&&void 0!==t&&t.includes(c)){var r=null==e?void 0:e.Metadata.SubvideoIndex;v[r]=r}}));var _={};null===(l=this._localStream)||void 0===l||null===(h=l.subVideoDescriptions)||void 0===h||h.forEach((function(e){void 0!==v[e.sub_index]&&(_[e.video_index]=e)}));var m=(null===(f=u.track)||void 0===f||null===(p=f.getSettings())||void 0===p?void 0:p.height)||720,y=[];d.encodings=d.encodings.map((function(e){return e.rid&&(_[e.rid]?(e.active=!0,e.scaleResolutionDownBy=Math.max(m/_[e.rid].height,1),y.push({type:1,rid:e.rid,downBy:e.scaleResolutionDownBy,bitrate:e.maxBitrate})):(y.push({type:0,rid:e.rid}),e.active=!1)),e})),MB.rtcInvokeStatus(JSON.stringify(y),0,"rscp",c,0)}u.setParameters(d)}}},{key:"_onRTT",value:function(e){var t=e.StreamIds,r=e.Metadata;if(t.length&&r){var n,i=t[0];null!==(n=this._context)&&void 0!==n&&n.streamRTT&&(this._context.streamRTT[i]={audio:r.audio_rtt,video:r.video_rtt})}}},{key:"_reportNetworkQuality",value:function(e,t){this._subFallbackManager.updateNetworkQuality(e,t),this.emit(Gz.ON_NETWORK_QUALITY,e,t)}},{key:"_emitVideoSizeChange",value:function(e,t,r,n){var i;this.emit(Gz.ON_REMOTE_VIDEO_SIZE_CHANGED,{roomId:null===(i=this.roomInfo)||void 0===i?void 0:i.roomId,userId:e,streamIndex:t?L.STREAM_INDEX_SCREEN:L.STREAM_INDEX_MAIN},{width:r,height:n})}},{key:"_emitSubscribeFallback",value:function(e){this.emit(Gz.ON_SIMULCAST_SUBSCRIBE_FALLBACK,e)}},{key:"multiChatMode",get:function(){var e;return null===(e=this._mediaServerClient)||void 0===e?void 0:e.multiChatMode()}}]),P}($L),PW=function(){function e(){u(this,e),h(this,"_all_201_count",void 0),h(this,"_has_4xx",void 0),this._all_201_count=0,this._has_4xx=!1}return l(e,[{key:"shouldReconnect",get:function(){return!(this._all_201_count>=3||this._has_4xx)}},{key:"record",value:function(e){var t=!1,r=!1;if(Array.isArray(e)){var n=0;e.map((function(e){var t,i,o;400<=(null===(t=e.error)||void 0===t?void 0:t.code)&&(null===(i=e.error)||void 0===i?void 0:i.code)<500&&(r=!0),201===(null===(o=e.error)||void 0===o?void 0:o.code)&&n++})),n===e.length&&(t=!0),t&&this._all_201_count++,r&&(this._has_4xx=!0)}}},{key:"clear",value:function(){this._all_201_count=0,this._has_4xx=!1}}]),e}(),MW=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=document.createElement(e);return t.id&&(r.id=t.id),t.classList&&t.classList.forEach((function(e){r.classList.add(e)})),t.style&&Object.assign(r.style,t.style),t.attributes&&Object.entries(t.attributes).forEach((function(e){var t=E(e,2),n=t[0],i=t[1];"muted"===n?r.muted=!0:r.setAttribute(n,i)})),r},LW=new JL("Player",0),UW=["play","playing","pause","ended","error","seeking","seeked","waiting","canplay","canplaythrough","durationchange","volumechange","loadedmetadata","loadeddata","loadstart","timeupdate"],VW={playsinline:"","webkit-playsinline":""},FW={playsinline:"","webkit-playsinline":"","x5-playsinline":"","x5-video-player-type":"h5","x-webkit-airplay":"allow",preload:"",muted:""},BW=function(e){f(n,e);var t,r=g(n);function n(e){var t;u(this,n),h(m(t=r.call(this)),"_containerDom",void 0),h(m(t),"_videoDom",void 0),h(m(t),"__cumulativeTime",void 0),h(m(t),"userId",void 0),h(m(t),"renderMode",void 0),h(m(t),"mirrorType",B.MIRROR_TYPE_NONE),h(m(t),"isScreen",void 0),h(m(t),"isLocal",void 0),h(m(t),"played",!1),h(m(t),"_emitPlayFailed",!1),h(m(t),"_videoContainer",void 0),h(m(t),"_safari15VideoTimer",void 0),h(m(t),"emitVideoEvent",(function(e){var r,n,i={type:"video",rawEvent:e,readyState:(null===(r=t._videoDom)||void 0===r?void 0:r.readyState)||0,userId:t.userId,eventName:e.type,currentTime:(null===(n=t._videoDom)||void 0===n?void 0:n.currentTime)||0,isScreen:t.isScreen};switch(t.emit("playback_event",i),e.type){case"pause":var o;try{MB.rtcInvokeStatus("video element paused, auto resume",0,"VideoPlayerPause",t.userId,0)}catch(T0){}LW.print("VideoPlayerPause","[userId-".concat(t.userId,"] video element paused, auto resume")),null===(o=t._videoDom)||void 0===o||o.play();break;case"canplay":case"loadeddata":t._internalPlay();break;case"playing":LW.print("VideoPlayerPlaying","[userId-".concat(t.userId,"] video element playing"))}})),h(m(t),"_internalPlay",(function(){var e;if(null!==(e=t._videoDom)&&void 0!==e&&e.paused){var r=t._videoDom.play();null!=r&&r.then&&r.catch((function(e){var r,n;t._emitPlayFailed||(t._emitPlayFailed=!0,MB.rtcError("video autoplay failed, userId: ".concat(t.userId,", ").concat(e.name),-1e3),t.emit("playback_event",{type:"video",rawEvent:e,readyState:(null===(r=t._videoDom)||void 0===r?void 0:r.readyState)||0,userId:t.userId,eventName:"autoplay-error",currentTime:(null===(n=t._videoDom)||void 0===n?void 0:n.currentTime)||0,isScreen:t.isScreen}))}))}}));var i=e.renderDom,o=e.userId;t.renderMode=void 0!==e.renderMode?e.renderMode:M.RENDER_MODE_FIT;var a="string"==typeof i?document.getElementById(i):i;if(!a)throw new hN(dN.CANT_FIND_DOM,"can't find dom");return t._videoContainer=document.createElement("div"),t._videoContainer.style.width="100%",t._videoContainer.style.height="100%",t._videoContainer.style.position="relative",t._videoContainer.style.overflow="hidden",t._containerDom=a,t.userId=o,t.isLocal=!!e.isLocal,t.isScreen=!!e.isScreen,t._initVideo(),SP&&15===kP&&(t._safari15VideoTimer=window.setInterval((function(){try{t._videoContainer.style.display="block",setTimeout((function(){t._videoContainer.style.display="flex"}),500)}catch(T0){}}),5e3)),t}return l(n,[{key:"_initVideo",value:function(){this._videoDom||(this._videoDom=MW("video",{style:{width:"100%",height:"100%"},attributes:FW}),this._videoDom.id="".concat(this.userId,"_").concat(hP()),this.renderMode===M.RENDER_MODE_FIT?this._videoDom.style.objectFit="contain":this._videoDom.style.objectFit="cover",this.mirror(this.mirrorType===B.MIRROR_TYPE_RENDER)),this._videoContainer.appendChild(this._videoDom),this._containerDom.appendChild(this._videoContainer),this._initListeners()}},{key:"_initListeners",value:function(){var e=this;this._videoDom&&UW.forEach((function(t){var r;null===(r=e._videoDom)||void 0===r||r.addEventListener(t,e.emitVideoEvent)}))}},{key:"_removeListeners",value:function(){var e=this;this._videoDom&&(UW.forEach((function(t){var r;null===(r=e._videoDom)||void 0===r||r.removeEventListener(t,e.emitVideoEvent)})),this._videoDom.addEventListener("canplay",this._internalPlay),this._videoDom.addEventListener("loadeddata",this._internalPlay))}},{key:"_recordFrame",value:function(e){var t=this,r=e.isScreen?1.5:.5;if(SP){var n;if(null===(n=this._videoDom)||void 0===n||!n.requestVideoFrameCallback)return;this._videoDom.requestVideoFrameCallback((function n(i,o){var a=o.presentationTime;if(e.recordedVideoFrames||(e.recordedVideoFrames=[]),t.__cumulativeTime){var s,c=(a-t.__cumulativeTime)%2e3,u=c>1e3*r;null===(s=e.recordedVideoFrames)||void 0===s||s.push({playTime:a,isStall:u,stallCount:u?1:0,stallDuration:c})}t.__cumulativeTime=a,t._videoDom.requestVideoFrameCallback(n)}))}else this.on("playback_event",(function(n){var i;if("timeupdate"===n.eventName){if(0===(null===(i=t._videoDom)||void 0===i?void 0:i.currentTime))return;if(void 0===t.__cumulativeTime)return void(t.__cumulativeTime=t._videoDom.currentTime);if(e.recordedVideoFrames||(e.recordedVideoFrames=[]),t._videoDom.currentTime>t.__cumulativeTime){var o=Math.floor(1e3*(t._videoDom.currentTime-t.__cumulativeTime)),a=t._videoDom.currentTime-t.__cumulativeTime>r;e.recordedVideoFrames.push({playTime:t._videoDom.currentTime,isStall:a,stallCount:a?1:0,stallDuration:o%2e3})}t.__cumulativeTime=t._videoDom.currentTime}}))}},{key:"playVideo",value:(t=c(o().mark((function e(t,r){var n,i,a,s,c=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=this._videoDom,LW.print("playVideo","play video track: ".concat(this.userId)),!(a&&a.srcObject instanceof MediaStream&&a.srcObject.getTrackById(null===(n=t.getTrack())||void 0===n?void 0:n.id))){e.next=5;break}try{MB.rtcInvokeStatus("play video repeatedly",0,"playVideo",this.userId,0)}catch(T0){}return e.abrupt("return");case 5:a||(this._initVideo(),a=this._videoDom),LW.print("playVideo","play video by dom: ".concat(null===(i=a)||void 0===i?void 0:i.id)),(s=new MediaStream).addTrack(t.getTrack("preprocessing")),a.srcObject=s,a&&!this._containerDom.contains(this._videoContainer)&&this._containerDom.appendChild(this._videoContainer),a&&!this._videoContainer.contains(a)&&this._videoContainer.appendChild(a),setTimeout((function(){return c._internalPlay()})),r&&this._recordFrame(r),this.played=!0;case 15:case"end":return e.stop()}}),e,this)}))),function(e,r){return t.apply(this,arguments)})},{key:"updateSrcObject",value:function(e){var t=e.getTrack();if(t&&this._videoDom){var r=new MediaStream;r.addTrack(t),this._videoDom.srcObject=r}}},{key:"manuallyPlay",value:function(){if(LW.print("Invoke VideoPlayer.manuallyPlay",this.userId,this.isScreen),this._emitPlayFailed=!1,!this._videoDom)throw new hN(dN.INVALID_PARAMS,"Player not found");return 0!==this._videoDom.readyState||AP?this._videoDom.play():Promise.resolve()}},{key:"mirror",value:function(e){LW.print("mirror","".concat(this.userId," set mirror: ").concat(e)),this.mirrorType=e?B.MIRROR_TYPE_RENDER:B.MIRROR_TYPE_NONE,this._videoDom&&(this._videoDom.style.transform=e?"rotateY(180deg)":"")}},{key:"stop",value:function(){var e,t=this._containerDom;(LW.print("stop","stop video track: ".concat(this.userId)),this._videoDom)&&(this._videoDom.srcObject=null,null!=t&&t.contains(this._videoContainer)&&t.removeChild(this._videoContainer),null!==(e=this._videoContainer)&&void 0!==e&&e.contains(this._videoDom)&&this._videoContainer.removeChild(this._videoDom));this.__cumulativeTime=void 0,this.played=!1}},{key:"destroy",value:function(){LW.print("destroy","video player: ".concat(this.userId)),this.stop(),b(p(n.prototype),"removeAllListeners",this).call(this),this._removeListeners(),this._videoDom&&(this._videoDom.srcObject=null,delete this._videoDom),this._safari15VideoTimer&&(window.clearInterval(this._safari15VideoTimer),this._safari15VideoTimer=void 0)}},{key:"domElement",get:function(){return this._videoDom}}]),n}(jL.exports.EventEmitter),jW=function(e){f(i,e);var t,r,n=g(i);function i(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{divId:void 0,muted:!1,isScreen:!1},o=r.divId,a=r.muted,s=r.isScreen;if(u(this,i),h(m(t=n.call(this)),"_containerDom",void 0),h(m(t),"_audioDom",void 0),h(m(t),"_fakeAudioDom",void 0),h(m(t),"userId",void 0),h(m(t),"muted",!1),h(m(t),"_emitPlayFailed",!1),h(m(t),"played",!1),h(m(t),"isScreen",void 0),h(m(t),"_wechatTimer",void 0),h(m(t),"emitAudioEvent",(function(e){var r,n,i={type:"audio",rawEvent:e,readyState:(null===(r=t._audioDom)||void 0===r?void 0:r.readyState)||0,userId:t.userId,eventName:e.type,currentTime:(null===(n=t._audioDom)||void 0===n?void 0:n.currentTime)||0};"playing"===e.type&&LW.print("AudioPlayerPlaying","[userId-".concat(t.userId,"] audio element playing")),"pause"===e.type&&LW.print("AudioPlayerPause","[userId-".concat(t.userId,"] audio element pause")),RP&&AP&&("canplay"===e.type?(clearTimeout(t._wechatTimer),t._wechatTimer=window.setTimeout((function(){t._autoPlayError("wechat")}),500)):"playing"===e.type&&clearTimeout(t._wechatTimer)),t.emit("playback_event",i)})),h(m(t),"_internalPlay",(function(){var e,r;if(XB("_internalPlay",{paused:null===(e=t._audioDom)||void 0===e?void 0:e.paused}),null!==(r=t._audioDom)&&void 0!==r&&r.paused)try{var n=t._audioDom.play();null!=n&&n.then&&n.catch((function(e){t._autoPlayError(e),MB.rtcError("audio autoplay failed, userId: ".concat(t.userId,": ").concat(e.message," ").concat(e.name),-1e3)})).then((function(){XB("_internalPlay successfully",{userId:t.userId})}))}catch(i){t._autoPlayError(i),MB.rtcError("audio autoplay failed, userId: ".concat(t.userId,": ").concat(i.message," ").concat(i.name),-1e3)}})),o){var c=document.getElementById(o);if(!c)throw new hN(dN.CANT_FIND_DOM,"can't find dom");t._containerDom=c}else t._containerDom=document.body;return t.userId=e,t.muted=a,t.isScreen=s,t._initAudio(),t}return l(i,[{key:"_initAudio",value:function(){this._audioDom||(this._audioDom=MW("audio",{style:{display:"none"},attributes:VW}),this._audioDom.volume=this.muted?0:1,this._audioDom.muted=this.muted,this._audioDom.id="".concat(this.userId,"_").concat(hP()),this._containerDom.appendChild(this._audioDom)),this._initListeners()}},{key:"_initListeners",value:function(){var e=this;this._audioDom&&UW.forEach((function(t){var r;null===(r=e._audioDom)||void 0===r||r.addEventListener(t,e.emitAudioEvent)}))}},{key:"_removeListeners",value:function(){var e=this;this._audioDom&&(UW.forEach((function(t){var r;null===(r=e._audioDom)||void 0===r||r.removeEventListener(t,e.emitAudioEvent)})),this._audioDom.removeEventListener("canplay",this._internalPlay),this._audioDom.removeEventListener("loadeddata",this._internalPlay))}},{key:"playAudio",value:(r=c(o().mark((function e(t){var r,n,i,a,s,c=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(LW.print("playAudio","play audio track: ".concat(this.userId)),!((a=this._audioDom)&&a.srcObject instanceof MediaStream&&a.srcObject.getTrackById(null===(r=t.getTrack())||void 0===r?void 0:r.id))){e.next=4;break}return e.abrupt("return");case 4:a||(this._initAudio(),a=this._audioDom),(s=new MediaStream).addTrack(t.getTrack("preprocessing")),a.srcObject=s,null===(n=a)||void 0===n||n.addEventListener("canplay",this._internalPlay),null===(i=a)||void 0===i||i.addEventListener("loadeddata",this._internalPlay),setTimeout((function(){return c._internalPlay()})),this.played=!0;case 12:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"_autoPlayError",value:function(e){var t,r;this._emitPlayFailed||(this._emitPlayFailed=!0,this.emit("playback_event",{type:"audio",rawEvent:e,readyState:(null===(t=this._audioDom)||void 0===t?void 0:t.readyState)||0,userId:this.userId,eventName:"autoplay-error",currentTime:(null===(r=this._audioDom)||void 0===r?void 0:r.currentTime)||0}))}},{key:"pause",value:function(){if(!this._audioDom)throw new hN(dN.INVALID_PARAMS,"Player not found");this._audioDom.pause()}},{key:"manuallyPlay",value:function(){var e;if(LW.print("Invoke AudioPlayer.manuallyPlay"),this._emitPlayFailed=!1,!this._audioDom)throw new hN(dN.INVALID_PARAMS,"Player not found");if(!this.played)return Promise.resolve();this._audioDom.volume=1,this._audioDom.muted=!1,null===(e=this._fakeAudioDom)||void 0===e||e.play();var t=this._audioDom.play();return null!=t&&t.then?t:Promise.resolve(t)}},{key:"setPlaybackDevice",value:(t=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return LW.print("setPlaybackDevice","setPlaybackDevice: ".concat(t)),e.next=3,UH.enumerateAudioPlaybackDevices();case 3:if(e.sent.map((function(e){return e.deviceId})).includes(t)&&this._audioDom&&this._audioDom.setSinkId){e.next=7;break}return e.abrupt("return");case 7:return e.next=9,this._audioDom.setSinkId(t);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"stop",value:function(){var e=this._containerDom;LW.print("stopAudio","stop audio track: ".concat(this.userId)),this._audioDom&&(this._audioDom.srcObject=null,null!=e&&e.contains(this._audioDom)&&e.removeChild(this._audioDom)),this._fakeAudioDom&&(this._fakeAudioDom.srcObject=null,this._fakeAudioDom=void 0),this.played=!1}},{key:"domElement",get:function(){return this._audioDom}},{key:"destroy",value:function(){LW.print("destroy","audio player: ".concat(this.userId)),this.stop(),b(p(i.prototype),"removeAllListeners",this).call(this),this._removeListeners(),this._audioDom&&(this._audioDom.srcObject=null,delete this._audioDom)}}]),i}(jL.exports.EventEmitter);function GW(e,t,r,n){var i=function(){var e=c(o().mark((function e(t,i){var a,s;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=null==n?void 0:n.get(i),Array.isArray(a)&&(a=null===(s=a)||void 0===s?void 0:s.find((function(e){return e.isScreen===r}))),!t){e.next=9;break}if(!t.played){e.next=8;break}return e.next=6,t.manuallyPlay();case 6:e.next=9;break;case 8:a&&(t instanceof BW&&a.videoTrack&&t.playVideo(a.videoTrack,a),t instanceof jW&&a.audioTrack&&t.playAudio(a.audioTrack));case 9:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}();if(t)return i(e.get(t),t);var a=[];return e.forEach((function(e,t){return a.push(i(e,t))})),Promise.all(a)}var HW=function(){function e(){u(this,e),h(this,"_timer",void 0),h(this,"userMessage",void 0),h(this,"roomMessage",void 0),this.userMessage={},this.roomMessage={},this._setTimer()}return l(e,[{key:"_setTimer",value:function(){var e=this;!function t(){e._reportAndgReset(),clearTimeout(e._timer),e._timer=setTimeout(t,1e4)}()}},{key:"_reportAndgReset",value:function(){(Object.keys(this.userMessage).length||Object.keys(this.roomMessage).length)&&(this._report(),this._reset())}},{key:"_report",value:function(){var e=this;MB.rtcMessageStatistics(Object.keys(this.userMessage).map((function(t){return e.userMessage[t]})),Object.keys(this.roomMessage).map((function(t){return e.roomMessage[t]})),"")}},{key:"_reset",value:function(){this.userMessage={},this.roomMessage={}}},{key:"_checkInitUserMessage",value:function(e,t){this.userMessage["".concat(t,"-").concat(e)]||(this.userMessage["".concat(t,"-").concat(e)]={dc_peer_user_id:e,dc_send_total:0,dc_recv_total:0,dc_send_ack:0,dc_send_fail:0,dc_fail_timeout:0,dc_fail_no_receiver:0,dc_fail_no_relay_path:0,dc_cost_time:0,dc_cost_e2s:0,dc_cost_s2s:0,dc_least_time:1/0,dc_most_time:0,dc_cost_peer_s2e:0,dc_send_ack_100:0,dc_send_ack_200:0,dc_send_ack_400:0,dc_send_ack_1s:0,dc_message_type:t,dc_send_binary:0})}},{key:"_sendUserMessage",value:function(e,t,r){this._checkInitUserMessage(e,t),this.userMessage["".concat(t,"-").concat(e)].dc_send_total++,r&&this.userMessage["".concat(t,"-").concat(e)].dc_send_binary++}},{key:"_recvUserMessage",value:function(e,t){this._checkInitUserMessage(e,t),this.userMessage["".concat(t,"-").concat(e)].dc_recv_total++}},{key:"_sendUserFail",value:function(e,t,r){var n=this.userMessage["".concat(t,"-").concat(e)];n&&(n.dc_send_fail++,this._handleUserFail(n,r))}},{key:"_handleUserFail",value:function(e,t){t&&(t.code||t.err)&&(t.code===dN.TIME_OUT?e.dc_fail_timeout++:t.err===bj.NO_RECEIVER?e.dc_fail_no_receiver++:t.err===bj.NO_RELAYPATH?e.dc_fail_no_relay_path++:t.err===bj.TIMEOUT&&e.dc_fail_timeout++)}},{key:"_sendUserAck",value:function(e,t,r,n,i){var o=this.userMessage["".concat(t,"-").concat(e)];o&&(o.dc_send_ack++,o.dc_cost_time+=r,o.dc_cost_s2s+=n||0,o.dc_cost_peer_s2e+=i,o.dc_cost_e2s+=r-(n||0)-i,r<=100?(o.dc_send_ack_100++,o.dc_send_ack_200++,o.dc_send_ack_400++,o.dc_send_ack_1s++):r<=200?(o.dc_send_ack_200++,o.dc_send_ack_400++,o.dc_send_ack_1s++):r<=400?(o.dc_send_ack_400++,o.dc_send_ack_1s++):r<=1e3&&o.dc_send_ack_1s++,r<o.dc_least_time&&(o.dc_least_time=r),r>o.dc_most_time&&(o.dc_most_time=r))}},{key:"sendRoomMessage",value:function(e,t){this.roomMessage[e]||(this.roomMessage[e]={dc_room_id:e,dc_send_total:0,dc_send_ack:0,dc_cost_time:0,dc_least_time:1/0,dc_most_time:0,dc_send_fail:0,dc_send_ack_100:0,dc_send_ack_200:0,dc_send_ack_400:0,dc_send_ack_1s:0,dc_send_binary:0}),this.roomMessage[e].dc_send_total++,t&&this.roomMessage[e].dc_send_binary++}},{key:"sendRoomFail",value:function(e){var t=this.roomMessage[e];t&&t.dc_send_fail++}},{key:"sendRoomAck",value:function(e,t){var r=this.roomMessage[e];r&&(r.dc_send_ack++,r.dc_cost_time+=t,t<r.dc_least_time&&(r.dc_least_time=t),t>r.dc_most_time&&(r.dc_most_time=t),t<=100?(r.dc_send_ack_100++,r.dc_send_ack_200++,r.dc_send_ack_400++,r.dc_send_ack_1s++):t<=200?(r.dc_send_ack_200++,r.dc_send_ack_400++,r.dc_send_ack_1s++):t<=400?(r.dc_send_ack_400++,r.dc_send_ack_1s++):t<=1e3&&r.dc_send_ack_1s++)}},{key:"sendP2PMessage",value:function(e,t){this._sendUserMessage(e,OB.P2P,t)}},{key:"recvP2PMessage",value:function(e){this._recvUserMessage(e,OB.P2P)}},{key:"sendP2PFail",value:function(e,t){this._sendUserFail(e,OB.P2P,t)}},{key:"sendP2PAck",value:function(e,t,r,n){this._sendUserAck(e,OB.P2P,t,r,n)}},{key:"sendP2POutRoomMessage",value:function(e,t){this._sendUserMessage(e,OB.P2P_OUTSIDE_ROOM,t)}},{key:"recvP2POutRoomMessage",value:function(e){this._recvUserMessage(e,OB.P2P_OUTSIDE_ROOM)}},{key:"sendP2POutRoomFail",value:function(e,t){this._sendUserFail(e,OB.P2P_OUTSIDE_ROOM,t)}},{key:"sendP2POutRoomAck",value:function(e,t,r,n){this._sendUserAck(e,OB.P2P_OUTSIDE_ROOM,t,r,n)}},{key:"sendP2serverMessage",value:function(e){this._sendUserMessage("",OB.P2SERVER,e)}},{key:"sendP2serverFail",value:function(e){this._sendUserFail("",OB.P2SERVER,e)}},{key:"sendP2serveAck",value:function(e){this._sendUserAck("",OB.P2SERVER,e,0,0)}},{key:"countP2PMessage",value:function(e,t,r,n,i){this.sendP2PMessage(t,r),e?this.sendP2PAck(t,Date.now()-n,i.s2s_time,i.s2e_time):this.sendP2PFail(t,i)}},{key:"countRoomMessage",value:function(e,t,r,n){this.sendRoomMessage(t,r),e?this.sendRoomAck(t,Date.now()-n):this.sendRoomFail(t)}},{key:"countUserMessageOutsideRoom",value:function(e,t,r,n,i){this.sendP2POutRoomMessage(t,r),e?this.sendP2POutRoomAck(t,Date.now()-n,i.s2s_time,i.s2e_time):this.sendP2POutRoomFail(t,i)}},{key:"countServerMessage",value:function(e,t,r,n){this.sendP2serverMessage(t),e?this.sendP2serveAck(Date.now()-r):this.sendP2serverFail(n)}},{key:"destroy",value:function(){this._reset(),clearTimeout(this._timer)}}]),e}(),zW="object"==typeof global&&global&&global.Object===Object&&global,XW="object"==typeof self&&self&&self.Object===Object&&self,KW=zW||XW||Function("return this")(),qW=KW.Symbol,WW=Object.prototype,YW=WW.hasOwnProperty,JW=WW.toString,QW=qW?qW.toStringTag:void 0;var ZW=Object.prototype.toString;var $W=qW?qW.toStringTag:void 0;function eY(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":$W&&$W in Object(e)?function(e){var t=YW.call(e,QW),r=e[QW];try{e[QW]=void 0;var n=!0}catch(o){}var i=JW.call(e);return n&&(t?e[QW]=r:delete e[QW]),i}(e):function(e){return ZW.call(e)}(e)}function tY(e){return null!=e&&"object"==typeof e}var rY=Array.isArray;function nY(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function iY(e){return e}function oY(e){if(!nY(e))return!1;var t=eY(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}var aY,sY=KW["__core-js_shared__"],cY=(aY=/[^.]+$/.exec(sY&&sY.keys&&sY.keys.IE_PROTO||""))?"Symbol(src)_1."+aY:"";var uY=Function.prototype.toString;var dY=/^\[object .+?Constructor\]$/,lY=Function.prototype,hY=Object.prototype,fY=lY.toString,pY=hY.hasOwnProperty,vY=RegExp("^"+fY.call(pY).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function _Y(e){return!(!nY(e)||(t=e,cY&&cY in t))&&(oY(e)?vY:dY).test(function(e){if(null!=e){try{return uY.call(e)}catch(t){}try{return e+""}catch(t){}}return""}(e));var t}function mY(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}var yY=Date.now;var gY,SY,bY,EY=function(){try{var e=_Y(t=function(e,t){return null==e?void 0:e[t]}(Object,"defineProperty"))?t:void 0;return e({},"",{}),e}catch(r){}var t}(),kY=EY,TY=kY?function(e,t){return kY(e,"toString",{configurable:!0,enumerable:!1,value:(r=t,function(){return r}),writable:!0});var r}:iY,IY=(gY=TY,SY=0,bY=0,function(){var e=yY(),t=16-(e-bY);if(bY=e,t>0){if(++SY>=800)return arguments[0]}else SY=0;return gY.apply(void 0,arguments)}),AY=IY,RY=/^(?:0|[1-9]\d*)$/;function wY(e,t){var r=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==r||"symbol"!=r&&RY.test(e))&&e>-1&&e%1==0&&e<t}function CY(e,t,r){"__proto__"==t&&kY?kY(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function OY(e,t){return e===t||e!=e&&t!=t}var xY=Object.prototype.hasOwnProperty;function DY(e,t,r){var n=e[t];xY.call(e,t)&&OY(n,r)&&(void 0!==r||t in e)||CY(e,t,r)}var NY=Math.max;function PY(e,t){return AY(function(e,t,r){return t=NY(void 0===t?e.length-1:t,0),function(){for(var n=arguments,i=-1,o=NY(n.length-t,0),a=Array(o);++i<o;)a[i]=n[t+i];i=-1;for(var s=Array(t+1);++i<t;)s[i]=n[i];return s[t]=r(a),mY(e,this,s)}}(e,t,iY),e+"")}function MY(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function LY(e){return null!=e&&MY(e.length)&&!oY(e)}var UY=Object.prototype;function VY(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||UY)}function FY(e){return tY(e)&&"[object Arguments]"==eY(e)}var BY=Object.prototype,jY=BY.hasOwnProperty,GY=BY.propertyIsEnumerable,HY=FY(function(){return arguments}())?FY:function(e){return tY(e)&&jY.call(e,"callee")&&!GY.call(e,"callee")},zY=HY;var XY="object"==typeof exports&&exports&&!exports.nodeType&&exports,KY=XY&&"object"==typeof module&&module&&!module.nodeType&&module,qY=KY&&KY.exports===XY?KW.Buffer:void 0,WY=(qY?qY.isBuffer:void 0)||function(){return!1},YY={};YY["[object Float32Array]"]=YY["[object Float64Array]"]=YY["[object Int8Array]"]=YY["[object Int16Array]"]=YY["[object Int32Array]"]=YY["[object Uint8Array]"]=YY["[object Uint8ClampedArray]"]=YY["[object Uint16Array]"]=YY["[object Uint32Array]"]=!0,YY["[object Arguments]"]=YY["[object Array]"]=YY["[object ArrayBuffer]"]=YY["[object Boolean]"]=YY["[object DataView]"]=YY["[object Date]"]=YY["[object Error]"]=YY["[object Function]"]=YY["[object Map]"]=YY["[object Number]"]=YY["[object Object]"]=YY["[object RegExp]"]=YY["[object Set]"]=YY["[object String]"]=YY["[object WeakMap]"]=!1;var JY="object"==typeof exports&&exports&&!exports.nodeType&&exports,QY=JY&&"object"==typeof module&&module&&!module.nodeType&&module,ZY=QY&&QY.exports===JY&&zW.process,$Y=function(){try{var e=QY&&QY.require&&QY.require("util").types;return e||ZY&&ZY.binding&&ZY.binding("util")}catch(t){}}(),eJ=$Y&&$Y.isTypedArray,tJ=eJ?function(e){return function(t){return e(t)}}(eJ):function(e){return tY(e)&&MY(e.length)&&!!YY[eY(e)]},rJ=tJ,nJ=Object.prototype.hasOwnProperty;function iJ(e,t){var r=rY(e),n=!r&&zY(e),i=!r&&!n&&WY(e),o=!r&&!n&&!i&&rJ(e),a=r||n||i||o,s=a?function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(e.length,String):[],c=s.length;for(var u in e)!t&&!nJ.call(e,u)||a&&("length"==u||i&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||wY(u,c))||s.push(u);return s}var oJ=function(e,t){return function(r){return e(t(r))}}(Object.keys,Object),aJ=oJ,sJ=Object.prototype.hasOwnProperty;function cJ(e){return LY(e)?iJ(e):function(e){if(!VY(e))return aJ(e);var t=[];for(var r in Object(e))sJ.call(e,r)&&"constructor"!=r&&t.push(r);return t}(e)}var uJ=Object.prototype.hasOwnProperty;function dJ(e){if(!nY(e))return function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t}(e);var t=VY(e),r=[];for(var n in e)("constructor"!=n||!t&&uJ.call(e,n))&&r.push(n);return r}var lJ,hJ=(lJ=function(e,t){!function(e,t,r,n){var i=!r;r||(r={});for(var o=-1,a=t.length;++o<a;){var s=t[o],c=n?n(r[s],e[s],s,r,e):void 0;void 0===c&&(c=e[s]),i?CY(r,s,c):DY(r,s,c)}}(t,function(e){return LY(e)?iJ(e,!0):dJ(e)}(t),e)},PY((function(e,t){var r=-1,n=t.length,i=n>1?t[n-1]:void 0,o=n>2?t[2]:void 0;for(i=lJ.length>3&&"function"==typeof i?(n--,i):void 0,o&&function(e,t,r){if(!nY(r))return!1;var n=typeof t;return!!("number"==n?LY(r)&&wY(t,r.length):"string"==n&&t in r)&&OY(r[t],e)}(t[0],t[1],o)&&(i=n<3?void 0:i,n=1),e=Object(e);++r<n;){var a=t[r];a&&lJ(e,a,r,i)}return e})));function fJ(e,t){return function(e,t){for(var r=-1,n=null==e?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}(t,(function(t){return e[t]}))}function pJ(e){return null==e?[]:fJ(e,cJ(e))}var vJ=de,_J=sr("iterator"),mJ=!vJ((function(){var e=new URL("b?a=1&b=2&c=3","http://a"),t=e.searchParams,r="";return e.pathname="c%20d",t.forEach((function(e,n){t.delete("b"),r+=n+e})),!t.sort||"http://a/c%20d?a=1&c=3"!==e.href||"3"!==t.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!t[_J]||"a"!==new URL("https://a@b").username||"b"!==new URLSearchParams(new URLSearchParams("a=b")).get("a")||"xn--e1aybc"!==new URL("http://тест").host||"#%D0%B1"!==new URL("http://a#б").hash||"a1c3"!==r||"x"!==new URL("http://x",void 0).host})),yJ=Re,gJ=2147483647,SJ=/[^\0-\u007E]/,bJ=/[.\u3002\uFF0E\uFF61]/g,EJ="Overflow: input needs wider integers to process",kJ=RangeError,TJ=yJ(bJ.exec),IJ=Math.floor,AJ=String.fromCharCode,RJ=yJ("".charCodeAt),wJ=yJ([].join),CJ=yJ([].push),OJ=yJ("".replace),xJ=yJ("".split),DJ=yJ("".toLowerCase),NJ=function(e){return e+22+75*(e<26)},PJ=function(e,t,r){var n=0;for(e=r?IJ(e/700):e>>1,e+=IJ(e/t);e>455;)e=IJ(e/35),n+=36;return IJ(n+36*e/(e+38))},MJ=function(e){var t=[];e=function(e){for(var t=[],r=0,n=e.length;r<n;){var i=RJ(e,r++);if(i>=55296&&i<=56319&&r<n){var o=RJ(e,r++);56320==(64512&o)?CJ(t,((1023&i)<<10)+(1023&o)+65536):(CJ(t,i),r--)}else CJ(t,i)}return t}(e);var r,n,i=e.length,o=128,a=0,s=72;for(r=0;r<e.length;r++)(n=e[r])<128&&CJ(t,AJ(n));var c=t.length,u=c;for(c&&CJ(t,"-");u<i;){var d=gJ;for(r=0;r<e.length;r++)(n=e[r])>=o&&n<d&&(d=n);var l=u+1;if(d-o>IJ((gJ-a)/l))throw kJ(EJ);for(a+=(d-o)*l,o=d,r=0;r<e.length;r++){if((n=e[r])<o&&++a>gJ)throw kJ(EJ);if(n==o){for(var h=a,f=36;;){var p=f<=s?1:f>=s+26?26:f-s;if(h<p)break;var v=h-p,_=36-p;CJ(t,AJ(NJ(p+v%_))),h=IJ(v/_),f+=36}CJ(t,AJ(NJ(h))),s=PJ(a,l,u==c),a=0,u++}}a++,o++}return wJ(t,"")},LJ=ro,UJ=ce,VJ=ve,FJ=Re,BJ=le,jJ=mJ,GJ=$n,HJ=jh,zJ=ed,XJ=sd,KJ=Ln,qJ=ph,WJ=qe,YJ=Xt,JJ=ga,QJ=So,ZJ=Fr,$J=Je,eQ=As,tQ=cs,rQ=Ee,nQ=ql,iQ=Bl,oQ=x_,aQ=PI,sQ=sr("iterator"),cQ="URLSearchParams",uQ="URLSearchParamsIterator",dQ=KJ.set,lQ=KJ.getterFor(cQ),hQ=KJ.getterFor(uQ),fQ=Object.getOwnPropertyDescriptor,pQ=function(e){if(!BJ)return UJ[e];var t=fQ(UJ,e);return t&&t.value},vQ=pQ("fetch"),_Q=pQ("Request"),mQ=pQ("Headers"),yQ=_Q&&_Q.prototype,gQ=mQ&&mQ.prototype,SQ=UJ.RegExp,bQ=UJ.TypeError,EQ=UJ.decodeURIComponent,kQ=UJ.encodeURIComponent,TQ=FJ("".charAt),IQ=FJ([].join),AQ=FJ([].push),RQ=FJ("".replace),wQ=FJ([].shift),CQ=FJ([].splice),OQ=FJ("".split),xQ=FJ("".slice),DQ=/\+/g,NQ=Array(4),PQ=function(e){return NQ[e-1]||(NQ[e-1]=SQ("((?:%[\\da-f]{2}){"+e+"})","gi"))},MQ=function(e){try{return EQ(e)}catch(T0){return e}},LQ=function(e){var t=RQ(e,DQ," "),r=4;try{return EQ(t)}catch(T0){for(;r;)t=RQ(t,PQ(r--),MQ);return t}},UQ=/[!'()~]|%20/g,VQ={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},FQ=function(e){return VQ[e]},BQ=function(e){return RQ(kQ(e),UQ,FQ)},jQ=XJ((function(e,t){dQ(this,{type:uQ,iterator:nQ(lQ(e).entries),kind:t})}),"Iterator",(function(){var e=hQ(this),t=e.kind,r=e.iterator.next(),n=r.value;return r.done||(r.value="keys"===t?n.key:"values"===t?n.value:[n.key,n.value]),r}),!0),GQ=function(e){this.entries=[],this.url=null,void 0!==e&&($J(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===TQ(e,0)?xQ(e,1):e:eQ(e)))};GQ.prototype={type:cQ,bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t,r,n,i,o,a,s,c=iQ(e);if(c)for(r=(t=nQ(e,c)).next;!(n=VJ(r,t)).done;){if(o=(i=nQ(ZJ(n.value))).next,(a=VJ(o,i)).done||(s=VJ(o,i)).done||!VJ(o,i).done)throw bQ("Expected sequence with length 2");AQ(this.entries,{key:eQ(a.value),value:eQ(s.value)})}else for(var u in e)YJ(e,u)&&AQ(this.entries,{key:u,value:eQ(e[u])})},parseQuery:function(e){if(e)for(var t,r,n=OQ(e,"&"),i=0;i<n.length;)(t=n[i++]).length&&(r=OQ(t,"="),AQ(this.entries,{key:LQ(wQ(r)),value:LQ(IQ(r,"="))}))},serialize:function(){for(var e,t=this.entries,r=[],n=0;n<t.length;)e=t[n++],AQ(r,BQ(e.key)+"="+BQ(e.value));return IQ(r,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var HQ=function(){qJ(this,zQ);var e=arguments.length>0?arguments[0]:void 0;dQ(this,new GQ(e))},zQ=HQ.prototype;if(HJ(zQ,{append:function(e,t){oQ(arguments.length,2);var r=lQ(this);AQ(r.entries,{key:eQ(e),value:eQ(t)}),r.updateURL()},delete:function(e){oQ(arguments.length,1);for(var t=lQ(this),r=t.entries,n=eQ(e),i=0;i<r.length;)r[i].key===n?CQ(r,i,1):i++;t.updateURL()},get:function(e){oQ(arguments.length,1);for(var t=lQ(this).entries,r=eQ(e),n=0;n<t.length;n++)if(t[n].key===r)return t[n].value;return null},getAll:function(e){oQ(arguments.length,1);for(var t=lQ(this).entries,r=eQ(e),n=[],i=0;i<t.length;i++)t[i].key===r&&AQ(n,t[i].value);return n},has:function(e){oQ(arguments.length,1);for(var t=lQ(this).entries,r=eQ(e),n=0;n<t.length;)if(t[n++].key===r)return!0;return!1},set:function(e,t){oQ(arguments.length,1);for(var r,n=lQ(this),i=n.entries,o=!1,a=eQ(e),s=eQ(t),c=0;c<i.length;c++)(r=i[c]).key===a&&(o?CQ(i,c--,1):(o=!0,r.value=s));o||AQ(i,{key:a,value:s}),n.updateURL()},sort:function(){var e=lQ(this);aQ(e.entries,(function(e,t){return e.key>t.key?1:-1})),e.updateURL()},forEach:function(e){for(var t,r=lQ(this).entries,n=JJ(e,arguments.length>1?arguments[1]:void 0),i=0;i<r.length;)n((t=r[i++]).value,t.key,this)},keys:function(){return new jQ(this,"keys")},values:function(){return new jQ(this,"values")},entries:function(){return new jQ(this,"entries")}},{enumerable:!0}),GJ(zQ,sQ,zQ.entries,{name:"entries"}),GJ(zQ,"toString",(function(){return lQ(this).serialize()}),{enumerable:!0}),zJ(HQ,cQ),LJ({global:!0,constructor:!0,forced:!jJ},{URLSearchParams:HQ}),!jJ&&WJ(mQ)){var XQ=FJ(gQ.has),KQ=FJ(gQ.set),qQ=function(e){if($J(e)){var t,r=e.body;if(QJ(r)===cQ)return t=e.headers?new mQ(e.headers):new mQ,XQ(t,"content-type")||KQ(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),tQ(e,{body:rQ(0,eQ(r)),headers:rQ(0,t)})}return e};if(WJ(vQ)&&LJ({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(e){return vQ(e,arguments.length>1?qQ(arguments[1]):{})}}),WJ(_Q)){var WQ=function(e){return qJ(this,yQ),new _Q(e,arguments.length>1?qQ(arguments[1]):{})};yQ.constructor=WQ,WQ.prototype=yQ,LJ({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:WQ})}}var YQ,JQ=ro,QQ=le,ZQ=mJ,$Q=ce,eZ=ga,tZ=Re,rZ=$n,nZ=Og,iZ=ph,oZ=Xt,aZ=Gp,sZ=QN,cZ=rl,uZ=Qc.codeAt,dZ=function(e){var t,r,n=[],i=xJ(OJ(DJ(e),bJ,"."),".");for(t=0;t<i.length;t++)r=i[t],CJ(n,TJ(SJ,r)?"xn--"+MJ(r):r);return wJ(n,".")},lZ=As,hZ=ed,fZ=x_,pZ={URLSearchParams:HQ,getState:lQ},vZ=Ln,_Z=vZ.set,mZ=vZ.getterFor("URL"),yZ=pZ.URLSearchParams,gZ=pZ.getState,SZ=$Q.URL,bZ=$Q.TypeError,EZ=$Q.parseInt,kZ=Math.floor,TZ=Math.pow,IZ=tZ("".charAt),AZ=tZ(/./.exec),RZ=tZ([].join),wZ=tZ(1..toString),CZ=tZ([].pop),OZ=tZ([].push),xZ=tZ("".replace),DZ=tZ([].shift),NZ=tZ("".split),PZ=tZ("".slice),MZ=tZ("".toLowerCase),LZ=tZ([].unshift),UZ="Invalid scheme",VZ="Invalid host",FZ="Invalid port",BZ=/[a-z]/i,jZ=/[\d+-.a-z]/i,GZ=/\d/,HZ=/^0x/i,zZ=/^[0-7]+$/,XZ=/^\d+$/,KZ=/^[\da-f]+$/i,qZ=/[\0\t\n\r #%/:<>?@[\\\]^|]/,WZ=/[\0\t\n\r #/:<>?@[\\\]^|]/,YZ=/^[\u0000-\u0020]+|[\u0000-\u0020]+$/g,JZ=/[\t\n\r]/g,QZ=function(e){var t,r,n,i;if("number"==typeof e){for(t=[],r=0;r<4;r++)LZ(t,e%256),e=kZ(e/256);return RZ(t,".")}if("object"==typeof e){for(t="",n=function(e){for(var t=null,r=1,n=null,i=0,o=0;o<8;o++)0!==e[o]?(i>r&&(t=n,r=i),n=null,i=0):(null===n&&(n=o),++i);return i>r&&(t=n,r=i),t}(e),r=0;r<8;r++)i&&0===e[r]||(i&&(i=!1),n===r?(t+=r?":":"::",i=!0):(t+=wZ(e[r],16),r<7&&(t+=":")));return"["+t+"]"}return e},ZZ={},$Z=aZ({},ZZ,{" ":1,'"':1,"<":1,">":1,"`":1}),e$=aZ({},$Z,{"#":1,"?":1,"{":1,"}":1}),t$=aZ({},e$,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),r$=function(e,t){var r=uZ(e,0);return r>32&&r<127&&!oZ(t,e)?e:encodeURIComponent(e)},n$={ftp:21,file:null,http:80,https:443,ws:80,wss:443},i$=function(e,t){var r;return 2==e.length&&AZ(BZ,IZ(e,0))&&(":"==(r=IZ(e,1))||!t&&"|"==r)},o$=function(e){var t;return e.length>1&&i$(PZ(e,0,2))&&(2==e.length||"/"===(t=IZ(e,2))||"\\"===t||"?"===t||"#"===t)},a$=function(e){return"."===e||"%2e"===MZ(e)},s$={},c$={},u$={},d$={},l$={},h$={},f$={},p$={},v$={},_$={},m$={},y$={},g$={},S$={},b$={},E$={},k$={},T$={},I$={},A$={},R$={},w$=function(e,t,r){var n,i,o,a=lZ(e);if(t){if(i=this.parse(a))throw bZ(i);this.searchParams=null}else{if(void 0!==r&&(n=new w$(r,!0)),i=this.parse(a,null,n))throw bZ(i);(o=gZ(new yZ)).bindURL(this),this.searchParams=o}};w$.prototype={type:"URL",parse:function(e,t,r){var n,i,o,a,s,c=this,u=t||s$,d=0,l="",h=!1,f=!1,p=!1;for(e=lZ(e),t||(c.scheme="",c.username="",c.password="",c.host=null,c.port=null,c.path=[],c.query=null,c.fragment=null,c.cannotBeABaseURL=!1,e=xZ(e,YZ,"")),e=xZ(e,JZ,""),n=sZ(e);d<=n.length;){switch(i=n[d],u){case s$:if(!i||!AZ(BZ,i)){if(t)return UZ;u=u$;continue}l+=MZ(i),u=c$;break;case c$:if(i&&(AZ(jZ,i)||"+"==i||"-"==i||"."==i))l+=MZ(i);else{if(":"!=i){if(t)return UZ;l="",u=u$,d=0;continue}if(t&&(c.isSpecial()!=oZ(n$,l)||"file"==l&&(c.includesCredentials()||null!==c.port)||"file"==c.scheme&&!c.host))return;if(c.scheme=l,t)return void(c.isSpecial()&&n$[c.scheme]==c.port&&(c.port=null));l="","file"==c.scheme?u=S$:c.isSpecial()&&r&&r.scheme==c.scheme?u=d$:c.isSpecial()?u=p$:"/"==n[d+1]?(u=l$,d++):(c.cannotBeABaseURL=!0,OZ(c.path,""),u=I$)}break;case u$:if(!r||r.cannotBeABaseURL&&"#"!=i)return UZ;if(r.cannotBeABaseURL&&"#"==i){c.scheme=r.scheme,c.path=cZ(r.path),c.query=r.query,c.fragment="",c.cannotBeABaseURL=!0,u=R$;break}u="file"==r.scheme?S$:h$;continue;case d$:if("/"!=i||"/"!=n[d+1]){u=h$;continue}u=v$,d++;break;case l$:if("/"==i){u=_$;break}u=T$;continue;case h$:if(c.scheme=r.scheme,i==YQ)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=cZ(r.path),c.query=r.query;else if("/"==i||"\\"==i&&c.isSpecial())u=f$;else if("?"==i)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=cZ(r.path),c.query="",u=A$;else{if("#"!=i){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=cZ(r.path),c.path.length--,u=T$;continue}c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=cZ(r.path),c.query=r.query,c.fragment="",u=R$}break;case f$:if(!c.isSpecial()||"/"!=i&&"\\"!=i){if("/"!=i){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,u=T$;continue}u=_$}else u=v$;break;case p$:if(u=v$,"/"!=i||"/"!=IZ(l,d+1))continue;d++;break;case v$:if("/"!=i&&"\\"!=i){u=_$;continue}break;case _$:if("@"==i){h&&(l="%40"+l),h=!0,o=sZ(l);for(var v=0;v<o.length;v++){var _=o[v];if(":"!=_||p){var m=r$(_,t$);p?c.password+=m:c.username+=m}else p=!0}l=""}else if(i==YQ||"/"==i||"?"==i||"#"==i||"\\"==i&&c.isSpecial()){if(h&&""==l)return"Invalid authority";d-=sZ(l).length+1,l="",u=m$}else l+=i;break;case m$:case y$:if(t&&"file"==c.scheme){u=E$;continue}if(":"!=i||f){if(i==YQ||"/"==i||"?"==i||"#"==i||"\\"==i&&c.isSpecial()){if(c.isSpecial()&&""==l)return VZ;if(t&&""==l&&(c.includesCredentials()||null!==c.port))return;if(a=c.parseHost(l))return a;if(l="",u=k$,t)return;continue}"["==i?f=!0:"]"==i&&(f=!1),l+=i}else{if(""==l)return VZ;if(a=c.parseHost(l))return a;if(l="",u=g$,t==y$)return}break;case g$:if(!AZ(GZ,i)){if(i==YQ||"/"==i||"?"==i||"#"==i||"\\"==i&&c.isSpecial()||t){if(""!=l){var y=EZ(l,10);if(y>65535)return FZ;c.port=c.isSpecial()&&y===n$[c.scheme]?null:y,l=""}if(t)return;u=k$;continue}return FZ}l+=i;break;case S$:if(c.scheme="file","/"==i||"\\"==i)u=b$;else{if(!r||"file"!=r.scheme){u=T$;continue}if(i==YQ)c.host=r.host,c.path=cZ(r.path),c.query=r.query;else if("?"==i)c.host=r.host,c.path=cZ(r.path),c.query="",u=A$;else{if("#"!=i){o$(RZ(cZ(n,d),""))||(c.host=r.host,c.path=cZ(r.path),c.shortenPath()),u=T$;continue}c.host=r.host,c.path=cZ(r.path),c.query=r.query,c.fragment="",u=R$}}break;case b$:if("/"==i||"\\"==i){u=E$;break}r&&"file"==r.scheme&&!o$(RZ(cZ(n,d),""))&&(i$(r.path[0],!0)?OZ(c.path,r.path[0]):c.host=r.host),u=T$;continue;case E$:if(i==YQ||"/"==i||"\\"==i||"?"==i||"#"==i){if(!t&&i$(l))u=T$;else if(""==l){if(c.host="",t)return;u=k$}else{if(a=c.parseHost(l))return a;if("localhost"==c.host&&(c.host=""),t)return;l="",u=k$}continue}l+=i;break;case k$:if(c.isSpecial()){if(u=T$,"/"!=i&&"\\"!=i)continue}else if(t||"?"!=i)if(t||"#"!=i){if(i!=YQ&&(u=T$,"/"!=i))continue}else c.fragment="",u=R$;else c.query="",u=A$;break;case T$:if(i==YQ||"/"==i||"\\"==i&&c.isSpecial()||!t&&("?"==i||"#"==i)){if(".."===(s=MZ(s=l))||"%2e."===s||".%2e"===s||"%2e%2e"===s?(c.shortenPath(),"/"==i||"\\"==i&&c.isSpecial()||OZ(c.path,"")):a$(l)?"/"==i||"\\"==i&&c.isSpecial()||OZ(c.path,""):("file"==c.scheme&&!c.path.length&&i$(l)&&(c.host&&(c.host=""),l=IZ(l,0)+":"),OZ(c.path,l)),l="","file"==c.scheme&&(i==YQ||"?"==i||"#"==i))for(;c.path.length>1&&""===c.path[0];)DZ(c.path);"?"==i?(c.query="",u=A$):"#"==i&&(c.fragment="",u=R$)}else l+=r$(i,e$);break;case I$:"?"==i?(c.query="",u=A$):"#"==i?(c.fragment="",u=R$):i!=YQ&&(c.path[0]+=r$(i,ZZ));break;case A$:t||"#"!=i?i!=YQ&&("'"==i&&c.isSpecial()?c.query+="%27":c.query+="#"==i?"%23":r$(i,ZZ)):(c.fragment="",u=R$);break;case R$:i!=YQ&&(c.fragment+=r$(i,$Z))}d++}},parseHost:function(e){var t,r,n;if("["==IZ(e,0)){if("]"!=IZ(e,e.length-1))return VZ;if(t=function(e){var t,r,n,i,o,a,s,c=[0,0,0,0,0,0,0,0],u=0,d=null,l=0,h=function(){return IZ(e,l)};if(":"==h()){if(":"!=IZ(e,1))return;l+=2,d=++u}for(;h();){if(8==u)return;if(":"!=h()){for(t=r=0;r<4&&AZ(KZ,h());)t=16*t+EZ(h(),16),l++,r++;if("."==h()){if(0==r)return;if(l-=r,u>6)return;for(n=0;h();){if(i=null,n>0){if(!("."==h()&&n<4))return;l++}if(!AZ(GZ,h()))return;for(;AZ(GZ,h());){if(o=EZ(h(),10),null===i)i=o;else{if(0==i)return;i=10*i+o}if(i>255)return;l++}c[u]=256*c[u]+i,2!=++n&&4!=n||u++}if(4!=n)return;break}if(":"==h()){if(l++,!h())return}else if(h())return;c[u++]=t}else{if(null!==d)return;l++,d=++u}}if(null!==d)for(a=u-d,u=7;0!=u&&a>0;)s=c[u],c[u--]=c[d+a-1],c[d+--a]=s;else if(8!=u)return;return c}(PZ(e,1,-1)),!t)return VZ;this.host=t}else if(this.isSpecial()){if(e=dZ(e),AZ(qZ,e))return VZ;if(t=function(e){var t,r,n,i,o,a,s,c=NZ(e,".");if(c.length&&""==c[c.length-1]&&c.length--,(t=c.length)>4)return e;for(r=[],n=0;n<t;n++){if(""==(i=c[n]))return e;if(o=10,i.length>1&&"0"==IZ(i,0)&&(o=AZ(HZ,i)?16:8,i=PZ(i,8==o?1:2)),""===i)a=0;else{if(!AZ(10==o?XZ:8==o?zZ:KZ,i))return e;a=EZ(i,o)}OZ(r,a)}for(n=0;n<t;n++)if(a=r[n],n==t-1){if(a>=TZ(256,5-t))return null}else if(a>255)return null;for(s=CZ(r),n=0;n<r.length;n++)s+=r[n]*TZ(256,3-n);return s}(e),null===t)return VZ;this.host=t}else{if(AZ(WZ,e))return VZ;for(t="",r=sZ(e),n=0;n<r.length;n++)t+=r$(r[n],ZZ);this.host=t}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||"file"==this.scheme},includesCredentials:function(){return""!=this.username||""!=this.password},isSpecial:function(){return oZ(n$,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;!t||"file"==this.scheme&&1==t&&i$(e[0],!0)||e.length--},serialize:function(){var e=this,t=e.scheme,r=e.username,n=e.password,i=e.host,o=e.port,a=e.path,s=e.query,c=e.fragment,u=t+":";return null!==i?(u+="//",e.includesCredentials()&&(u+=r+(n?":"+n:"")+"@"),u+=QZ(i),null!==o&&(u+=":"+o)):"file"==t&&(u+="//"),u+=e.cannotBeABaseURL?a[0]:a.length?"/"+RZ(a,"/"):"",null!==s&&(u+="?"+s),null!==c&&(u+="#"+c),u},setHref:function(e){var t=this.parse(e);if(t)throw bZ(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if("blob"==e)try{return new C$(e.path[0]).origin}catch(T0){return"null"}return"file"!=e&&this.isSpecial()?e+"://"+QZ(this.host)+(null!==t?":"+t:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse(lZ(e)+":",s$)},getUsername:function(){return this.username},setUsername:function(e){var t=sZ(lZ(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var r=0;r<t.length;r++)this.username+=r$(t[r],t$)}},getPassword:function(){return this.password},setPassword:function(e){var t=sZ(lZ(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var r=0;r<t.length;r++)this.password+=r$(t[r],t$)}},getHost:function(){var e=this.host,t=this.port;return null===e?"":null===t?QZ(e):QZ(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,m$)},getHostname:function(){var e=this.host;return null===e?"":QZ(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,y$)},getPort:function(){var e=this.port;return null===e?"":lZ(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""==(e=lZ(e))?this.port=null:this.parse(e,g$))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+RZ(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,k$))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){""==(e=lZ(e))?this.query=null:("?"==IZ(e,0)&&(e=PZ(e,1)),this.query="",this.parse(e,A$)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){""!=(e=lZ(e))?("#"==IZ(e,0)&&(e=PZ(e,1)),this.fragment="",this.parse(e,R$)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var C$=function(e){var t=iZ(this,O$),r=fZ(arguments.length,1)>1?arguments[1]:void 0,n=_Z(t,new w$(e,!1,r));QQ||(t.href=n.serialize(),t.origin=n.getOrigin(),t.protocol=n.getProtocol(),t.username=n.getUsername(),t.password=n.getPassword(),t.host=n.getHost(),t.hostname=n.getHostname(),t.port=n.getPort(),t.pathname=n.getPathname(),t.search=n.getSearch(),t.searchParams=n.getSearchParams(),t.hash=n.getHash())},O$=C$.prototype,x$=function(e,t){return{get:function(){return mZ(this)[e]()},set:t&&function(e){return mZ(this)[t](e)},configurable:!0,enumerable:!0}};if(QQ&&(nZ(O$,"href",x$("serialize","setHref")),nZ(O$,"origin",x$("getOrigin")),nZ(O$,"protocol",x$("getProtocol","setProtocol")),nZ(O$,"username",x$("getUsername","setUsername")),nZ(O$,"password",x$("getPassword","setPassword")),nZ(O$,"host",x$("getHost","setHost")),nZ(O$,"hostname",x$("getHostname","setHostname")),nZ(O$,"port",x$("getPort","setPort")),nZ(O$,"pathname",x$("getPathname","setPathname")),nZ(O$,"search",x$("getSearch","setSearch")),nZ(O$,"searchParams",x$("getSearchParams")),nZ(O$,"hash",x$("getHash","setHash"))),rZ(O$,"toJSON",(function(){return mZ(this).serialize()}),{enumerable:!0}),rZ(O$,"toString",(function(){return mZ(this).serialize()}),{enumerable:!0}),SZ){var D$=SZ.createObjectURL,N$=SZ.revokeObjectURL;D$&&rZ(C$,"createObjectURL",eZ(D$,SZ)),N$&&rZ(C$,"revokeObjectURL",eZ(N$,SZ))}hZ(C$,"URL"),JQ({global:!0,constructor:!0,forced:!ZQ,sham:!QQ},{URL:C$});var P$=function(){var e=c(o().mark((function e(t,r){var n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new Audio(URL.createObjectURL(new Blob([t],r))),e.prev=1,n.muted=!0,e.next=5,n.play();case 5:return n.pause(),e.abrupt("return",!0);case 9:return e.prev=9,e.t0=e.catch(1),e.abrupt("return",!1);case 12:case"end":return e.stop()}}),e,null,[[1,9]])})));return function(t,r){return e.apply(this,arguments)}}(),M$=Object.defineProperty,L$=Object.getOwnPropertyDescriptor,U$=function(e,t,r,n){for(var i,o=n>1?void 0:n?L$(t,r):t,a=e.length-1;a>=0;a--)(i=e[a])&&(o=(n?i(t,r,o):i(o))||o);return n&&o&&M$(t,r,o),o},V$=function(){function e(t){u(this,e),h(this,"_sharedAudioContext",new AudioContext),h(this,"_audioDestination",this._sharedAudioContext.createMediaStreamDestination()),h(this,"_localGainNode",this._sharedAudioContext.createGain()),h(this,"_bufferGainNode",this._sharedAudioContext.createGain()),h(this,"_audioBufferSource",void 0),h(this,"_localSource",void 0),h(this,"_context",void 0),h(this,"_failedAudioList",[]),h(this,"_startingIds",new Map),h(this,"mixingMap",new Map),h(this,"resourcesCache",new Map),h(this,"volumeConfig",new Map),h(this,"cachedBuffer",[]),h(this,"id","AudioMixingManager"),this._context=t,this._localGainNode.gain.value=1}var t,r,n;return l(e,[{key:"mixMediaStream",value:function(e){this._localSource&&this._localSource.disconnect(this._localGainNode),this._localSource=this._sharedAudioContext.createMediaStreamSource(e),this._localSource.connect(this._localGainNode).connect(this._audioDestination)}},{key:"startAudioMixing",value:(n=c(o().mark((function e(t,r,n){var i,a,s,c,u,d,l,h,f,p,v,_,m,y=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0===this._startingIds.get(t)){e.next=3;break}return console.warn("AudioMixing task id: ".concat(t," is starting")),e.abrupt("return");case 3:if(this._startingIds.set(t,t),console.log(this._startingIds),i=n.playCount,XP(a=n.type,"mixingType",pJ(re)),s=this._context.getLocalAudioTrack()){e.next=10;break}return e.abrupt("return");case 10:if((c=s.getTrack("preprocessing"))&&this.mixMediaStream(new MediaStream([c])),null!=(u=this.mixingMap.get(t))&&u.audioNode){u.audioNode.pause(),this._context.emitMessage({mixId:t,state:ne.AUDIO_MIXING_STATE_STOPPED,error:lN.AUDIO_MIXING_ERROR_OK});try{u.gainNode.disconnect(this._audioDestination),u.audioSource.disconnect(u.gainNode)}catch(o){}}if(!(l=this.resourcesCache.get(t))||l.filePath!==r){e.next=19;break}d=l.getAudioNode(),e.next=32;break;case 19:return e.next=21,fetch(r,{mode:"cors",credentials:"include"}).then((function(e){if(e.ok)return e.arrayBuffer();throw y._context.emitMessage({mixId:t,state:ne.AUDIO_MIXING_STATE_FAILED,error:lN.AUDIO_MIXING_ERROR_START_FAILED}),new hN(dN.LOAD_RESOURCES_FAILED,e.statusText)}));case 21:return h=e.sent,r.endsWith("mp3")?f={type:"audio/mpeg"}:r.endsWith("aac")&&(f={type:"audio/aac"}),e.next=25,P$(h,f);case 25:if(e.sent){e.next=29;break}throw this._context.emitMessage({mixId:t,state:ne.AUDIO_MIXING_STATE_FAILED,error:lN.AUDIO_MIXING_ERROR_START_FAILED}),new hN(dN.LOAD_RESOURCES_FAILED,"invalid audio resource");case 29:(d=new Audio).crossOrigin="anonymous",d.src=URL.createObjectURL(new Blob([h],f));case 32:return i<=0?d.loop=!0:i>0&&(p=i,d.onended=function(){--p>0?d.play():(y.mixingMap.delete(t),y._context.emitMessage({mixId:t,state:ne.AUDIO_MIXING_STATE_FINISHED,error:lN.AUDIO_MIXING_ERROR_OK}))}),e.prev=33,e.next=36,d.play();case 36:e.next=43;break;case 38:e.prev=38,e.t0=e.catch(33),console.error(e.t0),this._failedAudioList.push(d),this._context.onAutoPlayFailed({userId:this.id,kind:"audio",streamIndex:L.STREAM_INDEX_MAIN,mediaType:U.AUDIO});case 43:if(this._startingIds.delete(t),v=this._sharedAudioContext.createMediaElementSource(d),_=this._sharedAudioContext.createGain(),m=this.volumeConfig.get(t),_.gain.value=m?m/100:1,v.connect(_).connect(this._audioDestination),this.mixingMap.set(t,{audioSource:v,audioNode:d,gainNode:_,type:"file"}),a===re.PUBLISH)try{_.disconnect(this._sharedAudioContext.destination)}catch(o){}else _.connect(this._sharedAudioContext.destination);this._context.updateLocalAudioTrack(this._audioDestination.stream.getAudioTracks()[0],n.type),this._context.emitMessage({mixId:t,state:ne.AUDIO_MIXING_STATE_PLAYING,error:lN.AUDIO_MIXING_ERROR_OK});case 53:case"end":return e.stop()}}),e,this,[[33,38]])}))),function(e,t,r){return n.apply(this,arguments)})},{key:"stopAudioMixing",value:function(e){var t=this.mixingMap.get(e);t&&"file"===t.type&&(this.mixingMap.delete(e),t.audioNode.pause(),t.audioSource.disconnect(t.gainNode),t.gainNode.disconnect(this._audioDestination),this._context.emitMessage({mixId:e,state:ne.AUDIO_MIXING_STATE_STOPPED,error:lN.AUDIO_MIXING_ERROR_OK}))}},{key:"pauseAudioMixing",value:function(e){var t=this.mixingMap.get(e);t&&(this._context.emitMessage({mixId:e,state:ne.AUDIO_MIXING_STATE_PAUSED,error:lN.AUDIO_MIXING_ERROR_OK}),t.audioNode.pause())}},{key:"resumeAudioMixing",value:function(e){var t=this.mixingMap.get(e);t&&(this._context.emitMessage({mixId:e,state:ne.AUDIO_MIXING_STATE_PLAYING,error:lN.AUDIO_MIXING_ERROR_OK}),t.audioNode.play())}},{key:"preloadAudioMixing",value:(r=c(o().mark((function e(t,r){var n,i,a=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.stopAudioMixing(t),e.next=3,fetch(r,{mode:"cors",credentials:"include"}).then((function(e){if(e.ok)return e.arrayBuffer();throw new hN(dN.LOAD_RESOURCES_FAILED,e.statusText)})).catch((function(e){if(a._context.emitMessage({mixId:t,state:ne.AUDIO_MIXING_STATE_FAILED,error:lN.AUDIO_MIXING_ERROR_PRELOAD_FAILED}),e instanceof hN)throw e;throw new hN(dN.LOAD_RESOURCES_FAILED,"Load resources failed",e)}));case 3:return n=e.sent,r.endsWith("mp3")?i={type:"audio/mpeg"}:r.endsWith("aac")&&(i={type:"audio/aac"}),e.next=7,P$(n,i);case 7:if(e.sent){e.next=11;break}throw this._context.emitMessage({mixId:t,state:ne.AUDIO_MIXING_STATE_FAILED,error:lN.AUDIO_MIXING_ERROR_PRELOAD_FAILED}),new hN(dN.LOAD_RESOURCES_FAILED,"Load resources failed");case 11:this._context.emitMessage({mixId:t,state:ne.AUDIO_MIXING_STATE_PRELOADED,error:lN.AUDIO_MIXING_ERROR_OK}),this.resourcesCache.set(t,{getAudioNode:function(){return new Audio(URL.createObjectURL(new Blob([n],i)))},filePath:r});case 13:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"unloadAudioMixing",value:function(e){this.resourcesCache.has(e)&&this.resourcesCache.delete(e)}},{key:"getAudioMixingVolume",value:function(e){var t=this.mixingMap.get(e);return t?100*t.gainNode.gain.value:0}},{key:"setAudioMixingVolume",value:function(e,t){t<0?t=0:t>400&&(t=400),this.volumeConfig.set(e,t);var r=this.mixingMap.get(e);r&&(r.gainNode.gain.value=Number(t)/100)}},{key:"getAudioMixingDuration",value:function(e){var t=this.mixingMap.get(e),r=this.mixingMap.get(e);return t||r?t?1e3*t.audioNode.duration:r?1e3*r.audioNode.duration:0:0}},{key:"getAudioMixingCurrentPosition",value:function(e){var t=this.mixingMap.get(e);return t?1e3*t.audioNode.currentTime:0}},{key:"setAudioMixingPosition",value:function(e,t){var r=this.mixingMap.get(e);r&&(r.audioNode.currentTime=t/1e3,r.audioNode.play())}},{key:"enableAudioMixingBuffer",value:function(e){XP(e,"type",pJ(re));var t=this._context.getLocalAudioTrack();if(t){var r=t.getTrack("preprocessing");if(r&&this.mixMediaStream(new MediaStream([r])),e===re.PUBLISH)try{this._bufferGainNode.disconnect(this._sharedAudioContext.destination)}catch(n){}else this._bufferGainNode.connect(this._sharedAudioContext.destination);this._context.updateLocalAudioTrack(this._audioDestination.stream.getAudioTracks()[0],e),this._bufferGainNode.connect(this._audioDestination),this._context.emitMessage({mixId:-1,state:ne.AUDIO_MIXING_STATE_PCM_ENABLED,error:lN.AUDIO_MIXING_ERROR_OK})}}},{key:"disableAudioMixingBuffer",value:function(){if(this.cachedBuffer=[],this._audioBufferSource){try{this._audioBufferSource.disconnect(this._bufferGainNode),this._bufferGainNode.disconnect(this._audioDestination),this._bufferGainNode.disconnect(this._sharedAudioContext.destination)}catch(e){}finally{this._audioBufferSource=void 0}this._context.updateLocalAudioTrack(),this._context.emitMessage({mixId:-1,state:ne.AUDIO_MIXING_STATE_PCM_DISABLED,error:lN.AUDIO_MIXING_ERROR_OK})}}},{key:"pushAudioMixingBuffer",value:function(e){var t=this;if(!(this._audioBufferSource&&(this.cachedBuffer.push(e),this.cachedBuffer.length>0))){this._audioBufferSource=this._sharedAudioContext.createBufferSource(),this._audioBufferSource.buffer=e,this._audioBufferSource.connect(this._bufferGainNode);try{this._audioBufferSource.start()}catch(r){this._failedAudioList.push(this._audioBufferSource)}this._audioBufferSource.onended=function(){var e;if(null===(e=t._audioBufferSource)||void 0===e||e.disconnect(t._bufferGainNode),t._audioBufferSource=void 0,t.cachedBuffer.length){var r=t.cachedBuffer.shift();r&&t.pushAudioMixingBuffer(r)}}}}},{key:"stopAll",value:function(){var e=this;if(this._localSource)try{this._localSource.disconnect(this._localGainNode),delete this._localSource}catch(t){}this.mixingMap.forEach((function(t,r){e.stopAudioMixing(r)}))}},{key:"mixTrack",get:function(){return this._audioDestination.stream.getAudioTracks()[0]}},{key:"sharedAudioContext",get:function(){return this._sharedAudioContext}},{key:"resumeLocalPlay",value:(t=c(o().mark((function e(){var t,r,n,i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=[],r=A(this._failedAudioList),e.prev=2,r.s();case 4:if((n=r.n()).done){e.next=24;break}if(i=n.value,e.prev=6,!(i instanceof HTMLAudioElement)){e.next=13;break}return i.muted=!1,e.next=11,i.play();case 11:e.next=14;break;case 13:i.start();case 14:e.next=22;break;case 16:return e.prev=16,e.t0=e.catch(6),t.push(i),console.error(e.t0),this._context.onAutoPlayFailed({userId:this.id,kind:"audio",streamIndex:L.STREAM_INDEX_MAIN,mediaType:U.AUDIO}),e.abrupt("break",24);case 22:e.next=4;break;case 24:e.next=29;break;case 26:e.prev=26,e.t1=e.catch(2),r.e(e.t1);case 29:return e.prev=29,r.f(),e.finish(29);case 32:this._failedAudioList=t;case 33:case"end":return e.stop()}}),e,this,[[2,26,29,32],[6,16]])}))),function(){return t.apply(this,arguments)})},{key:"destroy",value:function(){var e=this._sharedAudioContext;"closed"!==e.state&&"function"==typeof e.close&&e.close(),this.cachedBuffer=[],this.mixingMap.clear(),this.resourcesCache.clear(),this.volumeConfig.clear(),this._startingIds=new Map}}]),e}();U$([HB("default","id","filePath","options")],V$.prototype,"startAudioMixing",1),U$([HB("default","id")],V$.prototype,"stopAudioMixing",1),U$([HB("default","id")],V$.prototype,"pauseAudioMixing",1),U$([HB("default","id")],V$.prototype,"resumeAudioMixing",1),U$([HB("default","id")],V$.prototype,"preloadAudioMixing",1),U$([HB("default","id")],V$.prototype,"unloadAudioMixing",1),U$([HB("default","id")],V$.prototype,"getAudioMixingVolume",1),U$([HB("default","id","volume")],V$.prototype,"setAudioMixingVolume",1),U$([HB("default","id")],V$.prototype,"getAudioMixingDuration",1),U$([HB("default","id")],V$.prototype,"getAudioMixingCurrentPosition",1),U$([HB("default","id","position")],V$.prototype,"setAudioMixingPosition",1),U$([HB("default","type")],V$.prototype,"enableAudioMixingBuffer",1),U$([HB()],V$.prototype,"disableAudioMixingBuffer",1),U$([HB("default","buffer")],V$.prototype,"pushAudioMixingBuffer",1);var F$=function(e){return e.NORMAL_USER="normalUser",e.SILENT_USER="silentUser",e}(F$||{}),B$=new JL("RTMClient",1),j$=function(e){f(_,e);var t,r,n,i,a,s,d,v=g(_);function _(e){var t;return u(this,_),h(m(t=v.call(this)),"_dataChannelSignal",null),h(m(t),"_handler",null),h(m(t),"_dataChannelSignalState",mX.DISCONNECTED),h(m(t),"_loginSessionId",null),h(m(t),"_userId",null),h(m(t),"_token",null),h(m(t),"_isReconnecting",!1),h(m(t),"_reconnectTimer",null),h(m(t),"_loginResolveCallback",null),h(m(t),"_loginRejectCallback",null),h(m(t),"_iceConfigNode",null),h(m(t),"_wait_login_token",!1),h(m(t),"_serverParamsCache",void 0),t._appId=e,t}return l(_,[{key:"login",value:function(e,t){var r=this;return new Promise((function(n,i){if(B$.print("login","invoke login, token: %o, userId: %o",e,t),r._loginSessionId)throw new hN(dN.ALREADY_LOGIN,"Already logined");if(r._loginResolveCallback)throw new hN(dN.LOGIN_FAILED,"Is logging in, please try again later.");r._userId=t,r._token=e,FB.setStats({rtc_app_id:r._appId,user_id:t}),r._loginResolveCallback=n,r._loginRejectCallback=i,r._dataChannelSignal?r._login():(B$.print("login","init dataChannelSingling"),r._dataChannelSignalState=mX.CONNECTING,r._createDataChannelSignaling(t).then((function(e){r._dataChannelSignal=e,r._login()})).catch((function(){r._onDisconnect()})))}))}},{key:"logout",value:(d=c(o().mark((function e(){var t;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._loginSessionId&&this._userId){e.next=2;break}throw new hN(dN.NOT_LOGIN,"login first");case 2:return e.next=4,null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("logout",{loginSessionId:this._loginSessionId,userId:this._userId,appId:this._appId},{functionType:Aj.C2RTM}).catch((function(){}));case 4:this._closeDataChannelSignaling(),this._clearState();case 6:case"end":return e.stop()}}),e,this)}))),function(){return d.apply(this,arguments)})},{key:"updateLoginToken",value:(s=c(o().mark((function e(t){var r=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._token=t,e.abrupt("return",new Promise((function(e,t){r._wait_login_token?(r._loginResolveCallback=e,r._loginRejectCallback=t,r._login()):e()})));case 2:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"getPeerOnlineStatus",value:(a=c(o().mark((function e(t){var r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._loginSessionId&&this._userId){e.next=2;break}throw new hN(dN.NOT_LOGIN,"login first");case 2:return this._checkDataChannelSignal(),e.next=5,this._dataChannelSignal.sendSignaling("getPeerOnlineStatus",{loginSessionId:this._loginSessionId,userId:this._userId,appId:this._appId,peerUserId:t},{functionType:Aj.C2RTM});case 5:return r=e.sent,e.abrupt("return",null==r?void 0:r.status);case 7:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"sendUserMessageOutsideRoom",value:(i=c(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._loginSessionId&&this._userId){e.next=2;break}throw new hN(dN.NOT_LOGIN,"login first");case 2:return this._checkDataChannelSignal(),e.abrupt("return",this._dataChannelSignal.sendP2PMessage({from:this._userId,app:this._appId,to:t,room:"",msg:r}));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return i.apply(this,arguments)})},{key:"setServerParams",value:(n=c(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,zP(t,"signature"),zP(r,"url"),this._loginSessionId&&this._userId){e.next=5;break}throw new hN(dN.NOT_LOGIN,"login first");case 5:return this._checkDataChannelSignal(),e.next=8,this._dataChannelSignal.sendSignaling("setServerParams",{loginSessionId:this._loginSessionId,userId:this._userId,appId:this._appId,signature:t,url:r},{functionType:Aj.C2RTM}).catch((function(e){throw new hN(dN.UNEXPECTED_ERROR,e.msg)}));case 8:this._serverParamsCache={signature:t,url:r},this.emit("onServerParamsSetResult"),e.next=16;break;case 12:throw e.prev=12,e.t0=e.catch(0),this.emit("onServerParamsSetResult",e.t0),e.t0;case 16:case"end":return e.stop()}}),e,this,[[0,12]])}))),function(e,t){return n.apply(this,arguments)})},{key:"sendServerMessage",value:(r=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._loginSessionId&&this._userId){e.next=2;break}throw new hN(dN.NOT_LOGIN,"login first");case 2:return this._checkDataChannelSignal(),e.abrupt("return",this._dataChannelSignal.sendP2PMessage({from:this._userId,app:this._appId,to:"",room:"",type:Sj.BUSINESS_SERVER,msg:t}));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"destroy",value:function(){this._clearState(),this._closeDataChannelSignaling(),b(p(_.prototype),"removeAllListeners",this).call(this),delete this._serverParamsCache}},{key:"_login",value:function(){var e=this;if(this._userId){var t=hP();this._checkDataChannelSignal(),this._dataChannelSignal.sendSignaling("login",{Token:_P.token2auth(this._appId,null,this._userId,this._token),timestamp:Date.now(),loginSessionId:t,params:{deviceType:"web",userAgent:window.navigator.userAgent,sdkVersion:oj.VERSION,deviceId:ej.getDeviceId(),appId:this._appId,userId:this._userId}},{functionType:Aj.C2RTM}).then((function(){"function"==typeof e._loginResolveCallback&&e._loginResolveCallback(),e._loginSessionId=t,e._wait_login_token=!1,e._serverParamsCache&&e.setServerParams(e._serverParamsCache.signature,e._serverParamsCache.url)})).catch((function(t){var r,n,i=t||{},o=i.code,a=i.message;e._wait_login_token=!1,o>=700&&o<800?708===o?(r=dN.INVALID_PARAMS,n="Invalid userId"):(r=dN.INVALID_TOKEN,n="Invalid token",e._wait_login_token=!0,e._loginRejectCallback||e.emit("onRTMTokenError")):(r=dN.LOGIN_FAILED,n="login failed"),"function"==typeof e._loginRejectCallback&&e._loginRejectCallback(new hN(r,a||n))})).finally((function(){e._loginResolveCallback=null,e._loginRejectCallback=null}))}}},{key:"_createDataChannelSignaling",value:(t=c(o().mark((function e(t){var r,n,i,a,s,c,u,d=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=new xj,i=this._iceConfigNode){e.next=16;break}return e.prev=3,e.next=6,null==n?void 0:n.getAccessNode(this._appId,"",t,ej.getDeviceId(),"");case 6:if(a=e.sent,i=a[0]){e.next=10;break}throw new Error;case 10:e.next=16;break;case 12:throw e.prev=12,e.t0=e.catch(3),XB("rtm.login.getNodeFailed","",0,!0),new hN(dN.ICE_SERVER_WRONG,"get ICE config failed");case 16:return XB("rtm.login.getNodeSuccess",i,0,!0),B$.print("_createDataChannelSignaling()","get node success",i),this._handler=sX(LB),null===(r=this._handler)||void 0===r||r.once("disconnect",(function(){B$.print("_createDataChannelSignaling()","recv BasicHandler event: disconnect"),d._onDisconnect()})),e.prev=20,e.next=23,null===(c=this._handler)||void 0===c?void 0:c.connect(i);case 23:s=e.sent,B$.print("_createDataChannelSignaling()","establish peerConnection success"),this._dataChannelSignalState=mX.CONNECTED,e.next=33;break;case 28:throw e.prev=28,e.t1=e.catch(20),this._iceConfigNode=null,this._dataChannelSignalState=mX.DISCONNECTED,new hN(dN.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed",e.t1);case 33:return u=new wj(s),B$.print("_createDataChannelSignaling()","send ping"),u.sendPingSignaling(),u.once("close",(function(){B$.print("_createDataChannelSignaling()","recv DataChannelSignaling event: close"),d._onDisconnect()})),u.on(pj.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM,(function(e){d.emit("onUserMessageReceivedOutsideRoom",{userId:e.from,message:e.msg})})),u.on(pj.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM,(function(e){d.emit("onUserBinaryMessageReceivedOutsideRoom",{userId:e.from,message:e.msg})})),u.on(pj.USER_DISCONNECTION,(function(){d.emit("onUserDisconnection"),d._clearState()})),u.on(pj.NODE_CHANGE,(function(e){XB("rtm.nodeChange",JSON.stringify(e),0,!0),Array.isArray(e.nodes)&&e.nodes.length&&(d._iceConfigNode=e.nodes[0]),d._loginResolveCallback&&d._loginRejectCallback?d._login():d._reconnect()})),e.abrupt("return",u);case 42:case"end":return e.stop()}}),e,this,[[3,12],[20,28]])}))),function(e){return t.apply(this,arguments)})},{key:"_closeDataChannelSignaling",value:function(){var e,t;null===(e=this._dataChannelSignal)||void 0===e||e.destroy(),this._dataChannelSignal=null,null===(t=this._handler)||void 0===t||t.destroy(),this._handler=null}},{key:"_checkDataChannelSignal",value:function(){if(!this._dataChannelSignal||this._dataChannelSignalState!==mX.CONNECTED)throw new hN(dN.NOT_CONNECTED_YET,"datachannel not connect")}},{key:"_onDisconnect",value:function(){this._dataChannelSignalState=mX.DISCONNECTED,this._closeDataChannelSignaling(),navigator.onLine?this._reconnect():this._reconnectTimer=self.setTimeout(this._reconnect.bind(this),3e3)}},{key:"_reconnect",value:function(){var e=this;!this._isReconnecting&&this._userId&&(B$.print("_reconnect()","start reconnect..."),this._isReconnecting=!0,this._createDataChannelSignaling(this._userId).then((function(t){B$.print("_reconnect()","reconnect success!"),e._dataChannelSignal=t,e._login(),e._reconnectTimer=null})).catch((function(t){B$.print("_reconnect()","Reconnecting error, will reconnect after 3s",t),e._reconnectTimer=self.setTimeout(e._reconnect.bind(e),3e3)})).finally((function(){e._isReconnecting=!1})))}},{key:"_clearState",value:function(){this._userId=null,this._token=null,this._loginSessionId=null,null!==this._reconnectTimer&&(self.clearTimeout(this._reconnectTimer),this._reconnectTimer=null)}}]),_}(jL.exports.EventEmitter),G$=function(e){f(a,e);var t,r,n,i=g(a);function a(e){var t;return u(this,a),h(m(t=i.call(this)),"_mediaServerClient",void 0),h(m(t),"_appId",void 0),h(m(t),"_reconnectTimer",void 0),h(m(t),"remoteStreams",void 0),t._appId=e,t.remoteStreams=new Map,t}return l(a,[{key:"connect",value:(n=c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._mediaServerClient=new gX({}),this._bindEvents(),e.next=4,this._mediaServerClient.connect(this._appId);case 4:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"startPlayPublicStream",value:(r=c(o().mark((function e(t){var r,n=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.remoteStreams.get(t)){e.next=2;break}throw new hN(dN.REPEAT_PLAY,"repeat play public media stream");case 2:return(r=new Yz(t,t,!1,{audiostream:!0,localaudio:!0,videostream:!0,localvideo:!0,extaudio:!1,extvideo:!1,videoDescriptions:[]})).on("onSEIMessage",(function(e){if(e instanceof Uint8Array)for(var t=BP(e),i=0;i<t.seiCount;i++)n.emit(Gz.ON_SEI_MESSAGED_RECEIVED,{sei:t.seis[i],publicStreamId:r.streamId})})),e.next=6,this._mediaServerClient.subscribePublicStream(r);case 6:return this.remoteStreams.set(t,r),e.abrupt("return",r);case 8:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"stopPlayPublicStream",value:function(e){var t=this.remoteStreams.get(e);if(t)return this.remoteStreams.delete(e),this._mediaServerClient.unsubscribePublicStream(t)}},{key:"destroy",value:function(){this.remoteStreams=new Map,this._mediaServerClient&&this._mediaServerClient.destroy()}},{key:"_handleReconnected",value:(t=c(o().mark((function e(){var t,r,n,i=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:clearTimeout(this._reconnectTimer),t=A(this.remoteStreams);try{for(n=function(){var e=E(r.value,1)[0];i.remoteStreams.delete(e),i.startPlayPublicStream(e).then((function(){var t=i.remoteStreams.get(e);i.safeEmit(Gz.RESUBSCRIBE,{stream:t})}))},t.s();!(r=t.n()).done;)n()}catch(o){t.e(o)}finally{t.f()}case 3:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"_reconnect",value:function(){var e=this;this._mediaServerClient.removeAllListeners(),this._mediaServerClient.destroy(),navigator.onLine?this.connect().then(this._handleReconnected.bind(this)):this._reconnectTimer=window.setTimeout((function(){return e.connect().then(e._handleReconnected.bind(e))}),3e3)}},{key:"_bindEvents",value:function(){var e,t,r=this;null===(e=this._mediaServerClient)||void 0===e||e.on(_j.ABNORMAL_DISCONNECTION,this._reconnect.bind(this)),null===(t=this._mediaServerClient)||void 0===t||t.on("onRemoteStreamStats",(function(e){r.emit("onRemoteStreamStats",e)}))}}]),a}($L),H$=new JL("AudioDeviceManager",1),z$=function(e){f(a,e);var t,r,n,i=g(a);function a(e){var t;return u(this,a),h(m(t=i.call(this)),"_audioLevelFetcher",void 0),h(m(t),"_playbackDeviceTestTimer",void 0),h(m(t),"_audioElement",void 0),h(m(t),"_audioTrack",void 0),h(m(t),"_mediaRecorder",void 0),h(m(t),"_recoderTimer",void 0),h(m(t),"_isAudioPlaybackDeviceTesting",!1),h(m(t),"_isAudioDeviceRecordTesting",!1),h(m(t),"_audioCaptureAndRecoderResolve",void 0),h(m(t),"_onAutoplayFailed",void 0),t._extensionManager=e,t}return l(a,[{key:"startAudioPlaybackDeviceTest",value:(n=c(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._isAudioPlaybackDeviceTesting&&!this._isAudioDeviceRecordTesting){e.next=2;break}throw new hN(dN.REPEAT_DEVICE_TEST,"device test cannot be called repeatedly at the same time.");case 2:return this._isAudioPlaybackDeviceTesting=!0,H$.print("startAudioPlaybackDeviceTest()","Invoke"),e.prev=4,e.next=7,this._playAudioFile(t,{loop:!0});case 7:e.next=14;break;case 9:throw e.prev=9,e.t0=e.catch(4),H$.print("startAudioPlaybackDeviceTest()","error",e.t0),this.stopAudioPlaybackDeviceTest(),e.t0;case 14:this._startEmitAudioPlaybackDeviceTestVolume(r);case 15:case"end":return e.stop()}}),e,this,[[4,9]])}))),function(e,t){return n.apply(this,arguments)})},{key:"stopAudioPlaybackDeviceTest",value:function(){this._isAudioPlaybackDeviceTesting&&(H$.print("stopAudioPlaybackDeviceTest()","Invoke"),this._isAudioPlaybackDeviceTesting=!1,this._stopEmitAudioPlaybackDeviceTestVolume(),this._destroyAudioElement())}},{key:"startAudioDeviceRecordTest",value:(r=c(o().mark((function e(t,r){var n=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(window.MediaRecorder){e.next=2;break}throw new hN(dN.NOT_SUPPORTED,"Your browser does not support MediaRecorder.");case 2:if(!this._isAudioDeviceRecordTesting){e.next=4;break}throw new hN(dN.REPEAT_DEVICE_TEST,"device test cannot be called repeatedly at the same time.");case 4:return this._isAudioDeviceRecordTesting=!0,H$.print("startAudioDeviceRecordTest()","Invoke"),this._recoderTimer=window.setTimeout((function(){H$.print("startAudioDeviceRecordTest()","".concat(3e4,'ms automatic call method "stopAudioDeviceRecordAndPlayTest"')),n._stopAudioCaptureAndRecoder()}),3e4),e.prev=7,this._onAutoplayFailed=r,e.next=11,this._startAudioCaptureAndRecoder(t);case 11:e.next=18;break;case 13:throw e.prev=13,e.t0=e.catch(7),this._isAudioDeviceRecordTesting=!1,delete this._onAutoplayFailed,e.t0;case 18:delete this._audioCaptureAndRecoderResolve;case 19:case"end":return e.stop()}}),e,this,[[7,13]])}))),function(e,t){return r.apply(this,arguments)})},{key:"stopAudioDeviceRecordAndPlayTest",value:function(){H$.print("stopAudioDeviceRecordAndPlayTest()","Invoke"),void 0!==this._recoderTimer&&(clearTimeout(this._recoderTimer),delete this._recoderTimer),this._stopAudioCaptureAndRecoder()}},{key:"stopAudioDevicePlayTest",value:function(){this._isAudioDeviceRecordTesting&&(H$.print("stopAudioDevicePlayTest()","Invoke"),this._isAudioDeviceRecordTesting=!1,this.stopAudioDeviceRecordAndPlayTest(),this._stopEmitAudioPlaybackDeviceTestVolume(),this._destroyAudioElement()),delete this._onAutoplayFailed}},{key:"getRecordTrack",value:function(){return this._audioTrack}},{key:"destroy",value:function(){H$.print("destroy()","Invoke"),b(p(a.prototype),"removeAllListeners",this).call(this),this.stopAudioPlaybackDeviceTest(),this.stopAudioDevicePlayTest()}},{key:"_playAudioFile",value:function(e,t){var r=this;return H$.print("_playAudioFile()","Invoke url=".concat(e,"; loop=").concat(t.loop)),new Promise((function(n,i){var a,s,u=MW("audio",{attributes:{src:e,crossOrigin:"anonymous"}});r._audioElement=u,u.loop=t.loop,r._audioLevelFetcher=new FH(u),u.onplaying=function(){u.onplaying=null,H$.print("_playAudioFile()","onplaying"),n()},u.onerror=function(){var e=c(o().mark((function e(t){var r,n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:H$.print("_playAudioFile()","onerror",t),n=t.message||(null==u||null===(r=u.error)||void 0===r?void 0:r.message),i(new hN(dN.LOAD_RESOURCES_FAILED,"Failed to play recorded audio"+(n?", reason: ".concat(n):".")));case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),null===(a=u.play())||void 0===a||null===(s=a.catch)||void 0===s||s.call(a,(function(e){H$.print("_playAudioFile()","autoplay error",e);var t="Failed to play recorded audio, ".concat(e.name,": ").concat(e.message);"NotAllowedError"===e.name&&r._onAutoplayFailed?r._onAutoplayFailed((function(){var e;return Promise.all([null===(e=r._audioLevelFetcher)||void 0===e?void 0:e.resume(),u.play()])})):i(new hN(dN.LOAD_RESOURCES_FAILED,t))}))}))}},{key:"_destroyAudioElement",value:function(){this._audioElement&&(H$.print("_destroyAudioElement()","Invoke"),this._audioElement.onplaying=null,this._audioElement.onerror=null,this._audioElement.src="",delete this._audioElement,"function"==typeof this._audioCaptureAndRecoderResolve&&this._audioCaptureAndRecoderResolve())}},{key:"_startEmitAudioPlaybackDeviceTestVolume",value:function(e){var t=this;e=Math.max(e,100),this._audioElement&&(H$.print("_startEmitAudioPlaybackDeviceTestVolume()","start timer(".concat(e,"ms)")),this._playbackDeviceTestTimer=self.setInterval((function(){t._audioLevelFetcher&&t.emit("onAudioPlaybackDeviceTestVolume",t._audioLevelFetcher.getAudioLevel())}),e))}},{key:"_stopEmitAudioPlaybackDeviceTestVolume",value:function(){var e;void 0!==this._playbackDeviceTestTimer&&(H$.print("_stopEmitAudioPlaybackDeviceTestVolume()","stop timer"),self.clearInterval(this._playbackDeviceTestTimer),delete this._playbackDeviceTestTimer),null===(e=this._audioLevelFetcher)||void 0===e||e.destroy(),delete this._audioLevelFetcher}},{key:"_startAudioCaptureAndRecoder",value:(t=c(o().mark((function e(t){var r,n=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,hz({},this._extensionManager);case 2:return this._audioTrack=e.sent,i=this._audioTrack.getTrack("preprocessing"),r=zH.get(i),H$.print("startAudioDeviceRecordTest()","create microphone track success!"),e.abrupt("return",new Promise((function(e,i){var a;"function"==typeof MediaRecorder.isTypeSupported&&(a=["audio/webm","audio/mp4"].find((function(e){return MediaRecorder.isTypeSupported(e)})),H$.print("startAudioDeviceRecordTest()","use mimeType: ".concat(a))),n._mediaRecorder=new MediaRecorder(r,a?{mimeType:a}:void 0);var s=n._mediaRecorder.mimeType;n._mediaRecorder.ondataavailable=function(){var r=c(o().mark((function r(a){var c,u;return o().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!n._isAudioDeviceRecordTesting){r.next=16;break}return H$.print("startAudioDeviceRecordTest()","get recorded file(mimeType: ".concat(s,").")),u=new Blob([a.data],{type:s}),r.prev=3,r.next=6,n._playAudioFile(URL.createObjectURL(u),{loop:!1});case 6:r.next=11;break;case 8:return r.prev=8,r.t0=r.catch(3),r.abrupt("return",i(r.t0));case 11:n._startEmitAudioPlaybackDeviceTestVolume(t),null===(c=n._audioElement)||void 0===c||c.addEventListener("ended",(function(){n.stopAudioDevicePlayTest(),e()})),n._audioCaptureAndRecoderResolve=e,r.next=17;break;case 16:e();case 17:case"end":return r.stop()}}),r,null,[[3,8]])})));return function(e){return r.apply(this,arguments)}}(),n._mediaRecorder.onerror=function(e){i(new hN(dN.AUDIO_DEVICE_TEST_FAILED,e.message||"mediaRecorder error"))},n._mediaRecorder.start()})));case 6:case"end":return e.stop()}var i}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"_stopAudioCaptureAndRecoder",value:function(){var e;this._mediaRecorder&&("recording"===this._mediaRecorder.state&&this._mediaRecorder.stop(),delete this._mediaRecorder),null===(e=this._audioTrack)||void 0===e||e.close(),delete this._audioTrack}}]),a}(jL.exports.EventEmitter),X$=function(){function e(){u(this,e),h(this,"engineBAC",{adm:{},agc:{},ans:{}}),h(this,"engineANM",{}),h(this,"bitrate",void 0),h(this,"sampleRate",void 0),h(this,"channel",void 0),h(this,"aec",void 0),h(this,"agc",void 0),h(this,"ans",void 0),this._init()}var t;return l(e,[{key:"_init",value:(t=c(o().mark((function e(){var t;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=new Dj,e.next=3,t.getAudioProfile();case 3:this.engineBAC=e.sent;case 4:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"updateEngineBAC",value:function(e){e&&(this.engineBAC={codec:i(i({},this.engineBAC.codec),e.codec),adm:i(i({},this.engineBAC.adm),e.adm)},this.setAEC(!!e.aec),this.setAGC(!!e.agc),this.setANS(!!e.ans))}},{key:"updateEngineANM",value:function(e){e&&(this.engineANM=e)}},{key:"setAudioProfile",value:function(e){var t,r,n;switch(e){case J.fluent:r=16e3,t=24e3;break;case J.standard:r=48e3,t=48e3;break;case J.hd:r=48e3,t=128e3,n=2;break;case J.standardStereo:r=48e3,t=8e4,n=2;break;case J.hdMono:r=48e3,t=128e3}t&&(this.bitrate=t),n&&(this.channel=n),r&&(this.sampleRate=r)}},{key:"setBitrate",value:function(e){e>128e3&&(e=128e3),this.bitrate=e}},{key:"setAEC",value:function(e){this.aec=e}},{key:"setAGC",value:function(e){this.agc=e}},{key:"setANS",value:function(e){this.ans=e}},{key:"getOpusConfigStr",value:function(){var e=";",t=this.config;return console.log("config",t),t.bitrate&&(e+="maxaveragebitrate=".concat(t.bitrate,";")),t.encSampleRate&&(e+="sprop-maxcapturerate=".concat(t.encSampleRate,";")),t.playbackRate&&(e+="maxplaybackrate=".concat(t.playbackRate,";")),t.encChannel&&t.encChannel>1&&(e+="sprop-stereo=1;"),t.channel&&t.channel>1&&(e+="stereo=1;"),console.log("configStr",e),e.slice(0,-1)}},{key:"config",get:function(){var e,t,r,n,i,o,a,s,c,u,d,l,h,f,p,v,_;return{bitrate:this.bitrate||(null===(e=this.engineANM.enc_param)||void 0===e?void 0:e.bitrate)||0,playChannel:(null===(t=this.engineBAC.adm)||void 0===t||null===(r=t.play)||void 0===r?void 0:r.chn)||1,encChannel:this.channel||(null===(n=this.engineANM)||void 0===n||null===(i=n.enc_param)||void 0===i?void 0:i.chn)||(null===(o=this.engineBAC.adm)||void 0===o||null===(a=o.record)||void 0===a?void 0:a.chn),channel:this.channel||(null===(s=this.engineBAC.adm)||void 0===s||null===(c=s.record)||void 0===c?void 0:c.chn),aec:this.aec,agc:this.agc,ans:this.ans,encSampleRate:this.sampleRate||(null===(u=this.engineBAC.codec)||void 0===u?void 0:u.enc_fs)||(null===(d=this.engineANM.enc_param)||void 0===d?void 0:d.sr)||(null===(l=this.engineBAC.adm)||void 0===l||null===(h=l.record)||void 0===h?void 0:h.sr),sampleRate:this.sampleRate||(null===(f=this.engineBAC.adm)||void 0===f||null===(p=f.record)||void 0===p?void 0:p.sr),playbackRate:null===(v=this.engineBAC.adm)||void 0===v||null===(_=v.play)||void 0===_?void 0:_.sr}}}]),e}(),K$=new JL("VideoSnapshot",1),q$=function(e){var t=null==e?void 0:e.domElement;if(t&&!t.paused&&4===t.readyState)return t},W$=function(){var e=c(o().mark((function e(t,r,n){var i,a,s,c,u,d,l,h;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=document.createElement("canvas"),a=i.getContext("2d")){e.next=4;break}throw new Error("canvas.getContext error");case 4:if(s=function(e,t,n){return t=t||e.width,n=n||e.height,i.width=t,i.height=n,r?a.setTransform(-1,0,0,1,t,0):a.setTransform(1,0,0,1,0,0),a.drawImage(e,0,0,t,n),a.getImageData(0,0,t,n)},c=Date.now(),!(u=q$(n))){e.next=16;break}return K$.print("takeSnapshot","VideoPlayer already set."),e.next=11,s(u,u.videoWidth,u.videoHeight);case 11:return d=e.sent,K$.print("takeSnapshot","success, cost ".concat(Date.now()-c,"ms")),e.abrupt("return",d);case 16:if(!window.ImageCapture){e.next=29;break}if("live"!==(l=new window.ImageCapture(t)).track.readyState||!l.track.enabled||l.track.muted){e.next=29;break}return K$.print("takeSnapshot","use ImageCapture"),e.t0=s,e.next=23,l.grabFrame();case 23:return e.t1=e.sent,e.next=26,(0,e.t0)(e.t1);case 26:return h=e.sent,K$.print("takeSnapshot","success, cost ".concat(Date.now()-c,"ms")),e.abrupt("return",h);case 29:return K$.print("takeSnapshot","use temp video"),e.abrupt("return",new Promise((function(e,r){var n=new MediaStream([t]),i=document.createElement("video");i.setAttribute("playsinline",""),i.muted=!0,document.body.appendChild(i),i.onplaying=function(){var r=s(i,i.videoWidth,i.videoHeight);K$.print("takeSnapshot","success, cost ".concat(Date.now()-c,"ms")),e(r),n.removeTrack(t),i.srcObject=null,i.load()},i.onerror=r,i.srcObject=n,i.play()})));case 31:case"end":return e.stop()}}),e)})));return function(t,r,n){return e.apply(this,arguments)}}(),Y$=function(){return{url:"",video:{codec:$.H264,width:640,height:360,fps:15,gop:2,kBitRate:J$(640,360,15)},audio:{codec:"AAC",kBitRate:64,sampleRate:48e3,channels:2,AACProfile:Z.LC},layout:{regions:[],appData:"",backgroundColor:"#000000"}}};function J$(e,t,r){return e*t<=288e3?r<=15?800:1200:e*t<=864e3?r<=15?1200:1800:e*t<=1152e3?r<=15?1600:2400:e*t<=2592e3?r<=15?2500:3750:r<=15?3300:5e3}function Q$(e){if("string"!=typeof e||!/^rtmps?:\/\//.test(e))throw new hN(dN.INVALID_PARAMS,"Invalid rtmp address")}function Z$(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(null==e||!e.length)throw new hN(dN.INVALID_PARAMS,"regions should not be empty.");var t,r=A(e);try{for(r.s();!(t=r.n()).done;){var n=t.value;if("string"!=typeof n.userId)throw new hN(dN.INVALID_PARAMS,"region.userId(".concat(n.userId,") should be a string."));if("boolean"!=typeof n.isScreenStream)throw new hN(dN.INVALID_PARAMS,"region.isScreenStream(".concat(n.isScreenStream,") should be a boolean."))}}catch(i){r.e(i)}finally{r.f()}}function $$(e,t){var r,n,i,o=function(e,r){var n=e.reduce((function(e,t){return null==e?void 0:e[t]}),t),i=e.reduce((function(e,t){return null==e?void 0:e[t]}),Y$());return n&&r(n)?n:i},a=function(e){return e%2==0?e:e+1},s=a(o(["video","width"],(function(e){return e>=2&&e<=1920}))),c=a(o(["video","height"],(function(e){return e>=2&&e<=1920}))),u=o(["video","fps"],(function(e){return e>=1&&e<=60})),d=(null===(r=t.video)||void 0===r?void 0:r.kBitRate)||0,l=o(["audio","sampleRate"],(function(e){return!![32e3,44100,48e3].find((function(t){return t===e||t/1e3===e}))}));return{type:"transcode",action:e,transcodeMeta:{transcode:{url:t.url},control:{protocol:"2.0"},audio:{codec:o(["audio","codec"],(function(e){return"AAC"===e})),bitRate:1e3*o(["audio","kBitRate"],(function(e){return e>=32&&e<=192})),sampleRate:l<100?1e3*l:l,channels:o(["audio","channels"],(function(e){return[1,2].includes(e)})),profile:o(["audio","AACProfile"],(function(e){return[Z.LC,Z.HEv1,Z.HEv2].includes(e)}))},video:{codec:o(["video","codec"],(function(e){return["H264","H265"].includes(e)})),fps:u,gop:o(["video","gop"],(function(e){return e>=1&&e<=5})),bitRate:1e3*(d>=16&&d<=1e4?d:J$(s,c,u)),width:s,height:c},layout:{canvas:{bgnd:o(["layout","backgroundColor"],(function(e){return/^#([0-9a-fA-F]{6}|[0-9a-fA-F]{3})$/.test(e)}))},regions:(null===(n=t.layout)||void 0===n||null===(i=n.regions)||void 0===i?void 0:i.map((function(e){return{alpha:!e.alpha||+e.alpha>1||+e.alpha<=0?1:+e.alpha,uid:e.userId,zorder:!e.zorder||+e.zorder<0||+e.zorder>100?0:+e.zorder,x:!e.x||+e.x>=1||+e.x<0?0:+e.x,y:!e.y||+e.y>=1||+e.y<0?0:+e.y,w:!e.w||+e.w>1||+e.w<=0?1:+e.w,h:!e.h||+e.h>1||+e.h<=0?1:+e.h,renderMode:e.renderMode&&[1,2,3].includes(e.renderMode)?e.renderMode:1,contentControl:e.contentControl&&[0,1,2].includes(e.contentControl)?e.contentControl:0,screen:!!e.isScreenStream}})))||[],app_data:o(["layout","appData"],(function(e){return"string"==typeof e}))}}}}var e0,t0={getDefaultValue:Y$,checkStartParams:function(e){var t;Q$(e.url),Z$(null===(t=e.layout)||void 0===t?void 0:t.regions)},checckUpdateParams:function(e){var t;e.url&&Q$(e.url),Z$(null===(t=e.layout)||void 0===t?void 0:t.regions)},getStartParams:function(e){return $$("started",e)},getUpdateParams:function(e){return $$("layoutChanged",e)}},r0=new WeakMap,n0=function(e,t,r){var n;if(requestAnimationFrame){var i=r0.get(e);null!==(n=i)&&void 0!==n&&n[t]?i0(e,t):i||(i={},r0.set(e,i));var o=e[t];!function n(){var a=requestAnimationFrame(n);i[t]=a;var s=e[t];o!==s&&(o=s,r(s))}()}},i0=function(e,t){var r=r0.get(e);t&&r[t]?cancelAnimationFrame(r[t]):Object.keys(r).length&&Object.keys(r).forEach((function(e){cancelAnimationFrame(r[e])}))},o0=Object.defineProperty,a0=Object.getOwnPropertyDescriptor,s0=function(e,t,r,n){for(var i,o=n>1?void 0:n?a0(t,r):t,a=e.length-1;a>=0;a--)(i=e[a])&&(o=(n?i(t,r,o):i(o))||o);return n&&o&&o0(t,r,o),o},c0=new JL("Engine",0),u0=function(e){f(je,e);var t,r,n,a,s,d,v,_,y,S,k,T,I,C,O,x,P,M,j,G,H,z,q,W,J,Z,$,ee,te,ne,ie,ae,se,ce,ue,de,le,he,fe,pe,ve,_e,me,ye,ge,Se,be,Ee,ke,Te,Ie,Ae,Re,we,Ce,Oe,xe,De,Ne,Pe,Me,Le,Ue,Ve,Fe,Be=g(je);function je(e,t){var r;return u(this,je),h(m(r=Be.call(this)),"_room",void 0),h(m(r),"_outsideRoom",void 0),h(m(r),"_appId",void 0),h(m(r),"_businessId",void 0),h(m(r),"_visibility",!0),h(m(r),"_localVideoTrack",void 0),h(m(r),"_localAudioTrack",void 0),h(m(r),"_localImgVideoTrack",void 0),h(m(r),"_localImgScreenTrack",void 0),h(m(r),"_localScreenVideoTrack",void 0),h(m(r),"_localScreenAudioTrack",void 0),h(m(r),"_tempMixingAudioTrack",void 0),h(m(r),"_audioPlaybackDeviceId",void 0),h(m(r),"_videoPlayer",void 0),h(m(r),"_screenPlayer",void 0),h(m(r),"_remoteVideoPlayer",new Map),h(m(r),"_remoteScreenPlayer",new Map),h(m(r),"_remoteAudioPlayer",new Map),h(m(r),"_remoteScreenAudioPlayer",new Map),h(m(r),"_publicStreamAudioPlayer",new Map),h(m(r),"_publicStreamVideoPlayer",new Map),h(m(r),"_publicStreamIds",new Map),h(m(r),"_roomConfig",void 0),h(m(r),"_videoStreamConstraints",{width:640,height:360,frameRate:15}),h(m(r),"_audioStreamConstraints",{}),h(m(r),"_enableSimulcast",!1),h(m(r),"_videoStreamEncodeConfig",[dj]),h(m(r),"_screenStreamEncodeConfig",[lj]),h(m(r),"_dummyMainImage",void 0),h(m(r),"_dummyScreenImage",void 0),h(m(r),"_trackSourceType",void 0),h(m(r),"_liveTranscodeConfig",void 0),h(m(r),"_useCloudProxy",void 0),h(m(r),"_startCloudProxyTimestamp",void 0),h(m(r),"_localVideoDeviceId",void 0),h(m(r),"_localAudioDeviceId",void 0),h(m(r),"_pauseAllSubscribeState",{audio:void 0,video:void 0,resumeStreamIds:{}}),h(m(r),"_audioVolumeIndicationTimer",void 0),h(m(r),"_dummyMainTimer",void 0),h(m(r),"_dummyScreenTimer",void 0),h(m(r),"_audioPropertiesReportTimer",null),h(m(r),"_mirrorType",B.MIRROR_TYPE_RENDER),h(m(r),"_audioMixingManager",void 0),h(m(r),"_pubLock",void 0),h(m(r),"_rtmClient",void 0),h(m(r),"_messageStatisticsObserver",void 0),h(m(r),"_tempRoomInfo",void 0),h(m(r),"_originIceConfigRequestUrls",void 0),h(m(r),"_originConfigServerUrls",void 0),h(m(r),"_originLogServerUrl",void 0),h(m(r),"_extensionManager",new GH),h(m(r),"_audioDeviceManager",new z$(r._extensionManager)),h(m(r),"_audioProfileManager",new X$),h(m(r),"_remoteVideoConfig",new Map),h(m(r),"_userPriorityMap",new Map),h(m(r),"_subscribeFallbackOption",X.DISABLE),h(m(r),"_cameraCapturing",!1),h(m(r),"_interruptCameraCapture",!1),h(m(r),"_micCapturing",!1),h(m(r),"_interruptMicCapture",!1),h(m(r),"_config",void 0),h(m(r),"_needClosePreTrack",!1),h(m(r),"_updateMixAudioTrack",function(){var e=c(o().mark((function e(t){var n,i,a=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=a.length>1&&void 0!==a[1]?a[1]:re.PLAYOUT_AND_PUBLISH,c0.print("_updateMixAudioTrack()"),r._localAudioTrack){e.next=5;break}return t&&(r._tempMixingAudioTrack={track:t,type:i}),e.abrupt("return");case 5:if(t?(r._localAudioTrack.mixType=i,r._localAudioTrack.mixedAudioTrack=t):(delete r._localAudioTrack.mixType,delete r._localAudioTrack.mixedAudioTrack),null===(n=r._room)||void 0===n||!n.hasPublished){e.next=9;break}return e.next=9,r._updatePublish();case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),h(m(r),"_onAudioMixingMessage",(function(e){r.safeEmit(oe.onAudioMixingStateChanged,e)})),h(m(r),"_onAudioMixingAutoplayFailed",(function(e){r.safeEmit(oe.onAutoplayFailed,e)})),r._appId=e,r._pubLock=new dX("pubLock"),r._addDeviceEventHandler(),r._audioMixingManager=new V$({getLocalAudioTrack:function(){return r._localAudioTrack},updateLocalAudioTrack:r._updateMixAudioTrack,emitMessage:r._onAudioMixingMessage,onAutoPlayFailed:r._onAudioMixingAutoplayFailed}),window.__rtc_engine__=m(r),window["__rtc_engine__".concat(Math.floor(100*Math.random()+1))]=m(r),r._trackSourceType={video:R.VIDEO_SOURCE_TYPE_INTERNAL,screenVideo:R.VIDEO_SOURCE_TYPE_INTERNAL,audio:w.AUDIO_SOURCE_TYPE_INTERNAL,screenAudio:w.AUDIO_SOURCE_TYPE_INTERNAL},r._config=t,r._rtmClient=new j$(e),r._handleRTMClient(r._rtmClient),r._useCloudProxy=!1,r._handleAudioDeviceManager(),r._messageStatisticsObserver=new HW,r._extensionManager.setMinotor(MB),r}return l(je,[{key:"appId",get:function(){return this._appId},set:function(e){this._appId=e}},{key:"updateToken",value:(Fe=c(o().mark((function e(t){var r,n,i,a,s;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c0.print("updateToken()","token: %s",t),zP(t,"token"),!this.waitForNewToken||!this._tempRoomInfo){e.next=8;break}return n=this._tempRoomInfo,i=n.config,a=n.userInfo,s=n.roomId,delete this._tempRoomInfo,e.next=7,this.joinRoom(t,s,a,i);case 7:return e.abrupt("return",e.sent);case 8:if(this._room){e.next=10;break}throw new hN(dN.UPDATE_TOKEN_BEFORE_JOIN,"update token before join room");case 10:return e.next=12,null===(r=this._room)||void 0===r?void 0:r.updateToken(t);case 12:case"end":return e.stop()}}),e,this)}))),function(e){return Fe.apply(this,arguments)})},{key:"setVideoCaptureDevice",value:(Ve=c(o().mark((function e(t){var r,n,i=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c0.print("setVideoCaptureDevice()","deviceId: %s",t),zP(t,"deviceId"),this._localVideoDeviceId=t,this._localVideoTrack){e.next=5;break}return e.abrupt("return");case 5:return r=hJ({},this._videoStreamConstraints),"user"===t||"environment"===t||"left"===t||"right"===t?(delete r.deviceId,r.facingMode=t):r.deviceId={exact:t},this._needClosePreTrack&&(this._removeLocalTrackEvents(this._localVideoTrack),this._localVideoTrack.close(),delete this._localVideoTrack),c0.print("setVideoCaptureDevice()","start createCameraVideoTrack..."),e.next=11,dz(r,this._extensionManager).catch((function(e){if(i._localVideoTrack&&!i._localVideoTrack.dummy)return c0.print("setVideoCaptureDevice()","createCameraVideoTrack failed, stop pre VideoTrack."),i._removeLocalTrackEvents(i._localVideoTrack),i._localVideoTrack.close(),delete i._localVideoTrack,dz(r,i._extensionManager).then((function(e){return i._needClosePreTrack=!0,e})).catch(c(o().mark((function t(){var r;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return c0.print("setVideoCaptureDevice()","createCameraVideoTrack failed, rollback."),t.next=3,dz(i._videoStreamConstraints,i._extensionManager);case 3:throw r=t.sent,i._switchTrack(r),e;case 6:case"end":return t.stop()}}),t)}))));throw e}));case 11:return n=e.sent,c0.print("setVideoCaptureDevice()","createCameraVideoTrack success."),this._videoStreamConstraints=r,this._localVideoTrack&&(this._removeLocalTrackEvents(this._localVideoTrack),this._localVideoTrack.close()),e.next=17,this._switchTrack(n);case 17:case"end":return e.stop()}}),e,this)}))),function(e){return Ve.apply(this,arguments)})},{key:"setAudioCaptureDevice",value:(Ue=c(o().mark((function e(t){var r,n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c0.print("setAudioCaptureDevice()","deviceId: %s",t),zP(t,"deviceId"),this._localAudioDeviceId=t,this._localAudioTrack){e.next=5;break}return e.abrupt("return");case 5:return(r=this._audioStreamConstraints).deviceId={exact:t},this._audioStreamConstraints=r,this._localAudioTrack.close(),this._removeLocalTrackEvents(this._localAudioTrack),e.next=12,hz(r,this._extensionManager,this._audioProfileManager);case 12:if(n=e.sent,this._initLocalTrackEvents(n),this._localAudioTrack=n,this._room){e.next=17;break}return e.abrupt("return");case 17:if(!this._room.hasPublished){e.next=20;break}return e.next=20,this._updatePublish();case 20:case"end":return e.stop()}}),e,this)}))),function(e){return Ue.apply(this,arguments)})},{key:"_addDeviceEventHandler",value:function(){UH.on(oe.onVideoDeviceStateChanged,this._onVideoDeviceStateChange.bind(this)),UH.on(oe.onAudioDeviceStateChanged,this._onAudioDeviceStateChange.bind(this))}},{key:"_addHandlerEventHandler",value:function(){var e,t,r,n,i,o,a,s,c,u,d,l,h,f,p,v,_,m,y,g,S,b,E,k,T,I,A,R,w,C=this;null===(e=this._room)||void 0===e||e.on(pj.ON_ADD_STREAM,this._onAddStream.bind(this)),null===(t=this._room)||void 0===t||t.on(pj.ON_REMOVE_STREAM,this._onRemoveStream.bind(this)),null===(r=this._room)||void 0===r||r.on(pj.USER_CONNECTION,this._onUserConnection.bind(this)),null===(n=this._room)||void 0===n||n.on(Gz.ON_USER_LEAVE,this._onUserLeave.bind(this)),null===(i=this._room)||void 0===i||i.on(Gz.ON_ROOM_ERROR,this._onRoomError.bind(this)),null===(o=this._room)||void 0===o||o.on(Gz.ON_NETWORK_QUALITY,this._onNetworkQuality.bind(this)),null===(a=this._room)||void 0===a||a.on(pj.ON_CUSTOM_MESSAGE,this._onCustomMessage.bind(this)),null===(s=this._room)||void 0===s||s.on(pj.USER_MESSAGE_RECEIVED,this._onUserMessageReceived.bind(this)),null===(c=this._room)||void 0===c||c.on(pj.USER_BINARY_MESSAGE_RECEIVED,this._onUserBinaryMessageReceived.bind(this)),null===(u=this._room)||void 0===u||u.on(pj.ON_USER_TOKEN_WILL_EXPIRE,this._onUserTokenWillExpire.bind(this)),null===(d=this._room)||void 0===d||d.on(pj.POST_PROCESSING_MESSAGE,(function(e){"2.0"===e.protocol?C._onStreamMixingEvent({error:e.error,event:e.eventType,message:e.message}):"publicStreamCallback"===e.type?C._onPushPublicStreamResult(e):"transcodeStatusCallback"===e.type&&C._onLiveTranscodingResult(e)})),null===(l=this._room)||void 0===l||l.on(_j.ON_CONNECTION_STATE_CHANGE,this._onConnectionStateChange.bind(this)),null===(h=this._room)||void 0===h||h.on(Gz.RESUBSCRIBE,this._onResubscribe.bind(this)),null===(f=this._room)||void 0===f||f.on(Gz.SUBSCRIBE_PUSH_TRACK,this._onSubscribePushTrack.bind(this)),null===(p=this._room)||void 0===p||p.on(Gz.REMOVE_PUSH_TRACK,this._onRemovePushTrack.bind(this)),null===(v=this._room)||void 0===v||v.on(Gz.ON_PUBLISH_RESULT,(function(e){var t;null!==(t=C._room)&&void 0!==t&&t._roomConfig.isAutoPublish&&C.safeEmit(oe.onAutoPublishResult,e)})),null===(_=this._room)||void 0===_||_.on(Gz.ON_REMOTE_STREAM_STATS,(function(e){C.safeEmit(oe.onRemoteStreamStats,e)})),null===(m=this._room)||void 0===m||m.on(Gz.ON_LOCAL_STREAM_STATS,(function(e){C.safeEmit(oe.onLocalStreamStats,e)})),null===(y=this._room)||void 0===y||y.on(Gz.ON_USER_PUBLISH_STATE_CHANGE,this._onUserPublishStateChange.bind(this)),null===(g=this._room)||void 0===g||g.on(Gz.ON_USER_START_AUDIO_CAPTURE,(function(e,t){var r=e.userId;C._updateAudioPlayerState(t),C.safeEmit(oe.onUserStartAudioCapture,{userId:r})})),null===(S=this._room)||void 0===S||S.on(Gz.ON_USER_STOP_AUDIO_CAPTURE,(function(e){var t=e.userId;C.safeEmit(oe.onUserStopAudioCapture,{userId:t})})),null===(b=this._room)||void 0===b||b.on(Gz.ON_USER_START_VIDEO_CAPTURE,(function(e){var t=e.userId;C.safeEmit(oe.onUserStartVideoCapture,{userId:t})})),null===(E=this._room)||void 0===E||E.on(Gz.ON_USER_STOP_VIDEO_CAPTURE,(function(e){var t=e.userId;C.safeEmit(oe.onUserStopVideoCapture,{userId:t})})),null===(k=this._room)||void 0===k||k.on(Gz.ON_SEI_MESSAGED_RECEIVED,(function(e){C.safeEmit(oe.onSEIMessageReceived,e)})),null===(T=this._room)||void 0===T||T.on(Gz.ON_REMOTE_VIDEO_SIZE_CHANGED,(function(e,t){C.safeEmit(oe.onRemoteVideoSizeChanged,e,t)})),null===(I=this._room)||void 0===I||I.on(Gz.ON_SIMULCAST_SUBSCRIBE_FALLBACK,(function(e){return C.safeEmit(oe.onSimulcastSubscribeFallback,e)})),null===(A=this._room)||void 0===A||A.on(Gz.RECONNECT_FAILED,(function(){C.safeEmit(oe.onError,{errorCode:dN.RECONNECT_FAILED})})),null===(R=this._room)||void 0===R||R.on(Gz.ON_VIDEO_STREAM_BANNED,(function(e){C.safeEmit(oe.onVideoStreamBanned,{uid:e.uid,banned:e.banned})})),null===(w=this._room)||void 0===w||w.on(Gz.ON_AUDIO_STREAM_BANNED,(function(e){C.safeEmit(oe.onAudioStreamBanned,{uid:e.uid,banned:e.banned})}))}},{key:"safeEmit",value:function(e){for(var t,r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return oM(e)&&zB(e,NP(n)),(t=b(p(je.prototype),"safeEmit",this)).call.apply(t,[this,e].concat(n))}},{key:"_removeHandlerEventHandler",value:function(){var e;null===(e=this._room)||void 0===e||e.removeAllListeners()}},{key:"joinRoom",value:(Le=c(o().mark((function e(t,r,n,a){var s,c,u,d,l,h;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c0.print("joinRoom()","token: %o roomId: %o, userInfo: %o, roomConfig: %o",t,r,n,a),QP(t)||zP(t,"token"),ZP(r),tM(n),s={isAutoPublish:!0,isAutoSubscribeAudio:!0,isAutoSubscribeVideo:!0,roomProfileType:Y.communication},hJ(s,a),rM(s),!this._room||this._room.connectionState===mX.DISCONNECTED){e.next=11;break}throw new hN(dN.REPEAT_JOIN,"Already joined");case 11:return this._room=new NW(a,{audioProfileManager:this._audioProfileManager,streamRTT:{}}),this._room.userPriorityMap=this._userPriorityMap,this._room.subscribeFallbackOption=this._subscribeFallbackOption,this._addHandlerEventHandler(),c=this._liveTranscodeConfig&&t0.getStartParams(this._liveTranscodeConfig),u=i(i({},n),{},{businessId:this._businessId,role:this._visibility?F$.NORMAL_USER:F$.SILENT_USER}),e.prev=17,this._useCloudProxy&&(this._startCloudProxyTimestamp=Date.now()),e.next=21,this._room.join(this._appId,r,t,u,c,this._useCloudProxy,null===(d=this._config)||void 0===d?void 0:d.expectedIDC);case 21:return l=e.sent,this._roomConfig=a,this._tempRoomInfo&&delete this._tempRoomInfo,null!=a&&a.isAutoPublish&&(this._visibility?this._updatePublish({invokeByJoinRoom:!0,mediaType:U.AUDIO_AND_VIDEO}):this.safeEmit(oe.onAutoPublishResult,{isScreen:!1,state:N.PUBLISH_FAIL})),e.abrupt("return",l);case 28:throw e.prev=28,e.t0=e.catch(17),e.t0.code===dN.INVALID_TOKEN&&(this._tempRoomInfo={config:a,roomId:r,userInfo:u}),null===(h=this._room)||void 0===h||h.destroy(),e.t0;case 33:case"end":return e.stop()}}),e,this,[[17,28]])}))),function(e,t,r,n){return Le.apply(this,arguments)})},{key:"leaveRoom",value:(Me=c(o().mark((function e(){var t,r,n,i=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=i.length>0&&void 0!==i[0]&&i[0],c0.print("leaveRoom()"),!t){e.next=7;break}return e.next=5,null===(r=this._room)||void 0===r?void 0:r.leave(t);case 5:e.next=8;break;case 7:null===(n=this._room)||void 0===n||n.leave(t).catch();case 8:this._removeHandlerEventHandler(),this._liveTranscodeConfig&&this.stopLiveTranscoding(),this._room=void 0,this._remoteAudioPlayer.forEach((function(e){return e.destroy()})),this._remoteAudioPlayer=new Map,this._remoteScreenAudioPlayer.forEach((function(e){return e.destroy()})),this._remoteScreenAudioPlayer=new Map,this._remoteScreenPlayer.forEach((function(e){return e.destroy()})),this._remoteScreenPlayer=new Map,this._remoteVideoPlayer.forEach((function(e){return e.destroy()})),this._remoteVideoPlayer=new Map,this._roomConfig=void 0,this._publicStreamIds=new Map;case 21:case"end":return e.stop()}}),e,this)}))),function(){return Me.apply(this,arguments)})},{key:"destroy",value:function(){var e,t,r;c0.print("destroy()"),this.removeAllListeners(),this._removeHandlerEventHandler(),null===(e=this._room)||void 0===e||e.destroy(),this._room=void 0,null===(t=this._videoPlayer)||void 0===t||t.destroy(),this._videoPlayer=void 0,this._screenPlayer=void 0,this._videoStreamConstraints={},this._audioStreamConstraints={},this._videoStreamEncodeConfig=[dj],this._screenStreamEncodeConfig=[lj],this._pauseAllSubscribeState={audio:void 0,video:void 0,resumeStreamIds:{}},this._messageStatisticsObserver.destroy(),clearInterval(this._audioVolumeIndicationTimer),clearInterval(this._dummyMainTimer),clearInterval(this._dummyScreenTimer),this._audioVolumeIndicationTimer=void 0,this._stopAudioPropertiesReport(),this._localAudioTrack&&(this._removeLocalTrackEvents(this._localAudioTrack),this._localAudioTrack.close(),this._localAudioTrack=void 0),this._localVideoTrack&&(this._removeLocalTrackEvents(this._localVideoTrack),this._localVideoTrack.close(),this._localVideoTrack=void 0),this._localScreenAudioTrack&&(this._removeLocalTrackEvents(this._localScreenAudioTrack),this._localScreenAudioTrack.close(),this._localScreenAudioTrack=void 0),this._localScreenVideoTrack&&(this._removeLocalTrackEvents(this._localScreenVideoTrack),this._localScreenVideoTrack.close(),this._localScreenVideoTrack=void 0),this._localImgVideoTrack&&(this._localImgVideoTrack.stop(),this._localImgVideoTrack=void 0),this._localImgScreenTrack&&(this._localImgScreenTrack.stop(),this._localImgScreenTrack=void 0),this._remoteAudioPlayer.forEach((function(e){return e.destroy()})),this._remoteAudioPlayer=new Map,this._remoteScreenAudioPlayer.forEach((function(e){return e.destroy()})),this._remoteScreenAudioPlayer=new Map,this._remoteScreenPlayer.forEach((function(e){return e.destroy()})),this._remoteScreenPlayer=new Map,this._remoteVideoPlayer.forEach((function(e){return e.destroy()})),this._remoteVideoPlayer=new Map,this._publicStreamAudioPlayer.forEach((function(e){return e.destroy()})),this._publicStreamAudioPlayer=new Map,this._publicStreamVideoPlayer.forEach((function(e){return e.destroy()})),this._publicStreamVideoPlayer=new Map,this._roomConfig=void 0,this._audioMixingManager.destroy(),this._rtmClient.destroy(),null===(r=this._outsideRoom)||void 0===r||r.destroy(),this._publicStreamIds=new Map,this._audioDeviceManager.destroy(),this._remoteVideoConfig=new Map,this._userPriorityMap.clear(),this._extensionManager.destroy(),this._cameraCapturing=!1,this._micCapturing=!1,this._interruptCameraCapture=!1,this._interruptMicCapture=!1}},{key:"publishStream",value:(Pe=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c0.print("publishStream()","mediaType: %o",t),this._checkMediaType(t),this._assertNotInRoom(),!VP(t)||this._localVideoTrack||!this._localImgVideoTrack){e.next=7;break}return e.next=6,az(this._localImgVideoTrack,this._extensionManager);case 6:this._localVideoTrack=e.sent;case 7:return e.next=9,this._updatePublish({mediaType:t});case 9:case"end":return e.stop()}}),e,this)}))),function(e){return Pe.apply(this,arguments)})},{key:"unpublishStream",value:(Ne=c(o().mark((function e(t,r){var n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c0.print("unpublishStream()","mediaType: %o",t),this._checkMediaType(t),this._assertNotInRoom(),!r){e.next=5;break}return e.abrupt("return",null===(n=this._room)||void 0===n?void 0:n.unpublish());case 5:return e.next=7,this._updatePublish({mediaType:t,pubState:zz.UNPUB});case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return Ne.apply(this,arguments)})},{key:"publishScreen",value:(De=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c0.print("publishScreen()","mediaType: %o",t),this._checkMediaType(t),this._assertNotInRoom(),e.prev=3,!VP(t)||this._localScreenVideoTrack||!this._localImgScreenTrack){e.next=8;break}return e.next=7,cz(this._localImgScreenTrack,this._extensionManager);case 7:this._localScreenVideoTrack=e.sent;case 8:return e.next=10,this._updateScreenPublish({mediaType:t,pubState:zz.PUB});case 10:e.next=19;break;case 12:if(e.prev=12,e.t0=e.catch(3),!(e.t0 instanceof hN)){e.next=18;break}throw e.t0;case 18:throw new hN(dN.UNEXPECTED_ERROR,"unexpected error",e.t0);case 19:case"end":return e.stop()}}),e,this,[[3,12]])}))),function(e){return De.apply(this,arguments)})},{key:"unpublishScreen",value:(xe=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return c0.print("unpublishScreen()","mediaType: %o",t),this._checkMediaType(t),this._assertNotInRoom(),e.next=5,this._updateScreenPublish({mediaType:t,pubState:zz.UNPUB});case 5:case"end":return e.stop()}}),e,this)}))),function(e){return xe.apply(this,arguments)})},{key:"subscribeStream",value:(Oe=c(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return c0.print("subscribeStream()","userId: %o, mediaType: %o",t,r),e.abrupt("return",this._subscribe(!1,t,r));case 2:case"end":return e.stop()}}),e,this)}))),function(e,t){return Oe.apply(this,arguments)})},{key:"_subscribe",value:(Ce=c(o().mark((function e(t,r,n){var i,a,s,c,u,d,l,h,f,p,v,_,m,y,g;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._checkMediaType(n),this._assertNotInRoom(),n!==U.AUDIO||null===(i=this._room)||void 0===i||!i.multiChatMode){e.next=5;break}return c0.print("subscribeStream()","due to multiChatMode return"),e.abrupt("return");case 5:if(u=this._room.remoteStreams.get(r),d=null==u?void 0:u.find((function(e){return e.isScreen===t}))){e.next=9;break}throw new hN(dN.STREAM_NOT_EXIST,"stream not exist");case 9:return l=this._pauseAllSubscribeState.audio,h=this._pauseAllSubscribeState.video,this._pauseAllSubscribeState.audio&&(n-=n&U.AUDIO),this._pauseAllSubscribeState.video&&(n-=n&U.VIDEO),c0.print("subscribeStream()","due to pauseAll mediaType: %o",n),f=d.hasSubscribed,p=this._remoteVideoConfig.get(r)||(null===(a=this._roomConfig)||void 0===a?void 0:a.remoteVideoConfig),d.originalMediaType=n,e.next=19,this._room.subscribe(d,n,p);case 19:UP(n)&&this._updateAudioPlayerState(d),VP(n)&&this._updateVideoPlayerState(d),v=0,_=0,l!==this._pauseAllSubscribeState.audio&&(this._pauseAllSubscribeState.audio?v|=U.AUDIO:_|=U.AUDIO),h!==this._pauseAllSubscribeState.video&&(this._pauseAllSubscribeState.video?v|=U.VIDEO:_|=U.VIDEO),v&&this.pauseAllSubscribedStream(v),_&&this.resumeAllSubscribedStream(_),this._pauseAllSubscribeState.resumeStreamIds[d.streamId]=d.streamId,!t&&(null!==(s=this._roomConfig)&&void 0!==s&&s.isAutoSubscribeAudio||null!==(c=this._roomConfig)&&void 0!==c&&c.isAutoSubscribeVideo)&&(d.audioTrack||d.videoTrack)&&(m={userId:r,isScreen:!1,state:D.SUBSCRIBE_SUCC},this.safeEmit(oe.onAutoSubscribeResult,m)),!f&&UP(n)&&d.hasAudio&&(null===(y=d.observer)||void 0===y||y.setSubscribeAudio(!0)),!f&&VP(n)&&d.hasVideo&&(null===(g=d.observer)||void 0===g||g.setSubscribeVideo(!0));case 31:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return Ce.apply(this,arguments)})},{key:"unsubscribeStream",value:(we=c(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:c0.print("unsubscribeStream()","userId: %o, mediaType: %o",t,r),this._unsubscribe(!1,t,r);case 2:case"end":return e.stop()}}),e,this)}))),function(e,t){return we.apply(this,arguments)})},{key:"subscribeScreen",value:(Re=c(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return c0.print("subscribeScreen() userId: %o, mediaType: %o",t,r),e.abrupt("return",this._subscribe(!0,t,r));case 2:case"end":return e.stop()}}),e,this)}))),function(e,t){return Re.apply(this,arguments)})},{key:"unsubscribeScreen",value:(Ae=c(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:c0.print("unsubscribeScreen() userId: %o, mediaType: %o",t,r),this._unsubscribe(!0,t,r);case 2:case"end":return e.stop()}}),e,this)}))),function(e,t){return Ae.apply(this,arguments)})},{key:"_unsubscribe",value:function(e,t,r,n){var i,o=this;if(this._checkMediaType(r),this._assertNotInRoom(),r!==U.AUDIO||null===(i=this._room)||void 0===i||!i.multiChatMode){var a=this._room.remoteStreams.get(t),s=null==a?void 0:a.find((function(t){return t.isScreen===e}));if(null==s||!s.hasSubscribed)throw new hN(dN.STREAM_NOT_EXIST,"stream not exist");return this._room.unsubscribe(s,r).then((function(){n||delete o._pauseAllSubscribeState.resumeStreamIds[s.streamId]}))}c0.print("subscribeStream()","due to multiChatMode return")}},{key:"setRemoteVideoConfig",value:(Ie=c(o().mark((function e(t,r){var n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return c0.print("setRemoteVideoConfig() userId: %o, remoteVideoConfig: %o",t,r),$P(t),aM(r),this._remoteVideoConfig.set(t,r),e.abrupt("return",null===(n=this._room)||void 0===n?void 0:n.updateSubVideoConfig(t,r).then((function(){})));case 5:case"end":return e.stop()}}),e,this)}))),function(e,t){return Ie.apply(this,arguments)})},{key:"startVideoCapture",value:(Te=c(o().mark((function e(t){var r,n,i,a,s,c,u,d,l,h=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c0.print("startVideoCapture()","deviceId: %s",t),QP(t)||zP(t,"deviceId"),t=t||this._localVideoDeviceId,this._localVideoDeviceId=t,this._trackSourceType.video!==R.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=6;break}throw new hN(dN.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as internal first");case 6:if(!(this._cameraCapturing||this._localVideoTrack&&!this._localVideoTrack.dummy)){e.next=8;break}throw new hN(dN.REPEAT_CAPTURE,"Has already capture");case 8:return i=this._videoStreamConstraints,t&&("user"===t||"environment"===t||"left"===t||"right"===t?i.facingMode=t:i.deviceId={exact:t},this._videoStreamConstraints=i),a={},e.prev=11,this._cameraCapturing=!0,e.next=15,dz(i,this._extensionManager);case 15:if(c=e.sent,!this._interruptCameraCapture){e.next=21;break}throw this._interruptCameraCapture=!1,this._removeLocalTrackEvents(c),c.close(),new hN(dN.INTERRUPT,"interrupt by stopVideoCapture");case 21:if(this._initLocalTrackEvents(c),this._localVideoTrack=c,null===(s=this._videoPlayer)||void 0===s||s.playVideo(c),(u=null==c?void 0:c.getTrack())&&(a=u.getSettings(),d={width:a.width,height:a.height},this._localVideoTrack.resolution=d,setTimeout((function(){return h.safeEmit(oe.onLocalVideoSizeChanged,{streamIndex:L.STREAM_INDEX_MAIN,info:d})}))),this._room){e.next=28;break}return e.abrupt("return",a);case 28:return e.prev=28,this._cameraCapturing=!1,e.finish(28);case 31:return l=this._room._roomConfig.isAutoPublish,(this._room.hasPublished||l)&&(this._visibility?this._updatePublish():this.safeEmit(oe.onAutoPublishResult,{isScreen:!1,state:N.PUBLISH_FAIL})),null===(r=this._room.localStream)||void 0===r||null===(n=r.observer)||void 0===n||n.setEnableVideo(!0),e.abrupt("return",a);case 35:case"end":return e.stop()}}),e,this,[[11,,28,31]])}))),function(e){return Te.apply(this,arguments)})},{key:"stopVideoCapture",value:(ke=c(o().mark((function e(){var t,r,n,i,a,s;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c0.print("stopVideoCapture()"),!this._cameraCapturing){e.next=5;break}return this._interruptCameraCapture=!0,c0.print("stopVideoCapture()","capturing"),e.abrupt("return");case 5:if(this._trackSourceType.video!==R.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=7;break}throw new hN(dN.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as internal first");case 7:if(null===(t=this._videoPlayer)||void 0===t||t.stop(),this._localVideoTrack&&(this._localVideoTrack.dummy||(this._removeLocalTrackEvents(this._localVideoTrack),this._localVideoTrack.close(),this._localImgVideoTrack?(null===(s=this._localVideoTrack)||void 0===s||s.setTrack(this._localImgVideoTrack,this._extensionManager),this._localVideoTrack.dummy=!0):this._localVideoTrack=void 0)),this._room){e.next=11;break}return e.abrupt("return");case 11:if(null===(r=this._room)||void 0===r||!r.hasPublished){e.next=14;break}return e.next=14,this._updatePublish();case 14:null===(n=this._room)||void 0===n||null===(i=n.localStream)||void 0===i||null===(a=i.observer)||void 0===a||a.setEnableVideo(!1);case 15:case"end":return e.stop()}}),e,this)}))),function(){return ke.apply(this,arguments)})},{key:"startAudioCapture",value:(Ee=c(o().mark((function e(t){var r,n,i,a,s;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c0.print("startAudioCapture()","deviceId: $o",t),QP(t)||zP(t,"deviceId"),t=t||this._localAudioDeviceId,this._localAudioDeviceId=t,this._trackSourceType.audio!==w.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=6;break}throw new hN(dN.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");case 6:if(!this._micCapturing&&!this._localAudioTrack){e.next=8;break}throw new hN(dN.REPEAT_CAPTURE,"Has already capture");case 8:return i=this._audioStreamConstraints,t&&(i.deviceId={exact:t},this._audioStreamConstraints=i),e.prev=10,this._micCapturing=!0,e.next=14,hz(i,this._extensionManager,this._audioProfileManager);case 14:if(a=e.sent,!this._interruptMicCapture){e.next=20;break}throw this._interruptMicCapture=!1,this._removeLocalTrackEvents(a),a.close(),new hN(dN.INTERRUPT,"interrupt by stopAudioCapture");case 20:if(this._initLocalTrackEvents(a),this._localAudioTrack=a,this._tempMixingAudioTrack&&(this._localAudioTrack.mixType=this._tempMixingAudioTrack.type,this._localAudioTrack.mixedAudioTrack=this._tempMixingAudioTrack.track,delete this._tempMixingAudioTrack),this._room){e.next=25;break}return e.abrupt("return");case 25:return e.prev=25,this._micCapturing=!1,e.finish(25);case 28:s=this._room._roomConfig.isAutoPublish,(this._room.hasPublished||s)&&(this._visibility?this._updatePublish():this.safeEmit(oe.onAutoPublishResult,{isScreen:!1,state:N.PUBLISH_FAIL})),null===(r=this._room.localStream)||void 0===r||null===(n=r.observer)||void 0===n||n.setEnableAudio(!0);case 31:case"end":return e.stop()}}),e,this,[[10,,25,28]])}))),function(e){return Ee.apply(this,arguments)})},{key:"stopAudioCapture",value:(be=c(o().mark((function e(){var t,r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c0.print("stopAudioCapture()"),!this._micCapturing){e.next=5;break}return this._interruptMicCapture=!0,c0.print("stopAudioCapture()","capturing"),e.abrupt("return");case 5:if(this._trackSourceType.audio!==w.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=7;break}throw new hN(dN.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");case 7:if(this._localAudioTrack&&(this._removeLocalTrackEvents(this._localAudioTrack),this._localAudioTrack.close()),this._localAudioTrack=void 0,this._audioMixingManager.stopAll(),this._room){e.next=12;break}return e.abrupt("return");case 12:if(!this._room.hasPublished){e.next=15;break}return e.next=15,this._updatePublish();case 15:null===(t=this._room.localStream)||void 0===t||null===(r=t.observer)||void 0===r||r.setEnableAudio(!1);case 16:case"end":return e.stop()}}),e,this)}))),function(){return be.apply(this,arguments)})},{key:"getAudioMixingManager",value:function(){return c0.print("getAudioMixingManager()"),this._audioMixingManager}},{key:"startScreenCapture",value:(Se=c(o().mark((function e(){var t,r,n,i,a,s,c,u,d,l,h,f,p,v=this,_=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=_.length>0&&void 0!==_[0]?_[0]:{},c0.print("startScreenCapture()","config: %o",a),s=a.enableAudio,c=void 0!==s&&s,this._trackSourceType.screenVideo!==R.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=5;break}throw new hN(dN.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as internal first");case 5:if(this._trackSourceType.screenAudio!==w.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=7;break}throw new hN(dN.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");case 7:return e.next=9,pz(c,this._extensionManager,this._screenStreamEncodeConfig[0]);case 9:if(u=e.sent,d=E(u,2),l=d[0],h=d[1],this._localScreenVideoTrack&&!this._localScreenVideoTrack.dummy&&(this._removeLocalTrackEvents(this._localScreenVideoTrack),this._localScreenVideoTrack.close()),null===(t=this._localScreenAudioTrack)||void 0===t||t.close(),delete this._localScreenAudioTrack,this._localScreenVideoTrack=l,null!==(r=this._screenStreamEncodeConfig[0])&&void 0!==r&&r.contentHint&&l.setContentHint(null===(f=this._screenStreamEncodeConfig[0])||void 0===f?void 0:f.contentHint),(p=null==l?void 0:l.getTrack())&&setTimeout((function(){var e=p.getSettings(),t={width:e.width,height:e.height};l.resolution=t,v.safeEmit(oe.onLocalVideoSizeChanged,{streamIndex:L.STREAM_INDEX_SCREEN,info:{width:e.width,height:e.height}})}),500),h&&(this._localScreenAudioTrack=h,this._initLocalTrackEvents(h)),null===(n=this._screenPlayer)||void 0===n||n.playVideo(this._localScreenVideoTrack),this._initLocalTrackEvents(this._localScreenVideoTrack,!0),null===(i=this._room)||void 0===i||!i.hasScreenPublished){e.next=26;break}return e.next=26,this._updateScreenPublish();case 26:case"end":return e.stop()}}),e,this)}))),function(){return Se.apply(this,arguments)})},{key:"stopScreenCapture",value:(ge=c(o().mark((function e(){var t,r,n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c0.print("stopScreenCapture()"),null===(t=this._screenPlayer)||void 0===t||t.stop(),this._localScreenVideoTrack&&(this._localScreenVideoTrack.dummy||(this._removeLocalTrackEvents(this._localScreenVideoTrack),this._localScreenVideoTrack.close(),this._localImgScreenTrack&&(null===(n=this._localScreenVideoTrack)||void 0===n||n.setTrack(this._localImgScreenTrack,this._extensionManager),this._localScreenVideoTrack.dummy=!0))),this._localScreenAudioTrack&&(this._removeLocalTrackEvents(this._localScreenAudioTrack),this._localScreenAudioTrack.close()),this._localScreenAudioTrack=void 0,null===(r=this._room)||void 0===r||!r.hasScreenPublished){e.next=8;break}return e.next=8,this._updateScreenPublish();case 8:case"end":return e.stop()}}),e,this)}))),function(){return ge.apply(this,arguments)})},{key:"setLocalVideoPlayer",value:function(e,t){if(c0.print("setLocalVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",e,t),XP(e,"streamIndex",[L.STREAM_INDEX_MAIN,L.STREAM_INDEX_SCREEN]),t&&t.renderDom){var r,n,o=i(i({userId:this._getUserId()},t),{},{isLocal:!0});if(nM(o),e===L.STREAM_INDEX_MAIN&&!this._videoPlayer)return this._videoPlayer=new BW(o),this._initPlayerEvents(this._videoPlayer,!1,e),this._videoPlayer.mirror(!!this._mirrorType),this._localVideoTrack&&!this._localVideoTrack.dummy&&(null===(r=this._config)||void 0===r?void 0:r.autoPlayPolicy)!==Q.PLAY_MANUALLY&&this._videoPlayer.playVideo(this._localVideoTrack),this._videoPlayer.domElement;if(e===L.STREAM_INDEX_SCREEN&&!this._screenPlayer)return this._screenPlayer=new BW(i(i({},o),{},{isScreen:!0,isLocal:!0})),this._initPlayerEvents(this._screenPlayer,!1,e),this._localScreenVideoTrack&&!this._localScreenVideoTrack.dummy&&(null===(n=this._config)||void 0===n?void 0:n.autoPlayPolicy)!==Q.PLAY_MANUALLY&&this._screenPlayer.playVideo(this._localScreenVideoTrack),this._screenPlayer.domElement}else{var a,s;e===L.STREAM_INDEX_MAIN?(null===(a=this._videoPlayer)||void 0===a||a.destroy(),delete this._videoPlayer):(null===(s=this._screenPlayer)||void 0===s||s.destroy(),delete this._screenPlayer)}}},{key:"startLiveTranscoding",value:(ye=c(o().mark((function e(t){var r,n,i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c0.print("startLiveTranscoding()","transcode: %o",t),t0.checkStartParams(t),this._liveTranscodeConfig=t,!((n=null===(r=this._room)||void 0===r?void 0:r.roomInfo)&&n.roomId.length+n.userInfo.userId.length>126)){e.next=6;break}throw new hN(dN.INVALID_PARAMS,"The roomId+userId must be within 126 bytes");case 6:if(e.prev=6,this.safeEmit(oe.onStreamMixingEvent,{event:Hz.START,error:0,message:""}),!this._room||this._room.connectionState!==mX.CONNECTED){e.next=11;break}return e.next=11,null===(i=this._room)||void 0===i?void 0:i.liveControlMessage(t0.getStartParams(this._liveTranscodeConfig));case 11:e.next=20;break;case 13:if(e.prev=13,e.t0=e.catch(6),!(e.t0 instanceof hN)){e.next=19;break}throw e.t0;case 19:throw new hN(dN.UNEXPECTED_ERROR,"unexpected error",e.t0);case 20:case"end":return e.stop()}}),e,this,[[6,13]])}))),function(e){return ye.apply(this,arguments)})},{key:"updateLiveTranscoding",value:(me=c(o().mark((function e(t){var r,n,i,a;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c0.print("updateLiveTranscoding()","transcode: %o",t),this._liveTranscodeConfig){e.next=3;break}return e.abrupt("return");case 3:return delete(i=hJ({},t)).audio,null===(r=i.video)||void 0===r||delete r.codec,null===(n=i.video)||void 0===n||delete n.gop,t0.checckUpdateParams(i),this._liveTranscodeConfig=hJ(this._liveTranscodeConfig,i),e.prev=9,this.safeEmit(oe.onStreamMixingEvent,{event:Hz.UPDATE,error:0,message:""}),e.next=13,null===(a=this._room)||void 0===a?void 0:a.liveControlMessage(t0.getUpdateParams(this._liveTranscodeConfig));case 13:e.next=22;break;case 15:if(e.prev=15,e.t0=e.catch(9),!(e.t0 instanceof hN)){e.next=21;break}throw e.t0;case 21:throw new hN(dN.UNEXPECTED_ERROR,"unexpected error",e.t0);case 22:case"end":return e.stop()}}),e,this,[[9,15]])}))),function(e){return me.apply(this,arguments)})},{key:"stopLiveTranscoding",value:(_e=c(o().mark((function e(){var t;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c0.print("stopLiveTranscoding()"),this._liveTranscodeConfig){e.next=3;break}return e.abrupt("return");case 3:return delete this._liveTranscodeConfig,e.prev=4,this.safeEmit(oe.onStreamMixingEvent,{event:Hz.STOP,error:0,message:""}),e.next=8,null===(t=this._room)||void 0===t?void 0:t.liveControlMessage({action:"stopped",type:"transcode"});case 8:e.next=17;break;case 10:if(e.prev=10,e.t0=e.catch(4),!(e.t0 instanceof hN)){e.next=16;break}throw e.t0;case 16:throw new hN(dN.UNEXPECTED_ERROR,"unexpected error",e.t0);case 17:case"end":return e.stop()}}),e,this,[[4,10]])}))),function(){return _e.apply(this,arguments)})},{key:"setBusinessId",value:function(e){return c0.print("setBusinessId()","businessId: %s",e),!function(e){return"string"!=typeof e}(e)&&!this._room&&(VB.setStats({rtc_business_id:e}),EW.setStats({rtc_business_id:e}),this._businessId=e,!0)}},{key:"setUserVisibility",value:(ve=c(o().mark((function e(t){var r,n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c0.print("setUserVisibility()","enable: %o",t),t=!!t,this._visibility!==t){e.next=4;break}return e.abrupt("return");case 4:if(this._room){e.next=7;break}return this._visibility=t,e.abrupt("return");case 7:if(this._assertNotInRoom(),this._room.localStream&&(null===(n=this._room.localStream.observer)||void 0===n||n.setPublisher(t)),e.t0=!t,!e.t0){e.next=13;break}return e.next=13,this._room.unpublish();case 13:return e.next=15,this._room.updateUserAttributes({role:t?F$.NORMAL_USER:F$.SILENT_USER});case 15:this._visibility=t,t&&null!==(r=this._roomConfig)&&void 0!==r&&r.isAutoPublish&&this._updatePublish({mediaType:U.AUDIO_AND_VIDEO});case 17:case"end":return e.stop()}}),e,this)}))),function(e){return ve.apply(this,arguments)})},{key:"_initPlayerEvents",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:L.STREAM_INDEX_MAIN,i=n===L.STREAM_INDEX_SCREEN;e.on("playback_event",(function(n){switch(n.eventName){case"timeupdate":return;case"loadeddata":if("audio"===n.type){var o=e.userId.replace("_screen","");r?t.safeEmit(oe.onFirstPublicStreamAudioFrameDecoded,{publicStreamId:o}):(t.safeEmit(oe.onAudioFirstFrameDecoded,{userId:o,isScreen:i}),t.safeEmit(oe.onRemoteAudioFirstFrame,{userId:o,isScreen:i})),MB.firstRemoteAudioRender("",o||"",{isScreen:i})}else{var a,s,c={userId:e.userId,height:(null===(a=e.domElement)||void 0===a?void 0:a.videoHeight)||0,width:(null===(s=e.domElement)||void 0===s?void 0:s.videoWidth)||0,isScreen:i};r?(c.publicStreamId=c.userId,delete c.userId,delete c.isScreen,t.safeEmit(oe.onFirstPublicStreamVideoFrameRendered,c),t.safeEmit(oe.onFirstPublicStreamVideoFrameDecoded,c)):e.isLocal||(t.safeEmit(oe.onVideoFirstFrameRendered,c),t.safeEmit(oe.onVideoFirstFrameDecoded,c),t.safeEmit(oe.onRemoteVideoFirstFrame,c)),MB.firstRemoteVideoRender("",n.userId||"",{isScreen:i})}break;case"autoplay-error":return r&&(n.publicStreamId=n.userId),MB.rtcInvokeStatus(e instanceof BW?"video":"audio",0,"autoplay-error",n.userId||"",0),void t.safeEmit(oe.onAutoplayFailed,{userId:n.userId,kind:e instanceof BW?"video":"audio",mediaType:e instanceof BW?U.VIDEO:U.AUDIO,streamIndex:e.isScreen?L.STREAM_INDEX_SCREEN:L.STREAM_INDEX_MAIN})}t.safeEmit(oe.onPlayerEvent,n)}))}},{key:"_initLocalTrackEvents",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];e.on("track-ended",(function(e){var r=!1;e!==t._localScreenAudioTrack&&e!==t._localScreenVideoTrack||(r=!0),t.safeEmit(oe.onTrackEnded,{kind:e.getTrack().kind,isScreen:r})})),e.on("resolution-change",(function(e){t.safeEmit(oe.onLocalVideoSizeChanged,{streamIndex:r?L.STREAM_INDEX_SCREEN:L.STREAM_INDEX_MAIN,info:e})}))}},{key:"_removeLocalTrackEvents",value:function(e){e.removeAllListeners("track-ended"),e.removeAllListeners("resolution-change")}},{key:"setRemoteVideoPlayer",value:function(e,t){c0.print("setRemoteVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",e,t),XP(e,"streamIndex",[L.STREAM_INDEX_MAIN,L.STREAM_INDEX_SCREEN]),nM(t);var r,n,o,a=t.userId;if(e===L.STREAM_INDEX_MAIN){var s,c,u;if(null===(s=this._remoteVideoPlayer.get(a))||void 0===s||s.destroy(),!t.renderDom)return;var d=new BW(t);this._initPlayerEvents(d,!1,e),this._remoteVideoPlayer.set(a,d);var l=null===(c=this._room)||void 0===c||null===(u=c.remoteStreams.get(a))||void 0===u?void 0:u.find((function(e){return!e.isScreen}));return l&&this._updateVideoPlayerState(l),d.domElement}if(null===(r=this._remoteScreenPlayer.get(a))||void 0===r||r.destroy(),t.renderDom){var h=new BW(i(i({},t),{},{isScreen:!0}));this._remoteScreenPlayer.set(a,h),this._initPlayerEvents(h,!1,e);var f=null===(n=this._room)||void 0===n||null===(o=n.remoteStreams.get(a))||void 0===o?void 0:o.find((function(e){return e.isScreen}));return f&&this._updateVideoPlayerState(f),h.domElement}}},{key:"setLocalVideoMirrorType",value:function(e){c0.print("setLocalVideoMirrorType()","mirrorType: %o",e),XP(e,"mirrorType",[B.MIRROR_TYPE_NONE,B.MIRROR_TYPE_RENDER]),this._mirrorType=e,this._videoPlayer&&this._videoPlayer.mirror(!!e)}},{key:"setAudioPlaybackDevice",value:(pe=c(o().mark((function e(t){var r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c0.print("setAudioPlaybackDevice()","deviceId: %s",t),zP(t,"deviceId"),void 0!==HTMLAudioElement.prototype.setSinkId){e.next=5;break}return c0.print("setAudioPlaybackDevice failed","setSinkId not supported by current browser"),e.abrupt("return");case 5:return e.next=7,UH.getDeviceById(t);case 7:if(r=e.sent){e.next=10;break}throw new hN(dN.INVALID_DEVICE_ID,"audio playback device id ".concat(t," is invalid"));case 10:this._remoteAudioPlayer.forEach((function(e){e.setPlaybackDevice(t)})),this._remoteScreenAudioPlayer.forEach((function(e){e.setPlaybackDevice(t)})),this._audioPlaybackDeviceId=t,r&&this.safeEmit(oe.onAudioPlaybackDeviceChanged,r),MB.rtcAudioDevice(EB.PLAYOUT_DEVICE_SWITCH,t,0);case 15:case"end":return e.stop()}}),e,this)}))),function(e){return pe.apply(this,arguments)})},{key:"play",value:(fe=c(o().mark((function e(t){var r,n,i,a,s,c,u,d,l,h,f,p,v,_,m,y,g=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=g.length>1&&void 0!==g[1]?g[1]:U.AUDIO_AND_VIDEO,s=g.length>2?g[2]:void 0,c0.print("play()","userId: %s, mediaType: %s, streamIndex: %s",t,a,s),c=!t||t===this._getUserId()||"local_user",u=void 0===s||s===L.STREAM_INDEX_MAIN,d=void 0===s||s===L.STREAM_INDEX_SCREEN,l=a!==U.VIDEO,h=a!==U.AUDIO,f=[],c&&h&&(u&&this._localVideoTrack&&(null===(p=this._videoPlayer)||void 0===p||p.mirror(!!this._mirrorType),f.push(null===(v=this._videoPlayer)||void 0===v?void 0:v.playVideo(this._localVideoTrack))),d&&this._localScreenVideoTrack&&f.push(null===(_=this._screenPlayer)||void 0===_?void 0:_.playVideo(this._localScreenVideoTrack))),t===(null===(r=this._audioMixingManager)||void 0===r?void 0:r.id)&&f.push(this._audioMixingManager.resumeLocalPlay()),m=null===(n=this._room)||void 0===n?void 0:n.remoteStreams,h&&u&&f.push(GW(this._remoteVideoPlayer,t,!1,m)),h&&d&&f.push(GW(this._remoteScreenPlayer,t,!0,m)),l&&u&&f.push(GW(this._remoteAudioPlayer,t,!1,m)),h&&d&&f.push(GW(this._remoteScreenAudioPlayer,t,!0,m)),y=null===(i=this._outsideRoom)||void 0===i?void 0:i.remoteStreams,l&&f.push(GW(this._publicStreamVideoPlayer,t,!1,y)),h&&f.push(GW(this._publicStreamAudioPlayer,t,!1,y)),e.abrupt("return",Promise.all(f).then((function(){})));case 20:case"end":return e.stop()}}),e,this)}))),function(e){return fe.apply(this,arguments)})},{key:"pauseAllSubscribedStream",value:(he=c(o().mark((function e(t){var r,n,i,a,s=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c0.print("pauseAllSubscribedStream()","mediaType: %o",t),this._checkMediaType(t),UP(t)&&(s._pauseAllSubscribeState.audio=!0),VP(t)&&(s._pauseAllSubscribeState.video=!0),this._room){e.next=6;break}return e.abrupt("return",Promise.resolve());case 6:r=[],n=A(this._room.remoteStreams.values());try{for(n.s();!(i=n.n()).done;)a=i.value,Array.isArray(a)&&a.forEach((function(e){if(e.hasSubscribed){s._pauseAllSubscribeState.resumeStreamIds[e.streamId]=e.streamId;var n=s._unsubscribe(e.isScreen,e.userId,t,!0);n&&r.push(n)}}))}catch(o){n.e(o)}finally{n.f()}return e.abrupt("return",Promise.all(r).then((function(){})));case 10:case"end":return e.stop()}}),e,this)}))),function(e){return he.apply(this,arguments)})},{key:"resumeAllSubscribedStream",value:(le=c(o().mark((function e(t){var r,n,i,a,s=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c0.print("resumeAllSubscribedStream()","mediaType: %o",t),this._checkMediaType(t),UP(t)&&(s._pauseAllSubscribeState.audio=!1),VP(t)&&(s._pauseAllSubscribeState.video=!1),this._room){e.next=6;break}return e.abrupt("return",Promise.resolve());case 6:r=[],n=A(this._room.remoteStreams.values());try{for(n.s();!(i=n.n()).done;)a=i.value,Array.isArray(a)&&a.forEach((function(e){if(s._pauseAllSubscribeState.resumeStreamIds[e.streamId]){delete s._pauseAllSubscribeState.resumeStreamIds[e.streamId];var n=s._subscribe(e.isScreen,e.userId,t);n&&r.push(n)}}))}catch(o){n.e(o)}finally{n.f()}return e.abrupt("return",Promise.all(r).then((function(){var e,t;null===(e=s._room)||void 0===e||null===(t=e.remoteStreams)||void 0===t||t.forEach((function(e){Array.isArray(e)&&e.forEach((function(e){s._updateAudioPlayerState(e),s._updateVideoPlayerState(e)}))}))})));case 10:case"end":return e.stop()}}),e,this)}))),function(e){return le.apply(this,arguments)})},{key:"sendUserMessage",value:(de=c(o().mark((function e(t,r){var n,i,a,s=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return $P(t),iM(r),this._assertNotInRoom(),a=Date.now(),e.abrupt("return",null===(n=this._room)||void 0===n||null===(i=n.sendUserMessage(t,r))||void 0===i?void 0:i.then((function(e){return s._messageStatisticsObserver.countP2PMessage(!0,t,!1,a,e),e.id})).catch((function(e){throw s._messageStatisticsObserver.countP2PMessage(!1,t,!1,a,e),e})));case 5:case"end":return e.stop()}}),e,this)}))),function(e,t){return de.apply(this,arguments)})},{key:"sendUserBinaryMessage",value:(ue=c(o().mark((function e(t,r){var n,i,a,s=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return $P(t),WP(r,"message"),iM(r),this._assertNotInRoom(),a=Date.now(),e.abrupt("return",null===(n=this._room)||void 0===n||null===(i=n.sendUserMessage(t,r))||void 0===i?void 0:i.then((function(e){return s._messageStatisticsObserver.countP2PMessage(!0,t,!0,a,e),e.id})).catch((function(e){throw s._messageStatisticsObserver.countP2PMessage(!1,t,!0,a,e),e})));case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return ue.apply(this,arguments)})},{key:"sendRoomMessage",value:(ce=c(o().mark((function e(t){var r,n,i,a=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return iM(t),this._assertNotInRoom(),i=Date.now(),e.abrupt("return",null===(r=this._room)||void 0===r||null===(n=r.sendRoomMessage(t))||void 0===n?void 0:n.then((function(e){var t,r;return a._messageStatisticsObserver.countRoomMessage(!0,null===(t=a._room)||void 0===t||null===(r=t.roomInfo)||void 0===r?void 0:r.roomId,!1,i),e})).catch((function(e){var t,r;throw a._messageStatisticsObserver.countRoomMessage(!1,null===(t=a._room)||void 0===t||null===(r=t.roomInfo)||void 0===r?void 0:r.roomId,!1,i),e})));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return ce.apply(this,arguments)})},{key:"sendRoomBinaryMessage",value:(se=c(o().mark((function e(t){var r,n,i,a=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return iM(t),this._assertNotInRoom(),i=Date.now(),e.abrupt("return",null===(r=this._room)||void 0===r||null===(n=r.sendRoomMessage(t,!0))||void 0===n?void 0:n.then((function(e){var t,r;return a._messageStatisticsObserver.countRoomMessage(!0,null===(t=a._room)||void 0===t||null===(r=t.roomInfo)||void 0===r?void 0:r.roomId,!0,i),e})).catch((function(e){var t,r;throw a._messageStatisticsObserver.countRoomMessage(!1,null===(t=a._room)||void 0===t||null===(r=t.roomInfo)||void 0===r?void 0:r.roomId,!0,i),e})));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return se.apply(this,arguments)})},{key:"setAudioCaptureConfig",value:(ae=c(o().mark((function e(){var t,r,n,i=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=i.length>0&&void 0!==i[0]?i[0]:{},c0.print("setAudioCaptureConfig()","config: %o",t),delete t.deviceId,YP(t),r=this._audioStreamConstraints.deviceId,this._audioStreamConstraints=t,r&&(this._audioStreamConstraints.deviceId=r),!this._localAudioTrack){e.next=11;break}return this._localAudioTrack.audioCaptureConfig=this._audioStreamConstraints,e.next=11,null===(n=this._localAudioTrack)||void 0===n?void 0:n.updateAudioCaptureConfig();case 11:case"end":return e.stop()}}),e,this)}))),function(){return ae.apply(this,arguments)})},{key:"setVideoCaptureConfig",value:(ie=c(o().mark((function e(){var t,r,n,a=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=a.length>0&&void 0!==a[0]?a[0]:{},c0.print("setVideoCaptureConfig()","config: %o",r),delete r.deviceId,YP(r),n=i(i({},r),{},{deviceId:this._videoStreamConstraints.deviceId}),!this._localVideoTrack){e.next=9;break}return e.next=8,this._localVideoTrack.updateVideoCaptureConfig(n);case 8:this._updatePublish();case 9:return this._videoStreamConstraints=n,e.abrupt("return",(null===(t=this._localVideoTrack)||void 0===t?void 0:t.getTrack().getSettings())||{});case 11:case"end":return e.stop()}}),e,this)}))),function(){return ie.apply(this,arguments)})},{key:"enableSimulcastMode",value:function(e){return c0.print("enableSimulcastMode()","enabled: %o",e),this._enableSimulcast=e,!0}},{key:"setVideoEncoderConfig",value:(ne=c(o().mark((function e(t){var r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:c0.print("setVideoEncoderConfig()"," descriptions: %o",t),Array.isArray(t)||(t=[t]),t.length>3&&(t=t.slice(0,3)),t.sort((function(e,t){return t.maxKbps-e.maxKbps})),this._videoStreamEncodeConfig=t,this._updateDummyCaptureImage(L.STREAM_INDEX_MAIN),null!==(r=this._room)&&void 0!==r&&r.hasPublished&&this._updatePublish();case 7:case"end":return e.stop()}}),e,this)}))),function(e){return ne.apply(this,arguments)})},{key:"setScreenEncoderConfig",value:(te=c(o().mark((function e(t){var r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:c0.print("setScreenEncoderConfig()","description: %o",t),this._screenStreamEncodeConfig=[t],this._localScreenVideoTrack&&(this._localScreenVideoTrack.updateVideoCaptureConfig(t),t.contentHint&&this._localScreenVideoTrack.setContentHint(t.contentHint)),this._updateDummyCaptureImage(L.STREAM_INDEX_SCREEN),null!==(r=this._room)&&void 0!==r&&r.hasScreenPublished&&this._updateScreenPublish();case 5:case"end":return e.stop()}}),e,this)}))),function(e){return te.apply(this,arguments)})},{key:"sendSEIMessage",value:function(e,t,r){if(c0.print("sendSEIMessage()","streamIdex: %o, message: %o, repeatCount: %o",e,t,r),!Yj())throw new hN(dN.NOT_SUPPORTED,"Browser does not support sending SEI");XP(e,"streamIndex",[L.STREAM_INDEX_MAIN,L.STREAM_INDEX_SCREEN]),HP(r,"repeatCount",0,30);var n="string"==typeof t?new Uint8Array(_P.str2ab(t)):t;if(t.length){var i;if(e===L.STREAM_INDEX_MAIN){var o,a,s;if(null===(o=this._room)||void 0===o||null===(a=o.localStream)||void 0===a||!a.hasPublished)return;i=null===(s=this._room)||void 0===s?void 0:s.localStream}else{var c,u,d;if(null===(c=this._room)||void 0===c||null===(u=c.localScreenStream)||void 0===u||!u.hasPublished)return;i=null===(d=this._room)||void 0===d?void 0:d.localScreenStream}if(n.byteLength>4096)c0.print("sei size must not bigger than 4KB");else{var l=hP();i.seiList.push({content:n,uuid:l,repeatCount:r}),setTimeout((function(){if(i){var e=i.seiList.findIndex((function(e){return e.uuid===l}));e&&i.seiList.splice(e,1)}}),2e3)}}else c0.print("sei message must not be empty")}},{key:"setAudioVolumeIndicationInterval",value:function(e){var t=this;c0.print("setAudioVolumeIndicationInterval()","interval %o: ",e),("number"!=typeof e||e<200)&&(e=200);var r=[];this._audioVolumeIndicationTimer&&clearInterval(this._audioVolumeIndicationTimer),this._audioVolumeIndicationTimer=setInterval((function(){var e,n;r=[],null===(e=t._room)||void 0===e||e.remoteStreams.forEach((function(e,t){var n;if(0!==e.length){var i=e.find((function(e){return!1===e.isScreen})),o=null==i||null===(n=i.audioTrack)||void 0===n?void 0:n.getAudioLevel();r.push({userId:t,volume:o||0})}}));var i=null===(n=t._localAudioTrack)||void 0===n?void 0:n.getAudioLevel();r.push({userId:t._getUserId(),volume:i||0}),t.safeEmit(oe.onAudioVolumeIndication,{speakers:r})}),e)}},{key:"_sendActiveSpeaker",value:function(e,t){if(this._room&&this._room.remoteUsers.size>=1){var r,n=e[0],i=t.reduce((function(e,t){return e&&e.audioPropertiesInfo.nonlinearVolume>t.audioPropertiesInfo.nonlinearVolume?e:t}),void 0);if((r=n?i?n.audioPropertiesInfo.nonlinearVolume>i.audioPropertiesInfo.nonlinearVolume?n:i:n:i)&&r.audioPropertiesInfo.nonlinearVolume>-35){var o,a;if(r.streamKey)o=this._room.remoteUsers.get(r.streamKey.userId);else o=null===(a=this._room._roomInfo)||void 0===a?void 0:a.userInfo;o&&this.safeEmit(oe.onActiveSpeaker,{userId:o.userId,extraInfo:o.extraInfo})}}}},{key:"enableAudioPropertiesReport",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};c0.print("enableAudioPropertiesReport()","config %o: ",t);var r=t.enableInBackground,n=void 0===r||r,i=t.interval,o=void 0===i?100:i;this._stopAudioPropertiesReport(),o<=0||(o=Math.max(100,o),this._audioPropertiesReportTimer=self.setInterval((function(){if(n||"hidden"!==document.visibilityState){var t=[],r=e._audioDeviceManager.getRecordTrack()||e._localAudioTrack;if(r){var i=r.getAudioLevel();t.push({streamIndex:L.STREAM_INDEX_MAIN,audioPropertiesInfo:{linearVolume:i,nonlinearVolume:LP(i)}})}if(e._localScreenAudioTrack){var o=e._localScreenAudioTrack.getAudioLevel();t.push({streamIndex:L.STREAM_INDEX_SCREEN,audioPropertiesInfo:{linearVolume:o,nonlinearVolume:LP(o)}})}if(e.safeEmit(oe.onLocalAudioPropertiesReport,t),e._room){var a,s=[];if(null!==(a=e._room)&&void 0!==a&&a.multiChatMode)e._room.getActiveSpeakerInMultiChatMode().forEach((function(t){var r,n,i=255*t.audioLevel;s.push({streamKey:{userId:t.userId,streamIndex:L.STREAM_INDEX_MAIN,roomId:null===(r=e._room)||void 0===r||null===(n=r._roomInfo)||void 0===n?void 0:n.roomId},audioPropertiesInfo:{linearVolume:i,nonlinearVolume:LP(i)}})}));else e._room.remoteStreams.forEach((function(t,r){t.forEach((function(t){if(t.audioTrack){var n,i,o=t.audioTrack.getAudioLevel();s.push({streamKey:{userId:r,streamIndex:t.isScreen?L.STREAM_INDEX_SCREEN:L.STREAM_INDEX_MAIN,roomId:null===(n=e._room)||void 0===n||null===(i=n.roomInfo)||void 0===i?void 0:i.roomId},audioPropertiesInfo:{linearVolume:o,nonlinearVolume:LP(o)}})}}))}));e.safeEmit(oe.onRemoteAudioPropertiesReport,s),e._sendActiveSpeaker(t,s.filter((function(e){return e.streamKey.streamIndex!==L.STREAM_INDEX_SCREEN})))}}}),o))}},{key:"setVideoSourceType",value:(ee=c(o().mark((function e(t,r){var n,i,a,s,c,u,d,l,h,f,p,v,_,m,y,g,S,b,E,k,T;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c0.print("setVideoSourceType()","index: %o, videoSourceType: %o",t,r),XP(t,"streamIndex",[L.STREAM_INDEX_MAIN,L.STREAM_INDEX_SCREEN]),XP(r,"VideoSourceType",[R.VIDEO_SOURCE_TYPE_EXTERNAL,R.VIDEO_SOURCE_TYPE_INTERNAL]),n=t===L.STREAM_INDEX_MAIN?"video":"screenVideo",this._trackSourceType[n]===r){e.next=26;break}if(this._trackSourceType[n]=r,c0.print("setVideoSourceType","set ".concat(n," source type to ").concat(r)),!this._localVideoTrack||t!==L.STREAM_INDEX_MAIN){e.next=17;break}if(c=!1,r===R.VIDEO_SOURCE_TYPE_EXTERNAL&&(c=!0,this._removeLocalTrackEvents(this._localVideoTrack),this._localVideoTrack.close()),null===(i=this._videoPlayer)||void 0===i||i.stop(),this._localVideoTrack=void 0,u=null===(a=this._room)||void 0===a?void 0:a._roomConfig.isAutoPublish,c?null===(d=this._room)||void 0===d||null===(l=d.localStream)||void 0===l||null===(h=l.observer)||void 0===h||h.setEnableVideo(!1):null===(f=this._room)||void 0===f||null===(p=f.localStream)||void 0===p||null===(v=p.observer)||void 0===v||v.setPushVideo(!1),!(null!==(s=this._room)&&void 0!==s&&s.hasPublished||u)){e.next=17;break}return e.next=17,this._updatePublish();case 17:if(!this._localScreenVideoTrack||t!==L.STREAM_INDEX_SCREEN){e.next=26;break}if(y=!1,r===R.VIDEO_SOURCE_TYPE_EXTERNAL&&(y=!0,this._removeLocalTrackEvents(this._localScreenVideoTrack),this._localScreenVideoTrack.close()),null===(_=this._screenPlayer)||void 0===_||_.stop(),this._localScreenVideoTrack=void 0,y?null===(g=this._room)||void 0===g||null===(S=g.localScreenStream)||void 0===S||null===(b=S.observer)||void 0===b||b.setEnableVideo(!1):null===(E=this._room)||void 0===E||null===(k=E.localScreenStream)||void 0===k||null===(T=k.observer)||void 0===T||T.setPushVideo(!1),null===(m=this._room)||void 0===m||!m.hasScreenPublished){e.next=26;break}return e.next=26,this._updateScreenPublish();case 26:case"end":return e.stop()}}),e,this)}))),function(e,t){return ee.apply(this,arguments)})},{key:"setExternalVideoTrack",value:($=c(o().mark((function e(t,r){var n,i,a,s,c,u,d,l,h;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c0.print("setExternalVideoTrack()","index: %o, track: %o",t,r),XP(t,"streamIndex",[L.STREAM_INDEX_MAIN,L.STREAM_INDEX_SCREEN]),KP(r),t!==L.STREAM_INDEX_MAIN){e.next=15;break}if(this._trackSourceType.video===R.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=6;break}throw new hN(dN.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as external first");case 6:return e.next=8,mz(r,this._extensionManager);case 8:if(this._localVideoTrack=e.sent,this._initLocalTrackEvents(this._localVideoTrack),null===(n=this._videoPlayer)||void 0===n||n.playVideo(this._localVideoTrack),s=null===(i=this._room)||void 0===i?void 0:i._roomConfig.isAutoPublish,!(null!==(a=this._room)&&void 0!==a&&a.hasPublished||s)){e.next=15;break}return e.next=15,this._updatePublish();case 15:if(t!==L.STREAM_INDEX_SCREEN){e.next=27;break}if(this._trackSourceType.screenVideo===R.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=18;break}throw new hN(dN.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as external first");case 18:return e.next=20,bz(r,this._extensionManager);case 20:if(this._localScreenVideoTrack=e.sent,this._initLocalTrackEvents(this._localScreenVideoTrack,!0),null===(c=this._screenPlayer)||void 0===c||c.playVideo(this._localScreenVideoTrack),null===(u=this._room)||void 0===u||null===(d=u.localScreenStream)||void 0===d||null===(l=d.observer)||void 0===l||l.setPushVideo(!0),null===(h=this._room)||void 0===h||!h.hasScreenPublished){e.next=27;break}return e.next=27,this._updateScreenPublish();case 27:case"end":return e.stop()}}),e,this)}))),function(e,t){return $.apply(this,arguments)})},{key:"setAudioSourceType",value:(Z=c(o().mark((function e(t,r){var n,i,a,s,c,u,d,l,h,f,p,v,_,m,y,g,S,b,E;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c0.print("setAudioSourceType()","index: %o, audioSourceType: %o",t,r),XP(t,"streamIndex",[L.STREAM_INDEX_MAIN,L.STREAM_INDEX_SCREEN]),XP(r,"audioSourceType",[w.AUDIO_SOURCE_TYPE_EXTERNAL,w.AUDIO_SOURCE_TYPE_INTERNAL]),n=t===L.STREAM_INDEX_MAIN?"audio":"screenAudio",this._trackSourceType[n]===r){e.next=24;break}if(this._trackSourceType[n]=r,c0.print("setVideoSourceType","set ".concat(n," source type to ").concat(r)),!this._localAudioTrack||t!==L.STREAM_INDEX_MAIN){e.next=16;break}if(s=!1,this._trackSourceType.audio===w.AUDIO_SOURCE_TYPE_EXTERNAL&&(s=!0,this._removeLocalTrackEvents(this._localAudioTrack),this._localAudioTrack.close()),this._localAudioTrack=void 0,c=null===(i=this._room)||void 0===i?void 0:i._roomConfig.isAutoPublish,s?null===(u=this._room)||void 0===u||null===(d=u.localStream)||void 0===d||null===(l=d.observer)||void 0===l||l.setEnableAudio(!1):null===(h=this._room)||void 0===h||null===(f=h.localStream)||void 0===f||null===(p=f.observer)||void 0===p||p.setPushAudio(!1),!(null!==(a=this._room)&&void 0!==a&&a.hasPublished||c)){e.next=16;break}return e.next=16,this._updatePublish();case 16:if(!this._localScreenAudioTrack||t!==L.STREAM_INDEX_SCREEN){e.next=24;break}if(_=!1,this._trackSourceType.audio===w.AUDIO_SOURCE_TYPE_EXTERNAL&&(_=!0,this._removeLocalTrackEvents(this._localScreenAudioTrack),this._localScreenAudioTrack.close()),this._localScreenAudioTrack=void 0,_?null===(m=this._room)||void 0===m||null===(y=m.localScreenStream)||void 0===y||null===(g=y.observer)||void 0===g||g.setEnableAudio(!1):null===(S=this._room)||void 0===S||null===(b=S.localScreenStream)||void 0===b||null===(E=b.observer)||void 0===E||E.setPushAudio(!1),null===(v=this._room)||void 0===v||!v.hasScreenPublished){e.next=24;break}return e.next=24,this._updateScreenPublish();case 24:case"end":return e.stop()}}),e,this)}))),function(e,t){return Z.apply(this,arguments)})},{key:"setExternalAudioTrack",value:(J=c(o().mark((function e(t,r){var n,i,a,s,c,u,d,l,h,f;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c0.print("setExternalAudioTrack()","index: %o, track: %o",t,r),XP(t,"streamIndex",[L.STREAM_INDEX_MAIN,L.STREAM_INDEX_SCREEN]),KP(r),t!==L.STREAM_INDEX_MAIN){e.next=15;break}if(this._trackSourceType.audio===w.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=6;break}throw new hN(dN.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as external first");case 6:return e.next=8,gz(r,this._extensionManager);case 8:if(this._localAudioTrack=e.sent,this._initLocalTrackEvents(this._localAudioTrack),u=null===(n=this._room)||void 0===n?void 0:n._roomConfig.isAutoPublish,null===(i=this._room)||void 0===i||null===(a=i.localStream)||void 0===a||null===(s=a.observer)||void 0===s||s.setPushAudio(!0),!(null!==(c=this._room)&&void 0!==c&&c.hasPublished||u)){e.next=15;break}return e.next=15,this._updatePublish();case 15:if(t!==L.STREAM_INDEX_SCREEN){e.next=26;break}if(this._trackSourceType.screenAudio===w.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=18;break}throw new hN(dN.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as external first");case 18:return e.next=20,kz(r,this._extensionManager);case 20:if(this._localScreenAudioTrack=e.sent,this._initLocalTrackEvents(this._localScreenAudioTrack),null===(d=this._room)||void 0===d||null===(l=d.localScreenStream)||void 0===l||null===(h=l.observer)||void 0===h||h.setPushAudio(!0),null===(f=this._room)||void 0===f||!f.hasScreenPublished){e.next=26;break}return e.next=26,this._updateScreenPublish();case 26:case"end":return e.stop()}}),e,this)}))),function(e,t){return J.apply(this,arguments)})},{key:"login",value:(W=c(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return c0.print("login()","token: %o, userInfo: %o",t,r),QP(t)||zP(t,"token"),$P(r),e.abrupt("return",this._rtmClient.login(t,r));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return W.apply(this,arguments)})},{key:"logout",value:(q=c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return c0.print("logout()"),e.abrupt("return",this._rtmClient.logout());case 2:case"end":return e.stop()}}),e,this)}))),function(){return q.apply(this,arguments)})},{key:"updateLoginToken",value:(z=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return c0.print("updateLoginToken()","token: %o",t),QP(t)||zP(t,"token"),e.abrupt("return",this._rtmClient.updateLoginToken(t));case 3:case"end":return e.stop()}}),e,this)}))),function(e){return z.apply(this,arguments)})},{key:"getPeerOnlineStatus",value:(H=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return c0.print("getPeerOnlineStatus()","userId: %o",t),$P(t),e.abrupt("return",this._rtmClient.getPeerOnlineStatus(t));case 3:case"end":return e.stop()}}),e,this)}))),function(e){return H.apply(this,arguments)})},{key:"sendUserMessageOutsideRoom",value:(G=c(o().mark((function e(t,r){var n,i=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return $P(t),iM(r),n=Date.now(),e.abrupt("return",this._rtmClient.sendUserMessageOutsideRoom(t,r).then((function(e){return i._messageStatisticsObserver.countUserMessageOutsideRoom(!0,t,!1,n,e),e.id})).catch((function(e){throw i._messageStatisticsObserver.countUserMessageOutsideRoom(!1,t,!1,n,e),e})));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return G.apply(this,arguments)})},{key:"sendUserBinaryMessageOutsideRoom",value:(j=c(o().mark((function e(t,r){var n,i=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return $P(t),WP(r,"message"),iM(r),n=Date.now(),e.abrupt("return",this._rtmClient.sendUserMessageOutsideRoom(t,r).then((function(e){return i._messageStatisticsObserver.countUserMessageOutsideRoom(!0,t,!0,n,e),e.id})).catch((function(e){throw i._messageStatisticsObserver.countUserMessageOutsideRoom(!1,t,!0,n,e),e})));case 5:case"end":return e.stop()}}),e,this)}))),function(e,t){return j.apply(this,arguments)})},{key:"setServerParams",value:(M=c(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return c0.print("setServerParams()","signature: %o, url: %0",t,r),e.abrupt("return",this._rtmClient.setServerParams(t,r));case 2:case"end":return e.stop()}}),e,this)}))),function(e,t){return M.apply(this,arguments)})},{key:"sendServerMessage",value:(P=c(o().mark((function e(t){var r,n=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return zP(t,"message"),iM(t),r=Date.now(),e.abrupt("return",this._rtmClient.sendServerMessage(t).then((function(){n._messageStatisticsObserver.countServerMessage(!0,!1,r)})).catch((function(e){throw n._messageStatisticsObserver.countServerMessage(!1,!1,r,e),e})));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return P.apply(this,arguments)})},{key:"sendServerBinaryMessage",value:(x=c(o().mark((function e(t){var r,n=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return WP(t,"message"),iM(t),r=Date.now(),e.abrupt("return",this._rtmClient.sendServerMessage(t).then((function(){n._messageStatisticsObserver.countServerMessage(!0,!0,r)})).catch((function(e){throw n._messageStatisticsObserver.countServerMessage(!1,!0,r,e),e})));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return x.apply(this,arguments)})},{key:"startCloudProxy",value:function(e){if(this._room)throw new hN(dN.START_CLOUD_PROXY_AFTER_JOIN,"[startCloudProxy] should be invoke before join room ");c0.print("startCloudProxy()",e),zP(e.logProxy,"logProxy"),zP(e.accessProxy,"accessProxy"),zP(e.configProxy,"configProxy"),this._originIceConfigRequestUrls=sj("ICE_CONFIG_REQUEST_URLS"),this._originLogServerUrl=sj("LOG_SERVER_URL"),this._originConfigServerUrls=sj("CONFIG_REQUEST_DOMAINS"),aj("ICE_CONFIG_REQUEST_URLS",e.accessProxy),aj("LOG_SERVER_URL",function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return/^https?:\/\/.+/.test(e)||(e="https://"+e),"".concat(e,"/video/v1/webrtc_log/")}(e.logProxy)),aj("CONFIG_REQUEST_DOMAINS",[e.configProxy]),this._useCloudProxy=!0}},{key:"stopCloudProxy",value:function(){if(this._room)throw new hN(dN.STOP_CLOUD_PROXY_BEFORE_LEAVE,"[stopCloudProxy] should be invoke after leave room ");c0.print("stopCloudProxy()"),aj("ICE_CONFIG_REQUEST_URLS",[]),aj("LOG_SERVER_URL",this._originLogServerUrl),aj("CONFIG_REQUEST_DOMAINS",this._originConfigServerUrls),this._useCloudProxy=!1,this._startCloudProxyTimestamp=void 0}},{key:"startPushPublicStream",value:(O=c(o().mark((function e(t,r){var n,i,a,s=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c0.print("startPushPublicStream()","publicStreamId: %o, publicStreamParam: %o",t,r),eM(t),this._assertNotInRoom(),!this._publicStreamIds.get(t)){e.next=5;break}throw new hN(dN.REPEAT_PUSH,"repeat push public media stream");case 5:return a=cj(t,"started",r),e.abrupt("return",null===(n=this._room)||void 0===n||null===(i=n.publicStreamControlMessage(a))||void 0===i?void 0:i.then((function(){s._publicStreamIds.set(t,t)})));case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return O.apply(this,arguments)})},{key:"updatePublicStreamParam",value:(C=c(o().mark((function e(t,r){var n,i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return c0.print("startPushPublicStream()","publicStreamId: %o, publicStreamParam: %o",t,r),eM(t),this._assertNotInRoom(),i=cj(t,"layoutChanged",r),e.abrupt("return",null===(n=this._room)||void 0===n?void 0:n.publicStreamControlMessage(i));case 5:case"end":return e.stop()}}),e,this)}))),function(e,t){return C.apply(this,arguments)})},{key:"stopPushPublicStream",value:(I=c(o().mark((function e(t){var r,n=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return c0.print("startPushPublicStream()","publicStreamId: %o",t),eM(t),this._assertNotInRoom(),e.abrupt("return",null===(r=this._room)||void 0===r?void 0:r.publicStreamControlMessage({type:"publicstream",action:"stopped",publicStreamID:t}).then((function(){n._publicStreamIds.delete(t)})));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return I.apply(this,arguments)})},{key:"startPlayPublicStream",value:(T=c(o().mark((function e(t){var r,n,i,a,s,c,u=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(eM(t),this._outsideRoom){e.next=8;break}return this._outsideRoom=new G$(this._appId),this._outsideRoom.on(Gz.RESUBSCRIBE,(function(e){var t=e.stream;if(t){var r,n=u._publicStreamAudioPlayer.get(t.streamId);n&&t.audioTrack&&(n.stop(),n.playAudio(null===(r=e.stream)||void 0===r?void 0:r.audioTrack));var i,o=u._publicStreamVideoPlayer.get(t.streamId);o&&t.videoTrack&&o.playVideo(null===(i=e.stream)||void 0===i?void 0:i.videoTrack)}})),null===(r=this._outsideRoom)||void 0===r||r.on("onRemoteStreamStats",(function(e){e.publicStreamId=e.userId,delete e.userId,delete e.isScreen,u.safeEmit(oe.onPublicStreamStats,e)})),null===(n=this._outsideRoom)||void 0===n||n.on(Gz.ON_SEI_MESSAGED_RECEIVED,(function(e){u.safeEmit(oe.onPublicStreamSEIMessageReceived,e)})),e.next=8,this._outsideRoom.connect();case 8:return e.next=10,this._outsideRoom.startPlayPublicStream(t);case 10:i=e.sent,(a=this._publicStreamVideoPlayer.get(t))&&null!=i&&i.videoTrack&&a.playVideo(i.videoTrack,i),!(s=this._publicStreamAudioPlayer.get(t))&&null!=i&&i.audioTrack&&(s=new jW(t,{muted:(null===(c=this._config)||void 0===c?void 0:c.autoPlayPolicy)===Q.VIDEO_ONLY,isScreen:!1}),this._initPlayerEvents(s,!0),s.playAudio(i.audioTrack),this._publicStreamAudioPlayer.set(t,s));case 15:case"end":return e.stop()}}),e,this)}))),function(e){return T.apply(this,arguments)})},{key:"stopPlayPublicStream",value:(k=c(o().mark((function e(t){var r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._outsideRoom){e.next=2;break}return e.abrupt("return");case 2:this._outsideRoom.stopPlayPublicStream(t),(r=this._publicStreamAudioPlayer.get(t))&&(r.destroy(),this._publicStreamAudioPlayer.delete(t));case 5:case"end":return e.stop()}}),e,this)}))),function(e){return k.apply(this,arguments)})},{key:"setAudioProfile",value:(S=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this._audioProfileManager.setAudioProfile(t);case 1:case"end":return e.stop()}}),e,this)}))),function(e){return S.apply(this,arguments)})},{key:"setPublicStreamVideoPlayer",value:function(e,t){var r,n,o,a;c0.print("setPublicStreamVideoPlayer()","publicStreamId: %o, videoPlayerOption: %o",e,t);var s=this._publicStreamVideoPlayer.get(e);if(null===(r=s)||void 0===r||r.destroy(),null!=t&&t.renderDom){s=new BW(i(i({},t),{},{userId:e})),this._initPlayerEvents(s,!0),this._publicStreamVideoPlayer.set(e,s);var c=null===(n=this._outsideRoom)||void 0===n||null===(o=n.remoteStreams)||void 0===o?void 0:o.get(e);null!=c&&c.videoTrack&&(null===(a=this._config)||void 0===a?void 0:a.autoPlayPolicy)!==Q.PLAY_MANUALLY&&s.playVideo(c.videoTrack,c)}else this._publicStreamVideoPlayer.delete(e)}},{key:"setDummyCaptureImagePath",value:(y=c(o().mark((function e(t,r){var n=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e,i){zP(r,"filePath");var o=new Image;o.crossOrigin="anonymous",o.src=r,o.onload=function(){t===L.STREAM_INDEX_MAIN?n._dummyMainImage=o:n._dummyScreenImage=o;try{n._updateDummyCaptureImage(t),e()}catch(r){i(new hN(dN.UNEXPECTED_ERROR,r.message))}},o.onerror=function(){i(new hN(dN.UNEXPECTED_ERROR,"Load image error"))}})));case 1:case"end":return e.stop()}}),e)}))),function(e,t){return y.apply(this,arguments)})},{key:"_updateDummyCaptureImage",value:function(e){var t,r;if(e===L.STREAM_INDEX_MAIN?(t=this._dummyMainImage,r=this._videoStreamEncodeConfig[0]):(t=this._dummyScreenImage,r=this._screenStreamEncodeConfig[0]),t){var n,i,o=document.createElement("canvas"),a=o.getContext("2d");if(!a)throw new hN(dN.UNEXPECTED_ERROR,"Not support canvas");!r||t.width<=r.width&&t.height<=r.height?(n=t.width,i=t.height):(n=Math.min(r.width,t.width*r.height/t.height),i=Math.min(r.height,t.height*r.width/t.width)),o.width=n,o.height=i,a.drawImage(t,0,0,t.width,t.height,0,0,n,i);var s=window.setInterval((function(){t&&a.drawImage(t,0,0,t.width,t.height,0,0,n,i)}),200);e===L.STREAM_INDEX_MAIN?(clearInterval(this._dummyMainTimer),this._dummyMainTimer=s):(clearInterval(this._dummyScreenTimer),this._dummyScreenTimer=s);var c,u,d,l,h=o.captureStream(5).getVideoTracks()[0];if(e===L.STREAM_INDEX_MAIN){if(this._localImgVideoTrack=h,null!==(c=this._localVideoTrack)&&void 0!==c&&c.dummy)null===(u=this._localVideoTrack)||void 0===u||u.setTrack(this._localImgVideoTrack,this._extensionManager)}else if(this._localImgScreenTrack=h,null!==(d=this._localScreenVideoTrack)&&void 0!==d&&d.dummy)null===(l=this._localScreenVideoTrack)||void 0===l||l.setTrack(this._localImgScreenTrack,this._extensionManager)}}},{key:"registerExtension",value:(_=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.monitor=MB,t.isSupported()){e.next=3;break}throw new Error("This extension is not supported.");case 3:return e.next=5,t.init();case 5:this._extensionManager.register(t);case 6:case"end":return e.stop()}}),e,this)}))),function(e){return _.apply(this,arguments)})},{key:"defaultTranscoding",value:function(){return JSON.parse(JSON.stringify(t0.getDefaultValue()))}},{key:"_updatePublish",value:(v=c(o().mark((function e(){var t,r,n,a=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=a.length>0&&void 0!==a[0]?a[0]:{},c0.print("_updatePublish()","config: %o",t),r={mediaType:void 0,invokeByJoinRoom:!1,pubState:zz.PUB},t=i(i({},r),t),this._visibility){e.next=6;break}throw new hN(dN.NO_PUBLISH_PERMISSION,"no publish permission");case 6:return e.next=8,this._pubLock.lock();case 8:if(n=e.sent,this._room&&this._room.connectionState===mX.CONNECTED){e.next=12;break}return n(),e.abrupt("return");case 12:return e.prev=12,e.next=15,this._room.publish(this._videoStreamEncodeConfig,this._enableSimulcast,this._localVideoTrack,this._localAudioTrack,t.mediaType,t.pubState,t.invokeByJoinRoom);case 15:e.next=24;break;case 17:if(e.prev=17,e.t0=e.catch(12),!(e.t0 instanceof hN)){e.next=23;break}throw e.t0;case 23:throw new hN(dN.UNEXPECTED_ERROR,"unexpected error",e.t0);case 24:return e.prev=24,n(),e.finish(24);case 27:case"end":return e.stop()}}),e,this,[[12,17,24,27]])}))),function(){return v.apply(this,arguments)})},{key:"startAudioPlaybackDeviceTest",value:(d=c(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return c0.print("startAudioPlaybackDeviceTest()","filePath: %o, indicationInterval: %o",t,r),zP(t,"filePath"),HP(r,"indicationInterval"),e.next=5,this._audioDeviceManager.startAudioPlaybackDeviceTest(t,r);case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return d.apply(this,arguments)})},{key:"stopAudioPlaybackDeviceTest",value:function(){c0.print("stopAudioPlaybackDeviceTest()"),this._audioDeviceManager.stopAudioPlaybackDeviceTest()}},{key:"startAudioDeviceRecordTest",value:(s=c(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return c0.print("startAudioDeviceRecordTest()","indicationInterval: %o",t),HP(t,"indicationInterval"),e.next=4,this._audioDeviceManager.startAudioDeviceRecordTest(t,r);case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return s.apply(this,arguments)})},{key:"stopAudioDeviceRecordAndPlayTest",value:function(){c0.print("stopAudioDeviceRecordAndPlayTest()"),this._audioDeviceManager.stopAudioDeviceRecordAndPlayTest()}},{key:"stopAudioDevicePlayTest",value:function(){c0.print("stopAudioDevicePlayTest()"),this._audioDeviceManager.stopAudioDevicePlayTest()}},{key:"setRemoteUserPriority",value:function(e,t){var r;c0.print("setRemoteUserPriority()","userId: %o, priority: %o",e,t);try{$P(e),XP(t,"priority",[K.HIGH,K.MEDIUM,K.LOW])}catch(n){return console.warn(n),!1}return this._userPriorityMap.set(e,t),null===(r=this._room)||void 0===r||r.setRemoteUserPriority(e,t),!0}},{key:"takeLocalSnapshot",value:(a=c(o().mark((function e(t){var r,n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c0.print("takeLocalSnapshot()","streamIndex: %o",t),XP(t,"streamIndex",[L.STREAM_INDEX_MAIN,L.STREAM_INDEX_SCREEN]),r=t===L.STREAM_INDEX_MAIN?this.localVideoTrack:this.localScreenVideoTrack){e.next=5;break}throw new hN(dN.INVOKED_BEFORE_CAPTURE,"capture first");case 5:return n=t===L.STREAM_INDEX_MAIN?this._videoPlayer:this._screenPlayer,e.abrupt("return",W$(r.getTrack("preprocessing"),(null==n?void 0:n.mirrorType)===B.MIRROR_TYPE_RENDER,n));case 7:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"takeRemoteSnapshot",value:(n=c(o().mark((function e(t,r){var n,i,a,s,c,u;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c0.print("takeRemoteSnapshot()","id: %o, streamIndex: %o",t,r),zP(t,"id"),XP(r,"streamIndex",[L.STREAM_INDEX_MAIN,L.STREAM_INDEX_SCREEN]),u=(null===(n=this._room)||void 0===n||null===(i=n.remoteStreams.get(t))||void 0===i||null===(a=i.find((function(e){return e.isScreen===(r===L.STREAM_INDEX_SCREEN)})))||void 0===a?void 0:a.videoTrack)||(null===(s=this._outsideRoom)||void 0===s||null===(c=s.remoteStreams.get(t))||void 0===c?void 0:c.videoTrack)){e.next=6;break}throw new hN(dN.STREAM_NOT_EXIST,"stream not exist");case 6:return e.abrupt("return",W$(u.getTrack(),!1,r===L.STREAM_INDEX_MAIN?this._remoteVideoPlayer.get(t):this._remoteScreenPlayer.get(t)));case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return n.apply(this,arguments)})},{key:"setSubscribeFallbackOption",value:function(e){c0.print("setSubscribeFallbackOption()","option: %o",e);try{XP(e,"option",[X.DISABLE,X.VIDEO_STREAM_LOW,X.AUDIO_ONLY])}catch(t){return console.warn(t),!1}return!this._room&&(this._subscribeFallbackOption=e,!0)}},{key:"getLocalStreamTrack",value:function(e,t){var r,n,i=this;if(e===L.STREAM_INDEX_MAIN?(r="video"===t?this.localVideoTrack:this.localAudioTrack,n=function(){var e;return null===(e=i._room)||void 0===e?void 0:e.localStream}):(r="video"===t?this.localScreenVideoTrack:this.localScreenAudioTrack,n=function(){var e;return null===(e=i._room)||void 0===e?void 0:e.localScreenStream}),r){var o=r instanceof Iz&&r.mixedAudioTrack?r.mixedAudioTrack:r.getTrack("preprocessing");if(o){var a=n();return n0(o,"enabled",this._reportMsTrackEvent.bind(this,"enabled",(null==a?void 0:a.streamId)||"","getLocalStreamTrack",t)),n0(o,"readyState",(function(e){"ended"===e&&(i0(o,"enabled"),i0(o,"readyState")),i._reportMsTrackEvent("readyState",(null==a?void 0:a.streamId)||"","getLocalStreamTrack",t,e)})),o.addEventListener("ended",(function(){i0(o,"enabled"),i0(o,"readyState")})),o}}}},{key:"getRemoteStreamTrack",value:function(e,t,r){var n,i,o=this,a=(null===(n=this._room)||void 0===n?void 0:n.remoteStreams.get(e))||[];if(a&&a.length){var s,c,u,d,l;if(t===L.STREAM_INDEX_MAIN)s=a.find((function(e){return!e.isScreen})),i="video"===r?null===(c=s)||void 0===c?void 0:c.videoTrack:null===(u=s)||void 0===u?void 0:u.audioTrack;else s=a.find((function(e){return e.isScreen})),i="video"===r?null===(d=s)||void 0===d?void 0:d.videoTrack:null===(l=s)||void 0===l?void 0:l.audioTrack;if(i){var h=i.getTrack();if(h&&s){var f=s.streamId;return n0(h,"enabled",this._reportMsTrackEvent.bind(this,"enabled",f,"getRemoteStreamTrack",r)),n0(h,"readyState",(function(e){"ended"===e&&(i0(h,"enabled"),i0(h,"readyState")),o._reportMsTrackEvent("readyState",f,"getRemoteStreamTrack",r,e)})),h.addEventListener("ended",(function(){i0(h,"enabled"),i0(h,"readyState")})),h}}}}},{key:"getPublicStreamTrack",value:function(e,t){var r=this;if(this._outsideRoom&&this._outsideRoom.remoteStreams){var n=this._outsideRoom.remoteStreams.get(e);if(n){var i="video"===t?n.videoTrack:n.audioTrack;if(i){var o=i.getTrack();if(o){var a=n.streamId;return n0(o,"enabled",this._reportMsTrackEvent.bind(this,"enabled",a,"getPublicStreamTrack",t)),n0(o,"readyState",(function(e){"ended"===e&&(i0(o,"enabled"),i0(o,"readyState")),r._reportMsTrackEvent("readyState",a,"getPublicStreamTrack",t,e)})),o.addEventListener("ended",(function(){i0(o,"enabled"),i0(o,"readyState")})),o}}}}}},{key:"_reportMsTrackEvent",value:function(e,t,r,n,i){var o;switch(e){case"readyState":o="live"!==i?"".concat(n," stopped"):"unknown";break;case"enabled":o="".concat(n,!0===i?" unmuted":" muted");break;default:o="unknown"}MB.rtcInvokeStatus(o,0,r,t||"",0,{direction:"getLocalStreamTrack"===r?"up":"down"})}},{key:"_updateScreenPublish",value:(r=c(o().mark((function e(){var t,r,n,a=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=a.length>0&&void 0!==a[0]?a[0]:{},c0.print("_updateScreenPublish()"),r={mediaType:void 0,pubState:zz.PUB},t=i(i({},r),t),e.next=6,this._pubLock.lock();case 6:if(n=e.sent,this._room&&this._room.connectionState===mX.CONNECTED){e.next=10;break}return n(),e.abrupt("return");case 10:return e.prev=10,e.next=13,this._room.publishScreen(this._screenStreamEncodeConfig,this._localScreenVideoTrack,this._localScreenAudioTrack,t.mediaType,t.pubState);case 13:e.next=22;break;case 15:if(e.prev=15,e.t0=e.catch(10),!(e.t0 instanceof hN)){e.next=21;break}throw e.t0;case 21:throw new hN(dN.UNEXPECTED_ERROR,"unexpected error",e.t0);case 22:return e.prev=22,n(),e.finish(22);case 25:case"end":return e.stop()}}),e,this,[[10,15,22,25]])}))),function(){return r.apply(this,arguments)})},{key:"_updateAudioPlayerState",value:function(e){c0.print("_updateAudioPlayerState()");var t,r=e.userId,n=e.isScreen,i=n?this._remoteScreenAudioPlayer:this._remoteAudioPlayer,o=i.get(r);if(e.audioTrack&&(e.attributes.audiostream&&e.subAudio||this.multiChatMode)){var a,s;if(!o)o=new jW(r,{muted:(null===(s=this._config)||void 0===s?void 0:s.autoPlayPolicy)===Q.VIDEO_ONLY,isScreen:n}),this._initPlayerEvents(o,!1,n?L.STREAM_INDEX_SCREEN:L.STREAM_INDEX_MAIN),i.set(r,o),this._audioPlaybackDeviceId&&o.setPlaybackDevice(this._audioPlaybackDeviceId);(null===(a=this._config)||void 0===a?void 0:a.autoPlayPolicy)!==Q.PLAY_MANUALLY&&o.playAudio(e.audioTrack),SP&&IP&&(t=this._remoteAudioPlayer,e0&&clearTimeout(e0),e0=setTimeout((function(){var e,r=A(t);try{for(r.s();!(e=r.n()).done;){var n=E(e.value,2),i=n[0],o=n[1];null!=i&&i.startsWith("mux")&&o.pause()}}catch(l){r.e(l)}finally{r.f()}var a,s=A(t);try{for(s.s();!(a=s.n()).done;){var c=E(a.value,2),u=c[0],d=c[1];null!=u&&u.startsWith("mux")&&d.manuallyPlay()}}catch(l){s.e(l)}finally{s.f()}}),2e3))}else{var c;null===(c=o)||void 0===c||c.stop()}}},{key:"_updateVideoPlayerState",value:function(e){var t;c0.print("_updateVideoPlayerState()");var r,n,i=e.userId;if(r=e.isScreen?this._remoteScreenPlayer.get(i):this._remoteVideoPlayer.get(i),e.videoTrack)r&&(null===(n=this._config)||void 0===n?void 0:n.autoPlayPolicy)!==Q.PLAY_MANUALLY&&r.playVideo(e.videoTrack,e);else if(null!==(t=r)&&void 0!==t&&t.played){var o;null===(o=r)||void 0===o||o.stop()}}},{key:"_onAddStream",value:function(e){var t=e.stream,r=null==t?void 0:t.attributes,n=r.localaudio,i=r.audiostream,o=r.localvideo,a=r.videostream,s=Az.NONE;if(i&&(s|=U.AUDIO),a&&(s|=U.VIDEO),s){var c;if(null!=t&&t.isScreen)this.safeEmit(oe.onUserPublishScreen,{userId:t.userId,mediaType:s});else this.safeEmit(oe.onUserPublishStream,{userId:t.userId,mediaType:s,videoStreamDescriptions:null==t||null===(c=t.attributes)||void 0===c?void 0:c.videoDescriptions}),this._handleAutoSubscribe(t,!0);this.safeEmit("onAddStream",{userId:t.userId,mediaType:s,isScreen:!(null==t||!t.isScreen)}),null!=t&&t.isScreen||(n&&this.safeEmit(oe.onUserStartAudioCapture,{userId:t.userId}),o&&this.safeEmit(oe.onUserStartVideoCapture,{userId:t.userId}))}}},{key:"_handleAutoSubscribe",value:function(e,t){var r,n,i=Az.NONE;if(null!==(r=this._roomConfig)&&void 0!==r&&r.isAutoSubscribeAudio&&(i|=U.AUDIO),null!==(n=this._roomConfig)&&void 0!==n&&n.isAutoSubscribeVideo&&(i|=U.VIDEO),i){var o,a;if(t&&UP(i))null===(o=e.observer)||void 0===o||o.setAutoSubscribeAudio(!0);if(t&&VP(i))null===(a=e.observer)||void 0===a||a.setAutoSubscribeVideo(!0);this._subscribe(!1,e.userId,i)}}},{key:"_onRemoveStream",value:function(e){var t,r=this,n=e.stream,i=null!==(t=d0[e.reason])&&void 0!==t?t:V.STREAM_REMOVE_REASON_OTHER,o=n.isScreen?oe.onUserUnpublishScreen:oe.onUserUnpublishStream,a=Az.NONE;n.attributes.audiostream&&(a|=U.AUDIO),n.attributes.videostream&&(a|=U.VIDEO),a!==Az.NONE&&(this.safeEmit(o,{userId:n.userId,mediaType:a,reason:i}),this.safeEmit("onRemoveStream",{userId:n.userId,isScreen:n.isScreen})),this._getRemotePlayer(n.userId,n.isScreen).forEach((function(e){var t=n.isScreen?"".concat(n.userId,"_screen"):n.userId;r._remoteAudioPlayer.delete(t),n.isScreen?r._remoteScreenPlayer.delete(n.userId):r._remoteVideoPlayer.delete(n.userId),null==e||e.destroy()}))}},{key:"_onUserConnection",value:function(e){this.safeEmit(oe.onUserJoined,e)}},{key:"_onUserLeave",value:function(e){this.safeEmit(oe.onUserLeave,e)}},{key:"_onRoomError",value:function(e){var t;this.safeEmit(oe.onError,e),null===(t=this._room)||void 0===t||t.destroy(),this._room=void 0}},{key:"_onNetworkQuality",value:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this.safeEmit.apply(this,[oe.onNetworkQuality].concat(t))}},{key:"_onConnectionStateChange",value:function(e){if(void 0!==this._startCloudProxyTimestamp&&this._useCloudProxy&&e.state===F.CONNECTION_STATE_CONNECTED&&this.safeEmit(oe.onCloudProxyConnected,{interval:Date.now()-this._startCloudProxyTimestamp}),this.safeEmit(oe.onConnectionStateChanged,e),e.state===F.CONNECTION_STATE_RECONNECTING){var t,r=A(this._remoteAudioPlayer);try{for(r.s();!(t=r.n()).done;){var n=E(t.value,2),i=n[0],o=n[1];null!=i&&i.startsWith("mux")&&o.stop()}}catch(a){r.e(a)}finally{r.f()}}}},{key:"_getRemotePlayer",value:function(e,t){return[(t?this._remoteScreenAudioPlayer:this._remoteAudioPlayer).get(e),(t?this._remoteScreenPlayer:this._remoteVideoPlayer).get(e)]}},{key:"_stopAudioPropertiesReport",value:function(){null!==this._audioPropertiesReportTimer&&(clearInterval(this._audioPropertiesReportTimer),this._audioPropertiesReportTimer=null)}},{key:"_onResubscribe",value:function(e){e.stream&&(this._getRemotePlayer(e.stream.userId,e.stream.isScreen).forEach((function(e){return null==e?void 0:e.stop()})),this._updateAudioPlayerState(e.stream),this._updateVideoPlayerState(e.stream))}},{key:"_onSubscribePushTrack",value:function(e){e.stream&&this._updateAudioPlayerState(e.stream)}},{key:"_onRemovePushTrack",value:function(e){e.stream&&this._updateAudioPlayerState(e.stream)}},{key:"_onVideoDeviceStateChange",value:function(e){this.safeEmit(oe.onVideoDeviceStateChanged,e)}},{key:"_onAudioDeviceStateChange",value:function(e){this.safeEmit(oe.onAudioDeviceStateChanged,e)}},{key:"_onUserPublishStateChange",value:function(e){var t,r=e.userId,n=e.isScreen,o=e.mediaType,a=e.pubState,s=e.remoteStream,c={userId:r,mediaType:o};n?a===zz.PUB?this.safeEmit(oe.onUserPublishScreen,c):this.safeEmit(oe.onUserUnpublishScreen,i(i({},c),{},{reason:V.STREAM_REMOVE_REASON_UNPUBLISH})):a===zz.PUB?(c.videoStreamDescriptions=null==s||null===(t=s.attributes)||void 0===t?void 0:t.videoDescriptions,this.safeEmit(oe.onUserPublishStream,c),this._handleAutoSubscribe(s,!0)):this.safeEmit(oe.onUserUnpublishStream,i(i({},c),{},{reason:V.STREAM_REMOVE_REASON_UNPUBLISH}))}},{key:"_onCustomMessage",value:function(e){var t=e.message;e.binary?this.safeEmit(oe.onRoomBinaryMessageReceived,{userId:e.clientId,message:t}):this.safeEmit(oe.onRoomMessageReceived,{userId:e.clientId,message:t})}},{key:"_onUserMessageReceived",value:function(e){this._messageStatisticsObserver.recvP2PMessage(e.userId),this.safeEmit(oe.onUserMessageReceived,e)}},{key:"_onUserBinaryMessageReceived",value:function(e){this._messageStatisticsObserver.recvP2PMessage(e.userId),this.safeEmit(oe.onUserBinaryMessageReceived,e)}},{key:"_onLiveTranscodingResult",value:function(e){this.safeEmit(oe.onLiveTranscodingResult,e)}},{key:"_onStreamMixingEvent",value:function(e){this.safeEmit(oe.onStreamMixingEvent,e)}},{key:"_onUserTokenWillExpire",value:function(){this.safeEmit(oe.onTokenWillExpire)}},{key:"_onPushPublicStreamResult",value:function(e){this.safeEmit(oe.onPushPublicStreamResult,e)}},{key:"_handleRTMClient",value:function(e){var t=this;e.on("onUserMessageReceivedOutsideRoom",(function(e){t._messageStatisticsObserver.recvP2POutRoomMessage(e.userId),t.safeEmit(oe.onUserMessageReceivedOutsideRoom,e)})),e.on("onUserBinaryMessageReceivedOutsideRoom",(function(e){t._messageStatisticsObserver.recvP2POutRoomMessage(e.userId),t.safeEmit(oe.onUserBinaryMessageReceivedOutsideRoom,e)})),e.on("onUserDisconnection",(function(){t.safeEmit(oe.onError,{errorCode:dN.RTM_DUPLICATE_LOGIN})})),e.on("onRTMTokenError",(function(){t.safeEmit(oe.onError,{errorCode:dN.RTM_TOKEN_ERROR})})),e.on("onServerParamsSetResult",(function(e){t.safeEmit(oe.onServerParamsSetResult,null==e?void 0:e.code)}))}},{key:"waitForNewToken",get:function(){return!!this._tempRoomInfo}},{key:"localAudioTrack",get:function(){return this._localAudioTrack}},{key:"localVideoTrack",get:function(){return this._localVideoTrack}},{key:"localScreenAudioTrack",get:function(){return this._localScreenAudioTrack}},{key:"localScreenVideoTrack",get:function(){return this._localScreenVideoTrack}},{key:"remoteStreams",get:function(){var e,t,r=[];null!==(e=this._room)&&void 0!==e&&e.remoteStreams&&(null===(t=this._room)||void 0===t||t.remoteStreams.forEach((function(e){Array.isArray(e)&&e.forEach((function(e){r.push({userId:e.userId,isScreen:e.isScreen,hasVideo:e.hasVideo,hasAudio:e.hasAudio,videoStreamDescriptions:e.attributes.videoDescriptions})}))})));return r}},{key:"iceState",get:function(){var e,t,r,n;return null===(e=this._room)||void 0===e||null===(t=e._mediaServerClient)||void 0===t||null===(r=t.handler)||void 0===r||null===(n=r._peerConnection)||void 0===n?void 0:n.iceConnectionState}},{key:"remoteUsers",get:function(){var e,t,r=[];null!==(e=this._room)&&void 0!==e&&e.remoteUsers&&(null===(t=this._room)||void 0===t||t.remoteUsers.forEach((function(e){r.push({userId:e.userId})})));return r}},{key:"multiChatMode",get:function(){var e,t;return!(null===(e=this._room)||void 0===e||null===(t=e._mediaServerClient)||void 0===t||!t.roomAttributes.multiChatMode)}},{key:"_handleAudioDeviceManager",value:function(){var e=this;this._audioDeviceManager.on("onAudioPlaybackDeviceTestVolume",(function(t){e.safeEmit(oe.onAudioPlaybackDeviceTestVolume,t)}))}},{key:"_assertNotInRoom",value:function(){if(!this._room||this._room.connectionState!==mX.CONNECTED)throw new hN(dN.NOT_CONNECTED_YET,"server not connected")}},{key:"_checkMediaType",value:function(e){XP(e,"mediaType",[U.AUDIO,U.VIDEO,U.AUDIO_AND_VIDEO])}},{key:"_getUserId",value:function(){var e,t;return(null===(e=this._room)||void 0===e||null===(t=e.roomInfo)||void 0===t?void 0:t.userInfo.userId)||"local_user"}},{key:"_switchTrack",value:(t=c(o().mark((function e(t){var r,n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._initLocalTrackEvents(t),this._localVideoTrack=t,null!==(r=this._videoPlayer)&&void 0!==r&&r.played&&(this._videoPlayer.stop(),this._videoPlayer.playVideo(t),this._videoPlayer.mirror(!!this._mirrorType)),null===(n=this._room)||void 0===n||!n.hasPublished){e.next=6;break}return e.next=6,this._updatePublish();case 6:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})}]),je}($L);s0([HB()],u0.prototype,"updateToken",1),s0([HB()],u0.prototype,"setVideoCaptureDevice",1),s0([HB()],u0.prototype,"setAudioCaptureDevice",1),s0([HB()],u0.prototype,"joinRoom",1),s0([HB()],u0.prototype,"leaveRoom",1),s0([HB()],u0.prototype,"destroy",1),s0([HB()],u0.prototype,"publishStream",1),s0([HB()],u0.prototype,"unpublishStream",1),s0([HB()],u0.prototype,"publishScreen",1),s0([HB()],u0.prototype,"unpublishScreen",1),s0([HB()],u0.prototype,"subscribeStream",1),s0([HB()],u0.prototype,"unsubscribeStream",1),s0([HB()],u0.prototype,"subscribeScreen",1),s0([HB()],u0.prototype,"unsubscribeScreen",1),s0([HB()],u0.prototype,"setRemoteVideoConfig",1),s0([HB()],u0.prototype,"startVideoCapture",1),s0([HB()],u0.prototype,"stopVideoCapture",1),s0([HB()],u0.prototype,"startAudioCapture",1),s0([HB()],u0.prototype,"stopAudioCapture",1),s0([HB()],u0.prototype,"getAudioMixingManager",1),s0([HB()],u0.prototype,"startScreenCapture",1),s0([HB()],u0.prototype,"stopScreenCapture",1),s0([HB()],u0.prototype,"setLocalVideoPlayer",1),s0([HB()],u0.prototype,"startLiveTranscoding",1),s0([HB()],u0.prototype,"updateLiveTranscoding",1),s0([HB()],u0.prototype,"stopLiveTranscoding",1),s0([HB()],u0.prototype,"setBusinessId",1),s0([HB()],u0.prototype,"setUserVisibility",1),s0([HB()],u0.prototype,"setRemoteVideoPlayer",1),s0([HB()],u0.prototype,"setLocalVideoMirrorType",1),s0([HB()],u0.prototype,"setAudioPlaybackDevice",1),s0([HB()],u0.prototype,"play",1),s0([HB()],u0.prototype,"pauseAllSubscribedStream",1),s0([HB()],u0.prototype,"resumeAllSubscribedStream",1),s0([HB()],u0.prototype,"sendUserMessage",1),s0([HB()],u0.prototype,"sendUserBinaryMessage",1),s0([HB()],u0.prototype,"sendRoomMessage",1),s0([HB()],u0.prototype,"sendRoomBinaryMessage",1),s0([HB()],u0.prototype,"setAudioCaptureConfig",1),s0([HB()],u0.prototype,"setVideoCaptureConfig",1),s0([HB()],u0.prototype,"enableSimulcastMode",1),s0([HB()],u0.prototype,"setVideoEncoderConfig",1),s0([HB()],u0.prototype,"setScreenEncoderConfig",1),s0([HB()],u0.prototype,"sendSEIMessage",1),s0([HB()],u0.prototype,"setAudioVolumeIndicationInterval",1),s0([HB()],u0.prototype,"enableAudioPropertiesReport",1),s0([HB()],u0.prototype,"setVideoSourceType",1),s0([HB()],u0.prototype,"setExternalVideoTrack",1),s0([HB()],u0.prototype,"setAudioSourceType",1),s0([HB()],u0.prototype,"setExternalAudioTrack",1),s0([HB("rtm")],u0.prototype,"login",1),s0([HB("rtm")],u0.prototype,"logout",1),s0([HB("rtm")],u0.prototype,"updateLoginToken",1),s0([HB("rtm")],u0.prototype,"getPeerOnlineStatus",1),s0([HB("rtm")],u0.prototype,"sendUserMessageOutsideRoom",1),s0([HB("rtm")],u0.prototype,"sendUserBinaryMessageOutsideRoom",1),s0([HB("rtm")],u0.prototype,"setServerParams",1),s0([HB("rtm")],u0.prototype,"sendServerMessage",1),s0([HB("rtm")],u0.prototype,"sendServerBinaryMessage",1),s0([HB()],u0.prototype,"startCloudProxy",1),s0([HB()],u0.prototype,"stopCloudProxy",1),s0([HB()],u0.prototype,"startPushPublicStream",1),s0([HB()],u0.prototype,"updatePublicStreamParam",1),s0([HB()],u0.prototype,"stopPushPublicStream",1),s0([HB("outsideRoom","streamId")],u0.prototype,"startPlayPublicStream",1),s0([HB("outsideRoom","streamId")],u0.prototype,"stopPlayPublicStream",1),s0([HB()],u0.prototype,"setAudioProfile",1),s0([HB("outsideRoom")],u0.prototype,"setPublicStreamVideoPlayer",1),s0([HB()],u0.prototype,"setDummyCaptureImagePath",1),s0([HB()],u0.prototype,"registerExtension",1),s0([HB()],u0.prototype,"startAudioPlaybackDeviceTest",1),s0([HB()],u0.prototype,"stopAudioPlaybackDeviceTest",1),s0([HB()],u0.prototype,"startAudioDeviceRecordTest",1),s0([HB()],u0.prototype,"stopAudioDeviceRecordAndPlayTest",1),s0([HB()],u0.prototype,"stopAudioDevicePlayTest",1),s0([HB()],u0.prototype,"setRemoteUserPriority",1),s0([HB()],u0.prototype,"takeLocalSnapshot",1),s0([HB()],u0.prototype,"takeRemoteSnapshot",1),s0([HB()],u0.prototype,"setSubscribeFallbackOption",1),s0([HB()],u0.prototype,"getLocalStreamTrack",1),s0([HB()],u0.prototype,"getRemoteStreamTrack",1),s0([HB()],u0.prototype,"getPublicStreamTrack",1);var d0={"client unpublished":V.STREAM_REMOVE_REASON_UNPUBLISH,"publish failed":V.STREAM_REMOVE_REASON_PUBLISH_FAILED,"stream removed":V.STREAM_REMOVE_REASON_KEEP_LIVE_FAILED,"client disconnected":V.STREAM_REMOVE_REASON_CLIENT_DISCONNECTED,"client republish":V.STREAM_REMOVE_REASON_REPUBLISH},l0=new JL("VERTC",0);KL.storeKey="".concat(Date.now(),"-").concat(ej.getDeviceId()),[VB,FB,BB].forEach((function(e){var t;return e.setStats({rtc_sdk_version:oj.VERSION,product_line:$F.RTC,report_version:eB.W_5,os:tB.WEB,device_id:ej.getDeviceId(),log_cache_key:KL.storeKey,user_agent:vP()?"":null===(t=navigator)||void 0===t?void 0:t.userAgent})})),EW.setStats({rtc_sdk_version:oj.VERSION,log_cache_key:KL.storeKey});var h0=function(e,t){return l0.print("createEngine","Invoke VERTC.createEngine"),zP(e,"appId"),[VB,FB,BB].forEach((function(r){return r.setStats({rtc_app_id:e,auto_play_policy:null==t?void 0:t.autoPlayPolicy})})),EW.setStats({rtc_app_id:e}),MB.sdkInitEngine(Date.now(),RB.BEGIN),new u0(e,t)},f0=function(e){if(l0.print("destroyEngine","Invoke VERTC.destroyEngine"),!(e instanceof u0))throw new hN(dN.INVALID_ENGINE,"Invalid engine object");e.destroy(),MB.sdkInitEngine(Date.now(),RB.END)},p0=function(){var e=c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",UH.enumerateDevices());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),v0=function(){var e=c(o().mark((function e(){var t,r,n,i,a,s,c=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=c.length>0&&void 0!==c[0]?c[0]:{video:!0,audio:!0},r=t.video,n=t.audio,i={video:!1,audio:!1},!r){e.next=13;break}return e.prev=4,e.next=7,UH.getPermissions({video:!0,force:!0});case 7:a=e.sent,i.video=a.video,e.next=13;break;case 11:e.prev=11,e.t0=e.catch(4);case 13:if(!n){e.next=23;break}return e.prev=14,e.next=17,UH.getPermissions({audio:!0,force:!0});case 17:s=e.sent,i.audio=s.audio,e.next=23;break;case 21:e.prev=21,e.t1=e.catch(14);case 23:return e.abrupt("return",i);case 24:case"end":return e.stop()}}),e,null,[[4,11],[14,21]])})));return function(){return e.apply(this,arguments)}}(),_0=function(){var e=c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",UH.enumerateAudioCaptureDevices());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),m0=function(){var e=c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",UH.enumerateVideoCaptureDevices());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),y0=function(){var e=c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",UH.enumerateAudioPlaybackDevices());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),g0=function(){return oj.VERSION},S0=function(){return MB.rtcSdkApiCall("isSupported",0,""),Kj()},b0=function(){return MB.rtcSdkApiCall("getSupportedCodecs",0,""),Wj()},E0=function(e){var t=e.logLevel,r=e.LogfileSize;t&&(KL.logLevel=t),r&&(KL.LogfileSize=r)},k0=function(e){KL.download(e)};return!vP()&&location.search.includes("_rtc_autotest_"),i(i(i(i({},new(l((function e(){u(this,e),h(this,"getSdkVersion",g0),h(this,"createEngine",h0),h(this,"destroyEngine",f0),h(this,"enumerateDevices",p0),h(this,"enableDevices",v0),h(this,"enumerateAudioCaptureDevices",_0),h(this,"enumerateVideoCaptureDevices",m0),h(this,"enumerateAudioPlaybackDevices",y0),h(this,"getParameter",sj),h(this,"setParameter",aj),h(this,"isSupported",S0),h(this,"getSupportedCodecs",b0),h(this,"events",oe),h(this,"ErrorCode",dN),h(this,"platform","".concat({}.PRODUCT_PLATFORM)),h(this,"_monitor",MB),h(this,"downloadLog",k0),h(this,"setLogConfig",E0)})))),ee),ie),{},{events:oe})}));
|
|
6
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).BytePlusRTC=t()}(this,(function(){"use strict";function e(e,t){return t.forEach((function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach((function(r){if("default"!==r&&!(r in e)){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})}}))})),Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}function t(e){var t,n,i,o=2;for("undefined"!=typeof Symbol&&(n=Symbol.asyncIterator,i=Symbol.iterator);o--;){if(n&&null!=(t=e[n]))return t.call(e);if(i&&null!=(t=e[i]))return new r(t.call(e));n="@@asyncIterator",i="@@iterator"}throw new TypeError("Object is not async iterable")}function r(e){function t(e){if(Object(e)!==e)return Promise.reject(new TypeError(e+" is not an object."));var t=e.done;return Promise.resolve(e.value).then((function(e){return{value:e,done:t}}))}return(r=function(e){this.s=e,this.n=e.next}).prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments))},return:function(e){var r=this.s.return;return void 0===r?Promise.resolve({value:e,done:!0}):t(r.apply(this.s,arguments))},throw:function(e){var r=this.s.return;return void 0===r?Promise.reject(e):t(r.apply(this.s,arguments))}},new r(e)}function n(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?n(Object(r),!0).forEach((function(t){h(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function o(){o=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=Object.defineProperty||function(e,t,r){e[t]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function u(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(C){u=function(e,t,r){return e[t]=r}}function d(e,t,r,i){var o=t&&t.prototype instanceof f?t:f,a=Object.create(o.prototype),s=new A(i||[]);return n(a,"_invoke",{value:E(e,r,s)}),a}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(C){return{type:"throw",arg:C}}}e.wrap=d;var h={};function f(){}function p(){}function v(){}var _={};u(_,a,(function(){return this}));var m=Object.getPrototypeOf,y=m&&m(m(R([])));y&&y!==t&&r.call(y,a)&&(_=y);var g=v.prototype=f.prototype=Object.create(_);function S(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function b(e,t){function i(n,o,a,s){var c=l(e[n],e,o);if("throw"!==c.type){var u=c.arg,d=u.value;return d&&"object"==typeof d&&r.call(d,"__await")?t.resolve(d.__await).then((function(e){i("next",e,a,s)}),(function(e){i("throw",e,a,s)})):t.resolve(d).then((function(e){u.value=e,a(u)}),(function(e){return i("throw",e,a,s)}))}s(c.arg)}var o;n(this,"_invoke",{value:function(e,r){function n(){return new t((function(t,n){i(e,r,t,n)}))}return o=o?o.then(n,n):n()}})}function E(e,t,r){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return{value:void 0,done:!0}}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var s=k(a,r);if(s){if(s===h)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=l(e,t,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===h)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}function k(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,k(e,t),"throw"===t.method))return h;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var n=l(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,h;var i=n.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,h):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,h)}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 I(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function A(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(T,this),this.reset(!0)}function R(e){if(e){var t=e[a];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:w}}function w(){return{value:void 0,done:!0}}return p.prototype=v,n(g,"constructor",{value:v,configurable:!0}),n(v,"constructor",{value:p,configurable:!0}),p.displayName=u(v,c,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===p||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,u(e,c,"GeneratorFunction")),e.prototype=Object.create(g),e},e.awrap=function(e){return{__await:e}},S(b.prototype),u(b.prototype,s,(function(){return this})),e.AsyncIterator=b,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var a=new b(d(t,r,n,i),o);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},S(g),u(g,c,"Generator"),u(g,a,(function(){return this})),u(g,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},e.values=R,A.prototype={constructor:A,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(I),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return a.type="throw",a.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var s=r.call(o,"catchLoc"),c=r.call(o,"finallyLoc");if(s&&c){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,h):this.complete(a)},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),h},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),I(r),h}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;I(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:R(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},e}function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function s(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(u){return void r(u)}s.done?t(c):Promise.resolve(c).then(n,i)}function c(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){s(o,n,i,a,c,"next",e)}function c(e){s(o,n,i,a,c,"throw",e)}a(void 0)}))}}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function d(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function l(e,t,r){return t&&d(e.prototype,t),r&&d(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function h(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function f(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&v(e,t)}function p(e){return(p=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function v(e,t){return(v=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function _(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function m(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function y(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return m(e)}function g(e){var t=function(){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}}();return function(){var r,n=p(e);if(t){var i=p(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return y(this,r)}}function S(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=p(e)););return e}function b(){return b="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=S(e,t);if(n){var i=Object.getOwnPropertyDescriptor(n,t);return i.get?i.get.call(arguments.length<3?e:r):i.value}},b.apply(this,arguments)}function E(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var n,i,o=[],a=!0,s=!1;try{for(r=r.call(e);!(a=(n=r.next()).done)&&(o.push(n.value),!t||o.length!==t);a=!0);}catch(c){s=!0,i=c}finally{try{a||null==r.return||r.return()}finally{if(s)throw i}}return o}(e,t)||T(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 k(e){return function(e){if(Array.isArray(e))return I(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||T(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 T(e,t){if(e){if("string"==typeof e)return I(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?I(e,t):void 0}}function I(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function A(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=T(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},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 o,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}var R=function(e){return e[e.VIDEO_SOURCE_TYPE_EXTERNAL=0]="VIDEO_SOURCE_TYPE_EXTERNAL",e[e.VIDEO_SOURCE_TYPE_INTERNAL=1]="VIDEO_SOURCE_TYPE_INTERNAL",e}(R||{}),w=function(e){return e[e.AUDIO_SOURCE_TYPE_EXTERNAL=0]="AUDIO_SOURCE_TYPE_EXTERNAL",e[e.AUDIO_SOURCE_TYPE_INTERNAL=1]="AUDIO_SOURCE_TYPE_INTERNAL",e}(w||{}),C=function(e){return e[e.QUIT=0]="QUIT",e[e.DROPPED=1]="DROPPED",e[e.SWITCH_TO_INVISIBLE=2]="SWITCH_TO_INVISIBLE",e[e.KICKED_BY_ADMIN=3]="KICKED_BY_ADMIN",e}(C||{}),O=function(e){return e[e.CHANNEL_PROFILE_COMMUNICATION=0]="CHANNEL_PROFILE_COMMUNICATION",e[e.CHANNEL_PROFILE_LIVE_BROADCASTING=1]="CHANNEL_PROFILE_LIVE_BROADCASTING",e}(O||{}),x=function(e){return e[e.AUTO_SUBSCRIBE_MODE=0]="AUTO_SUBSCRIBE_MODE",e[e.MANUAL_SUBSCRIBE_MODE=1]="MANUAL_SUBSCRIBE_MODE",e}(x||{}),D=function(e){return e[e.SUBSCRIBE_SUCC=0]="SUBSCRIBE_SUCC",e[e.SUBSCRIBE_FAIL=1]="SUBSCRIBE_FAIL",e}(D||{}),N=function(e){return e[e.PUBLISH_SUCC=0]="PUBLISH_SUCC",e[e.PUBLISH_FAIL=1]="PUBLISH_FAIL",e}(N||{}),P=function(e){return e[e.MIRROR_MODE_OFF=0]="MIRROR_MODE_OFF",e[e.MIRROR_MODE_ON=1]="MIRROR_MODE_ON",e}(P||{}),M=function(e){return e[e.RENDER_MODE_HIDDEN=0]="RENDER_MODE_HIDDEN",e[e.RENDER_MODE_FIT=1]="RENDER_MODE_FIT",e}(M||{}),L=function(e){return e[e.STREAM_INDEX_MAIN=0]="STREAM_INDEX_MAIN",e[e.STREAM_INDEX_SCREEN=1]="STREAM_INDEX_SCREEN",e}(L||{}),U=function(e){return e[e.AUDIO=1]="AUDIO",e[e.VIDEO=2]="VIDEO",e[e.AUDIO_AND_VIDEO=3]="AUDIO_AND_VIDEO",e}(U||{}),V=function(e){return e[e.STREAM_REMOVE_REASON_UNPUBLISH=0]="STREAM_REMOVE_REASON_UNPUBLISH",e[e.STREAM_REMOVE_REASON_PUBLISH_FAILED=1]="STREAM_REMOVE_REASON_PUBLISH_FAILED",e[e.STREAM_REMOVE_REASON_KEEP_LIVE_FAILED=2]="STREAM_REMOVE_REASON_KEEP_LIVE_FAILED",e[e.STREAM_REMOVE_REASON_CLIENT_DISCONNECTED=3]="STREAM_REMOVE_REASON_CLIENT_DISCONNECTED",e[e.STREAM_REMOVE_REASON_REPUBLISH=4]="STREAM_REMOVE_REASON_REPUBLISH",e[e.STREAM_REMOVE_REASON_OTHER=5]="STREAM_REMOVE_REASON_OTHER",e}(V||{}),F=function(e){return e[e.CONNECTION_START=0]="CONNECTION_START",e[e.CONNECTION_STATE_DISCONNECTED=1]="CONNECTION_STATE_DISCONNECTED",e[e.CONNECTION_STATE_CONNECTING=2]="CONNECTION_STATE_CONNECTING",e[e.CONNECTION_STATE_CONNECTED=3]="CONNECTION_STATE_CONNECTED",e[e.CONNECTION_STATE_RECONNECTING=4]="CONNECTION_STATE_RECONNECTING",e[e.CONNECTION_STATE_RECONNECTED=5]="CONNECTION_STATE_RECONNECTED",e[e.CONNECTION_STATE_LOST=6]="CONNECTION_STATE_LOST",e}(F||{}),B=function(e){return e[e.MIRROR_TYPE_NONE=0]="MIRROR_TYPE_NONE",e[e.MIRROR_TYPE_RENDER=1]="MIRROR_TYPE_RENDER",e}(B||{}),j=function(e){return e[e.domestic=0]="domestic",e[e.overseas=1]="overseas",e}(j||{}),G=function(e){return e[e.OFFLINE=0]="OFFLINE",e[e.ONLINE=1]="ONLINE",e[e.UNREACHABLE=2]="UNREACHABLE",e}(G||{}),H=function(e){return e[e.AUDIO_AND_VIDEO=0]="AUDIO_AND_VIDEO",e[e.AUDIO_ONLY=1]="AUDIO_ONLY",e[e.VIDEO_ONLY=2]="VIDEO_ONLY",e}(H||{}),z=function(e){return e[e.PREV_FRAME=0]="PREV_FRAME",e[e.OTHER_FRAME=1]="OTHER_FRAME",e}(z||{}),X=function(e){return e[e.DISABLE=0]="DISABLE",e[e.VIDEO_STREAM_LOW=1]="VIDEO_STREAM_LOW",e[e.AUDIO_ONLY=2]="AUDIO_ONLY",e}(X||{}),K=function(e){return e[e.LOW=0]="LOW",e[e.MEDIUM=100]="MEDIUM",e[e.HIGH=200]="HIGH",e}(K||{}),q=function(e){return e[e.UNKNOWN=0]="UNKNOWN",e[e.EXCELLENT=1]="EXCELLENT",e[e.GOOD=2]="GOOD",e[e.POOR=3]="POOR",e[e.BAD=4]="BAD",e[e.VBAD=5]="VBAD",e}(q||{}),W=function(e){return e[e.Unknown=-1]="Unknown",e[e.SubscribeFallbackByBandwidth=0]="SubscribeFallbackByBandwidth",e[e.SubscribeRecoverByBandwidth=2]="SubscribeRecoverByBandwidth",e}(W||{}),Y=function(e){return e[e.communication=0]="communication",e[e.chat=5]="chat",e[e.chatRoom=6]="chatRoom",e[e.coHost=9]="coHost",e[e.meeting=16]="meeting",e[e.classRoom=18]="classRoom",e}(Y||{}),J=function(e){return e[e.default=0]="default",e[e.fluent=1]="fluent",e[e.standard=2]="standard",e[e.hd=3]="hd",e[e.standardStereo=4]="standardStereo",e[e.hdMono=5]="hdMono",e}(J||{}),Q=function(e){return e[e.AUTO_PLAY=0]="AUTO_PLAY",e[e.VIDEO_ONLY=1]="VIDEO_ONLY",e[e.PLAY_MANUALLY=2]="PLAY_MANUALLY",e}(Q||{}),Z=function(e){return e.LC="LC",e.HEv1="HEv1",e.HEv2="HEv2",e}(Z||{}),$=function(e){return e.H264="H264",e.H265="H265",e}($||{}),ee=Object.freeze(Object.defineProperty({__proto__:null,VideoSourceType:R,AudioSourceType:w,UserOfflineReason:C,ChannelProfile:O,SubscribeMode:x,SubscribeState:D,PublishState:N,MirrorMode:P,VideoRenderMode:M,StreamIndex:L,MediaType:U,StreamRemoveReason:V,ConnectionState:F,MirrorType:B,LogChannel:j,USER_ONLINE_STATUS:G,PublicStreamType:H,PublicInterpolationMode:z,SubscribeFallbackOption:X,RemoteUserPriority:K,NetworkQuality:q,FallbackOrRecoverReason:W,RoomProfileType:Y,AudioProfileType:J,RTCAutoPlayPolicy:Q,AAC_PROFILE:Z,TRANSCODING_VIDEO_CODEC:$},Symbol.toStringTag,{value:"Module"})),te=function(e){return e[e.AUTO=0]="AUTO",e[e.MODE_L=1]="MODE_L",e[e.MODE_R=2]="MODE_R",e[e.MODE_MIX=3]="MODE_MIX",e}(te||{}),re=function(e){return e[e.PLAYOUT=0]="PLAYOUT",e[e.PUBLISH=1]="PUBLISH",e[e.PLAYOUT_AND_PUBLISH=2]="PLAYOUT_AND_PUBLISH",e}(re||{}),ne=function(e){return e[e.AUDIO_MIXING_STATE_PRELOADED=0]="AUDIO_MIXING_STATE_PRELOADED",e[e.AUDIO_MIXING_STATE_PLAYING=1]="AUDIO_MIXING_STATE_PLAYING",e[e.AUDIO_MIXING_STATE_PAUSED=2]="AUDIO_MIXING_STATE_PAUSED",e[e.AUDIO_MIXING_STATE_STOPPED=3]="AUDIO_MIXING_STATE_STOPPED",e[e.AUDIO_MIXING_STATE_FAILED=4]="AUDIO_MIXING_STATE_FAILED",e[e.AUDIO_MIXING_STATE_FINISHED=5]="AUDIO_MIXING_STATE_FINISHED",e[e.AUDIO_MIXING_STATE_PCM_ENABLED=6]="AUDIO_MIXING_STATE_PCM_ENABLED",e[e.AUDIO_MIXING_STATE_PCM_DISABLED=7]="AUDIO_MIXING_STATE_PCM_DISABLED",e}(ne||{}),ie=Object.freeze(Object.defineProperty({__proto__:null,AudioMixingDualMonoMode:te,AudioMixingType:re,AudioMixingState:ne},Symbol.toStringTag,{value:"Module"})),oe=function(e){return e.onTrackEnded="onTrackEnded",e.onPlayerEvent="onPlayerEvent",e.onAutoplayFailed="onAutoplayFailed",e.onUserJoined="onUserJoined",e.onUserLeave="onUserLeave",e.onConnectionStateChanged="onConnectionStateChanged",e.onUserPublishStream="onUserPublishStream",e.onUserUnpublishStream="onUserUnpublishStream",e.onUserPublishScreen="onUserPublishScreen",e.onUserUnpublishScreen="onUserUnpublishScreen",e.onRoomMessageReceived="onRoomMessageReceived",e.onRoomBinaryMessageReceived="onRoomBinaryMessageReceived",e.onUserMessageReceived="onUserMessageReceived",e.onUserBinaryMessageReceived="onUserBinaryMessageReceived",e.onVideoFirstFrameRendered="onVideoFirstFrameRendered",e.onVideoFirstFrameDecoded="onVideoFirstFrameDecoded",e.onRemoteVideoFirstFrame="onRemoteVideoFirstFrame",e.onAudioFirstFrameDecoded="onAudioFirstFrameDecoded",e.onRemoteAudioFirstFrame="onRemoteAudioFirstFrame",e.onFirstPublicStreamVideoFrameRendered="onFirstPublicStreamVideoFrameRendered",e.onFirstPublicStreamVideoFrameDecoded="onFirstPublicStreamVideoFrameDecoded",e.onFirstPublicStreamAudioFrameDecoded="onFirstPublicStreamAudioFrameDecoded",e.onVideoDeviceStateChanged="onVideoDeviceStateChanged",e.onAudioDeviceStateChanged="onAudioDeviceStateChanged",e.onRemoteStreamStats="onRemoteStreamStats",e.onPublicStreamStats="onPublicStreamStats",e.onLocalStreamStats="onLocalStreamStats",e.onAudioVolumeIndication="onAudioVolumeIndication",e.onLocalAudioPropertiesReport="onLocalAudioPropertiesReport",e.onRemoteAudioPropertiesReport="onRemoteAudioPropertiesReport",e.onActiveSpeaker="onActiveSpeaker",e.onAudioPlaybackDeviceChanged="onAudioPlaybackDeviceChanged",e.onUserStartVideoCapture="onUserStartVideoCapture",e.onUserStopVideoCapture="onUserStopVideoCapture",e.onUserStartAudioCapture="onUserStartAudioCapture",e.onUserStopAudioCapture="onUserStopAudioCapture",e.onAutoPublishResult="onAutoPublishResult",e.onAutoSubscribeResult="onAutoSubscribeResult",e.onLiveTranscodingResult="onLiveTranscodingResult",e.onStreamMixingEvent="onStreamMixingEvent",e.onAudioPlaybackDeviceTestVolume="onAudioPlaybackDeviceTestVolume",e.onSEIMessageReceived="onSEIMessageReceived",e.onError="onError",e.onAudioMixingStateChanged="onAudioMixingStateChanged",e.onUserMessageReceivedOutsideRoom="onUserMessageReceivedOutsideRoom",e.onUserBinaryMessageReceivedOutsideRoom="onUserBinaryMessageReceivedOutsideRoom",e.onTokenWillExpire="onTokenWillExpire",e.onCloudProxyConnected="onCloudProxyConnected",e.onPushPublicStreamResult="onPushPublicStreamResult",e.onPublicStreamSEIMessageReceived="onPublicStreamSEIMessageReceived",e.onNetworkQuality="onNetworkQuality",e.onSimulcastSubscribeFallback="onSimulcastSubscribeFallback",e.onRemoteVideoSizeChanged="onRemoteVideoSizeChanged",e.onVideoStreamBanned="onVideoStreamBanned",e.onAudioStreamBanned="onAudioStreamBanned",e.onLocalVideoSizeChanged="onLocalVideoSizeChanged",e.onServerParamsSetResult="onServerParamsSetResult",e}(oe||{}),ae="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},se=function(e){return e&&e.Math==Math&&e},ce=se("object"==typeof globalThis&&globalThis)||se("object"==typeof window&&window)||se("object"==typeof self&&self)||se("object"==typeof ae&&ae)||function(){return this}()||Function("return this")(),ue={},de=function(e){try{return!!e()}catch(t){return!0}},le=!de((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),he=!de((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),fe=he,pe=Function.prototype.call,ve=fe?pe.bind(pe):function(){return pe.apply(pe,arguments)},_e={},me={}.propertyIsEnumerable,ye=Object.getOwnPropertyDescriptor,ge=ye&&!me.call({1:2},1);_e.f=ge?function(e){var t=ye(this,e);return!!t&&t.enumerable}:me;var Se,be,Ee=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},ke=he,Te=Function.prototype,Ie=Te.call,Ae=ke&&Te.bind.bind(Ie,Ie),Re=ke?Ae:function(e){return function(){return Ie.apply(e,arguments)}},we=Re,Ce=we({}.toString),Oe=we("".slice),xe=function(e){return Oe(Ce(e),8,-1)},De=de,Ne=xe,Pe=Object,Me=Re("".split),Le=De((function(){return!Pe("z").propertyIsEnumerable(0)}))?function(e){return"String"==Ne(e)?Me(e,""):Pe(e)}:Pe,Ue=function(e){return null==e},Ve=Ue,Fe=TypeError,Be=function(e){if(Ve(e))throw Fe("Can't call method on "+e);return e},je=Le,Ge=Be,He=function(e){return je(Ge(e))},ze="object"==typeof document&&document.all,Xe={all:ze,IS_HTMLDDA:void 0===ze&&void 0!==ze},Ke=Xe.all,qe=Xe.IS_HTMLDDA?function(e){return"function"==typeof e||e===Ke}:function(e){return"function"==typeof e},We=qe,Ye=Xe.all,Je=Xe.IS_HTMLDDA?function(e){return"object"==typeof e?null!==e:We(e)||e===Ye}:function(e){return"object"==typeof e?null!==e:We(e)},Qe=ce,Ze=qe,$e=function(e){return Ze(e)?e:void 0},et=function(e,t){return arguments.length<2?$e(Qe[e]):Qe[e]&&Qe[e][t]},tt=Re({}.isPrototypeOf),rt=et("navigator","userAgent")||"",nt=ce,it=rt,ot=nt.process,at=nt.Deno,st=ot&&ot.versions||at&&at.version,ct=st&&st.v8;ct&&(be=(Se=ct.split("."))[0]>0&&Se[0]<4?1:+(Se[0]+Se[1])),!be&&it&&(!(Se=it.match(/Edge\/(\d+)/))||Se[1]>=74)&&(Se=it.match(/Chrome\/(\d+)/))&&(be=+Se[1]);var ut=be,dt=ut,lt=de,ht=!!Object.getOwnPropertySymbols&&!lt((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&dt&&dt<41})),ft=ht&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,pt=et,vt=qe,_t=tt,mt=Object,yt=ft?function(e){return"symbol"==typeof e}:function(e){var t=pt("Symbol");return vt(t)&&_t(t.prototype,mt(e))},gt=String,St=function(e){try{return gt(e)}catch(t){return"Object"}},bt=qe,Et=St,kt=TypeError,Tt=function(e){if(bt(e))return e;throw kt(Et(e)+" is not a function")},It=Tt,At=Ue,Rt=function(e,t){var r=e[t];return At(r)?void 0:It(r)},wt=ve,Ct=qe,Ot=Je,xt=TypeError,Dt={exports:{}},Nt=ce,Pt=Object.defineProperty,Mt=function(e,t){try{Pt(Nt,e,{value:t,configurable:!0,writable:!0})}catch(r){Nt[e]=t}return t},Lt=Mt,Ut="__core-js_shared__",Vt=ce[Ut]||Lt(Ut,{}),Ft=Vt;(Dt.exports=function(e,t){return Ft[e]||(Ft[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.26.1",mode:"global",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.26.1/LICENSE",source:"https://github.com/zloirock/core-js"});var Bt=Be,jt=Object,Gt=function(e){return jt(Bt(e))},Ht=Gt,zt=Re({}.hasOwnProperty),Xt=Object.hasOwn||function(e,t){return zt(Ht(e),t)},Kt=Re,qt=0,Wt=Math.random(),Yt=Kt(1..toString),Jt=function(e){return"Symbol("+(void 0===e?"":e)+")_"+Yt(++qt+Wt,36)},Qt=ce,Zt=Dt.exports,$t=Xt,er=Jt,tr=ht,rr=ft,nr=Zt("wks"),ir=Qt.Symbol,or=ir&&ir.for,ar=rr?ir:ir&&ir.withoutSetter||er,sr=function(e){if(!$t(nr,e)||!tr&&"string"!=typeof nr[e]){var t="Symbol."+e;tr&&$t(ir,e)?nr[e]=ir[e]:nr[e]=rr&&or?or(t):ar(t)}return nr[e]},cr=ve,ur=Je,dr=yt,lr=Rt,hr=function(e,t){var r,n;if("string"===t&&Ct(r=e.toString)&&!Ot(n=wt(r,e)))return n;if(Ct(r=e.valueOf)&&!Ot(n=wt(r,e)))return n;if("string"!==t&&Ct(r=e.toString)&&!Ot(n=wt(r,e)))return n;throw xt("Can't convert object to primitive value")},fr=TypeError,pr=sr("toPrimitive"),vr=function(e,t){if(!ur(e)||dr(e))return e;var r,n=lr(e,pr);if(n){if(void 0===t&&(t="default"),r=cr(n,e,t),!ur(r)||dr(r))return r;throw fr("Can't convert object to primitive value")}return void 0===t&&(t="number"),hr(e,t)},_r=vr,mr=yt,yr=function(e){var t=_r(e,"string");return mr(t)?t:t+""},gr=Je,Sr=ce.document,br=gr(Sr)&&gr(Sr.createElement),Er=function(e){return br?Sr.createElement(e):{}},kr=Er,Tr=!le&&!de((function(){return 7!=Object.defineProperty(kr("div"),"a",{get:function(){return 7}}).a})),Ir=le,Ar=ve,Rr=_e,wr=Ee,Cr=He,Or=yr,xr=Xt,Dr=Tr,Nr=Object.getOwnPropertyDescriptor;ue.f=Ir?Nr:function(e,t){if(e=Cr(e),t=Or(t),Dr)try{return Nr(e,t)}catch(r){}if(xr(e,t))return wr(!Ar(Rr.f,e,t),e[t])};var Pr={},Mr=le&&de((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Lr=Je,Ur=String,Vr=TypeError,Fr=function(e){if(Lr(e))return e;throw Vr(Ur(e)+" is not an object")},Br=le,jr=Tr,Gr=Mr,Hr=Fr,zr=yr,Xr=TypeError,Kr=Object.defineProperty,qr=Object.getOwnPropertyDescriptor,Wr="enumerable",Yr="configurable",Jr="writable";Pr.f=Br?Gr?function(e,t,r){if(Hr(e),t=zr(t),Hr(r),"function"==typeof e&&"prototype"===t&&"value"in r&&Jr in r&&!r.writable){var n=qr(e,t);n&&n.writable&&(e[t]=r.value,r={configurable:Yr in r?r.configurable:n.configurable,enumerable:Wr in r?r.enumerable:n.enumerable,writable:!1})}return Kr(e,t,r)}:Kr:function(e,t,r){if(Hr(e),t=zr(t),Hr(r),jr)try{return Kr(e,t,r)}catch(n){}if("get"in r||"set"in r)throw Xr("Accessors not supported");return"value"in r&&(e[t]=r.value),e};var Qr=Pr,Zr=Ee,$r=le?function(e,t,r){return Qr.f(e,t,Zr(1,r))}:function(e,t,r){return e[t]=r,e},en={exports:{}},tn=le,rn=Xt,nn=Function.prototype,on=tn&&Object.getOwnPropertyDescriptor,an=rn(nn,"name"),sn={EXISTS:an,PROPER:an&&"something"===function(){}.name,CONFIGURABLE:an&&(!tn||tn&&on(nn,"name").configurable)},cn=qe,un=Vt,dn=Re(Function.toString);cn(un.inspectSource)||(un.inspectSource=function(e){return dn(e)});var ln,hn,fn,pn=un.inspectSource,vn=qe,_n=ce.WeakMap,mn=vn(_n)&&/native code/.test(String(_n)),yn=Dt.exports,gn=Jt,Sn=yn("keys"),bn=function(e){return Sn[e]||(Sn[e]=gn(e))},En={},kn=mn,Tn=ce,In=Je,An=$r,Rn=Xt,wn=Vt,Cn=bn,On=En,xn="Object already initialized",Dn=Tn.TypeError,Nn=Tn.WeakMap;if(kn||wn.state){var Pn=wn.state||(wn.state=new Nn);Pn.get=Pn.get,Pn.has=Pn.has,Pn.set=Pn.set,ln=function(e,t){if(Pn.has(e))throw Dn(xn);return t.facade=e,Pn.set(e,t),t},hn=function(e){return Pn.get(e)||{}},fn=function(e){return Pn.has(e)}}else{var Mn=Cn("state");On[Mn]=!0,ln=function(e,t){if(Rn(e,Mn))throw Dn(xn);return t.facade=e,An(e,Mn,t),t},hn=function(e){return Rn(e,Mn)?e[Mn]:{}},fn=function(e){return Rn(e,Mn)}}var Ln={set:ln,get:hn,has:fn,enforce:function(e){return fn(e)?hn(e):ln(e,{})},getterFor:function(e){return function(t){var r;if(!In(t)||(r=hn(t)).type!==e)throw Dn("Incompatible receiver, "+e+" required");return r}}},Un=de,Vn=qe,Fn=Xt,Bn=le,jn=sn.CONFIGURABLE,Gn=pn,Hn=Ln.enforce,zn=Ln.get,Xn=Object.defineProperty,Kn=Bn&&!Un((function(){return 8!==Xn((function(){}),"length",{value:8}).length})),qn=String(String).split("String"),Wn=en.exports=function(e,t,r){"Symbol("===String(t).slice(0,7)&&(t="["+String(t).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),r&&r.getter&&(t="get "+t),r&&r.setter&&(t="set "+t),(!Fn(e,"name")||jn&&e.name!==t)&&(Bn?Xn(e,"name",{value:t,configurable:!0}):e.name=t),Kn&&r&&Fn(r,"arity")&&e.length!==r.arity&&Xn(e,"length",{value:r.arity});try{r&&Fn(r,"constructor")&&r.constructor?Bn&&Xn(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(i){}var n=Hn(e);return Fn(n,"source")||(n.source=qn.join("string"==typeof t?t:"")),e};Function.prototype.toString=Wn((function(){return Vn(this)&&zn(this).source||Gn(this)}),"toString");var Yn=qe,Jn=Pr,Qn=en.exports,Zn=Mt,$n=function(e,t,r,n){n||(n={});var i=n.enumerable,o=void 0!==n.name?n.name:t;if(Yn(r)&&Qn(r,o,n),n.global)i?e[t]=r:Zn(t,r);else{try{n.unsafe?e[t]&&(i=!0):delete e[t]}catch(a){}i?e[t]=r:Jn.f(e,t,{value:r,enumerable:!1,configurable:!n.nonConfigurable,writable:!n.nonWritable})}return e},ei={},ti=Math.ceil,ri=Math.floor,ni=Math.trunc||function(e){var t=+e;return(t>0?ri:ti)(t)},ii=function(e){var t=+e;return t!=t||0===t?0:ni(t)},oi=ii,ai=Math.max,si=Math.min,ci=function(e,t){var r=oi(e);return r<0?ai(r+t,0):si(r,t)},ui=ii,di=Math.min,li=function(e){return e>0?di(ui(e),9007199254740991):0},hi=li,fi=function(e){return hi(e.length)},pi=He,vi=ci,_i=fi,mi=function(e){return function(t,r,n){var i,o=pi(t),a=_i(o),s=vi(n,a);if(e&&r!=r){for(;a>s;)if((i=o[s++])!=i)return!0}else for(;a>s;s++)if((e||s in o)&&o[s]===r)return e||s||0;return!e&&-1}},yi={includes:mi(!0),indexOf:mi(!1)},gi=Xt,Si=He,bi=yi.indexOf,Ei=En,ki=Re([].push),Ti=function(e,t){var r,n=Si(e),i=0,o=[];for(r in n)!gi(Ei,r)&&gi(n,r)&&ki(o,r);for(;t.length>i;)gi(n,r=t[i++])&&(~bi(o,r)||ki(o,r));return o},Ii=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Ai=Ti,Ri=Ii.concat("length","prototype");ei.f=Object.getOwnPropertyNames||function(e){return Ai(e,Ri)};var wi={};wi.f=Object.getOwnPropertySymbols;var Ci=et,Oi=ei,xi=wi,Di=Fr,Ni=Re([].concat),Pi=Ci("Reflect","ownKeys")||function(e){var t=Oi.f(Di(e)),r=xi.f;return r?Ni(t,r(e)):t},Mi=Xt,Li=Pi,Ui=ue,Vi=Pr,Fi=function(e,t,r){for(var n=Li(t),i=Vi.f,o=Ui.f,a=0;a<n.length;a++){var s=n[a];Mi(e,s)||r&&Mi(r,s)||i(e,s,o(t,s))}},Bi=de,ji=qe,Gi=/#|\.prototype\./,Hi=function(e,t){var r=Xi[zi(e)];return r==qi||r!=Ki&&(ji(t)?Bi(t):!!t)},zi=Hi.normalize=function(e){return String(e).replace(Gi,".").toLowerCase()},Xi=Hi.data={},Ki=Hi.NATIVE="N",qi=Hi.POLYFILL="P",Wi=Hi,Yi=ce,Ji=ue.f,Qi=$r,Zi=$n,$i=Mt,eo=Fi,to=Wi,ro=function(e,t){var r,n,i,o,a,s=e.target,c=e.global,u=e.stat;if(r=c?Yi:u?Yi[s]||$i(s,{}):(Yi[s]||{}).prototype)for(n in t){if(o=t[n],i=e.dontCallGetSet?(a=Ji(r,n))&&a.value:r[n],!to(c?n:s+(u?".":"#")+n,e.forced)&&void 0!==i){if(typeof o==typeof i)continue;eo(o,i)}(e.sham||i&&i.sham)&&Qi(o,"sham",!0),Zi(r,n,o,e)}},no=xe,io=Array.isArray||function(e){return"Array"==no(e)},oo=TypeError,ao=function(e){if(e>9007199254740991)throw oo("Maximum allowed index exceeded");return e},so=yr,co=Pr,uo=Ee,lo=function(e,t,r){var n=so(t);n in e?co.f(e,n,uo(0,r)):e[n]=r},ho={};ho[sr("toStringTag")]="z";var fo="[object z]"===String(ho),po=fo,vo=qe,_o=xe,mo=sr("toStringTag"),yo=Object,go="Arguments"==_o(function(){return arguments}()),So=po?_o:function(e){var t,r,n;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=function(e,t){try{return e[t]}catch(r){}}(t=yo(e),mo))?r:go?_o(t):"Object"==(n=_o(t))&&vo(t.callee)?"Arguments":n},bo=Re,Eo=de,ko=qe,To=So,Io=pn,Ao=function(){},Ro=[],wo=et("Reflect","construct"),Co=/^\s*(?:class|function)\b/,Oo=bo(Co.exec),xo=!Co.exec(Ao),Do=function(e){if(!ko(e))return!1;try{return wo(Ao,Ro,e),!0}catch(t){return!1}},No=function(e){if(!ko(e))return!1;switch(To(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return xo||!!Oo(Co,Io(e))}catch(t){return!0}};No.sham=!0;var Po=!wo||Eo((function(){var e;return Do(Do.call)||!Do(Object)||!Do((function(){e=!0}))||e}))?No:Do,Mo=io,Lo=Po,Uo=Je,Vo=sr("species"),Fo=Array,Bo=function(e){var t;return Mo(e)&&(t=e.constructor,(Lo(t)&&(t===Fo||Mo(t.prototype))||Uo(t)&&null===(t=t[Vo]))&&(t=void 0)),void 0===t?Fo:t},jo=function(e,t){return new(Bo(e))(0===t?0:t)},Go=de,Ho=ut,zo=sr("species"),Xo=function(e){return Ho>=51||!Go((function(){var t=[];return(t.constructor={})[zo]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},Ko=ro,qo=de,Wo=io,Yo=Je,Jo=Gt,Qo=fi,Zo=ao,$o=lo,ea=jo,ta=Xo,ra=ut,na=sr("isConcatSpreadable"),ia=ra>=51||!qo((function(){var e=[];return e[na]=!1,e.concat()[0]!==e})),oa=ta("concat"),aa=function(e){if(!Yo(e))return!1;var t=e[na];return void 0!==t?!!t:Wo(e)};Ko({target:"Array",proto:!0,arity:1,forced:!ia||!oa},{concat:function(e){var t,r,n,i,o,a=Jo(this),s=ea(a,0),c=0;for(t=-1,n=arguments.length;t<n;t++)if(aa(o=-1===t?a:arguments[t]))for(i=Qo(o),Zo(c+i),r=0;r<i;r++,c++)r in o&&$o(s,c,o[r]);else Zo(c+1),$o(s,c++,o);return s.length=c,s}});var sa=So,ca=fo?{}.toString:function(){return"[object "+sa(this)+"]"};fo||$n(Object.prototype,"toString",ca,{unsafe:!0});var ua={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},da=Er("span").classList,la=da&&da.constructor&&da.constructor.prototype,ha=la===Object.prototype?void 0:la,fa=xe,pa=Re,va=function(e){if("Function"===fa(e))return pa(e)},_a=Tt,ma=he,ya=va(va.bind),ga=function(e,t){return _a(e),void 0===t?e:ma?ya(e,t):function(){return e.apply(t,arguments)}},Sa=ga,ba=Le,Ea=Gt,ka=fi,Ta=jo,Ia=Re([].push),Aa=function(e){var t=1==e,r=2==e,n=3==e,i=4==e,o=6==e,a=7==e,s=5==e||o;return function(c,u,d,l){for(var h,f,p=Ea(c),v=ba(p),_=Sa(u,d),m=ka(v),y=0,g=l||Ta,S=t?g(c,m):r||a?g(c,0):void 0;m>y;y++)if((s||y in v)&&(f=_(h=v[y],y,p),e))if(t)S[y]=f;else if(f)switch(e){case 3:return!0;case 5:return h;case 6:return y;case 2:Ia(S,h)}else switch(e){case 4:return!1;case 7:Ia(S,h)}return o?-1:n||i?i:S}},Ra={forEach:Aa(0),map:Aa(1),filter:Aa(2),some:Aa(3),every:Aa(4),find:Aa(5),findIndex:Aa(6),filterReject:Aa(7)},wa=de,Ca=function(e,t){var r=[][e];return!!r&&wa((function(){r.call(null,t||function(){return 1},1)}))},Oa=Ra.forEach,xa=Ca("forEach")?[].forEach:function(e){return Oa(this,e,arguments.length>1?arguments[1]:void 0)},Da=ce,Na=ua,Pa=ha,Ma=xa,La=$r,Ua=function(e){if(e&&e.forEach!==Ma)try{La(e,"forEach",Ma)}catch(t){e.forEach=Ma}};for(var Va in Na)Na[Va]&&Ua(Da[Va]&&Da[Va].prototype);Ua(Pa);var Fa={},Ba=Ti,ja=Ii,Ga=Object.keys||function(e){return Ba(e,ja)},Ha=le,za=Mr,Xa=Pr,Ka=Fr,qa=He,Wa=Ga;Fa.f=Ha&&!za?Object.defineProperties:function(e,t){Ka(e);for(var r,n=qa(t),i=Wa(t),o=i.length,a=0;o>a;)Xa.f(e,r=i[a++],n[r]);return e};var Ya,Ja=et("document","documentElement"),Qa=Fr,Za=Fa,$a=Ii,es=En,ts=Ja,rs=Er,ns=bn("IE_PROTO"),is=function(){},os=function(e){return"<script>"+e+"</"+"script>"},as=function(e){e.write(os("")),e.close();var t=e.parentWindow.Object;return e=null,t},ss=function(){try{Ya=new ActiveXObject("htmlfile")}catch(n){}var e,t;ss="undefined"!=typeof document?document.domain&&Ya?as(Ya):((t=rs("iframe")).style.display="none",ts.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(os("document.F=Object")),e.close(),e.F):as(Ya);for(var r=$a.length;r--;)delete ss.prototype[$a[r]];return ss()};es[ns]=!0;var cs=Object.create||function(e,t){var r;return null!==e?(is.prototype=Qa(e),r=new is,is.prototype=null,r[ns]=e):r=ss(),void 0===t?r:Za.f(r,t)},us=sr,ds=cs,ls=Pr.f,hs=us("unscopables"),fs=Array.prototype;null==fs[hs]&&ls(fs,hs,{configurable:!0,value:ds(null)});var ps=function(e){fs[hs][e]=!0},vs=yi.includes,_s=ps;ro({target:"Array",proto:!0,forced:de((function(){return!Array(1).includes()}))},{includes:function(e){return vs(this,e,arguments.length>1?arguments[1]:void 0)}}),_s("includes");var ms=Je,ys=xe,gs=sr("match"),Ss=function(e){var t;return ms(e)&&(void 0!==(t=e[gs])?!!t:"RegExp"==ys(e))},bs=Ss,Es=TypeError,ks=function(e){if(bs(e))throw Es("The method doesn't accept regular expressions");return e},Ts=So,Is=String,As=function(e){if("Symbol"===Ts(e))throw TypeError("Cannot convert a Symbol value to a string");return Is(e)},Rs=sr("match"),ws=function(e){var t=/./;try{"/./"[e](t)}catch(r){try{return t[Rs]=!1,"/./"[e](t)}catch(n){}}return!1},Cs=ro,Os=ks,xs=Be,Ds=As,Ns=ws,Ps=Re("".indexOf);Cs({target:"String",proto:!0,forced:!Ns("includes")},{includes:function(e){return!!~Ps(Ds(xs(this)),Ds(Os(e)),arguments.length>1?arguments[1]:void 0)}});var Ms,Ls,Us=Fr,Vs=function(){var e=Us(this),t="";return e.hasIndices&&(t+="d"),e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.unicodeSets&&(t+="v"),e.sticky&&(t+="y"),t},Fs=de,Bs=ce.RegExp,js=Fs((function(){var e=Bs("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),Gs=js||Fs((function(){return!Bs("a","y").sticky})),Hs=js||Fs((function(){var e=Bs("^r","gy");return e.lastIndex=2,null!=e.exec("str")})),zs={BROKEN_CARET:Hs,MISSED_STICKY:Gs,UNSUPPORTED_Y:js},Xs=de,Ks=ce.RegExp,qs=Xs((function(){var e=Ks(".","s");return!(e.dotAll&&e.exec("\n")&&"s"===e.flags)})),Ws=de,Ys=ce.RegExp,Js=Ws((function(){var e=Ys("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")})),Qs=ve,Zs=Re,$s=As,ec=Vs,tc=zs,rc=Dt.exports,nc=cs,ic=Ln.get,oc=qs,ac=Js,sc=rc("native-string-replace",String.prototype.replace),cc=RegExp.prototype.exec,uc=cc,dc=Zs("".charAt),lc=Zs("".indexOf),hc=Zs("".replace),fc=Zs("".slice),pc=(Ls=/b*/g,Qs(cc,Ms=/a/,"a"),Qs(cc,Ls,"a"),0!==Ms.lastIndex||0!==Ls.lastIndex),vc=tc.BROKEN_CARET,_c=void 0!==/()??/.exec("")[1];(pc||_c||vc||oc||ac)&&(uc=function(e){var t,r,n,i,o,a,s,c=this,u=ic(c),d=$s(e),l=u.raw;if(l)return l.lastIndex=c.lastIndex,t=Qs(uc,l,d),c.lastIndex=l.lastIndex,t;var h=u.groups,f=vc&&c.sticky,p=Qs(ec,c),v=c.source,_=0,m=d;if(f&&(p=hc(p,"y",""),-1===lc(p,"g")&&(p+="g"),m=fc(d,c.lastIndex),c.lastIndex>0&&(!c.multiline||c.multiline&&"\n"!==dc(d,c.lastIndex-1))&&(v="(?: "+v+")",m=" "+m,_++),r=new RegExp("^(?:"+v+")",p)),_c&&(r=new RegExp("^"+v+"$(?!\\s)",p)),pc&&(n=c.lastIndex),i=Qs(cc,f?r:c,m),f?i?(i.input=fc(i.input,_),i[0]=fc(i[0],_),i.index=c.lastIndex,c.lastIndex+=i[0].length):c.lastIndex=0:pc&&i&&(c.lastIndex=c.global?i.index+i[0].length:n),_c&&i&&i.length>1&&Qs(sc,i[0],r,(function(){for(o=1;o<arguments.length-2;o++)void 0===arguments[o]&&(i[o]=void 0)})),i&&h)for(i.groups=a=nc(null),o=0;o<h.length;o++)a[(s=h[o])[0]]=i[s[1]];return i});var mc=uc;ro({target:"RegExp",proto:!0,forced:/./.exec!==mc},{exec:mc});var yc=va,gc=$n,Sc=mc,bc=de,Ec=sr,kc=$r,Tc=Ec("species"),Ic=RegExp.prototype,Ac=function(e,t,r,n){var i=Ec(e),o=!bc((function(){var t={};return t[i]=function(){return 7},7!=""[e](t)})),a=o&&!bc((function(){var t=!1,r=/a/;return"split"===e&&((r={}).constructor={},r.constructor[Tc]=function(){return r},r.flags="",r[i]=/./[i]),r.exec=function(){return t=!0,null},r[i](""),!t}));if(!o||!a||r){var s=yc(/./[i]),c=t(i,""[e],(function(e,t,r,n,i){var a=yc(e),c=t.exec;return c===Sc||c===Ic.exec?o&&!i?{done:!0,value:s(t,r,n)}:{done:!0,value:a(r,t,n)}:{done:!1}}));gc(String.prototype,e,c[0]),gc(Ic,i,c[1])}n&&kc(Ic[i],"sham",!0)},Rc=Object.is||function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t},wc=ve,Cc=Fr,Oc=qe,xc=xe,Dc=mc,Nc=TypeError,Pc=function(e,t){var r=e.exec;if(Oc(r)){var n=wc(r,e,t);return null!==n&&Cc(n),n}if("RegExp"===xc(e))return wc(Dc,e,t);throw Nc("RegExp#exec called on incompatible receiver")},Mc=ve,Lc=Fr,Uc=Ue,Vc=Be,Fc=Rc,Bc=As,jc=Rt,Gc=Pc;Ac("search",(function(e,t,r){return[function(t){var r=Vc(this),n=Uc(t)?void 0:jc(t,e);return n?Mc(n,t,r):new RegExp(t)[e](Bc(r))},function(e){var n=Lc(this),i=Bc(e),o=r(t,n,i);if(o.done)return o.value;var a=n.lastIndex;Fc(a,0)||(n.lastIndex=0);var s=Gc(n,i);return Fc(n.lastIndex,a)||(n.lastIndex=a),null===s?-1:s.index}]}));var Hc=Re,zc=ii,Xc=As,Kc=Be,qc=Hc("".charAt),Wc=Hc("".charCodeAt),Yc=Hc("".slice),Jc=function(e){return function(t,r){var n,i,o=Xc(Kc(t)),a=zc(r),s=o.length;return a<0||a>=s?e?"":void 0:(n=Wc(o,a))<55296||n>56319||a+1===s||(i=Wc(o,a+1))<56320||i>57343?e?qc(o,a):n:e?Yc(o,a,a+2):i-56320+(n-55296<<10)+65536}},Qc={codeAt:Jc(!1),charAt:Jc(!0)},Zc=Qc.charAt,$c=function(e,t,r){return t+(r?Zc(e,t).length:1)},eu=ve,tu=Fr,ru=Ue,nu=li,iu=As,ou=Be,au=Rt,su=$c,cu=Pc;Ac("match",(function(e,t,r){return[function(t){var r=ou(this),n=ru(t)?void 0:au(t,e);return n?eu(n,t,r):new RegExp(t)[e](iu(r))},function(e){var n=tu(this),i=iu(e),o=r(t,n,i);if(o.done)return o.value;if(!n.global)return cu(n,i);var a=n.unicode;n.lastIndex=0;for(var s,c=[],u=0;null!==(s=cu(n,i));){var d=iu(s[0]);c[u]=d,""===d&&(n.lastIndex=su(i,nu(n.lastIndex),a)),u++}return 0===u?null:c}]}));var uu="\t\n\v\f\r \u2028\u2029\ufeff",du=Be,lu=As,hu=Re("".replace),fu="[\t\n\v\f\r \u2028\u2029\ufeff]",pu=RegExp("^"+fu+fu+"*"),vu=RegExp(fu+fu+"*$"),_u=function(e){return function(t){var r=lu(du(t));return 1&e&&(r=hu(r,pu,"")),2&e&&(r=hu(r,vu,"")),r}},mu={start:_u(1),end:_u(2),trim:_u(3)},yu=ce,gu=de,Su=Re,bu=As,Eu=mu.trim,ku=uu,Tu=yu.parseInt,Iu=yu.Symbol,Au=Iu&&Iu.iterator,Ru=/^[+-]?0x/i,wu=Su(Ru.exec),Cu=8!==Tu(ku+"08")||22!==Tu(ku+"0x16")||Au&&!gu((function(){Tu(Object(Au))}))?function(e,t){var r=Eu(bu(e));return Tu(r,t>>>0||(wu(Ru,r)?16:10))}:Tu;ro({global:!0,forced:parseInt!=Cu},{parseInt:Cu});var Ou,xu,Du,Nu={},Pu=!de((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),Mu=Xt,Lu=qe,Uu=Gt,Vu=Pu,Fu=bn("IE_PROTO"),Bu=Object,ju=Bu.prototype,Gu=Vu?Bu.getPrototypeOf:function(e){var t=Uu(e);if(Mu(t,Fu))return t[Fu];var r=t.constructor;return Lu(r)&&t instanceof r?r.prototype:t instanceof Bu?ju:null},Hu=de,zu=qe,Xu=Je,Ku=Gu,qu=$n,Wu=sr("iterator"),Yu=!1;[].keys&&("next"in(Du=[].keys())?(xu=Ku(Ku(Du)))!==Object.prototype&&(Ou=xu):Yu=!0),(!Xu(Ou)||Hu((function(){var e={};return Ou[Wu].call(e)!==e})))&&(Ou={}),zu(Ou[Wu])||qu(Ou,Wu,(function(){return this}));var Ju={IteratorPrototype:Ou,BUGGY_SAFARI_ITERATORS:Yu},Qu=Pr.f,Zu=Xt,$u=sr("toStringTag"),ed=function(e,t,r){e&&!r&&(e=e.prototype),e&&!Zu(e,$u)&&Qu(e,$u,{configurable:!0,value:t})},td=Ju.IteratorPrototype,rd=cs,nd=Ee,id=ed,od=Nu,ad=function(){return this},sd=function(e,t,r,n){var i=t+" Iterator";return e.prototype=rd(td,{next:nd(+!n,r)}),id(e,i,!1),od[i]=ad,e},cd=qe,ud=String,dd=TypeError,ld=Re,hd=Fr,fd=function(e){if("object"==typeof e||cd(e))return e;throw dd("Can't set "+ud(e)+" as a prototype")},pd=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=ld(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(r,[]),t=r instanceof Array}catch(n){}return function(r,n){return hd(r),fd(n),t?e(r,n):r.__proto__=n,r}}():void 0),vd=ro,_d=ve,md=qe,yd=sd,gd=Gu,Sd=pd,bd=ed,Ed=$r,kd=$n,Td=Nu,Id=sn.PROPER,Ad=sn.CONFIGURABLE,Rd=Ju.IteratorPrototype,wd=Ju.BUGGY_SAFARI_ITERATORS,Cd=sr("iterator"),Od="keys",xd="values",Dd="entries",Nd=function(){return this},Pd=function(e,t,r,n,i,o,a){yd(r,t,n);var s,c,u,d=function(e){if(e===i&&v)return v;if(!wd&&e in f)return f[e];switch(e){case Od:case xd:case Dd:return function(){return new r(this,e)}}return function(){return new r(this)}},l=t+" Iterator",h=!1,f=e.prototype,p=f[Cd]||f["@@iterator"]||i&&f[i],v=!wd&&p||d(i),_="Array"==t&&f.entries||p;if(_&&(s=gd(_.call(new e)))!==Object.prototype&&s.next&&(gd(s)!==Rd&&(Sd?Sd(s,Rd):md(s[Cd])||kd(s,Cd,Nd)),bd(s,l,!0)),Id&&i==xd&&p&&p.name!==xd&&(Ad?Ed(f,"name",xd):(h=!0,v=function(){return _d(p,this)})),i)if(c={values:d(xd),keys:o?v:d(Od),entries:d(Dd)},a)for(u in c)(wd||h||!(u in f))&&kd(f,u,c[u]);else vd({target:t,proto:!0,forced:wd||h},c);return f[Cd]!==v&&kd(f,Cd,v,{name:i}),Td[t]=v,c},Md=function(e,t){return{value:e,done:t}},Ld=He,Ud=ps,Vd=Nu,Fd=Ln,Bd=Pr.f,jd=Pd,Gd=Md,Hd=le,zd="Array Iterator",Xd=Fd.set,Kd=Fd.getterFor(zd),qd=jd(Array,"Array",(function(e,t){Xd(this,{type:zd,target:Ld(e),index:0,kind:t})}),(function(){var e=Kd(this),t=e.target,r=e.kind,n=e.index++;return!t||n>=t.length?(e.target=void 0,Gd(void 0,!0)):Gd("keys"==r?n:"values"==r?t[n]:[n,t[n]],!1)}),"values"),Wd=Vd.Arguments=Vd.Array;if(Ud("keys"),Ud("values"),Ud("entries"),Hd&&"values"!==Wd.name)try{Bd(Wd,"name",{value:"values"})}catch(T0){}var Yd={exports:{}},Jd={},Qd=ci,Zd=fi,$d=lo,el=Array,tl=Math.max,rl=function(e,t,r){for(var n=Zd(e),i=Qd(t,n),o=Qd(void 0===r?n:r,n),a=el(tl(o-i,0)),s=0;i<o;i++,s++)$d(a,s,e[i]);return a.length=s,a},nl=xe,il=He,ol=ei.f,al=rl,sl="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];Jd.f=function(e){return sl&&"Window"==nl(e)?function(e){try{return ol(e)}catch(T0){return al(sl)}}(e):ol(il(e))};var cl=de((function(){if("function"==typeof ArrayBuffer){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}})),ul=de,dl=Je,ll=xe,hl=cl,fl=Object.isExtensible,pl=ul((function(){fl(1)}))||hl?function(e){return!!dl(e)&&((!hl||"ArrayBuffer"!=ll(e))&&(!fl||fl(e)))}:fl,vl=!de((function(){return Object.isExtensible(Object.preventExtensions({}))})),_l=ro,ml=Re,yl=En,gl=Je,Sl=Xt,bl=Pr.f,El=ei,kl=Jd,Tl=pl,Il=vl,Al=!1,Rl=Jt("meta"),wl=0,Cl=function(e){bl(e,Rl,{value:{objectID:"O"+wl++,weakData:{}}})},Ol=Yd.exports={enable:function(){Ol.enable=function(){},Al=!0;var e=El.f,t=ml([].splice),r={};r[Rl]=1,e(r).length&&(El.f=function(r){for(var n=e(r),i=0,o=n.length;i<o;i++)if(n[i]===Rl){t(n,i,1);break}return n},_l({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:kl.f}))},fastKey:function(e,t){if(!gl(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!Sl(e,Rl)){if(!Tl(e))return"F";if(!t)return"E";Cl(e)}return e[Rl].objectID},getWeakData:function(e,t){if(!Sl(e,Rl)){if(!Tl(e))return!0;if(!t)return!1;Cl(e)}return e[Rl].weakData},onFreeze:function(e){return Il&&Al&&Tl(e)&&!Sl(e,Rl)&&Cl(e),e}};yl[Rl]=!0;var xl=Nu,Dl=sr("iterator"),Nl=Array.prototype,Pl=function(e){return void 0!==e&&(xl.Array===e||Nl[Dl]===e)},Ml=So,Ll=Rt,Ul=Ue,Vl=Nu,Fl=sr("iterator"),Bl=function(e){if(!Ul(e))return Ll(e,Fl)||Ll(e,"@@iterator")||Vl[Ml(e)]},jl=ve,Gl=Tt,Hl=Fr,zl=St,Xl=Bl,Kl=TypeError,ql=function(e,t){var r=arguments.length<2?Xl(e):t;if(Gl(r))return Hl(jl(r,e));throw Kl(zl(e)+" is not iterable")},Wl=ve,Yl=Fr,Jl=Rt,Ql=function(e,t,r){var n,i;Yl(e);try{if(!(n=Jl(e,"return"))){if("throw"===t)throw r;return r}n=Wl(n,e)}catch(T0){i=!0,n=T0}if("throw"===t)throw r;if(i)throw n;return Yl(n),r},Zl=ga,$l=ve,eh=Fr,th=St,rh=Pl,nh=fi,ih=tt,oh=ql,ah=Bl,sh=Ql,ch=TypeError,uh=function(e,t){this.stopped=e,this.result=t},dh=uh.prototype,lh=function(e,t,r){var n,i,o,a,s,c,u,d=r&&r.that,l=!(!r||!r.AS_ENTRIES),h=!(!r||!r.IS_RECORD),f=!(!r||!r.IS_ITERATOR),p=!(!r||!r.INTERRUPTED),v=Zl(t,d),_=function(e){return n&&sh(n,"normal",e),new uh(!0,e)},m=function(e){return l?(eh(e),p?v(e[0],e[1],_):v(e[0],e[1])):p?v(e,_):v(e)};if(h)n=e.iterator;else if(f)n=e;else{if(!(i=ah(e)))throw ch(th(e)+" is not iterable");if(rh(i)){for(o=0,a=nh(e);a>o;o++)if((s=m(e[o]))&&ih(dh,s))return s;return new uh(!1)}n=oh(e,i)}for(c=h?e.next:n.next;!(u=$l(c,n)).done;){try{s=m(u.value)}catch(T0){sh(n,"throw",T0)}if("object"==typeof s&&s&&ih(dh,s))return s}return new uh(!1)},hh=tt,fh=TypeError,ph=function(e,t){if(hh(t,e))return e;throw fh("Incorrect invocation")},vh=sr("iterator"),_h=!1;try{var mh=0,yh={next:function(){return{done:!!mh++}},return:function(){_h=!0}};yh[vh]=function(){return this},Array.from(yh,(function(){throw 2}))}catch(T0){}var gh=function(e,t){if(!t&&!_h)return!1;var r=!1;try{var n={};n[vh]=function(){return{next:function(){return{done:r=!0}}}},e(n)}catch(T0){}return r},Sh=qe,bh=Je,Eh=pd,kh=function(e,t,r){var n,i;return Eh&&Sh(n=t.constructor)&&n!==r&&bh(i=n.prototype)&&i!==r.prototype&&Eh(e,i),e},Th=ro,Ih=ce,Ah=Re,Rh=Wi,wh=$n,Ch=Yd.exports,Oh=lh,xh=ph,Dh=qe,Nh=Ue,Ph=Je,Mh=de,Lh=gh,Uh=ed,Vh=kh,Fh=function(e,t,r){var n=-1!==e.indexOf("Map"),i=-1!==e.indexOf("Weak"),o=n?"set":"add",a=Ih[e],s=a&&a.prototype,c=a,u={},d=function(e){var t=Ah(s[e]);wh(s,e,"add"==e?function(e){return t(this,0===e?0:e),this}:"delete"==e?function(e){return!(i&&!Ph(e))&&t(this,0===e?0:e)}:"get"==e?function(e){return i&&!Ph(e)?void 0:t(this,0===e?0:e)}:"has"==e?function(e){return!(i&&!Ph(e))&&t(this,0===e?0:e)}:function(e,r){return t(this,0===e?0:e,r),this})};if(Rh(e,!Dh(a)||!(i||s.forEach&&!Mh((function(){(new a).entries().next()})))))c=r.getConstructor(t,e,n,o),Ch.enable();else if(Rh(e,!0)){var l=new c,h=l[o](i?{}:-0,1)!=l,f=Mh((function(){l.has(1)})),p=Lh((function(e){new a(e)})),v=!i&&Mh((function(){for(var e=new a,t=5;t--;)e[o](t,t);return!e.has(-0)}));p||((c=t((function(e,t){xh(e,s);var r=Vh(new a,e,c);return Nh(t)||Oh(t,r[o],{that:r,AS_ENTRIES:n}),r}))).prototype=s,s.constructor=c),(f||v)&&(d("delete"),d("has"),n&&d("get")),(v||h)&&d(o),i&&s.clear&&delete s.clear}return u[e]=c,Th({global:!0,constructor:!0,forced:c!=a},u),Uh(c,e),i||r.setStrong(c,e,n),c},Bh=$n,jh=function(e,t,r){for(var n in t)Bh(e,n,t[n],r);return e},Gh=et,Hh=Pr,zh=le,Xh=sr("species"),Kh=function(e){var t=Gh(e),r=Hh.f;zh&&t&&!t[Xh]&&r(t,Xh,{configurable:!0,get:function(){return this}})},qh=Pr.f,Wh=cs,Yh=jh,Jh=ga,Qh=ph,Zh=Ue,$h=lh,ef=Pd,tf=Md,rf=Kh,nf=le,of=Yd.exports.fastKey,af=Ln.set,sf=Ln.getterFor,cf={getConstructor:function(e,t,r,n){var i=e((function(e,i){Qh(e,o),af(e,{type:t,index:Wh(null),first:void 0,last:void 0,size:0}),nf||(e.size=0),Zh(i)||$h(i,e[n],{that:e,AS_ENTRIES:r})})),o=i.prototype,a=sf(t),s=function(e,t,r){var n,i,o=a(e),s=c(e,t);return s?s.value=r:(o.last=s={index:i=of(t,!0),key:t,value:r,previous:n=o.last,next:void 0,removed:!1},o.first||(o.first=s),n&&(n.next=s),nf?o.size++:e.size++,"F"!==i&&(o.index[i]=s)),e},c=function(e,t){var r,n=a(e),i=of(t);if("F"!==i)return n.index[i];for(r=n.first;r;r=r.next)if(r.key==t)return r};return Yh(o,{clear:function(){for(var e=a(this),t=e.index,r=e.first;r;)r.removed=!0,r.previous&&(r.previous=r.previous.next=void 0),delete t[r.index],r=r.next;e.first=e.last=void 0,nf?e.size=0:this.size=0},delete:function(e){var t=this,r=a(t),n=c(t,e);if(n){var i=n.next,o=n.previous;delete r.index[n.index],n.removed=!0,o&&(o.next=i),i&&(i.previous=o),r.first==n&&(r.first=i),r.last==n&&(r.last=o),nf?r.size--:t.size--}return!!n},forEach:function(e){for(var t,r=a(this),n=Jh(e,arguments.length>1?arguments[1]:void 0);t=t?t.next:r.first;)for(n(t.value,t.key,this);t&&t.removed;)t=t.previous},has:function(e){return!!c(this,e)}}),Yh(o,r?{get:function(e){var t=c(this,e);return t&&t.value},set:function(e,t){return s(this,0===e?0:e,t)}}:{add:function(e){return s(this,e=0===e?0:e,e)}}),nf&&qh(o,"size",{get:function(){return a(this).size}}),i},setStrong:function(e,t,r){var n=t+" Iterator",i=sf(t),o=sf(n);ef(e,t,(function(e,t){af(this,{type:n,target:e,state:i(e),kind:t,last:void 0})}),(function(){for(var e=o(this),t=e.kind,r=e.last;r&&r.removed;)r=r.previous;return e.target&&(e.last=r=r?r.next:e.state.first)?tf("keys"==t?r.key:"values"==t?r.value:[r.key,r.value],!1):(e.target=void 0,tf(void 0,!0))}),r?"entries":"values",!r,!0),rf(t)}};Fh("Map",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),cf);var uf=Qc.charAt,df=As,lf=Ln,hf=Pd,ff=Md,pf="String Iterator",vf=lf.set,_f=lf.getterFor(pf);hf(String,"String",(function(e){vf(this,{type:pf,string:df(e),index:0})}),(function(){var e,t=_f(this),r=t.string,n=t.index;return n>=r.length?ff(void 0,!0):(e=uf(r,n),t.index+=e.length,ff(e,!1))}));var mf=ce,yf=ua,gf=ha,Sf=qd,bf=$r,Ef=sr,kf=Ef("iterator"),Tf=Ef("toStringTag"),If=Sf.values,Af=function(e,t){if(e){if(e[kf]!==If)try{bf(e,kf,If)}catch(T0){e[kf]=If}if(e[Tf]||bf(e,Tf,t),yf[t])for(var r in Sf)if(e[r]!==Sf[r])try{bf(e,r,Sf[r])}catch(T0){e[r]=Sf[r]}}};for(var Rf in yf)Af(mf[Rf]&&mf[Rf].prototype,Rf);Af(gf,"DOMTokenList");var wf=Gt,Cf=Ga;ro({target:"Object",stat:!0,forced:de((function(){Cf(1)}))},{keys:function(e){return Cf(wf(e))}});var Of=ro,xf=le,Df=Pr.f;Of({target:"Object",stat:!0,forced:Object.defineProperty!==Df,sham:!xf},{defineProperty:Df});var Nf=he,Pf=Function.prototype,Mf=Pf.apply,Lf=Pf.call,Uf="object"==typeof Reflect&&Reflect.apply||(Nf?Lf.bind(Mf):function(){return Lf.apply(Mf,arguments)}),Vf=Pr.f,Ff=function(e,t,r){r in e||Vf(e,r,{configurable:!0,get:function(){return t[r]},set:function(e){t[r]=e}})},Bf=As,jf=function(e,t){return void 0===e?arguments.length<2?"":t:Bf(e)},Gf=Je,Hf=$r,zf=Error,Xf=Re("".replace),Kf=String(zf("zxcasd").stack),qf=/\n\s*at [^:]*:[^\n]*/,Wf=qf.test(Kf),Yf=function(e,t){if(Wf&&"string"==typeof e&&!zf.prepareStackTrace)for(;t--;)e=Xf(e,qf,"");return e},Jf=Ee,Qf=!de((function(){var e=Error("a");return!("stack"in e)||(Object.defineProperty(e,"stack",Jf(1,7)),7!==e.stack)})),Zf=et,$f=Xt,ep=$r,tp=tt,rp=pd,np=Fi,ip=Ff,op=kh,ap=jf,sp=function(e,t){Gf(t)&&"cause"in t&&Hf(e,"cause",t.cause)},cp=Yf,up=Qf,dp=le,lp=ro,hp=Uf,fp=function(e,t,r,n){var i="stackTraceLimit",o=n?2:1,a=e.split("."),s=a[a.length-1],c=Zf.apply(null,a);if(c){var u=c.prototype;if($f(u,"cause")&&delete u.cause,!r)return c;var d=Zf("Error"),l=t((function(e,t){var r=ap(n?t:e,void 0),i=n?new c(e):new c;return void 0!==r&&ep(i,"message",r),up&&ep(i,"stack",cp(i.stack,2)),this&&tp(u,this)&&op(i,this,l),arguments.length>o&&sp(i,arguments[o]),i}));l.prototype=u,"Error"!==s?rp?rp(l,d):np(l,d,{name:!0}):dp&&i in c&&(ip(l,c,i),ip(l,c,"prepareStackTrace")),np(l,c);try{u.name!==s&&ep(u,"name",s),u.constructor=l}catch(T0){}return l}},pp="WebAssembly",vp=ce.WebAssembly,_p=7!==Error("e",{cause:7}).cause,mp=function(e,t){var r={};r[e]=fp(e,t,_p),lp({global:!0,constructor:!0,arity:1,forced:_p},r)},yp=function(e,t){if(vp&&vp[e]){var r={};r[e]=fp("WebAssembly."+e,t,_p),lp({target:pp,stat:!0,constructor:!0,arity:1,forced:_p},r)}};mp("Error",(function(e){return function(t){return hp(e,this,arguments)}})),mp("EvalError",(function(e){return function(t){return hp(e,this,arguments)}})),mp("RangeError",(function(e){return function(t){return hp(e,this,arguments)}})),mp("ReferenceError",(function(e){return function(t){return hp(e,this,arguments)}})),mp("SyntaxError",(function(e){return function(t){return hp(e,this,arguments)}})),mp("TypeError",(function(e){return function(t){return hp(e,this,arguments)}})),mp("URIError",(function(e){return function(t){return hp(e,this,arguments)}})),yp("CompileError",(function(e){return function(t){return hp(e,this,arguments)}})),yp("LinkError",(function(e){return function(t){return hp(e,this,arguments)}})),yp("RuntimeError",(function(e){return function(t){return hp(e,this,arguments)}}));var gp=Tt,Sp=Gt,bp=Le,Ep=fi,kp=TypeError,Tp=function(e){return function(t,r,n,i){gp(r);var o=Sp(t),a=bp(o),s=Ep(o),c=e?s-1:0,u=e?-1:1;if(n<2)for(;;){if(c in a){i=a[c],c+=u;break}if(c+=u,e?c<0:s<=c)throw kp("Reduce of empty array with no initial value")}for(;e?c>=0:s>c;c+=u)c in a&&(i=r(i,a[c],c,o));return i}},Ip={left:Tp(!1),right:Tp(!0)},Ap="process"==xe(ce.process),Rp=Ip.left,wp=ut,Cp=Ap;ro({target:"Array",proto:!0,forced:!Ca("reduce")||!Cp&&wp>79&&wp<83},{reduce:function(e){var t=arguments.length;return Rp(this,e,t,t>1?arguments[1]:void 0)}});var Op=le,xp=Re,Dp=ve,Np=de,Pp=Ga,Mp=wi,Lp=_e,Up=Gt,Vp=Le,Fp=Object.assign,Bp=Object.defineProperty,jp=xp([].concat),Gp=!Fp||Np((function(){if(Op&&1!==Fp({b:1},Fp(Bp({},"a",{enumerable:!0,get:function(){Bp(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},r=Symbol(),n="abcdefghijklmnopqrst";return e[r]=7,n.split("").forEach((function(e){t[e]=e})),7!=Fp({},e)[r]||Pp(Fp({},t)).join("")!=n}))?function(e,t){for(var r=Up(e),n=arguments.length,i=1,o=Mp.f,a=Lp.f;n>i;)for(var s,c=Vp(arguments[i++]),u=o?jp(Pp(c),o(c)):Pp(c),d=u.length,l=0;d>l;)s=u[l++],Op&&!Dp(a,c,s)||(r[s]=c[s]);return r}:Fp,Hp=Gp;ro({target:"Object",stat:!0,arity:2,forced:Object.assign!==Hp},{assign:Hp});var zp,Xp=ro,Kp=va,qp=ue.f,Wp=li,Yp=As,Jp=ks,Qp=Be,Zp=ws,$p=Kp("".endsWith),ev=Kp("".slice),tv=Math.min,rv=Zp("endsWith");Xp({target:"String",proto:!0,forced:!!(rv||(zp=qp(String.prototype,"endsWith"),!zp||zp.writable))&&!rv},{endsWith:function(e){var t=Yp(Qp(this));Jp(e);var r=arguments.length>1?arguments[1]:void 0,n=t.length,i=void 0===r?n:tv(Wp(r),n),o=Yp(e);return $p?$p(t,o,i):ev(t,i-o.length,i)===o}});var nv=le,iv=io,ov=TypeError,av=Object.getOwnPropertyDescriptor,sv=nv&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(T0){return T0 instanceof TypeError}}()?function(e,t){if(iv(e)&&!av(e,"length").writable)throw ov("Cannot set read only .length");return e.length=t}:function(e,t){return e.length=t},cv=ro,uv=Gt,dv=fi,lv=sv,hv=ao,fv=de((function(){return 4294967297!==[].push.call({length:4294967296},1)})),pv=!function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(T0){return T0 instanceof TypeError}}();cv({target:"Array",proto:!0,arity:1,forced:fv||pv},{push:function(e){var t=uv(this),r=dv(t),n=arguments.length;hv(r+n);for(var i=0;i<n;i++)t[r]=arguments[i],r++;return lv(t,r),r}});var vv=!0,_v=!0;function mv(e,t,r){var n=e.match(t);return n&&n.length>=r&&parseInt(n[r],10)}function yv(e,t,r){if(e.RTCPeerConnection){var n=e.RTCPeerConnection.prototype,i=n.addEventListener;n.addEventListener=function(e,n){if(e!==t)return i.apply(this,arguments);var o=function(e){var t=r(e);t&&(n.handleEvent?n.handleEvent(t):n(t))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(n,o),i.apply(this,[e,o])};var o=n.removeEventListener;n.removeEventListener=function(e,r){if(e!==t||!this._eventMap||!this._eventMap[t])return o.apply(this,arguments);if(!this._eventMap[t].has(r))return o.apply(this,arguments);var n=this._eventMap[t].get(r);return this._eventMap[t].delete(r),0===this._eventMap[t].size&&delete this._eventMap[t],0===Object.keys(this._eventMap).length&&delete this._eventMap,o.apply(this,[e,n])},Object.defineProperty(n,"on"+t,{get:function(){return this["_on"+t]},set:function(e){this["_on"+t]&&(this.removeEventListener(t,this["_on"+t]),delete this["_on"+t]),e&&this.addEventListener(t,this["_on"+t]=e)},enumerable:!0,configurable:!0})}}function gv(e){return"boolean"!=typeof e?new Error("Argument type: "+a(e)+". Please use a boolean."):(vv=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function Sv(e){return"boolean"!=typeof e?new Error("Argument type: "+a(e)+". Please use a boolean."):(_v=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function bv(){if("object"===("undefined"==typeof window?"undefined":a(window))){if(vv)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function Ev(e,t){_v&&console.warn(e+" is deprecated, please use "+t+" instead.")}function kv(e){var t={browser:null,version:null};if(void 0===e||!e.navigator)return t.browser="Not a browser.",t;var r=e.navigator;if(r.mozGetUserMedia)t.browser="firefox",t.version=mv(r.userAgent,/Firefox\/(\d+)\./,1);else if(r.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection)t.browser="chrome",t.version=mv(r.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else{if(!e.RTCPeerConnection||!r.userAgent.match(/AppleWebKit\/(\d+)\./))return t.browser="Not a supported browser.",t;t.browser="safari",t.version=mv(r.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return t}function Tv(e){return"[object Object]"===Object.prototype.toString.call(e)}function Iv(e){return Tv(e)?Object.keys(e).reduce((function(t,r){var n=Tv(e[r]),i=n?Iv(e[r]):e[r],o=n&&!Object.keys(i).length;return void 0===i||o?t:Object.assign(t,h({},r,i))}),{}):e}function Av(e,t,r){t&&!r.has(t.id)&&(r.set(t.id,t),Object.keys(t).forEach((function(n){n.endsWith("Id")?Av(e,e.get(t[n]),r):n.endsWith("Ids")&&t[n].forEach((function(t){Av(e,e.get(t),r)}))})))}function Rv(e,t,r){var n=r?"outbound-rtp":"inbound-rtp",i=new Map;if(null===t)return i;var o=[];return e.forEach((function(e){"track"===e.type&&e.trackIdentifier===t.id&&o.push(e)})),o.forEach((function(t){e.forEach((function(r){r.type===n&&r.trackId===t.id&&Av(e,r,i)}))})),i}var wv=ro,Cv=Ra.find,Ov=ps,xv="find",Dv=!0;xv in[]&&Array(1).find((function(){Dv=!1})),wv({target:"Array",proto:!0,forced:Dv},{find:function(e){return Cv(this,e,arguments.length>1?arguments[1]:void 0)}}),Ov(xv);var Nv=Re([].slice),Pv=ro,Mv=io,Lv=Po,Uv=Je,Vv=ci,Fv=fi,Bv=He,jv=lo,Gv=sr,Hv=Nv,zv=Xo("slice"),Xv=Gv("species"),Kv=Array,qv=Math.max;Pv({target:"Array",proto:!0,forced:!zv},{slice:function(e,t){var r,n,i,o=Bv(this),a=Fv(o),s=Vv(e,a),c=Vv(void 0===t?a:t,a);if(Mv(o)&&(r=o.constructor,(Lv(r)&&(r===Kv||Mv(r.prototype))||Uv(r)&&null===(r=r[Xv]))&&(r=void 0),r===Kv||void 0===r))return Hv(o,s,c);for(n=new(void 0===r?Kv:r)(qv(c-s,0)),i=0;s<c;s++,i++)s in o&&jv(n,i,o[s]);return n.length=i,n}});var Wv=ro,Yv=yi.indexOf,Jv=Ca,Qv=va([].indexOf),Zv=!!Qv&&1/Qv([1],1,-0)<0,$v=Jv("indexOf");Wv({target:"Array",proto:!0,forced:Zv||!$v},{indexOf:function(e){var t=arguments.length>1?arguments[1]:void 0;return Zv?Qv(this,e,t)||0:Yv(this,e,t)}});var e_=St,t_=TypeError,r_=function(e,t){if(!delete e[t])throw t_("Cannot delete property "+e_(t)+" of "+e_(e))},n_=ro,i_=Gt,o_=ci,a_=ii,s_=fi,c_=sv,u_=ao,d_=jo,l_=lo,h_=r_,f_=Xo("splice"),p_=Math.max,v_=Math.min;n_({target:"Array",proto:!0,forced:!f_},{splice:function(e,t){var r,n,i,o,a,s,c=i_(this),u=s_(c),d=o_(e,u),l=arguments.length;for(0===l?r=n=0:1===l?(r=0,n=u-d):(r=l-2,n=v_(p_(a_(t),0),u-d)),u_(u+r-n),i=d_(c,n),o=0;o<n;o++)(a=d+o)in c&&l_(i,o,c[a]);if(i.length=n,r<n){for(o=d;o<u-n;o++)s=o+r,(a=o+n)in c?c[s]=c[a]:h_(c,s);for(o=u;o>u-n+r;o--)h_(c,o-1)}else if(r>n)for(o=u-n;o>d;o--)s=o+r-1,(a=o+n-1)in c?c[s]=c[a]:h_(c,s);for(o=0;o<r;o++)c[o+d]=arguments[o+2];return c_(c,u-n+r),i}});var __=Ra.map;ro({target:"Array",proto:!0,forced:!Xo("map")},{map:function(e){return __(this,e,arguments.length>1?arguments[1]:void 0)}});var m_,y_,g_,S_,b_=Po,E_=St,k_=TypeError,T_=function(e){if(b_(e))return e;throw k_(E_(e)+" is not a constructor")},I_=Fr,A_=T_,R_=Ue,w_=sr("species"),C_=function(e,t){var r,n=I_(e).constructor;return void 0===n||R_(r=I_(n)[w_])?t:A_(r)},O_=TypeError,x_=function(e,t){if(e<t)throw O_("Not enough arguments");return e},D_=/(?:ipad|iphone|ipod).*applewebkit/i.test(rt),N_=ce,P_=Uf,M_=ga,L_=qe,U_=Xt,V_=de,F_=Ja,B_=Nv,j_=Er,G_=x_,H_=D_,z_=Ap,X_=N_.setImmediate,K_=N_.clearImmediate,q_=N_.process,W_=N_.Dispatch,Y_=N_.Function,J_=N_.MessageChannel,Q_=N_.String,Z_=0,$_={},em="onreadystatechange";try{m_=N_.location}catch(T0){}var tm=function(e){if(U_($_,e)){var t=$_[e];delete $_[e],t()}},rm=function(e){return function(){tm(e)}},nm=function(e){tm(e.data)},im=function(e){N_.postMessage(Q_(e),m_.protocol+"//"+m_.host)};X_&&K_||(X_=function(e){G_(arguments.length,1);var t=L_(e)?e:Y_(e),r=B_(arguments,1);return $_[++Z_]=function(){P_(t,void 0,r)},y_(Z_),Z_},K_=function(e){delete $_[e]},z_?y_=function(e){q_.nextTick(rm(e))}:W_&&W_.now?y_=function(e){W_.now(rm(e))}:J_&&!H_?(S_=(g_=new J_).port2,g_.port1.onmessage=nm,y_=M_(S_.postMessage,S_)):N_.addEventListener&&L_(N_.postMessage)&&!N_.importScripts&&m_&&"file:"!==m_.protocol&&!V_(im)?(y_=im,N_.addEventListener("message",nm,!1)):y_=em in j_("script")?function(e){F_.appendChild(j_("script")).onreadystatechange=function(){F_.removeChild(this),tm(e)}}:function(e){setTimeout(rm(e),0)});var om,am,sm,cm,um,dm,lm,hm,fm={set:X_,clear:K_},pm=ce,vm=/ipad|iphone|ipod/i.test(rt)&&void 0!==pm.Pebble,_m=/web0s(?!.*chrome)/i.test(rt),mm=ce,ym=ga,gm=ue.f,Sm=fm.set,bm=D_,Em=vm,km=_m,Tm=Ap,Im=mm.MutationObserver||mm.WebKitMutationObserver,Am=mm.document,Rm=mm.process,wm=mm.Promise,Cm=gm(mm,"queueMicrotask"),Om=Cm&&Cm.value;Om||(om=function(){var e,t;for(Tm&&(e=Rm.domain)&&e.exit();am;){t=am.fn,am=am.next;try{t()}catch(T0){throw am?cm():sm=void 0,T0}}sm=void 0,e&&e.enter()},bm||Tm||km||!Im||!Am?!Em&&wm&&wm.resolve?((lm=wm.resolve(void 0)).constructor=wm,hm=ym(lm.then,lm),cm=function(){hm(om)}):Tm?cm=function(){Rm.nextTick(om)}:(Sm=ym(Sm,mm),cm=function(){Sm(om)}):(um=!0,dm=Am.createTextNode(""),new Im(om).observe(dm,{characterData:!0}),cm=function(){dm.data=um=!um}));var xm=Om||function(e){var t={fn:e,next:void 0};sm&&(sm.next=t),am||(am=t,cm()),sm=t},Dm=ce,Nm=function(e){try{return{error:!1,value:e()}}catch(T0){return{error:!0,value:T0}}},Pm=function(){this.head=null,this.tail=null};Pm.prototype={add:function(e){var t={item:e,next:null};this.head?this.tail.next=t:this.head=t,this.tail=t},get:function(){var e=this.head;if(e)return this.head=e.next,this.tail===e&&(this.tail=null),e.item}};var Mm=Pm,Lm=ce.Promise,Um="object"==typeof Deno&&Deno&&"object"==typeof Deno.version,Vm=!Um&&!Ap&&"object"==typeof window&&"object"==typeof document,Fm=ce,Bm=Lm,jm=qe,Gm=Wi,Hm=pn,zm=sr,Xm=Vm,Km=Um,qm=ut;Bm&&Bm.prototype;var Wm=zm("species"),Ym=!1,Jm=jm(Fm.PromiseRejectionEvent),Qm={CONSTRUCTOR:Gm("Promise",(function(){var e=Hm(Bm),t=e!==String(Bm);if(!t&&66===qm)return!0;if(!qm||qm<51||!/native code/.test(e)){var r=new Bm((function(e){e(1)})),n=function(e){e((function(){}),(function(){}))};if((r.constructor={})[Wm]=n,!(Ym=r.then((function(){}))instanceof n))return!0}return!t&&(Xm||Km)&&!Jm})),REJECTION_EVENT:Jm,SUBCLASSING:Ym},Zm={},$m=Tt,ey=TypeError,ty=function(e){var t,r;this.promise=new e((function(e,n){if(void 0!==t||void 0!==r)throw ey("Bad Promise constructor");t=e,r=n})),this.resolve=$m(t),this.reject=$m(r)};Zm.f=function(e){return new ty(e)};var ry,ny,iy,oy=ro,ay=Ap,sy=ce,cy=ve,uy=$n,dy=pd,ly=ed,hy=Kh,fy=Tt,py=qe,vy=Je,_y=ph,my=C_,yy=fm.set,gy=xm,Sy=function(e,t){var r=Dm.console;r&&r.error&&(1==arguments.length?r.error(e):r.error(e,t))},by=Nm,Ey=Mm,ky=Ln,Ty=Lm,Iy=Zm,Ay="Promise",Ry=Qm.CONSTRUCTOR,wy=Qm.REJECTION_EVENT,Cy=Qm.SUBCLASSING,Oy=ky.getterFor(Ay),xy=ky.set,Dy=Ty&&Ty.prototype,Ny=Ty,Py=Dy,My=sy.TypeError,Ly=sy.document,Uy=sy.process,Vy=Iy.f,Fy=Vy,By=!!(Ly&&Ly.createEvent&&sy.dispatchEvent),jy="unhandledrejection",Gy=function(e){var t;return!(!vy(e)||!py(t=e.then))&&t},Hy=function(e,t){var r,n,i,o=t.value,a=1==t.state,s=a?e.ok:e.fail,c=e.resolve,u=e.reject,d=e.domain;try{s?(a||(2===t.rejection&&Wy(t),t.rejection=1),!0===s?r=o:(d&&d.enter(),r=s(o),d&&(d.exit(),i=!0)),r===e.promise?u(My("Promise-chain cycle")):(n=Gy(r))?cy(n,r,c,u):c(r)):u(o)}catch(T0){d&&!i&&d.exit(),u(T0)}},zy=function(e,t){e.notified||(e.notified=!0,gy((function(){for(var r,n=e.reactions;r=n.get();)Hy(r,e);e.notified=!1,t&&!e.rejection&&Ky(e)})))},Xy=function(e,t,r){var n,i;By?((n=Ly.createEvent("Event")).promise=t,n.reason=r,n.initEvent(e,!1,!0),sy.dispatchEvent(n)):n={promise:t,reason:r},!wy&&(i=sy["on"+e])?i(n):e===jy&&Sy("Unhandled promise rejection",r)},Ky=function(e){cy(yy,sy,(function(){var t,r=e.facade,n=e.value;if(qy(e)&&(t=by((function(){ay?Uy.emit("unhandledRejection",n,r):Xy(jy,r,n)})),e.rejection=ay||qy(e)?2:1,t.error))throw t.value}))},qy=function(e){return 1!==e.rejection&&!e.parent},Wy=function(e){cy(yy,sy,(function(){var t=e.facade;ay?Uy.emit("rejectionHandled",t):Xy("rejectionhandled",t,e.value)}))},Yy=function(e,t,r){return function(n){e(t,n,r)}},Jy=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=2,zy(e,!0))},Qy=function(e,t,r){if(!e.done){e.done=!0,r&&(e=r);try{if(e.facade===t)throw My("Promise can't be resolved itself");var n=Gy(t);n?gy((function(){var r={done:!1};try{cy(n,t,Yy(Qy,r,e),Yy(Jy,r,e))}catch(T0){Jy(r,T0,e)}})):(e.value=t,e.state=1,zy(e,!1))}catch(T0){Jy({done:!1},T0,e)}}};if(Ry&&(Py=(Ny=function(e){_y(this,Py),fy(e),cy(ry,this);var t=Oy(this);try{e(Yy(Qy,t),Yy(Jy,t))}catch(T0){Jy(t,T0)}}).prototype,(ry=function(e){xy(this,{type:Ay,done:!1,notified:!1,parent:!1,reactions:new Ey,rejection:!1,state:0,value:void 0})}).prototype=uy(Py,"then",(function(e,t){var r=Oy(this),n=Vy(my(this,Ny));return r.parent=!0,n.ok=!py(e)||e,n.fail=py(t)&&t,n.domain=ay?Uy.domain:void 0,0==r.state?r.reactions.add(n):gy((function(){Hy(n,r)})),n.promise})),ny=function(){var e=new ry,t=Oy(e);this.promise=e,this.resolve=Yy(Qy,t),this.reject=Yy(Jy,t)},Iy.f=Vy=function(e){return e===Ny||undefined===e?new ny(e):Fy(e)},py(Ty)&&Dy!==Object.prototype)){iy=Dy.then,Cy||uy(Dy,"then",(function(e,t){var r=this;return new Ny((function(e,t){cy(iy,r,e,t)})).then(e,t)}),{unsafe:!0});try{delete Dy.constructor}catch(T0){}dy&&dy(Dy,Py)}oy({global:!0,constructor:!0,wrap:!0,forced:Ry},{Promise:Ny}),ly(Ny,Ay,!1),hy(Ay);var Zy=Lm,$y=Qm.CONSTRUCTOR||!gh((function(e){Zy.all(e).then(void 0,(function(){}))})),eg=ve,tg=Tt,rg=Zm,ng=Nm,ig=lh;ro({target:"Promise",stat:!0,forced:$y},{all:function(e){var t=this,r=rg.f(t),n=r.resolve,i=r.reject,o=ng((function(){var r=tg(t.resolve),o=[],a=0,s=1;ig(e,(function(e){var c=a++,u=!1;s++,eg(r,t,e).then((function(e){u||(u=!0,o[c]=e,--s||n(o))}),i)})),--s||n(o)}));return o.error&&i(o.value),r.promise}});var og=ro,ag=Qm.CONSTRUCTOR,sg=Lm,cg=et,ug=qe,dg=$n,lg=sg&&sg.prototype;if(og({target:"Promise",proto:!0,forced:ag,real:!0},{catch:function(e){return this.then(void 0,e)}}),ug(sg)){var hg=cg("Promise").prototype.catch;lg.catch!==hg&&dg(lg,"catch",hg,{unsafe:!0})}var fg=ve,pg=Tt,vg=Zm,_g=Nm,mg=lh;ro({target:"Promise",stat:!0,forced:$y},{race:function(e){var t=this,r=vg.f(t),n=r.reject,i=_g((function(){var i=pg(t.resolve);mg(e,(function(e){fg(i,t,e).then(r.resolve,n)}))}));return i.error&&n(i.value),r.promise}});var yg=ve,gg=Zm;ro({target:"Promise",stat:!0,forced:Qm.CONSTRUCTOR},{reject:function(e){var t=gg.f(this);return yg(t.reject,void 0,e),t.promise}});var Sg=Fr,bg=Je,Eg=Zm,kg=function(e,t){if(Sg(e),bg(t)&&t.constructor===e)return t;var r=Eg.f(e);return(0,r.resolve)(t),r.promise},Tg=ro,Ig=Qm.CONSTRUCTOR,Ag=kg;et("Promise"),Tg({target:"Promise",stat:!0,forced:Ig},{resolve:function(e){return Ag(this,e)}});var Rg=Ap,wg=en.exports,Cg=Pr,Og=function(e,t,r){return r.get&&wg(r.get,t,{getter:!0}),r.set&&wg(r.set,t,{setter:!0}),Cg.f(e,t,r)},xg=le,Dg=de,Ng=Fr,Pg=cs,Mg=jf,Lg=Error.prototype.toString,Ug=Dg((function(){if(xg){var e=Pg(Object.defineProperty({},"name",{get:function(){return this===e}}));if("true"!==Lg.call(e))return!0}return"2: 1"!==Lg.call({message:1,name:2})||"Error"!==Lg.call({})}))?function(){var e=Ng(this),t=Mg(e.name,"Error"),r=Mg(e.message);return t?r?t+": "+r:t:r}:Lg,Vg={IndexSizeError:{s:"INDEX_SIZE_ERR",c:1,m:1},DOMStringSizeError:{s:"DOMSTRING_SIZE_ERR",c:2,m:0},HierarchyRequestError:{s:"HIERARCHY_REQUEST_ERR",c:3,m:1},WrongDocumentError:{s:"WRONG_DOCUMENT_ERR",c:4,m:1},InvalidCharacterError:{s:"INVALID_CHARACTER_ERR",c:5,m:1},NoDataAllowedError:{s:"NO_DATA_ALLOWED_ERR",c:6,m:0},NoModificationAllowedError:{s:"NO_MODIFICATION_ALLOWED_ERR",c:7,m:1},NotFoundError:{s:"NOT_FOUND_ERR",c:8,m:1},NotSupportedError:{s:"NOT_SUPPORTED_ERR",c:9,m:1},InUseAttributeError:{s:"INUSE_ATTRIBUTE_ERR",c:10,m:1},InvalidStateError:{s:"INVALID_STATE_ERR",c:11,m:1},SyntaxError:{s:"SYNTAX_ERR",c:12,m:1},InvalidModificationError:{s:"INVALID_MODIFICATION_ERR",c:13,m:1},NamespaceError:{s:"NAMESPACE_ERR",c:14,m:1},InvalidAccessError:{s:"INVALID_ACCESS_ERR",c:15,m:1},ValidationError:{s:"VALIDATION_ERR",c:16,m:0},TypeMismatchError:{s:"TYPE_MISMATCH_ERR",c:17,m:1},SecurityError:{s:"SECURITY_ERR",c:18,m:1},NetworkError:{s:"NETWORK_ERR",c:19,m:1},AbortError:{s:"ABORT_ERR",c:20,m:1},URLMismatchError:{s:"URL_MISMATCH_ERR",c:21,m:1},QuotaExceededError:{s:"QUOTA_EXCEEDED_ERR",c:22,m:1},TimeoutError:{s:"TIMEOUT_ERR",c:23,m:1},InvalidNodeTypeError:{s:"INVALID_NODE_TYPE_ERR",c:24,m:1},DataCloneError:{s:"DATA_CLONE_ERR",c:25,m:1}},Fg=ro,Bg=function(e){try{if(Rg)return Function('return require("'+e+'")')()}catch(T0){}},jg=et,Gg=de,Hg=cs,zg=Ee,Xg=Pr.f,Kg=$n,qg=Og,Wg=Xt,Yg=ph,Jg=Fr,Qg=Ug,Zg=jf,$g=Vg,eS=Yf,tS=Ln,rS=le,nS="DOMException",iS="DATA_CLONE_ERR",oS=jg("Error"),aS=jg(nS)||function(){try{(new(jg("MessageChannel")||Bg("worker_threads").MessageChannel)).port1.postMessage(new WeakMap)}catch(T0){if(T0.name==iS&&25==T0.code)return T0.constructor}}(),sS=aS&&aS.prototype,cS=oS.prototype,uS=tS.set,dS=tS.getterFor(nS),lS="stack"in oS(nS),hS=function(e){return Wg($g,e)&&$g[e].m?$g[e].c:0},fS=function(){Yg(this,pS);var e=arguments.length,t=Zg(e<1?void 0:arguments[0]),r=Zg(e<2?void 0:arguments[1],"Error"),n=hS(r);if(uS(this,{type:nS,name:r,message:t,code:n}),rS||(this.name=r,this.message=t,this.code=n),lS){var i=oS(t);i.name=nS,Xg(this,"stack",zg(1,eS(i.stack,1)))}},pS=fS.prototype=Hg(cS),vS=function(e){return{enumerable:!0,configurable:!0,get:e}},_S=function(e){return vS((function(){return dS(this)[e]}))};rS&&(qg(pS,"code",_S("code")),qg(pS,"message",_S("message")),qg(pS,"name",_S("name"))),Xg(pS,"constructor",zg(1,fS));var mS=Gg((function(){return!(new aS instanceof oS)})),yS=mS||Gg((function(){return cS.toString!==Qg||"2: 1"!==String(new aS(1,2))})),gS=mS||Gg((function(){return 25!==new aS(1,"DataCloneError").code}));mS||25!==aS.DATA_CLONE_ERR||sS.DATA_CLONE_ERR;Fg({global:!0,constructor:!0,forced:mS},{DOMException:mS?fS:aS});var SS=jg(nS),bS=SS.prototype;for(var ES in yS&&aS===SS&&Kg(bS,"toString",Qg),gS&&rS&&aS===SS&&qg(bS,"code",vS((function(){return hS(Jg(this).name)}))),$g)if(Wg($g,ES)){var kS=$g[ES],TS=kS.s,IS=zg(6,kS.c);Wg(SS,TS)||Xg(SS,TS,IS),Wg(bS,TS)||Xg(bS,TS,IS)}var AS=ro,RS=ce,wS=et,CS=Ee,OS=Pr.f,xS=Xt,DS=ph,NS=kh,PS=jf,MS=Vg,LS=Yf,US=le,VS="DOMException",FS=wS("Error"),BS=wS(VS),jS=function(){DS(this,GS);var e=arguments.length,t=PS(e<1?void 0:arguments[0]),r=PS(e<2?void 0:arguments[1],"Error"),n=new BS(t,r),i=FS(t);return i.name=VS,OS(n,"stack",CS(1,LS(i.stack,1))),NS(n,this,jS),n},GS=jS.prototype=BS.prototype,HS="stack"in FS(VS),zS="stack"in new BS(1,2),XS=BS&&US&&Object.getOwnPropertyDescriptor(RS,VS),KS=!(!XS||XS.writable&&XS.configurable),qS=HS&&!KS&&!zS;AS({global:!0,constructor:!0,forced:qS},{DOMException:qS?jS:BS});var WS=wS(VS),YS=WS.prototype;if(YS.constructor!==WS)for(var JS in OS(YS,"constructor",CS(1,WS)),MS)if(xS(MS,JS)){var QS=MS[JS],ZS=QS.s;xS(WS,ZS)||OS(WS,ZS,CS(6,QS.c))}var $S="DOMException";ed(et($S),$S);var eb=Ra.filter;ro({target:"Array",proto:!0,forced:!Xo("filter")},{filter:function(e){return eb(this,e,arguments.length>1?arguments[1]:void 0)}});var tb=Re,rb=Gt,nb=Math.floor,ib=tb("".charAt),ob=tb("".replace),ab=tb("".slice),sb=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,cb=/\$([$&'`]|\d{1,2})/g,ub=Uf,db=ve,lb=Re,hb=Ac,fb=de,pb=Fr,vb=qe,_b=Ue,mb=ii,yb=li,gb=As,Sb=Be,bb=$c,Eb=Rt,kb=function(e,t,r,n,i,o){var a=r+e.length,s=n.length,c=cb;return void 0!==i&&(i=rb(i),c=sb),ob(o,c,(function(o,c){var u;switch(ib(c,0)){case"$":return"$";case"&":return e;case"`":return ab(t,0,r);case"'":return ab(t,a);case"<":u=i[ab(c,1,-1)];break;default:var d=+c;if(0===d)return o;if(d>s){var l=nb(d/10);return 0===l?o:l<=s?void 0===n[l-1]?ib(c,1):n[l-1]+ib(c,1):o}u=n[d-1]}return void 0===u?"":u}))},Tb=Pc,Ib=sr("replace"),Ab=Math.max,Rb=Math.min,wb=lb([].concat),Cb=lb([].push),Ob=lb("".indexOf),xb=lb("".slice),Db="$0"==="a".replace(/./,"$0"),Nb=!!/./[Ib]&&""===/./[Ib]("a","$0"),Pb=!fb((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")}));hb("replace",(function(e,t,r){var n=Nb?"$":"$0";return[function(e,r){var n=Sb(this),i=_b(e)?void 0:Eb(e,Ib);return i?db(i,e,n,r):db(t,gb(n),e,r)},function(e,i){var o=pb(this),a=gb(e);if("string"==typeof i&&-1===Ob(i,n)&&-1===Ob(i,"$<")){var s=r(t,o,a,i);if(s.done)return s.value}var c=vb(i);c||(i=gb(i));var u=o.global;if(u){var d=o.unicode;o.lastIndex=0}for(var l=[];;){var h=Tb(o,a);if(null===h)break;if(Cb(l,h),!u)break;""===gb(h[0])&&(o.lastIndex=bb(a,yb(o.lastIndex),d))}for(var f,p="",v=0,_=0;_<l.length;_++){for(var m=gb((h=l[_])[0]),y=Ab(Rb(mb(h.index),a.length),0),g=[],S=1;S<h.length;S++)Cb(g,void 0===(f=h[S])?f:String(f));var b=h.groups;if(c){var E=wb([m],g,y,a);void 0!==b&&Cb(E,b);var k=gb(ub(i,void 0,E))}else k=kb(m,a,y,g,b,i);y>=v&&(p+=xb(a,v,y)+k,v=y+m.length)}return p+xb(a,v)}]}),!Pb||!Db||Nb);var Mb=ve,Lb=Xt,Ub=tt,Vb=Vs,Fb=RegExp.prototype,Bb=function(e){var t=e.flags;return void 0!==t||"flags"in Fb||Lb(e,"flags")||!Ub(Fb,e)?t:Mb(Vb,e)},jb=le,Gb=ce,Hb=Re,zb=Wi,Xb=kh,Kb=$r,qb=ei.f,Wb=tt,Yb=Ss,Jb=As,Qb=Bb,Zb=zs,$b=Ff,eE=$n,tE=de,rE=Xt,nE=Ln.enforce,iE=Kh,oE=qs,aE=Js,sE=sr("match"),cE=Gb.RegExp,uE=cE.prototype,dE=Gb.SyntaxError,lE=Hb(uE.exec),hE=Hb("".charAt),fE=Hb("".replace),pE=Hb("".indexOf),vE=Hb("".slice),_E=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,mE=/a/g,yE=/a/g,gE=new cE(mE)!==mE,SE=Zb.MISSED_STICKY,bE=Zb.UNSUPPORTED_Y,EE=jb&&(!gE||SE||oE||aE||tE((function(){return yE[sE]=!1,cE(mE)!=mE||cE(yE)==yE||"/a/i"!=cE(mE,"i")})));if(zb("RegExp",EE)){for(var kE=function(e,t){var r,n,i,o,a,s,c=Wb(uE,this),u=Yb(e),d=void 0===t,l=[],h=e;if(!c&&u&&d&&e.constructor===kE)return e;if((u||Wb(uE,e))&&(e=e.source,d&&(t=Qb(h))),e=void 0===e?"":Jb(e),t=void 0===t?"":Jb(t),h=e,oE&&"dotAll"in mE&&(n=!!t&&pE(t,"s")>-1)&&(t=fE(t,/s/g,"")),r=t,SE&&"sticky"in mE&&(i=!!t&&pE(t,"y")>-1)&&bE&&(t=fE(t,/y/g,"")),aE&&(o=function(e){for(var t,r=e.length,n=0,i="",o=[],a={},s=!1,c=!1,u=0,d="";n<=r;n++){if("\\"===(t=hE(e,n)))t+=hE(e,++n);else if("]"===t)s=!1;else if(!s)switch(!0){case"["===t:s=!0;break;case"("===t:lE(_E,vE(e,n+1))&&(n+=2,c=!0),i+=t,u++;continue;case">"===t&&c:if(""===d||rE(a,d))throw new dE("Invalid capture group name");a[d]=!0,o[o.length]=[d,u],c=!1,d="";continue}c?d+=t:i+=t}return[i,o]}(e),e=o[0],l=o[1]),a=Xb(cE(e,t),c?this:uE,kE),(n||i||l.length)&&(s=nE(a),n&&(s.dotAll=!0,s.raw=kE(function(e){for(var t,r=e.length,n=0,i="",o=!1;n<=r;n++)"\\"!==(t=hE(e,n))?o||"."!==t?("["===t?o=!0:"]"===t&&(o=!1),i+=t):i+="[\\s\\S]":i+=t+hE(e,++n);return i}(e),r)),i&&(s.sticky=!0),l.length&&(s.groups=l)),e!==h)try{Kb(a,"source",""===h?"(?:)":h)}catch(T0){}return a},TE=qb(cE),IE=0;TE.length>IE;)$b(kE,cE,TE[IE++]);uE.constructor=kE,kE.prototype=uE,eE(Gb,"RegExp",kE,{constructor:!0})}iE("RegExp");var AE=le,RE=qs,wE=xe,CE=Og,OE=Ln.get,xE=RegExp.prototype,DE=TypeError;AE&&RE&&CE(xE,"dotAll",{configurable:!0,get:function(){if(this!==xE){if("RegExp"===wE(this))return!!OE(this).dotAll;throw DE("Incompatible receiver, RegExp required")}}});var NE=le,PE=zs.MISSED_STICKY,ME=xe,LE=Og,UE=Ln.get,VE=RegExp.prototype,FE=TypeError;NE&&PE&&LE(VE,"sticky",{configurable:!0,get:function(){if(this!==VE){if("RegExp"===ME(this))return!!UE(this).sticky;throw FE("Incompatible receiver, RegExp required")}}});var BE=sn.PROPER,jE=$n,GE=Fr,HE=As,zE=de,XE=Bb,KE="toString",qE=RegExp.prototype.toString,WE=zE((function(){return"/a/b"!=qE.call({source:"a",flags:"b"})})),YE=BE&&qE.name!=KE;(WE||YE)&&jE(RegExp.prototype,KE,(function(){var e=GE(this);return"/"+HE(e.source)+"/"+HE(XE(e))}),{unsafe:!0});var JE=ro,QE=de,ZE=He,$E=ue.f,ek=le,tk=QE((function(){$E(1)}));JE({target:"Object",stat:!0,forced:!ek||tk,sham:!ek},{getOwnPropertyDescriptor:function(e,t){return $E(ZE(e),t)}});var rk=ro,nk=et,ik=Uf,ok=ve,ak=Re,sk=de,ck=io,uk=qe,dk=Je,lk=yt,hk=Nv,fk=ht,pk=nk("JSON","stringify"),vk=ak(/./.exec),_k=ak("".charAt),mk=ak("".charCodeAt),yk=ak("".replace),gk=ak(1..toString),Sk=/[\uD800-\uDFFF]/g,bk=/^[\uD800-\uDBFF]$/,Ek=/^[\uDC00-\uDFFF]$/,kk=!fk||sk((function(){var e=nk("Symbol")();return"[null]"!=pk([e])||"{}"!=pk({a:e})||"{}"!=pk(Object(e))})),Tk=sk((function(){return'"\\udf06\\ud834"'!==pk("\udf06\ud834")||'"\\udead"'!==pk("\udead")})),Ik=function(e,t){var r=hk(arguments),n=t;if((dk(t)||void 0!==e)&&!lk(e))return ck(t)||(t=function(e,t){if(uk(n)&&(t=ok(n,this,e,t)),!lk(t))return t}),r[1]=t,ik(pk,null,r)},Ak=function(e,t,r){var n=_k(r,t-1),i=_k(r,t+1);return vk(bk,e)&&!vk(Ek,i)||vk(Ek,e)&&!vk(bk,n)?"\\u"+gk(mk(e,0),16):e};pk&&rk({target:"JSON",stat:!0,arity:3,forced:kk||Tk},{stringify:function(e,t,r){var n=hk(arguments),i=ik(kk?Ik:pk,null,n);return Tk&&"string"==typeof i?yk(i,Sk,Ak):i}});var Rk=bv;function wk(e,t){var r=e&&e.navigator;if(r.mediaDevices){var n=function(e){if("object"!==a(e)||e.mandatory||e.optional)return e;var t={};return Object.keys(e).forEach((function(r){if("require"!==r&&"advanced"!==r&&"mediaSource"!==r){var n="object"===a(e[r])?e[r]:{ideal:e[r]};void 0!==n.exact&&"number"==typeof n.exact&&(n.min=n.max=n.exact);var i=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):"deviceId"===t?"sourceId":t};if(void 0!==n.ideal){t.optional=t.optional||[];var o={};"number"==typeof n.ideal?(o[i("min",r)]=n.ideal,t.optional.push(o),(o={})[i("max",r)]=n.ideal,t.optional.push(o)):(o[i("",r)]=n.ideal,t.optional.push(o))}void 0!==n.exact&&"number"!=typeof n.exact?(t.mandatory=t.mandatory||{},t.mandatory[i("",r)]=n.exact):["min","max"].forEach((function(e){void 0!==n[e]&&(t.mandatory=t.mandatory||{},t.mandatory[i(e,r)]=n[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"===a(e.audio)){var o=function(e,t,r){t in e&&!(r in e)&&(e[r]=e[t],delete e[t])};o((e=JSON.parse(JSON.stringify(e))).audio,"autoGainControl","googAutoGainControl"),o(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=n(e.audio)}if(e&&"object"===a(e.video)){var s=e.video.facingMode;s=s&&("object"===a(s)?s:{ideal:s});var c,u=t.version<66;if(s&&("user"===s.exact||"environment"===s.exact||"user"===s.ideal||"environment"===s.ideal)&&(!r.mediaDevices.getSupportedConstraints||!r.mediaDevices.getSupportedConstraints().facingMode||u))if(delete e.video.facingMode,"environment"===s.exact||"environment"===s.ideal?c=["back","rear"]:"user"!==s.exact&&"user"!==s.ideal||(c=["front"]),c)return r.mediaDevices.enumerateDevices().then((function(t){var r=(t=t.filter((function(e){return"videoinput"===e.kind}))).find((function(e){return c.some((function(t){return e.label.toLowerCase().includes(t)}))}));return!r&&t.length&&c.includes("back")&&(r=t[t.length-1]),r&&(e.video.deviceId=s.exact?{exact:r.deviceId}:{ideal:r.deviceId}),e.video=n(e.video),Rk("chrome: "+JSON.stringify(e)),i(e)}));e.video=n(e.video)}return Rk("chrome: "+JSON.stringify(e)),i(e)},o=function(e){return t.version>=64?e:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[e.name]||e.name,message:e.message,constraint:e.constraint||e.constraintName,toString:function(){return this.name+(this.message&&": ")+this.message}}};if(r.getUserMedia=function(e,t,n){i(e,(function(e){r.webkitGetUserMedia(e,t,(function(e){n&&n(o(e))}))}))}.bind(r),r.mediaDevices.getUserMedia){var s=r.mediaDevices.getUserMedia.bind(r.mediaDevices);r.mediaDevices.getUserMedia=function(e){return i(e,(function(e){return s(e).then((function(t){if(e.audio&&!t.getAudioTracks().length||e.video&&!t.getVideoTracks().length)throw t.getTracks().forEach((function(e){e.stop()})),new DOMException("","NotFoundError");return t}),(function(e){return Promise.reject(o(e))}))}))}}}}function Ck(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function Ok(e){if("object"===a(e)&&e.RTCPeerConnection&&!("ontrack"in e.RTCPeerConnection.prototype)){Object.defineProperty(e.RTCPeerConnection.prototype,"ontrack",{get:function(){return this._ontrack},set:function(e){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=e)},enumerable:!0,configurable:!0});var t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){var r=this;return this._ontrackpoly||(this._ontrackpoly=function(t){t.stream.addEventListener("addtrack",(function(n){var i;i=e.RTCPeerConnection.prototype.getReceivers?r.getReceivers().find((function(e){return e.track&&e.track.id===n.track.id})):{track:n.track};var o=new Event("track");o.track=n.track,o.receiver=i,o.transceiver={receiver:i},o.streams=[t.stream],r.dispatchEvent(o)})),t.stream.getTracks().forEach((function(n){var i;i=e.RTCPeerConnection.prototype.getReceivers?r.getReceivers().find((function(e){return e.track&&e.track.id===n.id})):{track:n};var o=new Event("track");o.track=n,o.receiver=i,o.transceiver={receiver:i},o.streams=[t.stream],r.dispatchEvent(o)}))},this.addEventListener("addstream",this._ontrackpoly)),t.apply(this,arguments)}}else yv(e,"track",(function(e){return e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e}))}function xk(e){if("object"===a(e)&&e.RTCPeerConnection&&!("getSenders"in e.RTCPeerConnection.prototype)&&"createDTMFSender"in e.RTCPeerConnection.prototype){var t=function(e,t){return{track:t,get dtmf(){return void 0===this._dtmf&&("audio"===t.kind?this._dtmf=e.createDTMFSender(t):this._dtmf=null),this._dtmf},_pc:e}};if(!e.RTCPeerConnection.prototype.getSenders){e.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};var r=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,n){var i=r.apply(this,arguments);return i||(i=t(this,e),this._senders.push(i)),i};var n=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){n.apply(this,arguments);var t=this._senders.indexOf(e);-1!==t&&this._senders.splice(t,1)}}var i=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){var r=this;this._senders=this._senders||[],i.apply(this,[e]),e.getTracks().forEach((function(e){r._senders.push(t(r,e))}))};var o=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;this._senders=this._senders||[],o.apply(this,[e]),e.getTracks().forEach((function(e){var r=t._senders.find((function(t){return t.track===e}));r&&t._senders.splice(t._senders.indexOf(r),1)}))}}else if("object"===a(e)&&e.RTCPeerConnection&&"getSenders"in e.RTCPeerConnection.prototype&&"createDTMFSender"in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)){var s=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){var e=this,t=s.apply(this,[]);return t.forEach((function(t){return t._pc=e})),t},Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get:function(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function Dk(e){if(e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){var e=this,r=Array.prototype.slice.call(arguments),n=r[0],i=r[1],o=r[2];if(arguments.length>0&&"function"==typeof n)return t.apply(this,arguments);if(0===t.length&&(0===arguments.length||"function"!=typeof n))return t.apply(this,[]);var a=function(e){var t={};return e.result().forEach((function(e){var r={id:e.id,timestamp:e.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[e.type]||e.type};e.names().forEach((function(t){r[t]=e.stat(t)})),t[r.id]=r})),t},s=function(e){return new Map(Object.keys(e).map((function(t){return[t,e[t]]})))};if(arguments.length>=2){var c=function(e){i(s(a(e)))};return t.apply(this,[c,n])}return new Promise((function(r,n){t.apply(e,[function(e){r(s(a(e)))},n])})).then(i,o)}}}function Nk(e){if("object"===a(e)&&e.RTCPeerConnection&&e.RTCRtpSender&&e.RTCRtpReceiver){if(!("getStats"in e.RTCRtpSender.prototype)){var t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){var e=this,r=t.apply(this,[]);return r.forEach((function(t){return t._pc=e})),r});var r=e.RTCPeerConnection.prototype.addTrack;r&&(e.RTCPeerConnection.prototype.addTrack=function(){var e=r.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){var e=this;return this._pc.getStats().then((function(t){return Rv(t,e.track,!0)}))}}if(!("getStats"in e.RTCRtpReceiver.prototype)){var n=e.RTCPeerConnection.prototype.getReceivers;n&&(e.RTCPeerConnection.prototype.getReceivers=function(){var e=this,t=n.apply(this,[]);return t.forEach((function(t){return t._pc=e})),t}),yv(e,"track",(function(e){return e.receiver._pc=e.srcElement,e})),e.RTCRtpReceiver.prototype.getStats=function(){var e=this;return this._pc.getStats().then((function(t){return Rv(t,e.track,!1)}))}}if("getStats"in e.RTCRtpSender.prototype&&"getStats"in e.RTCRtpReceiver.prototype){var i=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof e.MediaStreamTrack){var t,r,n,o=arguments[0];return this.getSenders().forEach((function(e){e.track===o&&(t?n=!0:t=e)})),this.getReceivers().forEach((function(e){return e.track===o&&(r?n=!0:r=e),e.track===o})),n||t&&r?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):t?t.getStats():r?r.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return i.apply(this,arguments)}}}}function Pk(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){var e=this;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map((function(t){return e._shimmedLocalStreams[t][0]}))};var t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,r){if(!r)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};var n=t.apply(this,arguments);return this._shimmedLocalStreams[r.id]?-1===this._shimmedLocalStreams[r.id].indexOf(n)&&this._shimmedLocalStreams[r.id].push(n):this._shimmedLocalStreams[r.id]=[r,n],n};var r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){var t=this;this._shimmedLocalStreams=this._shimmedLocalStreams||{},e.getTracks().forEach((function(e){if(t.getSenders().find((function(t){return t.track===e})))throw new DOMException("Track already exists.","InvalidAccessError")}));var n=this.getSenders();r.apply(this,arguments);var i=this.getSenders().filter((function(e){return-1===n.indexOf(e)}));this._shimmedLocalStreams[e.id]=[e].concat(i)};var n=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],n.apply(this,arguments)};var i=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){var t=this;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},e&&Object.keys(this._shimmedLocalStreams).forEach((function(r){var n=t._shimmedLocalStreams[r].indexOf(e);-1!==n&&t._shimmedLocalStreams[r].splice(n,1),1===t._shimmedLocalStreams[r].length&&delete t._shimmedLocalStreams[r]})),i.apply(this,arguments)}}function Mk(e,t){if(e.RTCPeerConnection){if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return Pk(e);var r=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){var e=this,t=r.apply(this);return this._reverseStreams=this._reverseStreams||{},t.map((function(t){return e._reverseStreams[t.id]}))};var n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(t){var r=this;if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},t.getTracks().forEach((function(e){if(r.getSenders().find((function(t){return t.track===e})))throw new DOMException("Track already exists.","InvalidAccessError")})),!this._reverseStreams[t.id]){var i=new e.MediaStream(t.getTracks());this._streams[t.id]=i,this._reverseStreams[i.id]=t,t=i}n.apply(this,[t])};var i=e.RTCPeerConnection.prototype.removeStream;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,r){var n=this;if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");var i=[].slice.call(arguments,1);if(1!==i.length||!i[0].getTracks().find((function(e){return e===t})))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");var o=this.getSenders().find((function(e){return e.track===t}));if(o)throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};var a=this._streams[r.id];if(a)a.addTrack(t),Promise.resolve().then((function(){n.dispatchEvent(new Event("negotiationneeded"))}));else{var s=new e.MediaStream([t]);this._streams[r.id]=s,this._reverseStreams[s.id]=r,this.addStream(s)}return this.getSenders().find((function(e){return e.track===t}))},["createOffer","createAnswer"].forEach((function(t){var r=e.RTCPeerConnection.prototype[t],n=h({},t,(function(){var e=this,t=arguments,n=arguments.length&&"function"==typeof arguments[0];return n?r.apply(this,[function(r){var n=s(e,r);t[0].apply(null,[n])},function(e){t[1]&&t[1].apply(null,e)},arguments[2]]):r.apply(this,arguments).then((function(t){return s(e,t)}))}));e.RTCPeerConnection.prototype[t]=n[t]}));var o=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=c(this,arguments[0]),o.apply(this,arguments)):o.apply(this,arguments)};var a=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(e.RTCPeerConnection.prototype,"localDescription",{get:function(){var e=a.get.apply(this);return""===e.type?e:s(this,e)}}),e.RTCPeerConnection.prototype.removeTrack=function(e){var t,r=this;if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!e._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(!(e._pc===this))throw new DOMException("Sender was not created by this connection.","InvalidAccessError");this._streams=this._streams||{},Object.keys(this._streams).forEach((function(n){r._streams[n].getTracks().find((function(t){return e.track===t}))&&(t=r._streams[n])})),t&&(1===t.getTracks().length?this.removeStream(this._reverseStreams[t.id]):t.removeTrack(e.track),this.dispatchEvent(new Event("negotiationneeded")))}}function s(e,t){var r=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((function(t){var n=e._reverseStreams[t],i=e._streams[n.id];r=r.replace(new RegExp(i.id,"g"),n.id)})),new RTCSessionDescription({type:t.type,sdp:r})}function c(e,t){var r=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((function(t){var n=e._reverseStreams[t],i=e._streams[n.id];r=r.replace(new RegExp(n.id,"g"),i.id)})),new RTCSessionDescription({type:t.type,sdp:r})}}function Lk(e,t){!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=e.webkitRTCPeerConnection),e.RTCPeerConnection&&t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){var r=e.RTCPeerConnection.prototype[t],n=h({},t,(function(){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}));e.RTCPeerConnection.prototype[t]=n[t]}))}function Uk(e,t){yv(e,"negotiationneeded",(function(e){var r=e.target;if(!(t.version<72||r.getConfiguration&&"plan-b"===r.getConfiguration().sdpSemantics)||"stable"===r.signalingState)return e}))}var Vk,Fk,Bk=Object.freeze(Object.defineProperty({__proto__:null,shimMediaStream:Ck,shimOnTrack:Ok,shimGetSendersWithDtmf:xk,shimGetStats:Dk,shimSenderReceiverGetStats:Nk,shimAddTrackRemoveTrackWithNative:Pk,shimAddTrackRemoveTrack:Mk,shimPeerConnection:Lk,fixNegotiationNeeded:Uk,shimGetUserMedia:wk,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&("function"==typeof t?e.navigator.mediaDevices.getDisplayMedia=function(r){return t(r).then((function(t){var n=r.video&&r.video.width,i=r.video&&r.video.height,o=r.video&&r.video.frameRate;return r.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:t,maxFrameRate:o||3}},n&&(r.video.mandatory.maxWidth=n),i&&(r.video.mandatory.maxHeight=i),e.navigator.mediaDevices.getUserMedia(r)}))}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))}},Symbol.toStringTag,{value:"Module"})),jk=ro,Gk=ve,Hk=qe,zk=Fr,Xk=As,Kk=(Vk=!1,(Fk=/[ac]/).exec=function(){return Vk=!0,/./.exec.apply(this,arguments)},!0===Fk.test("abc")&&Vk),qk=/./.test;jk({target:"RegExp",proto:!0,forced:!Kk},{test:function(e){var t=zk(this),r=Xk(e),n=t.exec;if(!Hk(n))return Gk(qk,t,r);var i=Gk(n,t,r);return null!==i&&(zk(i),!0)}});var Wk=ce,Yk=de,Jk=As,Qk=mu.trim,Zk=Re("".charAt),$k=Wk.parseFloat,eT=Wk.Symbol,tT=eT&&eT.iterator,rT=1/$k("\t\n\v\f\r \u2028\u2029\ufeff-0")!=-1/0||tT&&!Yk((function(){$k(Object(tT))}))?function(e){var t=Qk(Jk(e)),r=$k(t);return 0===r&&"-"==Zk(t,0)?-0:r}:$k;ro({global:!0,forced:parseFloat!=rT},{parseFloat:rT});var nT=ro,iT=Lm,oT=de,aT=et,sT=qe,cT=C_,uT=kg,dT=$n,lT=iT&&iT.prototype;if(nT({target:"Promise",proto:!0,real:!0,forced:!!iT&&oT((function(){lT.finally.call({then:function(){}},(function(){}))}))},{finally:function(e){var t=cT(this,aT("Promise")),r=sT(e);return this.then(r?function(r){return uT(t,e()).then((function(){return r}))}:e,r?function(r){return uT(t,e()).then((function(){throw r}))}:e)}}),sT(iT)){var hT=aT("Promise").prototype.finally;lT.finally!==hT&&dT(lT,"finally",hT,{unsafe:!0})}function fT(e,t){var r=e&&e.navigator,n=e&&e.MediaStreamTrack;if(r.getUserMedia=function(e,t,n){Ev("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),r.mediaDevices.getUserMedia(e).then(t,n)},!(t.version>55&&"autoGainControl"in r.mediaDevices.getSupportedConstraints())){var i=function(e,t,r){t in e&&!(r in e)&&(e[r]=e[t],delete e[t])},o=r.mediaDevices.getUserMedia.bind(r.mediaDevices);if(r.mediaDevices.getUserMedia=function(e){return"object"===a(e)&&"object"===a(e.audio)&&(e=JSON.parse(JSON.stringify(e)),i(e.audio,"autoGainControl","mozAutoGainControl"),i(e.audio,"noiseSuppression","mozNoiseSuppression")),o(e)},n&&n.prototype.getSettings){var s=n.prototype.getSettings;n.prototype.getSettings=function(){var e=s.apply(this,arguments);return i(e,"mozAutoGainControl","autoGainControl"),i(e,"mozNoiseSuppression","noiseSuppression"),e}}if(n&&n.prototype.applyConstraints){var c=n.prototype.applyConstraints;n.prototype.applyConstraints=function(e){return"audio"===this.kind&&"object"===a(e)&&(e=JSON.parse(JSON.stringify(e)),i(e,"autoGainControl","mozAutoGainControl"),i(e,"noiseSuppression","mozNoiseSuppression")),c.apply(this,[e])}}}}function pT(e){"object"===a(e)&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get:function(){return{receiver:this.receiver}}})}function vT(e,t){if("object"===a(e)&&(e.RTCPeerConnection||e.mozRTCPeerConnection)){!e.RTCPeerConnection&&e.mozRTCPeerConnection&&(e.RTCPeerConnection=e.mozRTCPeerConnection),t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){var r=e.RTCPeerConnection.prototype[t],n=h({},t,(function(){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}));e.RTCPeerConnection.prototype[t]=n[t]}));var r={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},n=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){var e=Array.prototype.slice.call(arguments),i=e[0],o=e[1],a=e[2];return n.apply(this,[i||null]).then((function(e){if(t.version<53&&!o)try{e.forEach((function(e){e.type=r[e.type]||e.type}))}catch(n){if("TypeError"!==n.name)throw n;e.forEach((function(t,n){e.set(n,Object.assign({},t,{type:r[t.type]||t.type}))}))}return e})).then(o,a)}}}function _T(e){if("object"===a(e)&&e.RTCPeerConnection&&e.RTCRtpSender&&(!e.RTCRtpSender||!("getStats"in e.RTCRtpSender.prototype))){var t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){var e=this,r=t.apply(this,[]);return r.forEach((function(t){return t._pc=e})),r});var r=e.RTCPeerConnection.prototype.addTrack;r&&(e.RTCPeerConnection.prototype.addTrack=function(){var e=r.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 mT(e){if("object"===a(e)&&e.RTCPeerConnection&&e.RTCRtpSender&&(!e.RTCRtpSender||!("getStats"in e.RTCRtpReceiver.prototype))){var t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){var e=this,r=t.apply(this,[]);return r.forEach((function(t){return t._pc=e})),r}),yv(e,"track",(function(e){return e.receiver._pc=e.srcElement,e})),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}}function yT(e){e.RTCPeerConnection&&!("removeStream"in e.RTCPeerConnection.prototype)&&(e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;Ev("removeStream","removeTrack"),this.getSenders().forEach((function(r){r.track&&e.getTracks().includes(r.track)&&t.removeTrack(r)}))})}function gT(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function ST(e){if("object"===a(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.addTransceiver;t&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];var e=arguments[1]&&arguments[1].sendEncodings;void 0===e&&(e=[]);var r=(e=k(e)).length>0;r&&e.forEach((function(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")}));var n=t.apply(this,arguments);if(r){var i=n.sender,o=i.getParameters();(!("encodings"in o)||1===o.encodings.length&&0===Object.keys(o.encodings[0]).length)&&(o.encodings=e,i.sendEncodings=e,this.setParametersPromises.push(i.setParameters(o).then((function(){delete i.sendEncodings})).catch((function(){delete i.sendEncodings}))))}return n})}}function bT(e){if("object"===a(e)&&e.RTCRtpSender){var t=e.RTCRtpSender.prototype.getParameters;t&&(e.RTCRtpSender.prototype.getParameters=function(){var e=t.apply(this,arguments);return"encodings"in e||(e.encodings=[].concat(this.sendEncodings||[{}])),e})}}function ET(e){if("object"===a(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(){var e=arguments,r=this;return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((function(){return t.apply(r,e)})).finally((function(){r.setParametersPromises=[]})):t.apply(this,arguments)}}}function kT(e){if("object"===a(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.createAnswer;e.RTCPeerConnection.prototype.createAnswer=function(){var e=arguments,r=this;return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((function(){return t.apply(r,e)})).finally((function(){r.setParametersPromises=[]})):t.apply(this,arguments)}}}var TT=Object.freeze(Object.defineProperty({__proto__:null,shimOnTrack:pT,shimPeerConnection:vT,shimSenderGetStats:_T,shimReceiverGetStats:mT,shimRemoveStream:yT,shimRTCDataChannel:gT,shimAddTransceiver:ST,shimGetParameters:bT,shimCreateOffer:ET,shimCreateAnswer:kT,shimGetUserMedia:fT,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&(e.navigator.mediaDevices.getDisplayMedia=function(r){if(!r||!r.video){var n=new DOMException("getDisplayMedia without video constraints is undefined");return n.name="NotFoundError",n.code=8,Promise.reject(n)}return!0===r.video?r.video={mediaSource:t}:r.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(r)})}},Symbol.toStringTag,{value:"Module"}));function IT(e){if("object"===a(e)&&e.RTCPeerConnection){if("getLocalStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in e.RTCPeerConnection.prototype)){var t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addStream=function(e){var r=this;this._localStreams||(this._localStreams=[]),this._localStreams.includes(e)||this._localStreams.push(e),e.getAudioTracks().forEach((function(n){return t.call(r,n,e)})),e.getVideoTracks().forEach((function(n){return t.call(r,n,e)}))},e.RTCPeerConnection.prototype.addTrack=function(e){for(var r=this,n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];return i&&i.forEach((function(e){r._localStreams?r._localStreams.includes(e)||r._localStreams.push(e):r._localStreams=[e]})),t.apply(this,arguments)}}"removeStream"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;this._localStreams||(this._localStreams=[]);var r=this._localStreams.indexOf(e);if(-1!==r){this._localStreams.splice(r,1);var n=e.getTracks();this.getSenders().forEach((function(e){n.includes(e.track)&&t.removeTrack(e)}))}})}}function AT(e){if("object"===a(e)&&e.RTCPeerConnection&&("getRemoteStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in e.RTCPeerConnection.prototype))){Object.defineProperty(e.RTCPeerConnection.prototype,"onaddstream",{get:function(){return this._onaddstream},set:function(e){var t=this;this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=e),this.addEventListener("track",this._onaddstreampoly=function(e){e.streams.forEach((function(e){if(t._remoteStreams||(t._remoteStreams=[]),!t._remoteStreams.includes(e)){t._remoteStreams.push(e);var r=new Event("addstream");r.stream=e,t.dispatchEvent(r)}}))})}});var t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){var e=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(t){t.streams.forEach((function(t){if(e._remoteStreams||(e._remoteStreams=[]),!(e._remoteStreams.indexOf(t)>=0)){e._remoteStreams.push(t);var r=new Event("addstream");r.stream=t,e.dispatchEvent(r)}}))}),t.apply(e,arguments)}}}function RT(e){if("object"===a(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype,r=t.createOffer,n=t.createAnswer,i=t.setLocalDescription,o=t.setRemoteDescription,s=t.addIceCandidate;t.createOffer=function(e,t){var n=arguments.length>=2?arguments[2]:arguments[0],i=r.apply(this,[n]);return t?(i.then(e,t),Promise.resolve()):i},t.createAnswer=function(e,t){var r=arguments.length>=2?arguments[2]:arguments[0],i=n.apply(this,[r]);return t?(i.then(e,t),Promise.resolve()):i};var c=function(e,t,r){var n=i.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n};t.setLocalDescription=c,c=function(e,t,r){var n=o.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n},t.setRemoteDescription=c,c=function(e,t,r){var n=s.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n},t.addIceCandidate=c}}function wT(e){var t=e&&e.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){var r=t.mediaDevices,n=r.getUserMedia.bind(r);t.mediaDevices.getUserMedia=function(e){return n(CT(e))}}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,r,n){t.mediaDevices.getUserMedia(e).then(r,n)}.bind(t))}function CT(e){return e&&void 0!==e.video?Object.assign({},e,{video:Iv(e.video)}):e}function OT(e){if(e.RTCPeerConnection){var t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,r){if(e&&e.iceServers){for(var n=[],i=0;i<e.iceServers.length;i++){var o=e.iceServers[i];!o.hasOwnProperty("urls")&&o.hasOwnProperty("url")?(Ev("RTCIceServer.url","RTCIceServer.urls"),(o=JSON.parse(JSON.stringify(o))).urls=o.url,delete o.url,n.push(o)):n.push(e.iceServers[i])}e.iceServers=n}return new t(e,r)},e.RTCPeerConnection.prototype=t.prototype,"generateCertificate"in t&&Object.defineProperty(e.RTCPeerConnection,"generateCertificate",{get:function(){return t.generateCertificate}})}}function xT(e){"object"===a(e)&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get:function(){return{receiver:this.receiver}}})}function DT(e){var t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(e){if(e){void 0!==e.offerToReceiveAudio&&(e.offerToReceiveAudio=!!e.offerToReceiveAudio);var r=this.getTransceivers().find((function(e){return"audio"===e.receiver.track.kind}));!1===e.offerToReceiveAudio&&r?"sendrecv"===r.direction?r.setDirection?r.setDirection("sendonly"):r.direction="sendonly":"recvonly"===r.direction&&(r.setDirection?r.setDirection("inactive"):r.direction="inactive"):!0!==e.offerToReceiveAudio||r||this.addTransceiver("audio",{direction:"recvonly"}),void 0!==e.offerToReceiveVideo&&(e.offerToReceiveVideo=!!e.offerToReceiveVideo);var n=this.getTransceivers().find((function(e){return"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",{direction:"recvonly"})}return t.apply(this,arguments)}}function NT(e){"object"!==a(e)||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var PT=Object.freeze(Object.defineProperty({__proto__:null,shimLocalStreamsAPI:IT,shimRemoteStreamsAPI:AT,shimCallbacksAPI:RT,shimGetUserMedia:wT,shimConstraints:CT,shimRTCIceServerUrls:OT,shimTrackEventTransceiver:xT,shimCreateOfferLegacy:DT,shimAudioContext:NT},Symbol.toStringTag,{value:"Module"})),MT=ve;ro({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return MT(URL.prototype.toString,this)}});var LT=Re(1..valueOf),UT=le,VT=ce,FT=Re,BT=Wi,jT=$n,GT=Xt,HT=kh,zT=tt,XT=yt,KT=vr,qT=de,WT=ei.f,YT=ue.f,JT=Pr.f,QT=LT,ZT=mu.trim,$T="Number",eI=VT.Number,tI=eI.prototype,rI=VT.TypeError,nI=FT("".slice),iI=FT("".charCodeAt),oI=function(e){var t=KT(e,"number");return"bigint"==typeof t?t:aI(t)},aI=function(e){var t,r,n,i,o,a,s,c,u=KT(e,"number");if(XT(u))throw rI("Cannot convert a Symbol value to a number");if("string"==typeof u&&u.length>2)if(u=ZT(u),43===(t=iI(u,0))||45===t){if(88===(r=iI(u,2))||120===r)return NaN}else if(48===t){switch(iI(u,1)){case 66:case 98:n=2,i=49;break;case 79:case 111:n=8,i=55;break;default:return+u}for(a=(o=nI(u,2)).length,s=0;s<a;s++)if((c=iI(o,s))<48||c>i)return NaN;return parseInt(o,n)}return+u};if(BT($T,!eI(" 0o1")||!eI("0b1")||eI("+0x1"))){for(var sI,cI=function(e){var t=arguments.length<1?0:eI(oI(e)),r=this;return zT(tI,r)&&qT((function(){QT(r)}))?HT(Object(t),r,cI):t},uI=UT?WT(eI):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,isFinite,isInteger,isNaN,isSafeInteger,parseFloat,parseInt,fromString,range".split(","),dI=0;uI.length>dI;dI++)GT(eI,sI=uI[dI])&&!GT(cI,sI)&&JT(cI,sI,YT(eI,sI));cI.prototype=tI,tI.constructor=cI,jT(VT,$T,cI,{constructor:!0})}var lI=sn.PROPER,hI=de,fI=uu,pI=mu.trim;ro({target:"String",proto:!0,forced:function(e){return hI((function(){return!!fI[e]()||"
"!=="
"[e]()||lI&&fI[e].name!==e}))}("trim")},{trim:function(){return pI(this)}});var vI,_I,mI={exports:{}};vI=mI,(_I={generateIdentifier:function(){return Math.random().toString(36).substr(2,10)}}).localCName=_I.generateIdentifier(),_I.splitLines=function(e){return e.trim().split("\n").map((function(e){return e.trim()}))},_I.splitSections=function(e){return e.split("\nm=").map((function(e,t){return(t>0?"m="+e:e).trim()+"\r\n"}))},_I.getDescription=function(e){var t=_I.splitSections(e);return t&&t[0]},_I.getMediaSections=function(e){var t=_I.splitSections(e);return t.shift(),t},_I.matchPrefix=function(e,t){return _I.splitLines(e).filter((function(e){return 0===e.indexOf(t)}))},_I.parseCandidate=function(e){for(var t,r={foundation:(t=0===e.indexOf("a=candidate:")?e.substring(12).split(" "):e.substring(10).split(" "))[0],component:{1:"rtp",2:"rtcp"}[t[1]]||t[1],protocol:t[2].toLowerCase(),priority:parseInt(t[3],10),ip:t[4],address:t[4],port:parseInt(t[5],10),type:t[7]},n=8;n<t.length;n+=2)switch(t[n]){case"raddr":r.relatedAddress=t[n+1];break;case"rport":r.relatedPort=parseInt(t[n+1],10);break;case"tcptype":r.tcpType=t[n+1];break;case"ufrag":r.ufrag=t[n+1],r.usernameFragment=t[n+1];break;default:void 0===r[t[n]]&&(r[t[n]]=t[n+1])}return r},_I.writeCandidate=function(e){var t=[];t.push(e.foundation);var r=e.component;"rtp"===r?t.push(1):"rtcp"===r?t.push(2):t.push(r),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(" ")},_I.parseIceOptions=function(e){return e.substr(14).split(" ")},_I.parseRtpMap=function(e){var t=e.substr(9).split(" "),r={payloadType:parseInt(t.shift(),10)};return t=t[0].split("/"),r.name=t[0],r.clockRate=parseInt(t[1],10),r.channels=3===t.length?parseInt(t[2],10):1,r.numChannels=r.channels,r},_I.writeRtpMap=function(e){var t=e.payloadType;void 0!==e.preferredPayloadType&&(t=e.preferredPayloadType);var r=e.channels||e.numChannels||1;return"a=rtpmap:"+t+" "+e.name+"/"+e.clockRate+(1!==r?"/"+r:"")+"\r\n"},_I.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]}},_I.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+"\r\n"},_I.parseFmtp=function(e){for(var t,r={},n=e.substr(e.indexOf(" ")+1).split(";"),i=0;i<n.length;i++)r[(t=n[i].trim().split("="))[0].trim()]=t[1];return r},_I.writeFmtp=function(e){var t="",r=e.payloadType;if(void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.parameters&&Object.keys(e.parameters).length){var n=[];Object.keys(e.parameters).forEach((function(t){void 0!==e.parameters[t]?n.push(t+"="+e.parameters[t]):n.push(t)})),t+="a=fmtp:"+r+" "+n.join(";")+"\r\n"}return t},_I.parseRtcpFb=function(e){var t=e.substr(e.indexOf(" ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},_I.writeRtcpFb=function(e){var t="",r=e.payloadType;return void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach((function(e){t+="a=rtcp-fb:"+r+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+"\r\n"})),t},_I.parseSsrcMedia=function(e){var t=e.indexOf(" "),r={ssrc:parseInt(e.substr(7,t-7),10)},n=e.indexOf(":",t);return n>-1?(r.attribute=e.substr(t+1,n-t-1),r.value=e.substr(n+1)):r.attribute=e.substr(t+1),r},_I.parseSsrcGroup=function(e){var t=e.substr(13).split(" ");return{semantics:t.shift(),ssrcs:t.map((function(e){return parseInt(e,10)}))}},_I.getMid=function(e){var t=_I.matchPrefix(e,"a=mid:")[0];if(t)return t.substr(6)},_I.parseFingerprint=function(e){var t=e.substr(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1].toUpperCase()}},_I.getDtlsParameters=function(e,t){return{role:"auto",fingerprints:_I.matchPrefix(e+t,"a=fingerprint:").map(_I.parseFingerprint)}},_I.writeDtlsParameters=function(e,t){var r="a=setup:"+t+"\r\n";return e.fingerprints.forEach((function(e){r+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"})),r},_I.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)}},_I.writeCryptoLine=function(e){return"a=crypto:"+e.tag+" "+e.cryptoSuite+" "+("object"===a(e.keyParams)?_I.writeCryptoKeyParams(e.keyParams):e.keyParams)+(e.sessionParams?" "+e.sessionParams.join(" "):"")+"\r\n"},_I.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}},_I.writeCryptoKeyParams=function(e){return e.keyMethod+":"+e.keySalt+(e.lifeTime?"|"+e.lifeTime:"")+(e.mkiValue&&e.mkiLength?"|"+e.mkiValue+":"+e.mkiLength:"")},_I.getCryptoParameters=function(e,t){return _I.matchPrefix(e+t,"a=crypto:").map(_I.parseCryptoLine)},_I.getIceParameters=function(e,t){var r=_I.matchPrefix(e+t,"a=ice-ufrag:")[0],n=_I.matchPrefix(e+t,"a=ice-pwd:")[0];return r&&n?{usernameFragment:r.substr(12),password:n.substr(10)}:null},_I.writeIceParameters=function(e){var t="a=ice-ufrag:"+e.usernameFragment+"\r\na=ice-pwd:"+e.password+"\r\n";return e.iceLite&&(t+="a=ice-lite\r\n"),t},_I.parseRtpParameters=function(e){for(var t={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},r=_I.splitLines(e)[0].split(" "),n=3;n<r.length;n++){var i=r[n],o=_I.matchPrefix(e,"a=rtpmap:"+i+" ")[0];if(o){var a=_I.parseRtpMap(o),s=_I.matchPrefix(e,"a=fmtp:"+i+" ");switch(a.parameters=s.length?_I.parseFmtp(s[0]):{},a.rtcpFeedback=_I.matchPrefix(e,"a=rtcp-fb:"+i+" ").map(_I.parseRtcpFb),t.codecs.push(a),a.name.toUpperCase()){case"RED":case"ULPFEC":t.fecMechanisms.push(a.name.toUpperCase())}}}return _I.matchPrefix(e,"a=extmap:").forEach((function(e){t.headerExtensions.push(_I.parseExtmap(e))})),t},_I.writeRtpDescription=function(e,t){var r="";r+="m="+e+" ",r+=t.codecs.length>0?"9":"0",r+=" UDP/TLS/RTP/SAVPF ",r+=t.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",t.codecs.forEach((function(e){r+=_I.writeRtpMap(e),r+=_I.writeFmtp(e),r+=_I.writeRtcpFb(e)}));var n=0;return t.codecs.forEach((function(e){e.maxptime>n&&(n=e.maxptime)})),n>0&&(r+="a=maxptime:"+n+"\r\n"),t.headerExtensions&&t.headerExtensions.forEach((function(e){r+=_I.writeExtmap(e)})),r},_I.parseRtpEncodingParameters=function(e){var t,r=[],n=_I.parseRtpParameters(e),i=-1!==n.fecMechanisms.indexOf("RED"),o=-1!==n.fecMechanisms.indexOf("ULPFEC"),a=_I.matchPrefix(e,"a=ssrc:").map((function(e){return _I.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute})),s=a.length>0&&a[0].ssrc,c=_I.matchPrefix(e,"a=ssrc-group:FID").map((function(e){return e.substr(17).split(" ").map((function(e){return parseInt(e,10)}))}));c.length>0&&c[0].length>1&&c[0][0]===s&&(t=c[0][1]),n.codecs.forEach((function(e){if("RTX"===e.name.toUpperCase()&&e.parameters.apt){var n={ssrc:s,codecPayloadType:parseInt(e.parameters.apt,10)};s&&t&&(n.rtx={ssrc:t}),r.push(n),i&&((n=JSON.parse(JSON.stringify(n))).fec={ssrc:s,mechanism:o?"red+ulpfec":"red"},r.push(n))}})),0===r.length&&s&&r.push({ssrc:s});var u=_I.matchPrefix(e,"b=");return u.length&&(u=0===u[0].indexOf("b=TIAS:")?parseInt(u[0].substr(7),10):0===u[0].indexOf("b=AS:")?1e3*parseInt(u[0].substr(5),10)*.95-16e3:void 0,r.forEach((function(e){e.maxBitrate=u}))),r},_I.parseRtcpParameters=function(e){var t={},r=_I.matchPrefix(e,"a=ssrc:").map((function(e){return _I.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute}))[0];r&&(t.cname=r.value,t.ssrc=r.ssrc);var n=_I.matchPrefix(e,"a=rtcp-rsize");t.reducedSize=n.length>0,t.compound=0===n.length;var i=_I.matchPrefix(e,"a=rtcp-mux");return t.mux=i.length>0,t},_I.writeRtcpParameters=function(e){var t="";return e.reducedSize&&(t+="a=rtcp-rsize\r\n"),e.mux&&(t+="a=rtcp-mux\r\n"),void 0!==e.ssrc&&e.cname&&(t+="a=ssrc:"+e.ssrc+" cname:"+e.cname+"\r\n"),t},_I.parseMsid=function(e){var t,r=_I.matchPrefix(e,"a=msid:");if(1===r.length)return{stream:(t=r[0].substr(7).split(" "))[0],track:t[1]};var n=_I.matchPrefix(e,"a=ssrc:").map((function(e){return _I.parseSsrcMedia(e)})).filter((function(e){return"msid"===e.attribute}));return n.length>0?{stream:(t=n[0].value.split(" "))[0],track:t[1]}:void 0},_I.parseSctpDescription=function(e){var t,r=_I.parseMLine(e),n=_I.matchPrefix(e,"a=max-message-size:");n.length>0&&(t=parseInt(n[0].substr(19),10)),isNaN(t)&&(t=65536);var i=_I.matchPrefix(e,"a=sctp-port:");if(i.length>0)return{port:parseInt(i[0].substr(12),10),protocol:r.fmt,maxMessageSize:t};var o=_I.matchPrefix(e,"a=sctpmap:");if(o.length>0){var a=o[0].substr(10).split(" ");return{port:parseInt(a[0],10),protocol:a[1],maxMessageSize:t}}},_I.writeSctpDescription=function(e,t){var r=[];return r="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&&r.push("a=max-message-size:"+t.maxMessageSize+"\r\n"),r.join("")},_I.generateSessionId=function(){return Math.random().toString().substr(2,21)},_I.writeSessionBoilerplate=function(e,t,r){var n=void 0!==t?t:2;return"v=0\r\no="+(r||"thisisadapterortc")+" "+(e||_I.generateSessionId())+" "+n+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},_I.getDirection=function(e,t){for(var r=_I.splitLines(e),n=0;n<r.length;n++)switch(r[n]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return r[n].substr(2)}return t?_I.getDirection(t):"sendrecv"},_I.getKind=function(e){return _I.splitLines(e)[0].split(" ")[0].substr(2)},_I.isRejected=function(e){return"0"===e.split(" ",2)[1]},_I.parseMLine=function(e){var t=_I.splitLines(e)[0].substr(2).split(" ");return{kind:t[0],port:parseInt(t[1],10),protocol:t[2],fmt:t.slice(3).join(" ")}},_I.parseOLine=function(e){var t=_I.matchPrefix(e,"o=")[0].substr(2).split(" ");return{username:t[0],sessionId:t[1],sessionVersion:parseInt(t[2],10),netType:t[3],addressType:t[4],address:t[5]}},_I.isValidSDP=function(e){if("string"!=typeof e||0===e.length)return!1;for(var t=_I.splitLines(e),r=0;r<t.length;r++)if(t[r].length<2||"="!==t[r].charAt(1))return!1;return!0},vI.exports=_I;var yI=mI.exports,gI=e({__proto__:null,default:yI},[mI.exports]);function SI(e){if(!(!e.RTCIceCandidate||e.RTCIceCandidate&&"foundation"in e.RTCIceCandidate.prototype)){var t=e.RTCIceCandidate;e.RTCIceCandidate=function(e){if("object"===a(e)&&e.candidate&&0===e.candidate.indexOf("a=")&&((e=JSON.parse(JSON.stringify(e))).candidate=e.candidate.substr(2)),e.candidate&&e.candidate.length){var r=new t(e),n=yI.parseCandidate(e.candidate),i=Object.assign(r,n);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,yv(e,"icecandidate",(function(t){return t.candidate&&Object.defineProperty(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t}))}}function bI(e){!e.RTCIceCandidate||e.RTCIceCandidate&&"relayProtocol"in e.RTCIceCandidate.prototype||yv(e,"icecandidate",(function(e){if(e.candidate){var t=yI.parseCandidate(e.candidate.candidate);"relay"===t.type&&(e.candidate.relayProtocol={0:"tls",1:"tcp",2:"udp"}[t.priority>>24])}return e}))}function EI(e,t){if(e.RTCPeerConnection){"sctp"in e.RTCPeerConnection.prototype||Object.defineProperty(e.RTCPeerConnection.prototype,"sctp",{get:function(){return void 0===this._sctp?null:this._sctp}});var r=function(e){if(!e||!e.sdp)return!1;var t=yI.splitSections(e.sdp);return t.shift(),t.some((function(e){var t=yI.parseMLine(e);return t&&"application"===t.kind&&-1!==t.protocol.indexOf("SCTP")}))},n=function(e){var t=e.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===t||t.length<2)return-1;var r=parseInt(t[1],10);return r!=r?-1:r},i=function(e){var r=65536;return"firefox"===t.browser&&(r=t.version<57?-1===e?16384:2147483637:t.version<60?57===t.version?65535:65536:2147483637),r},o=function(e,r){var n=65536;"firefox"===t.browser&&57===t.version&&(n=65535);var i=yI.matchPrefix(e.sdp,"a=max-message-size:");return i.length>0?n=parseInt(i[0].substr(19),10):"firefox"===t.browser&&-1!==r&&(n=2147483637),n},a=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,"chrome"===t.browser&&t.version>=76){var e=this.getConfiguration(),s=e.sdpSemantics;"plan-b"===s&&Object.defineProperty(this,"sctp",{get:function(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0})}if(r(arguments[0])){var c,u=n(arguments[0]),d=i(u),l=o(arguments[0],u);c=0===d&&0===l?Number.POSITIVE_INFINITY:0===d||0===l?Math.max(d,l):Math.min(d,l);var h={};Object.defineProperty(h,"maxMessageSize",{get:function(){return c}}),this._sctp=h}return a.apply(this,arguments)}}}function kI(e){if(e.RTCPeerConnection&&"createDataChannel"in e.RTCPeerConnection.prototype){var t=e.RTCPeerConnection.prototype.createDataChannel;e.RTCPeerConnection.prototype.createDataChannel=function(){var e=t.apply(this,arguments);return r(e,this),e},yv(e,"datachannel",(function(e){return r(e.channel,e.target),e}))}function r(e,t){var r=e.send;e.send=function(){var n=arguments[0],i=n.length||n.size||n.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 r.apply(e,arguments)}}}function TI(e){if(e.RTCPeerConnection&&!("connectionState"in e.RTCPeerConnection.prototype)){var t=e.RTCPeerConnection.prototype;Object.defineProperty(t,"connectionState",{get:function(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(t,"onconnectionstatechange",{get:function(){return this._onconnectionstatechange||null},set:function(e){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),e&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=e)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach((function(e){var r=t[e];t[e]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=function(e){var t=e.target;if(t._lastConnectionState!==t.connectionState){t._lastConnectionState=t.connectionState;var r=new Event("connectionstatechange",e);t.dispatchEvent(r)}return e},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),r.apply(this,arguments)}}))}}function II(e,t){if(e.RTCPeerConnection&&!("chrome"===t.browser&&t.version>=71||"safari"===t.browser&&t.version>=605)){var r=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(t){if(t&&t.sdp&&-1!==t.sdp.indexOf("\na=extmap-allow-mixed")){var n=t.sdp.split("\n").filter((function(e){return"a=extmap-allow-mixed"!==e.trim()})).join("\n");e.RTCSessionDescription&&t instanceof e.RTCSessionDescription?arguments[0]=new e.RTCSessionDescription({type:t.type,sdp:n}):t.sdp=n}return r.apply(this,arguments)}}}function AI(e,t){if(e.RTCPeerConnection&&e.RTCPeerConnection.prototype){var r=e.RTCPeerConnection.prototype.addIceCandidate;r&&0!==r.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():r.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}}function RI(e,t){if(e.RTCPeerConnection&&e.RTCPeerConnection.prototype){var r=e.RTCPeerConnection.prototype.setLocalDescription;r&&0!==r.length&&(e.RTCPeerConnection.prototype.setLocalDescription=function(){var e=this,t=arguments[0]||{};if("object"!==a(t)||t.type&&t.sdp)return r.apply(this,arguments);if(!(t={type:t.type,sdp:t.sdp}).type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":t.type="offer";break;default:t.type="answer"}if(t.sdp||"offer"!==t.type&&"answer"!==t.type)return r.apply(this,[t]);var n="offer"===t.type?this.createOffer:this.createAnswer;return n.apply(this).then((function(t){return r.apply(e,[t])}))})}}var wI=Object.freeze(Object.defineProperty({__proto__:null,shimRTCIceCandidate:SI,shimRTCIceCandidateRelayProtocol:bI,shimMaxMessageSize:EI,shimSendThrowTypeError:kI,shimConnectionState:TI,removeExtmapAllowMixed:II,shimAddIceCandidateNullOrEmpty:AI,shimParameterlessSetLocalDescription:RI},Symbol.toStringTag,{value:"Module"}));!function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.window,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{shimChrome:!0,shimFirefox:!0,shimSafari:!0},n=bv,i=kv(t),o={browserDetails:i,commonShim:wI,extractVersion:mv,disableLog:gv,disableWarnings:Sv,sdp:gI};switch(i.browser){case"chrome":if(!Bk||!Lk||!r.shimChrome)return n("Chrome shim is not included in this adapter release."),o;if(null===i.version)return n("Chrome shim can not determine version, not shimming."),o;n("adapter.js shimming chrome."),o.browserShim=Bk,AI(t,i),RI(t),wk(t,i),Ck(t),Lk(t,i),Ok(t),Mk(t,i),xk(t),Dk(t),Nk(t),Uk(t,i),SI(t),bI(t),TI(t),EI(t,i),kI(t),II(t,i);break;case"firefox":if(!TT||!vT||!r.shimFirefox)return n("Firefox shim is not included in this adapter release."),o;n("adapter.js shimming firefox."),o.browserShim=TT,AI(t,i),RI(t),fT(t,i),vT(t,i),pT(t),yT(t),_T(t),mT(t),gT(t),ST(t),bT(t),ET(t),kT(t),SI(t),TI(t),EI(t,i),kI(t);break;case"safari":if(!PT||!r.shimSafari)return n("Safari shim is not included in this adapter release."),o;n("adapter.js shimming safari."),o.browserShim=PT,AI(t,i),RI(t),OT(t),DT(t),RT(t),IT(t),AT(t),xT(t),wT(t),NT(t),SI(t),bI(t),EI(t,i),kI(t),II(t,i);break;default:n("Unsupported browser!")}}({window:"undefined"==typeof window?void 0:window});var CI=rl,OI=Math.floor,xI=function(e,t){var r=e.length,n=OI(r/2);return r<8?DI(e,t):NI(e,xI(CI(e,0,n),t),xI(CI(e,n),t),t)},DI=function(e,t){for(var r,n,i=e.length,o=1;o<i;){for(n=o,r=e[o];n&&t(e[n-1],r)>0;)e[n]=e[--n];n!==o++&&(e[n]=r)}return e},NI=function(e,t,r,n){for(var i=t.length,o=r.length,a=0,s=0;a<i||s<o;)e[a+s]=a<i&&s<o?n(t[a],r[s])<=0?t[a++]:r[s++]:a<i?t[a++]:r[s++];return e},PI=xI,MI=rt.match(/firefox\/(\d+)/i),LI=!!MI&&+MI[1],UI=/MSIE|Trident/.test(rt),VI=rt.match(/AppleWebKit\/(\d+)\./),FI=!!VI&&+VI[1],BI=ro,jI=Re,GI=Tt,HI=Gt,zI=fi,XI=r_,KI=As,qI=de,WI=PI,YI=Ca,JI=LI,QI=UI,ZI=ut,$I=FI,eA=[],tA=jI(eA.sort),rA=jI(eA.push),nA=qI((function(){eA.sort(void 0)})),iA=qI((function(){eA.sort(null)})),oA=YI("sort"),aA=!qI((function(){if(ZI)return ZI<70;if(!(JI&&JI>3)){if(QI)return!0;if($I)return $I<603;var e,t,r,n,i="";for(e=65;e<76;e++){switch(t=String.fromCharCode(e),e){case 66:case 69:case 70:case 72:r=3;break;case 68:case 71:r=4;break;default:r=2}for(n=0;n<47;n++)eA.push({k:t+n,v:r})}for(eA.sort((function(e,t){return t.v-e.v})),n=0;n<eA.length;n++)t=eA[n].k.charAt(0),i.charAt(i.length-1)!==t&&(i+=t);return"DGBEFHACIJK"!==i}}));BI({target:"Array",proto:!0,forced:nA||!iA||!oA||!aA},{sort:function(e){void 0!==e&&GI(e);var t=HI(this);if(aA)return void 0===e?tA(t):tA(t,e);var r,n,i=[],o=zI(t);for(n=0;n<o;n++)n in t&&rA(i,t[n]);for(WI(i,function(e){return function(t,r){return void 0===r?-1:void 0===t?1:void 0!==e?+e(t,r)||0:KI(t)>KI(r)?1:-1}}(e)),r=zI(i),n=0;n<r;)t[n]=i[n++];for(;n<o;)XI(t,n++);return t}});var sA,cA,uA,dA={exports:{}},lA="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView,hA=lA,fA=le,pA=ce,vA=qe,_A=Je,mA=Xt,yA=So,gA=St,SA=$r,bA=$n,EA=Pr.f,kA=tt,TA=Gu,IA=pd,AA=sr,RA=Jt,wA=Ln.enforce,CA=Ln.get,OA=pA.Int8Array,xA=OA&&OA.prototype,DA=pA.Uint8ClampedArray,NA=DA&&DA.prototype,PA=OA&&TA(OA),MA=xA&&TA(xA),LA=Object.prototype,UA=pA.TypeError,VA=AA("toStringTag"),FA=RA("TYPED_ARRAY_TAG"),BA="TypedArrayConstructor",jA=hA&&!!IA&&"Opera"!==yA(pA.opera),GA=!1,HA={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},zA={BigInt64Array:8,BigUint64Array:8},XA=function(e){var t=TA(e);if(_A(t)){var r=CA(t);return r&&mA(r,BA)?r.TypedArrayConstructor:XA(t)}},KA=function(e){if(!_A(e))return!1;var t=yA(e);return mA(HA,t)||mA(zA,t)};for(sA in HA)(uA=(cA=pA[sA])&&cA.prototype)?wA(uA).TypedArrayConstructor=cA:jA=!1;for(sA in zA)(uA=(cA=pA[sA])&&cA.prototype)&&(wA(uA).TypedArrayConstructor=cA);if((!jA||!vA(PA)||PA===Function.prototype)&&(PA=function(){throw UA("Incorrect invocation")},jA))for(sA in HA)pA[sA]&&IA(pA[sA],PA);if((!jA||!MA||MA===LA)&&(MA=PA.prototype,jA))for(sA in HA)pA[sA]&&IA(pA[sA].prototype,MA);if(jA&&TA(NA)!==MA&&IA(NA,MA),fA&&!mA(MA,VA))for(sA in GA=!0,EA(MA,VA,{get:function(){return _A(this)?this[FA]:void 0}}),HA)pA[sA]&&SA(pA[sA],FA,sA);var qA={NATIVE_ARRAY_BUFFER_VIEWS:jA,TYPED_ARRAY_TAG:GA&&FA,aTypedArray:function(e){if(KA(e))return e;throw UA("Target is not a typed array")},aTypedArrayConstructor:function(e){if(vA(e)&&(!IA||kA(PA,e)))return e;throw UA(gA(e)+" is not a typed array constructor")},exportTypedArrayMethod:function(e,t,r,n){if(fA){if(r)for(var i in HA){var o=pA[i];if(o&&mA(o.prototype,e))try{delete o.prototype[e]}catch(T0){try{o.prototype[e]=t}catch(a){}}}MA[e]&&!r||bA(MA,e,r?t:jA&&xA[e]||t,n)}},exportTypedArrayStaticMethod:function(e,t,r){var n,i;if(fA){if(IA){if(r)for(n in HA)if((i=pA[n])&&mA(i,e))try{delete i[e]}catch(T0){}if(PA[e]&&!r)return;try{return bA(PA,e,r?t:jA&&PA[e]||t)}catch(T0){}}for(n in HA)!(i=pA[n])||i[e]&&!r||bA(i,e,t)}},getTypedArrayConstructor:XA,isView:function(e){if(!_A(e))return!1;var t=yA(e);return"DataView"===t||mA(HA,t)||mA(zA,t)},isTypedArray:KA,TypedArray:PA,TypedArrayPrototype:MA},WA=ce,YA=de,JA=gh,QA=qA.NATIVE_ARRAY_BUFFER_VIEWS,ZA=WA.ArrayBuffer,$A=WA.Int8Array,eR=!QA||!YA((function(){$A(1)}))||!YA((function(){new $A(-1)}))||!JA((function(e){new $A,new $A(null),new $A(1.5),new $A(e)}),!0)||YA((function(){return 1!==new $A(new ZA(2),1,void 0).length})),tR=ii,rR=li,nR=RangeError,iR=function(e){if(void 0===e)return 0;var t=tR(e),r=rR(t);if(t!==r)throw nR("Wrong length or index");return r},oR=Array,aR=Math.abs,sR=Math.pow,cR=Math.floor,uR=Math.log,dR=Math.LN2,lR=Gt,hR=ci,fR=fi,pR=function(e){for(var t=lR(this),r=fR(t),n=arguments.length,i=hR(n>1?arguments[1]:void 0,r),o=n>2?arguments[2]:void 0,a=void 0===o?r:hR(o,r);a>i;)t[i++]=e;return t},vR=ce,_R=Re,mR=le,yR=lA,gR=sn,SR=$r,bR=jh,ER=de,kR=ph,TR=ii,IR=li,AR=iR,RR={pack:function(e,t,r){var n,i,o,a=oR(r),s=8*r-t-1,c=(1<<s)-1,u=c>>1,d=23===t?sR(2,-24)-sR(2,-77):0,l=e<0||0===e&&1/e<0?1:0,h=0;for((e=aR(e))!=e||e===1/0?(i=e!=e?1:0,n=c):(n=cR(uR(e)/dR),e*(o=sR(2,-n))<1&&(n--,o*=2),(e+=n+u>=1?d/o:d*sR(2,1-u))*o>=2&&(n++,o/=2),n+u>=c?(i=0,n=c):n+u>=1?(i=(e*o-1)*sR(2,t),n+=u):(i=e*sR(2,u-1)*sR(2,t),n=0));t>=8;)a[h++]=255&i,i/=256,t-=8;for(n=n<<t|i,s+=t;s>0;)a[h++]=255&n,n/=256,s-=8;return a[--h]|=128*l,a},unpack:function(e,t){var r,n=e.length,i=8*n-t-1,o=(1<<i)-1,a=o>>1,s=i-7,c=n-1,u=e[c--],d=127&u;for(u>>=7;s>0;)d=256*d+e[c--],s-=8;for(r=d&(1<<-s)-1,d>>=-s,s+=t;s>0;)r=256*r+e[c--],s-=8;if(0===d)d=1-a;else{if(d===o)return r?NaN:u?-1/0:1/0;r+=sR(2,t),d-=a}return(u?-1:1)*r*sR(2,d-t)}},wR=Gu,CR=pd,OR=ei.f,xR=Pr.f,DR=pR,NR=rl,PR=ed,MR=gR.PROPER,LR=gR.CONFIGURABLE,UR=Ln.get,VR=Ln.set,FR="ArrayBuffer",BR="DataView",jR="Wrong index",GR=vR.ArrayBuffer,HR=GR,zR=HR&&HR.prototype,XR=vR.DataView,KR=XR&&XR.prototype,qR=Object.prototype,WR=vR.Array,YR=vR.RangeError,JR=_R(DR),QR=_R([].reverse),ZR=RR.pack,$R=RR.unpack,ew=function(e){return[255&e]},tw=function(e){return[255&e,e>>8&255]},rw=function(e){return[255&e,e>>8&255,e>>16&255,e>>24&255]},nw=function(e){return e[3]<<24|e[2]<<16|e[1]<<8|e[0]},iw=function(e){return ZR(e,23,4)},ow=function(e){return ZR(e,52,8)},aw=function(e,t){xR(e.prototype,t,{get:function(){return UR(this)[t]}})},sw=function(e,t,r,n){var i=AR(r),o=UR(e);if(i+t>o.byteLength)throw YR(jR);var a=UR(o.buffer).bytes,s=i+o.byteOffset,c=NR(a,s,s+t);return n?c:QR(c)},cw=function(e,t,r,n,i,o){var a=AR(r),s=UR(e);if(a+t>s.byteLength)throw YR(jR);for(var c=UR(s.buffer).bytes,u=a+s.byteOffset,d=n(+i),l=0;l<t;l++)c[u+l]=d[o?l:t-l-1]};if(yR){var uw=MR&&GR.name!==FR;if(ER((function(){GR(1)}))&&ER((function(){new GR(-1)}))&&!ER((function(){return new GR,new GR(1.5),new GR(NaN),1!=GR.length||uw&&!LR})))uw&&LR&&SR(GR,"name",FR);else{(HR=function(e){return kR(this,zR),new GR(AR(e))}).prototype=zR;for(var dw,lw=OR(GR),hw=0;lw.length>hw;)(dw=lw[hw++])in HR||SR(HR,dw,GR[dw]);zR.constructor=HR}CR&&wR(KR)!==qR&&CR(KR,qR);var fw=new XR(new HR(2)),pw=_R(KR.setInt8);fw.setInt8(0,2147483648),fw.setInt8(1,2147483649),!fw.getInt8(0)&&fw.getInt8(1)||bR(KR,{setInt8:function(e,t){pw(this,e,t<<24>>24)},setUint8:function(e,t){pw(this,e,t<<24>>24)}},{unsafe:!0})}else zR=(HR=function(e){kR(this,zR);var t=AR(e);VR(this,{bytes:JR(WR(t),0),byteLength:t}),mR||(this.byteLength=t)}).prototype,KR=(XR=function(e,t,r){kR(this,KR),kR(e,zR);var n=UR(e).byteLength,i=TR(t);if(i<0||i>n)throw YR("Wrong offset");if(i+(r=void 0===r?n-i:IR(r))>n)throw YR("Wrong length");VR(this,{buffer:e,byteLength:r,byteOffset:i}),mR||(this.buffer=e,this.byteLength=r,this.byteOffset=i)}).prototype,mR&&(aw(HR,"byteLength"),aw(XR,"buffer"),aw(XR,"byteLength"),aw(XR,"byteOffset")),bR(KR,{getInt8:function(e){return sw(this,1,e)[0]<<24>>24},getUint8:function(e){return sw(this,1,e)[0]},getInt16:function(e){var t=sw(this,2,e,arguments.length>1?arguments[1]:void 0);return(t[1]<<8|t[0])<<16>>16},getUint16:function(e){var t=sw(this,2,e,arguments.length>1?arguments[1]:void 0);return t[1]<<8|t[0]},getInt32:function(e){return nw(sw(this,4,e,arguments.length>1?arguments[1]:void 0))},getUint32:function(e){return nw(sw(this,4,e,arguments.length>1?arguments[1]:void 0))>>>0},getFloat32:function(e){return $R(sw(this,4,e,arguments.length>1?arguments[1]:void 0),23)},getFloat64:function(e){return $R(sw(this,8,e,arguments.length>1?arguments[1]:void 0),52)},setInt8:function(e,t){cw(this,1,e,ew,t)},setUint8:function(e,t){cw(this,1,e,ew,t)},setInt16:function(e,t){cw(this,2,e,tw,t,arguments.length>2?arguments[2]:void 0)},setUint16:function(e,t){cw(this,2,e,tw,t,arguments.length>2?arguments[2]:void 0)},setInt32:function(e,t){cw(this,4,e,rw,t,arguments.length>2?arguments[2]:void 0)},setUint32:function(e,t){cw(this,4,e,rw,t,arguments.length>2?arguments[2]:void 0)},setFloat32:function(e,t){cw(this,4,e,iw,t,arguments.length>2?arguments[2]:void 0)},setFloat64:function(e,t){cw(this,8,e,ow,t,arguments.length>2?arguments[2]:void 0)}});PR(HR,FR),PR(XR,BR);var vw={ArrayBuffer:HR,DataView:XR},_w=Je,mw=Math.floor,yw=Number.isInteger||function(e){return!_w(e)&&isFinite(e)&&mw(e)===e},gw=ii,Sw=RangeError,bw=function(e){var t=gw(e);if(t<0)throw Sw("The argument can't be less than 0");return t},Ew=RangeError,kw=function(e,t){var r=bw(e);if(r%t)throw Ew("Wrong offset");return r},Tw=So,Iw=Re("".slice),Aw=function(e){return"Big"===Iw(Tw(e),0,3)},Rw=vr,ww=TypeError,Cw=function(e){var t=Rw(e,"number");if("number"==typeof t)throw ww("Can't convert number to bigint");return BigInt(t)},Ow=ga,xw=ve,Dw=T_,Nw=Gt,Pw=fi,Mw=ql,Lw=Bl,Uw=Pl,Vw=Aw,Fw=qA.aTypedArrayConstructor,Bw=Cw,jw=ro,Gw=ce,Hw=ve,zw=le,Xw=eR,Kw=qA,qw=vw,Ww=ph,Yw=Ee,Jw=$r,Qw=yw,Zw=li,$w=iR,eC=kw,tC=yr,rC=Xt,nC=So,iC=Je,oC=yt,aC=cs,sC=tt,cC=pd,uC=ei.f,dC=function(e){var t,r,n,i,o,a,s,c,u=Dw(this),d=Nw(e),l=arguments.length,h=l>1?arguments[1]:void 0,f=void 0!==h,p=Lw(d);if(p&&!Uw(p))for(c=(s=Mw(d,p)).next,d=[];!(a=xw(c,s)).done;)d.push(a.value);for(f&&l>2&&(h=Ow(h,arguments[2])),r=Pw(d),n=new(Fw(u))(r),i=Vw(n),t=0;r>t;t++)o=f?h(d[t],t):d[t],n[t]=i?Bw(o):+o;return n},lC=Ra.forEach,hC=Kh,fC=Pr,pC=ue,vC=kh,_C=Ln.get,mC=Ln.set,yC=Ln.enforce,gC=fC.f,SC=pC.f,bC=Math.round,EC=Gw.RangeError,kC=qw.ArrayBuffer,TC=kC.prototype,IC=qw.DataView,AC=Kw.NATIVE_ARRAY_BUFFER_VIEWS,RC=Kw.TYPED_ARRAY_TAG,wC=Kw.TypedArray,CC=Kw.TypedArrayPrototype,OC=Kw.aTypedArrayConstructor,xC=Kw.isTypedArray,DC="BYTES_PER_ELEMENT",NC="Wrong length",PC=function(e,t){OC(e);for(var r=0,n=t.length,i=new e(n);n>r;)i[r]=t[r++];return i},MC=function(e,t){gC(e,t,{get:function(){return _C(this)[t]}})},LC=function(e){var t;return sC(TC,e)||"ArrayBuffer"==(t=nC(e))||"SharedArrayBuffer"==t},UC=function(e,t){return xC(e)&&!oC(t)&&t in e&&Qw(+t)&&t>=0},VC=function(e,t){return t=tC(t),UC(e,t)?Yw(2,e[t]):SC(e,t)},FC=function(e,t,r){return t=tC(t),!(UC(e,t)&&iC(r)&&rC(r,"value"))||rC(r,"get")||rC(r,"set")||r.configurable||rC(r,"writable")&&!r.writable||rC(r,"enumerable")&&!r.enumerable?gC(e,t,r):(e[t]=r.value,e)};zw?(AC||(pC.f=VC,fC.f=FC,MC(CC,"buffer"),MC(CC,"byteOffset"),MC(CC,"byteLength"),MC(CC,"length")),jw({target:"Object",stat:!0,forced:!AC},{getOwnPropertyDescriptor:VC,defineProperty:FC}),dA.exports=function(e,t,r){var n=e.match(/\d+$/)[0]/8,i=e+(r?"Clamped":"")+"Array",o="get"+e,a="set"+e,s=Gw[i],c=s,u=c&&c.prototype,d={},l=function(e,t){gC(e,t,{get:function(){return function(e,t){var r=_C(e);return r.view[o](t*n+r.byteOffset,!0)}(this,t)},set:function(e){return function(e,t,i){var o=_C(e);r&&(i=(i=bC(i))<0?0:i>255?255:255&i),o.view[a](t*n+o.byteOffset,i,!0)}(this,t,e)},enumerable:!0})};AC?Xw&&(c=t((function(e,t,r,i){return Ww(e,u),vC(iC(t)?LC(t)?void 0!==i?new s(t,eC(r,n),i):void 0!==r?new s(t,eC(r,n)):new s(t):xC(t)?PC(c,t):Hw(dC,c,t):new s($w(t)),e,c)})),cC&&cC(c,wC),lC(uC(s),(function(e){e in c||Jw(c,e,s[e])})),c.prototype=u):(c=t((function(e,t,r,i){Ww(e,u);var o,a,s,d=0,h=0;if(iC(t)){if(!LC(t))return xC(t)?PC(c,t):Hw(dC,c,t);o=t,h=eC(r,n);var f=t.byteLength;if(void 0===i){if(f%n)throw EC(NC);if((a=f-h)<0)throw EC(NC)}else if((a=Zw(i)*n)+h>f)throw EC(NC);s=a/n}else s=$w(t),o=new kC(a=s*n);for(mC(e,{buffer:o,byteOffset:h,byteLength:a,length:s,view:new IC(o)});d<s;)l(e,d++)})),cC&&cC(c,wC),u=c.prototype=aC(CC)),u.constructor!==c&&Jw(u,"constructor",c),yC(u).TypedArrayConstructor=c,RC&&Jw(u,RC,i);var h=c!=s;d[i]=c,jw({global:!0,constructor:!0,forced:h,sham:!AC},d),DC in c||Jw(c,DC,n),DC in u||Jw(u,DC,n),hC(i)}):dA.exports=function(){},(0,dA.exports)("Uint8",(function(e){return function(t,r,n){return e(this,t,r,n)}}));var BC=fi,jC=ii,GC=qA.aTypedArray;(0,qA.exportTypedArrayMethod)("at",(function(e){var t=GC(this),r=BC(t),n=jC(e),i=n>=0?n:r+n;return i<0||i>=r?void 0:t[i]}));var HC=Gt,zC=ci,XC=fi,KC=r_,qC=Math.min,WC=[].copyWithin||function(e,t){var r=HC(this),n=XC(r),i=zC(e,n),o=zC(t,n),a=arguments.length>2?arguments[2]:void 0,s=qC((void 0===a?n:zC(a,n))-o,n-i),c=1;for(o<i&&i<o+s&&(c=-1,o+=s-1,i+=s-1);s-- >0;)o in r?r[i]=r[o]:KC(r,i),i+=c,o+=c;return r},YC=qA,JC=Re(WC),QC=YC.aTypedArray;(0,YC.exportTypedArrayMethod)("copyWithin",(function(e,t){return JC(QC(this),e,t,arguments.length>2?arguments[2]:void 0)}));var ZC=Ra.every,$C=qA.aTypedArray;(0,qA.exportTypedArrayMethod)("every",(function(e){return ZC($C(this),e,arguments.length>1?arguments[1]:void 0)}));var eO=pR,tO=Cw,rO=So,nO=ve,iO=de,oO=qA.aTypedArray,aO=qA.exportTypedArrayMethod,sO=Re("".slice),cO=iO((function(){var e=0;return new Int8Array(2).fill({valueOf:function(){return e++}}),1!==e}));aO("fill",(function(e){var t=arguments.length;oO(this);var r="Big"===sO(rO(this),0,3)?tO(e):+e;return nO(eO,this,r,t>1?arguments[1]:void 0,t>2?arguments[2]:void 0)}),cO);var uO=fi,dO=function(e,t){for(var r=0,n=uO(t),i=new e(n);n>r;)i[r]=t[r++];return i},lO=C_,hO=qA.aTypedArrayConstructor,fO=qA.getTypedArrayConstructor,pO=function(e){return hO(lO(e,fO(e)))},vO=dO,_O=pO,mO=Ra.filter,yO=function(e,t){return vO(_O(e),t)},gO=qA.aTypedArray;(0,qA.exportTypedArrayMethod)("filter",(function(e){var t=mO(gO(this),e,arguments.length>1?arguments[1]:void 0);return yO(this,t)}));var SO=Ra.find,bO=qA.aTypedArray;(0,qA.exportTypedArrayMethod)("find",(function(e){return SO(bO(this),e,arguments.length>1?arguments[1]:void 0)}));var EO=Ra.findIndex,kO=qA.aTypedArray;(0,qA.exportTypedArrayMethod)("findIndex",(function(e){return EO(kO(this),e,arguments.length>1?arguments[1]:void 0)}));var TO=ga,IO=Le,AO=Gt,RO=fi,wO=function(e){var t=1==e;return function(r,n,i){for(var o,a=AO(r),s=IO(a),c=TO(n,i),u=RO(s);u-- >0;)if(c(o=s[u],u,a))switch(e){case 0:return o;case 1:return u}return t?-1:void 0}},CO={findLast:wO(0),findLastIndex:wO(1)},OO=CO.findLast,xO=qA.aTypedArray;(0,qA.exportTypedArrayMethod)("findLast",(function(e){return OO(xO(this),e,arguments.length>1?arguments[1]:void 0)}));var DO=CO.findLastIndex,NO=qA.aTypedArray;(0,qA.exportTypedArrayMethod)("findLastIndex",(function(e){return DO(NO(this),e,arguments.length>1?arguments[1]:void 0)}));var PO=Ra.forEach,MO=qA.aTypedArray;(0,qA.exportTypedArrayMethod)("forEach",(function(e){PO(MO(this),e,arguments.length>1?arguments[1]:void 0)}));var LO=yi.includes,UO=qA.aTypedArray;(0,qA.exportTypedArrayMethod)("includes",(function(e){return LO(UO(this),e,arguments.length>1?arguments[1]:void 0)}));var VO=yi.indexOf,FO=qA.aTypedArray;(0,qA.exportTypedArrayMethod)("indexOf",(function(e){return VO(FO(this),e,arguments.length>1?arguments[1]:void 0)}));var BO=ce,jO=de,GO=Re,HO=qA,zO=qd,XO=sr("iterator"),KO=BO.Uint8Array,qO=GO(zO.values),WO=GO(zO.keys),YO=GO(zO.entries),JO=HO.aTypedArray,QO=HO.exportTypedArrayMethod,ZO=KO&&KO.prototype,$O=!jO((function(){ZO[XO].call([1])})),ex=!!ZO&&ZO.values&&ZO[XO]===ZO.values&&"values"===ZO.values.name,tx=function(){return qO(JO(this))};QO("entries",(function(){return YO(JO(this))}),$O),QO("keys",(function(){return WO(JO(this))}),$O),QO("values",tx,$O||!ex,{name:"values"}),QO(XO,tx,$O||!ex,{name:"values"});var rx=qA.aTypedArray,nx=qA.exportTypedArrayMethod,ix=Re([].join);nx("join",(function(e){return ix(rx(this),e)}));var ox=Uf,ax=He,sx=ii,cx=fi,ux=Ca,dx=Math.min,lx=[].lastIndexOf,hx=!!lx&&1/[1].lastIndexOf(1,-0)<0,fx=ux("lastIndexOf"),px=hx||!fx?function(e){if(hx)return ox(lx,this,arguments)||0;var t=ax(this),r=cx(t),n=r-1;for(arguments.length>1&&(n=dx(n,sx(arguments[1]))),n<0&&(n=r+n);n>=0;n--)if(n in t&&t[n]===e)return n||0;return-1}:lx,vx=Uf,_x=px,mx=qA.aTypedArray;(0,qA.exportTypedArrayMethod)("lastIndexOf",(function(e){var t=arguments.length;return vx(_x,mx(this),t>1?[e,arguments[1]]:[e])}));var yx=Ra.map,gx=pO,Sx=qA.aTypedArray;(0,qA.exportTypedArrayMethod)("map",(function(e){return yx(Sx(this),e,arguments.length>1?arguments[1]:void 0,(function(e,t){return new(gx(e))(t)}))}));var bx=Ip.left,Ex=qA.aTypedArray;(0,qA.exportTypedArrayMethod)("reduce",(function(e){var t=arguments.length;return bx(Ex(this),e,t,t>1?arguments[1]:void 0)}));var kx=Ip.right,Tx=qA.aTypedArray;(0,qA.exportTypedArrayMethod)("reduceRight",(function(e){var t=arguments.length;return kx(Tx(this),e,t,t>1?arguments[1]:void 0)}));var Ix=qA.aTypedArray,Ax=qA.exportTypedArrayMethod,Rx=Math.floor;Ax("reverse",(function(){for(var e,t=this,r=Ix(t).length,n=Rx(r/2),i=0;i<n;)e=t[i],t[i++]=t[--r],t[r]=e;return t}));var wx=ce,Cx=ve,Ox=qA,xx=fi,Dx=kw,Nx=Gt,Px=de,Mx=wx.RangeError,Lx=wx.Int8Array,Ux=Lx&&Lx.prototype,Vx=Ux&&Ux.set,Fx=Ox.aTypedArray,Bx=Ox.exportTypedArrayMethod,jx=!Px((function(){var e=new Uint8ClampedArray(2);return Cx(Vx,e,{length:1,0:3},1),3!==e[1]})),Gx=jx&&Ox.NATIVE_ARRAY_BUFFER_VIEWS&&Px((function(){var e=new Lx(2);return e.set(1),e.set("2",1),0!==e[0]||2!==e[1]}));Bx("set",(function(e){Fx(this);var t=Dx(arguments.length>1?arguments[1]:void 0,1),r=Nx(e);if(jx)return Cx(Vx,this,r,t);var n=this.length,i=xx(r),o=0;if(i+t>n)throw Mx("Wrong length");for(;o<i;)this[t+o]=r[o++]}),!jx||Gx);var Hx=pO,zx=Nv,Xx=qA.aTypedArray;(0,qA.exportTypedArrayMethod)("slice",(function(e,t){for(var r=zx(Xx(this),e,t),n=Hx(this),i=0,o=r.length,a=new n(o);o>i;)a[i]=r[i++];return a}),de((function(){new Int8Array(1).slice()})));var Kx=Ra.some,qx=qA.aTypedArray;(0,qA.exportTypedArrayMethod)("some",(function(e){return Kx(qx(this),e,arguments.length>1?arguments[1]:void 0)}));var Wx=va,Yx=de,Jx=Tt,Qx=PI,Zx=LI,$x=UI,eD=ut,tD=FI,rD=qA.aTypedArray,nD=qA.exportTypedArrayMethod,iD=ce.Uint16Array,oD=iD&&Wx(iD.prototype.sort),aD=!(!oD||Yx((function(){oD(new iD(2),null)}))&&Yx((function(){oD(new iD(2),{})}))),sD=!!oD&&!Yx((function(){if(eD)return eD<74;if(Zx)return Zx<67;if($x)return!0;if(tD)return tD<602;var e,t,r=new iD(516),n=Array(516);for(e=0;e<516;e++)t=e%4,r[e]=515-e,n[e]=e-2*t+3;for(oD(r,(function(e,t){return(e/4|0)-(t/4|0)})),e=0;e<516;e++)if(r[e]!==n[e])return!0}));nD("sort",(function(e){return void 0!==e&&Jx(e),sD?oD(this,e):Qx(rD(this),function(e){return function(t,r){return void 0!==e?+e(t,r)||0:r!=r?-1:t!=t?1:0===t&&0===r?1/t>0&&1/r<0?1:-1:t>r}}(e))}),!sD||aD);var cD=Uf,uD=qA,dD=de,lD=Nv,hD=ce.Int8Array,fD=uD.aTypedArray,pD=uD.exportTypedArrayMethod,vD=[].toLocaleString,_D=!!hD&&dD((function(){vD.call(new hD(1))}));pD("toLocaleString",(function(){return cD(vD,_D?lD(fD(this)):fD(this),lD(arguments))}),dD((function(){return[1,2].toLocaleString()!=new hD([1,2]).toLocaleString()}))||!dD((function(){hD.prototype.toLocaleString.call([1,2])})));var mD=qA.exportTypedArrayMethod,yD=de,gD=Re,SD=ce.Uint8Array,bD=SD&&SD.prototype||{},ED=[].toString,kD=gD([].join);yD((function(){ED.call({})}))&&(ED=function(){return kD(this)});var TD=bD.toString!=ED;mD("toString",ED,TD);var ID=fi,AD=function(e,t){for(var r=ID(e),n=new t(r),i=0;i<r;i++)n[i]=e[r-i-1];return n},RD=qA.aTypedArray,wD=qA.getTypedArrayConstructor;(0,qA.exportTypedArrayMethod)("toReversed",(function(){return AD(RD(this),wD(this))}));var CD=Tt,OD=dO,xD=qA.aTypedArray,DD=qA.getTypedArrayConstructor,ND=qA.exportTypedArrayMethod,PD=Re(qA.TypedArrayPrototype.sort);ND("toSorted",(function(e){void 0!==e&&CD(e);var t=xD(this),r=OD(DD(t),t);return PD(r,e)}));var MD=fi,LD=ii,UD=RangeError,VD=function(e,t,r,n){var i=MD(e),o=LD(r),a=o<0?i+o:o;if(a>=i||a<0)throw UD("Incorrect index");for(var s=new t(i),c=0;c<i;c++)s[c]=c===a?n:e[c];return s},FD=Aw,BD=ii,jD=Cw,GD=qA.aTypedArray,HD=qA.getTypedArrayConstructor,zD=qA.exportTypedArrayMethod,XD=!!function(){try{new Int8Array(1).with(2,{valueOf:function(){throw 8}})}catch(T0){return 8===T0}}();zD("with",{with:function(e,t){var r=GD(this),n=BD(e),i=FD(r)?jD(t):+t;return VD(r,HD(r),n,i)}}.with,!XD);var KD=ro,qD=Ra.findIndex,WD=ps,YD="findIndex",JD=!0;YD in[]&&Array(1).findIndex((function(){JD=!1})),KD({target:"Array",proto:!0,forced:JD},{findIndex:function(e){return qD(this,e,arguments.length>1?arguments[1]:void 0)}}),WD(YD);var QD=ro,ZD=va,$D=ue.f,eN=li,tN=As,rN=ks,nN=Be,iN=ws,oN=ZD("".startsWith),aN=ZD("".slice),sN=Math.min,cN=iN("startsWith"),uN=!cN&&!!function(){var e=$D(String.prototype,"startsWith");return e&&!e.writable}();QD({target:"String",proto:!0,forced:!uN&&!cN},{startsWith:function(e){var t=tN(nN(this));rN(e);var r=eN(sN(arguments.length>1?arguments[1]:void 0,t.length)),n=tN(e);return oN?oN(t,n,r):aN(t,r,r+n.length)===n}});var dN=function(e){return e.INVALID_ENGINE="INVALID_ENGINE",e.INVALID_PARAMS="INVALID_PARAMS",e.INVOKED_BEFORE_JOIN_ROOM="INVOKED_BEFORE_JOIN_ROOM",e.INVALID_TOKEN="INVALID_TOKEN",e.EXPIRED_TOKEN="EXPIRED_TOKEN",e.JOIN_ROOM_FAILED="JOIN_ROOM_FAILED",e.UPDATE_TOKEN_WITH_INVALID_TOKEN="UPDATE_TOKEN_WITH_INVALID_TOKEN",e.UPDATE_TOKEN_BEFORE_JOIN="UPDATE_TOKEN_BEFORE_JOIN",e.REPEAT_JOIN="REPEAT_JOIN",e.REPEAT_PUBLISH="REPEAT_PUBLISH",e.REPEAT_PUSH="REPEAT_PUSH",e.REPEAT_PLAY="REPEAT_PLAY",e.PUBLISH_BEFORE_JOIN="PUBLISH_BEFORE_JOIN",e.UNPUBLISH_BEFORE_JOIN="UNPUBLISH_BEFORE_JOIN",e.SUBSCRIBE_BEFORE_JOIN="SUBSCRIBE_BEFORE_JOIN",e.UNSUBSCRIBE_BEFORE_JOIN="UNSUBSCRIBE_BEFORE_JOIN",e.NO_PUBLISH_PERMISSION="NO_PUBLISH_PERMISSION",e.STREAM_NOT_EXIST="STREAM_NOT_EXIST",e.EMPTY_STREAM="EMPTY_STREAM",e.NOT_CONNECTED_YET="NOT_CONNECTED_YET",e.IM_BEFORE_JOIN="IM_BEFORE_JOIN",e.USER_NOT_EXIST="USER_NOT_EXIST",e.ALREADY_IN_ROOM="ALREADY_IN_ROOM",e.KICKED_OUT="KICKED_OUT",e.ROOM_DISMISS="ROOM_DISMISS",e.TOKEN_EXPIRED="TOKEN_EXPIRED",e.DUPLICATE_LOGIN="DUPLICATE_LOGIN",e.INVOKED_BEFORE_CAPTURE="INVOKED_BEFORE_CAPTURE",e.REPEAT_CAPTURE="REPEAT_CAPTURE",e.GET_VIDEO_TRACK_FAILED="GET_VIDEO_TRACK_FAILED",e.GET_AUDIO_TRACK_FAILED="GET_AUDIO_TRACK_FAILED",e.GET_SCREEN_TRACK_FAILED="GET_SCREEN_TRACK_FAILED",e.STREAM_TYPE_NOT_MATCH="STREAM_TYPE_NOT_MATCH",e.CANT_FIND_DOM="CANT_FIND_DOM",e.INVALID_DEVICE_ID="INVALID_DEVICE_ID",e.NO_PERMISSION="NO_PERMISSION",e.NOT_SUPPORTED="NOT_SUPPORTED",e.INTERRUPT="INTERRUPT",e.ICE_SERVER_WRONG="ICE_SERVER_WRONG",e.ESTABLISH_DATACHANNEL_FAILED="ESTABLISH_DATACHANNEL_FAILED",e.LOAD_RESOURCES_FAILED="LOAD_RESOURCES_FAILED",e.SIGNALING_CHANNEL_NOT_OPEN="SIGNALING_CHANNEL_NOT_OPEN",e.TIME_OUT="TIME_OUT",e.REFUSE_OPERATION_IN_DISCONNECT="REFUSE_OPERATION_IN_DISCONNECT",e.ADD_TRANSCEIVER_FAILED="ADD_TRANSCEIVER_FAILED",e.UPDATE_TRACK_FAILED="UPDATE_TRACK_FAILED",e.PUBLISH_FAILED="PUBLISH_FAILED",e.UNPUBLISH_FAILED="UNPUBLISH_FAILED",e.SUBSCRIBE_FAILED="SUBSCRIBE_FAILED",e.UNSUBSCRIBE_FAILED="UNSUBSCRIBE_FAILED",e.OPERATION_CANCEL="OPERATION_CANCEL",e.START_CLOUD_PROXY_AFTER_JOIN="START_CLOUD_PROXY_AFTER_JOIN",e.STOP_CLOUD_PROXY_BEFORE_LEAVE="STOP_CLOUD_PROXY_BEFORE_LEAVE",e.UNEXPECTED_ERROR="UNEXPECTED_ERROR",e.REPEAT_DEVICE_TEST="REPEAT_DEVICE_TEST",e.AUDIO_DEVICE_TEST_FAILED="AUDIO_DEVICE_RECORD_FAILED",e.ALREADY_LOGIN="ALREADY_LOGIN",e.LOGIN_FAILED="LOGIN_FAILED",e.NOT_LOGIN="NOT_LOGIN",e.RTM_DUPLICATE_LOGIN="RTM_DUPLICATE_LOGIN",e.RTM_TOKEN_ERROR="RTM_TOKEN_ERROR",e.USER_MESSAGE_TIMEOUT="USER_MESSAGE_TIMEOUT",e.USER_MESSAGE_BROKEN="USER_MESSAGE_BROKEN",e.USER_MESSAGE_NO_RECEIVER="USER_MESSAGE_NO_RECEIVER",e.USER_MESSAGE_NO_RELAYPATH="USER_MESSAGE_NO_RELAYPATH",e.USER_MESSAGE_SEND_TO_SERVER_ERROR="USER_MESSAGE_SEND_TO_SERVER_ERROR",e.USER_MESSAGE_SERVER_RESPONSE_ERROR="USER_MESSAGE_SERVER_RESPONSE_ERROR",e.USER_MESSAGE_NOT_JOIN="USER_MESSAGE_NOT_JOIN",e.USER_MESSAGE_INIT="USER_MESSAGE_INIT",e.USER_MESSAGE_NO_CONNECTION="USER_MESSAGE_NO_CONNECTION",e.USER_MESSAGE_NOT_LOGIN="USER_MESSAGE_NOT_LOGIN",e.USER_MESSAGE_SERVER_PARAMS_NOTSET="USER_MESSAGE_SERVER_PARAMS_NOTSET",e.USER_MESSAGE_UNKNOWN="USER_MESSAGE_UNKNOWN",e.START_PUBLIC_STREAM_BEFORE_JOIN="START_PUBLIC_STREAM_BEFORE_JOIN",e.RECONNECT_FAILED="RECONNECT_FAILED",e}(dN||{}),lN=function(e){return e[e.AUDIO_MIXING_ERROR_OK=0]="AUDIO_MIXING_ERROR_OK",e[e.AUDIO_MIXING_ERROR_PRELOAD_FAILED=1]="AUDIO_MIXING_ERROR_PRELOAD_FAILED",e[e.AUDIO_MIXING_ERROR_START_FAILED=2]="AUDIO_MIXING_ERROR_START_FAILED",e[e.AUDIO_MIXING_ERROR_ID_NOT_FOUND=3]="AUDIO_MIXING_ERROR_ID_NOT_FOUND",e[e.AUDIO_MIXING_ERROR_SET_POSITION_FAILED=4]="AUDIO_MIXING_ERROR_SET_POSITION_FAILED",e[e.AUDIO_MIXING_ERROR_INVALID_VOLUME=5]="AUDIO_MIXING_ERROR_INVALID_VOLUME",e[e.AUDIO_MIXING_ERROR_LOAD_CONFLICT=6]="AUDIO_MIXING_ERROR_LOAD_CONFLICT",e[e.AUDIO_MIXING_ERROR_ID_TYPE_NOT_MATCH=7]="AUDIO_MIXING_ERROR_ID_TYPE_NOT_MATCH",e[e.AUDIO_MIXING_ERROR_ID_TYPE_INVALID_PITCH=8]="AUDIO_MIXING_ERROR_ID_TYPE_INVALID_PITCH",e[e.AUDIO_MIXING_ERROR_INVALID_AUDIO_TRACK=9]="AUDIO_MIXING_ERROR_INVALID_AUDIO_TRACK",e}(lN||{}),hN=l((function e(t,r,n){u(this,e),h(this,"code",void 0),h(this,"message",void 0),h(this,"error",void 0),this.code=t,this.message=r,this.error=n})),fN=le,pN=Re,vN=Ga,_N=He,mN=pN(_e.f),yN=pN([].push),gN=function(e){return function(t){for(var r,n=_N(t),i=vN(n),o=i.length,a=0,s=[];o>a;)r=i[a++],fN&&!mN(n,r)||yN(s,e?[r,n[r]]:n[r]);return s}},SN={entries:gN(!0),values:gN(!1)}.entries;ro({target:"Object",stat:!0},{entries:function(e){return SN(e)}});var bN=ii,EN=As,kN=Be,TN=RangeError,IN=Re,AN=li,RN=As,wN=function(e){var t=EN(kN(this)),r="",n=bN(e);if(n<0||n==1/0)throw TN("Wrong number of repetitions");for(;n>0;(n>>>=1)&&(t+=t))1&n&&(r+=t);return r},CN=Be,ON=IN(wN),xN=IN("".slice),DN=Math.ceil,NN=function(e){return function(t,r,n){var i,o,a=RN(CN(t)),s=AN(r),c=a.length,u=void 0===n?" ":RN(n);return s<=c||""==u?a:((o=ON(u,DN((i=s-c)/u.length))).length>i&&(o=xN(o,0,i)),e?a+o:o+a)}},PN={start:NN(!1),end:NN(!0)},MN=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(rt),LN=PN.end;ro({target:"String",proto:!0,forced:MN},{padEnd:function(e){return LN(this,e,arguments.length>1?arguments[1]:void 0)}});var UN=Cu;ro({target:"Number",stat:!0,forced:Number.parseInt!=UN},{parseInt:UN});var VN=Fr,FN=Ql,BN=ga,jN=ve,GN=Gt,HN=function(e,t,r,n){try{return n?t(VN(r)[0],r[1]):t(r)}catch(T0){FN(e,"throw",T0)}},zN=Pl,XN=Po,KN=fi,qN=lo,WN=ql,YN=Bl,JN=Array,QN=function(e){var t=GN(e),r=XN(this),n=arguments.length,i=n>1?arguments[1]:void 0,o=void 0!==i;o&&(i=BN(i,n>2?arguments[2]:void 0));var a,s,c,u,d,l,h=YN(t),f=0;if(!h||this===JN&&zN(h))for(a=KN(t),s=r?new this(a):JN(a);a>f;f++)l=o?i(t[f],f):t[f],qN(s,f,l);else for(d=(u=WN(t,h)).next,s=r?new this:[];!(c=jN(d,u)).done;f++)l=o?HN(u,i,[c.value,f],!0):c.value,qN(s,f,l);return s.length=f,s},ZN=QN;ro({target:"Array",stat:!0,forced:!gh((function(e){Array.from(e)}))},{from:ZN});var $N,eP=Math.log,tP=Math.LOG10E;ro({target:"Math",stat:!0},{log10:Math.log10||function(e){return eP(e)*tP}});var rP=new Uint8Array(16);function nP(){if(!$N&&!($N="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return $N(rP)}var iP=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function oP(e){return"string"==typeof e&&iP.test(e)}for(var aP,sP=[],cP=0;cP<256;++cP)sP.push((cP+256).toString(16).substr(1));function uP(e,t,r){var n=(e=e||{}).random||(e.rng||nP)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){r=r||0;for(var i=0;i<16;++i)t[r+i]=n[i];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=(sP[e[t+0]]+sP[e[t+1]]+sP[e[t+2]]+sP[e[t+3]]+"-"+sP[e[t+4]]+sP[e[t+5]]+"-"+sP[e[t+6]]+sP[e[t+7]]+"-"+sP[e[t+8]]+sP[e[t+9]]+"-"+sP[e[t+10]]+sP[e[t+11]]+sP[e[t+12]]+sP[e[t+13]]+sP[e[t+14]]+sP[e[t+15]]).toLowerCase();if(!oP(r))throw TypeError("Stringified UUID is invalid");return r}(n)}var dP=new TextDecoder,lP=new TextEncoder,hP=function(){return uP()},fP=function(){return Date.now()};function pP(e){for(var t=0,r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];for(var o=0,a=n;o<a.length;o++){var s=a[o];t+=s.length}for(var c=new e(t),u=0,d=0,l=n;d<l.length;d++){var h=l[d];c.set(h,u),u+=h.length}return c}var vP=function(){return"undefined"==typeof window},_P=function(){function e(){u(this,e)}var t,r;return l(e,null,[{key:"token2auth",value:function(t,r,n,i){return i?"Bearer ".concat(i):"Basic ".concat(e.createUnsafeToken(t,r,n))}},{key:"createUnsafeToken",value:function(e,t,r){return window.btoa([e,t,r].filter((function(e){return null!==e})).join(":"))}},{key:"merge",value:function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=0,i=Object.entries(t);n<i.length;n++){var o=E(i[n],2),s=o[0],c=o[1];null!==c&&"object"===a(c)?e.merge(t[s],r[s]):void 0!==r[s]&&(t[s]=r[s])}}},{key:"ab2str",value:function(e){return dP.decode(e)}},{key:"ab2obj",value:function(t){try{var r=e.ab2str(t);return JSON.parse(r)}catch(n){return{}}}},{key:"str2ab",value:function(e){return lP.encode(e).buffer}},{key:"ab2b64str",value:(r=c(o().mark((function e(t){var r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,new Promise((function(e){var r=new FileReader;r.onload=function(){return e(r.result)},r.readAsDataURL(new Blob([t]))}));case 2:return r=e.sent,e.abrupt("return",r.split(",",2)[1]);case 4:case"end":return e.stop()}}),e)}))),function(e){return r.apply(this,arguments)})},{key:"b64str2ab",value:(t=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",fetch("data:application/octet;base64,"+t).then((function(e){return e.arrayBuffer()})));case 1:case"end":return e.stop()}}),e)}))),function(e){return t.apply(this,arguments)})}]),e}();function mP(e){return new Promise((function(t,r){window.setTimeout(r,e)}))}function yP(){var e="none";return vP()||(null!==window.navigator.userAgent.match("Firefox")?e="mozilla":null!==window.navigator.userAgent.match("Chrome")?(e="chrome-stable",null!==window.navigator.userAgent.match("Electron")&&(e="electron")):(null!==window.navigator.userAgent.match("Safari")||null!==window.navigator.userAgent.match("AppleWebKit"))&&(e="safari")),e}var gP="mozilla"===yP(),SP="safari"===yP(),bP=0,EP=!vP()&&(null===(aP=navigator.userAgent.match(/version\/(\d+)/i))||void 0===aP?void 0:aP[1]);SP&&EP&&(bP=+EP);var kP=bP,TP=!vP()&&!!/(iPhone|iPad|iPod)/i.exec(navigator.userAgent);!vP()&&/(iPhone|iPod)/i.exec(navigator.userAgent);var IP=!vP()&&(!!/(iPad)/i.exec(navigator.userAgent)||/Macintosh/i.test(navigator.userAgent)&&"ontouchend"in document),AP=!vP()&&/MicroMessenger/i.test(navigator.userAgent),RP=!vP()&&/Android/i.test(navigator.userAgent),wP=!vP()&&navigator.userAgent.toLowerCase().includes("mobile"),CP=!vP()&&/chrome\/(86)|(87)|(88)|(89)|(90)|(91)|(92)/i.test(navigator.userAgent);function OP(){for(var e=(+"".concat(Math.random()).slice(-7).padEnd(7,"0")).toString(2).padEnd(28,"1").split(""),t=[];e.length;)t.push(e.splice(0,7));return t.map((function(e,r){var n=r===t.length-1?"0":"1";return Number.parseInt(n+e.join(""),2)}))}var xP=function(){return Math.floor(65535*Math.random())};function DP(e){return"string"==typeof e&&e.indexOf("__web__rtc__rtt__")>-1}function NP(e){return e.map((function e(t){if(null!=t&&t._reportName)return t._reportName;if(t instanceof HTMLElement)return t.toString();if(t instanceof ArrayBuffer||ArrayBuffer.isView(t)){var r=ArrayBuffer.isView(t)?t.buffer:t,n=r.byteLength,i=[];if(n>10){var o=new DataView(r),a=Array.from({length:5}).map((function(e,t){return o.getUint8(t)})),s=Array.from({length:5}).map((function(e,t){return n-1-t})).reverse().map((function(e){return o.getUint8(e)}));i=[].concat(k(a),["..."],k(s))}else i=Array.from(new Uint8Array(r));return"".concat(t.constructor.name,"(").concat(n,") [").concat(i.join(", "),"]")}if(t instanceof ImageData)return"ImageData";if(Array.isArray(t))return t.map(e);if("[object Object]"===Object.prototype.toString.call(t)){var c={};for(var u in t)c[u]=e(t[u]);return c}return t}))}var PP=function(){var e=c(o().mark((function e(){var t,r,n,i=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=i.length>0&&void 0!==i[0]&&i[0],e.prev=1,(r=new RTCPeerConnection({iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan"})).createDataChannel("default"),r.addTransceiver("audio",{direction:"recvonly"}),r.addTransceiver("video",{direction:"recvonly"}),t&&(r.addTransceiver("audio",{direction:"sendonly"}),r.addTransceiver("video",{direction:"sendonly"})),e.next=9,r.createOffer();case 9:return n=e.sent,r.close(),e.abrupt("return",n.sdp);case 14:e.prev=14,e.t0=e.catch(1);case 16:case"end":return e.stop()}}),e,null,[[1,14]])})));return function(){return e.apply(this,arguments)}}(),MP=function(e){return new Promise((function(t,r){var n=(e=Array.isArray(e)?e:[]).length,i=[];0===n?r([]):e.forEach((function(e){e.then((function(e){t(e)}),(function(e){n--,i.push(e),0===n&&r(i)}))}))}))};function LP(e){return+Math.max(-127,10*Math.log10(Math.pow(e/255,2))).toFixed(2)}function UP(e){return(e&U.AUDIO)===U.AUDIO}function VP(e){return(e&U.VIDEO)===U.VIDEO}function FP(e){var t={};return Object.keys(e).forEach((function(r){"object"===a(e[r])?t[r]=FP(e[r]):r.startsWith("_")||(t[r]=e[r])})),t}function BP(e){var t=new DataView(e.buffer);if(t.byteLength<=4||65535!==t.getUint16(0))return{seiCount:1,seis:[e]};for(var r={seiCount:0,seis:[]},n=!1,i=2;i<t.byteLength;){var o=t.getUint16(i);if(i+=2,t.byteLength-i<o){n=!0;break}var a=new Uint8Array(e.buffer,i,o);if(i+=o,t.byteLength-i>0&&t.byteLength-i<=2){n=!0;break}r.seiCount++,r.seis.push(a)}return n&&(r.seiCount=1,r.seis=[e]),r}function jP(e){return null==e?"undefined | null":"string"==typeof e?e:JSON.stringify({contentHint:e.contentHint,enabled:e.enabled,id:e.id,kind:e.kind,label:e.label,muted:e.muted,readyState:e.readyState})}function GP(e,t){if("boolean"!=typeof e)throw new hN(dN.INVALID_PARAMS,"Invalid ".concat(t,": The value should be boolean type."))}function HP(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Number.POSITIVE_INFINITY;if(e<r||e>n||"number"!=typeof e){var i=new hN(dN.INVALID_PARAMS,"Invalid ".concat(t,": the value range is [").concat(r,", ").concat(n,"]. integer only"));throw i}}function zP(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Number.POSITIVE_INFINITY;if(null==e)throw new hN(dN.INVALID_PARAMS,"".concat(t," cannot be empty"));if(!JP(e,r,n))throw new hN(dN.INVALID_PARAMS,"Invalid ".concat(t,": The value should be string type. Length of the string: [").concat(r,",").concat(n,"]"))}function XP(e,t,r){if(!r.includes(e))throw new hN(dN.INVALID_PARAMS,"Invalid ".concat(t,": The value can only be set as ").concat(JSON.stringify(r)))}function KP(e){if(!(e instanceof MediaStreamTrack))throw new hN(dN.INVALID_PARAMS,"Invalid track, The value should be MediaStreamTrack type.")}function qP(e,t){if(QP(e))throw new hN(dN.INVALID_PARAMS,"Invalid ".concat(t,", should not be empty"))}function WP(e,t){if(!(e instanceof ArrayBuffer))throw new hN(dN.INVALID_PARAMS,"Invalid ".concat(t,", should be ArrayBuffer"))}function YP(e){try{for(var t=navigator.mediaDevices.getSupportedConstraints(),r=0,n=Object.keys(e);r<n.length;r++){var i=n[r];t[i]||delete e[i]}}catch(o){}}function JP(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Number.POSITIVE_INFINITY;return"string"==typeof e&&e.length<=r&&e.length>=t}function QP(e){return null==e}function ZP(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new hN(dN.INVALID_PARAMS,"The RoomId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function $P(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new hN(dN.INVALID_PARAMS,"The userId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function eM(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new hN(dN.INVALID_PARAMS,"The publicStreamId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function tM(e){qP(e,"userInfo"),$P(e.userId),QP(e.extraInfo)||zP(e.extraInfo,"userInfo.extraInfo",1,200)}function rM(e){qP(e,"roomConfig"),GP(e.isAutoPublish,"roomConfig.isAutoPublish"),GP(e.isAutoSubscribeAudio,"roomConfig.isAutoSubscribeAudio"),GP(e.isAutoSubscribeVideo,"roomConfig.isAutoSubscribeVideo")}function nM(e){qP(e,"videoPlayerOption")}function iM(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:64;if(!e||0===(null==e?void 0:e.byteLength))throw new hN(dN.INVALID_PARAMS,"The message cannot be empty");if((null===(t=e instanceof ArrayBuffer?e:_P.str2ab(JSON.stringify(e)))||void 0===t?void 0:t.byteLength)>1e3*r)throw new hN(dN.INVALID_PARAMS,"The message length must be less than ".concat(r,"K"))}function oM(e){return![oe.onRemoteStreamStats,oe.onLocalStreamStats,oe.onAudioVolumeIndication,oe.onLocalAudioPropertiesReport,oe.onRemoteAudioPropertiesReport].includes(e)}function aM(e){if("number"!=typeof(null==e?void 0:e.width)||"number"!=typeof(null==e?void 0:e.height))throw new hN(dN.INVALID_PARAMS,"remoteVideoConfig must contain width, height, frameRate")}var sM={},cM=sr;sM.f=cM;var uM=ce,dM=Xt,lM=sM,hM=Pr.f,fM=function(e){var t=uM.Symbol||(uM.Symbol={});dM(t,e)||hM(t,e,{value:lM.f(e)})},pM=ve,vM=et,_M=sr,mM=$n,yM=ro,gM=ce,SM=ve,bM=Re,EM=le,kM=ht,TM=de,IM=Xt,AM=tt,RM=Fr,wM=He,CM=yr,OM=As,xM=Ee,DM=cs,NM=Ga,PM=ei,MM=Jd,LM=wi,UM=ue,VM=Pr,FM=Fa,BM=_e,jM=$n,GM=Dt.exports,HM=En,zM=Jt,XM=sr,KM=sM,qM=fM,WM=function(){var e=vM("Symbol"),t=e&&e.prototype,r=t&&t.valueOf,n=_M("toPrimitive");t&&!t[n]&&mM(t,n,(function(e){return pM(r,this)}),{arity:1})},YM=ed,JM=Ln,QM=Ra.forEach,ZM=bn("hidden"),$M="Symbol",eL=JM.set,tL=JM.getterFor($M),rL=Object.prototype,nL=gM.Symbol,iL=nL&&nL.prototype,oL=gM.TypeError,aL=gM.QObject,sL=UM.f,cL=VM.f,uL=MM.f,dL=BM.f,lL=bM([].push),hL=GM("symbols"),fL=GM("op-symbols"),pL=GM("wks"),vL=!aL||!aL.prototype||!aL.prototype.findChild,_L=EM&&TM((function(){return 7!=DM(cL({},"a",{get:function(){return cL(this,"a",{value:7}).a}})).a}))?function(e,t,r){var n=sL(rL,t);n&&delete rL[t],cL(e,t,r),n&&e!==rL&&cL(rL,t,n)}:cL,mL=function(e,t){var r=hL[e]=DM(iL);return eL(r,{type:$M,tag:e,description:t}),EM||(r.description=t),r},yL=function(e,t,r){e===rL&&yL(fL,t,r),RM(e);var n=CM(t);return RM(r),IM(hL,n)?(r.enumerable?(IM(e,ZM)&&e[ZM][n]&&(e[ZM][n]=!1),r=DM(r,{enumerable:xM(0,!1)})):(IM(e,ZM)||cL(e,ZM,xM(1,{})),e[ZM][n]=!0),_L(e,n,r)):cL(e,n,r)},gL=function(e,t){RM(e);var r=wM(t),n=NM(r).concat(kL(r));return QM(n,(function(t){EM&&!SM(SL,r,t)||yL(e,t,r[t])})),e},SL=function(e){var t=CM(e),r=SM(dL,this,t);return!(this===rL&&IM(hL,t)&&!IM(fL,t))&&(!(r||!IM(this,t)||!IM(hL,t)||IM(this,ZM)&&this[ZM][t])||r)},bL=function(e,t){var r=wM(e),n=CM(t);if(r!==rL||!IM(hL,n)||IM(fL,n)){var i=sL(r,n);return!i||!IM(hL,n)||IM(r,ZM)&&r[ZM][n]||(i.enumerable=!0),i}},EL=function(e){var t=uL(wM(e)),r=[];return QM(t,(function(e){IM(hL,e)||IM(HM,e)||lL(r,e)})),r},kL=function(e){var t=e===rL,r=uL(t?fL:wM(e)),n=[];return QM(r,(function(e){!IM(hL,e)||t&&!IM(rL,e)||lL(n,hL[e])})),n};kM||(nL=function(){if(AM(iL,this))throw oL("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?OM(arguments[0]):void 0,t=zM(e),r=function(e){this===rL&&SM(r,fL,e),IM(this,ZM)&&IM(this[ZM],t)&&(this[ZM][t]=!1),_L(this,t,xM(1,e))};return EM&&vL&&_L(rL,t,{configurable:!0,set:r}),mL(t,e)},jM(iL=nL.prototype,"toString",(function(){return tL(this).tag})),jM(nL,"withoutSetter",(function(e){return mL(zM(e),e)})),BM.f=SL,VM.f=yL,FM.f=gL,UM.f=bL,PM.f=MM.f=EL,LM.f=kL,KM.f=function(e){return mL(XM(e),e)},EM&&(cL(iL,"description",{configurable:!0,get:function(){return tL(this).description}}),jM(rL,"propertyIsEnumerable",SL,{unsafe:!0}))),yM({global:!0,constructor:!0,wrap:!0,forced:!kM,sham:!kM},{Symbol:nL}),QM(NM(pL),(function(e){qM(e)})),yM({target:$M,stat:!0,forced:!kM},{useSetter:function(){vL=!0},useSimple:function(){vL=!1}}),yM({target:"Object",stat:!0,forced:!kM,sham:!EM},{create:function(e,t){return void 0===t?DM(e):gL(DM(e),t)},defineProperty:yL,defineProperties:gL,getOwnPropertyDescriptor:bL}),yM({target:"Object",stat:!0,forced:!kM},{getOwnPropertyNames:EL}),WM(),YM(nL,$M),HM[ZM]=!0;var TL=ht&&!!Symbol.for&&!!Symbol.keyFor,IL=ro,AL=et,RL=Xt,wL=As,CL=Dt.exports,OL=TL,xL=CL("string-to-symbol-registry"),DL=CL("symbol-to-string-registry");IL({target:"Symbol",stat:!0,forced:!OL},{for:function(e){var t=wL(e);if(RL(xL,t))return xL[t];var r=AL("Symbol")(t);return xL[t]=r,DL[r]=t,r}});var NL=ro,PL=Xt,ML=yt,LL=St,UL=TL,VL=(0,Dt.exports)("symbol-to-string-registry");NL({target:"Symbol",stat:!0,forced:!UL},{keyFor:function(e){if(!ML(e))throw TypeError(LL(e)+" is not a symbol");if(PL(VL,e))return VL[e]}});var FL=wi,BL=Gt;ro({target:"Object",stat:!0,forced:!ht||de((function(){FL.f(1)}))},{getOwnPropertySymbols:function(e){var t=FL.f;return t?t(BL(e)):[]}});var jL={exports:{}};!function(e){var t=Object.prototype.hasOwnProperty,r="~";function n(){}function i(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function o(e,t,n,o,a){if("function"!=typeof n)throw new TypeError("The listener must be a function");var s=new i(n,o||e,a),c=r?r+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 a(e,t){0==--e._eventsCount?e._events=new n:delete e._events[t]}function s(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(r=!1)),s.prototype.eventNames=function(){var e,n,i=[];if(0===this._eventsCount)return i;for(n in e=this._events)t.call(e,n)&&i.push(r?n.slice(1):n);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},s.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,o=n.length,a=new Array(o);i<o;i++)a[i]=n[i].fn;return a},s.prototype.listenerCount=function(e){var t=r?r+e:e,n=this._events[t];return n?n.fn?1:n.length:0},s.prototype.emit=function(e,t,n,i,o,a){var s=r?r+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,n),!0;case 4:return d.fn.call(d.context,t,n,i),!0;case 5:return d.fn.call(d.context,t,n,i,o),!0;case 6:return d.fn.call(d.context,t,n,i,o,a),!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,f=d.length;for(u=0;u<f;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,n);break;case 4:d[u].fn.call(d[u].context,t,n,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,r){return o(this,e,t,r,!1)},s.prototype.once=function(e,t,r){return o(this,e,t,r,!0)},s.prototype.removeListener=function(e,t,n,i){var o=r?r+e:e;if(!this._events[o])return this;if(!t)return a(this,o),this;var s=this._events[o];if(s.fn)s.fn!==t||i&&!s.once||n&&s.context!==n||a(this,o);else{for(var c=0,u=[],d=s.length;c<d;c++)(s[c].fn!==t||i&&!s[c].once||n&&s[c].context!==n)&&u.push(s[c]);u.length?this._events[o]=1===u.length?u[0]:u:a(this,o)}return this},s.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&a(this,t)):(this._events=new n,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=r,s.EventEmitter=s,e.exports=s}(jL);var GL=jL.exports,HL="@byted/ve-rtc",zL="@byted/ve-rtc-cache-size",XL=function(){function e(){u(this,e),h(this,"storeKey",void 0),h(this,"logLevel",void 0),h(this,"LogfileSize",void 0),h(this,"db",void 0),h(this,"logId",void 0),h(this,"cacheLog",void 0),h(this,"cachedSize",void 0),h(this,"preCacheTime",void 0),h(this,"timer",void 0),h(this,"_getSize",(function(e){return new Blob(e).size/1048576})),this.storeKey="",this.logId=1,this.cacheLog="",this.logLevel="none",this.LogfileSize=100,this._createStore()}return l(e,[{key:"_createStore",value:function(){var e=this;if(!vP()){var t=indexedDB.open("@byted/ve-rtc");t.onupgradeneeded=function(){t.result.createObjectStore(HL);try{localStorage.removeItem(zL)}catch(T0){}},t.onerror=function(e){},t.onsuccess=function(){e.db=t.result,e._getCachedSize()}}}},{key:"_getCachedSize",value:function(){var e=this;try{var t=localStorage.getItem(zL);t?this.cachedSize=+t:this.values().then((function(t){e.cachedSize=e._getSize(t),e._setCachedSize()}))}catch(T0){}}},{key:"_setCachedSize",value:function(){try{localStorage.setItem(zL,"".concat(this.cachedSize))}catch(T0){}}},{key:"_getStore",value:function(e){if(this.db)return this.db.transaction(HL,e).objectStore(HL)}},{key:"set",value:function(e){var t=this;return new Promise((function(r,n){if("none"===t.logLevel)return r();if(e&&t.preCacheTime&&t.preCacheTime-Date.now()<1e3)return t.cacheLog+="\n\n".concat(t.logId,": ").concat(e),t.logId++,t.timer||(t.timer=setTimeout((function(){t.set("")}),1e3-(t.preCacheTime-Date.now()))),r();clearTimeout(t.timer),t.timer=null;var i=t._getStore("readwrite");if(!i)return n("get store fail");t.cachedSize&&t.cachedSize>t.LogfileSize&&t.keyEarliest().then((function(e){t.get(e).then((function(r){t.del(e).then((function(){t.cachedSize=t.cachedSize-t._getSize(["".concat(r)]),t._setCachedSize()}))}))}));var o=i.get(t.storeKey);o.onsuccess=function(){try{var a="".concat(o.result||"").concat(t.cacheLog),s=e?"".concat(a?"\n\n":"").concat(t.logId,": ").concat(e):"";i.put("".concat(a).concat(s),t.storeKey),e&&t.logId++,t.cacheLog="",t.cachedSize=(t.cachedSize||0)+t._getSize(["".concat(t.cacheLog).concat(s)]),t._setCachedSize(),t.preCacheTime=Date.now(),r()}catch(c){if(!e)return n(c);t.cacheLog+="\n\n".concat(t.logId,": ").concat(e),t.logId++,n(c)}},o.onerror=function(r){if(!e)return n(r);t.cacheLog+="\n\n".concat(t.logId,": ").concat(e),t.logId++,n(r)}}))}},{key:"get",value:function(e){var t=this;return new Promise((function(r,n){var i=t._getStore("readonly");if(!i)return n();var o=i.get(e);o.onsuccess=function(){r(o.result)},o.onerror=function(e){n(e)}}))}},{key:"del",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.storeKey;return new Promise((function(r,n){var i=e._getStore("readwrite");if(!i)return n();var o=i.delete(t);o.onsuccess=function(){return r(o.result)},o.onerror=function(e){return n(e)}}))}},{key:"keyEarliest",value:function(){return this.keys().then((function(e){var t,r=Date.now();return e.forEach((function(e){if(e&&e.length){var n=e.split("-")[0];Number(n)<r&&(r=Number(n),t=e)}})),t}))}},{key:"keys",value:function(){var e=this;return new Promise((function(t,r){var n=e._getStore("readonly");if(!n)return r();if(n.getAllKeys){var i=n.getAllKeys();return i.onsuccess=function(){t(i.result)},void(i.onerror=function(){r()})}var o=[];n.openCursor().onsuccess=function(){this.result&&(o.push(this.result.key),this.result.continue())},n.transaction.oncomplete=function(){return t(o)}}))}},{key:"values",value:function(){var e=this;return new Promise((function(t,r){var n=e._getStore("readonly");if(!n)return r();if(n.getAll){var i=n.getAll();return i.onsuccess=function(){t(i.result)},void(i.onerror=function(){r()})}var o=[];n.openCursor().onsuccess=function(){this.result&&(o.push(this.result.value),this.result.continue())},n.transaction.oncomplete=function(){return t(o)}}))}},{key:"download",value:function(e){e=e||this.storeKey,this.get(e).then((function(t){var r=document.createElement("a");r.download="".concat(e,".txt"),r.href="data:text/paint;utf-8,"+(t||""),r.click()}))}}]),e}(),KL=new XL,qL="[VERTC]",WL=["#0050b3","#0050b3","#0050b3","#0050b3","#0050b3"],YL=!vP()&&window.location.search.includes("_rtc_debug_"),JL=function(){function e(t,r,n){u(this,e),h(this,"_indent",void 0),h(this,"_module",void 0),h(this,"_id",void 0),this._module=t,this._indent=r}return l(e,[{key:"print",value:function(e){for(var t,r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];var o=n.shift();try{var a=[].concat(n),s="".concat(o).replace(/\%o/gi,(function(){var e=a.shift();return JSON.stringify(e)}));KL.set("".concat(qL,"[").concat(this._module,".").concat(e,"] ").concat(s," ").concat(a.map((function(e){return JSON.stringify(e)})).join(", ")))}catch(T0){}if(YL){for(var c="",u=0;u<this._indent;u++)c+=" ";(t=console).log.apply(t,["%c".concat(QL(),"-").concat(qL).concat(c,"[").concat(this._module,".").concat(e,"] ").concat(o),"color:".concat(WL[this._indent],";")].concat(n))}}}]),e}(),QL=function(){var e=new Date;return e.toTimeString().split(" ")[0]+":"+e.getMilliseconds()},ZL=new JL("VERTC",0),$L=function(e){f(r,e);var t=g(r);function r(){return u(this,r),t.apply(this,arguments)}return l(r,[{key:"safeEmit",value:function(e){var t=this.listenerCount(e);try{for(var n,i=arguments.length,o=new Array(i>1?i-1:0),a=1;a<i;a++)o[a-1]=arguments[a];return(n=b(p(r.prototype),"emit",this)).call.apply(n,[this,e].concat(o))}catch(T0){return ZL.print("safaEmit","safeEmit() | event listener threw an error [event:%s]:%o",e,T0),console.error(T0),Boolean(t)}}}]),r}(jL.exports.EventEmitter),eU=Xt,tU=function(e){return void 0!==e&&(eU(e,"value")||eU(e,"writable"))},rU=ve,nU=Je,iU=Fr,oU=tU,aU=ue,sU=Gu;ro({target:"Reflect",stat:!0},{get:function e(t,r){var n,i,o=arguments.length<3?t:arguments[2];return iU(t)===o?t[r]:(n=aU.f(t,r))?oU(n)?n.value:void 0===n.get?void 0:rU(n.get,o):nU(i=sU(t))?e(i,r,o):void 0}});var cU=ce,uU=ed;ro({global:!0},{Reflect:{}}),uU(cU.Reflect,"Reflect",!0);var dU=ve,lU=Fr,hU=Je,fU=tU,pU=Pr,vU=ue,_U=Gu,mU=Ee;ro({target:"Reflect",stat:!0,forced:de((function(){var e=function(){},t=pU.f(new e,"a",{configurable:!0});return!1!==Reflect.set(e.prototype,"a",1,t)}))},{set:function e(t,r,n){var i,o,a,s=arguments.length<4?t:arguments[3],c=vU.f(lU(t),r);if(!c){if(hU(o=_U(t)))return e(o,r,n,s);c=mU(0)}if(fU(c)){if(!1===c.writable||!hU(s))return!1;if(i=vU.f(s,r)){if(i.get||i.set||!1===i.writable)return!1;i.value=n,pU.f(s,r,i)}else pU.f(s,r,mU(0,n))}else{if(void 0===(a=c.set))return!1;dU(a,s,n)}return!0}});var yU=ro,gU=Gt,SU=fi,bU=sv,EU=r_,kU=ao,TU=1!==[].unshift(0),IU=!function(){try{Object.defineProperty([],"length",{writable:!1}).unshift()}catch(T0){return T0 instanceof TypeError}}();yU({target:"Array",proto:!0,arity:1,forced:TU||IU},{unshift:function(e){var t=gU(this),r=SU(t),n=arguments.length;if(n){kU(r+n);for(var i=r;i--;){var o=i+n;i in t?t[o]=t[i]:EU(t,o)}for(var a=0;a<n;a++)t[a]=arguments[a]}return bU(t,r+n)}}),(0,dA.exports)("Uint16",(function(e){return function(t,r,n){return e(this,t,r,n)}})),(0,dA.exports)("Int32",(function(e){return function(t,r,n){return e(this,t,r,n)}}));var AU={};!function(e){var t="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;function r(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var n=t.shift();if(n){if("object"!==a(n))throw new TypeError(n+"must be non-object");for(var i in n)r(n,i)&&(e[i]=n[i])}}return e},e.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var n={arraySet:function(e,t,r,n,i){if(t.subarray&&e.subarray)e.set(t.subarray(r,r+n),i);else for(var o=0;o<n;o++)e[i+o]=t[r+o]},flattenChunks:function(e){var t,r,n,i,o,a;for(n=0,t=0,r=e.length;t<r;t++)n+=e[t].length;for(a=new Uint8Array(n),i=0,t=0,r=e.length;t<r;t++)o=e[t],a.set(o,i),i+=o.length;return a}},i={arraySet:function(e,t,r,n,i){for(var o=0;o<n;o++)e[i+o]=t[r+o]},flattenChunks:function(e){return[].concat.apply([],e)}};e.setTyped=function(t){t?(e.Buf8=Uint8Array,e.Buf16=Uint16Array,e.Buf32=Int32Array,e.assign(e,n)):(e.Buf8=Array,e.Buf16=Array,e.Buf32=Array,e.assign(e,i))},e.setTyped(t)}(AU);var RU={},wU={},CU={},OU=AU;function xU(e){for(var t=e.length;--t>=0;)e[t]=0}var DU=256,NU=286,PU=30,MU=15,LU=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],UU=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],VU=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],FU=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],BU=new Array(576);xU(BU);var jU=new Array(60);xU(jU);var GU=new Array(512);xU(GU);var HU=new Array(256);xU(HU);var zU=new Array(29);xU(zU);var XU,KU,qU,WU=new Array(PU);function YU(e,t,r,n,i){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=n,this.max_length=i,this.has_stree=e&&e.length}function JU(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function QU(e){return e<256?GU[e]:GU[256+(e>>>7)]}function ZU(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function $U(e,t,r){e.bi_valid>16-r?(e.bi_buf|=t<<e.bi_valid&65535,ZU(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=r-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=r)}function eV(e,t,r){$U(e,r[2*t],r[2*t+1])}function tV(e,t){var r=0;do{r|=1&e,e>>>=1,r<<=1}while(--t>0);return r>>>1}function rV(e,t,r){var n,i,o=new Array(16),a=0;for(n=1;n<=MU;n++)o[n]=a=a+r[n-1]<<1;for(i=0;i<=t;i++){var s=e[2*i+1];0!==s&&(e[2*i]=tV(o[s]++,s))}}function nV(e){var t;for(t=0;t<NU;t++)e.dyn_ltree[2*t]=0;for(t=0;t<PU;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function iV(e){e.bi_valid>8?ZU(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function oV(e,t,r,n){var i=2*t,o=2*r;return e[i]<e[o]||e[i]===e[o]&&n[t]<=n[r]}function aV(e,t,r){for(var n=e.heap[r],i=r<<1;i<=e.heap_len&&(i<e.heap_len&&oV(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!oV(t,n,e.heap[i],e.depth));)e.heap[r]=e.heap[i],r=i,i<<=1;e.heap[r]=n}function sV(e,t,r){var n,i,o,a,s=0;if(0!==e.last_lit)do{n=e.pending_buf[e.d_buf+2*s]<<8|e.pending_buf[e.d_buf+2*s+1],i=e.pending_buf[e.l_buf+s],s++,0===n?eV(e,i,t):(eV(e,(o=HU[i])+DU+1,t),0!==(a=LU[o])&&$U(e,i-=zU[o],a),eV(e,o=QU(--n),r),0!==(a=UU[o])&&$U(e,n-=WU[o],a))}while(s<e.last_lit);eV(e,256,t)}function cV(e,t){var r,n,i,o=t.dyn_tree,a=t.stat_desc.static_tree,s=t.stat_desc.has_stree,c=t.stat_desc.elems,u=-1;for(e.heap_len=0,e.heap_max=573,r=0;r<c;r++)0!==o[2*r]?(e.heap[++e.heap_len]=u=r,e.depth[r]=0):o[2*r+1]=0;for(;e.heap_len<2;)o[2*(i=e.heap[++e.heap_len]=u<2?++u:0)]=1,e.depth[i]=0,e.opt_len--,s&&(e.static_len-=a[2*i+1]);for(t.max_code=u,r=e.heap_len>>1;r>=1;r--)aV(e,o,r);i=c;do{r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],aV(e,o,1),n=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=n,o[2*i]=o[2*r]+o[2*n],e.depth[i]=(e.depth[r]>=e.depth[n]?e.depth[r]:e.depth[n])+1,o[2*r+1]=o[2*n+1]=i,e.heap[1]=i++,aV(e,o,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],function(e,t){var r,n,i,o,a,s,c=t.dyn_tree,u=t.max_code,d=t.stat_desc.static_tree,l=t.stat_desc.has_stree,h=t.stat_desc.extra_bits,f=t.stat_desc.extra_base,p=t.stat_desc.max_length,v=0;for(o=0;o<=MU;o++)e.bl_count[o]=0;for(c[2*e.heap[e.heap_max]+1]=0,r=e.heap_max+1;r<573;r++)(o=c[2*c[2*(n=e.heap[r])+1]+1]+1)>p&&(o=p,v++),c[2*n+1]=o,n>u||(e.bl_count[o]++,a=0,n>=f&&(a=h[n-f]),s=c[2*n],e.opt_len+=s*(o+a),l&&(e.static_len+=s*(d[2*n+1]+a)));if(0!==v){do{for(o=p-1;0===e.bl_count[o];)o--;e.bl_count[o]--,e.bl_count[o+1]+=2,e.bl_count[p]--,v-=2}while(v>0);for(o=p;0!==o;o--)for(n=e.bl_count[o];0!==n;)(i=e.heap[--r])>u||(c[2*i+1]!==o&&(e.opt_len+=(o-c[2*i+1])*c[2*i],c[2*i+1]=o),n--)}}(e,t),rV(o,u,e.bl_count)}function uV(e,t,r){var n,i,o=-1,a=t[1],s=0,c=7,u=4;for(0===a&&(c=138,u=3),t[2*(r+1)+1]=65535,n=0;n<=r;n++)i=a,a=t[2*(n+1)+1],++s<c&&i===a||(s<u?e.bl_tree[2*i]+=s:0!==i?(i!==o&&e.bl_tree[2*i]++,e.bl_tree[32]++):s<=10?e.bl_tree[34]++:e.bl_tree[36]++,s=0,o=i,0===a?(c=138,u=3):i===a?(c=6,u=3):(c=7,u=4))}function dV(e,t,r){var n,i,o=-1,a=t[1],s=0,c=7,u=4;for(0===a&&(c=138,u=3),n=0;n<=r;n++)if(i=a,a=t[2*(n+1)+1],!(++s<c&&i===a)){if(s<u)do{eV(e,i,e.bl_tree)}while(0!=--s);else 0!==i?(i!==o&&(eV(e,i,e.bl_tree),s--),eV(e,16,e.bl_tree),$U(e,s-3,2)):s<=10?(eV(e,17,e.bl_tree),$U(e,s-3,3)):(eV(e,18,e.bl_tree),$U(e,s-11,7));s=0,o=i,0===a?(c=138,u=3):i===a?(c=6,u=3):(c=7,u=4)}}xU(WU);var lV=!1;function hV(e,t,r,n){$U(e,0+(n?1:0),3),function(e,t,r,n){iV(e),n&&(ZU(e,r),ZU(e,~r)),OU.arraySet(e.pending_buf,e.window,t,r,e.pending),e.pending+=r}(e,t,r,!0)}CU._tr_init=function(e){lV||(!function(){var e,t,r,n,i,o=new Array(16);for(r=0,n=0;n<28;n++)for(zU[n]=r,e=0;e<1<<LU[n];e++)HU[r++]=n;for(HU[r-1]=n,i=0,n=0;n<16;n++)for(WU[n]=i,e=0;e<1<<UU[n];e++)GU[i++]=n;for(i>>=7;n<PU;n++)for(WU[n]=i<<7,e=0;e<1<<UU[n]-7;e++)GU[256+i++]=n;for(t=0;t<=MU;t++)o[t]=0;for(e=0;e<=143;)BU[2*e+1]=8,e++,o[8]++;for(;e<=255;)BU[2*e+1]=9,e++,o[9]++;for(;e<=279;)BU[2*e+1]=7,e++,o[7]++;for(;e<=287;)BU[2*e+1]=8,e++,o[8]++;for(rV(BU,287,o),e=0;e<PU;e++)jU[2*e+1]=5,jU[2*e]=tV(e,5);XU=new YU(BU,LU,257,NU,MU),KU=new YU(jU,UU,0,PU,MU),qU=new YU(new Array(0),VU,0,19,7)}(),lV=!0),e.l_desc=new JU(e.dyn_ltree,XU),e.d_desc=new JU(e.dyn_dtree,KU),e.bl_desc=new JU(e.bl_tree,qU),e.bi_buf=0,e.bi_valid=0,nV(e)},CU._tr_stored_block=hV,CU._tr_flush_block=function(e,t,r,n){var i,o,a=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=function(e){var t,r=4093624447;for(t=0;t<=31;t++,r>>>=1)if(1&r&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<DU;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0}(e)),cV(e,e.l_desc),cV(e,e.d_desc),a=function(e){var t;for(uV(e,e.dyn_ltree,e.l_desc.max_code),uV(e,e.dyn_dtree,e.d_desc.max_code),cV(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*FU[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),i=e.opt_len+3+7>>>3,(o=e.static_len+3+7>>>3)<=i&&(i=o)):i=o=r+5,r+4<=i&&-1!==t?hV(e,t,r,n):4===e.strategy||o===i?($U(e,2+(n?1:0),3),sV(e,BU,jU)):($U(e,4+(n?1:0),3),function(e,t,r,n){var i;for($U(e,t-257,5),$U(e,r-1,5),$U(e,n-4,4),i=0;i<n;i++)$U(e,e.bl_tree[2*FU[i]+1],3);dV(e,e.dyn_ltree,t-1),dV(e,e.dyn_dtree,r-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),sV(e,e.dyn_ltree,e.dyn_dtree)),nV(e),n&&iV(e)},CU._tr_tally=function(e,t,r){return e.pending_buf[e.d_buf+2*e.last_lit]=t>>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&r,e.last_lit++,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(HU[r]+DU+1)]++,e.dyn_dtree[2*QU(t)]++),e.last_lit===e.lit_bufsize-1},CU._tr_align=function(e){$U(e,2,3),eV(e,256,BU),function(e){16===e.bi_valid?(ZU(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}(e)};var fV=function(e,t,r,n){for(var i=65535&e|0,o=e>>>16&65535|0,a=0;0!==r;){r-=a=r>2e3?2e3:r;do{o=o+(i=i+t[n++]|0)|0}while(--a);i%=65521,o%=65521}return i|o<<16|0};var pV=function(){for(var e,t=[],r=0;r<256;r++){e=r;for(var n=0;n<8;n++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t}();var vV,_V=function(e,t,r,n){var i=pV,o=n+r;e^=-1;for(var a=n;a<o;a++)e=e>>>8^i[255&(e^t[a])];return-1^e},mV={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},yV=AU,gV=CU,SV=fV,bV=_V,EV=mV,kV=-2,TV=258,IV=262,AV=103,RV=113,wV=666;function CV(e,t){return e.msg=EV[t],t}function OV(e){return(e<<1)-(e>4?9:0)}function xV(e){for(var t=e.length;--t>=0;)e[t]=0}function DV(e){var t=e.state,r=t.pending;r>e.avail_out&&(r=e.avail_out),0!==r&&(yV.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))}function NV(e,t){gV._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,DV(e.strm)}function PV(e,t){e.pending_buf[e.pending++]=t}function MV(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function LV(e,t){var r,n,i=e.max_chain_length,o=e.strstart,a=e.prev_length,s=e.nice_match,c=e.strstart>e.w_size-IV?e.strstart-(e.w_size-IV):0,u=e.window,d=e.w_mask,l=e.prev,h=e.strstart+TV,f=u[o+a-1],p=u[o+a];e.prev_length>=e.good_match&&(i>>=2),s>e.lookahead&&(s=e.lookahead);do{if(u[(r=t)+a]===p&&u[r+a-1]===f&&u[r]===u[o]&&u[++r]===u[o+1]){o+=2,r++;do{}while(u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&o<h);if(n=TV-(h-o),o=h-TV,n>a){if(e.match_start=t,a=n,n>=s)break;f=u[o+a-1],p=u[o+a]}}}while((t=l[t&d])>c&&0!=--i);return a<=e.lookahead?a:e.lookahead}function UV(e){var t,r,n,i,o,a,s,c,u,d,l=e.w_size;do{if(i=e.window_size-e.lookahead-e.strstart,e.strstart>=l+(l-IV)){yV.arraySet(e.window,e.window,l,l,0),e.match_start-=l,e.strstart-=l,e.block_start-=l,t=r=e.hash_size;do{n=e.head[--t],e.head[t]=n>=l?n-l:0}while(--r);t=r=l;do{n=e.prev[--t],e.prev[t]=n>=l?n-l:0}while(--r);i+=l}if(0===e.strm.avail_in)break;if(a=e.strm,s=e.window,c=e.strstart+e.lookahead,u=i,d=void 0,(d=a.avail_in)>u&&(d=u),r=0===d?0:(a.avail_in-=d,yV.arraySet(s,a.input,a.next_in,d,c),1===a.state.wrap?a.adler=SV(a.adler,s,d,c):2===a.state.wrap&&(a.adler=bV(a.adler,s,d,c)),a.next_in+=d,a.total_in+=d,d),e.lookahead+=r,e.lookahead+e.insert>=3)for(o=e.strstart-e.insert,e.ins_h=e.window[o],e.ins_h=(e.ins_h<<e.hash_shift^e.window[o+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[o+3-1])&e.hash_mask,e.prev[o&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=o,o++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<IV&&0!==e.strm.avail_in)}function VV(e,t){for(var r,n;;){if(e.lookahead<IV){if(UV(e),e.lookahead<IV&&0===t)return 1;if(0===e.lookahead)break}if(r=0,e.lookahead>=3&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==r&&e.strstart-r<=e.w_size-IV&&(e.match_length=LV(e,r)),e.match_length>=3)if(n=gV._tr_tally(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart}while(0!=--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else n=gV._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(n&&(NV(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,4===t?(NV(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(NV(e,!1),0===e.strm.avail_out)?1:2}function FV(e,t){for(var r,n,i;;){if(e.lookahead<IV){if(UV(e),e.lookahead<IV&&0===t)return 1;if(0===e.lookahead)break}if(r=0,e.lookahead>=3&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==r&&e.prev_length<e.max_lazy_match&&e.strstart-r<=e.w_size-IV&&(e.match_length=LV(e,r),e.match_length<=5&&(1===e.strategy||3===e.match_length&&e.strstart-e.match_start>4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-3,n=gV._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=i&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart)}while(0!=--e.prev_length);if(e.match_available=0,e.match_length=2,e.strstart++,n&&(NV(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if((n=gV._tr_tally(e,0,e.window[e.strstart-1]))&&NV(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(n=gV._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,4===t?(NV(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(NV(e,!1),0===e.strm.avail_out)?1:2}function BV(e,t,r,n,i){this.good_length=e,this.max_lazy=t,this.nice_length=r,this.max_chain=n,this.func=i}function jV(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=8,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new yV.Buf16(1146),this.dyn_dtree=new yV.Buf16(122),this.bl_tree=new yV.Buf16(78),xV(this.dyn_ltree),xV(this.dyn_dtree),xV(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new yV.Buf16(16),this.heap=new yV.Buf16(573),xV(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new yV.Buf16(573),xV(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function GV(e){var t;return e&&e.state?(e.total_in=e.total_out=0,e.data_type=2,(t=e.state).pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?42:RV,e.adler=2===t.wrap?0:1,t.last_flush=0,gV._tr_init(t),0):CV(e,kV)}function HV(e){var t,r=GV(e);return 0===r&&((t=e.state).window_size=2*t.w_size,xV(t.head),t.max_lazy_match=vV[t.level].max_lazy,t.good_match=vV[t.level].good_length,t.nice_match=vV[t.level].nice_length,t.max_chain_length=vV[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=2,t.match_available=0,t.ins_h=0),r}function zV(e,t,r,n,i,o){if(!e)return kV;var a=1;if(-1===t&&(t=6),n<0?(a=0,n=-n):n>15&&(a=2,n-=16),i<1||i>9||8!==r||n<8||n>15||t<0||t>9||o<0||o>4)return CV(e,kV);8===n&&(n=9);var s=new jV;return e.state=s,s.strm=e,s.wrap=a,s.gzhead=null,s.w_bits=n,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=i+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+3-1)/3),s.window=new yV.Buf8(2*s.w_size),s.head=new yV.Buf16(s.hash_size),s.prev=new yV.Buf16(s.w_size),s.lit_bufsize=1<<i+6,s.pending_buf_size=4*s.lit_bufsize,s.pending_buf=new yV.Buf8(s.pending_buf_size),s.d_buf=1*s.lit_bufsize,s.l_buf=3*s.lit_bufsize,s.level=t,s.strategy=o,s.method=r,HV(e)}vV=[new BV(0,0,0,0,(function(e,t){var r=65535;for(r>e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(UV(e),0===e.lookahead&&0===t)return 1;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+r;if((0===e.strstart||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,NV(e,!1),0===e.strm.avail_out))return 1;if(e.strstart-e.block_start>=e.w_size-IV&&(NV(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(NV(e,!0),0===e.strm.avail_out?3:4):(e.strstart>e.block_start&&(NV(e,!1),e.strm.avail_out),1)})),new BV(4,4,8,4,VV),new BV(4,5,16,8,VV),new BV(4,6,32,32,VV),new BV(4,4,16,16,FV),new BV(8,16,32,32,FV),new BV(8,16,128,128,FV),new BV(8,32,128,256,FV),new BV(32,128,258,1024,FV),new BV(32,258,258,4096,FV)],wU.deflateInit=function(e,t){return zV(e,t,8,15,8,0)},wU.deflateInit2=zV,wU.deflateReset=HV,wU.deflateResetKeep=GV,wU.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?kV:(e.state.gzhead=t,0):kV},wU.deflate=function(e,t){var r,n,i,o;if(!e||!e.state||t>5||t<0)return e?CV(e,kV):kV;if(n=e.state,!e.output||!e.input&&0!==e.avail_in||n.status===wV&&4!==t)return CV(e,0===e.avail_out?-5:kV);if(n.strm=e,r=n.last_flush,n.last_flush=t,42===n.status)if(2===n.wrap)e.adler=0,PV(n,31),PV(n,139),PV(n,8),n.gzhead?(PV(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),PV(n,255&n.gzhead.time),PV(n,n.gzhead.time>>8&255),PV(n,n.gzhead.time>>16&255),PV(n,n.gzhead.time>>24&255),PV(n,9===n.level?2:n.strategy>=2||n.level<2?4:0),PV(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(PV(n,255&n.gzhead.extra.length),PV(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=bV(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(PV(n,0),PV(n,0),PV(n,0),PV(n,0),PV(n,0),PV(n,9===n.level?2:n.strategy>=2||n.level<2?4:0),PV(n,3),n.status=RV);else{var a=8+(n.w_bits-8<<4)<<8;a|=(n.strategy>=2||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(a|=32),a+=31-a%31,n.status=RV,MV(n,a),0!==n.strstart&&(MV(n,e.adler>>>16),MV(n,65535&e.adler)),e.adler=1}if(69===n.status)if(n.gzhead.extra){for(i=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>i&&(e.adler=bV(e.adler,n.pending_buf,n.pending-i,i)),DV(e),i=n.pending,n.pending!==n.pending_buf_size));)PV(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(e.adler=bV(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=bV(e.adler,n.pending_buf,n.pending-i,i)),DV(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}o=n.gzindex<n.gzhead.name.length?255&n.gzhead.name.charCodeAt(n.gzindex++):0,PV(n,o)}while(0!==o);n.gzhead.hcrc&&n.pending>i&&(e.adler=bV(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=bV(e.adler,n.pending_buf,n.pending-i,i)),DV(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}o=n.gzindex<n.gzhead.comment.length?255&n.gzhead.comment.charCodeAt(n.gzindex++):0,PV(n,o)}while(0!==o);n.gzhead.hcrc&&n.pending>i&&(e.adler=bV(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.status=AV)}else n.status=AV;if(n.status===AV&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&DV(e),n.pending+2<=n.pending_buf_size&&(PV(n,255&e.adler),PV(n,e.adler>>8&255),e.adler=0,n.status=RV)):n.status=RV),0!==n.pending){if(DV(e),0===e.avail_out)return n.last_flush=-1,0}else if(0===e.avail_in&&OV(t)<=OV(r)&&4!==t)return CV(e,-5);if(n.status===wV&&0!==e.avail_in)return CV(e,-5);if(0!==e.avail_in||0!==n.lookahead||0!==t&&n.status!==wV){var s=2===n.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(UV(e),0===e.lookahead)){if(0===t)return 1;break}if(e.match_length=0,r=gV._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(NV(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(NV(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(NV(e,!1),0===e.strm.avail_out)?1:2}(n,t):3===n.strategy?function(e,t){for(var r,n,i,o,a=e.window;;){if(e.lookahead<=TV){if(UV(e),e.lookahead<=TV&&0===t)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(n=a[i=e.strstart-1])===a[++i]&&n===a[++i]&&n===a[++i]){o=e.strstart+TV;do{}while(n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&i<o);e.match_length=TV-(o-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(r=gV._tr_tally(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=gV._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(NV(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(NV(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(NV(e,!1),0===e.strm.avail_out)?1:2}(n,t):vV[n.level].func(n,t);if(3!==s&&4!==s||(n.status=wV),1===s||3===s)return 0===e.avail_out&&(n.last_flush=-1),0;if(2===s&&(1===t?gV._tr_align(n):5!==t&&(gV._tr_stored_block(n,0,0,!1),3===t&&(xV(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),DV(e),0===e.avail_out))return n.last_flush=-1,0}return 4!==t?0:n.wrap<=0?1:(2===n.wrap?(PV(n,255&e.adler),PV(n,e.adler>>8&255),PV(n,e.adler>>16&255),PV(n,e.adler>>24&255),PV(n,255&e.total_in),PV(n,e.total_in>>8&255),PV(n,e.total_in>>16&255),PV(n,e.total_in>>24&255)):(MV(n,e.adler>>>16),MV(n,65535&e.adler)),DV(e),n.wrap>0&&(n.wrap=-n.wrap),0!==n.pending?0:1)},wU.deflateEnd=function(e){var t;return e&&e.state?42!==(t=e.state.status)&&69!==t&&73!==t&&91!==t&&t!==AV&&t!==RV&&t!==wV?CV(e,kV):(e.state=null,t===RV?CV(e,-3):0):kV},wU.deflateSetDictionary=function(e,t){var r,n,i,o,a,s,c,u,d=t.length;if(!e||!e.state)return kV;if(2===(o=(r=e.state).wrap)||1===o&&42!==r.status||r.lookahead)return kV;for(1===o&&(e.adler=SV(e.adler,t,d,0)),r.wrap=0,d>=r.w_size&&(0===o&&(xV(r.head),r.strstart=0,r.block_start=0,r.insert=0),u=new yV.Buf8(r.w_size),yV.arraySet(u,t,d-r.w_size,r.w_size,0),t=u,d=r.w_size),a=e.avail_in,s=e.next_in,c=e.input,e.avail_in=d,e.next_in=0,e.input=t,UV(r);r.lookahead>=3;){n=r.strstart,i=r.lookahead-2;do{r.ins_h=(r.ins_h<<r.hash_shift^r.window[n+3-1])&r.hash_mask,r.prev[n&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=n,n++}while(--i);r.strstart=n,r.lookahead=2,UV(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=2,r.match_available=0,e.next_in=s,e.input=c,e.avail_in=a,r.wrap=o,0},wU.deflateInfo="pako deflate (from Nodeca project)";var XV={},KV=AU,qV=!0,WV=!0;try{String.fromCharCode.apply(null,[0])}catch(I0){qV=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(I0){WV=!1}for(var YV=new KV.Buf8(256),JV=0;JV<256;JV++)YV[JV]=JV>=252?6:JV>=248?5:JV>=240?4:JV>=224?3:JV>=192?2:1;function QV(e,t){if(t<65534&&(e.subarray&&WV||!e.subarray&&qV))return String.fromCharCode.apply(null,KV.shrinkBuf(e,t));for(var r="",n=0;n<t;n++)r+=String.fromCharCode(e[n]);return r}YV[254]=YV[254]=1,XV.string2buf=function(e){var t,r,n,i,o,a=e.length,s=0;for(i=0;i<a;i++)55296==(64512&(r=e.charCodeAt(i)))&&i+1<a&&56320==(64512&(n=e.charCodeAt(i+1)))&&(r=65536+(r-55296<<10)+(n-56320),i++),s+=r<128?1:r<2048?2:r<65536?3:4;for(t=new KV.Buf8(s),o=0,i=0;o<s;i++)55296==(64512&(r=e.charCodeAt(i)))&&i+1<a&&56320==(64512&(n=e.charCodeAt(i+1)))&&(r=65536+(r-55296<<10)+(n-56320),i++),r<128?t[o++]=r:r<2048?(t[o++]=192|r>>>6,t[o++]=128|63&r):r<65536?(t[o++]=224|r>>>12,t[o++]=128|r>>>6&63,t[o++]=128|63&r):(t[o++]=240|r>>>18,t[o++]=128|r>>>12&63,t[o++]=128|r>>>6&63,t[o++]=128|63&r);return t},XV.buf2binstring=function(e){return QV(e,e.length)},XV.binstring2buf=function(e){for(var t=new KV.Buf8(e.length),r=0,n=t.length;r<n;r++)t[r]=e.charCodeAt(r);return t},XV.buf2string=function(e,t){var r,n,i,o,a=t||e.length,s=new Array(2*a);for(n=0,r=0;r<a;)if((i=e[r++])<128)s[n++]=i;else if((o=YV[i])>4)s[n++]=65533,r+=o-1;else{for(i&=2===o?31:3===o?15:7;o>1&&r<a;)i=i<<6|63&e[r++],o--;o>1?s[n++]=65533:i<65536?s[n++]=i:(i-=65536,s[n++]=55296|i>>10&1023,s[n++]=56320|1023&i)}return QV(s,n)},XV.utf8border=function(e,t){var r;for((t=t||e.length)>e.length&&(t=e.length),r=t-1;r>=0&&128==(192&e[r]);)r--;return r<0||0===r?t:r+YV[e[r]]>t?r:t};var ZV=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0},$V=wU,eF=AU,tF=XV,rF=mV,nF=ZV,iF=Object.prototype.toString;function oF(e){if(!(this instanceof oF))return new oF(e);this.options=eF.assign({level:-1,method:8,chunkSize:16384,windowBits:15,memLevel:8,strategy:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new nF,this.strm.avail_out=0;var r=$V.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(0!==r)throw new Error(rF[r]);if(t.header&&$V.deflateSetHeader(this.strm,t.header),t.dictionary){var n;if(n="string"==typeof t.dictionary?tF.string2buf(t.dictionary):"[object ArrayBuffer]"===iF.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,0!==(r=$V.deflateSetDictionary(this.strm,n)))throw new Error(rF[r]);this._dict_set=!0}}function aF(e,t){var r=new oF(t);if(r.push(e,!0),r.err)throw r.msg||rF[r.err];return r.result}oF.prototype.push=function(e,t){var r,n,i=this.strm,o=this.options.chunkSize;if(this.ended)return!1;n=t===~~t?t:!0===t?4:0,"string"==typeof e?i.input=tF.string2buf(e):"[object ArrayBuffer]"===iF.call(e)?i.input=new Uint8Array(e):i.input=e,i.next_in=0,i.avail_in=i.input.length;do{if(0===i.avail_out&&(i.output=new eF.Buf8(o),i.next_out=0,i.avail_out=o),1!==(r=$V.deflate(i,n))&&0!==r)return this.onEnd(r),this.ended=!0,!1;0!==i.avail_out&&(0!==i.avail_in||4!==n&&2!==n)||("string"===this.options.to?this.onData(tF.buf2binstring(eF.shrinkBuf(i.output,i.next_out))):this.onData(eF.shrinkBuf(i.output,i.next_out)))}while((i.avail_in>0||0===i.avail_out)&&1!==r);return 4===n?(r=$V.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,0===r):2!==n||(this.onEnd(0),i.avail_out=0,!0)},oF.prototype.onData=function(e){this.chunks.push(e)},oF.prototype.onEnd=function(e){0===e&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=eF.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},RU.Deflate=oF,RU.deflate=aF,RU.deflateRaw=function(e,t){return(t=t||{}).raw=!0,aF(e,t)},RU.gzip=function(e,t){return(t=t||{}).gzip=!0,aF(e,t)};var sF={},cF=le,uF=Og,dF=Vs,lF=de,hF=ce.RegExp,fF=hF.prototype;cF&&lF((function(){var e=!0;try{hF(".","d")}catch(T0){e=!1}var t={},r="",n=e?"dgimsy":"gimsy",i=function(e,n){Object.defineProperty(t,e,{get:function(){return r+=n,!0}})},o={dotAll:"s",global:"g",ignoreCase:"i",multiline:"m",sticky:"y"};for(var a in e&&(o.hasIndices="d"),o)i(a,o[a]);return Object.getOwnPropertyDescriptor(fF,"flags").get.call(t)!==n||r!==n}))&&uF(fF,"flags",{configurable:!0,get:dF});var pF={},vF=AU,_F=15,mF=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],yF=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],gF=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],SF=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64],bF=AU,EF=fV,kF=_V,TF=function(e,t){var r,n,i,o,a,s,c,u,d,l,h,f,p,v,_,m,y,g,S,b,E,k,T,I,A;r=e.state,n=e.next_in,I=e.input,i=n+(e.avail_in-5),o=e.next_out,A=e.output,a=o-(t-e.avail_out),s=o+(e.avail_out-257),c=r.dmax,u=r.wsize,d=r.whave,l=r.wnext,h=r.window,f=r.hold,p=r.bits,v=r.lencode,_=r.distcode,m=(1<<r.lenbits)-1,y=(1<<r.distbits)-1;e:do{p<15&&(f+=I[n++]<<p,p+=8,f+=I[n++]<<p,p+=8),g=v[f&m];t:for(;;){if(f>>>=S=g>>>24,p-=S,0===(S=g>>>16&255))A[o++]=65535&g;else{if(!(16&S)){if(0==(64&S)){g=v[(65535&g)+(f&(1<<S)-1)];continue t}if(32&S){r.mode=12;break e}e.msg="invalid literal/length code",r.mode=30;break e}b=65535&g,(S&=15)&&(p<S&&(f+=I[n++]<<p,p+=8),b+=f&(1<<S)-1,f>>>=S,p-=S),p<15&&(f+=I[n++]<<p,p+=8,f+=I[n++]<<p,p+=8),g=_[f&y];r:for(;;){if(f>>>=S=g>>>24,p-=S,!(16&(S=g>>>16&255))){if(0==(64&S)){g=_[(65535&g)+(f&(1<<S)-1)];continue r}e.msg="invalid distance code",r.mode=30;break e}if(E=65535&g,p<(S&=15)&&(f+=I[n++]<<p,(p+=8)<S&&(f+=I[n++]<<p,p+=8)),(E+=f&(1<<S)-1)>c){e.msg="invalid distance too far back",r.mode=30;break e}if(f>>>=S,p-=S,E>(S=o-a)){if((S=E-S)>d&&r.sane){e.msg="invalid distance too far back",r.mode=30;break e}if(k=0,T=h,0===l){if(k+=u-S,S<b){b-=S;do{A[o++]=h[k++]}while(--S);k=o-E,T=A}}else if(l<S){if(k+=u+l-S,(S-=l)<b){b-=S;do{A[o++]=h[k++]}while(--S);if(k=0,l<b){b-=S=l;do{A[o++]=h[k++]}while(--S);k=o-E,T=A}}}else if(k+=l-S,S<b){b-=S;do{A[o++]=h[k++]}while(--S);k=o-E,T=A}for(;b>2;)A[o++]=T[k++],A[o++]=T[k++],A[o++]=T[k++],b-=3;b&&(A[o++]=T[k++],b>1&&(A[o++]=T[k++]))}else{k=o-E;do{A[o++]=A[k++],A[o++]=A[k++],A[o++]=A[k++],b-=3}while(b>2);b&&(A[o++]=A[k++],b>1&&(A[o++]=A[k++]))}break}}break}}while(n<i&&o<s);n-=b=p>>3,f&=(1<<(p-=b<<3))-1,e.next_in=n,e.next_out=o,e.avail_in=n<i?i-n+5:5-(n-i),e.avail_out=o<s?s-o+257:257-(o-s),r.hold=f,r.bits=p},IF=function(e,t,r,n,i,o,a,s){var c,u,d,l,h,f,p,v,_,m=s.bits,y=0,g=0,S=0,b=0,E=0,k=0,T=0,I=0,A=0,R=0,w=null,C=0,O=new vF.Buf16(16),x=new vF.Buf16(16),D=null,N=0;for(y=0;y<=_F;y++)O[y]=0;for(g=0;g<n;g++)O[t[r+g]]++;for(E=m,b=_F;b>=1&&0===O[b];b--);if(E>b&&(E=b),0===b)return i[o++]=20971520,i[o++]=20971520,s.bits=1,0;for(S=1;S<b&&0===O[S];S++);for(E<S&&(E=S),I=1,y=1;y<=_F;y++)if(I<<=1,(I-=O[y])<0)return-1;if(I>0&&(0===e||1!==b))return-1;for(x[1]=0,y=1;y<_F;y++)x[y+1]=x[y]+O[y];for(g=0;g<n;g++)0!==t[r+g]&&(a[x[t[r+g]]++]=g);if(0===e?(w=D=a,f=19):1===e?(w=mF,C-=257,D=yF,N-=257,f=256):(w=gF,D=SF,f=-1),R=0,g=0,y=S,h=o,k=E,T=0,d=-1,l=(A=1<<E)-1,1===e&&A>852||2===e&&A>592)return 1;for(;;){p=y-T,a[g]<f?(v=0,_=a[g]):a[g]>f?(v=D[N+a[g]],_=w[C+a[g]]):(v=96,_=0),c=1<<y-T,S=u=1<<k;do{i[h+(R>>T)+(u-=c)]=p<<24|v<<16|_|0}while(0!==u);for(c=1<<y-1;R&c;)c>>=1;if(0!==c?(R&=c-1,R+=c):R=0,g++,0==--O[y]){if(y===b)break;y=t[r+a[g]]}if(y>E&&(R&l)!==d){for(0===T&&(T=E),h+=S,I=1<<(k=y-T);k+T<b&&!((I-=O[k+T])<=0);)k++,I<<=1;if(A+=1<<k,1===e&&A>852||2===e&&A>592)return 1;i[d=R&l]=E<<24|k<<16|h-o|0}}return 0!==R&&(i[h+R]=y-T<<24|64<<16|0),s.bits=E,0},AF=-2,RF=12,wF=30;function CF(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function OF(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new bF.Buf16(320),this.work=new bF.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function xF(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=1,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new bF.Buf32(852),t.distcode=t.distdyn=new bF.Buf32(592),t.sane=1,t.back=-1,0):AF}function DF(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,xF(e)):AF}function NF(e,t){var r,n;return e&&e.state?(n=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?AF:(null!==n.window&&n.wbits!==t&&(n.window=null),n.wrap=r,n.wbits=t,DF(e))):AF}function PF(e,t){var r,n;return e?(n=new OF,e.state=n,n.window=null,0!==(r=NF(e,t))&&(e.state=null),r):AF}var MF,LF,UF=!0;function VF(e){if(UF){var t;for(MF=new bF.Buf32(512),LF=new bF.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(IF(1,e.lens,0,288,MF,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;IF(2,e.lens,0,32,LF,0,e.work,{bits:5}),UF=!1}e.lencode=MF,e.lenbits=9,e.distcode=LF,e.distbits=5}function FF(e,t,r,n){var i,o=e.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new bF.Buf8(o.wsize)),n>=o.wsize?(bF.arraySet(o.window,t,r-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):((i=o.wsize-o.wnext)>n&&(i=n),bF.arraySet(o.window,t,r-n,i,o.wnext),(n-=i)?(bF.arraySet(o.window,t,r-n,n,0),o.wnext=n,o.whave=o.wsize):(o.wnext+=i,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=i))),0}pF.inflateReset=DF,pF.inflateReset2=NF,pF.inflateResetKeep=xF,pF.inflateInit=function(e){return PF(e,15)},pF.inflateInit2=PF,pF.inflate=function(e,t){var r,n,i,o,a,s,c,u,d,l,h,f,p,v,_,m,y,g,S,b,E,k,T,I,A=0,R=new bF.Buf8(4),w=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&0!==e.avail_in)return AF;(r=e.state).mode===RF&&(r.mode=13),a=e.next_out,i=e.output,c=e.avail_out,o=e.next_in,n=e.input,s=e.avail_in,u=r.hold,d=r.bits,l=s,h=c,k=0;e:for(;;)switch(r.mode){case 1:if(0===r.wrap){r.mode=13;break}for(;d<16;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(2&r.wrap&&35615===u){r.check=0,R[0]=255&u,R[1]=u>>>8&255,r.check=kF(r.check,R,2,0),u=0,d=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",r.mode=wF;break}if(8!=(15&u)){e.msg="unknown compression method",r.mode=wF;break}if(d-=4,E=8+(15&(u>>>=4)),0===r.wbits)r.wbits=E;else if(E>r.wbits){e.msg="invalid window size",r.mode=wF;break}r.dmax=1<<E,e.adler=r.check=1,r.mode=512&u?10:RF,u=0,d=0;break;case 2:for(;d<16;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(r.flags=u,8!=(255&r.flags)){e.msg="unknown compression method",r.mode=wF;break}if(57344&r.flags){e.msg="unknown header flags set",r.mode=wF;break}r.head&&(r.head.text=u>>8&1),512&r.flags&&(R[0]=255&u,R[1]=u>>>8&255,r.check=kF(r.check,R,2,0)),u=0,d=0,r.mode=3;case 3:for(;d<32;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}r.head&&(r.head.time=u),512&r.flags&&(R[0]=255&u,R[1]=u>>>8&255,R[2]=u>>>16&255,R[3]=u>>>24&255,r.check=kF(r.check,R,4,0)),u=0,d=0,r.mode=4;case 4:for(;d<16;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}r.head&&(r.head.xflags=255&u,r.head.os=u>>8),512&r.flags&&(R[0]=255&u,R[1]=u>>>8&255,r.check=kF(r.check,R,2,0)),u=0,d=0,r.mode=5;case 5:if(1024&r.flags){for(;d<16;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}r.length=u,r.head&&(r.head.extra_len=u),512&r.flags&&(R[0]=255&u,R[1]=u>>>8&255,r.check=kF(r.check,R,2,0)),u=0,d=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&((f=r.length)>s&&(f=s),f&&(r.head&&(E=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),bF.arraySet(r.head.extra,n,o,f,E)),512&r.flags&&(r.check=kF(r.check,n,f,o)),s-=f,o+=f,r.length-=f),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===s)break e;f=0;do{E=n[o+f++],r.head&&E&&r.length<65536&&(r.head.name+=String.fromCharCode(E))}while(E&&f<s);if(512&r.flags&&(r.check=kF(r.check,n,f,o)),s-=f,o+=f,E)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=8;case 8:if(4096&r.flags){if(0===s)break e;f=0;do{E=n[o+f++],r.head&&E&&r.length<65536&&(r.head.comment+=String.fromCharCode(E))}while(E&&f<s);if(512&r.flags&&(r.check=kF(r.check,n,f,o)),s-=f,o+=f,E)break e}else r.head&&(r.head.comment=null);r.mode=9;case 9:if(512&r.flags){for(;d<16;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(u!==(65535&r.check)){e.msg="header crc mismatch",r.mode=wF;break}u=0,d=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=RF;break;case 10:for(;d<32;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}e.adler=r.check=CF(u),u=0,d=0,r.mode=11;case 11:if(0===r.havedict)return e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,r.hold=u,r.bits=d,2;e.adler=r.check=1,r.mode=RF;case RF:if(5===t||6===t)break e;case 13:if(r.last){u>>>=7&d,d-=7&d,r.mode=27;break}for(;d<3;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}switch(r.last=1&u,d-=1,3&(u>>>=1)){case 0:r.mode=14;break;case 1:if(VF(r),r.mode=20,6===t){u>>>=2,d-=2;break e}break;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=wF}u>>>=2,d-=2;break;case 14:for(u>>>=7&d,d-=7&d;d<32;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if((65535&u)!=(u>>>16^65535)){e.msg="invalid stored block lengths",r.mode=wF;break}if(r.length=65535&u,u=0,d=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(f=r.length){if(f>s&&(f=s),f>c&&(f=c),0===f)break e;bF.arraySet(i,n,o,f,a),s-=f,o+=f,c-=f,a+=f,r.length-=f;break}r.mode=RF;break;case 17:for(;d<14;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(r.nlen=257+(31&u),u>>>=5,d-=5,r.ndist=1+(31&u),u>>>=5,d-=5,r.ncode=4+(15&u),u>>>=4,d-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=wF;break}r.have=0,r.mode=18;case 18:for(;r.have<r.ncode;){for(;d<3;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}r.lens[w[r.have++]]=7&u,u>>>=3,d-=3}for(;r.have<19;)r.lens[w[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,T={bits:r.lenbits},k=IF(0,r.lens,0,19,r.lencode,0,r.work,T),r.lenbits=T.bits,k){e.msg="invalid code lengths set",r.mode=wF;break}r.have=0,r.mode=19;case 19:for(;r.have<r.nlen+r.ndist;){for(;m=(A=r.lencode[u&(1<<r.lenbits)-1])>>>16&255,y=65535&A,!((_=A>>>24)<=d);){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(y<16)u>>>=_,d-=_,r.lens[r.have++]=y;else{if(16===y){for(I=_+2;d<I;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(u>>>=_,d-=_,0===r.have){e.msg="invalid bit length repeat",r.mode=wF;break}E=r.lens[r.have-1],f=3+(3&u),u>>>=2,d-=2}else if(17===y){for(I=_+3;d<I;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}d-=_,E=0,f=3+(7&(u>>>=_)),u>>>=3,d-=3}else{for(I=_+7;d<I;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}d-=_,E=0,f=11+(127&(u>>>=_)),u>>>=7,d-=7}if(r.have+f>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=wF;break}for(;f--;)r.lens[r.have++]=E}}if(r.mode===wF)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=wF;break}if(r.lenbits=9,T={bits:r.lenbits},k=IF(1,r.lens,0,r.nlen,r.lencode,0,r.work,T),r.lenbits=T.bits,k){e.msg="invalid literal/lengths set",r.mode=wF;break}if(r.distbits=6,r.distcode=r.distdyn,T={bits:r.distbits},k=IF(2,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,T),r.distbits=T.bits,k){e.msg="invalid distances set",r.mode=wF;break}if(r.mode=20,6===t)break e;case 20:r.mode=21;case 21:if(s>=6&&c>=258){e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,r.hold=u,r.bits=d,TF(e,h),a=e.next_out,i=e.output,c=e.avail_out,o=e.next_in,n=e.input,s=e.avail_in,u=r.hold,d=r.bits,r.mode===RF&&(r.back=-1);break}for(r.back=0;m=(A=r.lencode[u&(1<<r.lenbits)-1])>>>16&255,y=65535&A,!((_=A>>>24)<=d);){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(m&&0==(240&m)){for(g=_,S=m,b=y;m=(A=r.lencode[b+((u&(1<<g+S)-1)>>g)])>>>16&255,y=65535&A,!(g+(_=A>>>24)<=d);){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}u>>>=g,d-=g,r.back+=g}if(u>>>=_,d-=_,r.back+=_,r.length=y,0===m){r.mode=26;break}if(32&m){r.back=-1,r.mode=RF;break}if(64&m){e.msg="invalid literal/length code",r.mode=wF;break}r.extra=15&m,r.mode=22;case 22:if(r.extra){for(I=r.extra;d<I;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}r.length+=u&(1<<r.extra)-1,u>>>=r.extra,d-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;m=(A=r.distcode[u&(1<<r.distbits)-1])>>>16&255,y=65535&A,!((_=A>>>24)<=d);){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(0==(240&m)){for(g=_,S=m,b=y;m=(A=r.distcode[b+((u&(1<<g+S)-1)>>g)])>>>16&255,y=65535&A,!(g+(_=A>>>24)<=d);){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}u>>>=g,d-=g,r.back+=g}if(u>>>=_,d-=_,r.back+=_,64&m){e.msg="invalid distance code",r.mode=wF;break}r.offset=y,r.extra=15&m,r.mode=24;case 24:if(r.extra){for(I=r.extra;d<I;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}r.offset+=u&(1<<r.extra)-1,u>>>=r.extra,d-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=wF;break}r.mode=25;case 25:if(0===c)break e;if(f=h-c,r.offset>f){if((f=r.offset-f)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=wF;break}f>r.wnext?(f-=r.wnext,p=r.wsize-f):p=r.wnext-f,f>r.length&&(f=r.length),v=r.window}else v=i,p=a-r.offset,f=r.length;f>c&&(f=c),c-=f,r.length-=f;do{i[a++]=v[p++]}while(--f);0===r.length&&(r.mode=21);break;case 26:if(0===c)break e;i[a++]=r.length,c--,r.mode=21;break;case 27:if(r.wrap){for(;d<32;){if(0===s)break e;s--,u|=n[o++]<<d,d+=8}if(h-=c,e.total_out+=h,r.total+=h,h&&(e.adler=r.check=r.flags?kF(r.check,i,h,a-h):EF(r.check,i,h,a-h)),h=c,(r.flags?u:CF(u))!==r.check){e.msg="incorrect data check",r.mode=wF;break}u=0,d=0}r.mode=28;case 28:if(r.wrap&&r.flags){for(;d<32;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(u!==(4294967295&r.total)){e.msg="incorrect length check",r.mode=wF;break}u=0,d=0}r.mode=29;case 29:k=1;break e;case wF:k=-3;break e;case 31:return-4;default:return AF}return e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,r.hold=u,r.bits=d,(r.wsize||h!==e.avail_out&&r.mode<wF&&(r.mode<27||4!==t))&&FF(e,e.output,e.next_out,h-e.avail_out),l-=e.avail_in,h-=e.avail_out,e.total_in+=l,e.total_out+=h,r.total+=h,r.wrap&&h&&(e.adler=r.check=r.flags?kF(r.check,i,h,e.next_out-h):EF(r.check,i,h,e.next_out-h)),e.data_type=r.bits+(r.last?64:0)+(r.mode===RF?128:0)+(20===r.mode||15===r.mode?256:0),(0===l&&0===h||4===t)&&0===k&&(k=-5),k},pF.inflateEnd=function(e){if(!e||!e.state)return AF;var t=e.state;return t.window&&(t.window=null),e.state=null,0},pF.inflateGetHeader=function(e,t){var r;return e&&e.state?0==(2&(r=e.state).wrap)?AF:(r.head=t,t.done=!1,0):AF},pF.inflateSetDictionary=function(e,t){var r,n=t.length;return e&&e.state?0!==(r=e.state).wrap&&11!==r.mode?AF:11===r.mode&&EF(1,t,n,0)!==r.check?-3:FF(e,t,n,n)?(r.mode=31,-4):(r.havedict=1,0):AF},pF.inflateInfo="pako inflate (from Nodeca project)";var BF={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};var jF=pF,GF=AU,HF=XV,zF=BF,XF=mV,KF=ZV,qF=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1},WF=Object.prototype.toString;function YF(e){if(!(this instanceof YF))return new YF(e);this.options=GF.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new KF,this.strm.avail_out=0;var r=jF.inflateInit2(this.strm,t.windowBits);if(r!==zF.Z_OK)throw new Error(XF[r]);if(this.header=new qF,jF.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=HF.string2buf(t.dictionary):"[object ArrayBuffer]"===WF.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(r=jF.inflateSetDictionary(this.strm,t.dictionary))!==zF.Z_OK))throw new Error(XF[r])}function JF(e,t){var r=new YF(t);if(r.push(e,!0),r.err)throw r.msg||XF[r.err];return r.result}YF.prototype.push=function(e,t){var r,n,i,o,a,s=this.strm,c=this.options.chunkSize,u=this.options.dictionary,d=!1;if(this.ended)return!1;n=t===~~t?t:!0===t?zF.Z_FINISH:zF.Z_NO_FLUSH,"string"==typeof e?s.input=HF.binstring2buf(e):"[object ArrayBuffer]"===WF.call(e)?s.input=new Uint8Array(e):s.input=e,s.next_in=0,s.avail_in=s.input.length;do{if(0===s.avail_out&&(s.output=new GF.Buf8(c),s.next_out=0,s.avail_out=c),(r=jF.inflate(s,zF.Z_NO_FLUSH))===zF.Z_NEED_DICT&&u&&(r=jF.inflateSetDictionary(this.strm,u)),r===zF.Z_BUF_ERROR&&!0===d&&(r=zF.Z_OK,d=!1),r!==zF.Z_STREAM_END&&r!==zF.Z_OK)return this.onEnd(r),this.ended=!0,!1;s.next_out&&(0!==s.avail_out&&r!==zF.Z_STREAM_END&&(0!==s.avail_in||n!==zF.Z_FINISH&&n!==zF.Z_SYNC_FLUSH)||("string"===this.options.to?(i=HF.utf8border(s.output,s.next_out),o=s.next_out-i,a=HF.buf2string(s.output,i),s.next_out=o,s.avail_out=c-o,o&&GF.arraySet(s.output,s.output,i,o,0),this.onData(a)):this.onData(GF.shrinkBuf(s.output,s.next_out)))),0===s.avail_in&&0===s.avail_out&&(d=!0)}while((s.avail_in>0||0===s.avail_out)&&r!==zF.Z_STREAM_END);return r===zF.Z_STREAM_END&&(n=zF.Z_FINISH),n===zF.Z_FINISH?(r=jF.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===zF.Z_OK):n!==zF.Z_SYNC_FLUSH||(this.onEnd(zF.Z_OK),s.avail_out=0,!0)},YF.prototype.onData=function(e){this.chunks.push(e)},YF.prototype.onEnd=function(e){e===zF.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=GF.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},sF.Inflate=YF,sF.inflate=JF,sF.inflateRaw=function(e,t){return(t=t||{}).raw=!0,JF(e,t)},sF.ungzip=JF;var QF={};(0,AU.assign)(QF,RU,sF,BF);var ZF=QF,$F=function(e){return e.RTC="rtc",e}($F||{}),eB=function(e){return e.W_5="5",e}(eB||{}),tB=function(e){return e.IOS="ios",e.ANDROID="android",e.WEB="web",e.WINDOWS="windows",e.MAC="mac",e.LINUX="linux",e}(tB||{}),rB=function(e){return e.REQUEST="request",e.RESPONSE="response",e}(rB||{}),nB=function(e){return e.WEBSOCKET_RECONNECTING="websocket reconnecting",e.PEERCONNECTION_RECONNECTING="peerconnection reconnecting",e.DISCONNECTED="DISCONNECTED",e.LAN="LAN",e.WIFI="WIFI",e.W_2="2G",e.W_3="3G",e.W_4="4G",e.W_5="5G",e.UNKNOWN="UNKNOWN",e}(nB||{}),iB=function(e){return e.WEBSOCKET="websocket",e.NETWORKCHANGED="networkChanged",e.PEERCONNECTION="peerconnection",e}(iB||{}),oB=function(e){return e.WEBSOCKET_RECONNECTED="websocket reconnected",e.PEERCONNECTION_RECONNECTED="peerconnection reconnected",e}(oB||{}),aB=function(e){return e.WEBSOCKET="websocket",e.NETWORKCHANGED="networkChanged",e.PEERCONNECTION="peerconnection",e}(aB||{}),sB=function(e){return e.REQUEST="request",e.RESPONSE="response",e.KCP_REQUEST="kcp request",e.KCP_RESPONSE="kcp response",e.QUIC_REQUEST="quic request",e.QUIC_RESPONSE="quic response",e}(sB||{}),cB=function(e){return e.NEW="NEW",e.CHECKING="CHECKING",e.CONNECTED="CONNECTED",e.COMPLETED="COMPLETED",e.FAILED="FAILED",e.DISCONNECTED="DISCONNECTED",e.CLOSED="CLOSED",e.DATACHANNEL_CONNECTING="DATACHANNEL_CONNECTING",e.DATACHANNEL_OPEN="DATACHANNEL_OPEN",e.DATACHANNEL_CLOSING="DATACHANNEL_CLOSING",e.DATACHANNEL_CLOSED="DATACHANNEL_CLOSED",e}(cB||{}),uB=function(e){return e.SUCCEED="succeed",e.MESSAGE_ID_ERROR="message id error",e.ZIP_FAILED="zip failed",e.UNZIP_FAILED="unzip failed",e.MESSAGE_KEY_EMPTY="message key empty",e.MESSAGE_KEY_PARSE_FAILED="message key parse failed",e.MESSAGE_KEY_INVALID="message key invalid",e.ENCRYPT_FAILED="encrypt failed",e.DECRYPT_FAILED="decrypt failed",e.MESSAGE_TOO_BIG="message too big",e.INVALID_DATA="invalid data",e.MESSAGE_PARSE_FAILED="message parse failed",e}(uB||{}),dB=function(e){return e.UP="up",e.DOWN="down",e.DIRECT="direct",e}(dB||{}),lB=function(e){return e.UP="up",e.DOWN="down",e.PRE="pre",e}(lB||{}),hB=function(e){return e.UP="up",e.DOWN="down",e.PRE="pre",e}(hB||{}),fB=function(e){return e.W_0="0",e.W_1="1",e}(fB||{}),pB=function(e){return e.UP="up",e.DOWN="down",e}(pB||{}),vB=function(e){return e.ANSWER="answer",e.INCRANSWER="incranswer",e}(vB||{}),_B=function(e){return e.UP="up",e.DOWN="down",e}(_B||{}),mB=function(e){return e.SUCCESS="success",e.FAIL="fail",e}(mB||{}),yB=function(e){return e.W_0="0",e.W_1="1",e}(yB||{}),gB=function(e){return e.LEAVE_ROOM="leave room",e.ACK_FAILED="ack failed",e.SET_ANSWER_SDP_FAILED="set answer sdp failed",e.ICE_FAILED="ice failed",e.STREAM_FAILED="stream failed",e.NETWORK_RECONNECTED="network reconnected",e.JOIN_ROOM_ACK_FAILED="join room ack failed",e.UNKNOWN="unknown",e}(gB||{}),SB=function(e){return e.SUCCESS="success",e.FAIL="fail",e.IGNORE="ignore",e}(SB||{}),bB=function(e){return e.LEAVE_ROOM="leave room",e.ACK_FAILED="ack failed",e.SET_ANSWER_SDP_FAILED="set answer sdp failed",e.ICE_FAILED="ice failed",e.STREAM_FAILED="stream failed",e.NETWORK_RECONNECTED="network reconnected",e.ON_STREAM_REMOVE="on stream remove",e.PUBLISH_MUTE="publish mute",e.UNKNOWN="unknown",e.ON_STREAM_REMOVE_CLIENT_UNPUBLISHED="on stream remove:client unpublished",e.ON_STREAM_REMOVE_PUBLISH_FAILED="on stream remove:publish failed",e.ON_STREAM_REMOVE_STREAM_REMOVED="on stream remove:stream removed",e.ON_STREAM_REMOVE_CLIENT_DISCONNECTED="on stream remove:client disconnected",e.ON_STREAM_REMOVE_CLIENT_REPUBLISH="on stream remove:client republish",e}(bB||{}),EB=function(e){return e.PLAYOUT_DEVICE_SWITCH="playout_device_switch",e.RECORD_DEVICE_SWITCH="record_device_switch",e.UNKNOWN="unknown",e}(EB||{}),kB=function(e){return e.BEGIN_SEND="begin_send",e.SENT_END="sent_end",e.BEGIN_RECV="begin_recv",e.RECV_END="recv_end",e}(kB||{}),TB=function(e){return e.AUDIO="audio",e.VIDEO="video",e.SCREEN_VIDEO="screen_video",e.SCREEN_AUDIO="screen_audio",e}(TB||{}),IB=function(e){return e.LOGIN="login",e.PUBLISHER="publisher",e.UNMUTE="unmute",e.ENABLE="enable",e.PUSH="push",e.PUBLISH="publish",e.ONDEMAND="ondemand",e.SUBSCRIBE="subscribe",e.PUSH_TRACK="push_track",e.REMOTE_UNMUTE="remote_unmute",e.P2P="p2p",e}(IB||{}),AB=function(e){return e.TIMEOUT="timeout",e.AUDIENCE="audience",e.MUTE="mute",e.DISABLE="disable",e.STOP_PUSH="stop_push",e.UNPUBLISH="unpublish",e.NO_DEMAND="no_demand",e.LEAVE_ROOM="leave_room",e.UNSUBSCRIBE="unsubscribe",e.REMOVE_TRACK="remove_track",e.REMOTE_MUTE="remote_mute",e.USER_LEAVE="user_leave",e}(AB||{}),RB=function(e){return e.BEGIN="begin",e.END="end",e}(RB||{}),wB=function(e){return e.BEGIN="begin",e.END="end",e}(wB||{}),CB=function(e){return e.LEAVE_ROOM="leave_room",e.ACK_FAILED="ack_failed",e.TOKEN_ERROR="token_error",e.SIGNALING_ERROR="signaling_error",e.TIMEOUT_10="timeout_10",e.TIMEOUT_60="timeout_60",e}(CB||{}),OB=function(e){return e.P2P="p2p",e.P2P_OUTSIDE_ROOM="p2p_outside_room",e.P2SERVER="p2server",e}(OB||{}),xB=function(e){return e.START="start",e.START_CAPTURE_RESULT="start_capture_result",e.STARTED="started",e.RUNNING_FAILED="running_failed",e.STOP="stop",e.STOPPED="stopped",e}(xB||{}),DB=function(e){return e.SUCCESS="success",e.CAMERA_DEVICE_NO_PERMISSION="camera_device_no_permission",e.CAMERA_DEVICE_BUSY="camera_device_busy",e.CAMERA_DEVICE_FAILURE="camera_device_failure",e.CAMERA_DEVICE_NOT_FOUND="camera_device_not_found",e.CAMERA_DEVICE_DISCONNECTED="camera_device_disconnected",e.TIMEOUT="timeout",e.ABORT="abort",e}(DB||{}),NB=function(){function e(t){u(this,e),h(this,"_event_key",void 0),h(this,"_device_id",void 0),h(this,"_rtc_app_id",void 0),h(this,"_product_line",void 0),h(this,"_report_version",void 0),h(this,"_os",void 0),h(this,"_rtc_sdk_version",void 0),h(this,"_rtc_timestamp",void 0),h(this,"_rtc_sdk_git_commit",void 0),h(this,"_report_id",void 0),h(this,"_connection_id",void 0),h(this,"_rtc_sid",void 0),h(this,"_engine_session_id",void 0),h(this,"_rtc_business_id",void 0),h(this,"_app_sate",void 0),h(this,"_project_key",void 0),h(this,"_network_type",void 0),h(this,"_app_version",void 0),h(this,"_aid",void 0),h(this,"_device_model",void 0),h(this,"_device_brand",void 0),h(this,"_common_extra_info",void 0),h(this,"_had_selected_p2p",void 0),h(this,"_rtc_env_type",void 0),h(this,"_room_id",void 0),h(this,"_user_id",void 0),h(this,"_rtc_session_id",void 0),h(this,"_user_agent",void 0),h(this,"_auto_play_policy",void 0),h(this,"_platform",void 0),h(this,"_product",void 0),h(this,"_log_cache_key",void 0),h(this,"_overSea","0"),this.monitor=t}return l(e,[{key:"setStats",value:function(e){var t=this;Object.keys(e).forEach((function(r){t["_"+r]=e[r]})),this.monitor.StartUp()}},{key:"event_key",get:function(){return this._event_key}},{key:"device_id",get:function(){return this._device_id}},{key:"rtc_app_id",get:function(){return this._rtc_app_id}},{key:"product_line",get:function(){return this._product_line}},{key:"report_version",get:function(){return this._report_version}},{key:"os",get:function(){return this._os}},{key:"rtc_sdk_version",get:function(){return this._rtc_sdk_version}},{key:"rtc_timestamp",get:function(){return this._rtc_timestamp}},{key:"rtc_sdk_git_commit",get:function(){return this._rtc_sdk_git_commit}},{key:"report_id",get:function(){return this._report_id}},{key:"connection_id",get:function(){return this._connection_id}},{key:"rtc_sid",get:function(){return this._rtc_sid}},{key:"engine_session_id",get:function(){return this._engine_session_id}},{key:"rtc_business_id",get:function(){return this._rtc_business_id}},{key:"app_sate",get:function(){return this._app_sate}},{key:"project_key",get:function(){return this._project_key}},{key:"network_type",get:function(){return this._network_type}},{key:"app_version",get:function(){return this._app_version}},{key:"aid",get:function(){return this._aid}},{key:"device_model",get:function(){return this._device_model}},{key:"device_brand",get:function(){return this._device_brand}},{key:"common_extra_info",get:function(){return this._common_extra_info}},{key:"had_selected_p2p",get:function(){return this._had_selected_p2p}},{key:"rtc_env_type",get:function(){return this._rtc_env_type}},{key:"room_id",get:function(){return this._room_id}},{key:"user_id",get:function(){return this._user_id}},{key:"rtc_session_id",get:function(){return this._rtc_session_id}},{key:"user_agent",get:function(){return this._user_agent}},{key:"auto_play_policy",get:function(){return this._auto_play_policy}},{key:"platform",get:function(){return this._platform||"web"}},{key:"product",get:function(){return this._product||"webrtc"}},{key:"log_cache_key",get:function(){return this._log_cache_key}},{key:"overSea",get:function(){return this._overSea}}]),e}(),PB=function(e){f(r,e);var t=g(r);function r(){var e;return u(this,r),h(m(e=t.call(this)),"report_id",void 0),h(m(e),"report_common",void 0),h(m(e),"modify_ids",void 0),h(m(e),"dataBuffer",void 0),h(m(e),"posting",void 0),h(m(e),"sucSendTimer",void 0),h(m(e),"preSucTime",void 0),h(m(e),"errSendTimer",void 0),h(m(e),"errSendDelay",void 0),h(m(e),"commonStats",void 0),e.report_id=0,e.dataBuffer=[],e.posting=!1,e.report_common={},e.modify_ids={},e.preSucTime=0,e.errSendDelay=100,e.commonStats=new NB(m(e)),vP()||window.addEventListener("beforeunload",(function(){clearTimeout(e.errSendTimer),clearTimeout(e.sucSendTimer),e.send(null,!0)})),e}return l(r,[{key:"push",value:function(e,t){t?this.send(e):(this.dataBuffer.push(e),!this.posting&&!this.errSendTimer&&Date.now()-this.preSucTime>2e3&&(clearTimeout(this.sucSendTimer),this.send()))}},{key:"unshift",value:function(e){this.dataBuffer=e.concat(this.dataBuffer)}},{key:"send",value:function(e,t){var r=this;if(e||this.dataBuffer.length){var n={data:e||this.dataBuffer.splice(0,4e3),header:this.report_common,from:"web",os:"web",version:"1"},i=new XMLHttpRequest;i.timeout=1e4,i.onreadystatechange=function(){if(4===i.readyState){var o;if(e||(r.posting=!1),200===i.status||304===i.status)try{o=JSON.parse(i.responseText)}catch(T0){}o&&0===o.StatusCode?e||t||(!vP()&&location.search.includes("_rtc_autotest_")&&r.safeEmit("report_event",n),r.sucSend()):e?r.send(e):(r.unshift(n.data),t?r.send():r.errSend())}};var o=oj.LOG_SERVER_URL;if(i.open("POST",o,!0),e||(this.posting=!0),!vP()&&location.search.includes("_rtc_debug_"))i.send(JSON.stringify(n));else{var a=ZF.gzip(JSON.stringify(n));i.setRequestHeader("Content-Encoding","gzip"),i.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"),i.send(a)}}}},{key:"sucSend",value:function(){this.errSendDelay=100,this.preSucTime=Date.now(),this.sucSendTimer=setTimeout(this.send.bind(this),2e3)}},{key:"errSend",value:function(){var e=this;this.errSendTimer=setTimeout((function(){e.send(),e.errSendTimer=null}),this.errSendDelay),this.errSendDelay*=2}},{key:"StartUp",value:function(){var e=this.report_common,t=this.commonStats,r=t.event_key,n=t.device_id,i=t.rtc_app_id,o=t.product_line,a=t.report_version,s=t.os,c=t.rtc_sdk_version,u=t.rtc_timestamp,d=t.rtc_sdk_git_commit,l=t.report_id,h=t.rtc_sid,f=t.engine_session_id,p=t.rtc_business_id,v=t.project_key,_=t.network_type,m=t.app_version,y=t.aid,g=t.device_model,S=t.device_brand,b=t.common_extra_info,E=t.had_selected_p2p,k=t.rtc_env_type,T=t.user_agent,I=t.auto_play_policy,A=t.platform,R=t.product,w=t.log_cache_key,C=t.overSea;Object.assign(e,{event_key:r,device_id:n,rtc_app_id:i,product_line:o,report_version:a,os:s,rtc_sdk_version:c,rtc_timestamp:u,rtc_sdk_git_commit:d,report_id:l,rtc_sid:h,engine_session_id:f,rtc_business_id:p,project_key:v,network_type:_,app_version:m,aid:y,device_model:g,device_brand:S,common_extra_info:b,had_selected_p2p:E,rtc_env_type:k,user_agent:T,auto_play_policy:I,platform:A,product:R,log_cache_key:w,extra_is_oversea:C}),this.modify_ids.room_id=this.commonStats.room_id,this.modify_ids.user_id=this.commonStats.user_id,this.modify_ids.rtc_session_id=this.commonStats.rtc_session_id,this.modify_ids.connection_id=this.commonStats.connection_id,this.modify_ids.app_sate=this.commonStats.app_sate}},{key:"rtcSdkApiCall",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=i(i({event_key:"rtc_sdk_api_call",report_id:this.report_id++,rtc_timestamp:Date.now(),sdk_api_name:e,error_code:t,message:r},this.modify_ids),{},{common_extra_info:JSON.stringify(n)});n.streamId&&(o.stream_id=n.streamId),this.push(o)}},{key:"rtcSdkCallback",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=i(i({event_key:"rtc_sdk_callback",report_id:this.report_id++,rtc_timestamp:Date.now(),sdk_callback_name:e,error_code:t,message:r},this.modify_ids),{},{common_extra_info:JSON.stringify(n)});this.push(o)}},{key:"rtcGetConfig",value:function(e,t,r,n,o,a,s){var c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:{},u=i(i({event_key:"rtc_get_config",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,elapse:r,host:n,type:o,config_id:a,enable_cloud_proxy:s},this.modify_ids),{},{common_extra_info:JSON.stringify(c)});this.push(u)}},{key:"rtcReconnect",value:function(e,t,r,n){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},a=i(i({event_key:"rtc_reconnect",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,reconnect_id:r,reconnect_type:n},this.modify_ids),{},{common_extra_info:JSON.stringify(o)});this.push(a)}},{key:"rtcReconnected",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i({event_key:"rtc_reconnected",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,reconnect_type:t},this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}},{key:"rtcGetAccess",value:function(e,t,r,n,o,a){var s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:{},c=i(i({event_key:"rtc_get_access",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,elapse:r,type:n,host:o,connect_session_id:a},this.modify_ids),{},{common_extra_info:JSON.stringify(s)});this.push(c)}},{key:"rtcPreIceState",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i({event_key:"rtc_pre_ice_state",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,ice_state:t},this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}},{key:"rtcNodeChange",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=i(i({event_key:"rtc_node_change",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,reason:r},this.modify_ids),{},{common_extra_info:JSON.stringify(n)});this.push(o)}},{key:"rtcSignalingMsgError",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=i(i({event_key:"rtc_signaling_msg_error",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,reason:r},this.modify_ids),{},{common_extra_info:JSON.stringify(n)});this.push(o)}},{key:"rtcSignaling",value:function(e,t,r,n,o,a,s){var c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:{},u=i(i({event_key:"rtc_signaling",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,signaling_event:r,signaling_type:n,stream_id:o,stream_user_id:a,direction:s},this.modify_ids),{},{common_extra_info:JSON.stringify(c)});this.push(u)}},{key:"rtcJoinRoom",value:function(e,t,r,n){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},a=i(i({event_key:"rtc_join_room",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,deviceModel:t,deviceManufacturer:r,elapse:n},this.modify_ids),{},{common_extra_info:JSON.stringify(o)});this.push(a)}},{key:"rtcLeaveRoom",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=i(i({event_key:"rtc_leave_room",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,elapse:r},this.modify_ids),{},{common_extra_info:JSON.stringify(n)});this.push(o)}},{key:"rtcBeginCreateOffer",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=i(i({event_key:"rtc_begin_create_offer",report_id:this.report_id++,rtc_timestamp:Date.now(),direction:e,stream_id:t,stream_user_id:r},this.modify_ids),{},{common_extra_info:JSON.stringify(n)});this.push(o)}},{key:"rtcCreateOffer",value:function(e,t,r,n,o){var a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},s=i(i({event_key:"rtc_create_offer",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,direction:t,stream_id:r,stream_user_id:n,elapse:o},this.modify_ids),{},{common_extra_info:JSON.stringify(a)});this.push(s)}},{key:"rtcSetDescription",value:function(e,t,r,n,o,a,s){var c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:{},u=i(i({event_key:"rtc_set_description",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,is_local:r,direction:n,stream_id:o,stream_user_id:a,elapse:s},this.modify_ids),{},{common_extra_info:JSON.stringify(c)});this.push(u)}},{key:"rtcRecvAnswer",value:function(e,t,r,n,o,a,s){var c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:{},u=i(i({event_key:"rtc_recv_answer",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,answer_type:t,sequence_id:r,message:n,direction:o,stream_id:a,stream_user_id:s},this.modify_ids),{},{common_extra_info:JSON.stringify(c)});this.push(u)}},{key:"firstRemoteAudioRender",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i({event_key:"first_remote_audio_render",report_id:this.report_id++,rtc_timestamp:Date.now(),stream_id:e,stream_user_id:t},this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}},{key:"firstRemoteVideoRender",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i({event_key:"first_remote_video_render",report_id:this.report_id++,rtc_timestamp:Date.now(),stream_id:e,stream_user_id:t},this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}},{key:"rtcPublishStat",value:function(e,t,r,n){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},a=i(i({event_key:"rtc_publish_stat",report_id:this.report_id++,rtc_timestamp:Date.now(),result:e,is_screen:t,start:r,message:n},this.modify_ids),{},{common_extra_info:JSON.stringify(o)});this.push(a)}},{key:"rtcSubscribeStat",value:function(e,t,r,n){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},a=i(i({event_key:"rtc_subscribe_stat",report_id:this.report_id++,rtc_timestamp:Date.now(),result:e,start:t,message:r,stream_user_id:n},this.modify_ids),{},{common_extra_info:JSON.stringify(o)});this.push(a)}},{key:"rtcAudioDevice",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=i(i({event_key:"rtc_audio_device",report_id:this.report_id++,rtc_timestamp:Date.now(),audio_event:e,message:t,error_code:r},this.modify_ids),{},{common_extra_info:JSON.stringify(n)});this.push(o)}},{key:"rtcMediaStatistics",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i(i(i({event_key:"rtc_media_statistics",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}},{key:"rtcMessageStatistics",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=i(i({event_key:"rtc_message_statistics",report_id:this.report_id++,rtc_timestamp:Date.now(),dc_user_message:e,dc_room_message:t,media_server_ip:r},this.modify_ids),{},{common_extra_info:JSON.stringify(n)});this.push(o)}},{key:"rtcError",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i({event_key:"rtc_error",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,error_code:t},this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}},{key:"rtcInvokeStatus",value:function(e,t,r,n,o){var a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},s=i(i({event_key:"rtc_invoke_status",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,error_code:t,sdk_api_name:r,stream_id:n,elapse:o},this.modify_ids),{},{common_extra_info:JSON.stringify(a),direction:a.direction});this.push(s)}},{key:"rtcFirstFrame",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=i(i(i({event_key:"rtc_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),this.modify_ids),{},{common_extra_info:JSON.stringify(t)});this.push(r)}},{key:"rtcMuteRemote",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i({event_key:"rtc_mute_remote",report_id:this.report_id++,rtc_timestamp:Date.now(),mute_info:e,media_type:t},this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}},{key:"sdkInitEngine",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i({event_key:"sdk_init_engine",report_id:this.report_id++,rtc_timestamp:Date.now(),start:e,type:t},this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}},{key:"joinRoom",value:function(e,t,r,n){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},a=i(i({event_key:"join_room",report_id:this.report_id++,rtc_timestamp:Date.now(),type:e,start:t,result:r,reason:n},this.modify_ids),{},{common_extra_info:JSON.stringify(o)});this.push(a)}},{key:"p2pConnectionStatus",value:function(e,t,r,n,o){var a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},s=i(i({event_key:"p2p_connection_status",report_id:this.report_id++,rtc_timestamp:Date.now(),room_id:e,user_id:t,peer_user_id:r,status:n,elapse:o},this.modify_ids),{},{common_extra_info:JSON.stringify(a)});this.push(s)}},{key:"p2pConnectClosed",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=i(i({event_key:"p2p_connect_closed",report_id:this.report_id++,rtc_timestamp:Date.now(),p2p_selected:e},this.modify_ids),{},{common_extra_info:JSON.stringify(t)});this.push(r)}},{key:"rtcDeviceError",value:function(e,t,r,n,o,a,s,c,u,d,l,h,f,p,v,_){var m=arguments.length>16&&void 0!==arguments[16]?arguments[16]:{},y=i(i({event_key:"rtc_device_error",report_id:this.report_id++,rtc_timestamp:Date.now(),device_type:e,device_stage:t,error_code:r,system_error_code:n,system_api:o,call_parameters:a,location:s,message:c,media_device_id:u,media_device_name:d,elapse:l,scenario:h,event_session_id:f,device_pid:p,device_vid:v,media_mode:_},this.modify_ids),{},{common_extra_info:JSON.stringify(m)});this.push(y)}},{key:"rtcVideoDevice",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i({event_key:"rtc_video_device",report_id:this.report_id++,rtc_timestamp:Date.now(),media_device_id:e,media_device_name:t},this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}},{key:"rtcVideoCaptureEvent",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=i(i(i({event_key:"rtc_video_capture_event",report_id:this.report_id++,rtc_timestamp:Date.now()},e),this.modify_ids),{},{common_extra_info:JSON.stringify(t)});this.push(r)}},{key:"rtcEncodeFirstFrame",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i(i(i({event_key:"rtc_encode_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}},{key:"rtcFirstFrameEncoded",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i(i(i({event_key:"rtc_first_frame_encoded",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}},{key:"rtcSendFirstPacket",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i(i(i({event_key:"rtc_send_first_packet",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}},{key:"rtcRecvFirstPacket",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i(i(i({event_key:"rtc_recv_first_packet",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}},{key:"rtcRecvFirstFrame",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i(i(i({event_key:"rtc_recv_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}},{key:"rtcDecodeFirstFrame",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i(i(i({event_key:"rtc_decode_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}}]),r}($L),MB=new PB,LB=new PB,UB=new PB,VB=MB.commonStats,FB=LB.commonStats,BB=UB.commonStats;function jB(e){VB.setStats({app_sate:e}),FB.setStats({app_sate:e}),BB.setStats({app_sate:e})}!vP()&&(jB("active"),document.addEventListener("visibilitychange",(function(){"visible"===document.visibilityState?jB("active"):"hidden"===document.visibilityState&&jB("background")})));var GB={default:MB,rtm:LB,outsideRoom:UB};function HB(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default",t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return function(t,n,i){if("function"==typeof i.value){var o=i.value;i.value=function(){for(var t=arguments.length,i=new Array(t),a=0;a<t;a++)i[a]=arguments[a];var s={};r.forEach((function(e,t){s[e]=i[t]})),"joinRoom"===n&&VB.setStats({room_id:i[1]}),GB[e].rtcSdkApiCall(n,0,JSON.stringify(NP(i)),s);var c=o.apply(this,i);return"function"==typeof(null==c?void 0:c.then)?c.then((function(t){return GB[e].rtcSdkCallback(n,0,JSON.stringify(NP([t||{}]))),t})).catch((function(t){throw GB[e].rtcSdkCallback(n,t.code,JSON.stringify(t.message)),t})):(GB[e].rtcSdkCallback(n,0,JSON.stringify(NP([c||{}]))),c)}}}}function zB(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=e===oe.onUserMessageReceivedOutsideRoom||e===oe.onUserBinaryMessageReceivedOutsideRoom;(n?LB:MB).rtcSdkCallback(e,r,JSON.stringify(t))}function XB(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];(n?LB:MB).rtcInvokeStatus(JSON.stringify(t),r,e,"",0)}var KB="BytePlus",qB="RTC_DEVICE_ID",WB="RTC_ACCESS_NODE",YB="RTC_ACCESS_URLS",JB="RTC_H264_BLACK_LIST",QB="engine_BAC",ZB=function(){function e(){u(this,e)}return l(e,[{key:"get",value:function(e){var t=localStorage.getItem(e);if(!t)return null;try{var r=JSON.parse(t);return r.ttl>0&&Date.now()-r.saveTime>r.ttl?(this.delete(e),null):r.message}catch(n){return null}}},{key:"set",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,n={ttl:r,saveTime:Date.now(),message:t};try{return localStorage.setItem(e,JSON.stringify(n)),!0}catch(i){return!1}}},{key:"delete",value:function(e){try{return localStorage.removeItem(e),!0}catch(t){return!1}}}]),e}(),$B=function(e){f(r,e);var t=g(r);function r(){return u(this,r),t.apply(this,arguments)}return l(r,[{key:"getDeviceId",value:function(){if(vP())return"";var e=this.get(qB);return e&&!/^[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}$/.test(e)||(e=function(e){for(var t="",r=0;r<e;r++)t+=Math.floor(10*Math.random());return t}(30)),this.setDeviceId(e),e}},{key:"setDeviceId",value:function(e){return[VB,FB,BB].forEach((function(t){return t.setStats({device_id:e})})),this.set(qB,e),e}},{key:"getAccessNode",value:function(e){return this.get("".concat(WB,"_").concat(e,"-").concat(KB))}},{key:"setAccessNode",value:function(e,t,r){return this.set("".concat(WB,"_").concat(e,"-").concat(KB),t,1e3*r)}},{key:"clearAccessNode",value:function(e){this.delete("".concat(WB,"_").concat(e,"-").concat(KB))}},{key:"getAccessUrls",value:function(){return this.get("".concat(YB,"-").concat(KB))}},{key:"setAccessUrls",value:function(e){var t=e.map((function(e){var t=e.host,r=e.path;return"https://".concat(t).concat(r)}));return this.set("".concat(YB,"-").concat(KB),t)}},{key:"clearAccessUrls",value:function(){this.delete("".concat(YB,"-").concat(KB))}},{key:"getH264BlackList",value:function(){return this.get(JB)}},{key:"setH264BlackList",value:function(e){return this.set(JB,e)}},{key:"getAudioProfile",value:function(){return this.get(QB)}},{key:"setAudioProfile",value:function(e){return this.set(QB,e)}}]),r}(ZB),ej=new $B,tj="rtc-access.rtcplus.com,rtc-access-sg.rtcplus.com,rtc-access-va.rtcplus.com,rtc-access-fr.rtcplus.com".split(",");function rj(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return/^https?:\/\/.+/.test(e)||(e="https://"+e),"".concat(e,"/dispatch/v1/AccessInfo?Action=GetAccessInfo")}var nj="https://web-log-report.rtcplus.com/video/v1/webrtc_log/",ij="rtc.rtcplus.com".split(","),oj={VERSION:"4.49.2",ICE_CONFIG_REQUEST_URLS_INTERNAL:tj.map(rj),ICE_CONFIG_REQUEST_URLS:[],EXPECTED_ADDR:"",LOG_SERVER_URL:nj,CONFIG_REQUEST_DOMAINS:ij,DEVICE_ID:"",OVERSEA:!1,PLATFORM:"",PRODUCT:""};function aj(e,t){if(MB.rtcSdkApiCall("setParameter",0,"key: ".concat(e,", value: ").concat(t)),"VERSION"!==e){if("ICE_CONFIG_REQUEST_URLS"===e)return"string"==typeof t&&(t=[t]),void(oj.ICE_CONFIG_REQUEST_URLS=t.map(rj));if("PLATFORM"!==e||"string"!=typeof t)if("PRODUCT"!==e||"string"!=typeof t)if("LOG_SERVER_URL"!==e||t!==j.overseas)if("LOG_SERVER_URL"!==e||t!==j.domestic)if("LOG_SERVER_URL"!==e||"string"!=typeof t){if("OVERSEA"===e)return VB.setStats({overSea:t?"1":"0"}),void(oj.OVERSEA=t);"DEVICE_ID"===e&&ej.setDeviceId(t),oj[e]=t}else oj.LOG_SERVER_URL=t;else oj.LOG_SERVER_URL=nj;else oj.LOG_SERVER_URL="https://web-log-report.rtcplus.com/video/v1/webrtc_log/";else VB.setStats({product:t});else VB.setStats({platform:t})}}function sj(e){return"DEVICE_ID"===e?ej.getDeviceId():oj[e]}function cj(e,t,r){var n,i,o,a,s,c,u,d,l;return{type:"publicstream",action:t,publicStreamID:e,publicStreamMeta:{audio:{},video:{fps:(null===(n=r.video)||void 0===n?void 0:n.fps)||15,bitrate:1e3*((null===(i=r.video)||void 0===i?void 0:i.kBitRate)||40),width:(null===(o=r.video)||void 0===o?void 0:o.width)||640,height:(null===(a=r.video)||void 0===a?void 0:a.height)||360},layout:{layoutMode:2,interpolationMode:(null===(s=r.layout)||void 0===s?void 0:s.interpolationMode)||z.PREV_FRAME,canvas:{bgColor:(null===(c=r.layout)||void 0===c?void 0:c.backgroundColor)||"#000000",bgImage:(null===(u=r.layout)||void 0===u?void 0:u.backgroundImage)||""},regions:(null===(d=r.layout)||void 0===d||null===(l=d.regions)||void 0===l?void 0:l.map((function(e){return{roomId:e.roomId,userId:e.userId,alterImage:e.alertImage||"",alpha:!e.alpha||+e.alpha>1||+e.alpha<=0?1:+e.alpha,x:!e.x||+e.x>=1||+e.x<0?0:+e.x,y:!e.y||+e.y>=1||+e.y<0?0:+e.y,w:!e.w||+e.w>1||+e.w<=0?1:+e.w,h:!e.h||+e.h>1||+e.h<=0?1:+e.h,zorder:!e.zorder||+e.zorder<0||+e.zorder>100?0:+e.zorder,renderMode:void 0===e.renderMode?1:e.renderMode,streamType:e.isScreenStream?1:0,mediaType:e.mediaType||0,sourceCrop:e.sourceCrop}})))||[]}}}}var uj,dj={width:640,height:360,frameRate:15,maxKbps:600},lj={width:1920,height:1080,frameRate:15,maxKbps:3e3},hj=function(e){return e.streamRemovedBySchedule308="stream removed",e.clientRePublish="client republish",e.publishStreamFaied="publish failed",e.clientUnPublish="client unpublished",e.clientDisconnected="client disconnected",e.videoMuted="video muted",e}(hj||{}),fj=function(e){return e.PushLimitWarn="PushLimitWarn",e}(fj||{}),pj=function(e){return e.ON_ADD_STREAM="onAddStream",e.ON_ADD_STREAM_LIST="onAddStreamList",e.ON_REMOVE_STREAM="onRemoveStream",e.ON_REMOVE_STREAM_LIST="onRemoveStreamList",e.USER_DISCONNECTION="userDisconnection",e.USER_DISCONNECTION_LIST="userDisconnectionList",e.USER_CONNECTION="userConnection",e.USER_CONNECTION_LIST="userConnectionList",e.ON_UPDATE_STREAM_ATTRIBUTES="onUpdateStreamAttributes",e.ON_UPDATE_ROOM_ATTRIBUTES="onUpdateRoomAttributes",e.ON_UPDATE_USER_ATTRIBUTES="onUpdateUserAttributes",e.ON_PUSH_TRACK="onPushTrack",e.ON_REMOVE_TRACK="onRemoveTrack",e.ON_CUSTOM_MESSAGE="onCustomMessage",e.NODE_CHANGE="nodeChange",e.USER_MESSAGE_RECEIVED="userMessageReceived",e.USER_BINARY_MESSAGE_RECEIVED="userBinaryMessageReceived",e.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM="userMessageReceivedOutsideRoom",e.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM="userBinaryMessageReceivedOutsideRoom",e.POST_PROCESSING_MESSAGE="postProcessingMessage",e.ON_USER_TOKEN_WILL_EXPIRE="onUserTokenWillExpire",e.STREAM_CONTROL_MESSAGE="streamControlMessage",e.ON_SCENE_CONFIG="onSceneConfig",e.ON_SPEAKER_CHANGE="onSpeakerChange",e.ON_STREAM_FAILED="streamFailed",e}(pj||{}),vj=function(e){return e.RSCP="RSCP",e.RTT="RTT",e}(vj||{}),_j=function(e){return e.ON_CONNECTION_STATE_CHANGE="onConnectionStateChange",e.ABNORMAL_DISCONNECTION="normalConnection",e}(_j||{}),mj=function(e){return e.userLeave="userLeave",e.connectionLost="connectionLost",e.userDuplicateLogin="userDuplicateLogin",e.kickedByAdmin="kickedByAdmin",e.roleChanged="roleChanged",e.onUserTokenDidExpire="onUserTokenDidExpire",e}(mj||{}),yj=function(e){return e[e.roomDismissByAdmin=2]="roomDismissByAdmin",e}(yj||{}),gj=function(e){return e[e.SEND=0]="SEND",e[e.FEEDBACK=1]="FEEDBACK",e}(gj||{}),Sj=function(e){return e[e.P2P=0]="P2P",e[e.SIGNAL=1]="SIGNAL",e[e.BROADCAST=2]="BROADCAST",e[e.BUSINESS_SERVER=3]="BUSINESS_SERVER",e}(Sj||{}),bj=function(e){return e[e.SUCCESS=0]="SUCCESS",e[e.TIMEOUT=1]="TIMEOUT",e[e.BROKEN=2]="BROKEN",e[e.NO_RECEIVER=3]="NO_RECEIVER",e[e.NO_RELAYPATH=4]="NO_RELAYPATH",e[e.SEND_TO_SERVER_ERROR=17]="SEND_TO_SERVER_ERROR",e[e.SERVER_RESPONSE_ERROR=18]="SERVER_RESPONSE_ERROR",e[e.NOT_JOIN=100]="NOT_JOIN",e[e.INIT=101]="INIT",e[e.NO_CONNECTION=102]="NO_CONNECTION",e[e.NOT_LOGIN=105]="NOT_LOGIN",e[e.SERVER_PARAMS_NOTSET=106]="SERVER_PARAMS_NOTSET",e[e.UNKNOWN=1e3]="UNKNOWN",e}(bj||{}),Ej=(h(uj={},0,[0,"success"]),h(uj,1,[dN.USER_MESSAGE_TIMEOUT,"timeout, failed to send."]),h(uj,2,[dN.USER_MESSAGE_BROKEN,"dataChannel broken, failed to send."]),h(uj,3,[dN.USER_MESSAGE_NO_RECEIVER,"cannot find the receiver."]),h(uj,4,[dN.USER_MESSAGE_NO_RELAYPATH,"cannot find relay path."]),h(uj,17,[dN.USER_MESSAGE_SEND_TO_SERVER_ERROR,"failed to send to business server."]),h(uj,18,[dN.USER_MESSAGE_SERVER_RESPONSE_ERROR,"business server response error."]),h(uj,100,[dN.USER_MESSAGE_NOT_JOIN,"not join room"]),h(uj,101,[dN.USER_MESSAGE_INIT,"not init."]),h(uj,102,[dN.USER_MESSAGE_NO_CONNECTION,"no connection."]),h(uj,105,[dN.USER_MESSAGE_NOT_LOGIN,"not login."]),h(uj,106,[dN.USER_MESSAGE_SERVER_PARAMS_NOTSET,"server param is not set."]),h(uj,1e3,[dN.USER_MESSAGE_UNKNOWN,"unknown."]),uj),kj=["msg"],Tj=new JL("DataChannelSignaling",3),Ij=["onSpeakerChange"],Aj=function(e){return e[e.C2S=0]="C2S",e[e.C2C=1]="C2C",e[e.C2GW=2]="C2GW",e[e.C2CDirect=3]="C2CDirect",e[e.C2RTM=4]="C2RTM",e}(Aj||{}),Rj=6e4,wj=function(e){f(a,e);var t,r,n=g(a);function a(e){var t;return u(this,a),h(m(t=n.call(this)),"_singlingCache",new Map),h(m(t),"_p2pCache",new Map),h(m(t),"_rttIds",{}),h(m(t),"_p2pMessageId",0),h(m(t),"_clearDataChannelListener",void 0),t._dataChannel=e,t._clearDataChannelListener=t._handleHandler(),window.__rtc_mock_signaling__=t.emit.bind(m(t)),t}return l(a,[{key:"destroy",value:function(){this._dataChannel&&(this._clearDataChannelListener(),this._dataChannel.close()),this._singlingCache.clear(),this._p2pCache.clear(),this._p2pMessageId=0,this._rttIds={}}},{key:"sendSignaling",value:function(e,t,r){var n=this;return MB.rtcSignaling(0,JSON.stringify(t),"call-".concat(e),"Send",t.streamId,t.streamUserId,dB.UP),new Promise((function(i,o){var a=n._genHeader(r);a.id=OP();var s=a.id.join("-"),c=setTimeout((function(){n._singlingCache.delete(s),o(new hN(dN.TIME_OUT,"".concat(e," message time out")))}),Rj);n._singlingCache.set(s,{signalingType:e,success:function(e){clearTimeout(c),i(e)},error:function(e){clearTimeout(c),o(e)}}),Tj.print("Signal",">>>>>> [".concat(e,"][").concat(s,"]"),t),n._sendMessage(e,a,t)}))}},{key:"sendPingSignaling",value:function(){return this.sendSignaling("CheckConnectivity",{ts:Date.now()},{functionType:2})}},{key:"sendP2PMessage",value:(r=c(o().mark((function e(t,r){var n,a,s;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.msg,a=_(t,kj),s=n instanceof ArrayBuffer,e.t0=this,e.t1=i,e.t2=i({ver:1,id:this._p2pMessageId++,time:Date.now(),dir:gj.SEND,type:Sj.P2P,err:bj.SUCCESS},a),e.t3={},e.t4=s,!s){e.next=13;break}return e.next=10,_P.ab2b64str(n);case 10:e.t5=e.sent,e.next=14;break;case 13:e.t5=n;case 14:return e.t6=e.t5,e.t7={binary:e.t4,msg:e.t6},e.t8=(0,e.t1)(e.t2,e.t3,e.t7),e.t9=r,e.abrupt("return",e.t0._sendP2PMessage.call(e.t0,e.t8,e.t9));case 19:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"_sendP2PMessage",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return DP(e.msg)?this._rttIds[e.id]=e.id:e.dir===gj.SEND&&Tj.print("_sendP2PMessage [DC Signaling p2p >>]",JSON.stringify(e)),new Promise((function(n,o){var a=t._genHeader(i(i({needAck:!0,functionType:1},r),{},{id:OP()}));if(e.dir===gj.SEND){var s=setTimeout((function(){t._p2pCache.delete(e.id),o(new hN(dN.TIME_OUT,"P2P message timeout"))}),Rj);t._p2pCache.set(e.id,{success:function(e,t){clearTimeout(s),n(t)},error:function(e){clearTimeout(s);var t=E(Ej[e.err]||[dN.USER_MESSAGE_UNKNOWN,"err: ".concat(e.err,", msg: ").concat(e.msg)],2),r=t[0],n=t[1];o({err:e.err,code:r,message:e.msg||n})}})}t._sendMessage("p2p",a,e)}))}},{key:"_sendMessage",value:function(e,t,r){if(!this._dataChannel||"open"!==this._dataChannel.readyState)throw new hN(dN.SIGNALING_CHANNEL_NOT_OPEN,"DataChannel not open");var n=t.version+(+t.zip<<5)+(+t.encrypt<<6),i=+t.needAck+(+t.direction<<1)+(+t.functionType<<2)+(+t.binary<<6),o=_P.str2ab(JSON.stringify([e,r])),a=pP(Uint8Array,[n,i].concat(k(t.id||[])),new Uint8Array(o));this._dataChannel.send(a.buffer)}},{key:"_dispartData",value:function(e){var t=new Uint8Array(e),r=0,n=t[r++],i=t[r++],o={version:15&n,zip:16==(16&n),encrypt:32==(32&n),needAck:1==(1&i),direction:(2&i)>>1,functionType:(60&i)>>2,binary:64==(64&i)};if(o.needAck||1===o.direction){for(;r<=6;r++)if(128!=(128&t[r])){r++;break}o.id=Array.from(t.slice(2,r))}return{header:o,data:t.slice(r)}}},{key:"_feedbackSignaling",value:function(e,t,r){var n=this._genHeader({needAck:!0,direction:1,id:e.split("-").map((function(e){return+e}))});Ij.includes(t)||Tj.print("Signal",">>>>>> [".concat(t,"-res][").concat(e,"]")),this._sendMessage("".concat(t,"-res"),n,r)}},{key:"_handleMessage",value:(t=c(o().mark((function e(t){var r,n,a,s,c,u,d,l,h,f,p,v,_,m,y,g,S,b,k,T,I,A,R,w,C,O,x,D,N,P,M,L;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:u=this._dispartData(t),d=u.data,(l=u.header).zip&&((h=new ZF.Inflate).push(d,!0),d=h.result),f=_P.ab2str(d),p=[],e.prev=6,p=JSON.parse(f),e.next=14;break;case 10:return e.prev=10,e.t0=e.catch(6),e.t0 instanceof Error&&MB.rtcSignalingMsgError(-1,e.t0.message,uB.MESSAGE_PARSE_FAILED),e.abrupt("return");case 14:e.t1=l.functionType,e.next=0===e.t1?17:1===e.t1?34:2===e.t1?83:101;break;case 17:if(v=(null===(r=l.id)||void 0===r?void 0:r.join("-"))||"",1!==l.direction){e.next=22;break}this._handleAckMessage(v,p[0]||{},f),e.next=33;break;case 22:if(!Array.isArray(p)){e.next=33;break}if(_=p[0],p=p[1],Ij.includes(_)||Tj.print("Signal","<<<<<< ".concat(_),p,v),this._feedbackSignaling(v,_,_===pj.ON_CUSTOM_MESSAGE?i(i({},p),{},{message:""}):""),!p.binary||"string"!=typeof p.message){e.next=31;break}return e.next=30,_P.b64str2ab(p.message);case 30:p.message=e.sent;case 31:this.emit(_,i({},p)),MB.rtcSignaling(0,f,"on-".concat(_),"Recv",p.streamId,p.clientId,dB.DOWN);case 33:return e.abrupt("break",102);case 34:Array.isArray(p)&&(p=p[1]),m=null===(n=p)||void 0===n?void 0:n.id,this._rttIds[m]||(null===(a=p)||void 0===a?void 0:a.dir)===gj.FEEDBACK||DP(null===(s=p)||void 0===s?void 0:s.msg)?delete this._rttIds[m]:Tj.print("Signal","<<<<<< p2p response",p),e.t2=p.dir,e.next=e.t2===gj.SEND?40:e.t2===gj.FEEDBACK?78:81;break;case 40:if(DP(null===(c=p)||void 0===c?void 0:c.msg)){e.next=76;break}if(g=(y=p).binary,S=y.msg,b=y.room,k=y.to,T=y.from,I=""===b?g?pj.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM:pj.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM:g?pj.USER_BINARY_MESSAGE_RECEIVED:pj.USER_MESSAGE_RECEIVED,k){e.next=60;break}if(e.t3=this,e.t4=pj.ON_CUSTOM_MESSAGE,e.t5=T,e.t6=g,!g){e.next=54;break}return e.next=51,_P.b64str2ab(S);case 51:e.t7=e.sent,e.next=55;break;case 54:e.t7=S;case 55:e.t8=e.t7,e.t9={clientId:e.t5,binary:e.t6,message:e.t8},e.t3.emit.call(e.t3,e.t4,e.t9),e.next=76;break;case 60:if(e.t10=this,e.t11=I,e.t12=i,e.t13=i({},p),e.t14={},!g){e.next=71;break}return e.next=68,_P.b64str2ab(S);case 68:e.t15=e.sent,e.next=72;break;case 71:e.t15=S;case 72:e.t16=e.t15,e.t17={msg:e.t16},e.t18=(0,e.t12)(e.t13,e.t14,e.t17),e.t10.emit.call(e.t10,e.t11,e.t18);case 76:return this._sendP2PMessage(i(i({},p),{},{dir:gj.FEEDBACK,msg:""})),e.abrupt("break",82);case 78:return(A=this._p2pCache.get(p.id))&&(this._p2pCache.delete(p.id),p.err===bj.SUCCESS?A.success(p.id,p):A.error(p)),e.abrupt("break",82);case 81:return e.abrupt("break",82);case 82:return e.abrupt("break",102);case 83:if(1!==l.direction){e.next=88;break}w=(null===(R=l.id)||void 0===R?void 0:R.join("-"))||"",this._handleAckMessage(w,p[0]||{},f),e.next=100;break;case 88:if(C=E(p,2),O=C[0],x=C[1],D=void 0===x?{}:x,"RXMediaMsg"!==O){e.next=100;break}N=D.type,P=D.data,MB.rtcSignaling(0,f,"on-".concat(N),"Recv","","",dB.DOWN),e.t19=N,e.next="RSCP"===e.t19?95:"RTT"===e.t19?97:99;break;case 95:try{M=JSON.parse(P),Array.isArray(M)&&this.emit(N,M)}catch(o){}return e.abrupt("break",100);case 97:try{(L=JSON.parse(P)).length&&this.emit(N,L[0])}catch(o){}return e.abrupt("break",100);case 99:return e.abrupt("break",100);case 100:case 101:return e.abrupt("break",102);case 102:case"end":return e.stop()}}),e,this,[[6,10]])}))),function(e){return t.apply(this,arguments)})},{key:"_handleHandler",value:function(){var e=this,t=function(t){Tj.print("_handleHandler","dataChannel close",t),e.emit("close",t)},r=function(t){Tj.print("_handleHandler","dataChannel error",t),e.emit("close",t)},n=function(t){e._handleMessage(t.data)};return this._dataChannel.addEventListener("close",t),this._dataChannel.addEventListener("error",r),this._dataChannel.addEventListener("message",n),function(){e._dataChannel.removeEventListener("close",t),e._dataChannel.removeEventListener("error",r),e._dataChannel.removeEventListener("message",n)}}},{key:"_genHeader",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return i({version:2,zip:!1,encrypt:!1,needAck:!0,direction:0,functionType:0,binary:!1},e)}},{key:"_handleAckMessage",value:function(e,t,r){var n=this._singlingCache.get(e);n&&(this._singlingCache.delete(e),200===t.code?n.success(t):n.error(t),Tj.print("Signal","<<<<<< [".concat(n.signalingType,"-ack] ").concat(e),t)),MB.rtcSignaling(0,r,null==n?void 0:n.signalingType,"Ack","","",dB.DOWN)}}]),a}(jL.exports.EventEmitter),Cj=function(){function e(){u(this,e),h(this,"xhr",void 0),h(this,"isSending",void 0),h(this,"timeout",void 0),this.isSending=!1}return l(e,[{key:"ajax",value:function(e){var t=this,r=e.method,n=e.url,i=e.body,o=void 0===i?{}:i,a=e.headers,s=void 0===a?{}:a,c=e.stringify,u=void 0===c||c;return new Promise((function(e,i){t.isSending=!0;var a=new XMLHttpRequest;a.open(r,n,!0);for(var c=0,d=Object.entries(s);c<d.length;c++){var l=E(d[c],2),h=l[0],f=l[1];a.setRequestHeader(h,f)}a.onreadystatechange=function(){if(4===a.readyState)if(t.isSending=!1,200===a.status)e(JSON.parse(a.responseText));else{var r=a.statusText,n=a.status;if(a.responseText)try{var o=JSON.parse(a.responseText);o.errMessage&&(r=o.errMessage),o.code&&(n=o.code)}catch(s){}i({message:r,code:n})}0===a.status&&i({code:0,message:"Request abort"})},a.onerror=function(e){t.isSending=!1,i({code:-1,message:a.responseText||"unknown"})},t.timeout&&(a.timeout=t.timeout),u&&(o=JSON.stringify(o)),a.send(o),t.xhr=a}))}},{key:"get",value:function(e,t){return this.ajax({method:"GET",url:e,headers:t})}},{key:"post",value:function(e,t,r,n){return this.ajax({method:"POST",url:e,body:t,headers:r,stringify:n})}},{key:"abort",value:function(){var e;null===(e=this.xhr)||void 0===e||e.abort()}}]),e}(),Oj=new JL("ICE Request",3),xj=function(){function e(){u(this,e),h(this,"_request",void 0),this._request=new Cj}var t,r,n;return l(e,[{key:"getAccessNode",value:(n=c(o().mark((function e(t,r,n,i,a,s,c,u){var d;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(d=ej.getAccessNode(t))){e.next=9;break}if(this.getAccessNodeFromServer(t,r,n,i,a,s,c,u),XB("es.R.node.cache",d),!Array.isArray(d)){e.next=8;break}return e.abrupt("return",Promise.resolve(d));case 8:return e.abrupt("return",Promise.resolve([d]));case 9:return e.abrupt("return",this.getAccessNodeFromServer(t,r,n,i,a,s,c,u));case 10:case"end":return e.stop()}}),e,this)}))),function(e,t,r,i,o,a,s,c){return n.apply(this,arguments)})},{key:"getAccessNodeFromServer",value:(r=c(o().mark((function e(t,r,n,i,a,s,c,u){var d,l,h,f,p=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return h=ej.getAccessUrls(),f=!0,XB("es.R.req.cache.urls",h),(null===(d=h)||void 0===d?void 0:d.length)>0||(h=oj.ICE_CONFIG_REQUEST_URLS,f=!1,XB("es.R.req.external.urls",h)),(null===(l=h)||void 0===l?void 0:l.length)>0||(h=oj.ICE_CONFIG_REQUEST_URLS_INTERNAL,f=!1,XB("es.R.req.internal.urls",h)),e.abrupt("return",this.getICEConfigFromServer(h,t,r,n,i,a,s,c,u).then((function(e){var r=e.nodes;return ej.setAccessNode(t,r,e.ttl||11200),e.dispatchDomains&&ej.setAccessUrls(e.dispatchDomains),r})).catch((function(e){if(f)return XB("es.R.req.fallback",""),ej.clearAccessUrls(),p.getAccessNodeFromServer(t,r,n,i,a,s,c);throw e})));case 6:case"end":return e.stop()}}),e,this)}))),function(e,t,n,i,o,a,s,c){return r.apply(this,arguments)})},{key:"getICEConfigFromServer",value:(t=c(o().mark((function e(t,r,n,i,a,s,u,d,l){var h,f,p,v,_=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return h={appID:r,userID:i,deviceID:a,connectSessionID:hP(),os:"web",sdkVersion:oj.VERSION,isOversea:oj.OVERSEA,expectedAddr:sj("EXPECTED_ADDR"),productPlatform:"BytePlus",enableCloudProxy:d,expectedIDC:l},s&&u&&(h.feedbackInfo=[{feedbackIP:null===(f=u.publicIPs[0])||void 0===f?void 0:f.ip,feedbackReason:{type:"NODE_CHANGED",reason:s}}],delete h.expectedAddr),p=Date.now(),MB.rtcGetAccess(0,JSON.stringify(h),0,sB.REQUEST,t.join(","),h.connectSessionID),v=t.map(function(){var e=c(o().mark((function e(t,r){var n,i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,_._request.post(t,h);case 3:n=e.sent,e.next=9;break;case 6:throw e.prev=6,e.t0=e.catch(0),new hN(dN.ICE_SERVER_WRONG,"get ICE config failed",e.t0);case 9:if(200===n.code){e.next=11;break}throw new hN(dN.ICE_SERVER_WRONG,"get ICE config failed",{server_code:n.code,message:JSON.stringify(n)});case 11:if(i=n.nodes[0]){e.next=14;break}throw new hN(dN.ICE_SERVER_WRONG,"ICE config server return empty nodes",{code:n.code,message:JSON.stringify(n)});case 14:return e.abrupt("return",{result:n,firstNode:i,index:r});case 15:case"end":return e.stop()}}),e,null,[[0,6]])})));return function(t,r){return e.apply(this,arguments)}}()),e.abrupt("return",MP(v).then((function(e){var r=e.result;e.firstNode;var n=e.index;return MB.rtcGetAccess(200,JSON.stringify(r),Date.now()-p,sB.RESPONSE,t[n],h.connectSessionID),r})).catch((function(e){var r,n,i=null===(r=e[0])||void 0===r?void 0:r.error;throw MB.rtcGetAccess(+((null==i?void 0:i.code)||(null==i?void 0:i.server_code)),null===(n=e[0])||void 0===n?void 0:n.message,Date.now()-p,sB.RESPONSE,t.join(","),h.connectSessionID,{error:JSON.stringify(i)}),i})));case 6:case"end":return e.stop()}}),e)}))),function(e,r,n,i,o,a,s,c,u){return t.apply(this,arguments)})},{key:"abort",value:function(){this._request.isSending&&(Oj.print("abort","HTTP Request of [getICEConfigFromServer] abort"),this._request.abort())}}]),e}(),Dj=function(){function e(){u(this,e),h(this,"_request",void 0),this._request=new Cj}var t;return l(e,[{key:"getH264BlackList",value:(t=c(o().mark((function e(){var t;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=ej.getH264BlackList(),!Array.isArray(t)){e.next=6;break}return this._getH264BlackList(),e.abrupt("return",t);case 6:return e.abrupt("return",this._getH264BlackList());case 7:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"_getH264BlackList",value:function(){var e=this,t={keys:["web_h264_black_list"],labelSelector:"",sdkVersion:"4.49.2",deviceType:"web"};this._request.timeout=800;var r=oj.CONFIG_REQUEST_DOMAINS.map((function(e){return"https://".concat(e,"/decision/v1/multi")}));MB.rtcGetConfig(0,JSON.stringify(t),0,r.join(","),rB.REQUEST,"",!1);var n=r.map(function(){var r=c(o().mark((function r(n,i){var a,s;return o().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,r.next=3,e._request.post(n,t);case 3:s=r.sent,r.next=9;break;case 6:throw r.prev=6,r.t0=r.catch(0),new hN(dN.ICE_SERVER_WRONG,"get config failed");case 9:if(Array.isArray(null===(a=s)||void 0===a?void 0:a.web_h264_black_list)){r.next=11;break}throw new hN(dN.ICE_SERVER_WRONG,"get config failed");case 11:return r.abrupt("return",{result:s,index:i});case 12:case"end":return r.stop()}}),r,null,[[0,6]])})));return function(e,t){return r.apply(this,arguments)}}());return new Promise((function(e){MP(n).then((function(t){var n=t.result,i=t.index;ej.setH264BlackList(n.web_h264_black_list),MB.rtcGetConfig(200,JSON.stringify(n),0,r[i],rB.RESPONSE,"",!1),e(n.web_h264_black_list)})).catch((function(t){MB.rtcGetConfig(500,t.message,0,"",rB.RESPONSE,"",!1),e(ej.getH264BlackList()||[])}))}))}},{key:"getAudioProfile",value:function(){var e=this,t={keys:["engine_BAC"],labelSelector:"",sdkVersion:"4.49.2",deviceType:"web"},r=oj.CONFIG_REQUEST_DOMAINS.map((function(e){return"https://".concat(e,"/decision/v1/multi")}));MB.rtcGetConfig(0,JSON.stringify(t),0,r.join(","),rB.REQUEST,"",!1);var n=r.map(function(){var r=c(o().mark((function r(n,i){var a,s;return o().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,r.next=3,e._request.post(n,t);case 3:s=r.sent,r.next=9;break;case 6:throw r.prev=6,r.t0=r.catch(0),new hN(dN.ICE_SERVER_WRONG,"get config failed");case 9:if(Array.isArray(null===(a=s)||void 0===a?void 0:a.engine_BAC)){r.next=11;break}throw new hN(dN.ICE_SERVER_WRONG,"get config failed");case 11:return r.abrupt("return",{result:s,index:i});case 12:case"end":return r.stop()}}),r,null,[[0,6]])})));return function(e,t){return r.apply(this,arguments)}}());return new Promise((function(e){MP(n).then((function(t){var n=t.result,i=t.index;ej.setAudioProfile(n.engine_BAC),MB.rtcGetConfig(200,JSON.stringify(n),0,r[i],rB.RESPONSE,"",!1),e(n.engine_BAC)})).catch((function(t){MB.rtcGetConfig(500,t.message,0,"",rB.RESPONSE,"",!1),e(ej.getAudioProfile()||[])}))}))}}]),e}();function Nj(e,t){var r=1,n=e;(e.width>t.width||e.height>t.height)&&(r=e.width/e.height>t.width/t.height?e.width/t.width:e.height/t.height,n={width:Math.floor(e.width/r),height:Math.floor(e.height/r)});return i(i({},n),{},{scaleResolutionDownBy:r})}var Pj=[{sub_index:0,video_index:0,framerate:30,height:1080,maxkbps:3e3,width:1920},{sub_index:1,video_index:0,framerate:30,height:720,maxkbps:1200,width:1280},{sub_index:2,video_index:0,framerate:30,height:630,maxkbps:1100,width:1120},{sub_index:3,video_index:0,framerate:30,height:540,maxkbps:1e3,width:960},{sub_index:4,video_index:1,framerate:30,height:450,maxkbps:800,width:800},{sub_index:5,video_index:1,framerate:30,height:360,maxkbps:600,width:640},{sub_index:6,video_index:1,framerate:30,height:270,maxkbps:400,width:480},{sub_index:7,video_index:2,framerate:15,height:180,maxkbps:300,width:320},{sub_index:8,video_index:2,framerate:15,height:144,maxkbps:200,width:256},{sub_index:9,video_index:3,framerate:15,height:90,maxkbps:100,width:160}],Mj=[{width:1920,height:1080,maxLayers:3,totalPixels:2073600},{width:1280,height:720,maxLayers:3,totalPixels:921600},{width:960,height:540,maxLayers:3,totalPixels:518400},{width:640,height:360,maxLayers:2,totalPixels:230400},{width:480,height:270,maxLayers:2,totalPixels:129600},{width:320,height:180,maxLayers:1,totalPixels:57600},{width:0,height:0,maxLayers:1,totalPixels:0}];var Lj={width:160,height:90,frameRate:15,maxkbps:100},Uj={width:480,height:270,frameRate:15,maxkbps:400};Fh("Set",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),cf);var Vj=new Map,Fj=function(){var e=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e,r){if("chrome-stable"===yP()&&void 0===window.InstallTrigger)try{t.getStats((function(t){var r=[];t.result().forEach((function(e){if(!zj.includes(e.type)){var t={};e.names().forEach((function(r){t[r]=e.stat(r)})),r.push(i(i({},t),{},{id:e.id,type:e.type,timestamp:e.timestamp}))}})),e({all:r,getTrackStats:function(e){return r.filter((function(t){return"ssrc"!==t.type||t.googTrackId===e}))}})}))}catch(T0){r(T0)}else e({all:[],getTrackStats:function(){return[]}})})));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),Bj=function(){var e=c(o().mark((function e(t){var r,n,i,a,s,c;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getStats();case 2:return i=e.sent,a={all:[]},s=new Map,i.forEach((function(e){var t=s.get(e.type)||new Map;t.set(e.id,e),s.set(e.type,t),a.all.push(e)})),c=function(e,t){e.forEach((function(e){var r,n,i,o,a,c,u=e.codecId,d=e.transportId,l=e.trackId,h=e.playoutId;if(null===(r=s.get(Hj.codec))||void 0===r||r.forEach((function(e){e.id===u&&t.add(e)})),null===(n=s.get(Hj.transport))||void 0===n||n.forEach((function(e){e.id===d&&(a=e,t.add(e))})),null===(i=s.get(Hj.track))||void 0===i||i.forEach((function(e){e.id===l&&t.add(e)})),null===(o=s.get(Hj.mediaPlayout))||void 0===o||o.forEach((function(e){e.id===h&&t.add(e)})),a){var f,p,v=a,_=v.localCertificateId,m=v.remoteCertificateId,y=v.selectedCandidatePairId;null===(f=s.get(Hj.certificate))||void 0===f||f.forEach((function(e){(e.id===_||e.id===m)&&t.add(e)})),null===(p=s.get(Hj.candidatePair))||void 0===p||p.forEach((function(e){e.id===y&&(c=e,t.add(e))}))}if(c){var g,S,b=c,E=b.localCandidateId,k=b.remoteCandidateId;null===(g=s.get(Hj.localCandidate))||void 0===g||g.forEach((function(e){e.id===E&&t.add(e)})),null===(S=s.get(Hj.remoteCandidate))||void 0===S||S.forEach((function(e){e.id===k&&t.add(e)}))}}))},null===(r=s.get(Hj.mediaSource))||void 0===r||r.forEach((function(e){var t,r=new Set;r.add(e);var n=[];null===(t=s.get(Hj.outboundRtp))||void 0===t||t.forEach((function(t){var i;t.mediaSourceId===e.id&&(r.add(t),n.push(t),null===(i=s.get(Hj.remoteInboundRtp))||void 0===i||i.forEach((function(e){e.localId===t.id&&r.add(e)})))})),c(n,r),a[e.trackIdentifier]=Array.from(r)})),null===(n=s.get(Hj.inboundRtp))||void 0===n||n.forEach((function(e){var t,r=new Set;r.add(e),null===(t=s.get(Hj.remoteOutboundRtp))||void 0===t||t.forEach((function(t){t.localId===e.id&&r.add(t)})),c([e],r);var n,i=e.trackIdentifier;i||(null===(n=s.get(Hj.track))||void 0===n||n.forEach((function(t){t.id===e.trackId&&(i=t.trackIdentifier)})));a[i]=Array.from(r)})),e.abrupt("return",a);case 10:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),jj=function(){var e=c(o().mark((function e(t,r,n){var i,a,s,c,u,d;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=null==r?void 0:r.id,t instanceof RTCPeerConnection){e.next=3;break}return e.abrupt("return",[]);case 3:if(!gP&&!SP){e.next=10;break}return a=[],e.next=7,t.getStats(r);case 7:return e.sent.forEach((function(e){a.push(e)})),e.abrupt("return",a);case 10:return(!(s=Vj.get(t))||Date.now()-s.timestamp>150)&&(s={timestamp:Date.now(),statsPromise:Bj(t),extraStatsPromise:Fj(t)},Vj.set(t,s)),e.next=14,s.statsPromise;case 14:if(c=e.sent,u=(i?c[i]:c.all)||[],n){e.next=21;break}return e.next=19,s.extraStatsPromise;case 19:d=e.sent,u=u.concat((i?d.getTrackStats(i):d.all)||[]);case 21:return e.abrupt("return",u);case 22:case"end":return e.stop()}}),e)})));return function(t,r,n){return e.apply(this,arguments)}}();yP();var Gj,Hj=function(e){return e.codec="codec",e.inboundRtp="inbound-rtp",e.outboundRtp="outbound-rtp",e.remoteInboundRtp="remote-inbound-rtp",e.remoteOutboundRtp="remote-outbound-rtp",e.mediaSource="media-source",e.csrc="csrc",e.peerConnection="peer-connection",e.dataChannel="data-channel",e.stream="stream",e.track="track",e.transceiver="transceiver",e.sender="sender",e.receiver="receiver",e.transport="transport",e.sctpTransport="sctp-transport",e.candidatePair="candidate-pair",e.localCandidate="local-candidate",e.remoteCandidate="remote-candidate",e.certificate="certificate",e.iceServer="ice-server",e.mediaPlayout="media-playout",e}(Hj||{}),zj=["codec","inbound-rtp","outbound-rtp","remote-inbound-rtp","remote-outbound-rtp","media-source","csrc","peer-connection","data-channel","stream","track","transceiver","sender","receiver","transport","sctp-transport","candidate-pair","local-candidate","remote-candidate","certificate","ice-server"],Xj=new JL("isSupported",0),Kj=function(){var e=c(o().mark((function e(){var t;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,!vP()&&window.RTCPeerConnection&&window.RTCPeerConnection.prototype.addTransceiver&&window.RTCPeerConnection.prototype.createDataChannel){e.next=3;break}return e.abrupt("return",!1);case 3:return e.next=5,qj();case 5:return t=e.sent,e.abrupt("return",(null==t?void 0:t.includes("H264"))||(null==t?void 0:t.includes("vp8")));case 9:return e.prev=9,e.t0=e.catch(0),e.abrupt("return",!1);case 12:case"end":return e.stop()}}),e,null,[[0,9]])})));return function(){return e.apply(this,arguments)}}(),qj=function(){var e=c(o().mark((function e(){var t,r,n,i,a,s,c,u,d,l;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Xj.print("internalGetSupportedCodecs()","Invoke, cachedSupportedCodecs: %o",Gj),!Gj){e.next=3;break}return e.abrupt("return",Gj);case 3:if(t=[],e.prev=4,!navigator.userAgent.includes("VivoBrowser")){e.next=8;break}return e.next=8,PP();case 8:return e.next=10,PP();case 10:if(r=e.sent){e.next=13;break}return e.abrupt("return",t);case 13:if(!["level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f","profile-level-id=42e01f;level-asymmetry-allowed=1;packetization-mode=1","packetization-mode=1;profile-level-id=42e01f;level-asymmetry-allowed=1"].find((function(e){var t=null==r?void 0:r.includes(e);return Xj.print("internalGetSupportedCodecs()","".concat(t?"includes":"not found",": ").concat(e)),t}))){e.next=28;break}return n=navigator.userAgent.toLowerCase(),i=!1,a=["heytapbrowser","mqqbrowser","miuibrowser"],s=new Dj,e.next=21,s.getH264BlackList();case 21:for(c=e.sent,a.push.apply(a,k(c)),Xj.print("internalGetSupportedCodecs()","blackList: %o",a),u=0,d=a;u<d.length;u++)l=d[u],n.includes(l)&&(i=!0);!i&&t.push("H264"),e.next=29;break;case 28:Xj.print("internalGetSupportedCodecs()","sdp: %s",r);case 29:return null!=r&&r.includes("VP8")&&t.push("vp8"),Gj=t,e.abrupt("return",t);case 34:return e.prev=34,e.t0=e.catch(4),e.abrupt("return",t);case 37:case"end":return e.stop()}}),e,null,[[4,34]])})));return function(){return e.apply(this,arguments)}}(),Wj=function(){var e=c(o().mark((function e(){var t;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,qj();case 2:return t=e.sent,e.abrupt("return",t.map((function(e){return e.toUpperCase()})));case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Yj=function(){return"undefined"!=typeof TransformStream&&"undefined"!=typeof RTCRtpSender&&"undefined"!=typeof RTCRtpReceiver&&void 0!==RTCRtpSender.prototype.createEncodedStreams&&void 0!==RTCRtpReceiver.prototype.createEncodedStreams},Jj={},Qj=Uf,Zj=ve,$j=Re,eG=Ac,tG=Fr,rG=Ue,nG=Ss,iG=Be,oG=C_,aG=$c,sG=li,cG=As,uG=Rt,dG=rl,lG=Pc,hG=mc,fG=de,pG=zs.UNSUPPORTED_Y,vG=4294967295,_G=Math.min,mG=[].push,yG=$j(/./.exec),gG=$j(mG),SG=$j("".slice),bG=!fG((function(){var e=/(?:)/,t=e.exec;e.exec=function(){return t.apply(this,arguments)};var r="ab".split(e);return 2!==r.length||"a"!==r[0]||"b"!==r[1]}));eG("split",(function(e,t,r){var n;return n="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,r){var n=cG(iG(this)),i=void 0===r?vG:r>>>0;if(0===i)return[];if(void 0===e)return[n];if(!nG(e))return Zj(t,n,e,i);for(var o,a,s,c=[],u=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.unicode?"u":"")+(e.sticky?"y":""),d=0,l=new RegExp(e.source,u+"g");(o=Zj(hG,l,n))&&!((a=l.lastIndex)>d&&(gG(c,SG(n,d,o.index)),o.length>1&&o.index<n.length&&Qj(mG,c,dG(o,1)),s=o[0].length,d=a,c.length>=i));)l.lastIndex===o.index&&l.lastIndex++;return d===n.length?!s&&yG(l,"")||gG(c,""):gG(c,SG(n,d)),c.length>i?dG(c,0,i):c}:"0".split(void 0,0).length?function(e,r){return void 0===e&&0===r?[]:Zj(t,this,e,r)}:t,[function(t,r){var i=iG(this),o=rG(t)?void 0:uG(t,e);return o?Zj(o,t,i,r):Zj(n,cG(i),t,r)},function(e,i){var o=tG(this),a=cG(e),s=r(n,o,a,i,n!==t);if(s.done)return s.value;var c=oG(o,RegExp),u=o.unicode,d=(o.ignoreCase?"i":"")+(o.multiline?"m":"")+(o.unicode?"u":"")+(pG?"g":"y"),l=new c(pG?"^(?:"+o.source+")":o,d),h=void 0===i?vG:i>>>0;if(0===h)return[];if(0===a.length)return null===lG(l,a)?[a]:[];for(var f=0,p=0,v=[];p<a.length;){l.lastIndex=pG?0:p;var _,m=lG(l,pG?SG(a,p):a);if(null===m||(_=_G(sG(l.lastIndex+(pG?p:0)),a.length))===f)p=aG(a,p,u);else{if(gG(v,SG(a,f,p)),v.length===h)return v;for(var y=1;y<=m.length-1;y++)if(gG(v,m[y]),v.length===h)return v;p=f=_}}return gG(v,SG(a,f)),v}]}),!bG,pG);var EG={},kG={exports:{}},TG=kG.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(TG).forEach((function(e){TG[e].forEach((function(e){e.reg||(e.reg=/(.*)/),e.format||(e.format="%s")}))})),function(e){var t=function(e){return String(Number(e))===e?Number(e):e},r=function(e,r,n){var i=e.name&&e.names;e.push&&!r[e.push]?r[e.push]=[]:i&&!r[e.name]&&(r[e.name]={});var o=e.push?{}:i?r[e.name]:r;!function(e,r,n,i){if(i&&!n)r[i]=t(e[1]);else for(var o=0;o<n.length;o+=1)null!=e[o+1]&&(r[n[o]]=t(e[o+1]))}(n.match(e.reg),o,e.names,e.name),e.push&&r[e.push].push(o)},n=kG.exports,i=RegExp.prototype.test.bind(/^([a-z])=(.*)/);e.parse=function(e){var t={},o=[],a=t;return e.split(/(\r\n|\r|\n)/).filter(i).forEach((function(e){var t=e[0],i=e.slice(2);"m"===t&&(o.push({rtp:[],fmtp:[]}),a=o[o.length-1]);for(var s=0;s<(n[t]||[]).length;s+=1){var c=n[t][s];if(c.reg.test(i))return r(c,a,i)}})),t.media=o,t};var o=function(e,r){var n=r.split(/=(.+)/,2);return 2===n.length?e[n[0]]=t(n[1]):1===n.length&&r.length>1&&(e[n[0]]=void 0),e};e.parseParams=function(e){return e.split(/;\s?/).reduce(o,{})},e.parseFmtpConfig=e.parseParams,e.parsePayloads=function(e){return e.toString().split(" ").map(Number)},e.parseRemoteCandidates=function(e){for(var r=[],n=e.split(" ").map(t),i=0;i<n.length;i+=3)r.push({component:n[i],ip:n[i+1],port:n[i+2]});return r},e.parseImageAttributes=function(e){return e.split(" ").map((function(e){return e.substring(1,e.length-1).split(",").reduce(o,{})}))},e.parseSimulcastStreamList=function(e){return e.split(";").map((function(e){return e.split(",").map((function(e){var r,n=!1;return"~"!==e[0]?r=t(e):(r=t(e.substring(1,e.length)),n=!0),{scid:r,paused:n}}))}))}}(EG);var IG=kG.exports,AG=/%[sdv%]/g,RG=function(e){var t=1,r=arguments,n=r.length;return e.replace(AG,(function(e){if(t>=n)return e;var i=r[t];switch(t+=1,e){case"%%":return"%";case"%s":return String(i);case"%d":return Number(i);case"%v":return""}}))},wG=function(e,t,r){var n=[e+"="+(t.format instanceof Function?t.format(t.push?r:r[t.name]):t.format)];if(t.names)for(var i=0;i<t.names.length;i+=1){var o=t.names[i];t.name?n.push(r[t.name][o]):n.push(r[t.names[i]])}else n.push(r[t.name]);return RG.apply(null,n)},CG=["v","o","s","i","u","e","p","c","b","t","r","z","a"],OG=["i","c","b","a"],xG=EG,DG=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 r=t.outerOrder||CG,n=t.innerOrder||OG,i=[];return r.forEach((function(t){IG[t].forEach((function(r){r.name in e&&null!=e[r.name]?i.push(wG(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){i.push(wG(t,r,e))}))}))})),e.media.forEach((function(e){i.push(wG("m",IG.m[0],e)),n.forEach((function(t){IG[t].forEach((function(r){r.name in e&&null!=e[r.name]?i.push(wG(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){i.push(wG(t,r,e))}))}))}))})),i.join("\r\n")+"\r\n"};Jj.write=DG,Jj.parse=xG.parse,Jj.parseParams=xG.parseParams,Jj.parseFmtpConfig=xG.parseFmtpConfig,Jj.parsePayloads=xG.parsePayloads,Jj.parseRemoteCandidates=xG.parseRemoteCandidates,Jj.parseImageAttributes=xG.parseImageAttributes,Jj.parseSimulcastStreamList=xG.parseSimulcastStreamList;var NG=new JL("FirefoxHandler",3),PG=Math.pow(2,32),MG="kp34Za0H+aVf862l",LG="o/i14u9pJrxRKAsu";function UG(e){return e>PG-18?(NG.print("generateAllSsrc","reset start id",e),UG(e=e-PG+1e4+18)):{audio:e,audioFec:e+1,audioRtx:e+2,video:e+3,videoFec:e+4,videoRtx:e+5,next:e+18}}var VG=function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:LG;return[{id:r,attribute:"cname",value:n},{id:r,attribute:"msid",value:"".concat(e," ").concat(e,"-").concat(t)},{id:r,attribute:"mslabel",value:"".concat(e)},{id:r,attribute:"label",value:"".concat(e,"-").concat(t)}]},FG=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=t.video,i=t.videoRtx,o=t.videoFec,a=[n,i],s=r.cname,c=r.flexfec;c&&a.push(o);var u=a.reduce((function(t,r){return t.concat(VG(e,"video",r,s))}),[]),d=[{semantics:"FID",ssrcs:"".concat(n," ").concat(i)}];return c&&d.push({semantics:"FEC-FR",ssrcs:"".concat(n," ").concat(o)}),{ssrcs:u,ssrcGroups:d}};function BG(e){return e.direction="inactive",e.port=0,delete e.ext,delete e.ssrcs,delete e.ssrcGroups,delete e.simulcast,delete e.simulcast_03,delete e.rids,delete e.extmapAllowMixed,delete e.bundleOnly,e}var jG=function(e,t,r){var n=i(i({},e),{},{invalid:[{value:"realx-exts:rscp"}],media:[]});return t&&n.media.push(t),r&&n.media.push(r),delete n.groups,delete n.msidSemantic,Jj.write(n)};function GG(e){return HG.apply(this,arguments)}function HG(){return(HG=c(o().mark((function e(t){var r,n,i,a;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r={},n=t.publicIPs,i=t.certFingerprint,a=t.iceParams,r.fingerprint={type:"sha-256",hash:i},r.icePwd=a.serverIcePwd,e.next=6,KG(a.serverIceUfrag);case 6:return r.iceUfrag=e.sent,VB.setStats({connection_id:r.iceUfrag}),r.candidates=zG(n),r.setup="active",r.iceOptions="renomination",e.abrupt("return",r);case 12:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function zG(e){if(!Array.isArray(e))return[];var t=0,r=2130706431,n=[];return e.forEach((function(e){var o={component:1,ip:e.ip,type:"host",generation:e.generation};e.udpPorts&&e.udpPorts.forEach((function(e){n.push(i(i({},o),{},{foundation:t++,transport:"udp",port:e,priority:r}))})),e.tcpPorts&&e.tcpPorts.forEach((function(e){n.push(i(i({},o),{},{foundation:t++,transport:"tcp",port:e,tcptype:"passive",priority:2130705431}))}))})),n}var XG,KG=function(){var e=c(o().mark((function e(t){var r,n,i,a,s,c,u;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=new TextEncoder,n=r.encode("PREC"),e.t0=Uint8Array,e.next=5,_P.b64str2ab(t);case 5:return e.t1=e.sent,i=new e.t0(e.t1),a=r.encode(Date.now().toString()).slice(-4),(s=new Uint8Array(2))[0]=0,s[1]=1,c=pP(Uint8Array,n,i,a,s),e.next=14,_P.ab2b64str(c.buffer);case 14:return u=e.sent,e.abrupt("return",u);case 16:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),qG=function(e,t){var r=0;if(Array.isArray(e.fmtp)&&Array.isArray(e.rtp)){var n,i=A(e.fmtp);try{for(i.s();!(n=i.n()).done;){var o=n.value;if(o.config.includes("level-asymmetry-allowed=1")&&o.config.includes("packetization-mode=1")&&o.config.includes("profile-level-id=42e01f")){r=o.payload;break}}}catch(u){i.e(u)}finally{i.f()}for(var a=0;a<e.rtp.length;a++){var s=e.rtp[a];if("H264"===t){if(s.payload===r){e.rtp.unshift(e.rtp.splice(a,1)[0]);break}}else if(s.codec===t){e.rtp.unshift(e.rtp.splice(a,1)[0]);break}}var c=[];e.rtp.forEach((function(e){return c.push(e.payload)})),e.payloads=c.join(" ")}},WG=new JL("BasicHandler",3),YG={iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan",encodedInsertableStreams:!!Yj()||void 0};function JG(e){if(void 0===XG){var t=navigator.userAgent.toLowerCase();XG=t.includes("mobile")}return XG?Math.ceil(e):e}var QG=function(e){f(d,e);var t,r,n,a,s=g(d);function d(e,t){var r;return u(this,d),h(m(r=s.call(this)),"_peerConnection",void 0),h(m(r),"_dataChannel",void 0),h(m(r),"_context",void 0),h(m(r),"monitor",void 0),h(m(r),"_offerIce",{}),h(m(r),"_answerIce",{}),h(m(r),"_initSctpEvents",!1),h(m(r),"_nextSsrc",Math.floor(Math.random()*PG+1e4)),h(m(r),"_aSendonlyAnswerTpl",void 0),h(m(r),"_vSendonlyAnswerTpl",void 0),h(m(r),"_enableSubFlexfec",!1),h(m(r),"audioTrack4ff",void 0),r.monitor=e,r._peerConnection=new RTCPeerConnection(YG),r._dataChannel=r._peerConnection.createDataChannel("signaling",{negotiated:!0,id:100}),r._context=t,r._dataChannel.binaryType="arraybuffer",r._peerConnection.ontrack=function(e){var t,n,i=null===(t=e.streams)||void 0===t||null===(n=t[0])||void 0===n?void 0:n.id;WG.print("constructor","pc.ontrack ".concat(e.track.kind," ").concat(e.track.id," ").concat(i)),"ff-stream"===i&&(r.audioTrack4ff=e.track),r.emit("ontrack",e)},r._peerConnection.onconnectionstatechange=function(e){WG.print("constructor","onconnectionstatechange ".concat(r._peerConnection.iceConnectionState," -> ").concat(r._peerConnection.connectionState)),"failed"!==r._peerConnection.iceConnectionState&&"closed"!==r._peerConnection.iceConnectionState&&"failed"!==r._peerConnection.connectionState||r.emit("disconnect")},r._peerConnection.oniceconnectionstatechange=function(){var t=r._peerConnection.iceConnectionState;e.rtcPreIceState(t,cB["".concat(t.toUpperCase())])},r}return l(d,[{key:"disconnect",value:function(){this._peerConnection.close(),this._dataChannel.close(),this._peerConnection.ontrack=null}},{key:"destroy",value:function(){WG.print("destroy"),this.disconnect(),this._context=void 0}},{key:"getTransceivers",value:function(){return this._peerConnection.getTransceivers()}},{key:"_simulcast",value:function(e,t,r,n,o){var a=[];1===e.videoEncodeConfig.length?(a=function(e,t){var r=[];if(t<=1)return r;var n=1,i=1;return e.width/e.height>16/9?(n=e.width/Lj.width,i=e.width/Uj.width):(n=e.height/Lj.height,i=e.height/Uj.height),r.push({maxkbps:Lj.maxkbps,scaleResolutionDownBy:n,frameRate:Lj.frameRate,width:Math.floor(e.width/n),height:Math.floor(e.height/n)}),t<=2||n>2&&r.unshift({maxkbps:Uj.maxkbps,scaleResolutionDownBy:i,frameRate:Uj.frameRate,width:Math.floor(e.width/i),height:Math.floor(e.height/i)}),r}(t,o),WG.print("simulcast() ","simulcastLayers: %o",a)):(a=e.videoEncodeConfig.slice(1).slice(1-o).map((function(e){return i({frameRate:e.frameRate||15,maxkbps:e.maxKbps||600},Nj(t,e))})),WG.print("simulcast() ","simulcastLayers2: %o",a)),a.forEach((function(e,t){var i,o={maxBitrate:1e3*e.maxkbps,scaleResolutionDownBy:JG(e.scaleResolutionDownBy),rid:"".concat(t+1),maxFramerate:e.frameRate};null===(i=r.sendEncodings)||void 0===i||i.unshift(o),n.push({width:e.width,height:e.height,framerate:e.frameRate,maxkbps:e.maxkbps,rid:"".concat(t+1)})}))}},{key:"internalPublish",value:function(e){var t=e.stream,r=e.videoTrack,n=e.audioTrack,o=e.enableSimulcast,a=e.pubAudio,s=e.pubVideo,c={direction:"sendonly",streams:[t]},u={direction:"sendonly",streams:[t]},d=[],l=[];if(Array.isArray(null==e?void 0:e.videoEncodeConfig)&&e.videoEncodeConfig.length){var h=null==r?void 0:r.getTrack(),f={width:640,height:360,frameRate:30};if(h){var p=null==h?void 0:h.getSettings();f={width:Math.floor(p.width),height:Math.floor(p.height),frameRate:Math.floor(p.frameRate)}}var v=null==e?void 0:e.videoEncodeConfig[0],_=Nj(f,v);e.prevScaleResolutionDownBy=_.scaleResolutionDownBy,e.videoInputConfig=f;var m={maxBitrate:1e3*v.maxKbps,scaleResolutionDownBy:JG(_.scaleResolutionDownBy),rid:"0",maxFramerate:v.frameRate||15};if(u.sendEncodings=[m],d.push({width:_.width,height:_.height,framerate:v.frameRate,maxkbps:v.maxKbps,rid:"0"}),o){var y,g,S=function(e){for(var t=0,r=e.width*e.height,n=0;n<Mj.length;n++)if(r>=Mj[n].totalPixels){t=n;break}if(0===t)return Mj[t].maxLayers;var i=Mj[t-1].totalPixels;return(i-r)/(i-Mj[t].totalPixels)<.1?Mj[t-1].maxLayers:Mj[t].maxLayers}(_);if(WG.print("simulcast() ","maxLayers: %o",S),S>1)this._simulcast(e,f,u,d,S),null!==(y=this._context)&&void 0!==y&&null!==(g=y.serverConfig)&&void 0!==g&&g.simulcastOnDemand&&(l=function(e){if(!e.length)return[];var t=e.shift(),r=t.width/t.height,n=0,o=0,a=i(i({},t),{},{video_index:o,sub_index:n++});delete a.rid;for(var s=[a],c=0,u=0;u<Pj.length;u++)if(Pj[u].height<t.height){c=u;break}for(var d=e.shift(),l=c;l<Pj.length;l++){var h,f=Pj[l];if(d&&f.height<=(null===(h=d)||void 0===h?void 0:h.height)){var p,v=f.height===(null===(p=d)||void 0===p?void 0:p.height),_=i(i({},d),{},{video_index:++o,sub_index:n++});if(delete _.rid,s.push(_),d=e.shift(),v)continue}s.push(i(i({},f),{},{width:Math.floor(f.height*r),video_index:o,sub_index:n++}))}return s}([].concat(d))),WG.print("subVideoDesc","desc: %o ",l)}}WG.print("publish videoTransceiverInit videoDescriptions","",u,d);var b=null==n?void 0:n.getTrack("preprocessing");(null==n?void 0:n.mixType)!==re.PLAYOUT&&null!=n&&n.mixedAudioTrack&&(b=null==n?void 0:n.mixedAudioTrack),b=a&&b?b:"audio";var E=null==r?void 0:r.getTrack("preprocessing");E=s&&E?E:"video";try{this.monitor.rtcInvokeStatus(JSON.stringify({aTrack:jP(b),vTrack:jP(E),audioTransceiverInit:c,videoTransceiverInit:u}),0,"Handler.internalPublish","",0)}catch(T0){}return{semantics:"unified-plan",videoDescriptions:d,subVideoDescriptions:l,audioTransceiverInit:{track:b,init:c},videoTransceiverInit:{track:E,init:u}}}},{key:"updateMaxBitrate",value:function(e){var t,r;WG.print("updateMaxBitrate()");var n=null===(t=e.videoTrack)||void 0===t?void 0:t.getTrack(),i=e.videoTransceiver;if(n&&e.pubVideo&&i){var o=null===(r=i.sender)||void 0===r?void 0:r.getParameters();if(o){var a;o.encodings=null==o||null===(a=o.encodings)||void 0===a?void 0:a.map((function(t){var r,n=+t.rid||0,i=null===(r=e.videoEncodeConfig[n])||void 0===r?void 0:r.maxKbps;return"number"==typeof i&&(t.maxBitrate=1e3*i),t})),null==i||i.sender.setParameters(o);try{this.monitor.rtcInvokeStatus(JSON.stringify(o.encodings),0,"Handler.updateScaleResolutionDownBy","",0)}catch(T0){}}}else WG.print("updateMaxBitrate()","no pub")}},{key:"updateScaleResolutionDownBy",value:(a=c(o().mark((function e(t){var r,n,i,a,s,c,u,d,l,h;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(WG.print("updateScaleResolutionDownBy()"),i=null===(r=t.videoTrack)||void 0===r?void 0:r.getTrack(),a=t.videoTransceiver,i&&t.pubVideo&&a){e.next=6;break}return WG.print("updateScaleResolutionDownBy()","no pub"),e.abrupt("return");case 6:if(s=null==i?void 0:i.getSettings(),c={width:Math.floor(s.width),height:Math.floor(s.height),frameRate:Math.floor(s.frameRate)},(u=Nj(c,t.videoEncodeConfig[0])).scaleResolutionDownBy===t.prevScaleResolutionDownBy&&WG.print("updateScaleResolutionDownBy()","no change %o",t.prevScaleResolutionDownBy),d=null===(n=a.sender)||void 0===n?void 0:n.getParameters()){h=u.scaleResolutionDownBy/t.prevScaleResolutionDownBy,d.encodings=null==d||null===(l=d.encodings)||void 0===l?void 0:l.map((function(e){var r;Math.max(e.scaleResolutionDownBy=(e.scaleResolutionDownBy||1)*h,1);var n=+e.rid||0;return e.maxFramerate=(null===(r=t.videoEncodeConfig[n])||void 0===r?void 0:r.frameRate)||e.maxFramerate,e})),t.prevScaleResolutionDownBy=u.scaleResolutionDownBy,t.videoInputConfig=c,null==a||a.sender.setParameters(d);try{this.monitor.rtcInvokeStatus(JSON.stringify(d.encodings),0,"Handler.updateScaleResolutionDownBy","",0)}catch(T0){}}case 12:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"getStats",value:function(e,t){return jj(this._peerConnection,e,t)}},{key:"setLocalDescription",value:(n=c(o().mark((function e(t,r){var n,i,a,s=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=fP(),e.prev=1,e.next=4,this._peerConnection.setLocalDescription(new RTCSessionDescription({type:"offer",sdp:t}));case 4:this.monitor.rtcSetDescription(0,t,fB.W_1,"local"===(null==r?void 0:r.streamUserId)?pB.UP:pB.DOWN,(null==r?void 0:r.streamId)||"",(null==r?void 0:r.streamUserId)||"",fP()-n,{type:"offer"}),this._initSctpEvents||(this._initSctpEvents=!0,(a=null===(i=this._peerConnection)||void 0===i?void 0:i.sctp)&&(a.onstatechange=function(){s.monitor.rtcInvokeStatus("sctp state change TO: ".concat(a.state),0,"sctp","",0)},a.transport&&(a.transport.onstatechange=function(){var e;s.monitor.rtcInvokeStatus("dtls state change TO: ".concat(null==a||null===(e=a.transport)||void 0===e?void 0:e.state),0,"dtls","",0)}))),e.next=12;break;case 8:e.prev=8,e.t0=e.catch(1),console.error("setLocal",e.t0),this.monitor.rtcSetDescription(-1,e.t0.message+t,fB.W_1,"local"===(null==r?void 0:r.streamUserId)?pB.UP:pB.DOWN,"","",fP()-n,{type:"offer"});case 12:case"end":return e.stop()}}),e,this,[[1,8]])}))),function(e,t){return n.apply(this,arguments)})},{key:"setRemoteDescription",value:(r=c(o().mark((function e(t,r){var n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=fP(),e.prev=1,e.next=4,this._peerConnection.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:t}));case 4:this.monitor.rtcSetDescription(0,t,fB.W_0,"local"===(null==r?void 0:r.streamUserId)?pB.UP:pB.DOWN,(null==r?void 0:r.streamId)||"",(null==r?void 0:r.streamUserId)||"",fP()-n,{type:"answer"}),e.next=11;break;case 7:e.prev=7,e.t0=e.catch(1),console.error("setRemote",e.t0),this.monitor.rtcSetDescription(-1,e.t0.message+t,fB.W_1,"local"===(null==r?void 0:r.streamUserId)?pB.UP:pB.DOWN,(null==r?void 0:r.streamId)||"",(null==r?void 0:r.streamUserId)||"",fP()-n,{type:"answer"});case 11:case"end":return e.stop()}}),e,this,[[1,7]])}))),function(e,t){return r.apply(this,arguments)})},{key:"setCurrentDescription",value:(t=c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}}),e)}))),function(){return t.apply(this,arguments)})},{key:"createAVMlineAnswerTpl",value:function(e){var t=this;Jj.parse(e).media.forEach((function(e){if("audio"===e.type){if("sendonly"===e.direction){var r=null==e?void 0:e.rtp.find((function(e){return"opus"===e.codec}));if(r&&null!=e&&e.fmtp){var n=null==e?void 0:e.fmtp.find((function(e){return e.payload===r.payload}));n&&t._context&&(n.config+=";stereo=1;sprop-stereo=1")}t._aSendonlyAnswerTpl=e}}else"video"===e.type&&("sendonly"===e.direction&&(t._vSendonlyAnswerTpl=e),Array.isArray(e.rtp)&&e.rtp.forEach((function(e){var r;null!==(r=e.codec)&&void 0!==r&&r.includes("flexfec")&&(t._enableSubFlexfec=!0)})))}))}},{key:"pc",get:function(){return this._peerConnection}},{key:"addBitrateLimit",value:function(e,t){null==e||e.rtp.forEach((function(r){var n=r.codec,i=r.payload;if(["vp8","h264"].includes(n.toLocaleLowerCase())){var o=e.fmtp.find((function(e){return e.payload===i}));o?o.config=[].concat(k(o.config.split(";")),["x-google-min-bitrate=100","x-google-start-bitrate=".concat(t)]).join(";"):e.fmtp.push({payload:i,config:"x-google-min-bitrate=100;x-google-start-bitrate=".concat(t)})}}))}}]),d}(jL.exports.EventEmitter),ZG=Re,$G=jh,eH=Yd.exports.getWeakData,tH=ph,rH=Fr,nH=Ue,iH=Je,oH=lh,aH=Xt,sH=Ln.set,cH=Ln.getterFor,uH=Ra.find,dH=Ra.findIndex,lH=ZG([].splice),hH=0,fH=function(e){return e.frozen||(e.frozen=new pH)},pH=function(){this.entries=[]},vH=function(e,t){return uH(e.entries,(function(e){return e[0]===t}))};pH.prototype={get:function(e){var t=vH(this,e);if(t)return t[1]},has:function(e){return!!vH(this,e)},set:function(e,t){var r=vH(this,e);r?r[1]=t:this.entries.push([e,t])},delete:function(e){var t=dH(this.entries,(function(t){return t[0]===e}));return~t&&lH(this.entries,t,1),!!~t}};var _H,mH={getConstructor:function(e,t,r,n){var i=e((function(e,i){tH(e,o),sH(e,{type:t,id:hH++,frozen:void 0}),nH(i)||oH(i,e[n],{that:e,AS_ENTRIES:r})})),o=i.prototype,a=cH(t),s=function(e,t,r){var n=a(e),i=eH(rH(t),!0);return!0===i?fH(n).set(t,r):i[n.id]=r,e};return $G(o,{delete:function(e){var t=a(this);if(!iH(e))return!1;var r=eH(e);return!0===r?fH(t).delete(e):r&&aH(r,t.id)&&delete r[t.id]},has:function(e){var t=a(this);if(!iH(e))return!1;var r=eH(e);return!0===r?fH(t).has(e):r&&aH(r,t.id)}}),$G(o,r?{get:function(e){var t=a(this);if(iH(e)){var r=eH(e);return!0===r?fH(t).get(e):r?r[t.id]:void 0}},set:function(e,t){return s(this,e,t)}}:{add:function(e){return s(this,e,!0)}}),i}},yH=ce,gH=Re,SH=jh,bH=Yd.exports,EH=Fh,kH=mH,TH=Je,IH=pl,AH=Ln.enforce,RH=mn,wH=!yH.ActiveXObject&&"ActiveXObject"in yH,CH=function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}},OH=EH("WeakMap",CH,kH);if(RH&&wH){_H=kH.getConstructor(CH,"WeakMap",!0),bH.enable();var xH=OH.prototype,DH=gH(xH.delete),NH=gH(xH.has),PH=gH(xH.get),MH=gH(xH.set);SH(xH,{delete:function(e){if(TH(e)&&!IH(e)){var t=AH(this);return t.frozen||(t.frozen=new _H),DH(this,e)||t.frozen.delete(e)}return DH(this,e)},has:function(e){if(TH(e)&&!IH(e)){var t=AH(this);return t.frozen||(t.frozen=new _H),NH(this,e)||t.frozen.has(e)}return NH(this,e)},get:function(e){if(TH(e)&&!IH(e)){var t=AH(this);return t.frozen||(t.frozen=new _H),NH(this,e)?PH(this,e):t.frozen.get(e)}return PH(this,e)},set:function(e,t){if(TH(e)&&!IH(e)){var r=AH(this);r.frozen||(r.frozen=new _H),NH(this,e)?MH(this,e,t):r.frozen.set(e,t)}else MH(this,e,t);return this}})}var LH=function(e){f(b,e);var t,r,n,i,a,s,d,p,v,_,y,S=g(b);function b(){var e,t,r;return u(this,b),h(m(r=S.call(this)),"inited",!1),h(m(r),"deviceMap",{audioinput:new Map,audiooutput:new Map,videoinput:new Map}),h(m(r),"checkDeviceChangeTimer",null),h(m(r),"isSupportedPermissionsQuery",!1),h(m(r),"isGrantedMicrophonePermission",!1),h(m(r),"isGrantedCameraPermission",!1),r.isSupportedPermissionsQuery=!vP()&&!(null===(e=navigator)||void 0===e||null===(t=e.permissions)||void 0===t||!t.query),r._handleDeviceChange=r._handleDeviceChange.bind(m(r)),!vP()&&r.refreshDevices(),r}return l(b,[{key:"refreshDevices",value:(y=c(o().mark((function e(){var t,r,n=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(navigator.mediaDevices){e.next=2;break}return e.abrupt("return");case 2:if(t=void 0,!gP){e.next=12;break}return e.prev=4,e.next=7,navigator.mediaDevices.getUserMedia({audio:!0});case 7:t=e.sent,e.next=12;break;case 10:e.prev=10,e.t0=e.catch(4);case 12:return e.next=14,navigator.mediaDevices.enumerateDevices();case 14:r=e.sent,t&&t.getTracks().forEach((function(e){return e.stop()})),r.forEach((function(e){var t;e.deviceId&&(null===(t=n.deviceMap[e.kind])||void 0===t||t.set(e.deviceId,e))})),this.inited||this.initListener(),this.inited=!0;case 19:case"end":return e.stop()}}),e,this,[[4,10]])}))),function(){return y.apply(this,arguments)})},{key:"initListener",value:(_=c(o().mark((function e(){var t,r,n,i,a=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0!==(null===(t=navigator.mediaDevices)||void 0===t?void 0:t.ondevicechange)&&"function"==typeof(null===(r=navigator.mediaDevices)||void 0===r?void 0:r.addEventListener)?navigator.mediaDevices.addEventListener("devicechange",(function(){a._handleDeviceChange(),setTimeout((function(){a._handleDeviceChange()}),300)})):this.checkDeviceChangeTimer=window.setInterval((function(){a._handleDeviceChange()}),3e3),!this.isSupportedPermissionsQuery){e.next=22;break}return e.prev=2,e.next=5,navigator.permissions.query({name:"microphone"});case 5:n=e.sent,this.isGrantedMicrophonePermission="granted"===n.state,n.addEventListener("change",(function(){a.isGrantedMicrophonePermission="granted"===n.state})),e.next=12;break;case 10:e.prev=10,e.t0=e.catch(2);case 12:return e.prev=12,e.next=15,navigator.permissions.query({name:"camera"});case 15:i=e.sent,this.isGrantedCameraPermission="granted"===i.state,i.addEventListener("change",(function(){a.isGrantedCameraPermission="granted"===i.state})),e.next=22;break;case 20:e.prev=20,e.t1=e.catch(12);case 22:case"end":return e.stop()}}),e,this,[[2,10],[12,20]])}))),function(){return _.apply(this,arguments)})},{key:"_handleDeviceChange",value:(v=c(o().mark((function e(){var t,r,n,i=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=void 0,!gP){e.next=5;break}return e.next=4,navigator.mediaDevices.getUserMedia({audio:!0});case 4:t=e.sent;case 5:return e.next=7,navigator.mediaDevices.enumerateDevices();case 7:r=(r=e.sent).filter((function(e){return!!e.deviceId})),t&&t.getTracks().forEach((function(e){return e.stop()})),n=Array.from([].concat(k(this.deviceMap.audioinput.values()),k(this.deviceMap.videoinput.values()),k(this.deviceMap.audiooutput.values()))),r.forEach((function(e){var t=i.deviceMap[e.kind].get(e.deviceId);i.deviceMap[e.kind].set(e.deviceId,e),t||(e.kind.includes("video")?i.emit(oe.onVideoDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"active"}):e.kind.includes("audio")&&i.emit(oe.onAudioDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"active"}))})),n.forEach((function(e){r.find((function(t){return t.deviceId===e.deviceId&&t.kind===e.kind}))||(i.deviceMap[e.kind].delete(e.deviceId),e.kind.includes("video")?i.emit(oe.onVideoDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"inactive"}):e.kind.includes("audio")&&i.emit(oe.onAudioDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"inactive"}))}));case 13:case"end":return e.stop()}}),e,this)}))),function(){return v.apply(this,arguments)})},{key:"getUserMedia",value:(p=c(o().mark((function e(t){var r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,navigator.mediaDevices.getUserMedia(t);case 2:return r=e.sent,null!=t&&t.audio&&(this.isGrantedMicrophonePermission=!0),null!=t&&t.video&&(this.isGrantedCameraPermission=!0),this.refreshDevices(),e.abrupt("return",r);case 7:case"end":return e.stop()}}),e,this)}))),function(e){return p.apply(this,arguments)})},{key:"checkPermissionsByDevices",value:(d=c(o().mark((function e(){var t,r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t={audio:!1,video:!1},navigator.mediaDevices){e.next=3;break}return e.abrupt("return",t);case 3:return e.next=5,navigator.mediaDevices.enumerateDevices();case 5:return r=e.sent,t.audio=r.filter((function(e){return"audioinput"===e.kind&&e.label&&e.deviceId})).length>0,t.video=r.filter((function(e){return"videoinput"===e.kind&&e.label&&e.deviceId})).length>0,e.abrupt("return",t);case 9:case"end":return e.stop()}}),e)}))),function(){return d.apply(this,arguments)})},{key:"getPermissions",value:(s=c(o().mark((function e(){var t,r,n,i,a,s,c,u=this,d=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=d.length>0&&void 0!==d[0]?d[0]:{},n=r.audio,i=r.video,a=r.force,n||i||(n=!0,i=!0),s={audio:!1,video:!1},a){e.next=30;break}if(!this.isSupportedPermissionsQuery){e.next=20;break}if(!n||!i){e.next=14;break}if(!this.isGrantedMicrophonePermission||!this.isGrantedCameraPermission){e.next=12;break}return s.audio=!0,s.video=!0,e.abrupt("return",s);case 12:e.next=18;break;case 14:if(!(n&&this.isGrantedMicrophonePermission||i&&this.isGrantedCameraPermission)){e.next=18;break}return s.audio=this.isGrantedMicrophonePermission,s.video=this.isGrantedCameraPermission,e.abrupt("return",s);case 18:case 26:e.next=30;break;case 20:return e.next=22,this.checkPermissionsByDevices();case 22:if(c=e.sent,!n||!i){e.next=28;break}if(!c.audio||!c.video){e.next=26;break}return e.abrupt("return",c);case 28:if(!(n&&c.audio||i&&c.video)){e.next=30;break}return e.abrupt("return",c);case 30:if(null===(t=navigator.mediaDevices)||void 0===t||!t.getUserMedia){e.next=33;break}return e.next=33,navigator.mediaDevices.getUserMedia({audio:n,video:i}).then((function(e){e&&(e.getTracks().forEach((function(e){return e.stop()})),n&&(s.audio=!0,u.isGrantedMicrophonePermission=!0),i&&(s.video=!0,u.isGrantedCameraPermission=!0))})).catch((function(){}));case 33:return e.next=35,this.refreshDevices();case 35:return e.abrupt("return",s);case 36:case"end":return e.stop()}}),e,this)}))),function(){return s.apply(this,arguments)})},{key:"enumerateDevices",value:(a=c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getPermissions();case 2:return e.next=4,this.refreshDevices();case 4:return e.abrupt("return",Array.from([].concat(k(this.deviceMap.audioinput.values()),k(this.deviceMap.videoinput.values()),k(this.deviceMap.audiooutput.values()))));case 5:case"end":return e.stop()}}),e,this)}))),function(){return a.apply(this,arguments)})},{key:"enumerateAudioCaptureDevices",value:(i=c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getPermissions({audio:!0});case 2:return e.next=4,this.refreshDevices();case 4:return e.abrupt("return",Array.from(this.deviceMap.audioinput.values()));case 5:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"enumerateVideoCaptureDevices",value:(n=c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getPermissions({video:!0});case 2:return e.next=4,this.refreshDevices();case 4:return e.abrupt("return",Array.from(this.deviceMap.videoinput.values()));case 5:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"enumerateAudioPlaybackDevices",value:(r=c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getPermissions({audio:!0});case 2:return e.next=4,this.refreshDevices();case 4:return e.abrupt("return",Array.from(this.deviceMap.audiooutput.values()));case 5:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"getDeviceById",value:(t=c(o().mark((function e(t){var r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.enumerateDevices();case 2:return r=e.sent,e.abrupt("return",r.find((function(e){return e.deviceId===t})));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})}]),b}($L),UH=new LH;!vP()&&(window.__rtc_dd__=UH);var VH=function(){function e(){u(this,e),h(this,"_audioContextInstance",void 0)}return l(e,[{key:"getAudioContextInstance",value:function(){if(!this._audioContextInstance){var e=window.AudioContext||window.webkitAudioContext;this._audioContextInstance=new e}return this._audioContextInstance}}]),e}(),FH=function(){function e(t){u(this,e),h(this,"_ctx",void 0),h(this,"_analyserNode",void 0),h(this,"_audioSource",void 0);var r=BH.getAudioContextInstance();if(t instanceof MediaStreamTrack){var n=new MediaStream;n.addTrack(t),this._audioSource=r.createMediaStreamSource(n)}else this._audioSource=r.createMediaElementSource(t),this._audioSource.connect(r.destination);var i=r.createAnalyser();this._audioSource.connect(i),this._analyserNode=i,this._ctx=r}var t;return l(e,[{key:"getAudioLevel",value:function(){var e;"suspended"===(null===(e=this._ctx)||void 0===e?void 0:e.state)&&this._ctx.resume();var t=new Uint8Array(2048);this._analyserNode.getByteTimeDomainData(t);var r=0;return t.forEach((function(e){return r=Math.max(r,Math.abs(e-128))})),r/128*255}},{key:"resume",value:(t=c(o().mark((function e(){var t;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,null===(t=this._ctx)||void 0===t?void 0:t.resume();case 2:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"destroy",value:function(){this._audioSource.disconnect(),this._analyserNode.disconnect()}}]),e}(),BH=new VH,jH=function(e){return e[e.CAPTURE=0]="CAPTURE",e[e.PRE_PROCESSING=1]="PRE_PROCESSING",e[e.ENCODE=2]="ENCODE",e[e.TRANSFER=3]="TRANSFER",e[e.POST_PROCESSING=4]="POST_PROCESSING",e[e.DECODE=5]="DECODE",e[e.RENDERING=6]="RENDERING",e}(jH||{}),GH=function(){function e(){u(this,e),h(this,"_plugins",new Map),h(this,"_monitor",void 0)}var t;return l(e,[{key:"setMinotor",value:function(e){this._monitor=e}},{key:"register",value:function(e){e.monitor=this._monitor;var t=this._plugins.get(e.type)||[];if(t.findIndex((function(t){return t.name===e.name}))>-1)throw new Error("Failed to register ".concat(e.name,": name is repeated."));t.push(e),this._plugins.set(e.type,t)}},{key:"getPluginsByType",value:function(e){return this._plugins.get(e)||[]}},{key:"getPluginByName",value:function(e,t){return(this._plugins.get(e)||[]).find((function(e){return e.name===t}))}},{key:"getPreProcessingTrack",value:(t=c(o().mark((function e(t){var r,n,i,a,s;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=this._plugins.get(1)||[],n=t.getTrack(),i=A(r),e.prev=3,i.s();case 5:if((a=i.n()).done){e.next=12;break}return s=a.value,e.next=9,s.effect(t,n);case 9:n=e.sent;case 10:e.next=5;break;case 12:e.next=17;break;case 14:e.prev=14,e.t0=e.catch(3),i.e(e.t0);case 17:return e.prev=17,i.f(),e.finish(17);case 20:return e.abrupt("return",n);case 21:case"end":return e.stop()}}),e,this,[[3,14,17,20]])}))),function(e){return t.apply(this,arguments)})},{key:"destroy",value:function(){this._plugins.forEach((function(e){e.forEach((function(e){return e.destroy()}))})),this._plugins.clear()}}]),e}(),HH=new JL("VERTC",0),zH=new WeakMap,XH=function(e){f(r,e);var t=g(r);function r(e,n){var i;return u(this,r),h(m(i=t.call(this)),"sourceType",1),h(m(i),"mediaType",void 0),h(m(i),"_trackId",void 0),i._trackId=e,i.mediaType=n,i}return l(r,[{key:"getId",value:function(){return this._trackId}}]),r}($L),KH=function(e){f(n,e);var t,r=g(n);function n(e,t,i){var o;return u(this,n),h(m(o=r.call(this,t,i)),"_mediaTrack",void 0),h(m(o),"_preProcessingTrack",void 0),h(m(o),"handleTrackEnded",(function(){MB.rtcError("track-ended mediaType: ".concat(o._mediaTrack.kind),-1001),o.emit("track-ended",m(o))})),o._mediaTrack=e,o._initListeners(),o}return l(n,[{key:"getTrack",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"origin";return"origin"===e?this._mediaTrack:this._preProcessingTrack||this._mediaTrack}},{key:"setTrack",value:function(e,t){this._mediaTrack=e,t&&this.generatePreProcessingTrack(t)}},{key:"generatePreProcessingTrack",value:(t=c(o().mark((function e(t){var r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,t.getPreProcessingTrack(this);case 3:(r=e.sent)instanceof MediaStreamTrack&&(this._preProcessingTrack=r),e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),console.error(e.t0);case 10:case"end":return e.stop()}}),e,this,[[0,7]])}))),function(e){return t.apply(this,arguments)})},{key:"close",value:function(){var e,t,r;return this._mediaTrack.onended=null,this._mediaTrack.onmute=null,this._mediaTrack.onunmute=null,null===(e=this._mediaTrack)||void 0===e||e.removeEventListener("ended",this.handleTrackEnded),null===(t=this._preProcessingTrack)||void 0===t||t.stop(),null===(r=this._mediaTrack)||void 0===r?void 0:r.stop()}},{key:"_initListeners",value:function(){this._mediaTrack instanceof MediaStreamTrack&&this._mediaTrack.addEventListener("ended",this.handleTrackEnded)}}]),n}(XH),qH=function(e){f(r,e);var t=g(r);function r(e,n,i){var o;return u(this,r),h(m(o=t.call(this,n,i)),"_mediaTrack",void 0),o._mediaTrack=e,o}return l(r,[{key:"getTrack",value:function(){return this._mediaTrack}}]),r}(XH),WH=function(e){f(n,e);var t,r=g(n);function n(e,t){var i;return u(this,n),h(m(i=r.call(this,e,t,"video")),"resolution",void 0),h(m(i),"dummy",!1),i.resolution={width:0,height:0},i}return l(n,[{key:"updateVideoCaptureConfig",value:(t=c(o().mark((function e(t){var r,n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.getTrack()){e.next=2;break}return e.abrupt("return");case 2:return HH.print("updateVideoEncoderConfig","update localVideoTrack: ",t),delete(r=i({},t)).contentHint,e.next=7,this.getTrack().applyConstraints(r);case 7:((n=this.getTrack().getSettings()).width&&n.width!==this.resolution.width||n.height&&n.height!==this.resolution.height)&&(this.resolution={width:n.width,height:n.height},this.emit("resolution-change",this.resolution));case 9:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"replaceTrack",value:function(e){this.setTrack(e)}},{key:"setContentHint",value:function(e){this._mediaTrack&&"contentHint"in this._mediaTrack&&["text","motion","detail"].includes(e)&&(this._mediaTrack.contentHint=e)}}]),n}(KH),YH=function(e){f(n,e);var t,r=g(n);function n(e,t){var i;return u(this,n),h(m(i=r.call(this,e,t,"audio")),"audioCaptureConfig",void 0),h(m(i),"_audioLevelFetcher",void 0),h(m(i),"mixedAudioTrack",void 0),h(m(i),"mixType",re.PLAYOUT_AND_PUBLISH),i}return l(n,[{key:"getAudioLevel",value:function(){return this._audioLevelFetcher||(this._audioLevelFetcher=new FH(this.getTrack("preprocessing"))),this._audioLevelFetcher.getAudioLevel()}},{key:"updateAudioCaptureConfig",value:(t=c(o().mark((function e(){var t;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.audioCaptureConfig){e.next=2;break}return e.abrupt("return");case 2:return HH.print("updateAudioCaptureConfig","update localAudioTrack: ",this.audioCaptureConfig),e.next=5,null===(t=this.getTrack())||void 0===t?void 0:t.applyConstraints(this.audioCaptureConfig);case 5:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}]),n}(KH),JH=function(e){f(r,e);var t=g(r);function r(e,n){return u(this,r),t.call(this,e,n,"video")}return l(r)}(qH),QH=function(e){f(r,e);var t=g(r);function r(e,n){var i;return u(this,r),h(m(i=t.call(this,e,n,"audio")),"_audioLevelFetcher",void 0),i}return l(r,[{key:"getAudioLevel",value:function(){return this._audioLevelFetcher||(this._audioLevelFetcher=new FH(this.getTrack())),this._audioLevelFetcher.getAudioLevel()}}]),r}(qH),ZH=function(e){f(r,e);var t=g(r);function r(){var e;u(this,r);for(var n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];return h(m(e=t.call.apply(t,[this].concat(i))),"streamIndex",L.STREAM_INDEX_MAIN),e}return l(r)}(YH),$H=function(e){f(r,e);var t=g(r);function r(){var e;u(this,r);for(var n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];return h(m(e=t.call.apply(t,[this].concat(i))),"streamIndex",L.STREAM_INDEX_MAIN),e}return l(r)}(WH),ez=function(e){f(r,e);var t=g(r);function r(){var e;u(this,r);for(var n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];return h(m(e=t.call.apply(t,[this].concat(i))),"streamIndex",L.STREAM_INDEX_MAIN),h(m(e),"sourceType",0),e}return l(r)}(WH),tz=function(e){f(r,e);var t=g(r);function r(){var e;u(this,r);for(var n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];return h(m(e=t.call.apply(t,[this].concat(i))),"streamIndex",L.STREAM_INDEX_MAIN),h(m(e),"sourceType",0),e}return l(r)}(YH),rz=function(e){f(r,e);var t=g(r);function r(){var e;u(this,r);for(var n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];return h(m(e=t.call.apply(t,[this].concat(i))),"streamIndex",L.STREAM_INDEX_SCREEN),e}return l(r)}(WH),nz=function(e){f(r,e);var t=g(r);function r(){var e;u(this,r);for(var n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];return h(m(e=t.call.apply(t,[this].concat(i))),"streamIndex",L.STREAM_INDEX_SCREEN),e}return l(r)}(YH),iz=function(e){f(r,e);var t=g(r);function r(){var e;u(this,r);for(var n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];return h(m(e=t.call.apply(t,[this].concat(i))),"streamIndex",L.STREAM_INDEX_SCREEN),h(m(e),"sourceType",0),e}return l(r)}(WH),oz=function(e){f(r,e);var t=g(r);function r(){var e;u(this,r);for(var n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];return h(m(e=t.call.apply(t,[this].concat(i))),"streamIndex",L.STREAM_INDEX_SCREEN),h(m(e),"sourceType",0),e}return l(r)}(YH);function az(e,t){return sz.apply(this,arguments)}function sz(){return(sz=c(o().mark((function e(t,r){var n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=new $H(t,hP())).dummy=!0,e.next=4,n.generatePreProcessingTrack(r);case 4:return e.abrupt("return",n);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function cz(e,t){return uz.apply(this,arguments)}function uz(){return(uz=c(o().mark((function e(t,r){var n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=new rz(t,hP())).dummy=!0,e.next=4,n.generatePreProcessingTrack(r);case 4:return e.abrupt("return",n);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function dz(e,t){return lz.apply(this,arguments)}function lz(){return(lz=c(o().mark((function e(t,r){var n,i,a,s,c,u;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=(null==t||null===(n=t.deviceId)||void 0===n?void 0:n.exact)||"default",e.prev=1,HH.print("createCameraVideoTrack","constraints:",t),MB.rtcVideoCaptureEvent({event_type:xB.START,media_device_id:a}),s=fP(),e.next=7,UH.getUserMedia({video:t});case 7:i=e.sent,MB.rtcVideoCaptureEvent({event_type:xB.START_CAPTURE_RESULT,media_device_id:a,reason:DB.SUCCESS,elapse:fP()-s}),e.next=15;break;case 11:throw e.prev=11,e.t0=e.catch(1),MB.rtcVideoCaptureEvent({event_type:xB.RUNNING_FAILED,media_device_id:a,error_code:e.t0.code,reason:e.t0.name+e.t0.message}),new hN(dN.GET_VIDEO_TRACK_FAILED,"throw error from getUserMedia. [".concat(e.t0.name||"unknown name","]: ").concat(e.t0.message||"unknown message","."),e.t0);case 15:return c=i.getVideoTracks()[0],zH.set(c,i),u=new $H(c,hP()),e.next=20,u.generatePreProcessingTrack(r);case 20:return e.abrupt("return",u);case 21:case"end":return e.stop()}}),e,null,[[1,11]])})))).apply(this,arguments)}function hz(e,t,r){return fz.apply(this,arguments)}function fz(){return(fz=c(o().mark((function e(t,r,n){var i,a,s,c,u,d,l,h,f,p,v,_;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return HH.print("createMicrophoneAudioTrack","constraints:",t),s=(null==t||null===(i=t.deviceId)||void 0===i?void 0:i.exact)||"default",c=(null==n?void 0:n.config)||{},u=c.sampleRate,d=c.channel,l=c.agc,h=c.ans,f=c.aec,void 0===t.sampleRate&&(t.sampleRate=u),void 0===t.channelCount&&(t.channelCount=d),void 0===t.autoGainControl&&(t.autoGainControl=l),void 0===t.noiseSuppression&&(t.noiseSuppression=h),void 0===t.echoCancellation&&(t.echoCancellation=f),e.prev=8,MB.rtcVideoCaptureEvent({event_type:xB.START,media_device_id:s}),p=fP(),r.getPluginByName(jH.PRE_PROCESSING,"RTCAIAnsExtension")&&(t.autoGainControl=!0,t.noiseSuppression=!1),e.next=14,UH.getUserMedia({audio:t});case 14:a=e.sent,MB.rtcVideoCaptureEvent({event_type:xB.START_CAPTURE_RESULT,media_device_id:s,reason:DB.SUCCESS,elapse:fP()-p}),e.next=22;break;case 18:throw e.prev=18,e.t0=e.catch(8),MB.rtcVideoCaptureEvent({event_type:xB.RUNNING_FAILED,media_device_id:s,error_code:e.t0.code,reason:e.t0.name+e.t0.message}),new hN(dN.GET_AUDIO_TRACK_FAILED,"throw error from getUserMedia. [".concat(e.t0.name||"unknown name","]: ").concat(e.t0.message||"unknown message","."),e.t0);case 22:return v=a.getAudioTracks()[0],zH.set(v,a),_=new ZH(v,hP()),e.next=27,_.generatePreProcessingTrack(r);case 27:return e.abrupt("return",_);case 28:case"end":return e.stop()}}),e,null,[[8,18]])})))).apply(this,arguments)}function pz(){return vz.apply(this,arguments)}function vz(){return vz=c(o().mark((function e(){var t,r,n,i,a,s,c,u,d,l=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=l.length>0&&void 0!==l[0]&&l[0],r=l.length>1?l[1]:void 0,n=l.length>2?l[2]:void 0,HH.print("createScreenTracks","withAudio: %o, constraints: %o",t,n),e.prev=4,MB.rtcVideoCaptureEvent({event_type:xB.START,media_device_id:"screen"}),a=fP(),e.next=9,navigator.mediaDevices.getDisplayMedia({video:!(n&&(!SP||16!==kP))||n,audio:!!t&&{channelCount:2,noiseSuppression:!1,echoCancellation:!1,autoGainControl:!1}});case 9:i=e.sent,MB.rtcVideoCaptureEvent({event_type:xB.START_CAPTURE_RESULT,media_device_id:"screen",reason:DB.SUCCESS,elapse:fP()-a}),e.next=17;break;case 13:throw e.prev=13,e.t0=e.catch(4),MB.rtcVideoCaptureEvent({event_type:xB.RUNNING_FAILED,media_device_id:"screen",error_code:e.t0.code,reason:e.t0.name+e.t0.message}),new hN(dN.GET_SCREEN_TRACK_FAILED,"throw error from getDisplayMedia",e.t0);case 17:return s=i.getVideoTracks()[0],c=new rz(s,hP()),e.next=21,c.generatePreProcessingTrack(r);case 21:if(!(u=i.getAudioTracks()[0])){e.next=27;break}return d=new nz(u,hP()),e.next=26,d.generatePreProcessingTrack(r);case 26:return e.abrupt("return",[c,d]);case 27:return e.abrupt("return",[c,void 0]);case 28:case"end":return e.stop()}}),e,null,[[4,13]])}))),vz.apply(this,arguments)}function _z(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:hP();return new QH(e,t)}function mz(e,t){return yz.apply(this,arguments)}function yz(){return(yz=c(o().mark((function e(t,r){var n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new ez(t,hP()),e.next=3,n.generatePreProcessingTrack(r);case 3:return e.abrupt("return",n);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function gz(e,t){return Sz.apply(this,arguments)}function Sz(){return(Sz=c(o().mark((function e(t,r){var n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new tz(t,hP()),e.next=3,n.generatePreProcessingTrack(r);case 3:return e.abrupt("return",n);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function bz(e,t){return Ez.apply(this,arguments)}function Ez(){return(Ez=c(o().mark((function e(t,r){var n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new iz(t,hP()),e.next=3,n.generatePreProcessingTrack(r);case 3:return e.abrupt("return",n);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function kz(e,t){return Tz.apply(this,arguments)}function Tz(){return(Tz=c(o().mark((function e(t,r){var n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new oz(t,hP()),e.next=3,n.generatePreProcessingTrack(r);case 3:return e.abrupt("return",n);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Iz=YH,Az=function(e){return e[e.NONE=0]="NONE",e}(Az||{}),Rz=function(){function e(){u(this,e)}return l(e,null,[{key:"getNalunits",value:function(t){if(t.length-t.position<4)return[];var r=t.position;return 1===t.getInt32(r)||0===t.getInt16(r)&&1===t.getInt8(r+2)?e.getAnnexbNals(t):e.getAvccNals(t)}},{key:"getAnnexbNals",value:function(t){for(var r=[],n=e.getHeaderPositionAnnexB(t),i=n.pos,o=i;i<t.length-4;){var a=new Uint8Array(t.buffer.slice(i,i+n.headerLength));n.pos===t.position&&t.skip(n.headerLength),o=(n=e.getHeaderPositionAnnexB(t)).pos;var s={header:a,body:new Uint8Array(t.buffer.slice(i+a.byteLength,o)),type:-1};e.analyseNal(s),s.type<=9&&0!==s.type&&r.push(s),t.skip(o-t.position),i=o}return r}},{key:"getAvccNals",value:function(t){for(var r=[];t.position<t.length-4;){var n=t.getInt32(t.position);if(!(t.length-t.position>=n))break;var i=new Uint8Array(t.buffer.slice(t.position,t.position+4));t.skip(4);var o=new Uint8Array(t.buffer.slice(t.position,t.position+n));t.skip(n);var a={header:i,body:o,type:-1};e.analyseNal(a),a.type<=9&&0!==a.type&&r.push(a)}return r}},{key:"analyseNal",value:function(e){var t=31&e.body[0];switch(e.type=t,t){case 1:e.ndr=!0;break;case 5:e.idr=!0;break;case 6:e.sei=!0;break;case 7:e.sps=!0;break;case 8:e.pps=!0}}},{key:"getHeaderPositionAnnexB",value:function(e){for(var t=e.position,r=0,n=e.length;3!==r&&4!==r&&t<n-4;)0===e.getInt16(t)?1===e.getInt16(t+2)?r=4:1===e.getInt8(t+2)?r=3:t++:t++;return t===n-4&&(0===e.getInt16(t)?1===e.getInt16(t+2)?r=4:t=n:(t++,0===e.getInt16(t)&&1===e.getInt8(t)?r=3:t=n)),{pos:t,headerLength:r}}}]),e}(),wz=function(){function e(t){u(this,e),h(this,"_position",0),h(this,"_dataview",void 0),this._dataview=new DataView(t)}return l(e,[{key:"length",get:function(){return this.buffer.byteLength}},{key:"buffer",get:function(){return this._dataview.buffer}},{key:"position",get:function(){return this._position},set:function(e){this._position=e}},{key:"back",value:function(e){this.position-=e}},{key:"getUint8",value:function(e){return this._dataview.getUint8(e)}},{key:"getInt8",value:function(e){return this._dataview.getInt8(e)}},{key:"getInt16",value:function(e){return this._dataview.getInt16(e)}},{key:"getUint16",value:function(e){return this._dataview.getUint16(e)}},{key:"getUint32",value:function(e){return this._dataview.getUint32(e)}},{key:"getInt32",value:function(e){return this._dataview.getInt32(e)}},{key:"skip",value:function(t){for(var r=Math.floor(t/4),n=t%4,i=0;i<r;i++)e.readByte(this,4);n>0&&e.readByte(this,n)}},{key:"readUint8",value:function(){return e.readByte(this,1)}},{key:"readUint16",value:function(){return e.readByte(this,2)}},{key:"readUint24",value:function(){return e.readByte(this,3)}},{key:"readUint32",value:function(){return e.readByte(this,4)}},{key:"readUint64",value:function(){return e.readByte(this,8)}},{key:"readInt8",value:function(){return e.readByte(this,1,!0)}},{key:"readInt16",value:function(){return e.readByte(this,2,!0)}},{key:"readInt32",value:function(){return e.readByte(this,4,!0)}},{key:"writeUint32",value:function(e){return new Uint8Array([e>>>24&255,e>>>16&255,e>>>8&255,255&e])}}],[{key:"readByte",value:function(e,t,r){var n;switch(t){case 1:n=r?e.getInt8(e.position):e.getUint8(e.position);break;case 2:n=r?e.getInt16(e.position):e.getUint16(e.position);break;case 3:if(r)throw new Error("not supported for readByte 3");n=e.getUint8(e.position)<<16,n|=e.getUint8(e.position+1)<<8,n|=e.getUint8(e.position+2);break;case 4:n=r?e.getInt32(e.position):e.getUint32(e.position);break;case 8:if(r)throw new Error("not supported for readBody 8");n=e.getUint32(e.position)<<32,n|=e.getUint32(e.position+4);break;default:n=""}return e.position+=t,n}}]),e}(),Cz=function(e){return e[e.internal=0]="internal",e[e.external=1]="external",e[e.bypass=2]="bypass",e}(Cz||{}),Oz=new Uint8Array([109,167,53,190,103,90,72,1,170,89,63,164,194,199,19,85]),xz=new Uint8Array([109,167,53,190,103,90,72,1,170,89,63,164,194,199,19,84]),Dz=function(e){for(var t=[],r=0;r<e.length;r++)e[r]<=3&&0===e[r-1]&&0===e[r-2]&&t.push(3),t.push(e[r]);return new Uint8Array(t)};function Nz(e){for(var t=[];e>=255;)e-=255,t.push(255);return t.push(e),new Uint8Array(t)}function Pz(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=0;255===e[t]&&t<e.byteLength;)t++,r+=255;return t<e.byteLength&&(r+=e[t++]),[r,t]}var Mz=function(){function e(){u(this,e)}return l(e,null,[{key:"generateSEI",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=new Uint8Array([0,0,0,1]),n=new Uint8Array([6]),i=new Uint8Array([5]),o=t?Oz:xz,a=Nz(e.byteLength+o.byteLength),s=Dz(e);return new Uint8Array([].concat(k(r),k(n),k(i),k(a),k(o),k(s),[128]))}},{key:"decodeSeiBody",value:function(e){var t=function(e){for(var t=[],r=0;r<e.length;r++)e[r]<=3&&0===e[r-1]&&0===e[r-2]||t.push(e[r]);return new Uint8Array(t)}(e=e.slice(0,e.length-1));if(!(t.byteLength<2)){var r=0;if(5===t[1]||100===t[1]){var n=E(Pz(t,r+=2),2),i=n[0],o=2,a=(r=n[1])+i;return t.byteLength>=xz.byteLength&&i>=xz.byteLength&&t.slice(r,r+xz.byteLength).toString()===xz.toString()?(r+=xz.byteLength,o=1):t.byteLength>=xz.byteLength&&i>=xz.byteLength&&t.slice(r,r+Oz.byteLength).toString()===Oz.toString()&&(r+=Oz.byteLength,o=0),{type:o,payload:t.slice(r,a)}}}}},{key:"parseInternalSEI",value:function(e){var t=new Map,r=0;if(0===e.type){for(;e.payload.byteLength-r>=2;){var n=E(Pz(e.payload,r),2),i=n[0];r=n[1];var o=E(Pz(e.payload,r),2),a=o[0];if(r=o[1],t.get(i)||!(a<=e.payload.byteLength-r))break;t.set(i,e.payload.slice(r,r+a)),r+=a}return t}}},{key:"makeInternalSei",value:function(e){var t,r=[],n=A(e);try{for(n.s();!(t=n.n()).done;){var i=E(t.value,2),o=i[0],a=i[1],s=Nz(o),c=Nz(a.byteLength);r.push(s,c,a)}}catch(l){n.e(l)}finally{n.f()}var u=r.reduce((function(e,t){return e+t.byteLength}),0),d=new Uint8Array(u);return r.reduce((function(e,t){return d.set(t,e),e+t.byteLength}),0),d}}]),e}(),Lz=function(){function e(t){u(this,e),h(this,"player",void 0),h(this,"_stream",void 0),h(this,"_timer",void 0),h(this,"client",void 0),h(this,"handler",void 0),h(this,"monitor",void 0),this._stream=t}return l(e,[{key:"setVar",value:function(e,t,r){this.client=e,this.handler=t,this.monitor=r}},{key:"delStatsEvtInterval",value:function(){var e;clearTimeout(this._timer),this._timer=void 0,null===(e=this.monitor)||void 0===e||e.rtcInvokeStatus("".concat((new Error).stack),0,"del_media_statistics_timer",this._stream.streamId||"",0)}},{key:"filterIllegal",value:function(e){var t={};return Object.keys(e).forEach((function(r){null===e[r]||void 0===e[r]||Number.isNaN(e[r])||(t[r]=e[r])})),t}},{key:"destroy",value:function(){var e;null===(e=this.monitor)||void 0===e||e.rtcInvokeStatus("".concat((new Error).stack),0,"media_statistics_destroy","".concat(this._stream.streamId),0),this.delStatsEvtInterval()}}]),e}(),Uz=function(e){f(i,e);var t,r,n=g(i);function i(e){var t;return u(this,i),(t=n.call(this,e))._stream=e,t}return l(i,[{key:"setLocalStreamStatsEvtInterval",value:function(e,t,r){var n,i,a,s=this;if(!this._timer){this.setVar(e,t,r),e.once(_j.ABNORMAL_DISCONNECTION,(function(){s.destroy()}));var u={audio:{},video:{}},d=this._stream,l=null===(n=d.audioTrack)||void 0===n?void 0:n.getTrack("preprocessing"),h=null===(i=d.videoTrack)||void 0===i?void 0:i.getTrack("preprocessing");this.getAudioStats(l,u,null===(a=d.audioTrack)||void 0===a?void 0:a.getAudioLevel()),this.getVideoStats(h,u),this.delStatsEvtInterval();var f=function(){var e=c(o().mark((function e(){var t,r,n,i,a,c,l;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=null===(t=d.audioTrack)||void 0===t?void 0:t.getTrack("preprocessing"),a=null===(r=d.videoTrack)||void 0===r?void 0:r.getTrack("preprocessing"),e.next=4,s.getAudioStats(i,u,null===(n=d.audioTrack)||void 0===n?void 0:n.getAudioLevel());case 4:return c=e.sent,e.next=7,s.getVideoStats(a,u);case 7:return l=e.sent,e.abrupt("return",{audioStats:c,videoStats:l,isScreen:d.isScreen});case 9:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),p=function(){var e=c(o().mark((function e(){var t,r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,f();case 2:r=e.sent,null===(t=s.client)||void 0===t||t.emit("onLocalStreamStats",r),s._timer&&clearTimeout(s._timer),s._timer=setTimeout(p,2e3);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();this._timer&&clearTimeout(this._timer),this._timer=setTimeout(p,2e3)}}},{key:"unpublish",value:function(){this.delStatsEvtInterval()}},{key:"getAudioStats",value:(r=c(o().mark((function e(t,r,n){var i,a,s,c,u,d,l,h,f,p,v;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i={},a={timestamp:Date.now()},s=this._stream,c=s.streamId,u=s.audioMid,d=s.isScreen,l=s.pubAttributes,h=s.pubAudio,f={media_type:"audio",is_screen:!!d,direction:"up",stream_id:c,vid:u,connection_status:navigator.onLine,track_enabled:null==t?void 0:t.enabled,capture_state:l.localaudio?"capture_state_on":"capture_state_off",mute_state:h?"mute_state_off":"mute_state_on"},t&&this.handler){e.next=6;break}return e.abrupt("return",i);case 6:return e.next=8,this.handler.getStats(t);case 8:if((p=e.sent).length){e.next=11;break}return e.abrupt("return",i);case 11:if(p.forEach((function(e){var t=e.type,r=e.packetsSent,n=e.packetsLost,o=e.bytesSent,s=e.clockRate,c=e.roundTripTime,u=e.channels,d=e.audioLevel;e.googRtt;var l=e.mimeType,h=e.availableIncomingBitrate,p=e.availableOutgoingBitrate,v=e.bytesReceived,_=e.nominated,m=e.id,y=e.currentRoundTripTime,g=e.state,S=e.writable,b=e.requestsReceived,E=e.responsesReceived,k=e.requestsSent,T=e.consentRequestsSent,I=e.responsesSent,A=e.jitter,R=e.candidateType,w=e.ip,C=e.address,O=e.networkType,x=e.port,D=e.protocol,N=e.nackCount,P=e.retransmittedBytesSent,M=e.retransmittedPacketsSent,L=e.audioInputLevel,U=e.ssrc,V=e.totalAudioEnergy,F=e.totalSamplesDuration,B=e.mediaType,j=e.fractionLost;"outbound-rtp"===t?(a.packetsSent=r,a.bytesSent=o,f.bytes=o,f.packetsSent=r,f.nackCount=N,f.ssrc=U,f.retransmitted_bytes_sent=P,f.retransmitted_packets_sent=M,a.retransmittedBytesSent=P,a.retransmittedPacketsSent=M):"remote-inbound-rtp"===t?(a.packetsLost=n,f.packetsLost=n,f.net_jitter=1e3*A,i.rtt=1e3*c,f.rtt=i.rtt,i._fractionLost=j||0):"codec"===t?(i.recordSampleRate=s,i.numChannels=u,f.codecName=l):"media-source"===t&&void 0!==d?(f.audio_level=d?-10*Math.log10(Math.pow(d,2)):d,f.volume=255*d,f.total_audio_energy=V,f.totalInputDuration=F):"ssrc"===t&&"audio"===B?f.send_level=L:"candidate-pair"===t?(f.ice_available_incoming_bitrate=h,f.ice_available_outgoing_bitrate=p,f.ice_bytes_received=v,f.ice_bytes_sent=o,f.ice_nominated=+_,f.ice_pair_id=m,f.ice_pair_rtt=y,f.ice_pair_state=g,f.ice_pair_writable=S,f.recv_ping_requests=b,f.recv_ping_responses=E,f.sent_ping_requests_before_first_response=k,f.sent_ping_requests_total=k+(T||0),f.sent_ping_responses=I):"local-candidate"===t?(f.local_candidate_type=R,f.local_ip=w||C,f.local_network_type=O,f.local_port=x,f.protocol=D):"remote-candidate"===t&&(f.remote_candidate_type=R,f.remote_ip=w||C,f.remote_port=x)})),void 0===f.volume&&void 0!==n&&(f.volume=n,f.audio_level=n?-10*Math.log10(Math.pow(n/255,2)):n),(v=r.audio).timestamp){e.next=17;break}return r.audio=a,e.abrupt("return",this.filterIllegal(i));case 17:return void 0!==a.packetsLost&&(i.audioLossRate=(a.packetsLost-v.packetsLost)/(a.packetsSent-v.packetsSent),i.audioLossRate=Number.isNaN(i.audioLossRate)?0:i.audioLossRate,f.fraction_lost=i.audioLossRate),i.statsInterval=a.timestamp-v.timestamp,f.stats_interval=i.statsInterval,i.sendKBitrate=(a.bytesSent-v.bytesSent||0)/i.statsInterval*8,f.mediaBitratebps=Math.round(1e3*i.sendKBitrate),f.bandwidth=Math.round(f.mediaBitratebps/1024),void 0!==a.retransmittedBytesSent&&(f.retransmitBitratebps=(a.retransmittedBytesSent-v.retransmittedBytesSent||0)/i.statsInterval),r.audio=a,this.monitor.rtcMediaStatistics(f,{}),i._retransmittedRate=(a.retransmittedPacketsSent-v.retransmittedPacketsSent)/(a.packetsSent-v.packetsSent),void 0===i.audioLossRate&&(i.audioLossRate=i._retransmittedRate,f.fraction_lost=i.audioLossRate),i._fractionLost=Math.max(i._fractionLost,i.audioLossRate),e.abrupt("return",this.filterIllegal(i));case 30:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return r.apply(this,arguments)})},{key:"getVideoStats",value:(t=c(o().mark((function e(t,r){var n,i,a,s,c,u,d,l,h,f,p,v,_,m,y,g;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i={},a={timestamp:Date.now(),simulcast:{}},s=this._stream,c=s.streamId,u=s.videoMid,d=s.isScreen,l=s.pubAttributes,h=s.enableSimulcast,f=s.pubVideo,p={media_type:"video",is_screen:!!d,direction:"up",stream_id:c,vid:u,connection_status:navigator.onLine,track_enabled:null==t?void 0:t.enabled,capture_state:l.localvideo?"capture_state_on":"capture_state_off",mute_state:f?"mute_state_off":"mute_state_on"},t&&this.handler){e.next=6;break}return e.abrupt("return",i);case 6:return p.cap_frame_width=t.getSettings().width,p.cap_frame_height=t.getSettings().height,i.isScreen=d,e.next=11,this.handler.getStats(t);case 11:if((v=e.sent).length){e.next=14;break}return e.abrupt("return",i);case 14:if(null===(n=this.monitor)||void 0===n||n.rtcInvokeStatus("reports.length: ".concat(v.length,"; videoTrack: ").concat(t.id),0,"get_video_stats",c||"",0),_=0,v.forEach((function(e){var t=e.type,r=e.framesEncoded,n=e.packetsLost,o=e.bytesSent,s=e.framesSent,c=e.roundTripTime,u=e.mimeType,d=e.frameWidth,l=e.frameHeight,f=e.packetsSent,v=e.googActualEncBitrate,m=e.googAvailableReceiveBandwidth,y=e.googAvailableSendBandwidth,g=e.googAvgEncodeMs,S=e.googBucketDelay,b=e.googEncodeUsagePercent,E=e.googFrameRateInput,k=e.availableIncomingBitrate,T=e.availableOutgoingBitrate,I=e.bytesReceived,A=e.nominated,R=e.id,w=e.currentRoundTripTime,C=e.state,O=e.writable,x=e.candidateType,D=e.ip,N=e.address,P=e.networkType,M=e.port,L=e.nackCount,U=e.pliCount,V=e.protocol,F=e.qpSum,B=e.requestsReceived,j=e.responsesReceived,G=e.googRetransmitBitrate,H=e.requestsSent,z=e.consentRequestsSent,X=e.responsesSent,K=e.ssrc,q=e.googTargetEncBitrate,W=e.googTransmitBitrate,Y=e.retransmittedPacketsSent,J=e.encoderImplementation,Q=e.jitter,Z=e.rid,$=e.fractionLost,ee=e.googAdaptationChanges,te=e.qualityLimitationReason,re=e.qualityLimitationDurations,ne=e.googFirsReceived,ie=e.googFrameRateSent,oe=e.keyFramesEncoded;"outbound-rtp"===t?(h&&(Z?a.simulcast[Z]=e:a.simulcast[_]=e,_++),a.framesEncoded=r||a.framesEncoded||0,p.key_frames_encoded=oe||0,a.bytesSent=o||a.bytesSent||0,a.framesSent=s||a.framesSent||0,p.bytes=o||p.bytes||0,a.packetsSent=f||a.packetsSent||0,p.packetsSent=f||p.packetsSent||0,p.nackCount=L||p.nackCount||0,p.pli_count=U||p.pli_count||0,p.qp_sum=F||p.qp_sum||0,p.ssrc=K||p.ssrc||0,p.retransmitted_packets_sent=Y,a.retransmittedPacketsSent=Y,p.encoder_implementation=J,p.qualityLimitationReason=te,p.qualityLimitationDurations=re,void 0!==d&&((!i.encodedFrameWidth||d>i.encodedFrameWidth)&&(i.encodedFrameWidth=d),(!i.encodedFrameHeight||l>i.encodedFrameHeight)&&(i.encodedFrameHeight=l),p.frame_size_height=l,p.frame_size_width=d)):"track"===t?(i.encodedFrameWidth=d,i.encodedFrameHeight=l,p.frame_size_height=l,p.frame_size_width=d):"remote-inbound-rtp"===t?(a.packetsLost=n,i.rtt=1e3*c,p.rtt=i.rtt,p.jitter=Q,p.packetsLost=n,i._fractionLost=$||0):"codec"===t?(i.codecType=u,p.codecName=u):"candidate-pair"===t?(p.ice_available_incoming_bitrate=k,p.ice_available_outgoing_bitrate=T,p.ice_bytes_received=I,p.ice_bytes_sent=o,p.ice_nominated=+A,p.ice_pair_id=R,p.ice_pair_rtt=w,p.ice_pair_state=C,p.ice_pair_writable=O,p.recv_ping_requests=B,p.recv_ping_responses=j,p.sent_ping_requests_before_first_response=H,p.sent_ping_requests_total=H+z,p.sent_ping_responses=X):"local-candidate"===t?(p.local_candidate_type=x,p.local_ip=D||N,p.local_network_type=P,p.local_port=M,p.protocol=V):"remote-candidate"===t?(p.remote_candidate_type=x,p.remote_ip=D||N,p.remote_port=M):"VideoBwe"===t?(p.encBitratebps=v,p.available_receive_bandwidth=m,p.available_send_bandwidth=y,p.bucket_delay=S,p.retransmitBitratebps=G,p.targetEncBitratebps=q,p.transmit_bitrate=W,i._sendBandWidth=+y):"ssrc"===t&&(p.avg_encode_ms=g,p.encodeUsage=b,p.frame_rate_input=E,p.orignal_input_Framerate=+E,p.ddaptationChanges=ee,p.firsReceived=ne,p.frameRateSent=ie)})),(m=r.video).timestamp){e.next=21;break}return r.video=a,e.abrupt("return",this.filterIllegal(i));case 21:return i.statsInterval=a.timestamp-m.timestamp,p.stats_interval=i.statsInterval,y=Object.keys(a.simulcast),h?(p.sim_enc_width=[],p.sim_enc_height=[],p.sim_enc_bps=[],p.sim_enc_framerate=[],p.sim_enc_key_frames=[],p.sim_rids=[],p.sim_enc_bandwidth=[],p.sim_sent_framerate=[],p.sim_fraction_lost=[],p.sim_keyencoded=[],p.active_sim_streams=[],p.sim_retransmittedRate=[],g=!1,y.sort((function(e,t){return+e-+t})).forEach((function(e){var t=a.simulcast[e],r=t.frameWidth,n=t.frameHeight,o=t.bytesSent,s=t.framesEncoded,c=t.framesSent,u=t.packetsLost,d=t.packetsSent,l=t.qualityLimitationReason,h=t.qualityLimitationDurations,f=t.qualityLimitationResolutionChanges,v=t.retransmittedPacketsSent,_=t.pliCount,y=t.keyFramesEncoded;void 0!==l&&(p.sim_qualityLimitationReason||(p.sim_qualityLimitationReason=[],p.sim_qualityLimitationDurations=[],p.sim_qualityLimitationResolutionChanges=[]),p.sim_qualityLimitationReason.push(l),p.sim_qualityLimitationDurations.push(h),p.sim_qualityLimitationResolutionChanges.push(f));var S=m.simulcast[e];if(p.sim_enc_width.push(r||0),p.sim_enc_height.push(n||0),p.sim_enc_key_frames.push(y||0),S){var b=(o-S.bytesSent||0)/i.statsInterval;p.sim_enc_bps.push(Math.round(8e3*b)),p.sim_enc_bandwidth.push(Math.round(8e3*b/1024));var E=1e3*(s-S.framesEncoded)/i.statsInterval;p.sim_enc_framerate.push(Math.round(E)),p.sim_rids.push(e);var k=void 0!==c?c-S.framesSent:s-S.framesEncoded,T=1e3*k/i.statsInterval;p.sim_sent_framerate.push(Math.round(T));var I=(u-S.packetsLost)/(d-S.packetsSent);i._retransmittedRate=(v-S.retransmittedPacketsSent)/(d-S.packetsSent),I=Number.isNaN(I)?0:I,p.sim_fraction_lost.push(I),p.sim_keyencoded.push(_-S.pliCount>0),p.active_sim_streams.push(b>=0),p.sim_retransmittedRate.push(i._retransmittedRate),r>0&&!g&&(i.sentKBitrate=8*b,i.encoderOutputFrameRate=E,i.encodedFrameCount=k,i.sentFrameRate=T,i.videoLossRate=I,g=!0)}})),this.monitor.rtcMediaStatistics(p,{})):(i.encodedFrameCount=void 0!==a.framesSent?a.framesSent-m.framesSent:a.framesEncoded-m.framesEncoded,i.sentKBitrate=(a.bytesSent-m.bytesSent||0)/i.statsInterval*8,p.bitrate=Math.round(1e3*i.sentKBitrate),p.bandwidth=Math.round(p.bitrate/1024),i.encoderOutputFrameRate=1e3*(a.framesEncoded-m.framesEncoded)/i.statsInterval,p.frame_rate_encoded=Math.round(i.encoderOutputFrameRate),i.sentFrameRate=1e3*i.encodedFrameCount/i.statsInterval,p.frame_rate_sent=Math.round(i.sentFrameRate),i.videoLossRate=(a.packetsLost-m.packetsLost)/(a.packetsSent-m.packetsSent),i.videoLossRate=Number.isNaN(i.videoLossRate)?0:i.videoLossRate,p.fraction_lost=i.videoLossRate,i._retransmittedRate=(a.retransmittedPacketsSent-m.retransmittedPacketsSent)/(a.packetsSent-m.packetsSent),this.monitor.rtcMediaStatistics(p,{})),r.video=a,i._fractionLost=Math.max(i._fractionLost,i.videoLossRate),e.abrupt("return",this.filterIllegal(i));case 28:case"end":return e.stop()}}),e,this)}))),function(e,r){return t.apply(this,arguments)})}]),i}(Lz),Vz=function(e){f(a,e);var t,r,n,i=g(a);function a(e){var t;return u(this,a),h(m(t=i.call(this,e)),"isPaused",void 0),h(m(t),"pauseStart",void 0),h(m(t),"pauseDuration",void 0),h(m(t),"_audioStallCount",void 0),h(m(t),"_setAudioStallCount",void 0),h(m(t),"_audioStallTimer",void 0),h(m(t),"_audioStallInterval",void 0),h(m(t),"_audioStallRatio",void 0),h(m(t),"_videoInWaiting",void 0),h(m(t),"_context",void 0),t._videoInWaiting=!1,t.pauseDuration=0,t}return l(a,[{key:"setRemoteStreamStatsEvtInterval",value:(n=c(o().mark((function e(t,r,n,i){var s,u,d,l,h,f,p,v,_,m,y,g,S,b,E=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._timer){e.next=2;break}return e.abrupt("return");case 2:return this.setVar(t,r,n),this._context=i,t.once(_j.ABNORMAL_DISCONNECTION,(function(){E.destroy()})),this._audioStallInterval=a.audioStallInterval||100,this._audioStallRatio=a.audioStallRatio||.6,d={audio:{},video:{}},l=this._stream,h=null===(s=l.audioTrack)||void 0===s?void 0:s.getTrack(),f=null===(u=l.videoTrack)||void 0===u?void 0:u.getTrack(),this.getRemoteVideoStats(f,d),e.next=14,this.getRemoteAudioStats(h,d);case 14:this.delStatsEvtInterval(),p=0,v=0,m=[],y=0,g=fP(),this._setAudioStallCount=function(){if(E._audioStallInterval>0&&void 0!==d.audio.concealedSamples){var e=d.audio.concealedSamples,t=d.audio.totalSamplesReceived;g=fP();var r={isStall:!1,counted:!1,diff:0},n=.5*E._audioStallInterval;E._audioStallCount=c(o().mark((function i(){var a,s,c,u,d,h,f,_,S,b,k,T,I,A,R;return o().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(s=l.hasAudio,c=l.subAudio,s&&c){i.next=7;break}return r.isStall=!1,r.counted=!1,m.push({reason:"hasAudio: ".concat(s,", subAudio: ").concat(c)}),g=fP(),i.abrupt("return",{stall_count:p,stall_duration:v,stall_list:m,stats_count:y});case 7:return u=null===(a=l.audioTrack)||void 0===a?void 0:a.getTrack(),d=Date.now(),i.next=11,E.handler.getStats(u,!0);case 11:if(h=i.sent,f=Date.now(),_=fP(),!((S=_-g)<n)){i.next=18;break}return m.push({diff:S,start:g,end:_,get_stats_cost:f-d,get_stats_start:d,get_stats_end:f,reason:"diff(".concat(S,") < minInterval(").concat(n,")")}),i.abrupt("return",{stall_count:p,stall_duration:v,stall_list:m,stats_count:y});case 18:if(b=h.length,k=h.find((function(e){return"inbound-rtp"===e.type}))){i.next=23;break}return m.push({diff:S,start:g,end:_,get_stats_cost:f-d,get_stats_start:d,get_stats_end:f,reason:b?"no inbound-rtp":"no report"}),i.abrupt("return",{stall_count:p,stall_duration:v,stall_list:m,stats_count:y});case 23:return T=k.concealedSamples,I=k.totalSamplesReceived,R=I-t,(A=T-e)>=0&&R>=0&&A>=E._audioStallRatio*R?(m.push({concealed:A,received:R,diff:S,start:g,end:_,get_stats_cost:f-d,get_stats_start:d,get_stats_end:f,is_stall:!0}),r.isStall?(r.counted?v+=S:(v=v+r.diff+S,p++),r.counted=!0):S>=200?(v+=S,p++,r.counted=!0):(r.counted=!1,r.diff=S),r.isStall=!0):(m.push({concealed:A,received:R,diff:S,start:g,end:_,get_stats_cost:f-d,get_stats_start:d,get_stats_end:f}),r.isStall=!1,r.counted=!1),e=T,t=I,g=_,y++,i.abrupt("return",{stall_count:p,stall_duration:v,stall_list:m,stats_count:y});case 32:case"end":return i.stop()}}),i)}))),_=function(){var e=c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!E._audioStallCount&&E._setAudioStallCount&&E._setAudioStallCount(),!E._audioStallCount){e.next=6;break}return e.next=4,E._audioStallCount();case 4:E._audioStallTimer&&clearTimeout(E._audioStallTimer),E._audioStallTimer=setTimeout(_,E._audioStallInterval);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),E._audioStallTimer&&clearTimeout(E._audioStallTimer),E._audioStallTimer=setTimeout(_,E._audioStallInterval)}},this._setAudioStallCount(),S=function(){var e=c(o().mark((function e(){var t,r,n,i,a,s;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=null===(t=l.audioTrack)||void 0===t?void 0:t.getTrack(),i=null===(r=l.videoTrack)||void 0===r?void 0:r.getTrack(),e.next=4,E.getRemoteAudioStats(n,d);case 4:return a=e.sent,p=0,v=0,m=[],y=0,e.next=11,E.getRemoteVideoStats(i,d);case 11:return s=e.sent,e.abrupt("return",{audioStats:a,videoStats:s,isScreen:l.isScreen,userId:l.userId});case 13:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),b=function(){var e=c(o().mark((function e(){var t,r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,S();case 2:r=e.sent,null===(t=E.client)||void 0===t||t.emit("onRemoteStreamStats",r),_&&(g=fP(),E._audioStallTimer&&clearTimeout(E._audioStallTimer),E._audioStallTimer=setTimeout(_,E._audioStallInterval)),E._timer&&clearTimeout(E._timer),E._timer=setTimeout(b,2e3);case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),this._timer&&clearTimeout(this._timer),this._timer=setTimeout(b,2e3);case 26:case"end":return e.stop()}}),e,this)}))),function(e,t,r,i){return n.apply(this,arguments)})},{key:"delStatsEvtInterval",value:function(){b(p(a.prototype),"delStatsEvtInterval",this).call(this),clearTimeout(this._audioStallTimer),this._audioStallCount=void 0,this._setAudioStallCount=void 0,this.pauseDuration=0}},{key:"unsubscribe",value:function(){this.delStatsEvtInterval(),this._videoInWaiting=!1}},{key:"getRemoteAudioStats",value:(r=c(o().mark((function e(t,r){var n,i,a,s,c,u,d,l,h,f,p,v,_,m,y,g,S,b,E,k=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n={},i={},a=this._stream,s=a.streamId,c=a.userId,u=a.isScreen,d=a.audioMid,l=a.subMediaType,h=a._attributes,f=a.virtual,p={media_type:"audio",is_screen:!!u,direction:"down",stream_id:s,stream_user_id:c,vid:d,audio_mux:f,connection_status:navigator.onLine,track_enabled:null==t?void 0:t.enabled,mute_state:UP(l)?"mute_state_off":"mute_state_on",remote_user_capture_state:h.localaudio?"capture_state_on":"capture_state_off",remote_user_mute_state:h.localaudio&&h.audiostream?"mute_state_off":"mute_state_on"},t&&this.handler){e.next=6;break}return e.abrupt("return",n);case 6:return e.next=8,this.handler.getStats(t);case 8:if((v=e.sent).length){e.next=11;break}return e.abrupt("return",n);case 11:if(v.forEach((function(e){var t=e.type,r=e.packetsLost,o=e.packetsReceived,a=e.bytesReceived,c=e.jitterBufferDelay,u=e.jitterBufferEmittedCount,d=e.clockRate,l=e.channels,h=e.totalSamplesReceived,f=e.concealedSamples,v=e.silentConcealedSamples,_=e.concealmentEvents,m=e.totalRoundTripTime,y=e.packetsDiscarded,g=e.state,S=e.currentRoundTripTime,b=e.audioLevel,E=e.totalAudioEnergy,T=e.totalSamplesDuration,I=e.mimeType,A=e.googDecodingNormal,R=e.googDecodingMuted,w=e.availableIncomingBitrate,C=e.availableOutgoingBitrate,O=e.bytesSent,x=e.nominated,D=e.id,N=e.writable,P=e.jitter,M=e.candidateType,L=e.ip,U=e.address,V=e.networkType,F=e.port,B=e.protocol,j=e.audioOutputLevel,G=e.requestsReceived,H=e.responsesReceived,z=e.requestsSent,X=e.consentRequestsSent,K=e.responsesSent,q=e.ssrc;e.kind;var W=e.nackCount,Y=e.lastPacketReceivedTimestamp,J=e.concealmentevents,Q=e.fecPacketsReceived;if("inbound-rtp"===t)i.packetsLost=r,i.packetsReceived=o,p.packetsReceived=o,p.packetsDiscarded=y,p.nackCount=W,p.lastPacketReceivedTimestamp=Y,p.concealmentevents=J,i.bytesReceived=a,void 0!==c&&(n.jitterBufferDelay=c/u*1e3,p.average_jitter_buffer_delay_ms=n.jitterBufferDelay),void 0!==h&&(i.totalSamplesReceived=h,n.concealedSamples=f,i.concealedSamples=f,i.silentConcealedSamples=v,p.concealedSamples=f,n.concealmentEvents=_,p.totalSamplesReceived=h),void 0!==Q&&(p.fec_packets_received=Q,i.fecPacketsReceived=Q),p.jitter=1e3*P,p.ssrc=q,void 0!==b&&(p.audio_level=b?-10*Math.log10(Math.pow(b,2)):b),void 0!==b&&(p.volume=255*b),void 0!==E&&(p.total_audio_energy=E),void 0!==T&&(p.totalAudioDuration=T);else if("codec"===t)n.recordSampleRate=d,l&&(n.numChannels=l),p.codecName=I;else if("candidate-pair"===t){var Z,$,ee;p.ice_available_incoming_bitrate=w,p.ice_available_outgoing_bitrate=C,p.ice_bytes_received=a,p.ice_bytes_sent=O,p.ice_nominated=+x,p.ice_pair_id=D,p.ice_pair_rtt=S,p.rtt=1e3*S,p.rtt&&null!==(Z=k._context)&&void 0!==Z&&null!==($=Z.streamRTT)&&void 0!==$&&null!==(ee=$[s])&&void 0!==ee&&ee.audio&&(p.total_rtt_ms=p.rtt+k._context.streamRTT[s].audio),p.ice_pair_state=g,p.ice_pair_writable=N,p.recv_ping_requests=G,p.recv_ping_responses=H,p.sent_ping_requests_before_first_response=z,p.sent_ping_requests_total=z+(X||0),p.sent_ping_responses=K,"succeeded"===g&&(n.rtt=1e3*S,n.total_rtt=1e3*m)}else"track"===t&&void 0!==b?(p.audio_level=b?-10*Math.log10(Math.pow(b,2)):b,p.volume=255*b,p.total_audio_energy=E,p.totalAudioDuration=T):"ssrc"===t?(p.decodingNormal=A,p.recvAudioLevel=j,p.decodingMuted=R):"local-candidate"===t?(p.local_candidate_type=M,p.local_ip=L||U,p.local_network_type=V,p.local_port=F,p.protocol=B):"remote-candidate"===t&&(p.remote_candidate_type=M,p.remote_ip=L||U,p.remote_port=F)})),(_=r.audio).timestamp){e.next=17;break}return i.timestamp=Date.now(),r.audio=i,e.abrupt("return",this.filterIllegal(n));case 17:if(m={},void 0!==i.concealedSamples&&(p.interval_concealed_samples=i.concealedSamples-_.concealedSamples,p.interval_samples_received=i.totalSamplesReceived-_.totalSamplesReceived,p.interval_silent_concealed_samples=i.silentConcealedSamples-_.silentConcealedSamples),!(this._audioStallInterval>0&&void 0!==_.concealedSamples)){e.next=35;break}if(!this._audioStallCount&&this._setAudioStallCount&&this._setAudioStallCount(),clearTimeout(this._audioStallTimer),!this._audioStallCount){e.next=35;break}return e.next=25,this._audioStallCount();case 25:y=e.sent,g=y.stall_count,S=y.stall_duration,b=y.stall_list,E=y.stats_count,m.stall_list=b,m.stats_count=E,p.concealedSamples===p.interval_concealed_samples&&p.totalSamplesReceived===p.interval_samples_received?(p.stall_count=0,p.stall_duration=0):(p.stall_count=g,p.stall_duration=S),n.stallCount=p.stall_count,n.stallDuration=p.stall_duration;case 35:return i.timestamp=Date.now(),n.audioLossRate=(i.packetsLost-_.packetsLost)/(i.packetsReceived-_.packetsReceived+(i.packetsLost-_.packetsLost)),n.audioLossRate=Number.isNaN(n.audioLossRate)?0:n.audioLossRate,p.packetsLost=Math.round(i.packetsLost-_.packetsLost),p.fraction_lost=n.audioLossRate,n.statsInterval=i.timestamp-_.timestamp,p.stats_interval=n.statsInterval,n.receivedKBitrate=(i.bytesReceived-_.bytesReceived||0)/n.statsInterval*8,p.bandwidth=Math.round(1e3*n.receivedKBitrate/1024),void 0!==i.concealedSamples&&(n.receivedSampleRate=1e3*p.interval_samples_received/n.statsInterval),void 0!==i.fecPacketsReceived&&(p.fecBitratebps=(i.fecPacketsReceived-_.fecPacketsReceived||0)/n.statsInterval),r.audio=i,this.monitor.rtcMediaStatistics(p,{},m),e.abrupt("return",this.filterIllegal(n));case 49:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"getRemoteVideoStats",value:(t=c(o().mark((function e(t,r){var n,i,a,s,c,u,d,l,h,f,p,v,_,m=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i={},a={timestamp:Date.now()},s=this._stream,c=s.streamId,u=s.userId,d=s.isScreen,l=s.subMediaType,h=s._attributes,f={media_type:"video",is_screen:!!d,direction:"down",stream_id:c,stream_user_id:u,vid:this._stream.videoMid,connection_status:navigator.onLine,track_enabled:null==t?void 0:t.enabled,mute_state:VP(l)?"mute_state_off":"mute_state_on",remote_user_capture_state:h.localvideo?"capture_state_on":"capture_state_off",remote_user_mute_state:h.localvideo&&h.videostream?"mute_state_off":"mute_state_on"},t&&this.handler){e.next=6;break}return e.abrupt("return",i);case 6:return i.isScreen=d,e.next=9,this.handler.getStats(t);case 9:if(p=e.sent,null===(n=this.monitor)||void 0===n||n.rtcInvokeStatus("reports.length: ".concat(p.length,"; videoTrack: ").concat(t.id),0,"get_remote_video_stats",c,0),p.length){e.next=13;break}return e.abrupt("return",i);case 13:if(p.forEach((function(e){var t=e.type,r=e.frameHeight,n=e.frameWidth,o=e.packetsLost,s=e.packetsReceived,u=e.bytesReceived,d=e.framesDecoded,l=e.jitterBufferDelay,h=e.jitterBufferEmittedCount,p=e.mimeType,v=e.firCount,_=e.availableIncomingBitrate,y=e.availableOutgoingBitrate,g=e.bytesSent,S=e.nominated,b=e.id,E=e.currentRoundTripTime,k=e.state,T=e.writable,I=e.candidateType,A=e.ip,R=e.address,w=e.networkType,C=e.port,O=e.nackCount,x=e.pliCount,D=e.protocol,N=e.requestsReceived,P=e.responsesReceived,M=e.requestsSent,L=e.consentRequestsSent,U=e.responsesSent,V=e.ssrc,F=e.jitter,B=e.framesReceived,j=e.keyFramesDecoded,G=e.decoderImplementation,H=e.lastPacketReceivedTimestamp;if("inbound-rtp"===t)a.packetsLost=o,f.packetsLost=o,a.packetsReceived=s,f.packetsReceived=s,a.bytesReceived=u,f.bytes=u,a.framesDecoded=d,void 0!==l&&(a.jitterBufferDelay=l/h*1e3,f.average_jitter_buffer_delay_ms=a.jitterBufferDelay),f.fir_count=v,f.nackCount=O,a.nackCount=O,f.pli_count=x,f.ssrc=V,f.jitter=F,f.framesReceived=B,a.framesReceived=B,f.framesDecoded=d,f.key_frames_decoded=j,f.decoder_name=G,f.last_packet_received_timestamp=H,void 0!==n&&(i.width=n,f.frame_size_width=n,i.height=r,f.frame_size_height=r);else if("track"===t&&void 0!==n)i.width=n,f.frame_size_width=n,i.height=r,f.frame_size_height=r,void 0!==B&&(f.framesReceived=B,a.framesReceived=B);else if("codec"===t)f.codecName=p;else if("candidate-pair"===t){var z,X,K;f.ice_available_incoming_bitrate=_,f.ice_available_outgoing_bitrate=y,f.ice_bytes_received=u,f.ice_bytes_sent=g,f.ice_nominated=+S,f.ice_pair_id=b,f.ice_pair_rtt=E,f.rtt=1e3*E,f.rtt&&null!==(z=m._context)&&void 0!==z&&null!==(X=z.streamRTT)&&void 0!==X&&null!==(K=X[c])&&void 0!==K&&K.video&&(f.total_rtt_ms=f.rtt+m._context.streamRTT[c].video),i.rtt=f.rtt,f.ice_pair_state=k,f.ice_pair_writable=T,f.recv_ping_requests=N,f.recv_ping_responses=P,f.sent_ping_requests_before_first_response=M,f.sent_ping_requests_total=M+(L||0),f.sent_ping_responses=U}else"local-candidate"===t?(f.local_candidate_type=I,f.local_ip=A||R,f.local_network_type=w,f.local_port=C,f.protocol=D):"remote-candidate"===t&&(f.remote_candidate_type=I,f.remote_ip=A||R,f.remote_port=C)})),(v=r.video).timestamp){e.next=18;break}return r.video=a,e.abrupt("return",this.filterIllegal(i));case 18:return i.videoLossRate=(a.packetsLost-v.packetsLost)/(a.packetsReceived-v.packetsReceived+(a.packetsLost-v.packetsLost)),i._retransmittedRate=(a.nackCount-v.nackCount)/(a.packetsReceived-v.packetsReceived+(a.packetsLost-v.packetsLost)),i.videoLossRate=Number.isNaN(i.videoLossRate)?0:i.videoLossRate,f.fraction_lost=i.videoLossRate,i.statsInterval=a.timestamp-v.timestamp,f.stats_interval=i.statsInterval,i.receivedKBitrate=(a.bytesReceived-v.bytesReceived||0)/i.statsInterval*8,f.bitrate=Math.round(1e3*i.receivedKBitrate),f.bandwidth=Math.round(f.bitrate/1024),i.decoderOutputFrameRate=1e3*(a.framesDecoded-v.framesDecoded)/i.statsInterval,i.receivedFrameRate=1e3*(a.framesReceived-v.framesReceived)/i.statsInterval,f.frame_rate_decoded=Math.round(i.decoderOutputFrameRate),f.frame_rate_received=Math.round(i.receivedFrameRate),r.video=a,this.processStall(this._stream,f,i,d),this.isPaused?(_=a.timestamp-(this.pauseStart||0),f.pause_duration=this.pauseDuration+(_>500?_:0),this.pauseStart=a.timestamp):f.pause_duration=this.pauseDuration,f.pause_duration=Math.min(f.stall_duration,f.pause_duration),this.pauseDuration=0,this.monitor.rtcMediaStatistics(f,{}),e.abrupt("return",this.filterIllegal(i));case 38:case"end":return e.stop()}}),e,this)}))),function(e,r){return t.apply(this,arguments)})},{key:"processStall",value:function(e,t,r,n){var i=0,o=0,a=0;if(e.recordedVideoFrames&&this.player&&this.player.played){e.recordedVideoFrames.forEach((function(e){e.isStall&&(i+=e.stallCount,o+=e.stallDuration),a=e.playTime})),e.recordedVideoFrames.length||(o=2e3,i=this._videoInWaiting?0:1,this._videoInWaiting=!0);var s=e.recordedVideoFrames.pop();s&&(s.isStall?this._videoInWaiting=!0:this._videoInWaiting=!1),e.recordedVideoFrames=[]}t.stall_count=i,n?(t.stuck_length=o,t.stall_duration=void 0):(t.stall_duration=o,t.stuck_length=void 0),t.play_time=a,r.stallCount=i,r.stallDuration=o}},{key:"destroy",value:function(){b(p(a.prototype),"destroy",this).call(this),this.delStatsEvtInterval(),this._videoInWaiting=!1}}],[{key:"audioStallConfig",set:function(e){a.audioStallInterval=((null==e?void 0:e.audio_stall_interval)||200)/2,a.audioStallRatio=null==e?void 0:e.audio_stall_ratio}}]),a}(Lz);h(Vz,"audioStallInterval",void 0),h(Vz,"audioStallRatio",void 0);var Fz,Bz,jz,Gz=function(e){return e.RESUBSCRIBE="resubscribe",e.STREAM_FAILED="stream_failed",e.SUBSCRIBE_PUSH_TRACK="subscribe_push_track",e.REMOVE_PUSH_TRACK="remove_push_track",e.VIDEO_FIRST_FRAME="video_first_frame",e.ON_USER_PUBLISH_STATE_CHANGE="on_user_publish_state_change",e.ON_USER_START_AUDIO_CAPTURE="on_user_start_audio_capture",e.ON_USER_STOP_AUDIO_CAPTURE="on_user_stop_audio_capture",e.ON_USER_START_VIDEO_CAPTURE="on_user_start_video_capture",e.ON_USER_STOP_VIDEO_CAPTURE="on_user_stop_video_capture",e.ON_SEI_MESSAGED_RECEIVED="on_sei_messaged_received",e.ON_PUBLISH_RESULT="on_publish_result",e.ON_UPDATE_TOKEN_SUCCESS="on_update_token_success",e.ON_REMOTE_STREAM_STATS="ON_REMOTE_STREAM_STATS",e.ON_LOCAL_STREAM_STATS="ON_LOCAL_STREAM_STATS",e.ON_USER_LEAVE="on_user_leave",e.ON_ROOM_ERROR="on_room_error",e.ON_NETWORK_QUALITY="on_network_quality",e.ON_SIMULCAST_SUBSCRIBE_FALLBACK="on_simulcast_subscribe_fallback",e.ON_REMOTE_VIDEO_SIZE_CHANGED="on_remote_video_size_changed",e.RECONNECT_FAILED="reconnect_failed",e.ON_VIDEO_STREAM_BANNED="ON_VIDEO_STREAM_BANNED",e.ON_AUDIO_STREAM_BANNED="ON_AUDIO_STREAM_BANNED",e}(Gz||{}),Hz=function(e){return e[e.START=1]="START",e[e.START_SUCCESS=2]="START_SUCCESS",e[e.START_FAILED=3]="START_FAILED",e[e.UPDATE=4]="UPDATE",e[e.UPDATE_SUCCESS=5]="UPDATE_SUCCESS",e[e.UPDATE_FAILED=6]="UPDATE_FAILED",e[e.STOP=7]="STOP",e[e.STOP_SUCCESS=8]="STOP_SUCCESS",e[e.STOP_FAILED=9]="STOP_FAILED",e}(Hz||{}),zz=function(e){return e[e.PUB=0]="PUB",e[e.UNPUB=1]="UNPUB",e}(zz||{}),Xz=function(e){return e[e.SUB=0]="SUB",e[e.UNSUB=1]="UNSUB",e}(Xz||{}),Kz=new JL("Stream",0),qz=function(e){return e[e.INIT=0]="INIT",e[e.SUB_ING=1]="SUB_ING",e[e.SUB_ED=2]="SUB_ED",e}(qz||{}),Wz=function(){function e(){u(this,e),h(this,"isScreen",!1),h(this,"stream",void 0),h(this,"streamId",void 0),h(this,"audioMid",void 0),h(this,"videoMid",void 0),h(this,"seiList",[]),h(this,"videoTrack",void 0),h(this,"audioTrack",void 0),h(this,"videoTransceiver",void 0),h(this,"audioTransceiver",void 0),h(this,"videoInputConfig",void 0),h(this,"videoEncodeConfig",[dj]),h(this,"subVideoDescriptions",[]),h(this,"enableSimulcast",!1),h(this,"observer",void 0),h(this,"statsReport",void 0),h(this,"prevScaleResolutionDownBy",1),h(this,"pubAudio",!1),h(this,"pubVideo",!1),h(this,"pubAttributes",void 0),this.stream=new MediaStream,this.videoInputConfig={width:640,height:360,frameRate:30},this.pubAttributes={localaudio:!1,localvideo:!1,videostream:!1,audiostream:!1,extvideo:!1,extaudio:!1},this.statsReport=new Uz(this)}return l(e,[{key:"hasPublished",get:function(){return this.audioMid&&this.videoMid}},{key:"isEmptyStream",get:function(){return!this.audioTrack&&!this.videoTrack}},{key:"initStreamId",get:function(){return this.stream.id}},{key:"initVideoEncodedTransform",value:function(){var e=this;if(this.videoTransceiver&&this.videoTransceiver.sender){var t=this.videoTransceiver.sender;if(Yj()){var r=t.createEncodedStreams(),n=r.readable,i=r.writable,o=new TransformStream({transform:function(t,r){var n=e.seiList[0];if(n){var i=Mz.generateSEI(n.content),o=new Uint8Array(i.byteLength+t.data.byteLength);0===n.repeatCount&&e.seiList.splice(0,1),n.repeatCount--,o.set(new Uint8Array(t.data)),o.set(i,t.data.byteLength),t.data=o.buffer,r.enqueue(t)}else r.enqueue(t)}});n.pipeThrough(o).pipeTo(i)}}else Kz.print("no sender found when trying to bind encodedTransform")}},{key:"initAudioEncodedTransform",value:function(){if(this.audioTransceiver&&this.audioTransceiver.sender){var e=this.audioTransceiver.sender.createEncodedStreams(),t=e.readable,r=e.writable;t.pipeThrough(new TransformStream({transform:function(e,t){t.enqueue(e)}})).pipeTo(r)}else Kz.print("no sender found when trying to bind encodedTransform")}},{key:"clean",value:function(){var e;MB.rtcInvokeStatus("".concat((new Error).stack),0,"localstream_clean",this.streamId||"",0),this.audioMid=void 0,this.videoMid=void 0,this.videoTransceiver=void 0,this.audioTransceiver=void 0,null===(e=this.observer)||void 0===e||e.reset(),this.statsReport.destroy(),this.prevScaleResolutionDownBy=1,this.subVideoDescriptions=[]}},{key:"switchTrackEnableState",value:function(e,t){var r,n;"audio"===e?n=this.audioTrack:"video"===e&&(n=this.videoTrack);var i=null===(r=n)||void 0===r?void 0:r.getTrack();return!(!i||(null==i?void 0:i.enabled)===t)&&(i.enabled=t,!0)}}]),e}(),Yz=function(e){f(r,e);var t=g(r);function r(e,n,i,o){var a,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:K.LOW;return u(this,r),h(m(a=t.call(this)),"streamId",void 0),h(m(a),"userId",void 0),h(m(a),"isScreen",void 0),h(m(a),"hasVideo",void 0),h(m(a),"hasAudio",void 0),h(m(a),"_attributes",void 0),h(m(a),"streamState",void 0),h(m(a),"observer",void 0),h(m(a),"statsReport",void 0),h(m(a),"subVideo",void 0),h(m(a),"subAudio",void 0),h(m(a),"subMediaType",void 0),h(m(a),"subLayer",void 0),h(m(a),"audioMid",void 0),h(m(a),"videoMid",void 0),h(m(a),"_sequenceId",void 0),h(m(a),"stream",void 0),h(m(a),"videoTrack",void 0),h(m(a),"audioTrack",void 0),h(m(a),"videoTransceiver",void 0),h(m(a),"audioTransceiver",void 0),h(m(a),"recordedVideoFrames",void 0),h(m(a),"stillExist",void 0),h(m(a),"originalMediaType",void 0),h(m(a),"originalStreamIndex",0),h(m(a),"virtual",void 0),a.userPriority=s,a.virtual=!1,a.userId=e,a.isScreen=i,a.streamId=n,a.hasAudio=o.audiostream&&o.localaudio,a.hasVideo=o.videostream&&o.localvideo,a._attributes=o,a.subVideo=!1,a.subAudio=!1,a._sequenceId=0,a.subMediaType=Az.NONE,a.subLayer={spatialLayer:0,spatialSubLayer:-1},a.streamState=0,a.statsReport=new Vz(m(a)),a}return l(r,[{key:"sequenceId",get:function(){return this._sequenceId||-1},set:function(e){"number"==typeof e&&(this._sequenceId=e)}},{key:"hasSubscribed",get:function(){return 2===this.streamState}},{key:"attributes",get:function(){return this._attributes},set:function(e){this.hasVideo=e.localvideo&&e.videostream,this.hasAudio=e.localaudio&&e.audiostream,this._attributes=e}},{key:"initVideoEncodedTransform",value:function(){var e=this;if(this.videoTransceiver&&this.videoTransceiver.receiver){var t=this.videoTransceiver.receiver.createEncodedStreams(),r=t.readable,n=t.writable;r.pipeThrough(new TransformStream({transform:function(t,r){Rz.getNalunits(new wz(t.data)).forEach((function(t){if(t.sei){var r=Mz.decodeSeiBody(t.body);r&&r.type!==Cz.internal&&e.safeEmit("onSEIMessage",r.payload)}})),r.enqueue(t)}})).pipeTo(n)}else Kz.print("no receiver found when trying to bind encodedTransform")}},{key:"initAudioEncodedTransform",value:function(){if(this.audioTransceiver&&this.audioTransceiver.receiver){var e=this.audioTransceiver.receiver.createEncodedStreams(),t=e.readable,r=e.writable;t.pipeThrough(new TransformStream({transform:function(e,t){t.enqueue(e)}})).pipeTo(r)}else Kz.print("no receiver found when trying to bind encodedTransform")}},{key:"ontrack",value:function(e){var t,r,n,i,o;try{MB.rtcInvokeStatus(JSON.stringify({uid:this.userId,streamId:this.streamId,streams:e.streams.reduce((function(e,t){return e+(null==(r=t)?"undefined | null":"string"==typeof r?r:JSON.stringify({id:r.id,active:r.active}));var r}),""),transceiver:(n=e.transceiver,null==n?"undefined | null":"string"==typeof n?n:JSON.stringify({currentDirection:n.currentDirection,direction:n.direction,mid:n.mid,stopped:n.stopped,receiver:(o=n.receiver,null==o?"undefined | null":"string"==typeof o?o:JSON.stringify({track:jP(o.track)})),sender:(i=n.sender,null==i?"undefined | null":"string"==typeof i?i:JSON.stringify({track:jP(i.track)}))})),track:jP(e.track)}),0,"Stream.ontrack","",0)}catch(T0){}if((null===(t=e.streams)||void 0===t||null===(r=t[0])||void 0===r?void 0:r.id)===this.streamId){var a,s=e.track;"video"===(null==s?void 0:s.kind)?this._setVideoTrack(s):"audio"===(null===(a=e.track)||void 0===a?void 0:a.kind)&&this._setAudioTrack(s),this._setStream(e.streams[0])}this.safeEmit("ontrack",e)}},{key:"clean",value:function(){var e;Kz.print("clean","exec stream.clean ".concat(this.streamId," ").concat(this.userId)),MB.rtcInvokeStatus("".concat((new Error).stack),0,"remotestream_clean",this.streamId,0),this.subAudio=!1,this.subVideo=!1,this.audioMid=void 0,this.videoMid=void 0,this.sequenceId=0,this.videoTrack=void 0,this.audioTrack=void 0,this.stream=void 0,this.videoTransceiver=void 0,this.audioTransceiver=void 0,this.recordedVideoFrames=void 0,null===(e=this.observer)||void 0===e||e.reset(),this.statsReport.destroy()}},{key:"resetHasSubscribed",value:function(){this.streamState=0}},{key:"setRemoteUserPriority",value:function(e){this.userPriority=e}},{key:"getStreamPriority",value:function(){var e=this.isScreen?20:this.hasAudio||this.hasVideo?this.attributes.videoDescriptions.length>1?10-this.subLayer.spatialLayer:9:0;return 1e4*this.userPriority+100*e}},{key:"getSubscribeFallbackParams",value:function(e){if(e!==X.DISABLE&&this.subVideo){if(this.attributes.videoDescriptions.length-1>this.subLayer.spatialLayer)return[this.originalMediaType,Xz.SUB,this._getSubLayerBySpatialLayer(this.subLayer.spatialLayer+1)];if(e===X.AUDIO_ONLY)return[U.VIDEO,Xz.UNSUB]}return null}},{key:"getSubscribeRecoverParams",value:function(){if(this.originalMediaType&&VP(this.originalMediaType)){if(!1===this.subVideo)return[this.originalMediaType,Xz.SUB,this.subLayer];if("number"==typeof this.originalStreamIndex&&this.subLayer.spatialLayer>this.originalStreamIndex)return[this.originalMediaType,Xz.SUB,this._getSubLayerBySpatialLayer(this.subLayer.spatialLayer-1)]}return null}},{key:"_setStream",value:function(e){var t=this;this.stream=e,e.onaddtrack=function(e){"video"===e.track.kind?t._setVideoTrack(e.track):"audio"===e.track.kind&&t._setAudioTrack(e.track)}}},{key:"_setAudioTrack",value:function(e){var t,r;(null===(t=this.audioTrack)||void 0===t||null===(r=t.getTrack())||void 0===r?void 0:r.id)!==(null==e?void 0:e.id)&&(this.audioTrack=_z(e),this.emit("ontrack",this.audioTrack))}},{key:"_setVideoTrack",value:function(e){var t,r;(null===(t=this.videoTrack)||void 0===t||null===(r=t.getTrack())||void 0===r?void 0:r.id)!==(null==e?void 0:e.id)&&(this.videoTrack=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:hP();return new JH(e,t)}(e),this.emit("ontrack",this.videoTrack))}},{key:"_getSubLayerBySpatialLayer",value:function(e){var t=this._attributes,r=t.videoDescriptions,n=t.subVideoDescriptions,i=void 0===n?[]:n,o=r[e],a=o.width,s=o.height,c=i.find((function(e){return e.width===a&&e.height===s}));return{spatialLayer:e,spatialSubLayer:(null==c?void 0:c.sub_index)||-1}}}]),r}($L),Jz=new JL("queue",4),Qz=function(e){return e[e.ADD=0]="ADD",e[e.CLOSE=1]="CLOSE",e}(Qz||{}),Zz=function(e){return e.publish="publish",e.unpublish="unpublish",e.subscribe="subscribe",e.unsubscribe="unsubscribe",e.pushtrack="pushtrack",e.removetrack="removetrack",e}(Zz||{}),$z=(h(Fz={},"publish","unpublish"),h(Fz,"subscribe","unsubscribe"),h(Fz,"pushtrack","removetrack"),Fz),eX=(h(Bz={},"publish",0),h(Bz,"subscribe",0),h(Bz,"pushtrack",0),h(Bz,"unpublish",1),h(Bz,"unsubscribe",1),h(Bz,"removetrack",1),Bz),tX=function(e){f(r,e);var t=g(r);function r(){var e;return u(this,r),h(m(e=t.call(this)),"_queue",void 0),e._queue=[],e}return l(r,[{key:"queue",get:function(){return this._queue}},{key:"enqueue",value:function(e){var t=this._queue.length,r="";return this._queue=this._queue.filter((function(t){return t.streamId!==e.streamId||e.action!==$z[t.action]||(r=t.streamId,Jz.print("offsetStreamId",r),!1)})),this._queue.length===t&&this._queue.push(e),this.emit("start"),r}},{key:"dequeue",value:function(){if(!this._queue.length)return null;var e=this._queue.length;CP&&(e=Math.min(this._queue.length,5));for(var t=eX[this._queue[0].action],r=1;r<e;r++)if(eX[this._queue[r].action]!==t)return{sdpStrategy:t,items:this._queue.splice(0,r)};return{sdpStrategy:t,items:this._queue.splice(0,e)}}}]),r}(GL),rX=new JL("ChromeHandler",3),nX=Yj(),iX=function(e){f(k,e);var r,n,a,s,d,v,_,y,S=g(k);function k(e,t){var r;return u(this,k),h(m(r=S.call(this,e,t)),"name","chrome"),h(m(r),"_queueBusy",!1),h(m(r),"_sdpQueue",void 0),h(m(r),"_aSendonlyOfferTpl",void 0),h(m(r),"_vSendonlyOfferTpl",void 0),h(m(r),"_aRecvonlyOfferTpl",void 0),h(m(r),"_vRecvonlyOfferTpl",void 0),h(m(r),"_mid",10),h(m(r),"_offerSession",void 0),h(m(r),"_answerSession",void 0),h(m(r),"_offerMlines",[]),h(m(r),"_answerMlines",[]),h(m(r),"_inactiveMlineIndex",[]),h(m(r),"_mlinesCache",{}),r._sdpQueue=new tX,r._sdpQueue.on("start",(function(){r._queueBusy||"stable"!==r._peerConnection.signalingState||(rX.print("dequeue start"),r.dequeue())})),r}return l(k,[{key:"connect",value:(y=c(o().mark((function e(t){var r,n,a,s,c,u,d=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return rX.print("connect","invoke connect"),this._offerIce={iceUfrag:null===(r=t.iceParams)||void 0===r?void 0:r.clientIceUfrag,icePwd:null===(n=t.iceParams)||void 0===n?void 0:n.clientIcePwd,iceOptions:"renomination"},e.next=4,GG(t);case 4:return this._answerIce=e.sent,e.next=7,this._peerConnection.createOffer();case 7:return a=e.sent,s=Jj.parse(a.sdp),c=E(s.media,1),u=c[0],this._offerIce.fingerprint=s.fingerprint||u.fingerprint,delete s.media,this._offerSession=i({},s),this._answerSession=i({},s),this._answerSession.fingerprint&&(this._answerSession.fingerprint=this._answerIce.fingerprint),this._offerMlines=[i(i(i({},u),this._offerIce),{},{mid:"".concat(0)})],this._answerMlines=[i(i(i({},u),this._answerIce),{},{sctpmap:{sctpmapNumber:5e3,app:"webrtc-datachannel",maxMessageSize:262144},mid:"".concat(0)})],this.setDescription(),e.next=21,new Promise((function(e,t){d._dataChannel.onopen=function(){rX.print("connect","dataChannel open"),XB("es.dc.open",""),e("")},d._dataChannel.onerror=function(e){MB.rtcSignalingMsgError(e.error.sdpLineNumber,e.error.errorDetail,uB.INVALID_DATA),XB("es.dc.error",""),t(e)},d._dataChannel.onclose=function(e){XB("es.dc.close",""),t(e)},d._peerConnection.addEventListener("connectionstatechange",(function(e){"failed"!==d._peerConnection.iceConnectionState&&"closed"!==d._peerConnection.iceConnectionState&&"failed"!==d._peerConnection.connectionState||t(e)}))}));case 21:return rX.print("connect","dataChannel establish success"),e.abrupt("return",this._dataChannel);case 23:case"end":return e.stop()}}),e,this)}))),function(e){return y.apply(this,arguments)})},{key:"disconnect",value:function(){this._peerConnection.close(),this._dataChannel.close(),this._peerConnection.ontrack=null}},{key:"destroy",value:function(){b(p(k.prototype),"destroy",this).call(this),this._mlinesCache={}}},{key:"publish",value:(_=c(o().mark((function e(t){var r,n,a,s,c,u,d,l,h,f,v,_,m,y,g,S,T,I,A,R,w,C,O,x,D,N,P,M,L,U;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return c=t.stream,u=t.enableSimulcast,d=b(p(k.prototype),"internalPublish",this).call(this,t),l=d.videoDescriptions,h=d.subVideoDescriptions,f=d.audioTransceiverInit,v=d.videoTransceiverInit,_=UG(this._nextSsrc),this._nextSsrc=_.next,m="".concat(this._mid++),y="".concat(this._mid++),g=i(i(i({},this._aSendonlyOfferTpl),this._offerIce),{},{mid:m,msid:"".concat(c.id," ").concat(c.id,"-audio"),ssrcs:VG(c.id,"audio",_.audio,MG)}),S=i(i(i({},this._vSendonlyOfferTpl),this._offerIce),{},{mid:y,msid:"".concat(c.id," ").concat(c.id,"-video")}),u?(rX.print("subVideoDesc","desc: %o ",h),delete S.ssrcGroups,delete S.ssrcs,T=[],S.rids=l.map((function(e){var t=e.rid;return T.unshift(t),{id:t,direction:"send"}})),S.simulcast={dir1:"send",list1:T.join(";")}):(I=FG(c.id,_,{cname:MG}),A=I.ssrcs,R=I.ssrcGroups,S.ssrcs=A,S.ssrcGroups=R),null!==(r=this._context)&&void 0!==r&&null!==(n=r.serverConfig)&&void 0!==n&&n.audioRed&&Array.isArray(g.rtp)&&(-1!==(w=g.rtp.findIndex((function(e){return"red"===e.codec})))&&(C=g.rtp.splice(w,1),O=E(C,1),x=O[0],g.rtp.unshift(x)),D=[],g.rtp.forEach((function(e){return D.push(e.payload)})),g.payloads=D.join(" ")),null!==(a=this._context)&&void 0!==a&&null!==(s=a.serverConfig)&&void 0!==s&&s.videoCodec&&qG(S,null===(N=this._context)||void 0===N||null===(P=N.serverConfig)||void 0===P?void 0:P.videoCodec),(SP||TP)&&Array.isArray(S.ext)&&(S.ext=S.ext.filter((function(e){var t;return!(null!=e&&null!==(t=e.uri)&&void 0!==t&&t.includes("video-orientation"))}))),(M=null==g?void 0:g.rtp.find((function(e){return"opus"===e.codec})))&&g.fmtp&&(U=g.fmtp.find((function(e){return e.payload===M.payload})))&&null!==(L=this._context)&&void 0!==L&&L.audioProfileManager&&(U.config+=this._context.audioProfileManager.getOpusConfigStr()),u||SP||this.addBitrateLimit(S,t.videoEncodeConfig[0].maxKbps),this._mlinesCache[t.stream.id]=[g,S],e.abrupt("return",{partialSdp:jG(this._offerSession,g,S),audioMid:m,videoMid:y,type:"incroffer",semantics:"unified-plan",videoDescriptions:l,subVideoDescriptions:h,audioTransceiverInit:f,videoTransceiverInit:v});case 17:case"end":return e.stop()}}),e,this)}))),function(e){return _.apply(this,arguments)})},{key:"subscribe",value:(v=c(o().mark((function e(t,r){var n,a,s,c,u,d,l,h,f,p,v,_,m,y,g,S,b,E,k,T,I,A,R=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(rX.print("subscribe"),s="incroffer",c="unified-plan",this._aRecvonlyOfferTpl&&this._vRecvonlyOfferTpl){e.next=11;break}return e.next=6,PP(!0);case 6:if(u=e.sent){e.next=9;break}throw new hN(dN.NOT_SUPPORTED,"Get offer Error");case 9:return e.next=11,this.createAVMlineOfferTpl(u);case 11:if(d="",l="",h=!1,f=!1,p=void 0,v=void 0,this._mlinesCache[t.streamId]=[p,v],t.virtual?(d="".concat(this._mid++),h=!0):r.multiChatMode?(d="".concat(this._mid++),l="".concat(this._mid++),f=!0):(h=!0,f=!0,d="".concat(this._mid++),l="".concat(this._mid++)),d&&(p=i(i({},this._aRecvonlyOfferTpl),{},{mid:d})),h&&(this._mlinesCache[t.streamId][0]=p,_={track:"audio",init:{direction:"recvonly"}}),l&&(v=i(i({},this._vRecvonlyOfferTpl),{},{mid:l})),f&&(this._mlinesCache[t.streamId][1]=v,m={track:"video",init:{direction:"recvonly"}}),y=jG(this._offerSession,p,v),g=void 0,r.multiChatMode||t.virtual||!this._aSendonlyAnswerTpl||!this._aSendonlyAnswerTpl){e.next=34;break}return g=UG(this._nextSsrc),this._nextSsrc=g.next,b=i(i(i({},this._aSendonlyAnswerTpl),this._answerIce),{},{mid:d,msid:"".concat(t.streamId," ").concat(t.streamId,"-audio"),ssrcs:VG(t.streamId,"audio",g.audio)}),E=i(i(i({},this._vSendonlyAnswerTpl),this._answerIce),{},{mid:l,msid:"".concat(t.streamId," ").concat(t.streamId,"-video")},FG(t.streamId,g,{flexfec:this._enableSubFlexfec})),k=new Promise((function(e){R._sdpQueue.enqueue({action:Zz.subscribe,streamId:t.streamId,audioMid:d,videoMid:l,audioTransceiverInit:_,videoTransceiverInit:m,signalingAck:{sdp:Jj.write(i(i({},R._answerSession),{},{media:[b,E]})),sequenceId:t.sequenceId?++t.sequenceId:0},stream:t,sdp:y,onSuccess:function(){rX.print("subscribe()","sub success"),e(0)}})})),e.next=33,k;case 33:null===(S=g)||void 0===S||delete S.next;case 34:return(T=null===(n=p)||void 0===n?void 0:n.rtp.find((function(e){return"opus"===e.codec})))&&null!==(a=p)&&void 0!==a&&a.fmtp&&(A=null===(I=p)||void 0===I?void 0:I.fmtp.find((function(e){return e.payload===T.payload})))&&this._context&&(A.config+=";stereo=1;sprop-stereo=1"),e.abrupt("return",{partialSdp:y,audioMid:d,videoMid:l,type:s,semantics:c,audioTransceiverInit:_,videoTransceiverInit:m,allSsrc:g});case 37:case"end":return e.stop()}}),e,this)}))),function(e,t){return v.apply(this,arguments)})},{key:"handleAck",value:(d=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(rX.print("handleAck()","item: %o",t),!t.generatorSsrc){e.next=4;break}return rX.print("already set remote"),e.abrupt("return","");case 4:return e.abrupt("return",this._sdpQueue.enqueue(t));case 5:case"end":return e.stop()}}),e,this)}))),function(e){return d.apply(this,arguments)})},{key:"dequeue",value:(s=c(o().mark((function e(){var r,n,a,s,c,u,d,l,h,f,p,v,_=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._queueBusy=!0,r=this._sdpQueue.dequeue(),rX.print("dequeue()","ret: %o",r),r){e.next=6;break}return this._queueBusy=!1,e.abrupt("return");case 6:if(e.prev=6,n=r.items,a=r.sdpStrategy,s=[],c=[],u=[],a!==Qz.ADD){e.next=15;break}return e.delegateYield(o().mark((function e(){var r,a;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:delete(r=i({},_._answerIce)).candidates,d=!1,l=!1,e.prev=4,f=t(n);case 6:return e.next=8,f.next();case 8:if(!(d=!(p=e.sent).done)){e.next=16;break}if(a=p.value,"break"!==function(){var e=a.audioMid,t=a.videoMid,n=a.action,o=a.audioTransceiverInit,d=a.videoTransceiverInit,l=a.signalingAck,h=a.stream,f=h instanceof Yz;if(a.onSuccess&&u.push(a.onSuccess),f&&(null==l?void 0:l.sequenceId)<h.sequenceId)return"break";var p={},v={},m=Jj.parse(l.sdp);Array.isArray(m.media)&&m.media.sort((function(e,t){var r;return null==e||null===(r=e.type)||void 0===r?void 0:r.localeCompare(null==t?void 0:t.type)})).forEach((function(n){"audio"===(n=i(i({},n),r)).type?(p=n).mid=e:(v=n).mid=t}));var y,g=h.streamId;if(n===Zz.publish&&(g=null===(y=h.stream)||void 0===y?void 0:y.id),!_._mlinesCache[g])return"break";var S=E(_._mlinesCache[g],2),b=S[0],k=S[1];if(o&&b){h.audioTransceiver=_._peerConnection.addTransceiver(o.track,o.init),_.monitor.rtcInvokeStatus(JSON.stringify({audioStreamTrack:jP(o.track)}),0,"chromeHandler.addTrack","",0);var T=_._inactiveMlineIndex.shift();T||(T=_._offerMlines.length),_._offerMlines[T]=i({},b),_._answerMlines[T]=p,nX&&h.initAudioEncodedTransform()}if(d&&k){var I;n===Zz.publish&&wP&&(null==d||null===(I=d.init)||void 0===I||delete I.sendEncodings),h.videoTransceiver=_._peerConnection.addTransceiver(d.track,d.init),_.monitor.rtcInvokeStatus(JSON.stringify({videoStreamTrack:jP(d.track)}),0,"chromeHandler.addTrack","",0);var A=_._inactiveMlineIndex.shift();A||(A=_._offerMlines.length),_._offerMlines[A]=i({},k),_._answerMlines[A]=v,nX&&h.initVideoEncodedTransform()}s.push(h.streamId||""),c.push(f?h.userId:"local"),f&&(h.sequenceId=null==l?void 0:l.sequenceId),delete _._mlinesCache[g]}()){e.next=13;break}return e.abrupt("break",16);case 13:d=!1,e.next=6;break;case 16:e.next=22;break;case 18:e.prev=18,e.t0=e.catch(4),l=!0,h=e.t0;case 22:if(e.prev=22,e.prev=23,!d||null==f.return){e.next=27;break}return e.next=27,f.return();case 27:if(e.prev=27,!l){e.next=30;break}throw h;case 30:return e.finish(27);case 31:return e.finish(22);case 32:case"end":return e.stop()}}),e,null,[[4,18,22,32],[23,,27,31]])}))(),"t0",13);case 13:e.next=20;break;case 15:v={},n.forEach((function(e){var t=e.audioMid,r=e.videoMid,n=e.action;v[t]=t,n!==Zz.removetrack&&(v[r]=r),v[t]=t})),this._offerMlines=this._offerMlines.map((function(e,t){return v[e.mid]&&(e=BG(e),_._inactiveMlineIndex.push(t)),e})),this._inactiveMlineIndex.sort((function(e,t){return e-t})),this._answerMlines=this._answerMlines.map((function(e){return v[e.mid]&&(e=BG(e)),e}));case 20:return e.next=22,this.setDescription(s.length?{streamId:s.join(","),streamUserId:c.join(",")}:void 0);case 22:try{u.forEach((function(e){return e()}))}catch(T0){}rX.print("dequeue","loop"),e.next=29;break;case 26:e.prev=26,e.t1=e.catch(6),rX.print("dequeue","unknown error: %o",e.t1);case 29:return e.prev=29,this.dequeue(),e.finish(29);case 32:case"end":return e.stop()}}),e,this,[[6,26,29,32]])}))),function(){return s.apply(this,arguments)})},{key:"setDescription",value:(a=c(o().mark((function e(t){var r,n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return rX.print("setDescription"),this._offerSession.media=this._offerMlines,this._answerSession.media=this._answerMlines,r=[],this._offerMlines.forEach((function(e){"inactive"!==e.direction&&r.push(e.mid)})),this._offerSession.groups&&this._answerSession.groups&&(this._offerSession.groups[0].mids=r.join(" "),this._answerSession.groups[0].mids=r.join(" ")),n=fP(),t&&MB.rtcBeginCreateOffer("local"===t.streamUserId?lB.UP:lB.DOWN,t.streamId,t.streamUserId),e.next=10,this._peerConnection.createOffer();case 10:return t&&MB.rtcCreateOffer(0,"local"===t.streamUserId?hB.UP:hB.DOWN,t.streamId,t.streamUserId,fP()-n),e.next=13,this.setLocalDescription(Jj.write(this._offerSession),t);case 13:return e.next=15,this.setRemoteDescription(Jj.write(this._answerSession),t);case 15:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"getDefaultSdp",value:(n=c(o().mark((function e(){var t,r,n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,PP(!0);case 2:if(t=e.sent){e.next=5;break}throw new hN(dN.NOT_SUPPORTED,"Get offer Error");case 5:return this.createAVMlineOfferTpl(t),r=Jj.parse(t),n=[],r.media=r.media.filter((function(e){return"recvonly"===e.direction&&(Array.isArray(e.ext)&&(e.ext=e.ext.filter((function(e){return"urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id"!==e.uri}))),n.push(e.mid+""),!0)})),r.groups=[{mids:n.join(" "),type:"BUNDLE"}],e.abrupt("return",{sdp:Jj.write(r),semantics:"unified-plan",type:"incroffer"});case 11:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"rollback",value:(r=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:delete this._mlinesCache[t];case 1:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"createAVMlineOfferTpl",value:function(e){var t=this;Jj.parse(e).media.forEach((function(e){"audio"===e.type?"sendonly"===e.direction?t._aSendonlyOfferTpl=e:(Array.isArray(e.ext)&&(e.ext=e.ext.filter((function(e){return"urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id"!==e.uri}))),t._aRecvonlyOfferTpl=e):"video"===e.type&&("sendonly"===e.direction?t._vSendonlyOfferTpl=e:(Array.isArray(e.ext)&&(e.ext=e.ext.filter((function(e){return"urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id"!==e.uri}))),t._vRecvonlyOfferTpl=e))}))}}]),k}(QG),oX=new JL("FirefoxHandler",3),aX=function(e){f(k,e);var t,r,n,a,s,d,v,_,y,S=g(k);function k(){var e;u(this,k);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return h(m(e=S.call.apply(S,[this].concat(r))),"name","firefox"),h(m(e),"_aRecvonlyOfferTpl",void 0),e}return l(k,[{key:"connect",value:(y=c(o().mark((function e(t){var r,n,a,s,c,u,d,l=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return oX.print("connect","invoke connect"),this._offerIce={iceUfrag:null===(r=t.iceParams)||void 0===r?void 0:r.clientIceUfrag,icePwd:null===(n=t.iceParams)||void 0===n?void 0:n.clientIcePwd,iceOptions:"renomination"},e.next=4,GG(t);case 4:return this._answerIce=e.sent,this._peerConnection.addTransceiver("audio",{direction:"recvonly"}),this._peerConnection.addTransceiver("video",{direction:"recvonly"}),e.next=9,this._peerConnection.createOffer();case 9:return a=e.sent,s=Jj.parse(a.sdp),c=E(s.media,1),u=c[0],this._offerIce.fingerprint=s.fingerprint||u.fingerprint,s.media=s.media.map((function(e){return i(i({},e),l._offerIce)})),s.media.map((function(e){var t,r;"video"===e.type&&(e.ext=null===(t=e.ext)||void 0===t?void 0:t.filter((function(e){return-1===e.uri.indexOf("abs-send-time")})),e.rtcpFb=null===(r=e.rtcpFb)||void 0===r?void 0:r.filter((function(e){return"goog-remb"!==e.type})))})),(d=i({},s)).fingerprint=this._answerIce.fingerprint,d.media=d.media.map((function(e){return delete(e=i(i({},e),l._answerIce)).bundleOnly,e.port=9,"application"===e.type?e.sctpmap={sctpmapNumber:5e3,app:"webrtc-datachannel",maxMessageSize:262144}:("audio"===e.type&&(e.msid="ff-stream ff-stream-audio"),e.direction="sendonly"),e})),e.next=20,this.setLocalDescription(Jj.write(s));case 20:return e.next=22,this.setRemoteDescription(Jj.write(d));case 22:return e.next=24,new Promise((function(e,t){l._dataChannel.onopen=function(){oX.print("connect","dataChannel open"),XB("es.dc.open",""),e("")},l._dataChannel.onerror=function(e){MB.rtcSignalingMsgError(e.error.sdpLineNumber,e.error.errorDetail,uB.INVALID_DATA),XB("es.dc.error",""),t(e)},l._dataChannel.onclose=function(e){XB("es.dc.close",""),t(e)},l._peerConnection.addEventListener("connectionstatechange",(function(e){"failed"!==l._peerConnection.iceConnectionState&&"closed"!==l._peerConnection.iceConnectionState&&"failed"!==l._peerConnection.connectionState||t(e)}))}));case 24:return oX.print("connect","dataChannel establish success"),e.abrupt("return",this._dataChannel);case 26:case"end":return e.stop()}}),e,this)}))),function(e){return y.apply(this,arguments)})},{key:"publish",value:(_=c(o().mark((function e(t){var r,n,a,s,c,u,d,l,h,f,v,_,m,y,g=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=b(p(k.prototype),"internalPublish",this).call(this,t),s=a.videoDescriptions,c=a.subVideoDescriptions,u=a.audioTransceiverInit,d=a.videoTransceiverInit,t.audioTransceiver=this._peerConnection.addTransceiver(u.track,u.init),t.videoTransceiver=this._peerConnection.addTransceiver(d.track,d.init),l=fP(),MB.rtcBeginCreateOffer(lB.UP,"",""),e.next=7,this._peerConnection.createOffer();case 7:return h=e.sent,MB.rtcCreateOffer(0,hB.UP,"","",fP()-l),(f=Jj.parse(h.sdp)).media=null===(r=f.media)||void 0===r?void 0:r.map((function(e){return i(i({},e),g._offerIce)})),e.next=13,this.setLocalDescription(Jj.write(f));case 13:return v=t.audioTransceiver.mid,_=t.videoTransceiver.mid,m=null,y=null,f.media=null===(n=f.media)||void 0===n?void 0:n.map((function(e){if("".concat(e.mid)===v){var t,r=null===(t=m=e)||void 0===t?void 0:t.rtp.find((function(e){return"opus"===e.codec}));if(r&&m.fmtp){var n,i=m.fmtp.find((function(e){return e.payload===r.payload}));i&&null!==(n=g._context)&&void 0!==n&&n.audioProfileManager&&(i.config+=g._context.audioProfileManager.getOpusConfigStr())}}else if("".concat(e.mid)===_){var o,a,s,c;null!==(o=g._context)&&void 0!==o&&null!==(a=o.serverConfig)&&void 0!==a&&a.videoCodec&&qG(e,null===(s=g._context)||void 0===s||null===(c=s.serverConfig)||void 0===c?void 0:c.videoCodec),y=e}return e})),this.addBitrateLimit(y,t.videoEncodeConfig[0].maxKbps),e.next=21,this.setLocalDescription(Jj.write(f));case 21:return e.abrupt("return",{partialSdp:jG(f,m,y),audioMid:v,videoMid:_,type:"incroffer",semantics:"unified-plan",videoDescriptions:s,subVideoDescriptions:c,audioTransceiverInit:u,videoTransceiverInit:d});case 22:case"end":return e.stop()}}),e,this)}))),function(e){return _.apply(this,arguments)})},{key:"subscribe",value:(v=c(o().mark((function e(t,r){var n,a,s,c,u,d,l,h,f,p,v,_,m,y,g,S,b,E=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return oX.print("subscribe()"),u="",d="",l=!1,h=!1,f=void 0,p=void 0,t.virtual?l=!0:(r.multiChatMode||(l=!0),h=!0),l&&(t.audioTransceiver=this._peerConnection.addTransceiver("audio",{direction:"recvonly"})),h&&(t.videoTransceiver=this._peerConnection.addTransceiver("video",{direction:"recvonly"})),v=fP(),MB.rtcBeginCreateOffer(lB.UP,t.streamId,t.userId),e.next=14,this._peerConnection.createOffer();case 14:return _=e.sent,MB.rtcCreateOffer(0,hB.UP,t.streamId,t.userId,fP()-v),(m=Jj.parse(_.sdp)).media=null===(n=m.media)||void 0===n?void 0:n.map((function(e){return i(i({},e),E._offerIce)})),m.media.map((function(e){var t,r;"video"===e.type&&(e.ext=null===(t=e.ext)||void 0===t?void 0:t.filter((function(e){return-1===e.uri.indexOf("abs-send-time")})),e.rtcpFb=null===(r=e.rtcpFb)||void 0===r?void 0:r.filter((function(e){return"goog-remb"!==e.type})))})),e.next=21,this.setLocalDescription(Jj.write(m),{streamId:t.streamId||"",streamUserId:t.userId});case 21:if(u=null===(a=t.audioTransceiver)||void 0===a?void 0:a.mid,d=null===(s=t.videoTransceiver)||void 0===s?void 0:s.mid,null===(c=m.media)||void 0===c||c.forEach((function(e){"".concat(e.mid)===u?f=e:"".concat(e.mid)===d&&(p=e)})),u&&f||(u="audio_".concat(d),f=i(i({},this._aRecvonlyOfferTpl),{},{mid:u})),t.audioMid=u,t.videoMid=d,y=void 0,r.multiChatMode||t.virtual||!this._aSendonlyAnswerTpl||!this._aSendonlyAnswerTpl){e.next=36;break}return y=UG(this._nextSsrc),this._nextSsrc=y.next,S=i(i(i({},this._aSendonlyAnswerTpl),this._answerIce),{},{mid:u,msid:"".concat(t.streamId," ").concat(t.streamId,"-audio"),ssrcs:VG(t.streamId,"audio",y.audio)}),b=i(i(i({},this._vSendonlyAnswerTpl),this._answerIce),{},{mid:d,msid:"".concat(t.streamId," ").concat(t.streamId,"-video")},FG(t.streamId,y,{flexfec:this._enableSubFlexfec})),e.next=35,this._internalSetRemoteDescription([S,b],t);case 35:null===(g=y)||void 0===g||delete g.next;case 36:return e.abrupt("return",{partialSdp:jG(m,f,p),audioMid:u,videoMid:d,type:"incroffer",semantics:"unified-plan",audioTransceiverInit:t.audioTransceiver?{track:"audio",init:{direction:"recvonly"}}:void 0,videoTransceiverInit:t.videoTransceiver?{track:"video",init:{direction:"recvonly"}}:void 0,allSsrc:y});case 37:case"end":return e.stop()}}),e,this)}))),function(e,t){return v.apply(this,arguments)})},{key:"handleAck",value:(d=c(o().mark((function e(t){var r,n,i,a;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.signalingAck,n=t.stream,(i=t.action)!==Zz.unpublish&&i!==Zz.unsubscribe&&i!==Zz.removetrack){e.next=5;break}return e.next=4,this.close(n);case 4:return e.abrupt("return",n.streamId||"");case 5:if(!t.generatorSsrc){e.next=8;break}return oX.print("already set remote"),e.abrupt("return","");case 8:return a=Jj.parse(null==r?void 0:r.sdp),e.next=11,this._internalSetRemoteDescription(a.media,n);case 11:return e.abrupt("return","");case 12:case"end":return e.stop()}}),e,this)}))),function(e){return d.apply(this,arguments)})},{key:"_internalSetRemoteDescription",value:(s=c(o().mark((function e(t,r){var n,a,s,c,u,d,l=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s={},(c=Jj.parse(null===(n=this._peerConnection.remoteDescription)||void 0===n?void 0:n.sdp)).media.forEach((function(e){void 0!==e.mid&&(s[e.mid]=e)})),t.forEach((function(e){"audio"===(e=i(i({},e),l._answerIce)).type&&(r.audioMid?(e.mid=r.audioMid,s[r.audioMid]=e):s[e.mid]=e),"video"===e.type&&(r.videoMid?(e.mid=r.videoMid,s[r.videoMid]=e):s[e.mid]=e)})),u=Jj.parse(null===(a=this._peerConnection.localDescription)||void 0===a?void 0:a.sdp),d=u.media.map((function(e){var t=s[e.mid];return"inactive"===e.direction?e:t})),c.groups=u.groups,c.media=d,c.media.map((function(e){var t,r;"video"===e.type&&(e.ext=null===(t=e.ext)||void 0===t?void 0:t.filter((function(e){return-1===e.uri.indexOf("abs-send-time")})),e.rtcpFb=null===(r=e.rtcpFb)||void 0===r?void 0:r.filter((function(e){return"goog-remb"!==e.type})))})),e.next=11,this.setRemoteDescription(Jj.write(c));case 11:case"end":return e.stop()}}),e,this)}))),function(e,t){return s.apply(this,arguments)})},{key:"getDefaultSdp",value:(a=c(o().mark((function e(){var t,r,n,i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=Jj.parse(null===(t=this._peerConnection.localDescription)||void 0===t?void 0:t.sdp),this.createAVMlineOfferTpl(null===(r=this._peerConnection.localDescription)||void 0===r?void 0:r.sdp),i=[],n.media=n.media.filter((function(e){return"recvonly"===e.direction&&(e.mid=e.mid+1,i.push(e.mid+""),!0)})),n.groups=[{mids:i.join(" "),type:"BUNDLE"}],e.abrupt("return",{sdp:Jj.write(n),semantics:"unified-plan",type:"incroffer"});case 6:case"end":return e.stop()}}),e,this)}))),function(){return a.apply(this,arguments)})},{key:"rollback",value:(n=c(o().mark((function e(t,r,n){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return oX.print("rollback()"),e.abrupt("return",this.close(r));case 2:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return n.apply(this,arguments)})},{key:"close",value:(r=c(o().mark((function e(t,r){var n,a,s,c,u,d,l,h=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return oX.print("close()"),a={},t.audioTransceiver&&t.audioMid&&(t.audioTransceiver.stop(),a[t.audioMid]=t.audioMid),t.videoTransceiver&&t.videoMid&&!r&&(t.videoTransceiver.stop(),a[t.videoMid]=t.videoMid),s=[],e.next=7,this._peerConnection.createOffer();case 7:return c=e.sent,(u=Jj.parse(null==c?void 0:c.sdp)).media=u.media.map((function(e){return a[e.mid]&&(e=BG(e)),"inactive"!==e.direction&&s.push(e.mid),i(i({},e),h._offerIce)})),d=Jj.parse(null===(n=this._peerConnection.remoteDescription)||void 0===n?void 0:n.sdp),l={},d.media.forEach((function(e){void 0!==e.mid&&(l[e.mid]=e)})),d.media=u.media.map((function(e){return"inactive"===e.direction?e:l[e.mid]})),u.groups&&d.groups&&(u.groups[0].mids=s.join(" "),d.groups[0].mids=s.join(" ")),e.next=17,this.setLocalDescription(Jj.write(u));case 17:return e.next=19,this.setRemoteDescription(Jj.write(d));case 19:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"setCurrentDescription",value:(t=c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._peerConnection.createOffer();case 2:if(!this._peerConnection.localDescription||!this._peerConnection.remoteDescription){e.next=7;break}return e.next=5,this._peerConnection.setLocalDescription(this._peerConnection.localDescription);case 5:return e.next=7,this._peerConnection.setRemoteDescription(this._peerConnection.remoteDescription);case 7:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"createAVMlineOfferTpl",value:function(e){var t=this;Jj.parse(e).media.forEach((function(e){"audio"===e.type&&(t._aRecvonlyOfferTpl=e)}))}}]),k}(QG),sX=function(e,t){return gP?new aX(e,t):new iX(e,t)},cX=new JL("Locker",2),uX=1,dX=function(){function e(t){u(this,e),h(this,"lockingPromise",Promise.resolve()),h(this,"locks",0),h(this,"name",""),h(this,"lockId",void 0),this.lockId=uX++,t&&(this.name=t),cX.print("[lock-".concat(this.name,"-").concat(this.lockId,"] is created."))}return l(e,[{key:"isLocked",get:function(){return this.locks>0}},{key:"lock",value:function(){var e,t=this;this.locks+=1,cX.print("[lock-".concat(this.name,"-").concat(this.lockId,"] locked, current queue ").concat(this.locks,"."));var r=new Promise((function(r){e=function(){t.locks-=1,cX.print("[lock-".concat(t.name,"-").concat(t.lockId,"] unlocked, current queue ").concat(t.locks,".")),r()}})),n=this.lockingPromise.then((function(){return e}));return this.lockingPromise=this.lockingPromise.then((function(){return r})),n}}]),e}(),lX=(h(jz={},Y.communication,[0]),h(jz,Y.chat,[0]),h(jz,Y.chatRoom,[1,"IES_chatroom"]),h(jz,Y.coHost,[1,"IES_PK"]),h(jz,Y.meeting,[16]),h(jz,Y.classRoom,[0]),jz),hX=Object.defineProperty,fX=Object.getOwnPropertyDescriptor,pX=function(e,t,r,n){for(var i,o=n>1?void 0:n?fX(t,r):t,a=e.length-1;a>=0;a--)(i=e[a])&&(o=(n?i(t,r,o):i(o))||o);return n&&o&&hX(t,r,o),o},vX=new JL("MediaServerClient",2),_X=6e4,mX=function(e){return e.DISCONNECTED="disconnected",e.DISCONNECTING="disconnecting",e.CONNECTED="connected",e.CONNECTING="connecting",e}(mX||{}),yX=function(e,t){vX.print(e,"userId: %o, subAudio: %o, subVideo: %o, audioMid: %o, videoMid: %o, sequenceId: %o",t.userId,t.subAudio,t.subVideo,t.audioMid,t.videoMid,t.sequenceId)},gX=function(e){f(D,e);var t,r,n,a,s,d,p,v,_,y,S,b,k,T,I,A,R,w,C,O,x=g(D);function D(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:MB;return u(this,D),h(m(t=x.call(this)),"_token",void 0),h(m(t),"_appId",void 0),h(m(t),"_roomId",void 0),h(m(t),"_roomAttributes",void 0),h(m(t),"_clientId",void 0),h(m(t),"_businessId",void 0),h(m(t),"_userInfo",void 0),h(m(t),"_useCloudProxy",void 0),h(m(t),"_expectedIDC",void 0),h(m(t),"_authorization",void 0),h(m(t),"_sessionId",void 0),h(m(t),"_iceConfigRequestManager",void 0),h(m(t),"_ontrackCallbackMap",new Map),h(m(t),"_subResolves",{}),h(m(t),"supportConcurrent",!1),h(m(t),"_handler",void 0),h(m(t),"_pubSubLock",void 0),h(m(t),"_joinLeaveLock",void 0),h(m(t),"_state",void 0),h(m(t),"_dataChannelSignal",void 0),h(m(t),"_subConfig",{}),h(m(t),"monitor",void 0),h(m(t),"_roomProfile",Y.communication),h(m(t),"_context",void 0),h(m(t),"_subStreamQueue",{}),t.monitor=r,t._pubSubLock=new dX("pubSubLock"),t._joinLeaveLock=new dX("joinLeaveLock"),t._state="disconnected",t._roomAttributes={multiChatMode:!1,bigRoomMode:!1},t._context=e,t.on("SUB_END",(function(e){return t._handleSubStreamQueue(e)})),t}return l(D,[{key:"_addHandlerEvents",value:function(){var e,t=this;null===(e=this._handler)||void 0===e||e.once("disconnect",(function(){vX.print("emit ABNORMAL_DISCONNECTION ice"),t.safeEmit(_j.ABNORMAL_DISCONNECTION)}))}},{key:"_addSignalEventHandler",value:function(){var e,t=this;[pj.ON_ADD_STREAM,pj.ON_ADD_STREAM_LIST,pj.ON_REMOVE_STREAM,pj.ON_REMOVE_STREAM_LIST,pj.USER_CONNECTION,pj.USER_CONNECTION_LIST,pj.USER_DISCONNECTION,pj.USER_DISCONNECTION_LIST,pj.ON_UPDATE_STREAM_ATTRIBUTES,pj.ON_UPDATE_ROOM_ATTRIBUTES,pj.ON_PUSH_TRACK,pj.NODE_CHANGE,pj.ON_CUSTOM_MESSAGE,pj.USER_MESSAGE_RECEIVED,pj.USER_BINARY_MESSAGE_RECEIVED,pj.POST_PROCESSING_MESSAGE,pj.ON_USER_TOKEN_WILL_EXPIRE,pj.STREAM_CONTROL_MESSAGE,pj.ON_SCENE_CONFIG,pj.ON_UPDATE_USER_ATTRIBUTES,pj.ON_SPEAKER_CHANGE,vj.RSCP,vj.RTT,pj.ON_STREAM_FAILED].forEach((function(e){var r;null===(r=t._dataChannelSignal)||void 0===r||r.on(e,(function(r){t.safeEmit(e,r)}))})),null===(e=this._dataChannelSignal)||void 0===e||e.once("close",(function(){vX.print("emit ABNORMAL_DISCONNECTION datachannel"),t.safeEmit(_j.ABNORMAL_DISCONNECTION)}))}},{key:"_removeSignalEventHandler",value:function(){var e,t;null===(e=this._dataChannelSignal)||void 0===e||e.removeAllListeners(),null===(t=this._handler)||void 0===t||t.removeAllListeners()}},{key:"connectionState",get:function(){return this._state},set:function(e){this._state!==e&&(this.safeEmit(_j.ON_CONNECTION_STATE_CHANGE,{prev:this._state,next:e}),this._state=e)}},{key:"connect",value:(O=c(o().mark((function e(t){var r,n,i,a,s,c,u,d,l=this,h=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=h.length>1&&void 0!==h[1]?h[1]:"",n=h.length>2&&void 0!==h[2]?h[2]:"",i=h.length>3&&void 0!==h[3]?h[3]:{},this.connectionState="connecting",this._appId=t,this._handler&&(this._removeSignalEventHandler(),this._handler.destroy()),!i.node){e.next=11;break}a=[i.node],XB("es.join.nodeChange",i),e.next=20;break;case 11:return Promise.resolve().then((function(){return l.emit("onGetIceConfigHook")})),this._iceConfigRequestManager=new xj,e.next=15,null===(s=this._iceConfigRequestManager)||void 0===s?void 0:s.getAccessNode(t,r,n,ej.getDeviceId(),null==i?void 0:i.reason,null==i?void 0:i.feedbackNode,this._useCloudProxy,this._expectedIDC);case 15:if(a=e.sent){e.next=19;break}throw XB("es.join.getNodeFailed",""),new hN(dN.ICE_SERVER_WRONG,"get ICE config failed");case 19:XB("es.join.getNodeSuccess",a);case 20:return Promise.resolve().then((function(){return l.emit("onEstablishConnectionHook")})),e.prev=21,u=!1,d=a.map((function(e){var t=sX(l.monitor,l._context);return t.connect(e).then((function(r){u?t.destroy():(u=!0,c=r,l.safeEmit("prevIceNode",e),l._handler=t,l.supportConcurrent="chrome"===t.name,l._addHandlerEvents())})).catch((function(){t.destroy()}))})),e.next=26,MP(d);case 26:vX.print("join","establish peerConnection success"),e.next=33;break;case 29:throw e.prev=29,e.t0=e.catch(21),this.connectionState="disconnected",new hN(dN.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed",e.t0);case 33:if(!c){e.next=39;break}this._dataChannelSignal=new wj(c),this._addSignalEventHandler(),this._dataChannelSignal.sendPingSignaling(),e.next=41;break;case 39:throw this.connectionState="disconnected",new hN(dN.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed");case 41:case"end":return e.stop()}}),e,this,[[21,29]])}))),function(e){return O.apply(this,arguments)})},{key:"join",value:(C=c(o().mark((function e(t){var r,n,i,a,s,c,u,d,l,h,f,p,v,_,m,y,g,S,b,E,k,T,I,A,R=this,w=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=w.length>1&&void 0!==w[1]?w[1]:{},i=w.length>2&&void 0!==w[2]&&w[2],a=w.length>3?w[3]:void 0,vX.print("join()","info: %o, params: %o, reconnect: %o, controlMessage: %o",t,n,i,a),this._appId=t.appId,this._token=t.token,this._roomId=t.roomId,this._clientId=t.userInfo.userId,this._businessId=t.userInfo.businessId,this._userInfo=t.userInfo,this._useCloudProxy=t.useCloudProxy,this._expectedIDC=t.expectedIDC,this._roomProfile=t.roomProfile,this._sessionId=n.sessionId,e.next=16,this.connect(this._appId,this._roomId,this._clientId,n);case 16:return e.t0=_P.token2auth(this._appId,this._roomId,this._clientId,this._token),e.t1=this._sessionId||"",e.t2=Date.now(),e.t3=a,e.t4={extra_info:this._userInfo.extraInfo,role:this._userInfo.role},e.next=23,null===(r=this._handler)||void 0===r?void 0:r.getDefaultSdp();case 23:return e.t5=e.sent,e.next=26,qj();case 26:return e.t6=e.sent,e.t7=window.navigator.userAgent,e.t8=oj.VERSION,e.t9=ej.getDeviceId(),e.t10=this._appId,e.t11=this._roomId,e.t12=this._clientId,e.t13=this._businessId,e.t14=this._useCloudProxy,e.t15=lX[this._roomProfile]?lX[this._roomProfile][0]+"":"0",e.t16={supportedCodecs:e.t6,deviceType:"web",userAgent:e.t7,sdkVersion:e.t8,deviceId:e.t9,appId:e.t10,roomId:e.t11,userId:e.t12,businessId:e.t13,enableCloudProxy:e.t14,channelProfile:e.t15},e.t17={supportTokenExpireCallBack:!0,enableSceneConfigV2:!0,enableUnBundleMode:!0,enableAudioMux:!0,enableBigRoomMode:!0,needNegotiateSDP:!0},s={Authorization:e.t0,sessionId:e.t1,timestamp:e.t2,controlMessage:e.t3,userAttributes:e.t4,sdpInfo:e.t5,params:e.t16,options:e.t17},Promise.resolve().then((function(){return R.emit("onSendingJoinMessageHook")})),e.prev=40,_=i?"reconnected":"joinRoom",e.next=44,this._dataChannelSignal.sendSignaling(_,s);case 44:return m=e.sent,vX.print("join","send join message success"),this._authorization=s.Authorization,this.connectionState="connected",this._context&&(this._context.serverConfig={videoCodec:(null===(y=m.config)||void 0===y||null===(g=y.engine_WEB)||void 0===g?void 0:g.video_codec)||"H264",audioRed:!(null===(S=m.config)||void 0===S||null===(b=S.engine_WEB)||void 0===b||!b.pub_audio_red),muteReplaceUnsub:!(null===(E=m.config)||void 0===E||!E.mute_replace_unsub),simulcastOnDemand:!(!1===(null===(k=m.config)||void 0===k||null===(T=k.engine_VPM)||void 0===T||null===(I=T.ondemand)||void 0===I?void 0:I.enable))}),Vz.audioStallConfig=null===(c=m.config)||void 0===c?void 0:c.engine_WEB,null===(u=this._context)||void 0===u||null===(d=u.audioProfileManager)||void 0===d||d.updateEngineBAC(null===(l=m.config)||void 0===l?void 0:l.engine_BAC),null===(h=this._context)||void 0===h||null===(f=h.audioProfileManager)||void 0===f||f.updateEngineANM(null===(p=m.config)||void 0===p?void 0:p.engine_ANM),null!=m&&null!==(v=m.relayMessage)&&void 0!==v&&v.sdp&&(null===(A=this._handler)||void 0===A||A.createAVMlineAnswerTpl(m.relayMessage.sdp)),e.abrupt("return",m);case 56:if(e.prev=56,e.t18=e.catch(40),this.connectionState="disconnected",!((null===e.t18||void 0===e.t18?void 0:e.t18.code)>=700&&(null===e.t18||void 0===e.t18?void 0:e.t18.code)<800)){e.next=61;break}throw new hN(dN.INVALID_TOKEN,(null===e.t18||void 0===e.t18?void 0:e.t18.message)||"Invalid token");case 61:if(200===(null===e.t18||void 0===e.t18?void 0:e.t18.code)){e.next=63;break}throw new hN(dN.JOIN_ROOM_FAILED,(null===e.t18||void 0===e.t18?void 0:e.t18.message)||"Join room failed");case 63:case"end":return e.stop()}}),e,this,[[40,56]])}))),function(e){return C.apply(this,arguments)})},{key:"publish",value:(w=c(o().mark((function e(t){var r,n,a,s,c,u,d,l,h,f,p,v,_,m,y,g,S,b=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return vX.print("publish()","localStream: %o",t),r=t.videoTrack,n=t.audioTrack,a=fP(),s="",c="",e.prev=6,e.next=9,null===(u=this._handler)||void 0===u?void 0:u.publish(t);case 9:if(_=e.sent){e.next=12;break}throw new hN(dN.ADD_TRANSCEIVER_FAILED,"add transceiver failed");case 12:return s=_.audioMid,c=_.videoMid,t.pubAttributes={localaudio:!!n,localvideo:!!r,videostream:t.pubVideo,audiostream:t.pubAudio,extvideo:!!(r instanceof ez),extaudio:!!(n instanceof tz)},m={attributes:i({videoDescriptions:_.videoDescriptions},t.pubAttributes),audio:!0,video:!0,screen:t.isScreen,audioMid:s,videoMid:c,sdpInfo:{msid:t.stream.id,type:_.type,sdp:_.partialSdp,semantics:_.semantics}},t.enableSimulcast&&null!==(d=this._context)&&void 0!==d&&null!==(l=d.serverConfig)&&void 0!==l&&l.simulcastOnDemand&&null!==(h=_.subVideoDescriptions)&&void 0!==h&&h.length&&(m.attributes.subVideoDescriptions=_.subVideoDescriptions),e.next=19,null===(f=this._dataChannelSignal)||void 0===f?void 0:f.sendSignaling("publish",m);case 19:if(200===(null==(y=e.sent)?void 0:y.code)){e.next=22;break}throw new hN(dN.PUBLISH_FAILED,(null==y?void 0:y.message)||"publish failed");case 22:if(MB.rtcRecvAnswer(0,vB.INCRANSWER,(null==y||null===(p=y.relayMessage)||void 0===p?void 0:p.sequenceId)||0,null==y||null===(v=y.relayMessage)||void 0===v?void 0:v.sdp,_B.UP,"",""),g=new Promise((function(e,r){var n,i,o;null===(n=b._handler)||void 0===n||n.handleAck({action:Zz.publish,streamId:y.streamId,audioMid:s,videoMid:c,audioTransceiverInit:null==_?void 0:_.audioTransceiverInit,videoTransceiverInit:null==_?void 0:_.videoTransceiverInit,signalingAck:{sdp:null==y||null===(i=y.relayMessage)||void 0===i?void 0:i.sdp,sequenceId:null==y||null===(o=y.relayMessage)||void 0===o?void 0:o.sequenceId},sdp:_.sdp,stream:t,onSuccess:function(){vX.print("publish()","publish success"),e(0)}})})),e.t0=!gP,!e.t0){e.next=28;break}return e.next=28,g;case 28:return t.streamId=y.streamId,t.videoMid=c,t.audioMid=s,t.subVideoDescriptions=_.subVideoDescriptions,this.monitor.rtcPublishStat(mB.SUCCESS,yB.W_0,a,gB.UNKNOWN),t.statsReport.setLocalStreamStatsEvtInterval(this,this._handler,this.monitor),e.abrupt("return");case 37:return e.prev=37,e.t1=e.catch(6),e.t1 instanceof Error&&this.monitor.rtcPublishStat(mB.FAIL,yB.W_0,a,e.t1.message),e.next=42,null===(S=this._handler)||void 0===S?void 0:S.rollback(t.stream.id,t);case 42:throw e.t1;case 43:case"end":return e.stop()}}),e,this,[[6,37]])}))),function(e){return w.apply(this,arguments)})},{key:"updatePubTrack",value:(R=c(o().mark((function e(t){var r,n,i,a,s,c,u,d,l,h,f,p,v,_,m,y,g,S,b,k,T,I,A,R,w,C,O,x,D,N,P,M;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:vX.print("updatePubTrack()","localStream: %o",t),i=t.videoTrack,a=t.audioTrack,s=t.pubAudio,c=t.pubVideo,u=null==a?void 0:a.getTrack("preprocessing"),d=null==i?void 0:i.getTrack("preprocessing"),c&&d?null===(l=t.videoTransceiver)||void 0===l||l.sender.replaceTrack(d):null===(h=t.videoTransceiver)||void 0===h||h.sender.replaceTrack(null),wP||null===(f=this._handler)||void 0===f||f.updateScaleResolutionDownBy(t),null===(r=this._handler)||void 0===r||r.updateMaxBitrate(t),s&&u?(v=a.mixType,(_=a.mixedAudioTrack)&&v!==re.PLAYOUT&&!0===u.enabled&&(u=_),null===(p=t.audioTransceiver)||void 0===p||p.sender.replaceTrack(u)):(null===(m=t.audioTransceiver)||void 0===m||m.sender.replaceTrack(null),this.monitor.rtcInvokeStatus("null",0,"MediaClient.updatePubTrack(audio)","",0));try{this.monitor.rtcInvokeStatus(JSON.stringify({audioStreamTrack:jP(u),videoStreamTrack:jP(d)}),0,"MediaClient.updatePubTrack","",0)}catch(T0){}for(y={localaudio:!!a,localvideo:!!i,videostream:c,audiostream:s,extvideo:!!(i instanceof ez),extaudio:!!(a instanceof tz)},g={},S=0,b=Object.entries(y);S<b.length;S++)k=E(b[S],2),T=k[0],(I=k[1])!==Reflect.get(t.pubAttributes,T)&&Reflect.set(g,T,I);if(Object.keys(g).length){e.next=14;break}return e.abrupt("return");case 14:return t.observer&&(A=t.observer,R=g.audiostream,w=g.videostream,C=g.localaudio,O=g.localvideo,x=g.extaudio,D=g.extvideo,void 0!==O?void 0!==D?A.setPushVideo(D):A.setEnableVideo(O):void 0!==w&&A.setUnmuteVideo(w),void 0!==C?void 0!==x?A.setPushAudio(x):A.setEnableAudio(C):void 0!==R&&A.setUnmuteAudio(R)),t.pubAttributes=y,N={roomId:this._roomId,streamId:t.streamId,attributes:g},e.next=19,null===(n=this._dataChannelSignal)||void 0===n?void 0:n.sendSignaling("updateStreamAttributes",N);case 19:if(200===(null==(P=e.sent)?void 0:P.code)){e.next=22;break}throw new hN(dN.UPDATE_TRACK_FAILED,(null==P?void 0:P.message)||"update track failed");case 22:if(!gP){e.next=25;break}return e.next=25,null===(M=this._handler)||void 0===M?void 0:M.setCurrentDescription();case 25:case"end":return e.stop()}}),e,this)}))),function(e){return R.apply(this,arguments)})},{key:"updateToken",value:(A=c(o().mark((function e(t){var r,n,i,a,s;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(vX.print("updateToken()","newToken: %o",t),this._token=t,this._appId&&null!==(r=this._userInfo)&&void 0!==r&&r.userId&&this._roomId){e.next=4;break}return e.abrupt("return");case 4:return i={roomId:this._roomId,userId:null===(n=this._userInfo)||void 0===n?void 0:n.userId,appId:this._appId,token:"Bearer ".concat(t)},e.prev=5,e.next=8,null===(a=this._dataChannelSignal)||void 0===a?void 0:a.sendSignaling("updateToken",i);case 8:if(200===(null==(s=e.sent)?void 0:s.code)){e.next=11;break}throw new hN(dN.UPDATE_TOKEN_WITH_INVALID_TOKEN,"invoke updateToken with an invalid token");case 11:e.next=16;break;case 13:throw e.prev=13,e.t0=e.catch(5),new hN(dN.UPDATE_TOKEN_WITH_INVALID_TOKEN,"invoke updateToken with an invalid token");case 16:case"end":return e.stop()}}),e,this,[[5,13]])}))),function(e){return A.apply(this,arguments)})},{key:"unpublish",value:(I=c(o().mark((function e(t){var r,n,i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return vX.print("unpublish()","localStream: %o",t),i={roomId:this._roomId,initStreamId:t.initStreamId,streamId:t.streamId},null===(r=this._dataChannelSignal)||void 0===r||r.sendSignaling("unpublish",i),e.next=5,null===(n=this._handler)||void 0===n?void 0:n.handleAck({action:Zz.unpublish,audioMid:t.audioMid,videoMid:t.videoMid,stream:t,streamId:t.streamId});case 5:t.statsReport.unpublish();case 6:case"end":return e.stop()}}),e,this)}))),function(e){return I.apply(this,arguments)})},{key:"subscribe",value:(T=c(o().mark((function e(t,r,n){var i=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise(function(){var e=c(o().mark((function e(a,s){var c,u,d,l,f,p,v,_,m,y,g,S,b,E,k,T,I,A,R,w,C,O,x,D,N,P,M;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.streamState!==qz.SUB_ED){e.next=2;break}return e.abrupt("return",i._updateSubTrack(t,r,Xz.SUB).then(a,s));case 2:if(t.streamState!==qz.SUB_ING){e.next=7;break}return i._subStreamQueue[t.streamId]||(i._subStreamQueue[t.streamId]=[]),vX.print("_subStreamQueue","streamId: %o, enqueue",t.streamId),i._subStreamQueue[t.streamId].push({fn:i.subscribe,args:[t,r,n],resolve:a,reject:s}),e.abrupt("return");case 7:if(vX.print("subscribe()","mediaType: %o",r),yX("subscribe()",t),t.streamState=qz.SUB_ING,u=!1,d=!1,UP(r)&&(d=!0),VP(r)&&(u=!0),u||!i.multiChatMode()){e.next=17;break}return t.streamState=qz.INIT,i.emit("SUB_END",t.streamId),e.abrupt("return",a(null));case 17:return l=fP(),f=t.subVideo,p=[],v=!i.multiChatMode(),i._subResolves[t.streamId]||(i._subResolves[t.streamId]=[]),p.push(new Promise((function(e,r){i._subResolves[t.streamId].push(e);var n=setTimeout((function(){return r(new hN(dN.TIME_OUT,"wait video timeout for userId: ".concat(t.userId)))}),_X);t.on("ontrack",(function r(i){"video"===i.mediaType&&(vX.print("remoteStream ".concat(t.userId," received video track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),v&&p.push(new Promise((function(e,r){i._subResolves[t.streamId].push(e);var n=setTimeout((function(){return r(new hN(dN.TIME_OUT,"wait audio timeout for userId: ".concat(t.userId)))}),_X);t.on("ontrack",(function r(i){"audio"===i.mediaType&&(vX.print("remoteStream ".concat(t.userId," received audio track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),_=function(e){t.ontrack(e)},null===(c=i._handler)||void 0===c||c.on("ontrack",_),i._ontrackCallbackMap.set(t,_),e.prev=27,e.next=30,null===(m=i._handler)||void 0===m?void 0:m.subscribe(t,{multiChatMode:i.multiChatMode()});case 30:if(I=e.sent){e.next=33;break}throw new hN(dN.ADD_TRANSCEIVER_FAILED,"add transceiver failed");case 33:return A=I.audioMid,R=I.videoMid,t.subVideo=u,w={spatialLayer:(null==n?void 0:n.spatialLayer)||0,temporalLayer:0,spatialSubLayer:(null==n?void 0:n.spatialSubLayer)||-1},C={audio:!i.multiChatMode(),video:!0,data:!0,screen:t.isScreen,browser:"chrome-stable",videoMid:R,audioMid:A,sdpInfo:{sdp:null==I?void 0:I.partialSdp,semantics:null==I?void 0:I.semantics,type:null==I?void 0:I.type},streamUserId:t.userId,streamId:t.streamId,config:{enableMediaType:{audio:!!i.multiChatMode()||d,video:u},qualityLayer:w},extra:{enableSendRTT:!0}},null!=I&&I.allSsrc&&(C.extra.subscribeSSRC=I.allSsrc),e.next=41,null===(y=i._dataChannelSignal)||void 0===y?void 0:y.sendSignaling("subscribe",C);case 41:if(200===(null==(O=e.sent)?void 0:O.code)){e.next=44;break}throw new hN(dN.SUBSCRIBE_FAILED,(null==O?void 0:O.message)||"subscribe failed");case 44:return x=null==O?void 0:O.relayMessage,D=x.audioMid,N=x.videoMid,h(g={},A,D),h(g,R,N),P=g,vX.print("sub midmap",t.userId,P),t.videoMid=R,t.audioMid=A,t.subMediaType=r,t.streamState=qz.SUB_ED,t.subLayer=w,MB.rtcRecvAnswer(0,vB.INCRANSWER,(null==O||null===(S=O.relayMessage)||void 0===S?void 0:S.sequenceId)||0,null==O||null===(b=O.relayMessage)||void 0===b?void 0:b.sdp,_B.DOWN,t.streamId,t.userId),e.next=55,null===(E=i._handler)||void 0===E?void 0:E.handleAck({action:Zz.subscribe,streamId:t.streamId,audioMid:A,videoMid:R,audioTransceiverInit:null==I?void 0:I.audioTransceiverInit,videoTransceiverInit:null==I?void 0:I.videoTransceiverInit,signalingAck:{sdp:null==O||null===(k=O.relayMessage)||void 0===k?void 0:k.sdp,sequenceId:null==O||null===(T=O.relayMessage)||void 0===T?void 0:T.sequenceId},stream:t,sdp:I.sdp,generatorSsrc:!!I.allSsrc});case 55:return e.next=57,Promise.all(p);case 57:i.multiChatMode()||(t.subAudio=d),i.monitor.rtcSubscribeStat(SB.SUCCESS,l,bB.UNKNOWN,t.userId),i._context&&t.statsReport.setRemoteStreamStatsEvtInterval(i,i._handler,i.monitor,i._context),a(null),i.emit("SUB_END",t.streamId),e.next=73;break;case 64:return e.prev=64,e.t0=e.catch(27),e.t0 instanceof Error&&i.monitor.rtcSubscribeStat(SB.FAIL,l,e.t0.message,t.userId),t.subVideo=f,t.streamState=qz.INIT,e.next=71,null===(M=i._handler)||void 0===M?void 0:M.rollback(t.streamId,t);case 71:s(e.t0),i.emit("SUB_END",t.streamId);case 73:case"end":return e.stop()}}),e,null,[[27,64]])})));return function(t,r){return e.apply(this,arguments)}}()));case 1:case"end":return e.stop()}}),e)}))),function(e,t,r){return T.apply(this,arguments)})},{key:"_handleSubStreamQueue",value:function(e){var t,r=this;if(null!==(t=this._subStreamQueue[e])&&void 0!==t&&t.length){vX.print("_subStreamQueue","streamId: %o, exec",e);var n=this._subStreamQueue[e].shift(),i=n.fn,o=n.args,a=n.resolve,s=n.reject;i.apply(this,o).then(a,s).finally((function(){return r._handleSubStreamQueue(e)}))}else vX.print("_subStreamQueue","streamId: %o, END",e)}},{key:"controlMessage",value:(k=c(o().mark((function e(t){var r,n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return vX.print("controlMessage()","params: %o",t),n=t,"transcode"===t.type&&(n.roomId=this._roomId),e.next=5,null===(r=this._dataChannelSignal)||void 0===r?void 0:r.sendSignaling("controlMessage",n);case 5:case"end":return e.stop()}}),e,this)}))),function(e){return k.apply(this,arguments)})},{key:"updateUserAttributes",value:(b=c(o().mark((function e(t){var r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return vX.print("updateUserAttributes()","attributes: %o",t),e.next=3,null===(r=this._dataChannelSignal)||void 0===r?void 0:r.sendSignaling("updateUserAttributes",{roomId:this._roomId,sessionId:this._sessionId,attributes:t});case 3:case"end":return e.stop()}}),e,this)}))),function(e){return b.apply(this,arguments)})},{key:"updateSubTrack",value:(S=c(o().mark((function e(t,r,n){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._updateSubTrack(t,r,n));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return S.apply(this,arguments)})},{key:"updateSubTrackLayer",value:(y=c(o().mark((function e(t,r){var n,i,a;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(vX.print("updateSubTrack()","subLayer: %o",r),t.subLayer.spatialLayer!==r.spatialLayer||t.subLayer.spatialSubLayer!==r.spatialSubLayer){e.next=4;break}return vX.print("updateSubTrack()","subLayer no change"),e.abrupt("return");case 4:return i={roomId:this._roomId,streamList:[t.streamId],streamId:t.streamId,streamUserId:t.userId,config:{qualityLayer:r}},e.next=7,null===(n=this._dataChannelSignal)||void 0===n?void 0:n.sendSignaling("updateSubscribe",i);case 7:if(200===(null==(a=e.sent)?void 0:a.code)){e.next=10;break}throw new hN(dN.UPDATE_TRACK_FAILED,(null==a?void 0:a.message)||"update track failed");case 10:return t.subLayer=r,e.abrupt("return",t);case 12:case"end":return e.stop()}}),e,this)}))),function(e,t){return y.apply(this,arguments)})},{key:"_updateSubTrack",value:(_=c(o().mark((function e(t,r,n){var i,a,s,c,u,d,l,h;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(vX.print("updateSubTrack()","mediaType: %o",r),yX("updateSubTrack()",t),!this.multiChatMode()||r!==U.AUDIO){e.next=5;break}return vX.print("updateSubTrack","multiChatMode mediaType only audio"),e.abrupt("return",t);case 5:return s=0,s=n===Xz.SUB?t.subMediaType|r:t.subMediaType-(t.subMediaType&r),vX.print("updateSubTrack","prev: %o, direction: %o, mediaType: %o, newMediaType: %o",t.subMediaType,n,r,s),t.subMediaType===s&&vX.print("updateSubTrack","mediaType no change"),c=!1,u=!1,UP(s)&&(u=!0),VP(s)&&(c=!0),d={roomId:this._roomId,streamList:[t.streamId],config:{enableMediaType:{video:c,audio:!!this.multiChatMode()||u}}},e.next=15,null===(i=this._dataChannelSignal)||void 0===i?void 0:i.sendSignaling("updateSubscribe",d);case 15:if(200===(null==(l=e.sent)?void 0:l.code)){e.next=18;break}throw new hN(dN.UPDATE_TRACK_FAILED,(null==l?void 0:l.message)||"update track failed");case 18:return this.multiChatMode()||(null===(h=t.observer)||void 0===h||h.setUnmuteAudio(u),t.subAudio=u),null===(a=t.observer)||void 0===a||a.setUnmuteVideo(c),t.subVideo=c,t.subMediaType=s,e.abrupt("return",t);case 23:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return _.apply(this,arguments)})},{key:"subscribe4pushTrack",value:(v=c(o().mark((function e(t,r){var n,i,a,s,c,u,d,l,h;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return vX.print("subscribe4pushTrack()","streamInfo: %o",r),yX("subscribe4pushTrack()",t),t.subAudio=!0,null===(n=t.observer)||void 0===n||n.setPushTrack(!0),e.next=6,null===(i=this._handler)||void 0===i?void 0:i.subscribe(t,{multiChatMode:this.multiChatMode()});case 6:if(c=e.sent){e.next=9;break}throw new hN(dN.ADD_TRANSCEIVER_FAILED,"add transceiver failed");case 9:return u=c.audioMid,d=c.videoMid,(l=[]).push(new Promise((function(e,r){var n=setTimeout((function(){return r(new hN(dN.TIME_OUT,"wait audio timeout for userId: ".concat(t.userId)))}),_X);t.on("ontrack",(function r(i){"audio"===i.mediaType&&(vX.print("remoteStream ".concat(t.userId," received audio track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),h=function(e){t.ontrack(e)},null===(a=this._handler)||void 0===a||a.on("ontrack",h),this._ontrackCallbackMap.set(t,h),e.next=18,null===(s=this._handler)||void 0===s?void 0:s.handleAck({action:Zz.pushtrack,streamId:t.streamId,audioMid:u,videoMid:d,stream:t,audioTransceiverInit:null==c?void 0:c.audioTransceiverInit,videoTransceiverInit:null==c?void 0:c.videoTransceiverInit,signalingAck:null==r?void 0:r.message,sdp:c.sdp});case 18:return e.next=20,Promise.all(l);case 20:this._context&&t.statsReport.setRemoteStreamStatsEvtInterval(this,this._handler,this.monitor,this._context);case 21:case"end":return e.stop()}}),e,this)}))),function(e,t){return v.apply(this,arguments)})},{key:"unsubscribe4removeTrack",value:(p=c(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:yX("unsubscribe4removeTrack()",t),vX.print("unsubscribe4removeTrack()","sequenceId: ",r.sequenceId);case 2:case"end":return e.stop()}}),e)}))),function(e,t){return p.apply(this,arguments)})},{key:"unsubscribe",value:(d=c(o().mark((function e(t,r){var n,i,a=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=a.length>2&&void 0!==a[2]&&a[2],yX("unsubscribe()",t),!n){e.next=4;break}return e.abrupt("return",this._unsubscribe(t,r));case 4:if(!this.multiChatMode()||!VP(r)){e.next=6;break}return e.abrupt("return",this._unsubscribe(t,r));case 6:if(i=t.subMediaType-(t.subMediaType&r),this.multiChatMode()||i!==Az.NONE){e.next=9;break}return e.abrupt("return",this._unsubscribe(t,r));case 9:return e.abrupt("return",this._updateSubTrack(t,r,Xz.UNSUB));case 10:case"end":return e.stop()}}),e,this)}))),function(e,t){return d.apply(this,arguments)})},{key:"_unsubscribe",value:(s=c(o().mark((function e(t,r){var n,i,a,s,c,u;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.hasSubscribed){e.next=2;break}return e.abrupt("return");case 2:if(!this._subConfig.muteReplaceUnsub){e.next=4;break}return e.abrupt("return",this._updateSubTrack(t,r,Xz.UNSUB));case 4:return c={roomId:this._roomId,streamId:t.streamId,userId:t.userId},null===(n=this._dataChannelSignal)||void 0===n||n.sendSignaling("unsubscribe",c).catch((function(){})),t.streamState=qz.INIT,this._subStreamQueue[t.streamId]&&(this._subStreamQueue[t.streamId].forEach((function(e){return(0,e.resolve)(null)})),delete this._subStreamQueue[t.streamId]),t.subVideo=!1,null===(i=t.observer)||void 0===i||i.setSubscribeVideo(!1),null===(a=t.observer)||void 0===a||a.setSubscribeAudio(!1),e.next=13,null===(s=this._handler)||void 0===s?void 0:s.handleAck({action:Zz.unsubscribe,streamId:t.streamId,audioMid:t.audioMid,videoMid:t.videoMid,stream:t});case 13:u=e.sent,this._subResolves[u]&&this._subResolves[u].forEach((function(e){return e(0)})),vX.print("unsubscribe","clean unsub ".concat(t.userId)),t.clean(),this.removeOnTrackListener(t),t.statsReport.unsubscribe();case 19:case"end":return e.stop()}}),e,this)}))),function(e,t){return s.apply(this,arguments)})},{key:"removeOnTrackListener",value:function(e){var t,r=this._ontrackCallbackMap.get(e);r&&(null===(t=this._handler)||void 0===t||t.off("ontrack",r),this._ontrackCallbackMap.delete(e))}},{key:"handleRemoveStream",value:(a=c(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(yX("handleRemoveStream()",t),t.subVideo=!1,t.hasSubscribed){e.next=4;break}return e.abrupt("return");case 4:this.unsubscribe(t,U.AUDIO_AND_VIDEO,!0);case 5:case"end":return e.stop()}}),e,this)}))),function(e,t){return a.apply(this,arguments)})},{key:"leave",value:(n=c(o().mark((function e(){var t,r,n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(vX.print("leave()"),"connected"!==this.connectionState){e.next=22;break}return this.connectionState="disconnecting",t={Authorization:this._authorization,roomId:this._roomId,sessionId:this._sessionId},e.next=6,this._joinLeaveLock.lock();case 6:return r=e.sent,e.prev=7,e.next=10,null===(n=this._dataChannelSignal)||void 0===n?void 0:n.sendSignaling("leaveRoom",t);case 10:this.connectionState="disconnected",e.next=17;break;case 13:throw e.prev=13,e.t0=e.catch(7),this.connectionState="connected",e.t0;case 17:return e.prev=17,r(),e.finish(17);case 20:e.next=23;break;case 22:return e.abrupt("return",Promise.reject(new hN(dN.NOT_CONNECTED_YET,"server not connected")));case 23:case"end":return e.stop()}}),e,this,[[7,13,17,20]])}))),function(){return n.apply(this,arguments)})},{key:"subscribePublicStream",value:(r=c(o().mark((function e(t){var r,n,i,a,s,c,u,d,l,h,f,p,v,_,m,y=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,null===(r=this._handler)||void 0===r?void 0:r.subscribe(t,{multiChatMode:!1});case 2:if(s=e.sent){e.next=5;break}throw new hN(dN.ADD_TRANSCEIVER_FAILED,"add transceiver failed");case 5:return c=fP(),u=s.audioMid,d=s.videoMid,e.t0=this._appId,e.t1=t.streamId,e.t2=u,e.t3=d,e.t4={sdp:null==s?void 0:s.partialSdp,semantics:null==s?void 0:s.semantics,type:null==s?void 0:s.type},e.next=15,qj();case 15:return e.t5=e.sent,e.t6=window.navigator.userAgent,e.t7=oj.VERSION,e.t8=ej.getDeviceId(),e.t9=this._appId,e.t10=this._businessId,e.t11=this._useCloudProxy,e.t12={supportedCodecs:e.t5,deviceType:"web",userAgent:e.t6,sdkVersion:e.t7,deviceId:e.t8,appId:e.t9,businessId:e.t10,enableCloudProxy:e.t11},e.t13={enableMediaType:{audio:!0,video:!0},qualityLayer:{spatialLayer:0,temporalLayer:0}},l={appId:e.t0,streamId:e.t1,audio:!0,video:!0,data:!0,audioMid:e.t2,videoMid:e.t3,sdpInfo:e.t4,params:e.t12,config:e.t13},e.next=27,null===(n=this._dataChannelSignal)||void 0===n?void 0:n.sendSignaling("startPullStream",l);case 27:return h=e.sent,f=[],this._subResolves[t.streamId]=[],f.push(new Promise((function(e,r){y._subResolves[t.streamId].push(e);var n=setTimeout((function(){return r(new hN(dN.TIME_OUT,"wait video timeout for streamId: ".concat(t.streamId)))}),_X);t.on("ontrack",(function r(i){"video"===i.mediaType&&(vX.print("remoteStream ".concat(t.userId," received video track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),f.push(new Promise((function(e,r){y._subResolves[t.streamId].push(e);var n=setTimeout((function(){return r(new hN(dN.TIME_OUT,"wait audio timeout for streamId: ".concat(t.streamId)))}),_X);t.on("ontrack",(function r(i){"audio"===i.mediaType&&(vX.print("remoteStream ".concat(t.userId," received audio track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),p=function(e){t.ontrack(e)},null===(i=this._handler)||void 0===i||i.on("ontrack",p),this._ontrackCallbackMap.set(t,p),v=null==h?void 0:h.relayMessage,_=v.sequenceId,m=v.sdp,t.videoMid=d,t.audioMid=u,t.sequenceId=_,t.streamState=qz.SUB_ED,t.subAudio=!0,t.subVideo=!0,e.next=44,null===(a=this._handler)||void 0===a?void 0:a.handleAck({action:Zz.subscribe,streamId:t.streamId,audioMid:u,videoMid:d,audioTransceiverInit:null==s?void 0:s.audioTransceiverInit,videoTransceiverInit:null==s?void 0:s.videoTransceiverInit,signalingAck:{sdp:m,sequenceId:_},stream:t});case 44:return e.next=46,Promise.all(f);case 46:this.monitor.rtcSubscribeStat(SB.SUCCESS,c,bB.UNKNOWN,t.userId),this._context&&t.statsReport.setRemoteStreamStatsEvtInterval(this,this._handler,this.monitor,this._context);case 48:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"unsubscribePublicStream",value:(t=c(o().mark((function e(t){var r,n,i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return yX("unsubscribePublicStream()",t),n={appId:this._appId,streamId:t.streamId},e.prev=2,e.next=5,null===(i=this._dataChannelSignal)||void 0===i?void 0:i.sendSignaling("stopPullStream",n);case 5:e.next=9;break;case 7:e.prev=7,e.t0=e.catch(2);case 9:return t.streamState=qz.INIT,t.subVideo=!1,t.subAudio=!1,e.next=14,null===(r=this._handler)||void 0===r?void 0:r.handleAck({action:Zz.unsubscribe,streamId:t.streamId,audioMid:t.audioMid,videoMid:t.videoMid,stream:t});case 14:t.clean(),this.removeOnTrackListener(t),t.statsReport.unsubscribe();case 17:case"end":return e.stop()}}),e,this,[[2,7]])}))),function(e){return t.apply(this,arguments)})},{key:"destroy",value:function(){var e,t,r;vX.print("destroy()"),this._token=void 0,this._appId=void 0,this._roomId=void 0,this._clientId=void 0,this._authorization=void 0,this._sessionId=void 0,this._context=void 0,null===(e=this._handler)||void 0===e||e.destroy(),null===(t=this._dataChannelSignal)||void 0===t||t.destroy(),null===(r=this._iceConfigRequestManager)||void 0===r||r.abort(),this._handler=void 0,this._dataChannelSignal=void 0,this._iceConfigRequestManager=void 0,this._removeSignalEventHandler(),this.connectionState="disconnected",this.emit("INTERRUPT")}},{key:"sendUserMessage",value:function(e,t){var r;return null===(r=this._dataChannelSignal)||void 0===r?void 0:r.sendP2PMessage({to:e,from:this._userInfo.userId,room:this._roomId,app:this._appId,msg:t})}},{key:"sendRoomMessage",value:function(e){var t;return null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("customMessage",e)}},{key:"multiChatMode",value:function(){var e;return null===(e=this._roomAttributes)||void 0===e?void 0:e.multiChatMode}},{key:"handler",get:function(){return this._handler}},{key:"roomAttributes",get:function(){return this._roomAttributes},set:function(e){this._roomAttributes=e}}]),D}($L);function SX(e,t,r){var n=r.value;return r.value=c(o().mark((function e(){var r,i,a,s=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._handler||"connected"!==this._state){e.next=6;break}for(r=s.length,i=new Array(r),a=0;a<r;a++)i[a]=s[a];return e.next=4,n.apply(this,i);case 4:e.next=7;break;case 6:throw new hN(dN.NOT_CONNECTED_YET,"error in ".concat(t,": try again after joined"));case 7:case"end":return e.stop()}}),e,this)}))),r}function bX(e,t,r){var n=r.value;return r.value=c(o().mark((function e(){var t,r,i,a,s=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._pubSubLock.lock();case 2:for(t=e.sent,this.supportConcurrent&&t(),e.prev=4,r=s.length,i=new Array(r),a=0;a<r;a++)i[a]=s[a];return e.next=8,n.apply(this,i);case 8:return e.abrupt("return",e.sent);case 9:return e.prev=9,this.supportConcurrent||t(),e.finish(9);case 12:case"end":return e.stop()}}),e,this,[[4,,9,12]])}))),r}pX([function(e,t,r){var n=r.value;return r.value=c(o().mark((function e(){var t,r,i,a,s=this,u=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(t=u.length,r=new Array(t),i=0;i<t;i++)r[i]=u[i];return a=!1,e.abrupt("return",new Promise(function(){var e=c(o().mark((function e(t,i){var c;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s.on("INTERRUPT",(function(){a=!0,i(new hN(dN.OPERATION_CANCEL,"operation not finish when leave"))})),e.prev=1,e.next=4,n.apply(s,r);case 4:c=e.sent,t(c),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(1),a||i(e.t0);case 11:case"end":return e.stop()}}),e,null,[[1,8]])})));return function(t,r){return e.apply(this,arguments)}}()));case 3:case"end":return e.stop()}}),e)}))),r}],gX.prototype,"join",1),pX([bX,SX],gX.prototype,"publish",1),pX([bX,SX],gX.prototype,"updatePubTrack",1),pX([bX,SX],gX.prototype,"unpublish",1),pX([bX,SX],gX.prototype,"subscribe",1),pX([SX],gX.prototype,"controlMessage",1),pX([SX],gX.prototype,"updateUserAttributes",1),pX([SX],gX.prototype,"updateSubTrack",1),pX([SX],gX.prototype,"updateSubTrackLayer",1),pX([bX,SX],gX.prototype,"subscribe4pushTrack",1),pX([bX,SX],gX.prototype,"unsubscribe4removeTrack",1),pX([bX,SX],gX.prototype,"unsubscribe",1),pX([SX],gX.prototype,"handleRemoveStream",1),pX([bX],gX.prototype,"subscribePublicStream",1),pX([bX],gX.prototype,"unsubscribePublicStream",1);var EX=ro,kX=le,TX=ce,IX=Re,AX=Xt,RX=qe,wX=tt,CX=As,OX=Pr.f,xX=Fi,DX=TX.Symbol,NX=DX&&DX.prototype;if(kX&&RX(DX)&&(!("description"in NX)||void 0!==DX().description)){var PX={},MX=function(){var e=arguments.length<1||void 0===arguments[0]?void 0:CX(arguments[0]),t=wX(NX,this)?new DX(e):void 0===e?DX():DX(e);return""===e&&(PX[t]=!0),t};xX(MX,DX),MX.prototype=NX,NX.constructor=MX;var LX="Symbol(test)"==String(DX("test")),UX=IX(NX.valueOf),VX=IX(NX.toString),FX=/^Symbol\((.*)\)[^)]+$/,BX=IX("".replace),jX=IX("".slice);OX(NX,"description",{configurable:!0,get:function(){var e=UX(this);if(AX(PX,e))return"";var t=VX(e),r=LX?jX(t,7,-1):BX(t,FX,"$1");return""===r?void 0:r}}),EX({global:!0,constructor:!0,forced:!0},{Symbol:MX})}fM("iterator");var GX=Ip.right,HX=ut,zX=Ap;ro({target:"Array",proto:!0,forced:!Ca("reduceRight")||!zX&&HX>79&&HX<83},{reduceRight:function(e){return GX(this,e,arguments.length,arguments.length>1?arguments[1]:void 0)}});var XX={};Object.defineProperty(XX,"__esModule",{value:!0});var KX=function(){return(KX=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function qX(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(n=o.next()).done;)a.push(n.value)}catch(s){i={error:s}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a}function WX(e){return"object"==a(e)&&null!==e}function YX(e){return"function"==typeof e}function JX(){if("object"==("undefined"==typeof window?"undefined":a(window))&&WX(window))return window}function QX(){if("object"==("undefined"==typeof document?"undefined":a(document))&&WX(document))return document}var ZX=function(e){if(e)return e.__SLARDAR_REGISTRY__||(e.__SLARDAR_REGISTRY__={Slardar:{plugins:[],errors:[],subject:{}}}),e.__SLARDAR_REGISTRY__.Slardar},$X=function(e,t,r,n){void 0===t&&(t={}),void 0===n&&(n=[]);try{var i=e.apply(void 0,function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||((n=n||Array.prototype.slice.call(t,0,i))[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}([],qX(n),!1));return i&&i(t,r)||[]}catch(o){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=ZX(JX());r&&(r.errors||(r.errors=[]),r.errors.push(e))}(o),[]}},eK=function(e){return e.requestIdleCallback||function(t){return e.setTimeout(t,1)}},tK=function(){return Date.now()};var rK=function(e,t){return WX(e)?KX(KX({},t),e):!!e&&t};var nK=["SCRIPT","STYLE","META","HEAD"],iK=["js_error","http","resource_error"],oK=["performance","performance_longtask","performance_timing","custom"],aK=function e(t,r,n,i,o){if(void 0===r&&(r=0),void 0===n&&(n=0),void 0===i&&(i=1.5),void 0===o&&(o=nK),!t||-1<o.indexOf(t.tagName)||i<=n||4<r)return n;var a=function(){if(!r)return 0;var e=(n=t.getBoundingClientRect()).top,n=n.height;return e>innerHeight||n<=0?0:1/Math.pow(2,r-1)}();return[].reduceRight.call(t.children,(function(t,n){return e(n,r+1,t,i,o)}),n+a)},sK=function(e,t,r,n){if(function(){if(JX()&&"Promise"in window)return Promise}()&&r&&n){if(r.html2canvas)return o();var i=n.createElement("script");i.src=t,null!==(t=n.head)&&void 0!==t&&t.appendChild(i),i.onload=o}function o(){eK(r)((function(){r.html2canvas&&r.html2canvas(n.body,{scale:360/r.innerWidth}).then((function(t){e(t.toDataURL("image/jpeg",.1))}))}))}},cK=function(e,t,r,n,i){if(void 0===e&&(e=JX()),void 0===t&&(t=QX()),void 0===r&&(r=function(){if(JX()&&YX(window.PerformanceObserver))return window.PerformanceObserver}()),void 0===n&&(n=function(){if(JX()&&YX(window.MutationObserver))return window.MutationObserver}()),void 0===i&&(i=function(){if(JX()&&WX(window.performance))return window.performance}()),t&&e)return function(o,a){var s,c,u,d,l,h,f=o.threshold,p=o.screenshot,v=o.rootSelector,_=o.autoDetect,m=o.ssUrl,y=eK(e),g=qX(function(e){var t=e&&e.timing||void 0;return[t,function(){return e&&e.now?e.now():(Date.now?Date.now():+new Date)-(t&&t.navigationStart||0)},function(t){var r=(e||{}).getEntriesByType;return YX(r)&&r.call(e,t)||[]},function(){var t=(e||{}).clearResourceTimings;YX(t)&&t.call(e)},function(t){var r=(e||{}).getEntriesByName;return YX(r)&&r.call(e,t)||[]}]}(i),2)[1],S=0,b=!1,E=function(e){s&&a&&a({ev_type:"blank_screen",payload:{timestamp:s[0],score:s[1],screenshot:e,error:c}})},k=(d=function(){s&&!b&&(b=!0,I(),p?sK(E,m,e,t):E())},function(){l||(h=tK(),l=e.setTimeout((function(){l=0,h<S||d()}),g()>1e4?2e3:8e3))});function T(){u&&clearTimeout(u),u=e.setTimeout((function(){y((function(){e.requestAnimationFrame((function(){var e=v?t.querySelector(v):t.body;e&&((e=aK(e,0,0,f))<f?(s=[tK(),e],k()):s=void 0)}))}))}),1e3)}!function(e){var t=qX(function(e){var t=!1;return[function(r){t||(t=!0,e&&e(r))}]}(e),1)[0];["unload","beforeunload","pagehide"].forEach((function(e){addEventListener(e,t)}))}((function(){!b&&c&&E()}));var I=function(){clearTimeout(u),R&&R(),C&&C()},A=(o=qX(function(e,t){var r=e&&new e(t);return[function(e,t){r&&e&&r.observe(e,t)},function(){return r&&r.disconnect()}]}(n,T),2),o[0]),R=o[1],w=(o=qX(function(e,t,r,n){var i=e&&new e((function(e,i){e.getEntries?e.getEntries().forEach((function(e,r,n){return t(e,r,n,i)})):n&&n(),r&&i.disconnect()}));return[function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];if(!e||!i)return n&&n();try{t.forEach((function(t){-1<e.supportedEntryTypes.indexOf(t)&&i.observe({type:t,buffered:!1})}))}catch(o){try{i.observe({entryTypes:t})}catch(a){return n&&n()}}},function(){return i&&i.disconnect()}]}(r,(function(e,t,r){return u&&1<r.length&&T()})),2),o[0]),C=o[1];return _&&function(e){var t=JX(),r=QX();t&&r&&("loading"!==r.readyState?e():t.addEventListener("DOMContentLoaded",(function(){setTimeout((function(){e()}),0)}),!1))}((function(){var e;A(null===(e=QX())||void 0===e?void 0:e.body,{subtree:!0,childList:!0}),w("longtask","resource"),T()})),[I,function(e){b||function(e){return~oK.indexOf(e.ev_type)}(e)||(S=tK(),c&&S-c.timestamp>1e4&&(c=void 0),c=function(e,t){if(-1===iK.indexOf(t.ev_type))return e;if("http"===t.ev_type&&t.payload.response.status<400)return e;if(e&&iK.indexOf(e.type)<iK.indexOf(t.ev_type))return e;var r="";switch(t.ev_type){case"js_error":r=t.payload.error.message;break;case"http":r=t.payload.request.url;break;case"resource_error":r=t.payload.url}return{type:t.ev_type,message:r,timestamp:tK()}}(c,e))},T]}},uK="blankScreen";function dK(e,t,r){e.on("init",(function(){var n,i,o,a=function(e,t,r){return t=null===(e=e.config())||void 0===e?void 0:e.plugins[t],rK(t,r)}(e,uK,t)||rK(r,t);a&&(a=qX($X(cK,a,e.report.bind(e)),3),n=a[0],i=a[1],a=a[2],e.on("report",o=function(e){return i(e),e}),e.on("beforeDestroy",(function(){n(),e.off("report",o)})),e.provide("detectBlankScreen",a))}))}var lK={autoDetect:!0,threshold:1.5,screenshot:!0,ssUrl:"https://apm.volccdn.com/mars-web/apmplus/web/html2canvas.min.js"};var hK=XX.blankScreenPlugin=function(e){return{name:uK,setup:function(t){!function(e,t){dK(e,lK,t)}(t,e)}}},fK=Gt,pK=Gu,vK=Pu;ro({target:"Object",stat:!0,forced:de((function(){pK(1)})),sham:!vK},{getPrototypeOf:function(e){return pK(fK(e))}});var _K=PN.start;ro({target:"String",proto:!0,forced:MN},{padStart:function(e){return _K(this,e,arguments.length>1?arguments[1]:void 0)}});var mK,yK={};Object.defineProperty(yK,"__esModule",{value:!0});var gK=function(){return(gK=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function SK(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(n=o.next()).done;)a.push(n.value)}catch(s){i={error:s}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a}function bK(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||((n=n||Array.prototype.slice.call(t,0,i))[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}var EK=function(e){return JSON.stringify({ev_type:"batch",list:e})};var kK=["init","start","config","beforeDestroy","provide","beforeReport","report","beforeBuild","build","beforeSend","send","beforeConfig"],TK=function(){return{}};function IK(e){return"object"==a(e)&&null!==e}var AK=Object.prototype;function RK(e){return!!IK(e)&&("function"!=typeof Object.getPrototypeOf?"[object Object]"===AK.toString.call(e):(e=Object.getPrototypeOf(e))===AK||null===e)}function wK(e){return"[object Array]"===AK.toString.call(e)}function CK(e){return"function"==typeof e}function OK(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function xK(e,t){var r,n=gK({},e);for(r in t)OK(t,r)&&void 0!==t[r]&&(IK(t[r])&&RK(t[r])?n[r]=xK(IK(e[r])?e[r]:{},t[r]):wK(t[r])&&wK(e[r])?n[r]=DK(e[r],t[r]):n[r]=t[r]);return n}function DK(e,t){return e=wK(e)?e:[],t=wK(t)?t:[],Array.prototype.concat.call(e,t).map((function(e){return e instanceof RegExp?e:IK(e)&&RK(e)?xK({},e):wK(e)?DK([],e):e}))}function NK(e,t){if(!wK(e))return!1;if(0===e.length)return!1;for(var r=0;r<e.length;){if(e[r]===t)return!0;r++}return!1}var PK=function(e,t){if(!wK(e))return e;var r=e.indexOf(t);return 0<=r?((t=e.slice()).splice(r,1),t):e},MK=function(e,t,r){return function(e,t,r){for(var n,i=(t=SK(t.split(".")))[0],o=t.slice(1);e&&0<o.length;)e=e[i],i=(n=SK(o))[0],o=n.slice(1);if(e)return r(e,i)}(e,t,(function(e,t){if(e&&t in e&&CK(e[t]))try{return e[t].apply(e,r)}catch(n){return}}))};function LK(e){try{return function(e){return"string"==typeof e}(e)?e:JSON.stringify(e)}catch(t){return"[FAILED_TO_STRINGIFY]:"+String(t)}}var UK=0,VK=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];console.error.apply(console,bK(["[SDK]",Date.now(),(""+UK++).padStart(8," ")],SK(e),!1))},FK=0,BK=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];console.warn.apply(console,bK(["[SDK]",Date.now(),(""+FK++).padStart(8," ")],SK(e),!1))},jK=function(e){return function(t){for(var r=t,n=0;n<e.length&&r;n++)try{r=e[n](r)}catch(i){VK(i)}return r}};function GK(){var e=function(){for(var e=new Array(16),t=0,r=0;r<16;r++)0==(3&r)&&(t=4294967296*Math.random()),e[r]=t>>>((3&r)<<3)&255;return e}();return e[6]=15&e[6]|64,e[8]=63&e[8]|128,function(e){for(var t=[],r=0;r<256;++r)t[r]=(r+256).toString(16).substr(1);var n=0,i=t;return[i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]],i[e[14]],i[e[15]]].join("")}(e)}var HK=function e(t,r){var n=r.reduce((function(e,r){try{var n=r(t);"function"==typeof n&&e.push(n)}catch(i){}return e}),[]);return function(t){return e(t,n)}},zK=function(e){function t(e){n=PK(n,e),o||a()}var r,n=[],i=[],o=!1,a=function(e,t,r){var n=0;return function(){if(e())return n&&clearTimeout(n),void(n=0);0===n&&(n=setTimeout(t,r))}}((function(){return!!n.length}),(function(){o=!0,r&&r[0](),i.forEach((function(e){return e()})),i.length=0,r=void 0}),e=void 0===e?3e5:e);return{next:function(e){return HK(e,n)},complete:function(e){i.push(e)},attach:function(e,t){r=[e,t]},subscribe:function(e){if(o)throw new Error("Observer is closed");return n.push(e),r&&r[1]&&r[1](e),a(),function(){return t(e)}},unsubscribe:t}};var XK=function(e){var t,r,n,i=(t={},r={},n={set:function(e,i){return t[e]=i,r[e]=LK(i),n},merge:function(e){return t=gK(gK({},t),e),Object.keys(e).forEach((function(t){r[t]=LK(e[t])})),n},delete:function(e){return delete t[e],delete r[e],n},clear:function(){return t={},r={},n},get:function(e){return r[e]},toString:function(){return gK({},r)}},n);e.provide("context",i),e.on("report",(function(e){return e.extra||(e.extra={}),e.extra.context=i.toString(),e}))},KK=function(e,t,r){function n(){for(var r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];if(c=r[0]){var a=c.split(".")[0];if(a in n)return MK(n,c,[].slice.call(r,1));var s=o[a]||[],c=null!==(c=null==t?void 0:t(e))&&void 0!==c?c:{};s.push(bK([c],SK(r),!1)),o[a]=s}}var i,o={};for(i in function(e,t,r,n){return void 0===n&&(n=!0),function(){for(var i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];if(!e)return TK;var a=e[t],s=r.apply(void 0,bK([a],SK(i),!1)),c=s;return CK(c)&&n&&(c=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];try{return s.apply(this,e)}catch(r){return CK(a)&&a.apply(this,e)}}),e[t]=c,function(r){r||(c===e[t]?e[t]=a:s=a)}}}(e,"provide",(function(t){return function(r,i){n[r]=i,t.call(e,r,i)}}))(),e)Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i]);return e.on("provide",(function(t){o[t]&&(o[t].forEach((function(t){t=(n=SK(t))[0];var n=n.slice(1);null!=r&&r(e,t,n)})),o[t]=null)})),n};function qK(e,t){var r=t||{};e.provide("initSubject",(function(e){var t=(e=SK(e,2))[0];e=e[1];return r[t]||(r[t]=function(t,r){var n=zK();try{t(n.next,n.attach),r&&n.complete(r)}catch(e){}return[n.subscribe,n.unsubscribe]}(e,(function(){r[t]=void 0}))),r[t]})),e.provide("getSubject",(function(e){return r[e]}))}function WK(){if("object"==("undefined"==typeof window?"undefined":a(window))&&IK(window))return window}function YK(){var e=function(){if(WK()&&"navigator"in window)return window.navigator}();if(e)return e.connection||e.mozConnection||e.webkitConnection}function JK(){var e=WK()&&WK()&&window.location;return null==e?void 0:e.href}var QK=function(e){var t={url:JK(),timestamp:Date.now()},r=e.config();return null!=r&&r.pid&&(t.pid=r.pid),null!=e&&e.context&&(t.context=e.context.toString()),t};function ZK(e){return(null==e?void 0:e.effectiveType)||(null==e?void 0:e.type)||""}var $K=function(e,t,r){var n,i=t.url,o=t.data,a=void 0===(n=t.success)?TK:n,s=void 0===(n=t.fail)?TK:n,c=void 0===(n=t.getResponseText)?TK:n;t=void 0!==(t=t.withCredentials)&&t;(r=new r).withCredentials=t,r.open(e,i,!0),r.setRequestHeader("Content-Type","application/json"),r.onload=function(){null!=c&&c(this.responseText);try{var e;this.responseText?(e=JSON.parse(this.responseText),a(e)):a({})}catch(t){s(t)}},r.onerror=function(){s(new Error("Network request failed"))},r.onabort=function(){s(new Error("Network request aborted"))},r.send(o)},eq=function(){var e=function(){if("function"==typeof XMLHttpRequest&&CK(XMLHttpRequest))return XMLHttpRequest}();return e?{get:function(t){$K("GET",t,e)},post:function(t){$K("POST",t,e)}}:{get:TK,post:TK}};function tq(e){function t(e){n.post(r.getEndpoint(),EK([e]))}var r=function(e){var t=e.transport,r=e.endpoint,n=e.size,i=void 0===n?10:n,o=void 0===(e=e.wait)?1e3:e,a=[],s=0;function c(){a.length&&(t.post({url:r,data:this.getBatchData()}),a=[])}return{getSize:function(){return i},getWait:function(){return o},setSize:function(e){i=e},setWait:function(e){o=e},getEndpoint:function(){return r},setEndpoint:function(e){r=e},send:function(e){a.push(e),a.length>=i&&c.call(this),clearTimeout(s),s=setTimeout(c.bind(this),o)},flush:function(){clearTimeout(s),c.call(this)},getBatchData:function(){return a.length?EK(a):""},clear:function(){clearTimeout(s),a=[]}}}(e),n=function(){var e=WK();return e&&e.navigator.sendBeacon?{get:function(){},post:function(t,r){e.navigator.sendBeacon(t,r)}}:{get:TK,post:TK}}();return function(e){var t=SK(function(e){var t=!1;return[function(r){t||(t=!0,e&&e(r))}]}(e),1)[0];["unload","beforeunload","pagehide"].forEach((function(e){addEventListener(e,t)}))}((function(){var e=r.getBatchData();e&&(n.post(r.getEndpoint(),e),r.clear()),r.send=t})),r}var rq={build:function(e){return{ev_type:e.ev_type,payload:e.payload,common:gK(gK({},e.extra||{}),e.overrides||{})}}};function nq(e){var t,r=e.plugins||{};for(t in r)r[t]&&!IK(r[t])&&(r[t]={});return gK(gK({},e),{plugins:r})}function iq(e){return IK(e)&&"aid"in e}function oq(e){return gK({},e)}var aq="/settings/get/webpro",sq="/monitor_web/collect",cq=[sq,aq,"/monitor_browser/collect"],uq={sample_rate:1,include_users:[],sample_granularity:"session",rules:{}},dq=function(e,t){return void 0===t&&(t=sq),(e&&0<=e.indexOf("//")?"":"https://")+e+t},lq=function(e,t){return void 0===t&&(t=aq),(e&&0<=e.indexOf("//")?"":"https://")+e+t},hq=function(e){return e+"_"+Date.now()},fq=function(e){return"APMPLUS"+e},pq=function(e){return function(e){try{var t=localStorage.getItem(e),r=t;return t&&"string"==typeof t?JSON.parse(t):r}catch(n){return}}(e=fq(e))||{userId:GK(),deviceId:GK(),r:Math.random()}},vq=function(e){var t=e.aid,r=e.userId,n=e.deviceId;e=e.sample;!function(e,t){try{var r="string"==typeof t?t:JSON.stringify(t);localStorage.setItem(e,r)}catch(n){}}(t=fq(t),{userId:r,deviceId:n,r:e.r})},_q=function(e){var t,r,n,i=e,o={},a=TK,s=TK;return{getConfig:function(){return i},setConfig:function(e){return o=gK(gK({},o),e||{}),c(),t||(t=e,i.useLocalConfig?(n={},a()):r?u():function(e,t,r,n){e.get({withCredentials:!0,url:lq(t)+"?aid="+r,success:function(e){n(e.data||{})},fail:function(){n()}})}(i.transport,i.domain,i.aid,(function(e){r=e,u()}))),i},onChange:function(e){s=e},onReady:function(t){a=function(){e.userId!==i.userId&&(e.sample.r=Math.random(),c()),vq(i),t()},n&&a()}};function c(){var t=gK(gK(gK({},e),n||{}),o);t.plugins=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var r={},n=0;n<e.length;)r=xK(r,e[n++]);return r}(e.plugins,(null==n?void 0:n.plugins)||{},o.plugins||{}),t.sample=mq(mq(e.sample,null==n?void 0:n.sample),o.sample),i=t,s()}function u(){n=function(e){if(!e)return{};var t=e.sample,r=e.timestamp,n=e.status;if(!t)return{};var i=t.sample_rate;return e=t.sample_granularity,{sample:{include_users:t.include_users,sample_rate:n&&4===n?0:i,sample_granularity:e,rules:t.rules.reduce((function(e,t){var r=t.name,n=t.enable,i=t.sample_rate;return t=t.conditional_sample_rules,e[r]={enable:n,sample_rate:i,conditional_sample_rules:t},e}),{})},serverTimestamp:r}}(r),c(),a()}};function mq(e,t){if(!e||!t)return e||t;var r=gK(gK({},e),t);return r.include_users=bK(bK([],SK(e.include_users||[]),!1),SK(t.include_users||[]),!1),r.rules=bK(bK([],SK(Object.keys(e.rules||{})),!1),SK(Object.keys(t.rules||{})),!1).reduce((function(r,n){var i;return n in r||(n in(e.rules||{})&&n in(t.rules||{})?(r[n]=gK(gK({},e.rules[n]),t.rules[n]),r[n].conditional_sample_rules=bK(bK([],SK(e.rules[n].conditional_sample_rules||[]),!1),SK(t.rules[n].conditional_sample_rules||[]),!1)):r[n]=(null===(i=e.rules)||void 0===i?void 0:i[n])||(null===(i=t.rules)||void 0===i?void 0:i[n])),r}),{}),r}var yq=function(e){e.on("report",(function(e){return function(e){var t={url:JK(),timestamp:Date.now()};return gK(gK({},e),{extra:gK(gK({},t),e.extra||{})})}(e)}))},gq=function(e){e.on("beforeBuild",(function(t){return function(e,t){var r={};return r.aid=t.aid,r.pid=t.pid,r.view_id=t.viewId,r.user_id=t.userId,gK(gK({},e),{extra:gK(gK({},r),e.extra||{})})}(t,e.config())}))},Sq=function(e){e.on("start",(function(){var t,r={did:(t=e.config()).deviceId,sid:t.sessionId,release:t.release,env:t.env,sname:"APM_PLUS_WEB",sversion:"1.7.0",soffset:t.offset||0,biz_id:r=t.aid,x_auth_token:t=t.token};(t=e.getSender()).setEndpoint(t.getEndpoint()+function(e){return IK(e)?Object.keys(e).reduce((function(t,r){return t+"&"+r+"="+e[r]}),"").replace("&","?"):""}(r))}))},bq=function(e){return e=pq(e.aid),{aid:0,pid:"",token:"",viewId:hq("_"),userId:e.userId,deviceId:e.deviceId,sessionId:GK(),domain:"apmplus.volces.com",plugins:{ajax:{ignoreUrls:cq},fetch:{ignoreUrls:cq},breadcrumb:{},pageview:{},jsError:{},resource:{},resourceError:{},performance:{},tti:{},fmp:{},blankScreen:!1},release:"",env:"production",sample:gK(gK({},uq),{r:e.r}),transport:eq()}};mK=yK.createMinimalBrowserClient=function(e){var t=(r=void 0===e?{}:e).createSender,r=(e=r.builder,r.createDefaultConfig),n=function(e){var t,r,n=e.builder,i=e.createSender,o=e.createDefaultConfig,a=e.createConfigManager,s=e.userConfigNormalizer,c=e.initConfigNormalizer,u=e.validateInitConfig,d={};kK.forEach((function(e){return d[e]=[]}));var l=!1,h=!1,f=!1,p=[],v=[],_={getBuilder:function(){return n},getSender:function(){return t},getPreStartQueue:function(){return p},init:function(e){if(l)BK("already inited");else{if(!(e&&IK(e)&&u(e)))throw new Error("invalid InitConfig, init failed");var n=o(e);if(!n)throw new Error("defaultConfig missing");if(e=c(e),(r=a(n)).setConfig(e),r.onChange((function(){m("config")})),!(t=i(r.getConfig())))throw new Error("sender missing");m("init",l=!0)}},set:function(e){l&&e&&IK(e)&&(m("beforeConfig",!1,e),null!=r&&r.setConfig(e))},config:function(e){if(l)return e&&IK(e)&&(m("beforeConfig",!1,e),null!=r&&r.setConfig(s(e))),null==r?void 0:r.getConfig()},provide:function(e,t){NK(v,e)?BK("cannot provide "+e+", reserved"):(_[e]=t,m("provide",!1,e))},start:function(){var e=this;l&&(h||null!=r&&r.onReady((function(){m("start",h=!0),p.forEach((function(t){return e.build(t)})),p=[]})))},report:function(e){e&&(!(e=jK(d.beforeReport)(e))||(e=jK(d.report)(e))&&(h?this.build(e):p.push(e)))},build:function(e){!h||(e=jK(d.beforeBuild)(e))&&(!(e=n.build(e))||(e=jK(d.build)(e))&&this.send(e))},send:function(e){!h||(e=jK(d.beforeSend)(e))&&(t.send(e),m("send",!1,e))},destroy:function(){m("beforeDestroy",f=!0)},on:function(e,t){"init"===e&&l||"start"===e&&h||"beforeDestroy"===e&&f?t():d[e]&&d[e].push(t)},off:function(e,t){d[e]&&(d[e]=PK(d[e],t))}};return v=Object.keys(_),_;function m(e,t){void 0===t&&(t=!1);for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];d[e].forEach((function(e){try{e.apply(void 0,bK([],SK(r),!1))}catch(t){}})),t&&(d[e].length=0)}}({validateInitConfig:iq,initConfigNormalizer:nq,userConfigNormalizer:oq,createSender:void 0===t?function(e){return tq({size:20,endpoint:dq(e.domain),transport:e.transport})}:t,builder:void 0===e?rq:e,createDefaultConfig:void 0===r?bq:r,createConfigManager:_q});return XK(n),r=function(e){if(e)return e.__SLARDAR_REGISTRY__||(e.__SLARDAR_REGISTRY__={Slardar:{plugins:[],errors:[],subject:{}}}),e.__SLARDAR_REGISTRY__.Slardar}(WK()),qK(n,r&&r.subject),function(e){var t,r=!1;e.on("init",(function(){t=(new Date).getTime(),e.on("config",(function(){var n,i=null===(n=e.config())||void 0===n?void 0:n.serverTimestamp;isNaN(i)||Number(i)<=0||r||(r=!0,(n=(new Date).getTime())-t<700&&i&&(n=i-(n+t)/2,!isNaN(n)&&(0<n||n<-6e5)&&e.set({offset:n})))}))}))}(n),gq(n),yq(n),function(e){var t=YK(),r=ZK(t);t&&(t.onchange=function(){r=ZK(t)}),e.on("report",(function(e){return gK(gK({},e),{extra:gK(gK({},e.extra||{}),{network_type:r})})}))}(n),Sq(n),r=KK(n,QK,(function(e,t,r){return function(e,t){return function(r){function n(e){return e.overrides=t,e}e.on("report",n),r(),e.off("report",n)}}(e,t)((function(){var e=(t=SK(r))[0],t=t.slice(1);n[e].apply(n,bK([],SK(t),!1))}))})),function(e){e.on("init",(function(){var t=[],r=e.config();r&&r.integrations&&r.integrations.forEach((function(r){NK(t,r.name)||(t.push(r.name),r.setup(e),r.tearDown&&e.on("beforeDestroy",r.tearDown))}))}))}(r),r},yK.getDefaultConfig=bq;var Eq={};Object.defineProperty(Eq,"__esModule",{value:!0});var kq=function(){return(kq=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function Tq(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(n=o.next()).done;)a.push(n.value)}catch(s){i={error:s}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a}function Iq(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||((n=n||Array.prototype.slice.call(t,0,i))[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}var Aq=function(){return{}};function Rq(e){return"object"==a(e)&&null!==e}var wq=Object.prototype;function Cq(e){return"function"==typeof e}function Oq(e){return"string"==typeof e}function xq(e){return function(e){return"[object Array]"===wq.toString.call(e)}(e)&&e.length?function(e){for(var t=[],r=e.length,n=0;n<r;n++){var i=e[n];Oq(i)?t.push(i.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")):i&&i.source&&t.push(i.source)}return new RegExp(t.join("|"),"i")}(e):null}function Dq(e){try{return Oq(e)?e:JSON.stringify(e)}catch(t){return"[FAILED_TO_STRINGIFY]:"+String(t)}}var Nq=function(e,t,r,n){return void 0===n&&(n=!0),function(){for(var i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];if(!e)return Aq;var a=e[t],s=r.apply(void 0,Iq([a],Tq(i),!1)),c=s;return Cq(c)&&n&&(c=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];try{return s.apply(this,e)}catch(r){return Cq(a)&&a.apply(this,e)}}),e[t]=c,function(r){r||(c===e[t]?e[t]=a:s=a)}}};function Pq(){if("object"==("undefined"==typeof window?"undefined":a(window))&&Rq(window))return window}var Mq=function(e){if(e)return e.__SLARDAR_REGISTRY__||(e.__SLARDAR_REGISTRY__={Slardar:{plugins:[],errors:[],subject:{}}}),e.__SLARDAR_REGISTRY__.Slardar},Lq=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=Mq(Pq());r&&(r.errors||(r.errors=[]),r.errors.push(e))};function Uq(e,t,r){return function(e,t){return Rq(e)?kq(kq({},t),e):!!e&&t}(t=null===(e=e.config())||void 0===e?void 0:e.plugins[t],r)}var Vq=["name","message","stack","filename","lineno","colno"],Fq=function(e){var t;return function(e){switch(Object.prototype.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMError]":case"[object DOMException]":return!0;default:return e instanceof Error}}(e)?t=function(e,t){return e&&Rq(e)?t.reduce((function(t,r){return t[r]=e[r],t}),{}):e}(e,Vq):(function(e){return!!Rq(e)&&("function"!=typeof Object.getPrototypeOf?"[object Object]"===wq.toString.call(e):(e=Object.getPrototypeOf(e))===wq||null===e)}(e)||function(e){return"undefined"!=typeof Event&&function(e,t){try{return e instanceof t}catch(r){return!1}}(e,Event)}(e)||Oq(e))&&(t={message:Dq(e)}),t},Bq=function(e){return Fq(e.error)},jq=function(e){var t;try{var r=void 0;if("reason"in e?r=e.reason:"detail"in e&&"reason"in e.detail&&(r=e.detail.reason),r){var n=Fq(r);return kq(kq({},n),{name:null!==(t=n&&n.name)&&void 0!==t?t:"UnhandledRejection"})}}catch(i){}},Gq=function(e){return(function(e){return"[object ErrorEvent]"===Object.prototype.toString.call(e)}(e)?Bq:function(e){return"[object PromiseRejectionEvent]"===Object.prototype.toString.call(e)}(e)?jq:Fq)(e)},Hq=["EventTarget","Window","Node","ApplicationCache","ChannelMergerNode","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","MessagePort","Notification","SVGElementInstance","Screen","TextTrack","TextTrackCue","TextTrackList","WebSocket","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],zq=["setTimeout","setInterval","requestAnimationFrame","requestIdleCallback"],Xq=["onload","onerror","onprogress","onreadystatechange"],Kq="addEventListener",qq=function(e,t,r){function n(t,r){if(!Cq(t))return t;var i={type:"capture-global",data:kq({},r)},o=t._w_||(t._w_=function(){try{return(t.handleEvent&&Cq(t.handleEvent)?t.handleEvent:t).apply(this,[].map.call(arguments,(function(e){return n(e,r)})))}catch(a){var o=Fq(a);throw o&&e({error:o,source:i}),a}});return o._hook_=!0,o}void 0===t&&(t=Pq()),void 0===r&&(r=function(){if("function"==typeof XMLHttpRequest&&Cq(XMLHttpRequest))return XMLHttpRequest}());var i=[];return t&&i.push.apply(i,Iq([],Tq(zq.filter((function(e){return t[e]})).map((function(e){return Nq(t,e,(function(t){return function(r){for(var i=[],o=1;o<arguments.length;o++)i[o-1]=arguments[o];return t&&t.call.apply(t,Iq([this,n(r,{function:e})],Tq(i),!1))}}),!1)()}))),!1)),r&&r.prototype&&i.push(Nq(r.prototype,"send",(function(e){return function(){for(var t=this,r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];return i.push.apply(i,Iq([],Tq(Xq.filter((function(e){return t[e]&&!t[e]._hook_})).map((function(e){var r=Nq(t,e,(function(t){return n(t,{function:e})}),!1)();return function(){r(),t[e]._hook_=void 0}}))),!1)),e.apply(this,r)}}),!1)()),Hq.forEach((function(e){var r=t[e]&&t[e].prototype;r&&r.addEventListener&&(i.push(Nq(r,Kq,(function(t){return function(r,i,o){try{var a=i.handleEvent;Cq(a)&&(i.handleEvent=n(a,{function:"handleEvent",target:e}))}catch(s){}return t&&t.call(this,r,n(i,{function:Kq,target:e}),o)}}),!1)()),i.push(Nq(r,"removeEventListener",(function(e){return function(t,r,n){return null!=r&&r._w_&&e.call(this,t,r._w_,n),e.call(this,t,r,n)}}),!1)()))})),i},Wq=function(e,t){return e&&t&&e===t},Yq=function(){var e;return function(t){try{if(function(e,t){return!!(e&&t&&Wq(e.message,t.message)&&Wq(e.stack,t.stack))}(t,e))return void(e=t)}catch(r){Lq(r)}return e=t}},Jq=function(e){if(e=void 0===e?Pq():e)return function(t,r){var n,i,o=t.ignoreErrors,a=t.onerror,s=t.onunhandledrejection,c=t.dedupe,u=(t=t.captureGlobalAsync,xq(o)),d=[],l=Yq(),h=function(e){var t=e.error,n=e.extra,i=e.react;e=e.source,t=c?l(t):t;r&&t&&(u&&u.test(t.message)||r({ev_type:"js_error",payload:{error:t,breadcrumbs:[],extra:n,react:i,source:e}}))};return a&&(e.addEventListener("error",n=function(e){return h({error:Bq(e),source:{type:"onerror"}})}),d.push((function(){return e.removeEventListener("error",n)}))),s&&(e.addEventListener("unhandledrejection",i=function(e){return h({error:jq(e),source:{type:"onunhandledrejection"}})}),d.push((function(){return e.removeEventListener("unhandledrejection",i)}))),t&&d.push.apply(d,Iq([],Tq(qq(h)),!1)),[function(e,t,r){return h({error:Gq(e),extra:t,react:r,source:{type:"manual"}})},function(){d.forEach((function(e){return e()}))}]}},Qq="jsError",Zq={ignoreErrors:[],onerror:!0,onunhandledrejection:!0,captureGlobalAsync:!1,dedupe:!0};function $q(e){e.on("init",(function(){window.removeEventListener("error",e.pcErr,!0),window.removeEventListener("unhandledrejection",e.pcRej,!0);var t,r=Uq(e,Qq,Zq);r&&(r=(t=Tq(function(e,t,r,n){void 0===t&&(t={}),void 0===n&&(n=[]);try{var i=e.apply(void 0,Iq([],Tq(n),!1));return i&&i(t,r)||[]}catch(o){return Lq(o),[]}}(Jq,r,(function(t){e.getBreadcrumbs&&(t.payload.breadcrumbs=e.getBreadcrumbs()),e.report(t)})),2))[0],t=t[1],e.on("beforeDestroy",t),e.provide("captureException",r))}))}var eW=Eq.jsErrorPlugin=function(){return{name:Qq,setup:function(e){$q(e)}}},tW={};Object.defineProperty(tW,"__esModule",{value:!0});var rW=function(){return(rW=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function nW(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(n=o.next()).done;)a.push(n.value)}catch(s){i={error:s}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a}function iW(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||((n=n||Array.prototype.slice.call(t,0,i))[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}var oW=function(){return{}};function aW(e){return"object"==a(e)&&null!==e}function sW(e){return"function"==typeof e}var cW=function(e,t,r,n){return void 0===n&&(n=!0),function(){for(var i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];if(!e)return oW;var a=e[t],s=r.apply(void 0,iW([a],nW(i),!1)),c=s;return sW(c)&&n&&(c=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];try{return s.apply(this,e)}catch(r){return sW(a)&&a.apply(this,e)}}),e[t]=c,function(r){r||(c===e[t]?e[t]=a:s=a)}}};function uW(){if("object"==("undefined"==typeof window?"undefined":a(window))&&aW(window))return window}var dW=function(e){if(e)return e.__SLARDAR_REGISTRY__||(e.__SLARDAR_REGISTRY__={Slardar:{plugins:[],errors:[],subject:{}}}),e.__SLARDAR_REGISTRY__.Slardar},lW=function(e,t,r,n){void 0===t&&(t={}),void 0===n&&(n=[]);try{var i=e.apply(void 0,iW([],nW(n),!1));return i&&i(t,r)||[]}catch(o){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=dW(uW());r&&(r.errors||(r.errors=[]),r.errors.push(e))}(o),[]}};function hW(e){var t=function(){if("object"==("undefined"==typeof document?"undefined":a(document))&&aW(document))return document}();return t&&e?((t=t.createElement("a")).href=e,"/"!==(e=t.pathname||"/")[0]&&(e="/"+e),{url:t.href,protocol:t.protocol.slice(0,-1),domain:t.hostname,query:t.search.substring(1),path:e,hash:t.hash}):{url:e,protocol:"",domain:"",query:"",path:"",hash:""}}function fW(e,t,r){return function(e,t){return aW(e)?rW(rW({},t),e):!!e&&t}(t=null===(e=e.config())||void 0===e?void 0:e.plugins[t],r)}var pW=["hash_0",function(e,t){var r,n=uW();n&&(n.addEventListener("hashchange",r=function(){return e(location.href)},!0),t((function(){return n.removeEventListener("hashchange",r,!0)})))}],vW=["history_0",function(e,t){var r,n,i,o=uW()&&window.history;o&&(n=function(){return e(location.href)},(r=[]).push(cW(o,"pushState",i=function(e){return function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];try{e.apply(o,t)}finally{n()}}})(),cW(o,"replaceState",i)()),window.addEventListener("popstate",n,!0),r.push((function(){return window.removeEventListener("popstate",n,!0)})),t((function(){r.forEach((function(e){return e()}))})))}],_W=function(e,t){if(void 0===e&&(e=uW()),void 0===t&&(t=uW()&&window.location),e&&t)return function(e,r){var n,i,o,a=e.sendInit,s=e.initPid,c=e.routeMode,u=e.extractPid,d=e.onPidUpdate,l=(e=e.createObserver,[]),h="manual"===c?function(){return""}:function(e){return function(t){var r;return"hash"===e?(null===(r=hW(t).hash)||void 0===r?void 0:r.replace(/^#/,""))||"/":hW(t).path}}(c),f=u||function(){},p=(s=nW(function(e,t,r,n){var i=r,o=t;return n&&n(t),[function(t,r,a){"user_set"!==t&&r!==i?(i=r,o=null!=a?a:i,n&&n(o),e(t,o)):"user_set"===t&&r!==o&&(o=r,n&&n(o),e(t,o))},function(){t&&e("init",t)}]}((function(e,t){r&&r({ev_type:"pageview",payload:{pid:t,source:e}})}),s||(n=t.href,null!==(i=f(n))&&void 0!==i?i:h(n)),h(t.href),d),2),s[0]);d=s[1],s=p.bind(null,"user_set");return"manual"!==c&&(o=nW(function(e,t){var r=t;return[function(t,n){n!==r&&e(t,r=n)}]}((function(e,t){return p(e,h(t),f(t))}),""),1)[0],e=nW(e(c),1)[0],l.push(e((function(e){return o(c,e)})))),a&&d(),[s,function(){l.forEach((function(e){return e()}))}]}},mW="pageview",yW={sendInit:!0,routeMode:"history"};var gW=tW.pageviewPlugin=function(){return{name:mW,setup:function(e){var t;(t=e).on("init",(function(){var e,r=fW(t,mW,yW);r&&(r=nW(lW(_W,rW(rW({},r),{initPid:null===(r=t.config())||void 0===r?void 0:r.pid,onPidUpdate:function(e){t.set({pid:e,viewId:e+"_"+Date.now(),actionId:void 0})},createObserver:function(e){return t.initSubject("hash"===e?pW:vW)}}),t.report.bind(t)),2),e=r[0],r=r[1],t.on("config",(function(){e(t.config().pid)})),t.on("beforeDestroy",r),t.provide("sendPageview",e))}))}}};if(!vP()&&!window.__rtc_slardar__){var SW=mK();SW("init",{aid:432410,token:"d7271e1eac254529abcffc63e36b02c3",integrations:[gW(),eW(),hK({screenshot:!1})]}),SW("start"),window.__rtc_slardar__=SW}var bW,EW=new(function(){function e(){u(this,e)}return l(e,[{key:"setStats",value:function(e){!vP()&&window.__rtc_slardar__&&Object.keys(e).forEach((function(t){window.__rtc_slardar__("context.set",t,e[t])}))}}]),e}()),kW=function(){function e(t,r){u(this,e),h(this,"_audioEventSessionId",xP()),h(this,"_videoEventSessionId",xP()),h(this,"_handler",void 0),h(this,"_stream",void 0),h(this,"_firstAudioFrameTimer",void 0),h(this,"_firstVideoFrameTimer",void 0),h(this,"_transportDelayInterval",void 0),h(this,"_transportDelay",void 0),h(this,"_firstVideoFrameInterval",void 0),h(this,"_firstAudioFrameInterval",void 0),h(this,"_isScreen",!1),h(this,"_audioFirstFrameState",0),h(this,"_videoFirstFrameState",0),h(this,"_timeout",1e4),h(this,"_currentAudioRecv",{startTime:0,eventSessionId:0,type:IB.LOGIN}),h(this,"_currentVideoRecv",{startTime:0,eventSessionId:0,type:IB.LOGIN}),h(this,"_login",!1),h(this,"_unMuteAudio",!1),h(this,"_enableAudio",!1),h(this,"_unMuteVideo",!1),h(this,"_enableVideo",!1),h(this,"_remoteUnmuteAudio",!1),h(this,"_remoteUnmuteVideo",!1),h(this,"_audioExternal",!1),h(this,"_pushAudio",!1),h(this,"_videoExternal",!1),h(this,"_pushVideo",!1),h(this,"_autoSubscribeVideo",!1),h(this,"_autoSubscribeAudio",!1),h(this,"_autoSubscribe",!1),h(this,"_publishVideo",!1),h(this,"_publishAudio",!1),h(this,"_subscribeAudio",!1),h(this,"_subscribeVideo",!1),h(this,"_subscribe",!1),h(this,"_pushTrack",!1),h(this,"_multiChatMode",!1),this._stream=t,this._handler=r,this.getTransportDelay()}var t,r,n,i;return l(e,[{key:"beginRecvFrame",value:(i=c(o().mark((function e(t,r){var n,i,a,s,c,u,d,l,h,f,p,v,_,m=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getTransportDelay();case 2:n=this._transportDelay,i=!0,a=IB.LOGIN,s=IB.UNMUTE,c=IB.SUBSCRIBE,u=IB.PUSH_TRACK,[a,s,c,u].indexOf(r)>=0&&(n=0,i=!1),t===TB.AUDIO?(i||this._audioEventSessionId++,this._currentAudioRecv={startTime:Date.now(),eventSessionId:this._audioEventSessionId,type:r},h={media_type:t,event_type:kB.BEGIN_RECV,type:r,start:null===(d=this._currentAudioRecv)||void 0===d?void 0:d.startTime,event_session_id:this._audioEventSessionId,stream_user_id:null===(l=this._stream)||void 0===l?void 0:l.userId,transport_delay:n},this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),this._firstAudioFrameTimer=window.setTimeout((function(){m.stopRecvFrame(TB.AUDIO,AB.TIMEOUT),m._firstAudioFrameInterval&&window.clearInterval(m._firstAudioFrameInterval)}),this._timeout),MB.rtcFirstFrame(h),this._watchForFirstAudioFrameRecv(),this._audioFirstFrameState=1,this._login=!0,this._unMuteAudio=!0,this._enableAudio=!0,this._remoteUnmuteAudio=!0):t===TB.VIDEO&&(i||this._videoEventSessionId++,this._currentVideoRecv={startTime:Date.now(),eventSessionId:this._videoEventSessionId,type:r},_={media_type:null!==(f=this._stream)&&void 0!==f&&f.isScreen?TB.SCREEN_VIDEO:t,event_type:kB.BEGIN_RECV,type:r,start:null===(p=this._currentVideoRecv)||void 0===p?void 0:p.startTime,event_session_id:this._videoEventSessionId,stream_user_id:null===(v=this._stream)||void 0===v?void 0:v.userId,transport_delay:n},this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),this._firstVideoFrameTimer=window.setTimeout((function(){m.stopRecvFrame(TB.VIDEO,AB.TIMEOUT),m._firstVideoFrameInterval&&window.clearInterval(m._firstVideoFrameInterval)}),this._timeout),this._watchForFirstVideoFrameRecv(),MB.rtcFirstFrame(_),this._videoFirstFrameState=1,this._login=!0,this._unMuteVideo=!0,this._enableVideo=!0,this._remoteUnmuteVideo=!0);case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return i.apply(this,arguments)})},{key:"stopRecvFrame",value:function(e,t){if(e===TB.AUDIO){var r,n,i;if(1!==this._audioFirstFrameState)return;var o={event_type:kB.RECV_END,media_type:e,start:null===(r=this._currentAudioRecv)||void 0===r?void 0:r.startTime,reason:t,result:!1,stream_user_id:null===(n=this._stream)||void 0===n?void 0:n.userId,event_session_id:this._audioEventSessionId,type:null===(i=this._currentAudioRecv)||void 0===i?void 0:i.type};this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),delete this._currentAudioRecv,MB.rtcFirstFrame(o),this._audioFirstFrameState=2}else if(e===TB.VIDEO){var a,s,c,u;if(1!==this._videoFirstFrameState)return;var d={event_type:kB.RECV_END,media_type:null!==(a=this._stream)&&void 0!==a&&a.isScreen?TB.SCREEN_VIDEO:e,start:null===(s=this._currentVideoRecv)||void 0===s?void 0:s.startTime,reason:t,result:!1,stream_user_id:null===(c=this._stream)||void 0===c?void 0:c.userId,event_session_id:this._videoEventSessionId,type:null===(u=this._currentVideoRecv)||void 0===u?void 0:u.type};this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),delete this._currentVideoRecv,MB.rtcFirstFrame(d),this._videoFirstFrameState=2}}},{key:"recvFrameFinish",value:(n=c(o().mark((function e(t){var r,n,i,a,s,c,u,d,l,h,f,p,v,_,m,y;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getTransportDelay();case 2:if(r=this._transportDelay,n=IB.LOGIN,i=IB.UNMUTE,a=IB.SUBSCRIBE,s=IB.PUSH_TRACK,t!==TB.AUDIO){e.next=18;break}if(1===this._audioFirstFrameState){e.next=7;break}return e.abrupt("return");case 7:if(this._currentAudioRecv){e.next=9;break}return e.abrupt("return");case 9:u=this._currentAudioRecv,d=u.type,l=u.startTime,[n,i,a,s].indexOf(d)>=0&&(r=0),h={event_type:kB.RECV_END,media_type:t,start:l,result:!0,stream_user_id:null===(c=this._stream)||void 0===c?void 0:c.userId,event_session_id:this._audioEventSessionId,type:d,transport_delay:r},delete this._currentAudioRecv,this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),MB.rtcFirstFrame(h),this._audioFirstFrameState=3,e.next=30;break;case 18:if(t!==TB.VIDEO){e.next=30;break}if(1===this._videoFirstFrameState){e.next=21;break}return e.abrupt("return");case 21:if(this._currentVideoRecv){e.next=23;break}return e.abrupt("return");case 23:v=this._currentVideoRecv,_=v.type,m=v.startTime,[n,i,a,s].indexOf(_)>=0&&(r=0),y={event_type:kB.RECV_END,media_type:null!==(f=this._stream)&&void 0!==f&&f.isScreen?TB.SCREEN_VIDEO:t,start:m,result:!0,stream_user_id:null===(p=this._stream)||void 0===p?void 0:p.userId,event_session_id:this._videoEventSessionId,type:_,transport_delay:r},delete this._currentVideoRecv,this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),MB.rtcFirstFrame(y),this._videoFirstFrameState=3;case 30:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"setLogin",value:function(e){var t,r,n,i,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{audio:!0,video:!0};this._login!==e&&(this._login=e,e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&o.audio&&this.beginRecvFrame(TB.AUDIO,IB.LOGIN),e&&null!==(r=this._stream)&&void 0!==r&&r.hasVideo&&o.video&&this.beginRecvFrame(TB.VIDEO,IB.LOGIN),!e&&null!==(n=this._stream)&&void 0!==n&&n.hasAudio&&this.stopRecvFrame(TB.AUDIO,AB.LEAVE_ROOM),!e&&null!==(i=this._stream)&&void 0!==i&&i.hasVideo&&this.stopRecvFrame(TB.VIDEO,AB.LEAVE_ROOM))}},{key:"setUnmuteAudio",value:function(e){var t;this._unMuteAudio!==e&&(this._unMuteAudio=e,this._unMuteAudio?this.beginRecvFrame(TB.AUDIO,IB.UNMUTE):null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(TB.AUDIO,AB.MUTE))}},{key:"setRemoteUnmuteAudio",value:function(e){var t;this._remoteUnmuteAudio!==e&&(this._remoteUnmuteAudio=e,this._remoteUnmuteAudio?this.beginRecvFrame(TB.AUDIO,IB.REMOTE_UNMUTE):null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(TB.AUDIO,AB.REMOTE_MUTE))}},{key:"setEnableAudio",value:function(e){var t;this._enableAudio!==e&&(this._enableAudio=e,this._enableAudio?this.beginRecvFrame(TB.AUDIO,IB.ENABLE):null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(TB.AUDIO,AB.DISABLE))}},{key:"setUnmuteVideo",value:function(e){var t;this._unMuteVideo!==e&&(this._unMuteVideo=e,this._unMuteVideo?this.beginRecvFrame(TB.VIDEO,IB.UNMUTE):null!==(t=this._stream)&&void 0!==t&&t.hasVideo&&this.stopRecvFrame(TB.VIDEO,AB.MUTE))}},{key:"setRemoteUnmuteVideo",value:function(e){var t;this._remoteUnmuteVideo!==e&&(this._remoteUnmuteVideo=e,this._remoteUnmuteVideo?this.beginRecvFrame(TB.VIDEO,IB.REMOTE_UNMUTE):null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(TB.VIDEO,AB.REMOTE_MUTE))}},{key:"setEnableVideo",value:function(e){this._enableVideo!==e&&(this._enableVideo=e,this._enableVideo?this.beginRecvFrame(TB.VIDEO,IB.ENABLE):this.stopRecvFrame(TB.VIDEO,AB.DISABLE))}},{key:"setExternalAudioSource",value:function(e){this._audioExternal=e}},{key:"setPushAudio",value:function(e){var t;this._audioExternal&&this._pushAudio!==e&&(this._pushAudio=e),this._pushAudio&&this.beginRecvFrame(TB.AUDIO,IB.PUSH),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.beginRecvFrame(TB.AUDIO,IB.PUSH)}},{key:"setExternalVideoSource",value:function(e){this._videoExternal=e}},{key:"setPushVideo",value:function(e){var t;this._videoExternal&&this._pushVideo!==e&&(this._pushVideo=e),this._pushVideo&&this.beginRecvFrame(TB.VIDEO,IB.PUSH),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasVideo&&this.beginRecvFrame(TB.VIDEO,IB.PUSH)}},{key:"setPublishVideo",value:function(e){var t;this._publishVideo!==e&&(this._publishVideo=e),this._publishVideo&&this.beginRecvFrame(TB.VIDEO,IB.PUBLISH),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasVideo&&this.stopRecvFrame(TB.VIDEO,AB.UNPUBLISH)}},{key:"setPublishAudio",value:function(e){var t;this._publishAudio!==e&&(this._publishAudio=e),this._publishAudio&&this.beginRecvFrame(TB.AUDIO,IB.PUBLISH),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(TB.AUDIO,AB.UNPUBLISH)}},{key:"setAutoSubscribe",value:function(e){this._autoSubscribe=e}},{key:"setAutoSubscribeVideo",value:function(e){this._autoSubscribeVideo=e}},{key:"setAutoSubscribeAudio",value:function(e){this._autoSubscribeAudio=e}},{key:"setSubscribeAudio",value:function(e){var t,r;this._autoSubscribeAudio||this._subscribeAudio===e||(this._subscribe=e,e&&null!==(r=this._stream)&&void 0!==r&&r.hasAudio&&this.beginRecvFrame(TB.AUDIO,IB.SUBSCRIBE));!e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(TB.AUDIO,AB.UNSUBSCRIBE)}},{key:"setSubscribeVideo",value:function(e){var t,r;this._autoSubscribeVideo||this._subscribeVideo===e||(this._subscribeVideo=e,e&&null!==(r=this._stream)&&void 0!==r&&r.hasVideo&&this.beginRecvFrame(TB.VIDEO,IB.SUBSCRIBE));!e&&null!==(t=this._stream)&&void 0!==t&&t.hasVideo&&this.stopRecvFrame(TB.VIDEO,AB.UNSUBSCRIBE)}},{key:"setPushTrack",value:function(e){var t;this._pushTrack!==e&&(e&&!this._isScreen&&this.beginRecvFrame(TB.AUDIO,IB.PUSH_TRACK),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(TB.AUDIO,AB.REMOVE_TRACK))}},{key:"setMultiChatMode",value:function(e){this._multiChatMode=e}},{key:"setTimeout",value:function(e){this._timeout=e}},{key:"_watchForFirstVideoFrameRecv",value:function(){var e=this,t=-1,r=-1;this._firstVideoFrameInterval&&window.clearInterval(this._firstVideoFrameInterval),this._firstVideoFrameInterval=window.setInterval(c(o().mark((function n(){var i,a,s,c,u,d,l,h;return o().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(null===(i=e._handler)||void 0===i||!i.pc||null===(a=e._stream)||void 0===a||null===(s=a.videoTrack)||void 0===s||!s.getTrack()){n.next=12;break}return n.next=3,jj(null===(c=e._handler)||void 0===c?void 0:c.pc,null===(u=e._stream)||void 0===u||null===(d=u.videoTrack)||void 0===d?void 0:d.getTrack());case 3:if(l=n.sent,!(h=l.find((function(e){return"inbound-rtp"===e.type})))||!(h.framesReceived>t||h.packetsReceived>r)){n.next=12;break}if(-1!==t||-1!==r){n.next=10;break}return t=h.framesReceived,r=h.packetsReceived,n.abrupt("return");case 10:e.recvFrameFinish(TB.VIDEO),window.clearInterval(e._firstVideoFrameInterval);case 12:case"end":return n.stop()}}),n)}))),200)}},{key:"_watchForFirstAudioFrameRecv",value:function(){var e=this,t=-1,r=-1;this._firstAudioFrameInterval&&window.clearInterval(this._firstAudioFrameInterval),this._firstAudioFrameInterval=window.setInterval(c(o().mark((function n(){var i,a,s,c,u,d,l,h;return o().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(null===(i=e._handler)||void 0===i||!i.pc||null===(a=e._stream)||void 0===a||null===(s=a.audioTrack)||void 0===s||!s.getTrack()){n.next=12;break}return n.next=3,jj(null===(c=e._handler)||void 0===c?void 0:c.pc,null===(u=e._stream)||void 0===u||null===(d=u.audioTrack)||void 0===d?void 0:d.getTrack());case 3:if(l=n.sent,!(h=l.find((function(e){return"inbound-rtp"===e.type})))||!(h.totalSamplesReceived>t||h.packetsReceived>r)){n.next=12;break}if(-1!==t||-1!==r){n.next=10;break}return t=h.totalSamplesReceived,r=h.packetsReceived,n.abrupt("return");case 10:e.recvFrameFinish(TB.AUDIO),window.clearInterval(e._firstAudioFrameInterval);case 12:case"end":return n.stop()}}),n)}))),200)}},{key:"getTransportDelay",value:(r=c(o().mark((function e(){var t=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getTransportDelayIntl();case 2:window.clearInterval(this._transportDelayInterval),this._transportDelayInterval=window.setInterval(c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getTransportDelayIntl();case 2:case"end":return e.stop()}}),e)}))),2e3);case 4:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"getTransportDelayIntl",value:(t=c(o().mark((function e(){var t,r,n,i,a;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null===(t=this._handler)||void 0===t||!t.pc){e.next=7;break}return e.next=3,jj(null===(r=this._handler)||void 0===r?void 0:r.pc);case 3:n=e.sent,i=n.find((function(e){return"transport"===e.type&&"connected"===e.dtlsState})),(a=n.find((function(e){return"candidate-pair"===e.type&&"succeeded"===e.state&&e.id===(null==i?void 0:i.selectedCandidatePairId)})))&&(this._transportDelay=Math.round(1e3*a.currentRoundTripTime/2));case 7:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"reset",value:function(){this._currentAudioRecv={startTime:0,eventSessionId:0,type:IB.LOGIN},this._currentVideoRecv={startTime:0,eventSessionId:0,type:IB.LOGIN},this._login=!1,this._unMuteAudio=!1,this._enableAudio=!1,this._unMuteVideo=!1,this._remoteUnmuteAudio=!1,this._remoteUnmuteVideo=!1,this._enableVideo=!1,this._audioExternal=!1,this._pushAudio=!1,this._videoExternal=!1,this._pushVideo=!1,this._autoSubscribeVideo=!1,this._autoSubscribeAudio=!1,this._autoSubscribe=!1,this._subscribeAudio=!1,this._subscribeVideo=!1,this._subscribe=!1,this._pushTrack=!1,this._multiChatMode=!1,this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),this._firstAudioFrameInterval&&window.clearInterval(this._firstAudioFrameInterval),this._firstVideoFrameInterval&&window.clearInterval(this._firstVideoFrameInterval),this._transportDelayInterval&&window.clearInterval(this._transportDelayInterval)}}]),e}(),TW=function(){function e(t,r){u(this,e),h(this,"_audioEventSessionId",xP()),h(this,"_videoEventSessionId",xP()),h(this,"_pcSessionId",void 0),h(this,"_handler",void 0),h(this,"_firstAudioFrameTimer",void 0),h(this,"_firstVideoFrameTimer",void 0),h(this,"_stream",void 0),h(this,"_firstVideoFrameInterval",void 0),h(this,"_firstAudioFrameInterval",void 0),h(this,"_currentAudioSend",{startTime:0,eventSessionId:0,type:IB.LOGIN}),h(this,"_currentVideoSend",{startTime:0,eventSessionId:0,type:IB.LOGIN}),h(this,"_login",!1),h(this,"_publisher",!1),h(this,"_unMuteAudio",!1),h(this,"_enableAudio",!1),h(this,"_unMuteVideo",!1),h(this,"_enableVideo",!1),h(this,"_audioExternal",!1),h(this,"_pushAudio",!1),h(this,"_videoExternal",!1),h(this,"_pushVideo",!1),h(this,"_autoPublish",!1),h(this,"_publish",!1),h(this,"_timeout",1e4),h(this,"_audioFirstFrameState",0),h(this,"_videoFirstFrameState",0),this._stream=t,this._handler=r}var t,r;return l(e,[{key:"beginSendFrame",value:function(e,t){var r=this;if(e===TB.AUDIO){var n;this._audioEventSessionId++,this._currentAudioSend={startTime:Date.now(),eventSessionId:this._audioEventSessionId,type:t};var i={media_type:e,event_type:kB.BEGIN_SEND,type:t,start:null===(n=this._currentAudioSend)||void 0===n?void 0:n.startTime,event_session_id:this._audioEventSessionId};this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),this._firstAudioFrameTimer=window.setTimeout((function(){r.stopSendFrame(TB.AUDIO,AB.TIMEOUT),r._firstAudioFrameInterval&&window.clearInterval(r._firstAudioFrameInterval)}),this._timeout),MB.rtcFirstFrame(i),this._watchForFirstAudioFrameSend(),this._audioFirstFrameState=1,this._login=!0,this._publisher=!0,this._publish=!0,this._unMuteAudio=!0,this._pushAudio||(this._enableAudio=!0)}else if(e===TB.VIDEO){var o,a;this._videoEventSessionId++,this._currentVideoSend={startTime:Date.now(),eventSessionId:this._videoEventSessionId,type:t};var s={media_type:null!==(o=this._stream)&&void 0!==o&&o.isScreen?TB.SCREEN_VIDEO:e,event_type:kB.BEGIN_SEND,type:t,start:null===(a=this._currentVideoSend)||void 0===a?void 0:a.startTime,event_session_id:this._videoEventSessionId};this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),this._firstVideoFrameTimer=window.setTimeout((function(){r.stopSendFrame(TB.VIDEO,AB.TIMEOUT),r._firstVideoFrameInterval&&window.clearInterval(r._firstVideoFrameInterval)}),this._timeout),this._watchForFirstVideoFrameSend(),MB.rtcFirstFrame(s),this._videoFirstFrameState=1,this._login=!0,this._publisher=!0,this._publish=!0,this._unMuteVideo=!0,this._pushVideo||(this._enableVideo=!0)}}},{key:"stopSendFrame",value:function(e,t){if(e===TB.AUDIO){var r,n;if(1!==this._audioFirstFrameState)return;var i={event_type:kB.SENT_END,media_type:e,start:null===(r=this._currentAudioSend)||void 0===r?void 0:r.startTime,reason:t,result:!1,event_session_id:this._audioEventSessionId,type:null===(n=this._currentAudioSend)||void 0===n?void 0:n.type};this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),delete this._currentAudioSend,MB.rtcFirstFrame(i),this._audioFirstFrameState=2}else if(e===TB.VIDEO){var o,a,s;if(1!==this._videoFirstFrameState)return;var c={event_type:kB.SENT_END,media_type:null!==(o=this._stream)&&void 0!==o&&o.isScreen?TB.SCREEN_VIDEO:e,start:null===(a=this._currentVideoSend)||void 0===a?void 0:a.startTime,reason:t,result:!1,event_session_id:this._videoEventSessionId,type:null===(s=this._currentVideoSend)||void 0===s?void 0:s.type};this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),delete this._currentVideoSend,MB.rtcFirstFrame(c),this._videoFirstFrameState=2}}},{key:"sendFrameFinish",value:function(e){if(e===TB.AUDIO){if(1!==this._audioFirstFrameState)return;if(!this._currentAudioSend)return;var t=this._currentAudioSend,r=t.type,n=t.startTime,i={event_type:kB.SENT_END,media_type:e,start:n,result:!0,event_session_id:this._audioEventSessionId,type:r};delete this._currentAudioSend,this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),MB.rtcFirstFrame(i),this._audioFirstFrameState=3}else if(e===TB.VIDEO){var o;if(1!==this._videoFirstFrameState)return;if(!this._currentVideoSend)return;var a=this._currentVideoSend,s=a.type,c=a.startTime,u={event_type:kB.SENT_END,media_type:null!==(o=this._stream)&&void 0!==o&&o.isScreen?TB.SCREEN_VIDEO:e,start:c,result:!0,event_session_id:this._videoEventSessionId,type:s};delete this._currentVideoSend,this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),MB.rtcFirstFrame(u),this._videoFirstFrameState=3}}},{key:"setLogin",value:function(e){if(this._login!==e){var t,r;if(this._login=e,e)null!==(t=this._stream)&&void 0!==t&&t.videoTrack&&this.beginSendFrame(TB.VIDEO,IB.LOGIN),null!==(r=this._stream)&&void 0!==r&&r.audioTrack&&this.beginSendFrame(TB.AUDIO,IB.LOGIN);!e&&this._audioSending&&this.stopSendFrame(TB.AUDIO,AB.LEAVE_ROOM),!e&&this._videoSending&&this.stopSendFrame(TB.VIDEO,AB.LEAVE_ROOM)}}},{key:"setPublish",value:function(e){if(this._publish!==e){var t,r;if(this._publish=e,e)(null===(t=this._stream)||void 0===t?void 0:t.videoTrack)&&this.beginSendFrame(TB.VIDEO,IB.PUBLISH),(null===(r=this._stream)||void 0===r?void 0:r.audioTrack)&&this.beginSendFrame(TB.AUDIO,IB.PUBLISH);!e&&this._audioSending&&this.stopSendFrame(TB.AUDIO,AB.UNPUBLISH),!e&&this._videoSending&&this.stopSendFrame(TB.VIDEO,AB.UNPUBLISH)}}},{key:"setUnmuteAudio",value:function(e){this._unMuteAudio!==e&&(this._unMuteAudio=e,e&&this.beginSendFrame(TB.AUDIO,IB.UNMUTE),!e&&this._audioSending&&this.stopSendFrame(TB.AUDIO,AB.MUTE))}},{key:"setEnableAudio",value:function(e){this._enableAudio!==e&&(this._enableAudio=e,e&&this.beginSendFrame(TB.AUDIO,IB.ENABLE),!e&&this._audioSending&&this.stopSendFrame(TB.AUDIO,AB.DISABLE))}},{key:"setUnmuteVideo",value:function(e){this._unMuteVideo!==e&&(this._unMuteVideo=e,e&&this.beginSendFrame(TB.VIDEO,IB.UNMUTE),!e&&this._videoSending&&this.stopSendFrame(TB.VIDEO,AB.MUTE))}},{key:"setEnableVideo",value:function(e){this._enableVideo!==e&&(this._enableVideo=e,e&&this.beginSendFrame(TB.VIDEO,IB.ENABLE),!e&&this._videoSending&&this.stopSendFrame(TB.VIDEO,AB.DISABLE))}},{key:"setExternalAudioSource",value:function(e){this._audioExternal!==e&&(this._audioExternal=e,e&&(this._audioSending&&this.stopSendFrame(TB.AUDIO,AB.DISABLE),this._enableAudio=!1),e||(this._audioSending&&this.stopSendFrame(TB.AUDIO,AB.STOP_PUSH),this._pushAudio=!1))}},{key:"setPushAudio",value:function(e){this._pushAudio!==e&&(this._pushAudio=e,e&&this.beginSendFrame(TB.AUDIO,IB.PUSH),!e&&this._audioSending&&this.stopSendFrame(TB.AUDIO,AB.STOP_PUSH))}},{key:"setExternalVideoSource",value:function(e){this._videoExternal!==e&&(this._videoExternal=e,e&&(this._videoSending&&this.stopSendFrame(TB.VIDEO,AB.DISABLE),this._enableVideo=!1),e||(this._videoSending&&this.stopSendFrame(TB.VIDEO,AB.STOP_PUSH),this._pushVideo=!1))}},{key:"setPushVideo",value:function(e){this._pushVideo!==e&&(this._pushVideo=e,e&&this.beginSendFrame(TB.VIDEO,IB.PUSH),!e&&this._videoSending&&this.stopSendFrame(TB.VIDEO,AB.STOP_PUSH))}},{key:"setAutoPublish",value:function(e){this._autoPublish=e}},{key:"setPublisher",value:function(e){this._publisher!==e&&(this._publisher=e,!e&&this._audioSending&&this.stopSendFrame(TB.AUDIO,AB.AUDIENCE),!e&&this._videoSending&&this.stopSendFrame(TB.VIDEO,AB.AUDIENCE))}},{key:"setTimeout",value:function(e){this._timeout=e}},{key:"setPCSessionId",value:function(e){this._pcSessionId=e}},{key:"setHandler",value:function(e){this._handler=e}},{key:"_getFirstVideoFrameStats",value:(r=c(o().mark((function e(){var t,r,n,i,a,s,c,u;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null===(t=this._handler)||void 0===t||!t.pc||null===(r=this._stream)||void 0===r||null===(n=r.videoTrack)||void 0===n||!n.getTrack("preprocessing")){e.next=6;break}return e.next=3,jj(null===(i=this._handler)||void 0===i?void 0:i.pc,null===(a=this._stream)||void 0===a||null===(s=a.videoTrack)||void 0===s?void 0:s.getTrack("preprocessing"));case 3:return c=e.sent,u=c.find((function(e){return"outbound-rtp"===e.type})),e.abrupt("return",u);case 6:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"_getFirstAudioFrameStats",value:(t=c(o().mark((function e(){var t,r,n,i,a,s,c,u;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null===(t=this._handler)||void 0===t||!t.pc||null===(r=this._stream)||void 0===r||null===(n=r.audioTrack)||void 0===n||!n.getTrack("preprocessing")){e.next=6;break}return e.next=3,jj(null===(i=this._handler)||void 0===i?void 0:i.pc,null===(a=this._stream)||void 0===a||null===(s=a.audioTrack)||void 0===s?void 0:s.getTrack("preprocessing"));case 3:return c=e.sent,u=c.find((function(e){return"outbound-rtp"===e.type})),e.abrupt("return",u);case 6:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"_watchForFirstVideoFrameSend",value:function(){var e=this,t=-1,r=-1;this._firstVideoFrameInterval&&window.clearInterval(this._firstVideoFrameInterval),this._firstVideoFrameInterval=window.setInterval(c(o().mark((function n(){var i;return o().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,e._getFirstVideoFrameStats();case 2:if(!(i=n.sent)||!(i.framesSent>t||i.packetsSent>r)){n.next=10;break}if(-1!==t||-1!==r){n.next=8;break}return t=i.framesSent,r=i.packetsSent,n.abrupt("return");case 8:e.sendFrameFinish(TB.VIDEO),window.clearInterval(e._firstVideoFrameInterval);case 10:case"end":return n.stop()}}),n)}))),100)}},{key:"_watchForFirstAudioFrameSend",value:function(){var e=this,t=-1;this._firstAudioFrameInterval&&window.clearInterval(this._firstAudioFrameInterval),this._firstAudioFrameInterval=window.setInterval(c(o().mark((function r(){var n;return o().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,e._getFirstAudioFrameStats();case 2:if(!((n=r.sent)&&n.packetsSent>t)){r.next=9;break}if(-1!==t){r.next=7;break}return t=n.packetsSent,r.abrupt("return");case 7:e.sendFrameFinish(TB.AUDIO),window.clearInterval(e._firstAudioFrameInterval);case 9:case"end":return r.stop()}}),r)}))),100)}},{key:"reset",value:function(){this._login=!1,this._publisher=!1,this._unMuteAudio=!1,this._enableAudio=!1,this._unMuteVideo=!1,this._enableVideo=!1,this._audioExternal=!1,this._pushAudio=!1,this._videoExternal=!1,this._pushVideo=!1,this._autoPublish=!1,this._publish=!1,this._audioFirstFrameState=0,this._videoFirstFrameState=0,this._currentAudioSend={startTime:0,eventSessionId:0,type:IB.LOGIN},this._currentVideoSend={startTime:0,eventSessionId:0,type:IB.LOGIN},window.clearTimeout(this._firstAudioFrameTimer),window.clearTimeout(this._firstVideoFrameTimer),window.clearInterval(this._firstAudioFrameInterval),window.clearInterval(this._firstVideoFrameInterval)}},{key:"destroy",value:function(){this.reset(),delete this._stream,delete this._handler}},{key:"_audioSending",get:function(){return 1===this._audioFirstFrameState}},{key:"_videoSending",get:function(){return 1===this._videoFirstFrameState}}]),e}(),IW=(h(bW={},"audio",{delay:1200,stallRadio:.3}),h(bW,"video",{delay:1200,stallRadio:.6}),h(bW,"screen_audio",{delay:1600,stallRadio:.8}),h(bW,"screen_video",{delay:1600,stallRadio:.8}),bW),AW=function(){function e(){u(this,e),h(this,"_preUplinkStats",new Map),h(this,"_preDownlinkStats",new Map),h(this,"_timer",void 0),h(this,"_delayTimer",void 0),h(this,"_connectionState",mX.CONNECTED),h(this,"reportor",void 0)}return l(e,[{key:"updateUplinkStats",value:function(e){var t=e.audioStats,r=e.videoStats,n=e.isScreen;if(t.sendKBitrate>0&&t.rtt){var i=n?"screen_audio":"audio",o=t.rtt,a=t._fractionLost,s=t._retransmittedRate,c=this._getQosLevel(o,a||0,s||0),u=this._preUplinkStats.get(i)||[c];this._preUplinkStats.set(i,[].concat(k(u),[c]).slice(-2))}if(r.sentKBitrate>0&&r.rtt){var d=n?"screen_video":"video",l=r._fractionLost,h=r.rtt,f=r._sendBandWidth,p=r._retransmittedRate;0===f&&(l=Math.max(.65,l));var v=this._getQosLevel(h,l||0,p||0),_=this._preUplinkStats.get(d)||[v];this._preUplinkStats.set(d,[].concat(k(_),[v]).slice(-2))}this._startNetworkQualityReport()}},{key:"updateDownlinkStats",value:function(e,t){if(t){var r,n,i=this._getStreamActiveState(t),o=i.audioActive,a=i.videoActive,s=e.audioStats,c=e.videoStats,u=e.isScreen,d=e.userId;if(o)if(0===s.receivedKBitrate)r=q.VBAD;else{var l=s.rtt,h=s.audioLossRate,f=s.stallDuration,p=s.statsInterval,v=s.e2eDelay,_=f/p,m=u?"screen_audio":"audio",y=this._getQosLevel(l,h||0,c._retransmittedRate||0),g=this._getDownlinkQoE(m,_,v);r=this._getNetworkQuality(y,g)}if(a)if(0===c.receivedKBitrate||0===c.rtt)n=q.VBAD;else{var S=c.rtt,b=c.videoLossRate,E=c.stallDuration,T=c.statsInterval,I=c.e2eDelay,A=c._retransmittedRate,R=E/T,w=u?"screen_video":"video",C=this._getQosLevel(S,b||0,A||0),O=this._getDownlinkQoE(w,R,I);n=this._getNetworkQuality(C,O)}var x=r&&n?Math.ceil((r+n)/2):r||n;if(x){var D="".concat(d).concat(u?"_screen":""),N=this._preDownlinkStats.get(D)||[x];this._preDownlinkStats.set(D,[].concat(k(N),[x]).slice(-2)),this._startNetworkQualityReport()}}}},{key:"setConnectionState",value:function(e){this._connectionState=e}},{key:"destroy",value:function(){this._timer&&(window.clearInterval(this._timer),delete this._timer),this._delayTimer&&(window.clearTimeout(this._delayTimer),delete this._delayTimer),this._preUplinkStats.clear(),this._preDownlinkStats.clear()}},{key:"_startNetworkQualityReport",value:function(){var e=this;this._delayTimer||this._timer||(this._preUplinkStats.size>0||this._preDownlinkStats.size>0)&&(this._delayTimer=window.setTimeout((function(){delete e._delayTimer,e._reportNetworkQuality(),e._timer=window.setInterval((function(){e._reportNetworkQuality()}),2e3)}),300))}},{key:"_reportNetworkQuality",value:function(){var e,t,r=this;if(this._connectionState!==mX.CONNECTED)e=t=q.VBAD;else{var n=this._getBetterQualityAndRemoveOldest("audio","up"),i=this._getBetterQualityAndRemoveOldest("video","up");e=n&&i?Math.ceil((n+i)/2):n||i||this._getBetterQualityAndRemoveOldest("screen_video","up")||this._getBetterQualityAndRemoveOldest("screen_audio","up")||q.EXCELLENT;var o=Array.from(this._preDownlinkStats.keys()).map((function(e){return r._getBetterQualityAndRemoveOldest(e,"down")})).filter((function(e){return e}));t=Math.ceil(o.reduce((function(e,t){return t+e}),0)/o.length)||q.UNKNOWN}"function"==typeof this.reportor&&this.reportor(e,t)}},{key:"_getNetworkQuality",value:function(e,t){return 1===t?Math.max(e-2,1):2===t?e:Math.min(e+1,5)}},{key:"_getQosLevel",value:function(e,t,r){var n;return n=(!e||e<=250)&&t<=.15?1:(!e||e<=500)&&t<=.3?2:(!e||e<=750)&&t<=.45?3:(!e||e<=1e3)&&t<=.6?4:5,r>.5?n=Math.max(n,4):r>.35?n=Math.max(n,3):r>.15&&(n=Math.max(n,2)),n}},{key:"_getUplinkQoE",value:function(e,t){var r=0;switch(e){case"audio":case"video":r=t<.05?1:t<.1?2:3;break;case"screen_video":case"screen_audio":r=t<.04?1:t<.08?2:3}return r}},{key:"_getDownlinkQoE",value:function(e,t,r){var n=IW[e];return t>n.stallRadio||r>n.delay||t>n.stallRadio/2&&r>n.delay/2?3:(t>n.stallRadio/2||n.delay,2)}},{key:"_getBetterQualityAndRemoveOldest",value:function(e,t){var r=q.UNKNOWN,n="up"===t?this._preUplinkStats:this._preDownlinkStats,i=n.get(e);if(i){var o=i.filter((function(e){return e}));o.length>0&&(r=Math.min.apply(Math,k(o))),i.shift(),0===i.length&&n.delete(e)}return r}},{key:"_getStreamActiveState",value:function(e){var t=e.subMediaType,r=e._attributes,n=e.subVideo;return{audioActive:e.subAudio&&UP(t)&&r.localaudio&&r.audiostream,videoActive:n&&VP(t)&&r.localvideo&&r.videostream}}}]),e}(),RW=function(){function e(t){u(this,e),h(this,"_timer",void 0),h(this,"_remoteVideoSizeCache",{}),h(this,"_remoteScreenSizeCache",{}),h(this,"onchange",void 0),this._room=t,this._start()}return l(e,[{key:"destroy",value:function(){this._timer&&(window.clearInterval(this._timer),delete this._timer),this._remoteVideoSizeCache={},this._remoteScreenSizeCache={}}},{key:"_start",value:function(){var e=this;this._timer||(this._timer=window.setInterval((function(){var t={},r={};e._room.remoteStreams.forEach((function(n,i){n.forEach((function(n){var o,a=null===(o=n.videoTrack)||void 0===o?void 0:o.getTrack();if(a){var s=n.isScreen?e._remoteScreenSizeCache:e._remoteVideoSizeCache,c=s[i]||{},u=c.width,d=void 0===u?0:u,l=c.height,h=void 0===l?0:l,f=a.getSettings(),p=f.width,v=void 0===p?0:p,_=f.height,m=void 0===_?0:_;h===m&&d===v||"function"==typeof e.onchange&&e.onchange(i,n.isScreen,v,m),delete s[i],(n.isScreen?r:t)[i]={width:v,height:m}}}))})),Object.keys(e._remoteVideoSizeCache).forEach((function(t){"function"==typeof e.onchange&&e.onchange(t,!1,0,0)})),Object.keys(e._remoteScreenSizeCache).forEach((function(t){"function"==typeof e.onchange&&e.onchange(t,!0,0,0)})),e._remoteVideoSizeCache=t,e._remoteScreenSizeCache=r}),1e3))}}]),e}(),wW=new JL("SubscribeFallbackManager",2),CW=1e4,OW=function(){function e(t){u(this,e),h(this,"_preDownlinkNetworkQuality",[]),h(this,"_isSubscribeFallbackOrRecover",!1),h(this,"_inSubscribeRecoverChecking",!1),h(this,"_subRecoverCheckTimer",void 0),h(this,"_forbidSubRecover",!1),h(this,"_forbidSubRecoverTimer",void 0),h(this,"_forbidSubRecoverDuration",CW),h(this,"onSubscribeFallback",void 0),this._room=t}var t;return l(e,[{key:"updateNetworkQuality",value:function(e,t){this._preDownlinkNetworkQuality.push(t),this._preDownlinkNetworkQuality=this._preDownlinkNetworkQuality.slice(-10),this._inSubscribeRecoverChecking&&this._preDownlinkNetworkQuality.find((function(e){return e===q.BAD||e===q.VBAD}))&&this._startForbidSubRecover(),this._preDownlinkNetworkQuality.slice(-3).reduce((function(e,t){return e+t}),0)>3*q.POOR&&this._subscribeFallbackOrRecover("fallback"),!this._forbidSubRecover&&10===this._preDownlinkNetworkQuality.length&&this._preDownlinkNetworkQuality.every((function(e){return e===q.EXCELLENT}))&&this._subscribeFallbackOrRecover("recover")}},{key:"destroy",value:function(){this._stopSubscribeRecoverCheck(),this._stopForbidSubRecover(),delete this.onSubscribeFallback}},{key:"_subscribeFallbackOrRecover",value:(t=c(o().mark((function e(t){var r,n,i,a,s,c,u,d,l,h,f=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._isSubscribeFallbackOrRecover&&this._room.connectionState===mX.CONNECTED){e.next=2;break}return e.abrupt("return");case 2:if(this._room.subscribeFallbackOption!==X.AUDIO_ONLY&&this._room.subscribeFallbackOption!==X.VIDEO_STREAM_LOW){e.next=24;break}if(r=new Map,this._room.remoteStreams.forEach((function(e){e.forEach((function(e){if(e.hasSubscribed){var n="fallback"===t?e.getSubscribeFallbackParams(f._room.subscribeFallbackOption):e.getSubscribeRecoverParams();if(n){var i=e.getStreamPriority(),o=r.get(i)||[];o.push({stream:e,fallbackOrRecoverOption:n}),r.set(i,o)}}}))})),!(r.size>0)){e.next=24;break}if(wW.print("_subscribeFallbackOrRecover()","start subscribe ".concat(t,".")),n=Array.from(r.keys()).sort((function(e,t){return e-t}))["fallback"===t?0:r.size-1],i=r.get(n)||[],a=E(i,1),!(s=a[0])){e.next=24;break}return c=s.stream,u=s.fallbackOrRecoverOption,this._isSubscribeFallbackOrRecover=!0,d=c.subLayer.spatialLayer,l=c.subVideo,wW.print("_subscribeFallbackOrRecover()","".concat(c.userId,"'s stream will be ").concat(t," to: MediaType=").concat(u[0]," subState=").concat(u[1]," subLayer=%o"),u[2]),e.prev=15,e.next=18,MP([(h=this._room).updateSubTrack.apply(h,[c].concat(k(u))),mP(4e3)]).then((function(){"recover"===t?f._startSubscribeRecoverCheck():wW.print("_subscribeFallbackOrRecover()","fallback success."),"function"==typeof f.onSubscribeFallback&&f.onSubscribeFallback({userId:c.userId,isScreen:c.isScreen,beforeEnable:l,beforeVideoIndex:d,afterEnable:c.subVideo,afterVideoIndex:c.subLayer.spatialLayer,reason:"fallback"===t?W.SubscribeFallbackByBandwidth:W.SubscribeRecoverByBandwidth})}));case 18:e.next=22;break;case 20:e.prev=20,e.t0=e.catch(15);case 22:this._preDownlinkNetworkQuality=[],this._isSubscribeFallbackOrRecover=!1;case 24:case"end":return e.stop()}}),e,this,[[15,20]])}))),function(e){return t.apply(this,arguments)})},{key:"_startSubscribeRecoverCheck",value:function(){var e=this;this._stopSubscribeRecoverCheck(),this._inSubscribeRecoverChecking=!0,this._subRecoverCheckTimer=window.setTimeout((function(){e._inSubscribeRecoverChecking=!1,e._forbidSubRecoverDuration=CW,delete e._subRecoverCheckTimer,wW.print("_subscribeFallbackOrRecover()","recover success.")}),2e4)}},{key:"_stopSubscribeRecoverCheck",value:function(){this._subRecoverCheckTimer&&(window.clearTimeout(this._subRecoverCheckTimer),delete this._subRecoverCheckTimer),this._inSubscribeRecoverChecking=!1}},{key:"_startForbidSubRecover",value:function(){var e=this;this._stopSubscribeRecoverCheck(),this._stopForbidSubRecover(),this._forbidSubRecoverDuration=Math.min(this._forbidSubRecoverDuration+2e4,12e4),wW.print("_subscribeFallbackOrRecover()","subscribe-recover failed, and subscribe-recover not allowed within ".concat(this._forbidSubRecoverDuration/1e3,"s")),this._forbidSubRecover=!0,this._forbidSubRecoverTimer=window.setTimeout((function(){e._forbidSubRecover=!1,delete e._forbidSubRecoverTimer}),this._forbidSubRecoverDuration)}},{key:"_stopForbidSubRecover",value:function(){this._forbidSubRecoverTimer&&(window.clearTimeout(this._forbidSubRecoverTimer),delete this._forbidSubRecoverTimer)}}]),e}(),xW=new JL("Room",1),DW={audiostream:!0,extaudio:!1,extvideo:!1,localaudio:!0,localvideo:!1,videoDescriptions:[],videostream:!1},NW=function(e){f(P,e);var t,r,n,a,s,d,p,v,_,y,S,b,k,T,I,R,w,O,x,D=g(P);function P(e,t){var r;return u(this,P),h(m(r=D.call(this)),"_mediaServerClient",void 0),h(m(r),"_localStream",void 0),h(m(r),"_localScreenStream",void 0),h(m(r),"_remoteUsers",new Map),h(m(r),"_remoteStreams",new Map),h(m(r),"_remoteStreamStreamIdUserIdMap",{}),h(m(r),"_virtualStreams",[]),h(m(r),"_joinResolveCallback",void 0),h(m(r),"_joinRejectCallback",void 0),h(m(r),"_getAccessNode",void 0),h(m(r),"_getAccessFeedback",void 0),h(m(r),"_getAccessFeedbackIceNode",void 0),h(m(r),"_reconnectTimer",void 0),h(m(r),"_isReconnecting",void 0),h(m(r),"_context",void 0),h(m(r),"_sessionId",void 0),h(m(r),"_reconnectRecord",void 0),h(m(r),"_connectionLostTimer",void 0),h(m(r),"_liveControlMessage",void 0),h(m(r),"_serverConfig",void 0),h(m(r),"_liveTranscodingOnceSucc",!1),h(m(r),"_roomConfig",void 0),h(m(r),"_roomInfo",void 0),h(m(r),"_waitForNewToken",!1),h(m(r),"_userDuplicateLoginTimerMap",new Map),h(m(r),"_networkQualityManager",void 0),h(m(r),"userPriorityMap",void 0),h(m(r),"subscribeFallbackOption",void 0),h(m(r),"_videoSizeObserver",void 0),h(m(r),"_subFallbackManager",void 0),h(m(r),"_hasPublished",!1),h(m(r),"_csrcUserIdMap",void 0),r._roomConfig=e,r._mediaServerClient=new gX(t),r._reconnectRecord=new PW,r._addHandlerEventHandler(),r._isReconnecting=!1,r._networkQualityManager=new AW,r._networkQualityManager.reportor=r._reportNetworkQuality.bind(m(r)),r._videoSizeObserver=new RW(m(r)),r._videoSizeObserver.onchange=r._emitVideoSizeChange.bind(m(r)),r._subFallbackManager=new OW(m(r)),r._subFallbackManager.onSubscribeFallback=r._emitSubscribeFallback.bind(m(r)),r._context=t,r._csrcUserIdMap={},r}return l(P,[{key:"hasScreenPublished",get:function(){var e;return null===(e=this._localScreenStream)||void 0===e?void 0:e.hasPublished}},{key:"hasPublished",get:function(){var e;return null===(e=this._localStream)||void 0===e?void 0:e.hasPublished}},{key:"connectionState",get:function(){return this._mediaServerClient.connectionState}},{key:"remoteUsers",get:function(){return this._remoteUsers}},{key:"remoteStreams",get:function(){return this._remoteStreams}},{key:"localStream",get:function(){return this._localStream}},{key:"localScreenStream",get:function(){return this._localScreenStream}},{key:"roomInfo",get:function(){return this._roomInfo}},{key:"_addHandlerEventHandler",value:function(){var e,t,r,n,i,o,a,s,c,u,d,l,h,f,p,v,_,m,y,g,S,b,E,k,T,I,A,R,w,C,O,x=this;null===(e=this._mediaServerClient)||void 0===e||e.on(pj.ON_ADD_STREAM,this._onAddStream.bind(this)),null===(t=this._mediaServerClient)||void 0===t||t.on(pj.ON_ADD_STREAM_LIST,(function(e){Array.isArray(null==e?void 0:e.streamList)&&e.streamList.forEach((function(e){return x._onAddStream(e)}))})),null===(r=this._mediaServerClient)||void 0===r||r.on(pj.ON_REMOVE_STREAM,this._onRemoveStream.bind(this)),null===(n=this._mediaServerClient)||void 0===n||n.on(pj.ON_REMOVE_STREAM_LIST,(function(e){Array.isArray(null==e?void 0:e.streamList)&&e.streamList.forEach((function(e){return x._onRemoveStream(e)}))})),null===(i=this._mediaServerClient)||void 0===i||i.on(pj.USER_CONNECTION,this._onUserConnection.bind(this)),null===(o=this._mediaServerClient)||void 0===o||o.on(pj.USER_CONNECTION_LIST,(function(e){Array.isArray(null==e?void 0:e.userList)&&e.userList.forEach((function(e){return x._onUserConnection(e)}))})),null===(a=this._mediaServerClient)||void 0===a||a.on(pj.USER_DISCONNECTION,this._onUserDisconnection.bind(this)),null===(s=this._mediaServerClient)||void 0===s||s.on(pj.USER_DISCONNECTION_LIST,(function(e){Array.isArray(null==e?void 0:e.userList)&&e.userList.forEach((function(e){return x._onUserDisconnection(e)}))})),null===(c=this._mediaServerClient)||void 0===c||c.on(pj.ON_UPDATE_ROOM_ATTRIBUTES,this._onUpdateRoomAttributes.bind(this)),null===(u=this._mediaServerClient)||void 0===u||u.on(pj.ON_UPDATE_USER_ATTRIBUTES,this._onUpdateUserAttributes.bind(this)),null===(d=this._mediaServerClient)||void 0===d||d.on(pj.ON_UPDATE_STREAM_ATTRIBUTES,this._onUpdateStreamAttributes.bind(this)),null===(l=this._mediaServerClient)||void 0===l||l.on(pj.ON_PUSH_TRACK,this._onPushTrack.bind(this)),null===(h=this._mediaServerClient)||void 0===h||h.on(pj.ON_REMOVE_TRACK,this._onRemoveTrack.bind(this)),null===(f=this._mediaServerClient)||void 0===f||f.on(pj.NODE_CHANGE,this._nodeChange.bind(this)),null===(p=this._mediaServerClient)||void 0===p||p.on(pj.ON_CUSTOM_MESSAGE,this._onCustomMessage.bind(this)),null===(v=this._mediaServerClient)||void 0===v||v.on(pj.USER_MESSAGE_RECEIVED,this._onUserMessageReceived.bind(this)),null===(_=this._mediaServerClient)||void 0===_||_.on(pj.USER_BINARY_MESSAGE_RECEIVED,this._onUserBinaryMessageReceived.bind(this)),null===(m=this._mediaServerClient)||void 0===m||m.on(pj.POST_PROCESSING_MESSAGE,this._onPostProcessingMessage.bind(this)),null===(y=this._mediaServerClient)||void 0===y||y.on(pj.ON_USER_TOKEN_WILL_EXPIRE,this._onUserTokenWillExpire.bind(this)),null===(g=this._mediaServerClient)||void 0===g||g.on(pj.STREAM_CONTROL_MESSAGE,this._onStreamControlMessage.bind(this)),null===(S=this._mediaServerClient)||void 0===S||S.on(pj.ON_SCENE_CONFIG,this._onSceneConfig.bind(this)),null===(b=this._mediaServerClient)||void 0===b||b.on(pj.ON_STREAM_FAILED,this._onStreamFailed.bind(this)),null===(E=this._mediaServerClient)||void 0===E||E.on(vj.RSCP,this._onPublishOnDemand.bind(this)),null===(k=this._mediaServerClient)||void 0===k||k.on(vj.RTT,this._onRTT.bind(this)),null===(T=this._mediaServerClient)||void 0===T||T.on(_j.ON_CONNECTION_STATE_CHANGE,this._onConnectionStateChange.bind(this)),null===(I=this._mediaServerClient)||void 0===I||I.on(_j.ABNORMAL_DISCONNECTION,this._handleAbnormalDisconnection.bind(this)),null===(A=this._mediaServerClient)||void 0===A||A.on(pj.ON_SPEAKER_CHANGE,this._onMeetingSpeakerChange.bind(this)),null===(R=this._mediaServerClient)||void 0===R||R.on("onRemoteStreamStats",(function(e){x._networkQualityManager.updateDownlinkStats(e,x._findRemoteStreamByScreen(e.userId,e.isScreen)),x.emit(Gz.ON_REMOTE_STREAM_STATS,FP(e))})),null===(w=this._mediaServerClient)||void 0===w||w.on("onLocalStreamStats",(function(e){x._networkQualityManager.updateUplinkStats(e),x.emit(Gz.ON_LOCAL_STREAM_STATS,FP(e))})),null===(C=this._mediaServerClient)||void 0===C||C.on("prevIceNode",(function(e){x._getAccessFeedbackIceNode=e})),null===(O=this._mediaServerClient)||void 0===O||O.on("prevIceNode",(function(e){x._getAccessFeedbackIceNode=e}))}},{key:"_removeHandlerEventHandler",value:function(){var e;null===(e=this._mediaServerClient)||void 0===e||e.removeAllListeners()}},{key:"join",value:(x=c(o().mark((function e(t,r,n,i,a,s,c){var u=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return VB.setStats({rtc_app_id:t,room_id:r,user_id:i.userId}),EW.setStats({rtc_session_id:t,rtc_room_id:r}),xW.print("join()"),e.abrupt("return",new Promise((function(e,o){var d,l,h=fP();u._joinResolveCallback=function(t){var r;MB.joinRoom(wB.END,h,!0,"",{enable_cloud_proxy:null===(r=u._roomInfo)||void 0===r?void 0:r.useCloudProxy}),e(t)},u._joinRejectCallback=function(e){var t;MB.joinRoom(wB.END,h,!1,e.message,{enable_cloud_proxy:null===(t=u._roomInfo)||void 0===t?void 0:t.useCloudProxy}),o(e)},u._liveControlMessage=a,u._roomInfo={appId:t,roomId:r,token:n,userInfo:i,useCloudProxy:s,roomProfile:u._roomConfig.roomProfileType,expectedIDC:c},u.setSessionId(),MB.joinRoom(wB.BEGIN,h,!1,"",{enable_cloud_proxy:null===(d=u._roomInfo)||void 0===d?void 0:d.useCloudProxy,expectedIDC:null===(l=u._roomInfo)||void 0===l?void 0:l.expectedIDC}),u._join(u._joinResolveCallback,u._joinRejectCallback,!1)})));case 4:case"end":return e.stop()}}),e)}))),function(e,t,r,n,i,o,a){return x.apply(this,arguments)})},{key:"_join",value:(O=c(o().mark((function e(t,r){var n,i,a,s,c=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=c.length>2&&void 0!==c[2]&&c[2],i=fP(),xW.print("_join()"),e.prev=3,e.next=6,this._mediaServerClient.join(this._roomInfo,{node:this._getAccessNode,reason:this._getAccessFeedback,sessionId:this._sessionId,feedbackNode:this._getAccessFeedbackIceNode},n,this._liveControlMessage);case 6:s=e.sent,this._mediaServerClient.roomAttributes=s.roomAttributes,null!==(a=s.roomAttributes)&&void 0!==a&&a.multiChatMode&&this._handleFFAudioTrack(),this._reconnectRecord.clear(),this._joinResolveCallback=void 0,this._joinRejectCallback=void 0,this._getAccessFeedback=void 0,this._getAccessNode=void 0,"function"==typeof t&&t({users:s.clients,streams:s.streams}),this._isReconnecting=!1,MB.rtcJoinRoom(0,"web","web",fP()-i),this._onJoinSucc(s,n),e.next=24;break;case 20:if(e.prev=20,e.t0=e.catch(3),e.t0.code===dN.OPERATION_CANCEL||"function"!=typeof r){e.next=24;break}return e.abrupt("return",r(e.t0));case 24:case"end":return e.stop()}}),e,this,[[3,20]])}))),function(e,t){return O.apply(this,arguments)})},{key:"publishScreen",value:(w=c(o().mark((function e(t,r,n,i,a){var s,c,u,d,l,h,f,p,v,_;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(xW.print("publishScreen()"),this._localScreenStream||(this._localScreenStream=new Wz,this._localScreenStream.isScreen=!0,this._mediaServerClient.handler&&(this._localScreenStream.observer=new TW(this._localScreenStream,this._mediaServerClient.handler))),s=!1,c=!1,u=!1,d=!1,!this._localScreenStream.videoTrack&&r?(r instanceof ez&&(c=!0),s=!0):this._localScreenStream.videoTrack&&!r&&(s=!1),!this._localScreenStream.audioTrack&&n?(n instanceof tz&&(d=!0),u=!0):this._localScreenStream.audioTrack&&!n&&(u=!1),this._localScreenStream.videoTrack=r,this._localScreenStream.audioTrack=n,this._localScreenStream.videoEncodeConfig=t,i&&(UP(i)&&(this._localScreenStream.pubAudio=a===zz.PUB),VP(i)&&(this._localScreenStream.pubVideo=a===zz.PUB),xW.print("publishScreen mediaType","pubAudio: %o, pubVideo: %o",this._localScreenStream.pubAudio,this._localScreenStream.pubVideo)),this._localScreenStream.pubAudio||this._localScreenStream.pubVideo){e.next=18;break}if(null===(l=this._localScreenStream)||void 0===l||!l.hasPublished){e.next=17;break}return e.abrupt("return",this.unpublishScreen());case 17:return e.abrupt("return");case 18:if(this._localScreenStream.hasPublished){e.next=24;break}return null===(h=this._localScreenStream.observer)||void 0===h||h.setPublish(!0),e.next=22,this._mediaServerClient.publish(this._localScreenStream);case 22:e.next=28;break;case 24:return c?null===(f=this._localScreenStream.observer)||void 0===f||f.setPushVideo(s):null===(p=this._localScreenStream.observer)||void 0===p||p.setEnableVideo(s),d?null===(v=this._localScreenStream.observer)||void 0===v||v.setPushAudio(u):null===(_=this._localScreenStream.observer)||void 0===_||_.setEnableAudio(u),e.next=28,this.updatePubScreenTrack();case 28:case"end":return e.stop()}}),e,this)}))),function(e,t,r,n,i){return w.apply(this,arguments)})},{key:"updatePubScreenTrack",value:(R=c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(xW.print("updatePubScreenTrack","Invoke updatePubScreenTrack"),!this._localScreenStream){e.next=4;break}return e.next=4,this._mediaServerClient.updatePubTrack(this._localScreenStream);case 4:case"end":return e.stop()}}),e,this)}))),function(){return R.apply(this,arguments)})},{key:"unpublishScreen",value:(I=c(o().mark((function e(){var t;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(xW.print("unpublish","Invoke unpublishScreen"),!this._localScreenStream){e.next=7;break}return null===(t=this._localScreenStream.observer)||void 0===t||t.setPublish(!1),e.next=5,this._mediaServerClient.unpublish(this._localScreenStream);case 5:this._localScreenStream.clean(),this._localScreenStream=void 0;case 7:case"end":return e.stop()}}),e,this)}))),function(){return I.apply(this,arguments)})},{key:"liveControlMessage",value:(T=c(o().mark((function e(t){var r,n=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return xW.print("controlMessage","Invoke controlMessage"),null===(r=t.transcodeMeta)||void 0===r||r.layout.regions.forEach((function(e){n.roomInfo&&(e.roomID=n.roomInfo.roomId)})),this._liveControlMessage=t,e.next=5,this._mediaServerClient.controlMessage(t);case 5:"stopped"===t.action&&(delete this._liveControlMessage,this._liveTranscodingOnceSucc=!1),this._liveTranscodingOnceSucc=!0;case 7:case"end":return e.stop()}}),e,this)}))),function(e){return T.apply(this,arguments)})},{key:"publicStreamControlMessage",value:(k=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"stopped"===t.action&&delete t.publicStreamMeta,e.next=3,this._mediaServerClient.controlMessage(t);case 3:case"end":return e.stop()}}),e,this)}))),function(e){return k.apply(this,arguments)})},{key:"updateUserAttributes",value:(b=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return xW.print("updateUserAttributes","Invoke updateUserAttributes"),t.role&&this._roomInfo&&(this._roomInfo.userInfo.role=t.role),e.next=4,this._mediaServerClient.updateUserAttributes(t);case 4:case"end":return e.stop()}}),e,this)}))),function(e){return b.apply(this,arguments)})},{key:"publish",value:(S=c(o().mark((function e(t,r,n,i,a,s){var c,u,d,l,h,f,p,v,_,m,y,g,S=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c=S.length>6&&void 0!==S[6]&&S[6],xW.print("publish","Invoke publish"),u=!1,this._localStream||(this._localStream=new Wz,this._mediaServerClient.handler&&(this._localStream.observer=new TW(this._localStream,this._mediaServerClient.handler)),u=!0),this._localStream.videoTrack=n,this._localStream.audioTrack=i,this._localStream.videoEncodeConfig=t,this._localStream.enableSimulcast=r,a&&(UP(a)&&(this._localStream.pubAudio=s===zz.PUB),VP(a)&&(this._localStream.pubVideo=s===zz.PUB),xW.print("publish mediaType","pubAudio: %o, pubVideo: %o",this._localStream.pubAudio,this._localStream.pubVideo)),this._localStream.hasPublished){e.next=26;break}if(this._localStream.pubAudio||this._localStream.pubVideo){e.next=12;break}return e.abrupt("return");case 12:return e.prev=12,c?null===(d=this._localStream.observer)||void 0===d||d.setLogin(!0):u&&(l=!!this._localStream.videoTrack,h=!!this._localStream.audioTrack,f=this._localStream.videoTrack instanceof ez,p=this._localStream.audioTrack instanceof tz,this._roomConfig.isAutoPublish&&!this._hasPublished?(l&&(f?null===(v=this._localStream.observer)||void 0===v||v.setPushVideo(!0):null===(_=this._localStream.observer)||void 0===_||_.setEnableVideo(!0)),h&&(p?null===(m=this._localStream.observer)||void 0===m||m.setPushAudio(!0):null===(y=this._localStream.observer)||void 0===y||y.setEnableAudio(!0))):null===(g=this._localStream.observer)||void 0===g||g.setPublish(!0)),e.next=16,this._mediaServerClient.publish(this._localStream);case 16:this._hasPublished=!0,this.emit(Gz.ON_PUBLISH_RESULT,{isScreen:!1,state:N.PUBLISH_SUCC}),e.next=24;break;case 20:throw e.prev=20,e.t0=e.catch(12),this.emit(Gz.ON_PUBLISH_RESULT,{isScreen:!1,state:N.PUBLISH_FAIL}),e.t0;case 24:e.next=28;break;case 26:return e.next=28,this.updatePubTrack();case 28:case"end":return e.stop()}}),e,this,[[12,20]])}))),function(e,t,r,n,i,o){return S.apply(this,arguments)})},{key:"updatePubTrack",value:(y=c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(xW.print("updatePubTrack","Invoke updatePubTrack"),!this._localStream){e.next=4;break}return e.next=4,this._mediaServerClient.updatePubTrack(this._localStream);case 4:case"end":return e.stop()}}),e,this)}))),function(){return y.apply(this,arguments)})},{key:"unpublish",value:(_=c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(xW.print("unpublish","Invoke unpublish"),!this._localStream){e.next=6;break}return e.next=4,this._mediaServerClient.unpublish(this._localStream);case 4:this._localStream.clean(),this._localStream=void 0;case 6:case"end":return e.stop()}}),e,this)}))),function(){return _.apply(this,arguments)})},{key:"subscribe",value:(v=c(o().mark((function e(t,r,n){var i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return xW.print("subscribe","remoteStream %o",t),i=void 0,n&&(i=this._getSubLayer(n,t)),e.next=5,this._mediaServerClient.subscribe(t,r,i);case 5:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return v.apply(this,arguments)})},{key:"updateSubTrack",value:(p=c(o().mark((function e(t,r,n,i){var a,s;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(xW.print("updateSubTrack","Invoke updateSubTrack"),!i){e.next=4;break}return e.next=4,null===(s=this._mediaServerClient)||void 0===s?void 0:s.updateSubTrackLayer(t,i);case 4:return e.abrupt("return",null===(a=this._mediaServerClient)||void 0===a?void 0:a.updateSubTrack(t,r,n));case 5:case"end":return e.stop()}}),e,this)}))),function(e,t,r,n){return p.apply(this,arguments)})},{key:"updateSubVideoConfig",value:(d=c(o().mark((function e(t,r){var n,i,a,s,c;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((s=this._findRemoteStreamByScreen(t,!1))&&s.hasSubscribed&&!((null==s||null===(n=s.attributes)||void 0===n||null===(i=n.videoDescriptions)||void 0===i?void 0:i.length)<=1)){e.next=3;break}return e.abrupt("return");case 3:return c=this._getSubLayer(r,s),s.originalStreamIndex=c.spatialLayer,e.abrupt("return",null===(a=this._mediaServerClient)||void 0===a?void 0:a.updateSubTrackLayer(s,c));case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return d.apply(this,arguments)})},{key:"_getSubLayer",value:function(e,t){for(var r,n,i,o,a,s=null==t?void 0:t.attributes,c=s.videoDescriptions,u=s.subVideoDescriptions,d=Array.isArray(u)?u:c,l=-1,h=e.width*e.height,f=0;f<(null==d?void 0:d.length);f++){var p,v;if(h>=(null===(p=d[f])||void 0===p?void 0:p.width)*(null===(v=d[f])||void 0===v?void 0:v.height)){l=f;break}}var _=d[0];if(-1===l)_=d[l=d.length-1];else if(0!==l){var m=d[l-1].width*d[l-1].height,y=(m-h)/(m-d[l].width*d[l].height);_=y<.1?d[l-1]:d[l],l=y<.1?l-1:l}return a=null!==(r=null===(n=_)||void 0===n?void 0:n.sub_index)&&void 0!==r?r:-1,{spatialLayer:null!==(i=null===(o=_)||void 0===o?void 0:o.video_index)&&void 0!==i?i:l,spatialSubLayer:a}}},{key:"unsubscribe",value:(s=c(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return xW.print("unsubscribe","Invoke unsubscribe"),e.next=3,this._mediaServerClient.unsubscribe(t,r);case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return s.apply(this,arguments)})},{key:"leave",value:(a=c(o().mark((function e(){var t,r,n,i,a,s,c=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=c.length>0&&void 0!==c[0]&&c[0],xW.print("leave","Invoke leave"),r=fP(),e.prev=3,this._mediaServerClient.connectionState!==mX.CONNECTED&&this._joinRejectCallback&&this._joinRejectCallback(new Error(CB.LEAVE_ROOM)),clearTimeout(this._reconnectTimer),n=A(this._remoteStreams.values());try{for(n.s();!(i=n.n()).done;)a=i.value,Array.isArray(a)&&a.forEach((function(e){var t;null===(t=e.observer)||void 0===t||t.setLogin(!1)}))}catch(o){n.e(o)}finally{n.f()}return this._localStream&&(null===(s=this._localStream.observer)||void 0===s||s.setLogin(!1)),e.next=11,this._mediaServerClient.leave();case 11:this.destroy(),MB.rtcLeaveRoom(0,"",fP()-r),VB.setStats({room_id:void 0,user_id:void 0,rtc_session_id:void 0}),EW.setStats({rtc_room_id:void 0}),e.next=25;break;case 17:if(e.prev=17,e.t0=e.catch(3),!t){e.next=23;break}throw e.t0;case 23:this.destroy();case 24:e.t0 instanceof Error&&MB.rtcLeaveRoom(-1,e.t0.message,fP()-r);case 25:case"end":return e.stop()}}),e,this,[[3,17]])}))),function(){return a.apply(this,arguments)})},{key:"setRemoteUserPriority",value:function(e,t){var r,n;null===(r=this.remoteStreams.get(e))||void 0===r||r.forEach((function(e){return e.setRemoteUserPriority(t)})),null===(n=this.userPriorityMap)||void 0===n||n.set(e,t)}},{key:"destroy",value:function(){xW.print("destroy","Invoke destroy"),MB.rtcInvokeStatus("".concat((new Error).stack),0,"room_destroy","",0),this._destroyAndInitMediaServerClient(),this._roomInfo=void 0,this._remoteUsers=new Map;var e,t,r,n=A(this._remoteStreams);try{for(n.s();!(e=n.n()).done;){var i=E(e.value,2)[1];Array.isArray(i)&&i.forEach((function(e){e&&e.clean()}))}}catch(o){n.e(o)}finally{n.f()}(this._virtualStreams.forEach((function(e){null==e||e.clean()})),this._remoteStreams=new Map,this._localStream)&&(null===(t=this._localStream)||void 0===t||t.clean(),this._localStream=void 0);this._localScreenStream&&(null===(r=this._localScreenStream)||void 0===r||r.clean(),this._localScreenStream=void 0);this._context=void 0,this._reconnectRecord=new PW,this._removeHandlerEventHandler(),clearTimeout(this._connectionLostTimer),this._userDuplicateLoginTimerMap.forEach((function(e){clearTimeout(e)})),this._userDuplicateLoginTimerMap.clear(),this._networkQualityManager.destroy(),this._videoSizeObserver.destroy(),this._subFallbackManager.destroy(),this._csrcUserIdMap={},this._virtualStreams=[],this._remoteStreamStreamIdUserIdMap={}}},{key:"updateToken",value:(n=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return xW.print("updateToken","Invoke updateToken"),this._roomInfo&&(this._roomInfo.token=t),e.next=4,this._mediaServerClient.updateToken(t);case 4:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"sendUserMessage",value:function(e,t){var r;return null===(r=this._mediaServerClient)||void 0===r?void 0:r.sendUserMessage(e,t)}},{key:"setSessionId",value:function(){this._sessionId=uP(),VB.setStats({rtc_session_id:this._sessionId}),EW.setStats({rtc_session_id:this._sessionId})}},{key:"sendRoomMessage",value:(r=c(o().mark((function e(t){var r,n,i,a,s=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=s.length>1&&void 0!==s[1]&&s[1],a={clientId:null===(r=this._roomInfo)||void 0===r?void 0:r.userInfo.userId,binary:i,message:""},!i){e.next=8;break}return e.next=5,_P.ab2b64str(t);case 5:a.message=e.sent,e.next=9;break;case 8:a.message=t;case 9:return e.abrupt("return",null===(n=this._mediaServerClient)||void 0===n?void 0:n.sendRoomMessage(a));case 10:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"_destroyAndInitMediaServerClient",value:function(){xW.print("_destroyAndInitMediaServerClient()"),this._mediaServerClient&&(this._mediaServerClient.destroy(),this._removeHandlerEventHandler()),this._mediaServerClient=new gX(this._context),this._addHandlerEventHandler()}},{key:"_onJoinSucc",value:function(e,t){var r,n=this;xW.print("JoinSuccess()"),this._serverConfig=e.config;var i=[],o=[],a=[],s=[],c=[];null===(r=e.clientsDetail)||void 0===r||r.forEach((function(t){if(t.attributes&&(t.attributes.serverMuteVideo&&n.safeEmit(Gz.ON_VIDEO_STREAM_BANNED,{uid:t.clientId,banned:1===t.attributes.serverMuteVideo}),t.attributes.serverMuteAudio&&n.safeEmit(Gz.ON_AUDIO_STREAM_BANNED,{uid:t.clientId,banned:1===t.attributes.serverMuteAudio})),t.clientId!==e.clientId){var r=n._remoteUsers.get(t.clientId);r?r._stillExist=!0:i.push(t)}}));var u,d=A(this._remoteUsers.values());try{for(d.s();!(u=d.n()).done;){var l=u.value;l._stillExist||o.push({clientId:l.userId}),delete l._stillExist}}catch(v){d.e(v)}finally{d.f()}e.streams.forEach((function(e){var t=n._findRemoteStreamByScreen(e.clientId,e.screen);t?(t.stillExist=!0,t.streamId=e.streamId,c.push(e)):s.push(e)}));var h,f=A(this._remoteStreams.values());try{for(f.s();!(h=f.n()).done;){var p=h.value;Array.isArray(p)&&p.forEach((function(e){e.stillExist?delete e.stillExist:a.push({clientId:e.userId,streamId:e.streamId,message:hj.clientDisconnected})}))}}catch(v){f.e(v)}finally{f.f()}setTimeout((function(){o.forEach((function(e){return n._onUserDisconnection(e)})),i.forEach((function(e){return n._onUserConnection(e)})),a.forEach((function(e){return n._onRemoveStream(e)})),s.forEach((function(e){return n._onAddStream(e,{fromSignal:!1})})),c.forEach((function(e){return n._onUpdateStreamAttributes(e)})),t&&n._handleSendOrRecvStreamAfterReconnect()}))}},{key:"_handleSendOrRecvStreamAfterReconnect",value:function(){var e=this;this._localStream&&(this._localStream.clean(),this._mediaServerClient.publish(this._localStream).catch((function(e){}))),this._localScreenStream&&(this._localScreenStream.clean(),this._mediaServerClient.publish(this._localScreenStream).catch((function(e){})));var t,r=A(this._remoteStreams.values());try{for(r.s();!(t=r.n()).done;){var n=t.value;Array.isArray(n)&&n.forEach(function(){var t=c(o().mark((function t(r){return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!r.hasSubscribed){t.next=15;break}return r.resetHasSubscribed(),t.prev=2,xW.print("start resubscribe ".concat(r.userId," with ").concat(r.subMediaType)),t.next=6,e._mediaServerClient.subscribe(r,r.subMediaType);case 6:xW.print("success resubscribe ".concat(r.userId," with ").concat(r.subMediaType)),e.safeEmit(Gz.RESUBSCRIBE,{stream:r}),t.next=15;break;case 10:t.prev=10,t.t0=t.catch(2),xW.print("failed resubscribe ".concat(r.userId," with ").concat(r.subMediaType,", error:").concat(t.t0)),r.clean(),null==r||r.resetHasSubscribed();case 15:case"end":return t.stop()}}),t,null,[[2,10]])})));return function(e){return t.apply(this,arguments)}}())}}catch(i){r.e(i)}finally{r.f()}}},{key:"_handleFFAudioTrack",value:function(){var e,t,r,n,i=null===(e=this._mediaServerClient)||void 0===e||null===(t=e.handler)||void 0===t?void 0:t.audioTrack4ff,o=null===(r=this._mediaServerClient)||void 0===r||null===(n=r.handler)||void 0===n?void 0:n.getTransceivers();if(i&&Array.isArray(o)){var a=o.find((function(e){var t;return(null==e||null===(t=e.receiver)||void 0===t?void 0:t.track)===i}));if(a){var s=new Yz("ff-stream","ff-stream",!1,DW);s.virtual=!0,s.audioTransceiver=a,s.audioMid="0",s.audioTrack=_z(i),this._virtualStreams.push(s),this.safeEmit(Gz.SUBSCRIBE_PUSH_TRACK,{stream:s})}}}},{key:"_findRemoteStream",value:function(e,t){var r=this._remoteStreams.get(e);return Array.isArray(r)?r.find((function(e){return e.streamId===t})):null}},{key:"_findRemoteStreamByScreen",value:function(e,t){var r=this._remoteStreams.get(e);return Array.isArray(r)?r.find((function(e){return e.isScreen===t})):null}},{key:"_onAddStream",value:function(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.needEmit,i=void 0===n||n,o=r.fromSignal,a=void 0===o||o,s=r.virtual,c=void 0!==s&&s;if(e.clientId!==(null===(t=this._roomInfo)||void 0===t?void 0:t.userInfo.userId)){var u=this._roomConfig,d=u.isAutoSubscribeAudio,l=u.isAutoSubscribeVideo,h=this._findRemoteStreamByScreen(e.clientId,e.screen);if(h&&h.streamId!==e.streamId){var f,p=null===(f=this._remoteStreams.get(e.clientId))||void 0===f?void 0:f.filter((function(e){return e.streamId!==h.streamId}));h.clean(),this._remoteStreams.set(e.clientId,p||[])}var v,_=this._findRemoteStream(e.clientId,e.streamId);if(this._remoteStreamStreamIdUserIdMap[e.streamId]=e.clientId,_)_.attributes=e.attributes;else if((_=new Yz(e.clientId,e.streamId,e.screen,e.attributes,null===(v=this.userPriorityMap)||void 0===v?void 0:v.get(e.clientId))).virtual=c,this._initStreamListeners(_),!c){var m=this._remoteStreams.get(e.clientId);m?m.push(_):this._remoteStreams.set(e.clientId,[_])}if(this._mediaServerClient.handler&&(_.observer=new kW(_,this._mediaServerClient.handler)),!_.isScreen&&l){var y,g,S,b,E,k,T,I;if(a&&_.hasVideo)if(_.attributes.extvideo)null===(y=_.observer)||void 0===y||y.setExternalVideoSource(!0),null===(g=_.observer)||void 0===g||g.setPushVideo(!0);else null===(S=_.observer)||void 0===S||S.setExternalVideoSource(!1),null===(b=_.observer)||void 0===b||b.setPublishVideo(!0);if(a&&_.hasAudio&&d&&!this._mediaServerClient.roomAttributes.multiChatMode)if(_.attributes.extaudio)null===(E=_.observer)||void 0===E||E.setExternalAudioSource(!0),null===(k=_.observer)||void 0===k||k.setPushAudio(!0);else null===(T=_.observer)||void 0===T||T.setExternalAudioSource(!1),null===(I=_.observer)||void 0===I||I.setPublishAudio(!0);if(!0===i&&!1===a){var A,R=this._roomConfig,w=R.isAutoSubscribeAudio,C=R.isAutoSubscribeVideo;null===(A=_.observer)||void 0===A||A.setLogin(!0,{audio:!!w,video:!!C})}}return i&&this.safeEmit(pj.ON_ADD_STREAM,{stream:_}),_}}},{key:"_onUserConnection",value:function(e){var t;if(e.clientId!==(null===(t=this._roomInfo)||void 0===t?void 0:t.userInfo.userId)){var r=this._userDuplicateLoginTimerMap.get(e.clientId);if("number"==typeof r)return this._userDuplicateLoginTimerMap.delete(e.clientId),void self.clearTimeout(r);var n={userId:e.clientId,extraInfo:e.attributes.extra_info};this._remoteUsers.set(e.clientId,i({},n)),this.safeEmit(pj.USER_CONNECTION,{userInfo:n}),e.attributes&&(e.attributes.serverMuteVideo&&this.safeEmit(Gz.ON_VIDEO_STREAM_BANNED,{uid:e.clientId,banned:1===e.attributes.serverMuteVideo}),e.attributes.serverMuteAudio&&this.safeEmit(Gz.ON_AUDIO_STREAM_BANNED,{uid:e.clientId,banned:1===e.attributes.serverMuteAudio}))}}},{key:"_onUserDisconnection",value:function(e){var t,r=this,n=e.clientId,i=e.tag,o=e.code;if(n)if(n===(null===(t=this.roomInfo)||void 0===t?void 0:t.userInfo.userId)){var a=null;i===mj.kickedByAdmin?a=dN.KICKED_OUT:i===mj.onUserTokenDidExpire?a=dN.TOKEN_EXPIRED:i===mj.userDuplicateLogin&&(a=dN.DUPLICATE_LOGIN),o===yj.roomDismissByAdmin&&(a=dN.ROOM_DISMISS),a&&this.safeEmit(Gz.ON_ROOM_ERROR,{errorCode:a})}else{var s=C.DROPPED;i===mj.userLeave?s=C.QUIT:i===mj.kickedByAdmin?s=C.KICKED_BY_ADMIN:i===mj.roleChanged&&(s=C.SWITCH_TO_INVISIBLE);var c=function(){var e;r._remoteUsers.delete(n),null===(e=r._remoteStreams.get(n))||void 0===e||e.forEach((function(e){e.clean(),r._onRemoveStream({clientId:e.userId,streamId:e.streamId,message:hj.clientDisconnected})})),r._remoteStreams.delete(n),r.safeEmit(Gz.ON_USER_LEAVE,{userInfo:{userId:n},reason:s})};if(i===mj.userDuplicateLogin){var u=this._userDuplicateLoginTimerMap.get(n);u&&self.clearTimeout(u);var d=self.setTimeout(c,5e3);this._userDuplicateLoginTimerMap.set(n,d)}else c()}}},{key:"_onRemoveStream",value:function(e){var t,r=this;if(e.clientId!==(null===(t=this._roomInfo)||void 0===t?void 0:t.userInfo.userId)){var n=this._remoteStreams.get(e.clientId);if(n){var i=n.find((function(t){return t.streamId===e.streamId}));if(i){var o,a,s;if(null===(o=this._mediaServerClient)||void 0===o||o.handleRemoveStream(i,e).then((function(){var t=r._remoteStreams.get(e.clientId);t&&(t=t.filter((function(t){return t.streamId!==e.streamId||(t.clean(),!1)})),r._remoteStreams.set(e.clientId,t))})).finally((function(){r.safeEmit(pj.ON_REMOVE_STREAM,{stream:i,reason:e.message})})),i.hasVideo)null===(a=i.observer)||void 0===a||a.setPublishVideo(!1);if(i.hasAudio&&!this._mediaServerClient.roomAttributes.multiChatMode)null===(s=i.observer)||void 0===s||s.setPublishAudio(!1)}}}}},{key:"_onUpdateUserAttributes",value:function(e){e.attributes&&(e.attributes.serverMuteVideo&&this.safeEmit(Gz.ON_VIDEO_STREAM_BANNED,{uid:e.clientId,banned:1===e.attributes.serverMuteVideo}),e.attributes.serverMuteAudio&&this.safeEmit(Gz.ON_AUDIO_STREAM_BANNED,{uid:e.clientId,banned:1===e.attributes.serverMuteAudio}))}},{key:"_onUpdateRoomAttributes",value:function(e){var t;e.roomAttributes&&(this._mediaServerClient.roomAttributes=i(i({},this._mediaServerClient.roomAttributes),e.roomAttributes)),null!==(t=e.roomAttributes)&&void 0!==t&&t.multiChatMode&&this._handleFFAudioTrack()}},{key:"_onUpdateStreamAttributes",value:function(e){var t=this._roomConfig,r=t.isAutoSubscribeAudio,n=t.isAutoSubscribeVideo,o=e.clientId,a=e.streamId,s=e.attributes,c=this._findRemoteStream(o,a);if(c){var u,d,l=c.attributes,h=i(i({},l),s),f=!1,p=h.localaudio!==l.localaudio,v=!1,_=!1,m=h.localvideo!==l.localvideo,y=!1,g=Az.NONE,S=Az.NONE;if(h.audiostream!==l.audiostream&&(f=h.localaudio,v=!!h.audiostream,h.audiostream?g|=U.AUDIO:S|=U.AUDIO),h.videostream!==l.videostream&&(_=h.localvideo,y=!!h.videostream,h.videostream?g|=U.VIDEO:S|=U.VIDEO),g&&this.safeEmit(Gz.ON_USER_PUBLISH_STATE_CHANGE,{userId:o,mediaType:g,isScreen:c.isScreen,pubState:zz.PUB,remoteStream:c}),S&&this.safeEmit(Gz.ON_USER_PUBLISH_STATE_CHANGE,{userId:o,mediaType:S,isScreen:c.isScreen,pubState:zz.UNPUB,remoteStream:c}),c.attributes=h,h.localaudio!==l.localaudio)if(h.localaudio){var b,E,k,T;if(r)if(h.extaudio)null===(b=c.observer)||void 0===b||b.setExternalAudioSource(!0),null===(E=c.observer)||void 0===E||E.setPushAudio(!0);else null===(k=c.observer)||void 0===k||k.setExternalAudioSource(!1),null===(T=c.observer)||void 0===T||T.setEnableAudio(!0);this.safeEmit(Gz.ON_USER_START_AUDIO_CAPTURE,{userId:o},c)}else{var I,A,R,w;if(h.extaudio)null===(I=c.observer)||void 0===I||I.setExternalAudioSource(!0),null===(A=c.observer)||void 0===A||A.setPushAudio(!1);else null===(R=c.observer)||void 0===R||R.setExternalAudioSource(!1),null===(w=c.observer)||void 0===w||w.setEnableAudio(!1);!c.isScreen&&this.safeEmit(Gz.ON_USER_STOP_AUDIO_CAPTURE,{userId:o})}if(h.localvideo!==l.localvideo)if(h.localvideo){var C,O,x,D;if(n)if(h.extvideo)null===(C=c.observer)||void 0===C||C.setExternalVideoSource(!0),null===(O=c.observer)||void 0===O||O.setPushVideo(!0);else null===(x=c.observer)||void 0===x||x.setExternalVideoSource(!1),null===(D=c.observer)||void 0===D||D.setEnableVideo(!0);this.safeEmit(Gz.ON_USER_START_VIDEO_CAPTURE,{userId:o})}else{var N,P,M,L;if(h.extvideo)null===(N=c.observer)||void 0===N||N.setExternalVideoSource(!0),null===(P=c.observer)||void 0===P||P.setPushVideo(!1);else null===(M=c.observer)||void 0===M||M.setExternalVideoSource(!1),null===(L=c.observer)||void 0===L||L.setEnableVideo(!1);!c.isScreen&&this.safeEmit(Gz.ON_USER_STOP_VIDEO_CAPTURE,{userId:o})}if(f&&!p)null===(u=c.observer)||void 0===u||u.setRemoteUnmuteAudio(v);if(_&&!m)null===(d=c.observer)||void 0===d||d.setRemoteUnmuteVideo(y)}}},{key:"_onPushTrack",value:function(e){var t=this,r=this._onAddStream(i(i({},e),{},{attributes:DW}),{needEmit:!1,fromSignal:!1,virtual:!0});r&&this._mediaServerClient.subscribe4pushTrack(r,e).then((function(){t.safeEmit(Gz.SUBSCRIBE_PUSH_TRACK,{stream:r}),t._virtualStreams.push(r)})).catch((function(e){xW.print("subscribe","push track failed %o",e)}))}},{key:"_onRemoveTrack",value:function(e){var t,r=e.clientId,n=e.streamId,i=e.message;xW.print("_onRemoveTrack","remove track: %o",r);var o=this._findRemoteStream(r,n);o&&(null===(t=this._mediaServerClient)||void 0===t||t.unsubscribe4removeTrack(o,i))}},{key:"_onMeetingSpeakerChange",value:function(e){if(Array.isArray(null==e?void 0:e.speakerCsrcInfo)){var t={};null==e||e.speakerCsrcInfo.forEach((function(e){var r=e.csrc,n=e.userId;e.isScreen||(t[r]=n)})),this._csrcUserIdMap=t}}},{key:"getActiveSpeakerInMultiChatMode",value:function(){var e=this,t=[];return this._virtualStreams.forEach((function(r){var n,i=null===(n=r.audioTransceiver)||void 0===n?void 0:n.receiver;if(i){var o=E(i.getContributingSources()||[],1)[0];if(o){var a=o.audioLevel,s=o.source;e._csrcUserIdMap[s]&&t.push({userId:e._csrcUserIdMap[s],audioLevel:a})}}})),t.length&&t.sort((function(e,t){return e.audioLevel-t.audioLevel})),t}},{key:"_nodeChange",value:function(e){var t,r=e.nodes,n=e.reason;ej.clearAccessNode(null===(t=this._roomInfo)||void 0===t?void 0:t.appId),this._destroyAndInitMediaServerClient(),Array.isArray(r)&&r.length?this._getAccessNode=r[0]:this._getAccessFeedback=n,MB.rtcNodeChange(0,JSON.stringify(e),JSON.stringify(n)),this._joinResolveCallback&&this._joinRejectCallback?this._join(this._joinResolveCallback,this._joinRejectCallback):this._reconnect()}},{key:"_reconnect",value:function(){var e=this;this._isReconnecting=!0;var t,r=A(this._remoteStreams.values());try{for(r.s();!(t=r.n()).done;){var n=t.value;Array.isArray(n)&&n.forEach((function(e){return e.clean()}))}}catch(i){r.e(i)}finally{r.f()}MB.rtcReconnect(1002,nB.PEERCONNECTION_RECONNECTING,this._roomInfo.userInfo.userId,iB.PEERCONNECTION),this._liveTranscodingOnceSucc||delete this._liveControlMessage,this._join((function(){MB.rtcReconnected(oB.PEERCONNECTION_RECONNECTED,aB.PEERCONNECTION)}),(function(t){e._reconnectRecord.record(t),e._reconnectRecord.shouldReconnect?(xW.print("Reconnecting error, will reconnect after 3s",t),e._reconnectTimer=window.setTimeout(e._reconnect.bind(e),3e3)):(e.safeEmit(Gz.RECONNECT_FAILED),e.destroy())}),!0)}},{key:"_handleAbnormalDisconnection",value:function(){xW.print("on ABNORMAL_DISCONNECTION"),this._destroyAndInitMediaServerClient(),navigator.onLine?this._reconnect():this._reconnectTimer=window.setTimeout(this._reconnect.bind(this),3e3)}},{key:"_onConnectionStateChange",value:function(e){var t,r=this;if(e.next===mX.DISCONNECTED)t=F.CONNECTION_STATE_DISCONNECTED;else if(e.next===mX.CONNECTED)clearTimeout(this._connectionLostTimer),t=this._isReconnecting?F.CONNECTION_STATE_RECONNECTED:F.CONNECTION_STATE_CONNECTED;else{if(e.next!==mX.CONNECTING)return;t=this._isReconnecting?F.CONNECTION_STATE_RECONNECTING:F.CONNECTION_STATE_CONNECTING}e.prev===mX.CONNECTED&&e.next===mX.DISCONNECTED&&(this._connectionLostTimer=window.setTimeout((function(){r.safeEmit(_j.ON_CONNECTION_STATE_CHANGE,{state:F.CONNECTION_STATE_LOST})}),1e4)),this._networkQualityManager.setConnectionState(e.next),this.safeEmit(_j.ON_CONNECTION_STATE_CHANGE,{state:t})}},{key:"_initStreamListeners",value:function(e){var t=this;e.on("ontrack",(function(e){e.track})),e.on("onSEIMessage",(function(r){var n;t.emit(Gz.ON_SEI_MESSAGED_RECEIVED,{sei:r,remoteStreamKey:{userId:e.userId,roomId:null===(n=t._roomInfo)||void 0===n?void 0:n.roomId,streamIndex:e.isScreen?L.STREAM_INDEX_SCREEN:L.STREAM_INDEX_MAIN}})}))}},{key:"_onCustomMessage",value:function(e){this.safeEmit(pj.ON_CUSTOM_MESSAGE,e)}},{key:"_onUserMessageReceived",value:function(e){this.safeEmit(pj.USER_MESSAGE_RECEIVED,{userId:e.from,message:e.msg})}},{key:"_onUserBinaryMessageReceived",value:function(e){this.safeEmit(pj.USER_BINARY_MESSAGE_RECEIVED,{userId:e.from,message:e.msg})}},{key:"_onPostProcessingMessage",value:function(e){if(e.body){var t=e.body,r=t.error||0,n=Hz.START,i=["success","parameter error","subscription timeout","ffmpeg error","cdn error","publish error"];if("2.0"===t.protocol){switch(t.eventType){case"TranscodeStarted":0!==t.error&&(n=Hz.START_FAILED);break;case"TranscodeStateChanged":n=0!==t.error?Hz.START_FAILED:Hz.START_SUCCESS;break;case"TranscodeStopped":n=0!==t.error?Hz.STOP_FAILED:Hz.STOP_SUCCESS;break;case"TranscodeUpdated":n=0!==t.error?Hz.UPDATE_FAILED:Hz.UPDATE_SUCCESS}this.safeEmit(pj.POST_PROCESSING_MESSAGE,{code:r,protocol:t.protocol,error:t.error,eventType:n,message:i[r]})}this.safeEmit(pj.POST_PROCESSING_MESSAGE,{code:r,message:i[r],type:e.type})}}},{key:"_onUserTokenWillExpire",value:function(){this.safeEmit(pj.ON_USER_TOKEN_WILL_EXPIRE,null)}},{key:"_onSceneConfig",value:function(e){try{var t=e.multiSceneConfig,r=lX[this._roomConfig.roomProfileType][1];if(t){var n,i,o,a,s=t[r];if(null!=s&&s.engine_BAC)null===(n=this._context)||void 0===n||null===(i=n.audioProfileManager)||void 0===i||i.updateEngineBAC(s.engine_BAC);if(null!=s&&s.engine_ANM)null===(o=this._context)||void 0===o||null===(a=o.audioProfileManager)||void 0===a||a.updateEngineANM(s.engine_ANM)}}catch(c){}}},{key:"_onStreamFailed",value:(t=c(o().mark((function e(t){var r,n,i,a,s,c,u,d,l,h;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("publish"!==t.type){e.next=11;break}if(c=void 0,(null===(r=this.localStream)||void 0===r?void 0:r.streamId)===t.streamId?c=this.localStream:(null===(n=this.localScreenStream)||void 0===n?void 0:n.streamId)===t.streamId&&(c=this.localScreenStream),c){e.next=5;break}return e.abrupt("return");case 5:return null===(i=c)||void 0===i||i.clean(),e.next=8,null===(a=this._mediaServerClient)||void 0===a?void 0:a.unpublish(c).catch((function(){}));case 8:null===(s=this._mediaServerClient)||void 0===s||s.publish(c).catch((function(){})),e.next=20;break;case 11:if("subscribe"!==t.type){e.next=20;break}if(u=this._remoteStreamStreamIdUserIdMap[t.streamId],!(d=this._findRemoteStream(u,t.streamId))){e.next=20;break}return e.next=17,null===(l=this._mediaServerClient)||void 0===l?void 0:l.unsubscribe(d,U.AUDIO_AND_VIDEO);case 17:return e.next=19,null===(h=this._mediaServerClient)||void 0===h?void 0:h.subscribe(d,d.subMediaType,d.subLayer);case 19:this.safeEmit(Gz.RESUBSCRIBE,{stream:d});case 20:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"_onStreamControlMessage",value:function(e){var t,r;e.type===fj.PushLimitWarn&&(null!==(t=this._localStream)&&void 0!==t&&t.pubAudio||null!==(r=this._localStream)&&void 0!==r&&r.pubVideo||this.unpublish())}},{key:"_onPublishOnDemand",value:function(e){var t,r,n,i,o;if(!1!==(null===(t=this._serverConfig)||void 0===t||null===(r=t.engine_VPM)||void 0===r||null===(n=r.ondemand)||void 0===n?void 0:n.enable)&&null!==(i=this._localStream)&&void 0!==i&&i.enableSimulcast&&null!==(o=this._localStream)&&void 0!==o&&o.videoTransceiver){var a,s,c=null===(a=this._localStream)||void 0===a?void 0:a.stream.id,u=null===(s=this._localStream)||void 0===s?void 0:s.videoTransceiver.sender,d=u.getParameters();if(Array.isArray(d.encodings)&&Array.isArray(e)){var l,h,f,p,v={};xW.print("_onPublishOnDemand","usedDescriptions: %o",e),e.forEach((function(e){var t;if(null!=e&&null!==(t=e.StreamIds)&&void 0!==t&&t.includes(c)){var r=null==e?void 0:e.Metadata.SubvideoIndex;v[r]=r}}));var _={};null===(l=this._localStream)||void 0===l||null===(h=l.subVideoDescriptions)||void 0===h||h.forEach((function(e){void 0!==v[e.sub_index]&&(_[e.video_index]=e)}));var m=(null===(f=u.track)||void 0===f||null===(p=f.getSettings())||void 0===p?void 0:p.height)||720,y=[];d.encodings=d.encodings.map((function(e){return e.rid&&(_[e.rid]?(e.active=!0,e.scaleResolutionDownBy=Math.max(m/_[e.rid].height,1),y.push({type:1,rid:e.rid,downBy:e.scaleResolutionDownBy,bitrate:e.maxBitrate})):(y.push({type:0,rid:e.rid}),e.active=!1)),e})),MB.rtcInvokeStatus(JSON.stringify(y),0,"rscp",c,0)}u.setParameters(d)}}},{key:"_onRTT",value:function(e){var t=e.StreamIds,r=e.Metadata;if(t.length&&r){var n,i=t[0];null!==(n=this._context)&&void 0!==n&&n.streamRTT&&(this._context.streamRTT[i]={audio:r.audio_rtt,video:r.video_rtt})}}},{key:"_reportNetworkQuality",value:function(e,t){this._subFallbackManager.updateNetworkQuality(e,t),this.emit(Gz.ON_NETWORK_QUALITY,e,t)}},{key:"_emitVideoSizeChange",value:function(e,t,r,n){var i;this.emit(Gz.ON_REMOTE_VIDEO_SIZE_CHANGED,{roomId:null===(i=this.roomInfo)||void 0===i?void 0:i.roomId,userId:e,streamIndex:t?L.STREAM_INDEX_SCREEN:L.STREAM_INDEX_MAIN},{width:r,height:n})}},{key:"_emitSubscribeFallback",value:function(e){this.emit(Gz.ON_SIMULCAST_SUBSCRIBE_FALLBACK,e)}},{key:"multiChatMode",get:function(){var e;return null===(e=this._mediaServerClient)||void 0===e?void 0:e.multiChatMode()}}]),P}($L),PW=function(){function e(){u(this,e),h(this,"_all_201_count",void 0),h(this,"_has_4xx",void 0),this._all_201_count=0,this._has_4xx=!1}return l(e,[{key:"shouldReconnect",get:function(){return!(this._all_201_count>=3||this._has_4xx)}},{key:"record",value:function(e){var t=!1,r=!1;if(Array.isArray(e)){var n=0;e.map((function(e){var t,i,o;400<=(null===(t=e.error)||void 0===t?void 0:t.code)&&(null===(i=e.error)||void 0===i?void 0:i.code)<500&&(r=!0),201===(null===(o=e.error)||void 0===o?void 0:o.code)&&n++})),n===e.length&&(t=!0),t&&this._all_201_count++,r&&(this._has_4xx=!0)}}},{key:"clear",value:function(){this._all_201_count=0,this._has_4xx=!1}}]),e}(),MW=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=document.createElement(e);return t.id&&(r.id=t.id),t.classList&&t.classList.forEach((function(e){r.classList.add(e)})),t.style&&Object.assign(r.style,t.style),t.attributes&&Object.entries(t.attributes).forEach((function(e){var t=E(e,2),n=t[0],i=t[1];"muted"===n?r.muted=!0:r.setAttribute(n,i)})),r},LW=new JL("Player",0),UW=["play","playing","pause","ended","error","seeking","seeked","waiting","canplay","canplaythrough","durationchange","volumechange","loadedmetadata","loadeddata","loadstart","timeupdate"],VW={playsinline:"","webkit-playsinline":""},FW={playsinline:"","webkit-playsinline":"","x5-playsinline":"","x5-video-player-type":"h5","x-webkit-airplay":"allow",preload:"",muted:""},BW=function(e){f(n,e);var t,r=g(n);function n(e){var t;u(this,n),h(m(t=r.call(this)),"_containerDom",void 0),h(m(t),"_videoDom",void 0),h(m(t),"__cumulativeTime",void 0),h(m(t),"userId",void 0),h(m(t),"renderMode",void 0),h(m(t),"mirrorType",B.MIRROR_TYPE_NONE),h(m(t),"isScreen",void 0),h(m(t),"isLocal",void 0),h(m(t),"played",!1),h(m(t),"_emitPlayFailed",!1),h(m(t),"_videoContainer",void 0),h(m(t),"_safari15VideoTimer",void 0),h(m(t),"emitVideoEvent",(function(e){var r,n,i={type:"video",rawEvent:e,readyState:(null===(r=t._videoDom)||void 0===r?void 0:r.readyState)||0,userId:t.userId,eventName:e.type,currentTime:(null===(n=t._videoDom)||void 0===n?void 0:n.currentTime)||0,isScreen:t.isScreen};switch(t.emit("playback_event",i),e.type){case"pause":var o;try{MB.rtcInvokeStatus("video element paused, auto resume",0,"VideoPlayerPause",t.userId,0)}catch(T0){}LW.print("VideoPlayerPause","[userId-".concat(t.userId,"] video element paused, auto resume")),null===(o=t._videoDom)||void 0===o||o.play();break;case"canplay":case"loadeddata":t._internalPlay();break;case"playing":LW.print("VideoPlayerPlaying","[userId-".concat(t.userId,"] video element playing"))}})),h(m(t),"_internalPlay",(function(){var e;if(null!==(e=t._videoDom)&&void 0!==e&&e.paused){var r=t._videoDom.play();null!=r&&r.then&&r.catch((function(e){var r,n;t._emitPlayFailed||(t._emitPlayFailed=!0,MB.rtcError("video autoplay failed, userId: ".concat(t.userId,", ").concat(e.name),-1e3),t.emit("playback_event",{type:"video",rawEvent:e,readyState:(null===(r=t._videoDom)||void 0===r?void 0:r.readyState)||0,userId:t.userId,eventName:"autoplay-error",currentTime:(null===(n=t._videoDom)||void 0===n?void 0:n.currentTime)||0,isScreen:t.isScreen}))}))}}));var i=e.renderDom,o=e.userId;t.renderMode=void 0!==e.renderMode?e.renderMode:M.RENDER_MODE_FIT;var a="string"==typeof i?document.getElementById(i):i;if(!a)throw new hN(dN.CANT_FIND_DOM,"can't find dom");return t._videoContainer=document.createElement("div"),t._videoContainer.style.width="100%",t._videoContainer.style.height="100%",t._videoContainer.style.position="relative",t._videoContainer.style.overflow="hidden",t._containerDom=a,t.userId=o,t.isLocal=!!e.isLocal,t.isScreen=!!e.isScreen,t._initVideo(),SP&&15===kP&&(t._safari15VideoTimer=window.setInterval((function(){try{t._videoContainer.style.display="block",setTimeout((function(){t._videoContainer.style.display="flex"}),500)}catch(T0){}}),5e3)),t}return l(n,[{key:"_initVideo",value:function(){this._videoDom||(this._videoDom=MW("video",{style:{width:"100%",height:"100%"},attributes:FW}),this._videoDom.id="".concat(this.userId,"_").concat(hP()),this.renderMode===M.RENDER_MODE_FIT?this._videoDom.style.objectFit="contain":this._videoDom.style.objectFit="cover",this.mirror(this.mirrorType===B.MIRROR_TYPE_RENDER)),this._videoContainer.appendChild(this._videoDom),this._containerDom.appendChild(this._videoContainer),this._initListeners()}},{key:"_initListeners",value:function(){var e=this;this._videoDom&&UW.forEach((function(t){var r;null===(r=e._videoDom)||void 0===r||r.addEventListener(t,e.emitVideoEvent)}))}},{key:"_removeListeners",value:function(){var e=this;this._videoDom&&(UW.forEach((function(t){var r;null===(r=e._videoDom)||void 0===r||r.removeEventListener(t,e.emitVideoEvent)})),this._videoDom.addEventListener("canplay",this._internalPlay),this._videoDom.addEventListener("loadeddata",this._internalPlay))}},{key:"_recordFrame",value:function(e){var t=this,r=e.isScreen?1.5:.5;if(SP){var n;if(null===(n=this._videoDom)||void 0===n||!n.requestVideoFrameCallback)return;this._videoDom.requestVideoFrameCallback((function n(i,o){var a=o.presentationTime;if(e.recordedVideoFrames||(e.recordedVideoFrames=[]),t.__cumulativeTime){var s,c=(a-t.__cumulativeTime)%2e3,u=c>1e3*r;null===(s=e.recordedVideoFrames)||void 0===s||s.push({playTime:a,isStall:u,stallCount:u?1:0,stallDuration:c})}t.__cumulativeTime=a,t._videoDom.requestVideoFrameCallback(n)}))}else this.on("playback_event",(function(n){var i;if("timeupdate"===n.eventName){if(0===(null===(i=t._videoDom)||void 0===i?void 0:i.currentTime))return;if(void 0===t.__cumulativeTime)return void(t.__cumulativeTime=t._videoDom.currentTime);if(e.recordedVideoFrames||(e.recordedVideoFrames=[]),t._videoDom.currentTime>t.__cumulativeTime){var o=Math.floor(1e3*(t._videoDom.currentTime-t.__cumulativeTime)),a=t._videoDom.currentTime-t.__cumulativeTime>r;e.recordedVideoFrames.push({playTime:t._videoDom.currentTime,isStall:a,stallCount:a?1:0,stallDuration:o%2e3})}t.__cumulativeTime=t._videoDom.currentTime}}))}},{key:"_recordPause",value:function(e){var t=this;void 0===e.statsReport.isPaused&&this.on("playback_event",(function(r){if("pause"===r.eventName)e.statsReport.isPaused=!0,e.statsReport.pauseStart=fP();else if("timeupdate"===r.eventName){var n;if((null===(n=t._videoDom)||void 0===n||!n.paused)&&e.statsReport.isPaused){e.statsReport.isPaused=!1;var i=fP()-(e.statsReport.pauseStart||0);i>500&&(e.statsReport.pauseDuration+=i)}}}))}},{key:"playVideo",value:(t=c(o().mark((function e(t,r){var n,i,a,s,c=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=this._videoDom,LW.print("playVideo","play video track: ".concat(this.userId)),!(a&&a.srcObject instanceof MediaStream&&a.srcObject.getTrackById(null===(n=t.getTrack())||void 0===n?void 0:n.id))){e.next=5;break}try{MB.rtcInvokeStatus("play video repeatedly",0,"playVideo",this.userId,0)}catch(T0){}return e.abrupt("return");case 5:a||(this._initVideo(),a=this._videoDom),LW.print("playVideo","play video by dom: ".concat(null===(i=a)||void 0===i?void 0:i.id)),(s=new MediaStream).addTrack(t.getTrack("preprocessing")),a.srcObject=s,a&&!this._containerDom.contains(this._videoContainer)&&this._containerDom.appendChild(this._videoContainer),a&&!this._videoContainer.contains(a)&&this._videoContainer.appendChild(a),setTimeout((function(){return c._internalPlay()})),r&&(this._recordFrame(r),this._recordPause(r),r.statsReport.player=this),this.played=!0;case 15:case"end":return e.stop()}}),e,this)}))),function(e,r){return t.apply(this,arguments)})},{key:"updateSrcObject",value:function(e){var t=e.getTrack();if(t&&this._videoDom){var r=new MediaStream;r.addTrack(t),this._videoDom.srcObject=r}}},{key:"manuallyPlay",value:function(){if(LW.print("Invoke VideoPlayer.manuallyPlay",this.userId,this.isScreen),this._emitPlayFailed=!1,!this._videoDom)throw new hN(dN.INVALID_PARAMS,"Player not found");return 0!==this._videoDom.readyState||AP?this._videoDom.play():Promise.resolve()}},{key:"mirror",value:function(e){LW.print("mirror","".concat(this.userId," set mirror: ").concat(e)),this.mirrorType=e?B.MIRROR_TYPE_RENDER:B.MIRROR_TYPE_NONE,this._videoDom&&(this._videoDom.style.transform=e?"rotateY(180deg)":"")}},{key:"stop",value:function(){var e,t=this._containerDom;(LW.print("stop","stop video track: ".concat(this.userId)),this._videoDom)&&(this._videoDom.srcObject=null,null!=t&&t.contains(this._videoContainer)&&t.removeChild(this._videoContainer),null!==(e=this._videoContainer)&&void 0!==e&&e.contains(this._videoDom)&&this._videoContainer.removeChild(this._videoDom));this.__cumulativeTime=void 0,this.played=!1}},{key:"destroy",value:function(){LW.print("destroy","video player: ".concat(this.userId)),this.stop(),b(p(n.prototype),"removeAllListeners",this).call(this),this._removeListeners(),this._videoDom&&(this._videoDom.srcObject=null,delete this._videoDom),this._safari15VideoTimer&&(window.clearInterval(this._safari15VideoTimer),this._safari15VideoTimer=void 0)}},{key:"domElement",get:function(){return this._videoDom}}]),n}(jL.exports.EventEmitter),jW=function(e){f(i,e);var t,r,n=g(i);function i(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{divId:void 0,muted:!1,isScreen:!1},o=r.divId,a=r.muted,s=r.isScreen;if(u(this,i),h(m(t=n.call(this)),"_containerDom",void 0),h(m(t),"_audioDom",void 0),h(m(t),"_fakeAudioDom",void 0),h(m(t),"userId",void 0),h(m(t),"muted",!1),h(m(t),"_emitPlayFailed",!1),h(m(t),"played",!1),h(m(t),"isScreen",void 0),h(m(t),"_wechatTimer",void 0),h(m(t),"emitAudioEvent",(function(e){var r,n,i={type:"audio",rawEvent:e,readyState:(null===(r=t._audioDom)||void 0===r?void 0:r.readyState)||0,userId:t.userId,eventName:e.type,currentTime:(null===(n=t._audioDom)||void 0===n?void 0:n.currentTime)||0};"playing"===e.type&&LW.print("AudioPlayerPlaying","[userId-".concat(t.userId,"] audio element playing")),"pause"===e.type&&LW.print("AudioPlayerPause","[userId-".concat(t.userId,"] audio element pause")),RP&&AP&&("canplay"===e.type?(clearTimeout(t._wechatTimer),t._wechatTimer=window.setTimeout((function(){t._autoPlayError("wechat")}),500)):"playing"===e.type&&clearTimeout(t._wechatTimer)),t.emit("playback_event",i)})),h(m(t),"_internalPlay",(function(){var e,r;if(XB("_internalPlay",{paused:null===(e=t._audioDom)||void 0===e?void 0:e.paused}),null!==(r=t._audioDom)&&void 0!==r&&r.paused)try{var n=t._audioDom.play();null!=n&&n.then&&n.catch((function(e){t._autoPlayError(e),MB.rtcError("audio autoplay failed, userId: ".concat(t.userId,": ").concat(e.message," ").concat(e.name),-1e3)})).then((function(){XB("_internalPlay successfully",{userId:t.userId})}))}catch(i){t._autoPlayError(i),MB.rtcError("audio autoplay failed, userId: ".concat(t.userId,": ").concat(i.message," ").concat(i.name),-1e3)}})),o){var c=document.getElementById(o);if(!c)throw new hN(dN.CANT_FIND_DOM,"can't find dom");t._containerDom=c}else t._containerDom=document.body;return t.userId=e,t.muted=a,t.isScreen=s,t._initAudio(),t}return l(i,[{key:"_initAudio",value:function(){this._audioDom||(this._audioDom=MW("audio",{style:{display:"none"},attributes:VW}),this._audioDom.volume=this.muted?0:1,this._audioDom.muted=this.muted,this._audioDom.id="".concat(this.userId,"_").concat(hP()),this._containerDom.appendChild(this._audioDom)),this._initListeners()}},{key:"_initListeners",value:function(){var e=this;this._audioDom&&UW.forEach((function(t){var r;null===(r=e._audioDom)||void 0===r||r.addEventListener(t,e.emitAudioEvent)}))}},{key:"_removeListeners",value:function(){var e=this;this._audioDom&&(UW.forEach((function(t){var r;null===(r=e._audioDom)||void 0===r||r.removeEventListener(t,e.emitAudioEvent)})),this._audioDom.removeEventListener("canplay",this._internalPlay),this._audioDom.removeEventListener("loadeddata",this._internalPlay))}},{key:"playAudio",value:(r=c(o().mark((function e(t){var r,n,i,a,s,c=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(LW.print("playAudio","play audio track: ".concat(this.userId)),!((a=this._audioDom)&&a.srcObject instanceof MediaStream&&a.srcObject.getTrackById(null===(r=t.getTrack())||void 0===r?void 0:r.id))){e.next=4;break}return e.abrupt("return");case 4:a||(this._initAudio(),a=this._audioDom),(s=new MediaStream).addTrack(t.getTrack("preprocessing")),a.srcObject=s,null===(n=a)||void 0===n||n.addEventListener("canplay",this._internalPlay),null===(i=a)||void 0===i||i.addEventListener("loadeddata",this._internalPlay),setTimeout((function(){return c._internalPlay()})),this.played=!0;case 12:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"_autoPlayError",value:function(e){var t,r;this._emitPlayFailed||(this._emitPlayFailed=!0,this.emit("playback_event",{type:"audio",rawEvent:e,readyState:(null===(t=this._audioDom)||void 0===t?void 0:t.readyState)||0,userId:this.userId,eventName:"autoplay-error",currentTime:(null===(r=this._audioDom)||void 0===r?void 0:r.currentTime)||0}))}},{key:"pause",value:function(){if(!this._audioDom)throw new hN(dN.INVALID_PARAMS,"Player not found");this._audioDom.pause()}},{key:"manuallyPlay",value:function(){var e;if(LW.print("Invoke AudioPlayer.manuallyPlay"),this._emitPlayFailed=!1,!this._audioDom)throw new hN(dN.INVALID_PARAMS,"Player not found");if(!this.played)return Promise.resolve();this._audioDom.volume=1,this._audioDom.muted=!1,null===(e=this._fakeAudioDom)||void 0===e||e.play();var t=this._audioDom.play();return null!=t&&t.then?t:Promise.resolve(t)}},{key:"setPlaybackDevice",value:(t=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return LW.print("setPlaybackDevice","setPlaybackDevice: ".concat(t)),e.next=3,UH.enumerateAudioPlaybackDevices();case 3:if(e.sent.map((function(e){return e.deviceId})).includes(t)&&this._audioDom&&this._audioDom.setSinkId){e.next=7;break}return e.abrupt("return");case 7:return e.next=9,this._audioDom.setSinkId(t);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"stop",value:function(){var e=this._containerDom;LW.print("stopAudio","stop audio track: ".concat(this.userId)),this._audioDom&&(this._audioDom.srcObject=null,null!=e&&e.contains(this._audioDom)&&e.removeChild(this._audioDom)),this._fakeAudioDom&&(this._fakeAudioDom.srcObject=null,this._fakeAudioDom=void 0),this.played=!1}},{key:"domElement",get:function(){return this._audioDom}},{key:"destroy",value:function(){LW.print("destroy","audio player: ".concat(this.userId)),this.stop(),b(p(i.prototype),"removeAllListeners",this).call(this),this._removeListeners(),this._audioDom&&(this._audioDom.srcObject=null,delete this._audioDom)}}]),i}(jL.exports.EventEmitter);function GW(e,t,r,n){var i=function(){var e=c(o().mark((function e(t,i){var a,s;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=null==n?void 0:n.get(i),Array.isArray(a)&&(a=null===(s=a)||void 0===s?void 0:s.find((function(e){return e.isScreen===r}))),!t){e.next=9;break}if(!t.played){e.next=8;break}return e.next=6,t.manuallyPlay();case 6:e.next=9;break;case 8:a&&(t instanceof BW&&a.videoTrack&&t.playVideo(a.videoTrack,a),t instanceof jW&&a.audioTrack&&t.playAudio(a.audioTrack));case 9:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}();if(t)return i(e.get(t),t);var a=[];return e.forEach((function(e,t){return a.push(i(e,t))})),Promise.all(a)}var HW=function(){function e(){u(this,e),h(this,"_timer",void 0),h(this,"userMessage",void 0),h(this,"roomMessage",void 0),this.userMessage={},this.roomMessage={},this._setTimer()}return l(e,[{key:"_setTimer",value:function(){var e=this;!function t(){e._reportAndgReset(),clearTimeout(e._timer),e._timer=setTimeout(t,1e4)}()}},{key:"_reportAndgReset",value:function(){(Object.keys(this.userMessage).length||Object.keys(this.roomMessage).length)&&(this._report(),this._reset())}},{key:"_report",value:function(){var e=this;MB.rtcMessageStatistics(Object.keys(this.userMessage).map((function(t){return e.userMessage[t]})),Object.keys(this.roomMessage).map((function(t){return e.roomMessage[t]})),"")}},{key:"_reset",value:function(){this.userMessage={},this.roomMessage={}}},{key:"_checkInitUserMessage",value:function(e,t){this.userMessage["".concat(t,"-").concat(e)]||(this.userMessage["".concat(t,"-").concat(e)]={dc_peer_user_id:e,dc_send_total:0,dc_recv_total:0,dc_send_ack:0,dc_send_fail:0,dc_fail_timeout:0,dc_fail_no_receiver:0,dc_fail_no_relay_path:0,dc_cost_time:0,dc_cost_e2s:0,dc_cost_s2s:0,dc_least_time:1/0,dc_most_time:0,dc_cost_peer_s2e:0,dc_send_ack_100:0,dc_send_ack_200:0,dc_send_ack_400:0,dc_send_ack_1s:0,dc_message_type:t,dc_send_binary:0})}},{key:"_sendUserMessage",value:function(e,t,r){this._checkInitUserMessage(e,t),this.userMessage["".concat(t,"-").concat(e)].dc_send_total++,r&&this.userMessage["".concat(t,"-").concat(e)].dc_send_binary++}},{key:"_recvUserMessage",value:function(e,t){this._checkInitUserMessage(e,t),this.userMessage["".concat(t,"-").concat(e)].dc_recv_total++}},{key:"_sendUserFail",value:function(e,t,r){var n=this.userMessage["".concat(t,"-").concat(e)];n&&(n.dc_send_fail++,this._handleUserFail(n,r))}},{key:"_handleUserFail",value:function(e,t){t&&(t.code||t.err)&&(t.code===dN.TIME_OUT?e.dc_fail_timeout++:t.err===bj.NO_RECEIVER?e.dc_fail_no_receiver++:t.err===bj.NO_RELAYPATH?e.dc_fail_no_relay_path++:t.err===bj.TIMEOUT&&e.dc_fail_timeout++)}},{key:"_sendUserAck",value:function(e,t,r,n,i){var o=this.userMessage["".concat(t,"-").concat(e)];o&&(o.dc_send_ack++,o.dc_cost_time+=r,o.dc_cost_s2s+=n||0,o.dc_cost_peer_s2e+=i,o.dc_cost_e2s+=r-(n||0)-i,r<=100?(o.dc_send_ack_100++,o.dc_send_ack_200++,o.dc_send_ack_400++,o.dc_send_ack_1s++):r<=200?(o.dc_send_ack_200++,o.dc_send_ack_400++,o.dc_send_ack_1s++):r<=400?(o.dc_send_ack_400++,o.dc_send_ack_1s++):r<=1e3&&o.dc_send_ack_1s++,r<o.dc_least_time&&(o.dc_least_time=r),r>o.dc_most_time&&(o.dc_most_time=r))}},{key:"sendRoomMessage",value:function(e,t){this.roomMessage[e]||(this.roomMessage[e]={dc_room_id:e,dc_send_total:0,dc_send_ack:0,dc_cost_time:0,dc_least_time:1/0,dc_most_time:0,dc_send_fail:0,dc_send_ack_100:0,dc_send_ack_200:0,dc_send_ack_400:0,dc_send_ack_1s:0,dc_send_binary:0}),this.roomMessage[e].dc_send_total++,t&&this.roomMessage[e].dc_send_binary++}},{key:"sendRoomFail",value:function(e){var t=this.roomMessage[e];t&&t.dc_send_fail++}},{key:"sendRoomAck",value:function(e,t){var r=this.roomMessage[e];r&&(r.dc_send_ack++,r.dc_cost_time+=t,t<r.dc_least_time&&(r.dc_least_time=t),t>r.dc_most_time&&(r.dc_most_time=t),t<=100?(r.dc_send_ack_100++,r.dc_send_ack_200++,r.dc_send_ack_400++,r.dc_send_ack_1s++):t<=200?(r.dc_send_ack_200++,r.dc_send_ack_400++,r.dc_send_ack_1s++):t<=400?(r.dc_send_ack_400++,r.dc_send_ack_1s++):t<=1e3&&r.dc_send_ack_1s++)}},{key:"sendP2PMessage",value:function(e,t){this._sendUserMessage(e,OB.P2P,t)}},{key:"recvP2PMessage",value:function(e){this._recvUserMessage(e,OB.P2P)}},{key:"sendP2PFail",value:function(e,t){this._sendUserFail(e,OB.P2P,t)}},{key:"sendP2PAck",value:function(e,t,r,n){this._sendUserAck(e,OB.P2P,t,r,n)}},{key:"sendP2POutRoomMessage",value:function(e,t){this._sendUserMessage(e,OB.P2P_OUTSIDE_ROOM,t)}},{key:"recvP2POutRoomMessage",value:function(e){this._recvUserMessage(e,OB.P2P_OUTSIDE_ROOM)}},{key:"sendP2POutRoomFail",value:function(e,t){this._sendUserFail(e,OB.P2P_OUTSIDE_ROOM,t)}},{key:"sendP2POutRoomAck",value:function(e,t,r,n){this._sendUserAck(e,OB.P2P_OUTSIDE_ROOM,t,r,n)}},{key:"sendP2serverMessage",value:function(e){this._sendUserMessage("",OB.P2SERVER,e)}},{key:"sendP2serverFail",value:function(e){this._sendUserFail("",OB.P2SERVER,e)}},{key:"sendP2serveAck",value:function(e){this._sendUserAck("",OB.P2SERVER,e,0,0)}},{key:"countP2PMessage",value:function(e,t,r,n,i){this.sendP2PMessage(t,r),e?this.sendP2PAck(t,Date.now()-n,i.s2s_time,i.s2e_time):this.sendP2PFail(t,i)}},{key:"countRoomMessage",value:function(e,t,r,n){this.sendRoomMessage(t,r),e?this.sendRoomAck(t,Date.now()-n):this.sendRoomFail(t)}},{key:"countUserMessageOutsideRoom",value:function(e,t,r,n,i){this.sendP2POutRoomMessage(t,r),e?this.sendP2POutRoomAck(t,Date.now()-n,i.s2s_time,i.s2e_time):this.sendP2POutRoomFail(t,i)}},{key:"countServerMessage",value:function(e,t,r,n){this.sendP2serverMessage(t),e?this.sendP2serveAck(Date.now()-r):this.sendP2serverFail(n)}},{key:"destroy",value:function(){this._reset(),clearTimeout(this._timer)}}]),e}(),zW="object"==typeof global&&global&&global.Object===Object&&global,XW="object"==typeof self&&self&&self.Object===Object&&self,KW=zW||XW||Function("return this")(),qW=KW.Symbol,WW=Object.prototype,YW=WW.hasOwnProperty,JW=WW.toString,QW=qW?qW.toStringTag:void 0;var ZW=Object.prototype.toString;var $W=qW?qW.toStringTag:void 0;function eY(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":$W&&$W in Object(e)?function(e){var t=YW.call(e,QW),r=e[QW];try{e[QW]=void 0;var n=!0}catch(o){}var i=JW.call(e);return n&&(t?e[QW]=r:delete e[QW]),i}(e):function(e){return ZW.call(e)}(e)}function tY(e){return null!=e&&"object"==typeof e}var rY=Array.isArray;function nY(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function iY(e){return e}function oY(e){if(!nY(e))return!1;var t=eY(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}var aY,sY=KW["__core-js_shared__"],cY=(aY=/[^.]+$/.exec(sY&&sY.keys&&sY.keys.IE_PROTO||""))?"Symbol(src)_1."+aY:"";var uY=Function.prototype.toString;var dY=/^\[object .+?Constructor\]$/,lY=Function.prototype,hY=Object.prototype,fY=lY.toString,pY=hY.hasOwnProperty,vY=RegExp("^"+fY.call(pY).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function _Y(e){return!(!nY(e)||(t=e,cY&&cY in t))&&(oY(e)?vY:dY).test(function(e){if(null!=e){try{return uY.call(e)}catch(t){}try{return e+""}catch(t){}}return""}(e));var t}function mY(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}var yY=Date.now;var gY,SY,bY,EY=function(){try{var e=_Y(t=function(e,t){return null==e?void 0:e[t]}(Object,"defineProperty"))?t:void 0;return e({},"",{}),e}catch(r){}var t}(),kY=EY,TY=kY?function(e,t){return kY(e,"toString",{configurable:!0,enumerable:!1,value:(r=t,function(){return r}),writable:!0});var r}:iY,IY=(gY=TY,SY=0,bY=0,function(){var e=yY(),t=16-(e-bY);if(bY=e,t>0){if(++SY>=800)return arguments[0]}else SY=0;return gY.apply(void 0,arguments)}),AY=IY,RY=/^(?:0|[1-9]\d*)$/;function wY(e,t){var r=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==r||"symbol"!=r&&RY.test(e))&&e>-1&&e%1==0&&e<t}function CY(e,t,r){"__proto__"==t&&kY?kY(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function OY(e,t){return e===t||e!=e&&t!=t}var xY=Object.prototype.hasOwnProperty;function DY(e,t,r){var n=e[t];xY.call(e,t)&&OY(n,r)&&(void 0!==r||t in e)||CY(e,t,r)}var NY=Math.max;function PY(e,t){return AY(function(e,t,r){return t=NY(void 0===t?e.length-1:t,0),function(){for(var n=arguments,i=-1,o=NY(n.length-t,0),a=Array(o);++i<o;)a[i]=n[t+i];i=-1;for(var s=Array(t+1);++i<t;)s[i]=n[i];return s[t]=r(a),mY(e,this,s)}}(e,t,iY),e+"")}function MY(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function LY(e){return null!=e&&MY(e.length)&&!oY(e)}var UY=Object.prototype;function VY(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||UY)}function FY(e){return tY(e)&&"[object Arguments]"==eY(e)}var BY=Object.prototype,jY=BY.hasOwnProperty,GY=BY.propertyIsEnumerable,HY=FY(function(){return arguments}())?FY:function(e){return tY(e)&&jY.call(e,"callee")&&!GY.call(e,"callee")},zY=HY;var XY="object"==typeof exports&&exports&&!exports.nodeType&&exports,KY=XY&&"object"==typeof module&&module&&!module.nodeType&&module,qY=KY&&KY.exports===XY?KW.Buffer:void 0,WY=(qY?qY.isBuffer:void 0)||function(){return!1},YY={};YY["[object Float32Array]"]=YY["[object Float64Array]"]=YY["[object Int8Array]"]=YY["[object Int16Array]"]=YY["[object Int32Array]"]=YY["[object Uint8Array]"]=YY["[object Uint8ClampedArray]"]=YY["[object Uint16Array]"]=YY["[object Uint32Array]"]=!0,YY["[object Arguments]"]=YY["[object Array]"]=YY["[object ArrayBuffer]"]=YY["[object Boolean]"]=YY["[object DataView]"]=YY["[object Date]"]=YY["[object Error]"]=YY["[object Function]"]=YY["[object Map]"]=YY["[object Number]"]=YY["[object Object]"]=YY["[object RegExp]"]=YY["[object Set]"]=YY["[object String]"]=YY["[object WeakMap]"]=!1;var JY="object"==typeof exports&&exports&&!exports.nodeType&&exports,QY=JY&&"object"==typeof module&&module&&!module.nodeType&&module,ZY=QY&&QY.exports===JY&&zW.process,$Y=function(){try{var e=QY&&QY.require&&QY.require("util").types;return e||ZY&&ZY.binding&&ZY.binding("util")}catch(t){}}(),eJ=$Y&&$Y.isTypedArray,tJ=eJ?function(e){return function(t){return e(t)}}(eJ):function(e){return tY(e)&&MY(e.length)&&!!YY[eY(e)]},rJ=tJ,nJ=Object.prototype.hasOwnProperty;function iJ(e,t){var r=rY(e),n=!r&&zY(e),i=!r&&!n&&WY(e),o=!r&&!n&&!i&&rJ(e),a=r||n||i||o,s=a?function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(e.length,String):[],c=s.length;for(var u in e)!t&&!nJ.call(e,u)||a&&("length"==u||i&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||wY(u,c))||s.push(u);return s}var oJ=function(e,t){return function(r){return e(t(r))}}(Object.keys,Object),aJ=oJ,sJ=Object.prototype.hasOwnProperty;function cJ(e){return LY(e)?iJ(e):function(e){if(!VY(e))return aJ(e);var t=[];for(var r in Object(e))sJ.call(e,r)&&"constructor"!=r&&t.push(r);return t}(e)}var uJ=Object.prototype.hasOwnProperty;function dJ(e){if(!nY(e))return function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t}(e);var t=VY(e),r=[];for(var n in e)("constructor"!=n||!t&&uJ.call(e,n))&&r.push(n);return r}var lJ,hJ=(lJ=function(e,t){!function(e,t,r,n){var i=!r;r||(r={});for(var o=-1,a=t.length;++o<a;){var s=t[o],c=n?n(r[s],e[s],s,r,e):void 0;void 0===c&&(c=e[s]),i?CY(r,s,c):DY(r,s,c)}}(t,function(e){return LY(e)?iJ(e,!0):dJ(e)}(t),e)},PY((function(e,t){var r=-1,n=t.length,i=n>1?t[n-1]:void 0,o=n>2?t[2]:void 0;for(i=lJ.length>3&&"function"==typeof i?(n--,i):void 0,o&&function(e,t,r){if(!nY(r))return!1;var n=typeof t;return!!("number"==n?LY(r)&&wY(t,r.length):"string"==n&&t in r)&&OY(r[t],e)}(t[0],t[1],o)&&(i=n<3?void 0:i,n=1),e=Object(e);++r<n;){var a=t[r];a&&lJ(e,a,r,i)}return e})));function fJ(e,t){return function(e,t){for(var r=-1,n=null==e?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}(t,(function(t){return e[t]}))}function pJ(e){return null==e?[]:fJ(e,cJ(e))}var vJ=de,_J=sr("iterator"),mJ=!vJ((function(){var e=new URL("b?a=1&b=2&c=3","http://a"),t=e.searchParams,r="";return e.pathname="c%20d",t.forEach((function(e,n){t.delete("b"),r+=n+e})),!t.sort||"http://a/c%20d?a=1&c=3"!==e.href||"3"!==t.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!t[_J]||"a"!==new URL("https://a@b").username||"b"!==new URLSearchParams(new URLSearchParams("a=b")).get("a")||"xn--e1aybc"!==new URL("http://тест").host||"#%D0%B1"!==new URL("http://a#б").hash||"a1c3"!==r||"x"!==new URL("http://x",void 0).host})),yJ=Re,gJ=2147483647,SJ=/[^\0-\u007E]/,bJ=/[.\u3002\uFF0E\uFF61]/g,EJ="Overflow: input needs wider integers to process",kJ=RangeError,TJ=yJ(bJ.exec),IJ=Math.floor,AJ=String.fromCharCode,RJ=yJ("".charCodeAt),wJ=yJ([].join),CJ=yJ([].push),OJ=yJ("".replace),xJ=yJ("".split),DJ=yJ("".toLowerCase),NJ=function(e){return e+22+75*(e<26)},PJ=function(e,t,r){var n=0;for(e=r?IJ(e/700):e>>1,e+=IJ(e/t);e>455;)e=IJ(e/35),n+=36;return IJ(n+36*e/(e+38))},MJ=function(e){var t=[];e=function(e){for(var t=[],r=0,n=e.length;r<n;){var i=RJ(e,r++);if(i>=55296&&i<=56319&&r<n){var o=RJ(e,r++);56320==(64512&o)?CJ(t,((1023&i)<<10)+(1023&o)+65536):(CJ(t,i),r--)}else CJ(t,i)}return t}(e);var r,n,i=e.length,o=128,a=0,s=72;for(r=0;r<e.length;r++)(n=e[r])<128&&CJ(t,AJ(n));var c=t.length,u=c;for(c&&CJ(t,"-");u<i;){var d=gJ;for(r=0;r<e.length;r++)(n=e[r])>=o&&n<d&&(d=n);var l=u+1;if(d-o>IJ((gJ-a)/l))throw kJ(EJ);for(a+=(d-o)*l,o=d,r=0;r<e.length;r++){if((n=e[r])<o&&++a>gJ)throw kJ(EJ);if(n==o){for(var h=a,f=36;;){var p=f<=s?1:f>=s+26?26:f-s;if(h<p)break;var v=h-p,_=36-p;CJ(t,AJ(NJ(p+v%_))),h=IJ(v/_),f+=36}CJ(t,AJ(NJ(h))),s=PJ(a,l,u==c),a=0,u++}}a++,o++}return wJ(t,"")},LJ=ro,UJ=ce,VJ=ve,FJ=Re,BJ=le,jJ=mJ,GJ=$n,HJ=jh,zJ=ed,XJ=sd,KJ=Ln,qJ=ph,WJ=qe,YJ=Xt,JJ=ga,QJ=So,ZJ=Fr,$J=Je,eQ=As,tQ=cs,rQ=Ee,nQ=ql,iQ=Bl,oQ=x_,aQ=PI,sQ=sr("iterator"),cQ="URLSearchParams",uQ="URLSearchParamsIterator",dQ=KJ.set,lQ=KJ.getterFor(cQ),hQ=KJ.getterFor(uQ),fQ=Object.getOwnPropertyDescriptor,pQ=function(e){if(!BJ)return UJ[e];var t=fQ(UJ,e);return t&&t.value},vQ=pQ("fetch"),_Q=pQ("Request"),mQ=pQ("Headers"),yQ=_Q&&_Q.prototype,gQ=mQ&&mQ.prototype,SQ=UJ.RegExp,bQ=UJ.TypeError,EQ=UJ.decodeURIComponent,kQ=UJ.encodeURIComponent,TQ=FJ("".charAt),IQ=FJ([].join),AQ=FJ([].push),RQ=FJ("".replace),wQ=FJ([].shift),CQ=FJ([].splice),OQ=FJ("".split),xQ=FJ("".slice),DQ=/\+/g,NQ=Array(4),PQ=function(e){return NQ[e-1]||(NQ[e-1]=SQ("((?:%[\\da-f]{2}){"+e+"})","gi"))},MQ=function(e){try{return EQ(e)}catch(T0){return e}},LQ=function(e){var t=RQ(e,DQ," "),r=4;try{return EQ(t)}catch(T0){for(;r;)t=RQ(t,PQ(r--),MQ);return t}},UQ=/[!'()~]|%20/g,VQ={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},FQ=function(e){return VQ[e]},BQ=function(e){return RQ(kQ(e),UQ,FQ)},jQ=XJ((function(e,t){dQ(this,{type:uQ,iterator:nQ(lQ(e).entries),kind:t})}),"Iterator",(function(){var e=hQ(this),t=e.kind,r=e.iterator.next(),n=r.value;return r.done||(r.value="keys"===t?n.key:"values"===t?n.value:[n.key,n.value]),r}),!0),GQ=function(e){this.entries=[],this.url=null,void 0!==e&&($J(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===TQ(e,0)?xQ(e,1):e:eQ(e)))};GQ.prototype={type:cQ,bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t,r,n,i,o,a,s,c=iQ(e);if(c)for(r=(t=nQ(e,c)).next;!(n=VJ(r,t)).done;){if(o=(i=nQ(ZJ(n.value))).next,(a=VJ(o,i)).done||(s=VJ(o,i)).done||!VJ(o,i).done)throw bQ("Expected sequence with length 2");AQ(this.entries,{key:eQ(a.value),value:eQ(s.value)})}else for(var u in e)YJ(e,u)&&AQ(this.entries,{key:u,value:eQ(e[u])})},parseQuery:function(e){if(e)for(var t,r,n=OQ(e,"&"),i=0;i<n.length;)(t=n[i++]).length&&(r=OQ(t,"="),AQ(this.entries,{key:LQ(wQ(r)),value:LQ(IQ(r,"="))}))},serialize:function(){for(var e,t=this.entries,r=[],n=0;n<t.length;)e=t[n++],AQ(r,BQ(e.key)+"="+BQ(e.value));return IQ(r,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var HQ=function(){qJ(this,zQ);var e=arguments.length>0?arguments[0]:void 0;dQ(this,new GQ(e))},zQ=HQ.prototype;if(HJ(zQ,{append:function(e,t){oQ(arguments.length,2);var r=lQ(this);AQ(r.entries,{key:eQ(e),value:eQ(t)}),r.updateURL()},delete:function(e){oQ(arguments.length,1);for(var t=lQ(this),r=t.entries,n=eQ(e),i=0;i<r.length;)r[i].key===n?CQ(r,i,1):i++;t.updateURL()},get:function(e){oQ(arguments.length,1);for(var t=lQ(this).entries,r=eQ(e),n=0;n<t.length;n++)if(t[n].key===r)return t[n].value;return null},getAll:function(e){oQ(arguments.length,1);for(var t=lQ(this).entries,r=eQ(e),n=[],i=0;i<t.length;i++)t[i].key===r&&AQ(n,t[i].value);return n},has:function(e){oQ(arguments.length,1);for(var t=lQ(this).entries,r=eQ(e),n=0;n<t.length;)if(t[n++].key===r)return!0;return!1},set:function(e,t){oQ(arguments.length,1);for(var r,n=lQ(this),i=n.entries,o=!1,a=eQ(e),s=eQ(t),c=0;c<i.length;c++)(r=i[c]).key===a&&(o?CQ(i,c--,1):(o=!0,r.value=s));o||AQ(i,{key:a,value:s}),n.updateURL()},sort:function(){var e=lQ(this);aQ(e.entries,(function(e,t){return e.key>t.key?1:-1})),e.updateURL()},forEach:function(e){for(var t,r=lQ(this).entries,n=JJ(e,arguments.length>1?arguments[1]:void 0),i=0;i<r.length;)n((t=r[i++]).value,t.key,this)},keys:function(){return new jQ(this,"keys")},values:function(){return new jQ(this,"values")},entries:function(){return new jQ(this,"entries")}},{enumerable:!0}),GJ(zQ,sQ,zQ.entries,{name:"entries"}),GJ(zQ,"toString",(function(){return lQ(this).serialize()}),{enumerable:!0}),zJ(HQ,cQ),LJ({global:!0,constructor:!0,forced:!jJ},{URLSearchParams:HQ}),!jJ&&WJ(mQ)){var XQ=FJ(gQ.has),KQ=FJ(gQ.set),qQ=function(e){if($J(e)){var t,r=e.body;if(QJ(r)===cQ)return t=e.headers?new mQ(e.headers):new mQ,XQ(t,"content-type")||KQ(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),tQ(e,{body:rQ(0,eQ(r)),headers:rQ(0,t)})}return e};if(WJ(vQ)&&LJ({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(e){return vQ(e,arguments.length>1?qQ(arguments[1]):{})}}),WJ(_Q)){var WQ=function(e){return qJ(this,yQ),new _Q(e,arguments.length>1?qQ(arguments[1]):{})};yQ.constructor=WQ,WQ.prototype=yQ,LJ({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:WQ})}}var YQ,JQ=ro,QQ=le,ZQ=mJ,$Q=ce,eZ=ga,tZ=Re,rZ=$n,nZ=Og,iZ=ph,oZ=Xt,aZ=Gp,sZ=QN,cZ=rl,uZ=Qc.codeAt,dZ=function(e){var t,r,n=[],i=xJ(OJ(DJ(e),bJ,"."),".");for(t=0;t<i.length;t++)r=i[t],CJ(n,TJ(SJ,r)?"xn--"+MJ(r):r);return wJ(n,".")},lZ=As,hZ=ed,fZ=x_,pZ={URLSearchParams:HQ,getState:lQ},vZ=Ln,_Z=vZ.set,mZ=vZ.getterFor("URL"),yZ=pZ.URLSearchParams,gZ=pZ.getState,SZ=$Q.URL,bZ=$Q.TypeError,EZ=$Q.parseInt,kZ=Math.floor,TZ=Math.pow,IZ=tZ("".charAt),AZ=tZ(/./.exec),RZ=tZ([].join),wZ=tZ(1..toString),CZ=tZ([].pop),OZ=tZ([].push),xZ=tZ("".replace),DZ=tZ([].shift),NZ=tZ("".split),PZ=tZ("".slice),MZ=tZ("".toLowerCase),LZ=tZ([].unshift),UZ="Invalid scheme",VZ="Invalid host",FZ="Invalid port",BZ=/[a-z]/i,jZ=/[\d+-.a-z]/i,GZ=/\d/,HZ=/^0x/i,zZ=/^[0-7]+$/,XZ=/^\d+$/,KZ=/^[\da-f]+$/i,qZ=/[\0\t\n\r #%/:<>?@[\\\]^|]/,WZ=/[\0\t\n\r #/:<>?@[\\\]^|]/,YZ=/^[\u0000-\u0020]+|[\u0000-\u0020]+$/g,JZ=/[\t\n\r]/g,QZ=function(e){var t,r,n,i;if("number"==typeof e){for(t=[],r=0;r<4;r++)LZ(t,e%256),e=kZ(e/256);return RZ(t,".")}if("object"==typeof e){for(t="",n=function(e){for(var t=null,r=1,n=null,i=0,o=0;o<8;o++)0!==e[o]?(i>r&&(t=n,r=i),n=null,i=0):(null===n&&(n=o),++i);return i>r&&(t=n,r=i),t}(e),r=0;r<8;r++)i&&0===e[r]||(i&&(i=!1),n===r?(t+=r?":":"::",i=!0):(t+=wZ(e[r],16),r<7&&(t+=":")));return"["+t+"]"}return e},ZZ={},$Z=aZ({},ZZ,{" ":1,'"':1,"<":1,">":1,"`":1}),e$=aZ({},$Z,{"#":1,"?":1,"{":1,"}":1}),t$=aZ({},e$,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),r$=function(e,t){var r=uZ(e,0);return r>32&&r<127&&!oZ(t,e)?e:encodeURIComponent(e)},n$={ftp:21,file:null,http:80,https:443,ws:80,wss:443},i$=function(e,t){var r;return 2==e.length&&AZ(BZ,IZ(e,0))&&(":"==(r=IZ(e,1))||!t&&"|"==r)},o$=function(e){var t;return e.length>1&&i$(PZ(e,0,2))&&(2==e.length||"/"===(t=IZ(e,2))||"\\"===t||"?"===t||"#"===t)},a$=function(e){return"."===e||"%2e"===MZ(e)},s$={},c$={},u$={},d$={},l$={},h$={},f$={},p$={},v$={},_$={},m$={},y$={},g$={},S$={},b$={},E$={},k$={},T$={},I$={},A$={},R$={},w$=function(e,t,r){var n,i,o,a=lZ(e);if(t){if(i=this.parse(a))throw bZ(i);this.searchParams=null}else{if(void 0!==r&&(n=new w$(r,!0)),i=this.parse(a,null,n))throw bZ(i);(o=gZ(new yZ)).bindURL(this),this.searchParams=o}};w$.prototype={type:"URL",parse:function(e,t,r){var n,i,o,a,s,c=this,u=t||s$,d=0,l="",h=!1,f=!1,p=!1;for(e=lZ(e),t||(c.scheme="",c.username="",c.password="",c.host=null,c.port=null,c.path=[],c.query=null,c.fragment=null,c.cannotBeABaseURL=!1,e=xZ(e,YZ,"")),e=xZ(e,JZ,""),n=sZ(e);d<=n.length;){switch(i=n[d],u){case s$:if(!i||!AZ(BZ,i)){if(t)return UZ;u=u$;continue}l+=MZ(i),u=c$;break;case c$:if(i&&(AZ(jZ,i)||"+"==i||"-"==i||"."==i))l+=MZ(i);else{if(":"!=i){if(t)return UZ;l="",u=u$,d=0;continue}if(t&&(c.isSpecial()!=oZ(n$,l)||"file"==l&&(c.includesCredentials()||null!==c.port)||"file"==c.scheme&&!c.host))return;if(c.scheme=l,t)return void(c.isSpecial()&&n$[c.scheme]==c.port&&(c.port=null));l="","file"==c.scheme?u=S$:c.isSpecial()&&r&&r.scheme==c.scheme?u=d$:c.isSpecial()?u=p$:"/"==n[d+1]?(u=l$,d++):(c.cannotBeABaseURL=!0,OZ(c.path,""),u=I$)}break;case u$:if(!r||r.cannotBeABaseURL&&"#"!=i)return UZ;if(r.cannotBeABaseURL&&"#"==i){c.scheme=r.scheme,c.path=cZ(r.path),c.query=r.query,c.fragment="",c.cannotBeABaseURL=!0,u=R$;break}u="file"==r.scheme?S$:h$;continue;case d$:if("/"!=i||"/"!=n[d+1]){u=h$;continue}u=v$,d++;break;case l$:if("/"==i){u=_$;break}u=T$;continue;case h$:if(c.scheme=r.scheme,i==YQ)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=cZ(r.path),c.query=r.query;else if("/"==i||"\\"==i&&c.isSpecial())u=f$;else if("?"==i)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=cZ(r.path),c.query="",u=A$;else{if("#"!=i){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=cZ(r.path),c.path.length--,u=T$;continue}c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=cZ(r.path),c.query=r.query,c.fragment="",u=R$}break;case f$:if(!c.isSpecial()||"/"!=i&&"\\"!=i){if("/"!=i){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,u=T$;continue}u=_$}else u=v$;break;case p$:if(u=v$,"/"!=i||"/"!=IZ(l,d+1))continue;d++;break;case v$:if("/"!=i&&"\\"!=i){u=_$;continue}break;case _$:if("@"==i){h&&(l="%40"+l),h=!0,o=sZ(l);for(var v=0;v<o.length;v++){var _=o[v];if(":"!=_||p){var m=r$(_,t$);p?c.password+=m:c.username+=m}else p=!0}l=""}else if(i==YQ||"/"==i||"?"==i||"#"==i||"\\"==i&&c.isSpecial()){if(h&&""==l)return"Invalid authority";d-=sZ(l).length+1,l="",u=m$}else l+=i;break;case m$:case y$:if(t&&"file"==c.scheme){u=E$;continue}if(":"!=i||f){if(i==YQ||"/"==i||"?"==i||"#"==i||"\\"==i&&c.isSpecial()){if(c.isSpecial()&&""==l)return VZ;if(t&&""==l&&(c.includesCredentials()||null!==c.port))return;if(a=c.parseHost(l))return a;if(l="",u=k$,t)return;continue}"["==i?f=!0:"]"==i&&(f=!1),l+=i}else{if(""==l)return VZ;if(a=c.parseHost(l))return a;if(l="",u=g$,t==y$)return}break;case g$:if(!AZ(GZ,i)){if(i==YQ||"/"==i||"?"==i||"#"==i||"\\"==i&&c.isSpecial()||t){if(""!=l){var y=EZ(l,10);if(y>65535)return FZ;c.port=c.isSpecial()&&y===n$[c.scheme]?null:y,l=""}if(t)return;u=k$;continue}return FZ}l+=i;break;case S$:if(c.scheme="file","/"==i||"\\"==i)u=b$;else{if(!r||"file"!=r.scheme){u=T$;continue}if(i==YQ)c.host=r.host,c.path=cZ(r.path),c.query=r.query;else if("?"==i)c.host=r.host,c.path=cZ(r.path),c.query="",u=A$;else{if("#"!=i){o$(RZ(cZ(n,d),""))||(c.host=r.host,c.path=cZ(r.path),c.shortenPath()),u=T$;continue}c.host=r.host,c.path=cZ(r.path),c.query=r.query,c.fragment="",u=R$}}break;case b$:if("/"==i||"\\"==i){u=E$;break}r&&"file"==r.scheme&&!o$(RZ(cZ(n,d),""))&&(i$(r.path[0],!0)?OZ(c.path,r.path[0]):c.host=r.host),u=T$;continue;case E$:if(i==YQ||"/"==i||"\\"==i||"?"==i||"#"==i){if(!t&&i$(l))u=T$;else if(""==l){if(c.host="",t)return;u=k$}else{if(a=c.parseHost(l))return a;if("localhost"==c.host&&(c.host=""),t)return;l="",u=k$}continue}l+=i;break;case k$:if(c.isSpecial()){if(u=T$,"/"!=i&&"\\"!=i)continue}else if(t||"?"!=i)if(t||"#"!=i){if(i!=YQ&&(u=T$,"/"!=i))continue}else c.fragment="",u=R$;else c.query="",u=A$;break;case T$:if(i==YQ||"/"==i||"\\"==i&&c.isSpecial()||!t&&("?"==i||"#"==i)){if(".."===(s=MZ(s=l))||"%2e."===s||".%2e"===s||"%2e%2e"===s?(c.shortenPath(),"/"==i||"\\"==i&&c.isSpecial()||OZ(c.path,"")):a$(l)?"/"==i||"\\"==i&&c.isSpecial()||OZ(c.path,""):("file"==c.scheme&&!c.path.length&&i$(l)&&(c.host&&(c.host=""),l=IZ(l,0)+":"),OZ(c.path,l)),l="","file"==c.scheme&&(i==YQ||"?"==i||"#"==i))for(;c.path.length>1&&""===c.path[0];)DZ(c.path);"?"==i?(c.query="",u=A$):"#"==i&&(c.fragment="",u=R$)}else l+=r$(i,e$);break;case I$:"?"==i?(c.query="",u=A$):"#"==i?(c.fragment="",u=R$):i!=YQ&&(c.path[0]+=r$(i,ZZ));break;case A$:t||"#"!=i?i!=YQ&&("'"==i&&c.isSpecial()?c.query+="%27":c.query+="#"==i?"%23":r$(i,ZZ)):(c.fragment="",u=R$);break;case R$:i!=YQ&&(c.fragment+=r$(i,$Z))}d++}},parseHost:function(e){var t,r,n;if("["==IZ(e,0)){if("]"!=IZ(e,e.length-1))return VZ;if(t=function(e){var t,r,n,i,o,a,s,c=[0,0,0,0,0,0,0,0],u=0,d=null,l=0,h=function(){return IZ(e,l)};if(":"==h()){if(":"!=IZ(e,1))return;l+=2,d=++u}for(;h();){if(8==u)return;if(":"!=h()){for(t=r=0;r<4&&AZ(KZ,h());)t=16*t+EZ(h(),16),l++,r++;if("."==h()){if(0==r)return;if(l-=r,u>6)return;for(n=0;h();){if(i=null,n>0){if(!("."==h()&&n<4))return;l++}if(!AZ(GZ,h()))return;for(;AZ(GZ,h());){if(o=EZ(h(),10),null===i)i=o;else{if(0==i)return;i=10*i+o}if(i>255)return;l++}c[u]=256*c[u]+i,2!=++n&&4!=n||u++}if(4!=n)return;break}if(":"==h()){if(l++,!h())return}else if(h())return;c[u++]=t}else{if(null!==d)return;l++,d=++u}}if(null!==d)for(a=u-d,u=7;0!=u&&a>0;)s=c[u],c[u--]=c[d+a-1],c[d+--a]=s;else if(8!=u)return;return c}(PZ(e,1,-1)),!t)return VZ;this.host=t}else if(this.isSpecial()){if(e=dZ(e),AZ(qZ,e))return VZ;if(t=function(e){var t,r,n,i,o,a,s,c=NZ(e,".");if(c.length&&""==c[c.length-1]&&c.length--,(t=c.length)>4)return e;for(r=[],n=0;n<t;n++){if(""==(i=c[n]))return e;if(o=10,i.length>1&&"0"==IZ(i,0)&&(o=AZ(HZ,i)?16:8,i=PZ(i,8==o?1:2)),""===i)a=0;else{if(!AZ(10==o?XZ:8==o?zZ:KZ,i))return e;a=EZ(i,o)}OZ(r,a)}for(n=0;n<t;n++)if(a=r[n],n==t-1){if(a>=TZ(256,5-t))return null}else if(a>255)return null;for(s=CZ(r),n=0;n<r.length;n++)s+=r[n]*TZ(256,3-n);return s}(e),null===t)return VZ;this.host=t}else{if(AZ(WZ,e))return VZ;for(t="",r=sZ(e),n=0;n<r.length;n++)t+=r$(r[n],ZZ);this.host=t}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||"file"==this.scheme},includesCredentials:function(){return""!=this.username||""!=this.password},isSpecial:function(){return oZ(n$,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;!t||"file"==this.scheme&&1==t&&i$(e[0],!0)||e.length--},serialize:function(){var e=this,t=e.scheme,r=e.username,n=e.password,i=e.host,o=e.port,a=e.path,s=e.query,c=e.fragment,u=t+":";return null!==i?(u+="//",e.includesCredentials()&&(u+=r+(n?":"+n:"")+"@"),u+=QZ(i),null!==o&&(u+=":"+o)):"file"==t&&(u+="//"),u+=e.cannotBeABaseURL?a[0]:a.length?"/"+RZ(a,"/"):"",null!==s&&(u+="?"+s),null!==c&&(u+="#"+c),u},setHref:function(e){var t=this.parse(e);if(t)throw bZ(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if("blob"==e)try{return new C$(e.path[0]).origin}catch(T0){return"null"}return"file"!=e&&this.isSpecial()?e+"://"+QZ(this.host)+(null!==t?":"+t:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse(lZ(e)+":",s$)},getUsername:function(){return this.username},setUsername:function(e){var t=sZ(lZ(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var r=0;r<t.length;r++)this.username+=r$(t[r],t$)}},getPassword:function(){return this.password},setPassword:function(e){var t=sZ(lZ(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var r=0;r<t.length;r++)this.password+=r$(t[r],t$)}},getHost:function(){var e=this.host,t=this.port;return null===e?"":null===t?QZ(e):QZ(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,m$)},getHostname:function(){var e=this.host;return null===e?"":QZ(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,y$)},getPort:function(){var e=this.port;return null===e?"":lZ(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""==(e=lZ(e))?this.port=null:this.parse(e,g$))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+RZ(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,k$))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){""==(e=lZ(e))?this.query=null:("?"==IZ(e,0)&&(e=PZ(e,1)),this.query="",this.parse(e,A$)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){""!=(e=lZ(e))?("#"==IZ(e,0)&&(e=PZ(e,1)),this.fragment="",this.parse(e,R$)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var C$=function(e){var t=iZ(this,O$),r=fZ(arguments.length,1)>1?arguments[1]:void 0,n=_Z(t,new w$(e,!1,r));QQ||(t.href=n.serialize(),t.origin=n.getOrigin(),t.protocol=n.getProtocol(),t.username=n.getUsername(),t.password=n.getPassword(),t.host=n.getHost(),t.hostname=n.getHostname(),t.port=n.getPort(),t.pathname=n.getPathname(),t.search=n.getSearch(),t.searchParams=n.getSearchParams(),t.hash=n.getHash())},O$=C$.prototype,x$=function(e,t){return{get:function(){return mZ(this)[e]()},set:t&&function(e){return mZ(this)[t](e)},configurable:!0,enumerable:!0}};if(QQ&&(nZ(O$,"href",x$("serialize","setHref")),nZ(O$,"origin",x$("getOrigin")),nZ(O$,"protocol",x$("getProtocol","setProtocol")),nZ(O$,"username",x$("getUsername","setUsername")),nZ(O$,"password",x$("getPassword","setPassword")),nZ(O$,"host",x$("getHost","setHost")),nZ(O$,"hostname",x$("getHostname","setHostname")),nZ(O$,"port",x$("getPort","setPort")),nZ(O$,"pathname",x$("getPathname","setPathname")),nZ(O$,"search",x$("getSearch","setSearch")),nZ(O$,"searchParams",x$("getSearchParams")),nZ(O$,"hash",x$("getHash","setHash"))),rZ(O$,"toJSON",(function(){return mZ(this).serialize()}),{enumerable:!0}),rZ(O$,"toString",(function(){return mZ(this).serialize()}),{enumerable:!0}),SZ){var D$=SZ.createObjectURL,N$=SZ.revokeObjectURL;D$&&rZ(C$,"createObjectURL",eZ(D$,SZ)),N$&&rZ(C$,"revokeObjectURL",eZ(N$,SZ))}hZ(C$,"URL"),JQ({global:!0,constructor:!0,forced:!ZQ,sham:!QQ},{URL:C$});var P$=function(){var e=c(o().mark((function e(t,r){var n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new Audio(URL.createObjectURL(new Blob([t],r))),e.prev=1,n.muted=!0,e.next=5,n.play();case 5:return n.pause(),e.abrupt("return",!0);case 9:return e.prev=9,e.t0=e.catch(1),e.abrupt("return",!1);case 12:case"end":return e.stop()}}),e,null,[[1,9]])})));return function(t,r){return e.apply(this,arguments)}}(),M$=Object.defineProperty,L$=Object.getOwnPropertyDescriptor,U$=function(e,t,r,n){for(var i,o=n>1?void 0:n?L$(t,r):t,a=e.length-1;a>=0;a--)(i=e[a])&&(o=(n?i(t,r,o):i(o))||o);return n&&o&&M$(t,r,o),o},V$=function(){function e(t){u(this,e),h(this,"_sharedAudioContext",new AudioContext),h(this,"_audioDestination",this._sharedAudioContext.createMediaStreamDestination()),h(this,"_localGainNode",this._sharedAudioContext.createGain()),h(this,"_bufferGainNode",this._sharedAudioContext.createGain()),h(this,"_audioBufferSource",void 0),h(this,"_localSource",void 0),h(this,"_context",void 0),h(this,"_failedAudioList",[]),h(this,"_startingIds",new Map),h(this,"mixingMap",new Map),h(this,"resourcesCache",new Map),h(this,"volumeConfig",new Map),h(this,"cachedBuffer",[]),h(this,"id","AudioMixingManager"),this._context=t,this._localGainNode.gain.value=1}var t,r,n;return l(e,[{key:"mixMediaStream",value:function(e){this._localSource&&this._localSource.disconnect(this._localGainNode),this._localSource=this._sharedAudioContext.createMediaStreamSource(e),this._localSource.connect(this._localGainNode).connect(this._audioDestination)}},{key:"startAudioMixing",value:(n=c(o().mark((function e(t,r,n){var i,a,s,c,u,d,l,h,f,p,v,_,m,y=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0===this._startingIds.get(t)){e.next=3;break}return console.warn("AudioMixing task id: ".concat(t," is starting")),e.abrupt("return");case 3:if(this._startingIds.set(t,t),console.log(this._startingIds),i=n.playCount,XP(a=n.type,"mixingType",pJ(re)),s=this._context.getLocalAudioTrack()){e.next=10;break}return e.abrupt("return");case 10:if((c=s.getTrack("preprocessing"))&&this.mixMediaStream(new MediaStream([c])),null!=(u=this.mixingMap.get(t))&&u.audioNode){u.audioNode.pause(),this._context.emitMessage({mixId:t,state:ne.AUDIO_MIXING_STATE_STOPPED,error:lN.AUDIO_MIXING_ERROR_OK});try{u.gainNode.disconnect(this._audioDestination),u.audioSource.disconnect(u.gainNode)}catch(o){}}if(!(l=this.resourcesCache.get(t))||l.filePath!==r){e.next=19;break}d=l.getAudioNode(),e.next=32;break;case 19:return e.next=21,fetch(r,{mode:"cors",credentials:"include"}).then((function(e){if(e.ok)return e.arrayBuffer();throw y._context.emitMessage({mixId:t,state:ne.AUDIO_MIXING_STATE_FAILED,error:lN.AUDIO_MIXING_ERROR_START_FAILED}),new hN(dN.LOAD_RESOURCES_FAILED,e.statusText)}));case 21:return h=e.sent,r.endsWith("mp3")?f={type:"audio/mpeg"}:r.endsWith("aac")&&(f={type:"audio/aac"}),e.next=25,P$(h,f);case 25:if(e.sent){e.next=29;break}throw this._context.emitMessage({mixId:t,state:ne.AUDIO_MIXING_STATE_FAILED,error:lN.AUDIO_MIXING_ERROR_START_FAILED}),new hN(dN.LOAD_RESOURCES_FAILED,"invalid audio resource");case 29:(d=new Audio).crossOrigin="anonymous",d.src=URL.createObjectURL(new Blob([h],f));case 32:return i<=0?d.loop=!0:i>0&&(p=i,d.onended=function(){--p>0?d.play():(y.mixingMap.delete(t),y._context.emitMessage({mixId:t,state:ne.AUDIO_MIXING_STATE_FINISHED,error:lN.AUDIO_MIXING_ERROR_OK}))}),e.prev=33,e.next=36,d.play();case 36:e.next=43;break;case 38:e.prev=38,e.t0=e.catch(33),console.error(e.t0),this._failedAudioList.push(d),this._context.onAutoPlayFailed({userId:this.id,kind:"audio",streamIndex:L.STREAM_INDEX_MAIN,mediaType:U.AUDIO});case 43:if(this._startingIds.delete(t),v=this._sharedAudioContext.createMediaElementSource(d),_=this._sharedAudioContext.createGain(),m=this.volumeConfig.get(t),_.gain.value=m?m/100:1,v.connect(_).connect(this._audioDestination),this.mixingMap.set(t,{audioSource:v,audioNode:d,gainNode:_,type:"file"}),a===re.PUBLISH)try{_.disconnect(this._sharedAudioContext.destination)}catch(o){}else _.connect(this._sharedAudioContext.destination);this._context.updateLocalAudioTrack(this._audioDestination.stream.getAudioTracks()[0],n.type),this._context.emitMessage({mixId:t,state:ne.AUDIO_MIXING_STATE_PLAYING,error:lN.AUDIO_MIXING_ERROR_OK});case 53:case"end":return e.stop()}}),e,this,[[33,38]])}))),function(e,t,r){return n.apply(this,arguments)})},{key:"stopAudioMixing",value:function(e){var t=this.mixingMap.get(e);t&&"file"===t.type&&(this.mixingMap.delete(e),t.audioNode.pause(),t.audioSource.disconnect(t.gainNode),t.gainNode.disconnect(this._audioDestination),this._context.emitMessage({mixId:e,state:ne.AUDIO_MIXING_STATE_STOPPED,error:lN.AUDIO_MIXING_ERROR_OK}))}},{key:"pauseAudioMixing",value:function(e){var t=this.mixingMap.get(e);t&&(this._context.emitMessage({mixId:e,state:ne.AUDIO_MIXING_STATE_PAUSED,error:lN.AUDIO_MIXING_ERROR_OK}),t.audioNode.pause())}},{key:"resumeAudioMixing",value:function(e){var t=this.mixingMap.get(e);t&&(this._context.emitMessage({mixId:e,state:ne.AUDIO_MIXING_STATE_PLAYING,error:lN.AUDIO_MIXING_ERROR_OK}),t.audioNode.play())}},{key:"preloadAudioMixing",value:(r=c(o().mark((function e(t,r){var n,i,a=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.stopAudioMixing(t),e.next=3,fetch(r,{mode:"cors",credentials:"include"}).then((function(e){if(e.ok)return e.arrayBuffer();throw new hN(dN.LOAD_RESOURCES_FAILED,e.statusText)})).catch((function(e){if(a._context.emitMessage({mixId:t,state:ne.AUDIO_MIXING_STATE_FAILED,error:lN.AUDIO_MIXING_ERROR_PRELOAD_FAILED}),e instanceof hN)throw e;throw new hN(dN.LOAD_RESOURCES_FAILED,"Load resources failed",e)}));case 3:return n=e.sent,r.endsWith("mp3")?i={type:"audio/mpeg"}:r.endsWith("aac")&&(i={type:"audio/aac"}),e.next=7,P$(n,i);case 7:if(e.sent){e.next=11;break}throw this._context.emitMessage({mixId:t,state:ne.AUDIO_MIXING_STATE_FAILED,error:lN.AUDIO_MIXING_ERROR_PRELOAD_FAILED}),new hN(dN.LOAD_RESOURCES_FAILED,"Load resources failed");case 11:this._context.emitMessage({mixId:t,state:ne.AUDIO_MIXING_STATE_PRELOADED,error:lN.AUDIO_MIXING_ERROR_OK}),this.resourcesCache.set(t,{getAudioNode:function(){return new Audio(URL.createObjectURL(new Blob([n],i)))},filePath:r});case 13:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"unloadAudioMixing",value:function(e){this.resourcesCache.has(e)&&this.resourcesCache.delete(e)}},{key:"getAudioMixingVolume",value:function(e){var t=this.mixingMap.get(e);return t?100*t.gainNode.gain.value:0}},{key:"setAudioMixingVolume",value:function(e,t){t<0?t=0:t>400&&(t=400),this.volumeConfig.set(e,t);var r=this.mixingMap.get(e);r&&(r.gainNode.gain.value=Number(t)/100)}},{key:"getAudioMixingDuration",value:function(e){var t=this.mixingMap.get(e),r=this.mixingMap.get(e);return t||r?t?1e3*t.audioNode.duration:r?1e3*r.audioNode.duration:0:0}},{key:"getAudioMixingCurrentPosition",value:function(e){var t=this.mixingMap.get(e);return t?1e3*t.audioNode.currentTime:0}},{key:"setAudioMixingPosition",value:function(e,t){var r=this.mixingMap.get(e);r&&(r.audioNode.currentTime=t/1e3,r.audioNode.play())}},{key:"enableAudioMixingBuffer",value:function(e){XP(e,"type",pJ(re));var t=this._context.getLocalAudioTrack();if(t){var r=t.getTrack("preprocessing");if(r&&this.mixMediaStream(new MediaStream([r])),e===re.PUBLISH)try{this._bufferGainNode.disconnect(this._sharedAudioContext.destination)}catch(n){}else this._bufferGainNode.connect(this._sharedAudioContext.destination);this._context.updateLocalAudioTrack(this._audioDestination.stream.getAudioTracks()[0],e),this._bufferGainNode.connect(this._audioDestination),this._context.emitMessage({mixId:-1,state:ne.AUDIO_MIXING_STATE_PCM_ENABLED,error:lN.AUDIO_MIXING_ERROR_OK})}}},{key:"disableAudioMixingBuffer",value:function(){if(this.cachedBuffer=[],this._audioBufferSource){try{this._audioBufferSource.disconnect(this._bufferGainNode),this._bufferGainNode.disconnect(this._audioDestination),this._bufferGainNode.disconnect(this._sharedAudioContext.destination)}catch(e){}finally{this._audioBufferSource=void 0}this._context.updateLocalAudioTrack(),this._context.emitMessage({mixId:-1,state:ne.AUDIO_MIXING_STATE_PCM_DISABLED,error:lN.AUDIO_MIXING_ERROR_OK})}}},{key:"pushAudioMixingBuffer",value:function(e){var t=this;if(!(this._audioBufferSource&&(this.cachedBuffer.push(e),this.cachedBuffer.length>0))){this._audioBufferSource=this._sharedAudioContext.createBufferSource(),this._audioBufferSource.buffer=e,this._audioBufferSource.connect(this._bufferGainNode);try{this._audioBufferSource.start()}catch(r){this._failedAudioList.push(this._audioBufferSource)}this._audioBufferSource.onended=function(){var e;if(null===(e=t._audioBufferSource)||void 0===e||e.disconnect(t._bufferGainNode),t._audioBufferSource=void 0,t.cachedBuffer.length){var r=t.cachedBuffer.shift();r&&t.pushAudioMixingBuffer(r)}}}}},{key:"stopAll",value:function(){var e=this;if(this._localSource)try{this._localSource.disconnect(this._localGainNode),delete this._localSource}catch(t){}this.mixingMap.forEach((function(t,r){e.stopAudioMixing(r)}))}},{key:"mixTrack",get:function(){return this._audioDestination.stream.getAudioTracks()[0]}},{key:"sharedAudioContext",get:function(){return this._sharedAudioContext}},{key:"resumeLocalPlay",value:(t=c(o().mark((function e(){var t,r,n,i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=[],r=A(this._failedAudioList),e.prev=2,r.s();case 4:if((n=r.n()).done){e.next=24;break}if(i=n.value,e.prev=6,!(i instanceof HTMLAudioElement)){e.next=13;break}return i.muted=!1,e.next=11,i.play();case 11:e.next=14;break;case 13:i.start();case 14:e.next=22;break;case 16:return e.prev=16,e.t0=e.catch(6),t.push(i),console.error(e.t0),this._context.onAutoPlayFailed({userId:this.id,kind:"audio",streamIndex:L.STREAM_INDEX_MAIN,mediaType:U.AUDIO}),e.abrupt("break",24);case 22:e.next=4;break;case 24:e.next=29;break;case 26:e.prev=26,e.t1=e.catch(2),r.e(e.t1);case 29:return e.prev=29,r.f(),e.finish(29);case 32:this._failedAudioList=t;case 33:case"end":return e.stop()}}),e,this,[[2,26,29,32],[6,16]])}))),function(){return t.apply(this,arguments)})},{key:"destroy",value:function(){var e=this._sharedAudioContext;"closed"!==e.state&&"function"==typeof e.close&&e.close(),this.cachedBuffer=[],this.mixingMap.clear(),this.resourcesCache.clear(),this.volumeConfig.clear(),this._startingIds=new Map}}]),e}();U$([HB("default","id","filePath","options")],V$.prototype,"startAudioMixing",1),U$([HB("default","id")],V$.prototype,"stopAudioMixing",1),U$([HB("default","id")],V$.prototype,"pauseAudioMixing",1),U$([HB("default","id")],V$.prototype,"resumeAudioMixing",1),U$([HB("default","id")],V$.prototype,"preloadAudioMixing",1),U$([HB("default","id")],V$.prototype,"unloadAudioMixing",1),U$([HB("default","id")],V$.prototype,"getAudioMixingVolume",1),U$([HB("default","id","volume")],V$.prototype,"setAudioMixingVolume",1),U$([HB("default","id")],V$.prototype,"getAudioMixingDuration",1),U$([HB("default","id")],V$.prototype,"getAudioMixingCurrentPosition",1),U$([HB("default","id","position")],V$.prototype,"setAudioMixingPosition",1),U$([HB("default","type")],V$.prototype,"enableAudioMixingBuffer",1),U$([HB()],V$.prototype,"disableAudioMixingBuffer",1),U$([HB("default","buffer")],V$.prototype,"pushAudioMixingBuffer",1);var F$=function(e){return e.NORMAL_USER="normalUser",e.SILENT_USER="silentUser",e}(F$||{}),B$=new JL("RTMClient",1),j$=function(e){f(_,e);var t,r,n,i,a,s,d,v=g(_);function _(e){var t;return u(this,_),h(m(t=v.call(this)),"_dataChannelSignal",null),h(m(t),"_handler",null),h(m(t),"_dataChannelSignalState",mX.DISCONNECTED),h(m(t),"_loginSessionId",null),h(m(t),"_userId",null),h(m(t),"_token",null),h(m(t),"_isReconnecting",!1),h(m(t),"_reconnectTimer",null),h(m(t),"_loginResolveCallback",null),h(m(t),"_loginRejectCallback",null),h(m(t),"_iceConfigNode",null),h(m(t),"_wait_login_token",!1),h(m(t),"_serverParamsCache",void 0),t._appId=e,t}return l(_,[{key:"login",value:function(e,t){var r=this;return new Promise((function(n,i){if(B$.print("login","invoke login, token: %o, userId: %o",e,t),r._loginSessionId)throw new hN(dN.ALREADY_LOGIN,"Already logined");if(r._loginResolveCallback)throw new hN(dN.LOGIN_FAILED,"Is logging in, please try again later.");r._userId=t,r._token=e,FB.setStats({rtc_app_id:r._appId,user_id:t}),r._loginResolveCallback=n,r._loginRejectCallback=i,r._dataChannelSignal?r._login():(B$.print("login","init dataChannelSingling"),r._dataChannelSignalState=mX.CONNECTING,r._createDataChannelSignaling(t).then((function(e){r._dataChannelSignal=e,r._login()})).catch((function(){r._onDisconnect()})))}))}},{key:"logout",value:(d=c(o().mark((function e(){var t;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._loginSessionId&&this._userId){e.next=2;break}throw new hN(dN.NOT_LOGIN,"login first");case 2:return e.next=4,null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("logout",{loginSessionId:this._loginSessionId,userId:this._userId,appId:this._appId},{functionType:Aj.C2RTM}).catch((function(){}));case 4:this._closeDataChannelSignaling(),this._clearState();case 6:case"end":return e.stop()}}),e,this)}))),function(){return d.apply(this,arguments)})},{key:"updateLoginToken",value:(s=c(o().mark((function e(t){var r=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._token=t,e.abrupt("return",new Promise((function(e,t){r._wait_login_token?(r._loginResolveCallback=e,r._loginRejectCallback=t,r._login()):e()})));case 2:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"getPeerOnlineStatus",value:(a=c(o().mark((function e(t){var r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._loginSessionId&&this._userId){e.next=2;break}throw new hN(dN.NOT_LOGIN,"login first");case 2:return this._checkDataChannelSignal(),e.next=5,this._dataChannelSignal.sendSignaling("getPeerOnlineStatus",{loginSessionId:this._loginSessionId,userId:this._userId,appId:this._appId,peerUserId:t},{functionType:Aj.C2RTM});case 5:return r=e.sent,e.abrupt("return",null==r?void 0:r.status);case 7:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"sendUserMessageOutsideRoom",value:(i=c(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._loginSessionId&&this._userId){e.next=2;break}throw new hN(dN.NOT_LOGIN,"login first");case 2:return this._checkDataChannelSignal(),e.abrupt("return",this._dataChannelSignal.sendP2PMessage({from:this._userId,app:this._appId,to:t,room:"",msg:r}));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return i.apply(this,arguments)})},{key:"setServerParams",value:(n=c(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,zP(t,"signature"),zP(r,"url"),this._loginSessionId&&this._userId){e.next=5;break}throw new hN(dN.NOT_LOGIN,"login first");case 5:return this._checkDataChannelSignal(),e.next=8,this._dataChannelSignal.sendSignaling("setServerParams",{loginSessionId:this._loginSessionId,userId:this._userId,appId:this._appId,signature:t,url:r},{functionType:Aj.C2RTM}).catch((function(e){throw new hN(dN.UNEXPECTED_ERROR,e.msg)}));case 8:this._serverParamsCache={signature:t,url:r},this.emit("onServerParamsSetResult"),e.next=16;break;case 12:throw e.prev=12,e.t0=e.catch(0),this.emit("onServerParamsSetResult",e.t0),e.t0;case 16:case"end":return e.stop()}}),e,this,[[0,12]])}))),function(e,t){return n.apply(this,arguments)})},{key:"sendServerMessage",value:(r=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._loginSessionId&&this._userId){e.next=2;break}throw new hN(dN.NOT_LOGIN,"login first");case 2:return this._checkDataChannelSignal(),e.abrupt("return",this._dataChannelSignal.sendP2PMessage({from:this._userId,app:this._appId,to:"",room:"",type:Sj.BUSINESS_SERVER,msg:t}));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"destroy",value:function(){this._clearState(),this._closeDataChannelSignaling(),b(p(_.prototype),"removeAllListeners",this).call(this),delete this._serverParamsCache}},{key:"_login",value:function(){var e=this;if(this._userId){var t=hP();this._checkDataChannelSignal(),this._dataChannelSignal.sendSignaling("login",{Token:_P.token2auth(this._appId,null,this._userId,this._token),timestamp:Date.now(),loginSessionId:t,params:{deviceType:"web",userAgent:window.navigator.userAgent,sdkVersion:oj.VERSION,deviceId:ej.getDeviceId(),appId:this._appId,userId:this._userId}},{functionType:Aj.C2RTM}).then((function(){"function"==typeof e._loginResolveCallback&&e._loginResolveCallback(),e._loginSessionId=t,e._wait_login_token=!1,e._serverParamsCache&&e.setServerParams(e._serverParamsCache.signature,e._serverParamsCache.url)})).catch((function(t){var r,n,i=t||{},o=i.code,a=i.message;e._wait_login_token=!1,o>=700&&o<800?708===o?(r=dN.INVALID_PARAMS,n="Invalid userId"):(r=dN.INVALID_TOKEN,n="Invalid token",e._wait_login_token=!0,e._loginRejectCallback||e.emit("onRTMTokenError")):(r=dN.LOGIN_FAILED,n="login failed"),"function"==typeof e._loginRejectCallback&&e._loginRejectCallback(new hN(r,a||n))})).finally((function(){e._loginResolveCallback=null,e._loginRejectCallback=null}))}}},{key:"_createDataChannelSignaling",value:(t=c(o().mark((function e(t){var r,n,i,a,s,c,u,d=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=new xj,i=this._iceConfigNode){e.next=16;break}return e.prev=3,e.next=6,null==n?void 0:n.getAccessNode(this._appId,"",t,ej.getDeviceId(),"");case 6:if(a=e.sent,i=a[0]){e.next=10;break}throw new Error;case 10:e.next=16;break;case 12:throw e.prev=12,e.t0=e.catch(3),XB("rtm.login.getNodeFailed","",0,!0),new hN(dN.ICE_SERVER_WRONG,"get ICE config failed");case 16:return XB("rtm.login.getNodeSuccess",i,0,!0),B$.print("_createDataChannelSignaling()","get node success",i),this._handler=sX(LB),null===(r=this._handler)||void 0===r||r.once("disconnect",(function(){B$.print("_createDataChannelSignaling()","recv BasicHandler event: disconnect"),d._onDisconnect()})),e.prev=20,e.next=23,null===(c=this._handler)||void 0===c?void 0:c.connect(i);case 23:s=e.sent,B$.print("_createDataChannelSignaling()","establish peerConnection success"),this._dataChannelSignalState=mX.CONNECTED,e.next=33;break;case 28:throw e.prev=28,e.t1=e.catch(20),this._iceConfigNode=null,this._dataChannelSignalState=mX.DISCONNECTED,new hN(dN.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed",e.t1);case 33:return u=new wj(s),B$.print("_createDataChannelSignaling()","send ping"),u.sendPingSignaling(),u.once("close",(function(){B$.print("_createDataChannelSignaling()","recv DataChannelSignaling event: close"),d._onDisconnect()})),u.on(pj.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM,(function(e){d.emit("onUserMessageReceivedOutsideRoom",{userId:e.from,message:e.msg})})),u.on(pj.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM,(function(e){d.emit("onUserBinaryMessageReceivedOutsideRoom",{userId:e.from,message:e.msg})})),u.on(pj.USER_DISCONNECTION,(function(){d.emit("onUserDisconnection"),d._clearState()})),u.on(pj.NODE_CHANGE,(function(e){XB("rtm.nodeChange",JSON.stringify(e),0,!0),Array.isArray(e.nodes)&&e.nodes.length&&(d._iceConfigNode=e.nodes[0]),d._loginResolveCallback&&d._loginRejectCallback?d._login():d._reconnect()})),e.abrupt("return",u);case 42:case"end":return e.stop()}}),e,this,[[3,12],[20,28]])}))),function(e){return t.apply(this,arguments)})},{key:"_closeDataChannelSignaling",value:function(){var e,t;null===(e=this._dataChannelSignal)||void 0===e||e.destroy(),this._dataChannelSignal=null,null===(t=this._handler)||void 0===t||t.destroy(),this._handler=null}},{key:"_checkDataChannelSignal",value:function(){if(!this._dataChannelSignal||this._dataChannelSignalState!==mX.CONNECTED)throw new hN(dN.NOT_CONNECTED_YET,"datachannel not connect")}},{key:"_onDisconnect",value:function(){this._dataChannelSignalState=mX.DISCONNECTED,this._closeDataChannelSignaling(),navigator.onLine?this._reconnect():this._reconnectTimer=self.setTimeout(this._reconnect.bind(this),3e3)}},{key:"_reconnect",value:function(){var e=this;!this._isReconnecting&&this._userId&&(B$.print("_reconnect()","start reconnect..."),this._isReconnecting=!0,this._createDataChannelSignaling(this._userId).then((function(t){B$.print("_reconnect()","reconnect success!"),e._dataChannelSignal=t,e._login(),e._reconnectTimer=null})).catch((function(t){B$.print("_reconnect()","Reconnecting error, will reconnect after 3s",t),e._reconnectTimer=self.setTimeout(e._reconnect.bind(e),3e3)})).finally((function(){e._isReconnecting=!1})))}},{key:"_clearState",value:function(){this._userId=null,this._token=null,this._loginSessionId=null,null!==this._reconnectTimer&&(self.clearTimeout(this._reconnectTimer),this._reconnectTimer=null)}}]),_}(jL.exports.EventEmitter),G$=function(e){f(a,e);var t,r,n,i=g(a);function a(e){var t;return u(this,a),h(m(t=i.call(this)),"_mediaServerClient",void 0),h(m(t),"_appId",void 0),h(m(t),"_reconnectTimer",void 0),h(m(t),"remoteStreams",void 0),t._appId=e,t.remoteStreams=new Map,t}return l(a,[{key:"connect",value:(n=c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._mediaServerClient=new gX({}),this._bindEvents(),e.next=4,this._mediaServerClient.connect(this._appId);case 4:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"startPlayPublicStream",value:(r=c(o().mark((function e(t){var r,n=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.remoteStreams.get(t)){e.next=2;break}throw new hN(dN.REPEAT_PLAY,"repeat play public media stream");case 2:return(r=new Yz(t,t,!1,{audiostream:!0,localaudio:!0,videostream:!0,localvideo:!0,extaudio:!1,extvideo:!1,videoDescriptions:[]})).on("onSEIMessage",(function(e){if(e instanceof Uint8Array)for(var t=BP(e),i=0;i<t.seiCount;i++)n.emit(Gz.ON_SEI_MESSAGED_RECEIVED,{sei:t.seis[i],publicStreamId:r.streamId})})),e.next=6,this._mediaServerClient.subscribePublicStream(r);case 6:return this.remoteStreams.set(t,r),e.abrupt("return",r);case 8:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"stopPlayPublicStream",value:function(e){var t=this.remoteStreams.get(e);if(t)return this.remoteStreams.delete(e),this._mediaServerClient.unsubscribePublicStream(t)}},{key:"destroy",value:function(){this.remoteStreams=new Map,this._mediaServerClient&&this._mediaServerClient.destroy()}},{key:"_handleReconnected",value:(t=c(o().mark((function e(){var t,r,n,i=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:clearTimeout(this._reconnectTimer),t=A(this.remoteStreams);try{for(n=function(){var e=E(r.value,1)[0];i.remoteStreams.delete(e),i.startPlayPublicStream(e).then((function(){var t=i.remoteStreams.get(e);i.safeEmit(Gz.RESUBSCRIBE,{stream:t})}))},t.s();!(r=t.n()).done;)n()}catch(o){t.e(o)}finally{t.f()}case 3:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"_reconnect",value:function(){var e=this;this._mediaServerClient.removeAllListeners(),this._mediaServerClient.destroy(),navigator.onLine?this.connect().then(this._handleReconnected.bind(this)):this._reconnectTimer=window.setTimeout((function(){return e.connect().then(e._handleReconnected.bind(e))}),3e3)}},{key:"_bindEvents",value:function(){var e,t,r=this;null===(e=this._mediaServerClient)||void 0===e||e.on(_j.ABNORMAL_DISCONNECTION,this._reconnect.bind(this)),null===(t=this._mediaServerClient)||void 0===t||t.on("onRemoteStreamStats",(function(e){r.emit("onRemoteStreamStats",e)}))}}]),a}($L),H$=new JL("AudioDeviceManager",1),z$=function(e){f(a,e);var t,r,n,i=g(a);function a(e){var t;return u(this,a),h(m(t=i.call(this)),"_audioLevelFetcher",void 0),h(m(t),"_playbackDeviceTestTimer",void 0),h(m(t),"_audioElement",void 0),h(m(t),"_audioTrack",void 0),h(m(t),"_mediaRecorder",void 0),h(m(t),"_recoderTimer",void 0),h(m(t),"_isAudioPlaybackDeviceTesting",!1),h(m(t),"_isAudioDeviceRecordTesting",!1),h(m(t),"_audioCaptureAndRecoderResolve",void 0),h(m(t),"_onAutoplayFailed",void 0),t._extensionManager=e,t}return l(a,[{key:"startAudioPlaybackDeviceTest",value:(n=c(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._isAudioPlaybackDeviceTesting&&!this._isAudioDeviceRecordTesting){e.next=2;break}throw new hN(dN.REPEAT_DEVICE_TEST,"device test cannot be called repeatedly at the same time.");case 2:return this._isAudioPlaybackDeviceTesting=!0,H$.print("startAudioPlaybackDeviceTest()","Invoke"),e.prev=4,e.next=7,this._playAudioFile(t,{loop:!0});case 7:e.next=14;break;case 9:throw e.prev=9,e.t0=e.catch(4),H$.print("startAudioPlaybackDeviceTest()","error",e.t0),this.stopAudioPlaybackDeviceTest(),e.t0;case 14:this._startEmitAudioPlaybackDeviceTestVolume(r);case 15:case"end":return e.stop()}}),e,this,[[4,9]])}))),function(e,t){return n.apply(this,arguments)})},{key:"stopAudioPlaybackDeviceTest",value:function(){this._isAudioPlaybackDeviceTesting&&(H$.print("stopAudioPlaybackDeviceTest()","Invoke"),this._isAudioPlaybackDeviceTesting=!1,this._stopEmitAudioPlaybackDeviceTestVolume(),this._destroyAudioElement())}},{key:"startAudioDeviceRecordTest",value:(r=c(o().mark((function e(t,r){var n=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(window.MediaRecorder){e.next=2;break}throw new hN(dN.NOT_SUPPORTED,"Your browser does not support MediaRecorder.");case 2:if(!this._isAudioDeviceRecordTesting){e.next=4;break}throw new hN(dN.REPEAT_DEVICE_TEST,"device test cannot be called repeatedly at the same time.");case 4:return this._isAudioDeviceRecordTesting=!0,H$.print("startAudioDeviceRecordTest()","Invoke"),this._recoderTimer=window.setTimeout((function(){H$.print("startAudioDeviceRecordTest()","".concat(3e4,'ms automatic call method "stopAudioDeviceRecordAndPlayTest"')),n._stopAudioCaptureAndRecoder()}),3e4),e.prev=7,this._onAutoplayFailed=r,e.next=11,this._startAudioCaptureAndRecoder(t);case 11:e.next=18;break;case 13:throw e.prev=13,e.t0=e.catch(7),this._isAudioDeviceRecordTesting=!1,delete this._onAutoplayFailed,e.t0;case 18:delete this._audioCaptureAndRecoderResolve;case 19:case"end":return e.stop()}}),e,this,[[7,13]])}))),function(e,t){return r.apply(this,arguments)})},{key:"stopAudioDeviceRecordAndPlayTest",value:function(){H$.print("stopAudioDeviceRecordAndPlayTest()","Invoke"),void 0!==this._recoderTimer&&(clearTimeout(this._recoderTimer),delete this._recoderTimer),this._stopAudioCaptureAndRecoder()}},{key:"stopAudioDevicePlayTest",value:function(){this._isAudioDeviceRecordTesting&&(H$.print("stopAudioDevicePlayTest()","Invoke"),this._isAudioDeviceRecordTesting=!1,this.stopAudioDeviceRecordAndPlayTest(),this._stopEmitAudioPlaybackDeviceTestVolume(),this._destroyAudioElement()),delete this._onAutoplayFailed}},{key:"getRecordTrack",value:function(){return this._audioTrack}},{key:"destroy",value:function(){H$.print("destroy()","Invoke"),b(p(a.prototype),"removeAllListeners",this).call(this),this.stopAudioPlaybackDeviceTest(),this.stopAudioDevicePlayTest()}},{key:"_playAudioFile",value:function(e,t){var r=this;return H$.print("_playAudioFile()","Invoke url=".concat(e,"; loop=").concat(t.loop)),new Promise((function(n,i){var a,s,u=MW("audio",{attributes:{src:e,crossOrigin:"anonymous"}});r._audioElement=u,u.loop=t.loop,r._audioLevelFetcher=new FH(u),u.onplaying=function(){u.onplaying=null,H$.print("_playAudioFile()","onplaying"),n()},u.onerror=function(){var e=c(o().mark((function e(t){var r,n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:H$.print("_playAudioFile()","onerror",t),n=t.message||(null==u||null===(r=u.error)||void 0===r?void 0:r.message),i(new hN(dN.LOAD_RESOURCES_FAILED,"Failed to play recorded audio"+(n?", reason: ".concat(n):".")));case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),null===(a=u.play())||void 0===a||null===(s=a.catch)||void 0===s||s.call(a,(function(e){H$.print("_playAudioFile()","autoplay error",e);var t="Failed to play recorded audio, ".concat(e.name,": ").concat(e.message);"NotAllowedError"===e.name&&r._onAutoplayFailed?r._onAutoplayFailed((function(){var e;return Promise.all([null===(e=r._audioLevelFetcher)||void 0===e?void 0:e.resume(),u.play()])})):i(new hN(dN.LOAD_RESOURCES_FAILED,t))}))}))}},{key:"_destroyAudioElement",value:function(){this._audioElement&&(H$.print("_destroyAudioElement()","Invoke"),this._audioElement.onplaying=null,this._audioElement.onerror=null,this._audioElement.src="",delete this._audioElement,"function"==typeof this._audioCaptureAndRecoderResolve&&this._audioCaptureAndRecoderResolve())}},{key:"_startEmitAudioPlaybackDeviceTestVolume",value:function(e){var t=this;e=Math.max(e,100),this._audioElement&&(H$.print("_startEmitAudioPlaybackDeviceTestVolume()","start timer(".concat(e,"ms)")),this._playbackDeviceTestTimer=self.setInterval((function(){t._audioLevelFetcher&&t.emit("onAudioPlaybackDeviceTestVolume",t._audioLevelFetcher.getAudioLevel())}),e))}},{key:"_stopEmitAudioPlaybackDeviceTestVolume",value:function(){var e;void 0!==this._playbackDeviceTestTimer&&(H$.print("_stopEmitAudioPlaybackDeviceTestVolume()","stop timer"),self.clearInterval(this._playbackDeviceTestTimer),delete this._playbackDeviceTestTimer),null===(e=this._audioLevelFetcher)||void 0===e||e.destroy(),delete this._audioLevelFetcher}},{key:"_startAudioCaptureAndRecoder",value:(t=c(o().mark((function e(t){var r,n=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,hz({},this._extensionManager);case 2:return this._audioTrack=e.sent,i=this._audioTrack.getTrack("preprocessing"),r=zH.get(i),H$.print("startAudioDeviceRecordTest()","create microphone track success!"),e.abrupt("return",new Promise((function(e,i){var a;"function"==typeof MediaRecorder.isTypeSupported&&(a=["audio/webm","audio/mp4"].find((function(e){return MediaRecorder.isTypeSupported(e)})),H$.print("startAudioDeviceRecordTest()","use mimeType: ".concat(a))),n._mediaRecorder=new MediaRecorder(r,a?{mimeType:a}:void 0);var s=n._mediaRecorder.mimeType;n._mediaRecorder.ondataavailable=function(){var r=c(o().mark((function r(a){var c,u;return o().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!n._isAudioDeviceRecordTesting){r.next=16;break}return H$.print("startAudioDeviceRecordTest()","get recorded file(mimeType: ".concat(s,").")),u=new Blob([a.data],{type:s}),r.prev=3,r.next=6,n._playAudioFile(URL.createObjectURL(u),{loop:!1});case 6:r.next=11;break;case 8:return r.prev=8,r.t0=r.catch(3),r.abrupt("return",i(r.t0));case 11:n._startEmitAudioPlaybackDeviceTestVolume(t),null===(c=n._audioElement)||void 0===c||c.addEventListener("ended",(function(){n.stopAudioDevicePlayTest(),e()})),n._audioCaptureAndRecoderResolve=e,r.next=17;break;case 16:e();case 17:case"end":return r.stop()}}),r,null,[[3,8]])})));return function(e){return r.apply(this,arguments)}}(),n._mediaRecorder.onerror=function(e){i(new hN(dN.AUDIO_DEVICE_TEST_FAILED,e.message||"mediaRecorder error"))},n._mediaRecorder.start()})));case 6:case"end":return e.stop()}var i}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"_stopAudioCaptureAndRecoder",value:function(){var e;this._mediaRecorder&&("recording"===this._mediaRecorder.state&&this._mediaRecorder.stop(),delete this._mediaRecorder),null===(e=this._audioTrack)||void 0===e||e.close(),delete this._audioTrack}}]),a}(jL.exports.EventEmitter),X$=function(){function e(){u(this,e),h(this,"engineBAC",{adm:{},agc:{},ans:{}}),h(this,"engineANM",{}),h(this,"bitrate",void 0),h(this,"sampleRate",void 0),h(this,"channel",void 0),h(this,"aec",void 0),h(this,"agc",void 0),h(this,"ans",void 0),this._init()}var t;return l(e,[{key:"_init",value:(t=c(o().mark((function e(){var t;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=new Dj,e.next=3,t.getAudioProfile();case 3:this.engineBAC=e.sent;case 4:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"updateEngineBAC",value:function(e){e&&(this.engineBAC={codec:i(i({},this.engineBAC.codec),e.codec),adm:i(i({},this.engineBAC.adm),e.adm)},this.setAEC(!!e.aec),this.setAGC(!!e.agc),this.setANS(!!e.ans))}},{key:"updateEngineANM",value:function(e){e&&(this.engineANM=e)}},{key:"setAudioProfile",value:function(e){var t,r,n;switch(e){case J.fluent:r=16e3,t=24e3;break;case J.standard:r=48e3,t=48e3;break;case J.hd:r=48e3,t=128e3,n=2;break;case J.standardStereo:r=48e3,t=8e4,n=2;break;case J.hdMono:r=48e3,t=128e3}t&&(this.bitrate=t),n&&(this.channel=n),r&&(this.sampleRate=r)}},{key:"setBitrate",value:function(e){e>128e3&&(e=128e3),this.bitrate=e}},{key:"setAEC",value:function(e){this.aec=e}},{key:"setAGC",value:function(e){this.agc=e}},{key:"setANS",value:function(e){this.ans=e}},{key:"getOpusConfigStr",value:function(){var e=";",t=this.config;return console.log("config",t),t.bitrate&&(e+="maxaveragebitrate=".concat(t.bitrate,";")),t.encSampleRate&&(e+="sprop-maxcapturerate=".concat(t.encSampleRate,";")),t.playbackRate&&(e+="maxplaybackrate=".concat(t.playbackRate,";")),t.encChannel&&t.encChannel>1&&(e+="sprop-stereo=1;"),t.channel&&t.channel>1&&(e+="stereo=1;"),console.log("configStr",e),e.slice(0,-1)}},{key:"config",get:function(){var e,t,r,n,i,o,a,s,c,u,d,l,h,f,p,v,_;return{bitrate:this.bitrate||(null===(e=this.engineANM.enc_param)||void 0===e?void 0:e.bitrate)||0,playChannel:(null===(t=this.engineBAC.adm)||void 0===t||null===(r=t.play)||void 0===r?void 0:r.chn)||1,encChannel:this.channel||(null===(n=this.engineANM)||void 0===n||null===(i=n.enc_param)||void 0===i?void 0:i.chn)||(null===(o=this.engineBAC.adm)||void 0===o||null===(a=o.record)||void 0===a?void 0:a.chn),channel:this.channel||(null===(s=this.engineBAC.adm)||void 0===s||null===(c=s.record)||void 0===c?void 0:c.chn),aec:this.aec,agc:this.agc,ans:this.ans,encSampleRate:this.sampleRate||(null===(u=this.engineBAC.codec)||void 0===u?void 0:u.enc_fs)||(null===(d=this.engineANM.enc_param)||void 0===d?void 0:d.sr)||(null===(l=this.engineBAC.adm)||void 0===l||null===(h=l.record)||void 0===h?void 0:h.sr),sampleRate:this.sampleRate||(null===(f=this.engineBAC.adm)||void 0===f||null===(p=f.record)||void 0===p?void 0:p.sr),playbackRate:null===(v=this.engineBAC.adm)||void 0===v||null===(_=v.play)||void 0===_?void 0:_.sr}}}]),e}(),K$=new JL("VideoSnapshot",1),q$=function(e){var t=null==e?void 0:e.domElement;if(t&&!t.paused&&4===t.readyState)return t},W$=function(){var e=c(o().mark((function e(t,r,n){var i,a,s,c,u,d,l,h;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=document.createElement("canvas"),a=i.getContext("2d")){e.next=4;break}throw new Error("canvas.getContext error");case 4:if(s=function(e,t,n){return t=t||e.width,n=n||e.height,i.width=t,i.height=n,r?a.setTransform(-1,0,0,1,t,0):a.setTransform(1,0,0,1,0,0),a.drawImage(e,0,0,t,n),a.getImageData(0,0,t,n)},c=Date.now(),!(u=q$(n))){e.next=16;break}return K$.print("takeSnapshot","VideoPlayer already set."),e.next=11,s(u,u.videoWidth,u.videoHeight);case 11:return d=e.sent,K$.print("takeSnapshot","success, cost ".concat(Date.now()-c,"ms")),e.abrupt("return",d);case 16:if(!window.ImageCapture){e.next=29;break}if("live"!==(l=new window.ImageCapture(t)).track.readyState||!l.track.enabled||l.track.muted){e.next=29;break}return K$.print("takeSnapshot","use ImageCapture"),e.t0=s,e.next=23,l.grabFrame();case 23:return e.t1=e.sent,e.next=26,(0,e.t0)(e.t1);case 26:return h=e.sent,K$.print("takeSnapshot","success, cost ".concat(Date.now()-c,"ms")),e.abrupt("return",h);case 29:return K$.print("takeSnapshot","use temp video"),e.abrupt("return",new Promise((function(e,r){var n=new MediaStream([t]),i=document.createElement("video");i.setAttribute("playsinline",""),i.muted=!0,document.body.appendChild(i),i.onplaying=function(){var r=s(i,i.videoWidth,i.videoHeight);K$.print("takeSnapshot","success, cost ".concat(Date.now()-c,"ms")),e(r),n.removeTrack(t),i.srcObject=null,i.load()},i.onerror=r,i.srcObject=n,i.play()})));case 31:case"end":return e.stop()}}),e)})));return function(t,r,n){return e.apply(this,arguments)}}(),Y$=function(){return{url:"",video:{codec:$.H264,width:640,height:360,fps:15,gop:2,kBitRate:J$(640,360,15)},audio:{codec:"AAC",kBitRate:64,sampleRate:48e3,channels:2,AACProfile:Z.LC},layout:{regions:[],appData:"",backgroundColor:"#000000"}}};function J$(e,t,r){return e*t<=288e3?r<=15?800:1200:e*t<=864e3?r<=15?1200:1800:e*t<=1152e3?r<=15?1600:2400:e*t<=2592e3?r<=15?2500:3750:r<=15?3300:5e3}function Q$(e){if("string"!=typeof e||!/^rtmps?:\/\//.test(e))throw new hN(dN.INVALID_PARAMS,"Invalid rtmp address")}function Z$(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(null==e||!e.length)throw new hN(dN.INVALID_PARAMS,"regions should not be empty.");var t,r=A(e);try{for(r.s();!(t=r.n()).done;){var n=t.value;if("string"!=typeof n.userId)throw new hN(dN.INVALID_PARAMS,"region.userId(".concat(n.userId,") should be a string."));if("boolean"!=typeof n.isScreenStream)throw new hN(dN.INVALID_PARAMS,"region.isScreenStream(".concat(n.isScreenStream,") should be a boolean."))}}catch(i){r.e(i)}finally{r.f()}}function $$(e,t){var r,n,i,o=function(e,r){var n=e.reduce((function(e,t){return null==e?void 0:e[t]}),t),i=e.reduce((function(e,t){return null==e?void 0:e[t]}),Y$());return n&&r(n)?n:i},a=function(e){return e%2==0?e:e+1},s=a(o(["video","width"],(function(e){return e>=2&&e<=1920}))),c=a(o(["video","height"],(function(e){return e>=2&&e<=1920}))),u=o(["video","fps"],(function(e){return e>=1&&e<=60})),d=(null===(r=t.video)||void 0===r?void 0:r.kBitRate)||0,l=o(["audio","sampleRate"],(function(e){return!![32e3,44100,48e3].find((function(t){return t===e||t/1e3===e}))}));return{type:"transcode",action:e,transcodeMeta:{transcode:{url:t.url},control:{protocol:"2.0"},audio:{codec:o(["audio","codec"],(function(e){return"AAC"===e})),bitRate:1e3*o(["audio","kBitRate"],(function(e){return e>=32&&e<=192})),sampleRate:l<100?1e3*l:l,channels:o(["audio","channels"],(function(e){return[1,2].includes(e)})),profile:o(["audio","AACProfile"],(function(e){return[Z.LC,Z.HEv1,Z.HEv2].includes(e)}))},video:{codec:o(["video","codec"],(function(e){return["H264","H265"].includes(e)})),fps:u,gop:o(["video","gop"],(function(e){return e>=1&&e<=5})),bitRate:1e3*(d>=16&&d<=1e4?d:J$(s,c,u)),width:s,height:c},layout:{canvas:{bgnd:o(["layout","backgroundColor"],(function(e){return/^#([0-9a-fA-F]{6}|[0-9a-fA-F]{3})$/.test(e)}))},regions:(null===(n=t.layout)||void 0===n||null===(i=n.regions)||void 0===i?void 0:i.map((function(e){return{alpha:!e.alpha||+e.alpha>1||+e.alpha<=0?1:+e.alpha,uid:e.userId,zorder:!e.zorder||+e.zorder<0||+e.zorder>100?0:+e.zorder,x:!e.x||+e.x>=1||+e.x<0?0:+e.x,y:!e.y||+e.y>=1||+e.y<0?0:+e.y,w:!e.w||+e.w>1||+e.w<=0?1:+e.w,h:!e.h||+e.h>1||+e.h<=0?1:+e.h,renderMode:e.renderMode&&[1,2,3].includes(e.renderMode)?e.renderMode:1,contentControl:e.contentControl&&[0,1,2].includes(e.contentControl)?e.contentControl:0,screen:!!e.isScreenStream}})))||[],app_data:o(["layout","appData"],(function(e){return"string"==typeof e}))}}}}var e0,t0={getDefaultValue:Y$,checkStartParams:function(e){var t;Q$(e.url),Z$(null===(t=e.layout)||void 0===t?void 0:t.regions)},checckUpdateParams:function(e){var t;e.url&&Q$(e.url),Z$(null===(t=e.layout)||void 0===t?void 0:t.regions)},getStartParams:function(e){return $$("started",e)},getUpdateParams:function(e){return $$("layoutChanged",e)}},r0=new WeakMap,n0=function(e,t,r){var n;if(requestAnimationFrame){var i=r0.get(e);null!==(n=i)&&void 0!==n&&n[t]?i0(e,t):i||(i={},r0.set(e,i));var o=e[t];!function n(){var a=requestAnimationFrame(n);i[t]=a;var s=e[t];o!==s&&(o=s,r(s))}()}},i0=function(e,t){var r=r0.get(e);t&&r[t]?cancelAnimationFrame(r[t]):Object.keys(r).length&&Object.keys(r).forEach((function(e){cancelAnimationFrame(r[e])}))},o0=Object.defineProperty,a0=Object.getOwnPropertyDescriptor,s0=function(e,t,r,n){for(var i,o=n>1?void 0:n?a0(t,r):t,a=e.length-1;a>=0;a--)(i=e[a])&&(o=(n?i(t,r,o):i(o))||o);return n&&o&&o0(t,r,o),o},c0=new JL("Engine",0),u0=function(e){f(je,e);var t,r,n,a,s,d,v,_,y,S,k,T,I,C,O,x,P,M,j,G,H,z,q,W,J,Z,$,ee,te,ne,ie,ae,se,ce,ue,de,le,he,fe,pe,ve,_e,me,ye,ge,Se,be,Ee,ke,Te,Ie,Ae,Re,we,Ce,Oe,xe,De,Ne,Pe,Me,Le,Ue,Ve,Fe,Be=g(je);function je(e,t){var r;return u(this,je),h(m(r=Be.call(this)),"_room",void 0),h(m(r),"_outsideRoom",void 0),h(m(r),"_appId",void 0),h(m(r),"_businessId",void 0),h(m(r),"_visibility",!0),h(m(r),"_localVideoTrack",void 0),h(m(r),"_localAudioTrack",void 0),h(m(r),"_localImgVideoTrack",void 0),h(m(r),"_localImgScreenTrack",void 0),h(m(r),"_localScreenVideoTrack",void 0),h(m(r),"_localScreenAudioTrack",void 0),h(m(r),"_tempMixingAudioTrack",void 0),h(m(r),"_audioPlaybackDeviceId",void 0),h(m(r),"_videoPlayer",void 0),h(m(r),"_screenPlayer",void 0),h(m(r),"_remoteVideoPlayer",new Map),h(m(r),"_remoteScreenPlayer",new Map),h(m(r),"_remoteAudioPlayer",new Map),h(m(r),"_remoteScreenAudioPlayer",new Map),h(m(r),"_publicStreamAudioPlayer",new Map),h(m(r),"_publicStreamVideoPlayer",new Map),h(m(r),"_publicStreamIds",new Map),h(m(r),"_roomConfig",void 0),h(m(r),"_videoStreamConstraints",{width:640,height:360,frameRate:15}),h(m(r),"_audioStreamConstraints",{}),h(m(r),"_enableSimulcast",!1),h(m(r),"_videoStreamEncodeConfig",[dj]),h(m(r),"_screenStreamEncodeConfig",[lj]),h(m(r),"_dummyMainImage",void 0),h(m(r),"_dummyScreenImage",void 0),h(m(r),"_trackSourceType",void 0),h(m(r),"_liveTranscodeConfig",void 0),h(m(r),"_useCloudProxy",void 0),h(m(r),"_startCloudProxyTimestamp",void 0),h(m(r),"_localVideoDeviceId",void 0),h(m(r),"_localAudioDeviceId",void 0),h(m(r),"_pauseAllSubscribeState",{audio:void 0,video:void 0,resumeStreamIds:{}}),h(m(r),"_audioVolumeIndicationTimer",void 0),h(m(r),"_dummyMainTimer",void 0),h(m(r),"_dummyScreenTimer",void 0),h(m(r),"_audioPropertiesReportTimer",null),h(m(r),"_mirrorType",B.MIRROR_TYPE_RENDER),h(m(r),"_audioMixingManager",void 0),h(m(r),"_pubLock",void 0),h(m(r),"_rtmClient",void 0),h(m(r),"_messageStatisticsObserver",void 0),h(m(r),"_tempRoomInfo",void 0),h(m(r),"_originIceConfigRequestUrls",void 0),h(m(r),"_originConfigServerUrls",void 0),h(m(r),"_originLogServerUrl",void 0),h(m(r),"_extensionManager",new GH),h(m(r),"_audioDeviceManager",new z$(r._extensionManager)),h(m(r),"_audioProfileManager",new X$),h(m(r),"_remoteVideoConfig",new Map),h(m(r),"_userPriorityMap",new Map),h(m(r),"_subscribeFallbackOption",X.DISABLE),h(m(r),"_cameraCapturing",!1),h(m(r),"_interruptCameraCapture",!1),h(m(r),"_micCapturing",!1),h(m(r),"_interruptMicCapture",!1),h(m(r),"_config",void 0),h(m(r),"_needClosePreTrack",!1),h(m(r),"_updateMixAudioTrack",function(){var e=c(o().mark((function e(t){var n,i,a=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=a.length>1&&void 0!==a[1]?a[1]:re.PLAYOUT_AND_PUBLISH,c0.print("_updateMixAudioTrack()"),r._localAudioTrack){e.next=5;break}return t&&(r._tempMixingAudioTrack={track:t,type:i}),e.abrupt("return");case 5:if(t?(r._localAudioTrack.mixType=i,r._localAudioTrack.mixedAudioTrack=t):(delete r._localAudioTrack.mixType,delete r._localAudioTrack.mixedAudioTrack),null===(n=r._room)||void 0===n||!n.hasPublished){e.next=9;break}return e.next=9,r._updatePublish();case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),h(m(r),"_onAudioMixingMessage",(function(e){r.safeEmit(oe.onAudioMixingStateChanged,e)})),h(m(r),"_onAudioMixingAutoplayFailed",(function(e){r.safeEmit(oe.onAutoplayFailed,e)})),r._appId=e,r._pubLock=new dX("pubLock"),r._addDeviceEventHandler(),r._audioMixingManager=new V$({getLocalAudioTrack:function(){return r._localAudioTrack},updateLocalAudioTrack:r._updateMixAudioTrack,emitMessage:r._onAudioMixingMessage,onAutoPlayFailed:r._onAudioMixingAutoplayFailed}),window.__rtc_engine__=m(r),window["__rtc_engine__".concat(Math.floor(100*Math.random()+1))]=m(r),r._trackSourceType={video:R.VIDEO_SOURCE_TYPE_INTERNAL,screenVideo:R.VIDEO_SOURCE_TYPE_INTERNAL,audio:w.AUDIO_SOURCE_TYPE_INTERNAL,screenAudio:w.AUDIO_SOURCE_TYPE_INTERNAL},r._config=t,r._rtmClient=new j$(e),r._handleRTMClient(r._rtmClient),r._useCloudProxy=!1,r._handleAudioDeviceManager(),r._messageStatisticsObserver=new HW,r._extensionManager.setMinotor(MB),r}return l(je,[{key:"appId",get:function(){return this._appId},set:function(e){this._appId=e}},{key:"updateToken",value:(Fe=c(o().mark((function e(t){var r,n,i,a,s;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c0.print("updateToken()","token: %s",t),zP(t,"token"),!this.waitForNewToken||!this._tempRoomInfo){e.next=8;break}return n=this._tempRoomInfo,i=n.config,a=n.userInfo,s=n.roomId,delete this._tempRoomInfo,e.next=7,this.joinRoom(t,s,a,i);case 7:return e.abrupt("return",e.sent);case 8:if(this._room){e.next=10;break}throw new hN(dN.UPDATE_TOKEN_BEFORE_JOIN,"update token before join room");case 10:return e.next=12,null===(r=this._room)||void 0===r?void 0:r.updateToken(t);case 12:case"end":return e.stop()}}),e,this)}))),function(e){return Fe.apply(this,arguments)})},{key:"setVideoCaptureDevice",value:(Ve=c(o().mark((function e(t){var r,n,i=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c0.print("setVideoCaptureDevice()","deviceId: %s",t),zP(t,"deviceId"),this._localVideoDeviceId=t,this._localVideoTrack){e.next=5;break}return e.abrupt("return");case 5:return r=hJ({},this._videoStreamConstraints),"user"===t||"environment"===t||"left"===t||"right"===t?(delete r.deviceId,r.facingMode=t):r.deviceId={exact:t},this._needClosePreTrack&&(this._removeLocalTrackEvents(this._localVideoTrack),this._localVideoTrack.close(),delete this._localVideoTrack),c0.print("setVideoCaptureDevice()","start createCameraVideoTrack..."),e.next=11,dz(r,this._extensionManager).catch((function(e){if(i._localVideoTrack&&!i._localVideoTrack.dummy)return c0.print("setVideoCaptureDevice()","createCameraVideoTrack failed, stop pre VideoTrack."),i._removeLocalTrackEvents(i._localVideoTrack),i._localVideoTrack.close(),delete i._localVideoTrack,dz(r,i._extensionManager).then((function(e){return i._needClosePreTrack=!0,e})).catch(c(o().mark((function t(){var r;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return c0.print("setVideoCaptureDevice()","createCameraVideoTrack failed, rollback."),t.next=3,dz(i._videoStreamConstraints,i._extensionManager);case 3:throw r=t.sent,i._switchTrack(r),e;case 6:case"end":return t.stop()}}),t)}))));throw e}));case 11:return n=e.sent,c0.print("setVideoCaptureDevice()","createCameraVideoTrack success."),this._videoStreamConstraints=r,this._localVideoTrack&&(this._removeLocalTrackEvents(this._localVideoTrack),this._localVideoTrack.close()),e.next=17,this._switchTrack(n);case 17:case"end":return e.stop()}}),e,this)}))),function(e){return Ve.apply(this,arguments)})},{key:"setAudioCaptureDevice",value:(Ue=c(o().mark((function e(t){var r,n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c0.print("setAudioCaptureDevice()","deviceId: %s",t),zP(t,"deviceId"),this._localAudioDeviceId=t,this._localAudioTrack){e.next=5;break}return e.abrupt("return");case 5:return(r=this._audioStreamConstraints).deviceId={exact:t},this._audioStreamConstraints=r,this._localAudioTrack.close(),this._removeLocalTrackEvents(this._localAudioTrack),e.next=12,hz(r,this._extensionManager,this._audioProfileManager);case 12:if(n=e.sent,this._initLocalTrackEvents(n),this._localAudioTrack=n,this._room){e.next=17;break}return e.abrupt("return");case 17:if(!this._room.hasPublished){e.next=20;break}return e.next=20,this._updatePublish();case 20:case"end":return e.stop()}}),e,this)}))),function(e){return Ue.apply(this,arguments)})},{key:"_addDeviceEventHandler",value:function(){UH.on(oe.onVideoDeviceStateChanged,this._onVideoDeviceStateChange.bind(this)),UH.on(oe.onAudioDeviceStateChanged,this._onAudioDeviceStateChange.bind(this))}},{key:"_addHandlerEventHandler",value:function(){var e,t,r,n,i,o,a,s,c,u,d,l,h,f,p,v,_,m,y,g,S,b,E,k,T,I,A,R,w,C=this;null===(e=this._room)||void 0===e||e.on(pj.ON_ADD_STREAM,this._onAddStream.bind(this)),null===(t=this._room)||void 0===t||t.on(pj.ON_REMOVE_STREAM,this._onRemoveStream.bind(this)),null===(r=this._room)||void 0===r||r.on(pj.USER_CONNECTION,this._onUserConnection.bind(this)),null===(n=this._room)||void 0===n||n.on(Gz.ON_USER_LEAVE,this._onUserLeave.bind(this)),null===(i=this._room)||void 0===i||i.on(Gz.ON_ROOM_ERROR,this._onRoomError.bind(this)),null===(o=this._room)||void 0===o||o.on(Gz.ON_NETWORK_QUALITY,this._onNetworkQuality.bind(this)),null===(a=this._room)||void 0===a||a.on(pj.ON_CUSTOM_MESSAGE,this._onCustomMessage.bind(this)),null===(s=this._room)||void 0===s||s.on(pj.USER_MESSAGE_RECEIVED,this._onUserMessageReceived.bind(this)),null===(c=this._room)||void 0===c||c.on(pj.USER_BINARY_MESSAGE_RECEIVED,this._onUserBinaryMessageReceived.bind(this)),null===(u=this._room)||void 0===u||u.on(pj.ON_USER_TOKEN_WILL_EXPIRE,this._onUserTokenWillExpire.bind(this)),null===(d=this._room)||void 0===d||d.on(pj.POST_PROCESSING_MESSAGE,(function(e){"2.0"===e.protocol?C._onStreamMixingEvent({error:e.error,event:e.eventType,message:e.message}):"publicStreamCallback"===e.type?C._onPushPublicStreamResult(e):"transcodeStatusCallback"===e.type&&C._onLiveTranscodingResult(e)})),null===(l=this._room)||void 0===l||l.on(_j.ON_CONNECTION_STATE_CHANGE,this._onConnectionStateChange.bind(this)),null===(h=this._room)||void 0===h||h.on(Gz.RESUBSCRIBE,this._onResubscribe.bind(this)),null===(f=this._room)||void 0===f||f.on(Gz.SUBSCRIBE_PUSH_TRACK,this._onSubscribePushTrack.bind(this)),null===(p=this._room)||void 0===p||p.on(Gz.REMOVE_PUSH_TRACK,this._onRemovePushTrack.bind(this)),null===(v=this._room)||void 0===v||v.on(Gz.ON_PUBLISH_RESULT,(function(e){var t;null!==(t=C._room)&&void 0!==t&&t._roomConfig.isAutoPublish&&C.safeEmit(oe.onAutoPublishResult,e)})),null===(_=this._room)||void 0===_||_.on(Gz.ON_REMOTE_STREAM_STATS,(function(e){C.safeEmit(oe.onRemoteStreamStats,e)})),null===(m=this._room)||void 0===m||m.on(Gz.ON_LOCAL_STREAM_STATS,(function(e){C.safeEmit(oe.onLocalStreamStats,e)})),null===(y=this._room)||void 0===y||y.on(Gz.ON_USER_PUBLISH_STATE_CHANGE,this._onUserPublishStateChange.bind(this)),null===(g=this._room)||void 0===g||g.on(Gz.ON_USER_START_AUDIO_CAPTURE,(function(e,t){var r=e.userId;C._updateAudioPlayerState(t),C.safeEmit(oe.onUserStartAudioCapture,{userId:r})})),null===(S=this._room)||void 0===S||S.on(Gz.ON_USER_STOP_AUDIO_CAPTURE,(function(e){var t=e.userId;C.safeEmit(oe.onUserStopAudioCapture,{userId:t})})),null===(b=this._room)||void 0===b||b.on(Gz.ON_USER_START_VIDEO_CAPTURE,(function(e){var t=e.userId;C.safeEmit(oe.onUserStartVideoCapture,{userId:t})})),null===(E=this._room)||void 0===E||E.on(Gz.ON_USER_STOP_VIDEO_CAPTURE,(function(e){var t=e.userId;C.safeEmit(oe.onUserStopVideoCapture,{userId:t})})),null===(k=this._room)||void 0===k||k.on(Gz.ON_SEI_MESSAGED_RECEIVED,(function(e){C.safeEmit(oe.onSEIMessageReceived,e)})),null===(T=this._room)||void 0===T||T.on(Gz.ON_REMOTE_VIDEO_SIZE_CHANGED,(function(e,t){C.safeEmit(oe.onRemoteVideoSizeChanged,e,t)})),null===(I=this._room)||void 0===I||I.on(Gz.ON_SIMULCAST_SUBSCRIBE_FALLBACK,(function(e){return C.safeEmit(oe.onSimulcastSubscribeFallback,e)})),null===(A=this._room)||void 0===A||A.on(Gz.RECONNECT_FAILED,(function(){C.safeEmit(oe.onError,{errorCode:dN.RECONNECT_FAILED})})),null===(R=this._room)||void 0===R||R.on(Gz.ON_VIDEO_STREAM_BANNED,(function(e){C.safeEmit(oe.onVideoStreamBanned,{uid:e.uid,banned:e.banned})})),null===(w=this._room)||void 0===w||w.on(Gz.ON_AUDIO_STREAM_BANNED,(function(e){C.safeEmit(oe.onAudioStreamBanned,{uid:e.uid,banned:e.banned})}))}},{key:"safeEmit",value:function(e){for(var t,r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return oM(e)&&zB(e,NP(n)),(t=b(p(je.prototype),"safeEmit",this)).call.apply(t,[this,e].concat(n))}},{key:"_removeHandlerEventHandler",value:function(){var e;null===(e=this._room)||void 0===e||e.removeAllListeners()}},{key:"joinRoom",value:(Le=c(o().mark((function e(t,r,n,a){var s,c,u,d,l,h;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c0.print("joinRoom()","token: %o roomId: %o, userInfo: %o, roomConfig: %o",t,r,n,a),QP(t)||zP(t,"token"),ZP(r),tM(n),s={isAutoPublish:!0,isAutoSubscribeAudio:!0,isAutoSubscribeVideo:!0,roomProfileType:Y.communication},hJ(s,a),rM(s),!this._room||this._room.connectionState===mX.DISCONNECTED){e.next=11;break}throw new hN(dN.REPEAT_JOIN,"Already joined");case 11:return this._room=new NW(a,{audioProfileManager:this._audioProfileManager,streamRTT:{}}),this._room.userPriorityMap=this._userPriorityMap,this._room.subscribeFallbackOption=this._subscribeFallbackOption,this._addHandlerEventHandler(),c=this._liveTranscodeConfig&&t0.getStartParams(this._liveTranscodeConfig),u=i(i({},n),{},{businessId:this._businessId,role:this._visibility?F$.NORMAL_USER:F$.SILENT_USER}),e.prev=17,this._useCloudProxy&&(this._startCloudProxyTimestamp=Date.now()),e.next=21,this._room.join(this._appId,r,t,u,c,this._useCloudProxy,null===(d=this._config)||void 0===d?void 0:d.expectedIDC);case 21:return l=e.sent,this._roomConfig=a,this._tempRoomInfo&&delete this._tempRoomInfo,null!=a&&a.isAutoPublish&&(this._visibility?this._updatePublish({invokeByJoinRoom:!0,mediaType:U.AUDIO_AND_VIDEO}):this.safeEmit(oe.onAutoPublishResult,{isScreen:!1,state:N.PUBLISH_FAIL})),e.abrupt("return",l);case 28:throw e.prev=28,e.t0=e.catch(17),e.t0.code===dN.INVALID_TOKEN&&(this._tempRoomInfo={config:a,roomId:r,userInfo:u}),null===(h=this._room)||void 0===h||h.destroy(),e.t0;case 33:case"end":return e.stop()}}),e,this,[[17,28]])}))),function(e,t,r,n){return Le.apply(this,arguments)})},{key:"leaveRoom",value:(Me=c(o().mark((function e(){var t,r,n,i=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=i.length>0&&void 0!==i[0]&&i[0],c0.print("leaveRoom()"),!t){e.next=7;break}return e.next=5,null===(r=this._room)||void 0===r?void 0:r.leave(t);case 5:e.next=8;break;case 7:null===(n=this._room)||void 0===n||n.leave(t).catch();case 8:this._removeHandlerEventHandler(),this._liveTranscodeConfig&&this.stopLiveTranscoding(),this._room=void 0,this._remoteAudioPlayer.forEach((function(e){return e.destroy()})),this._remoteAudioPlayer=new Map,this._remoteScreenAudioPlayer.forEach((function(e){return e.destroy()})),this._remoteScreenAudioPlayer=new Map,this._remoteScreenPlayer.forEach((function(e){return e.destroy()})),this._remoteScreenPlayer=new Map,this._remoteVideoPlayer.forEach((function(e){return e.destroy()})),this._remoteVideoPlayer=new Map,this._roomConfig=void 0,this._publicStreamIds=new Map;case 21:case"end":return e.stop()}}),e,this)}))),function(){return Me.apply(this,arguments)})},{key:"destroy",value:function(){var e,t,r;c0.print("destroy()"),this.removeAllListeners(),this._removeHandlerEventHandler(),null===(e=this._room)||void 0===e||e.destroy(),this._room=void 0,null===(t=this._videoPlayer)||void 0===t||t.destroy(),this._videoPlayer=void 0,this._screenPlayer=void 0,this._videoStreamConstraints={},this._audioStreamConstraints={},this._videoStreamEncodeConfig=[dj],this._screenStreamEncodeConfig=[lj],this._pauseAllSubscribeState={audio:void 0,video:void 0,resumeStreamIds:{}},this._messageStatisticsObserver.destroy(),clearInterval(this._audioVolumeIndicationTimer),clearInterval(this._dummyMainTimer),clearInterval(this._dummyScreenTimer),this._audioVolumeIndicationTimer=void 0,this._stopAudioPropertiesReport(),this._localAudioTrack&&(this._removeLocalTrackEvents(this._localAudioTrack),this._localAudioTrack.close(),this._localAudioTrack=void 0),this._localVideoTrack&&(this._removeLocalTrackEvents(this._localVideoTrack),this._localVideoTrack.close(),this._localVideoTrack=void 0),this._localScreenAudioTrack&&(this._removeLocalTrackEvents(this._localScreenAudioTrack),this._localScreenAudioTrack.close(),this._localScreenAudioTrack=void 0),this._localScreenVideoTrack&&(this._removeLocalTrackEvents(this._localScreenVideoTrack),this._localScreenVideoTrack.close(),this._localScreenVideoTrack=void 0),this._localImgVideoTrack&&(this._localImgVideoTrack.stop(),this._localImgVideoTrack=void 0),this._localImgScreenTrack&&(this._localImgScreenTrack.stop(),this._localImgScreenTrack=void 0),this._remoteAudioPlayer.forEach((function(e){return e.destroy()})),this._remoteAudioPlayer=new Map,this._remoteScreenAudioPlayer.forEach((function(e){return e.destroy()})),this._remoteScreenAudioPlayer=new Map,this._remoteScreenPlayer.forEach((function(e){return e.destroy()})),this._remoteScreenPlayer=new Map,this._remoteVideoPlayer.forEach((function(e){return e.destroy()})),this._remoteVideoPlayer=new Map,this._publicStreamAudioPlayer.forEach((function(e){return e.destroy()})),this._publicStreamAudioPlayer=new Map,this._publicStreamVideoPlayer.forEach((function(e){return e.destroy()})),this._publicStreamVideoPlayer=new Map,this._roomConfig=void 0,this._audioMixingManager.destroy(),this._rtmClient.destroy(),null===(r=this._outsideRoom)||void 0===r||r.destroy(),this._publicStreamIds=new Map,this._audioDeviceManager.destroy(),this._remoteVideoConfig=new Map,this._userPriorityMap.clear(),this._extensionManager.destroy(),this._cameraCapturing=!1,this._micCapturing=!1,this._interruptCameraCapture=!1,this._interruptMicCapture=!1}},{key:"publishStream",value:(Pe=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c0.print("publishStream()","mediaType: %o",t),this._checkMediaType(t),this._assertNotInRoom(),!VP(t)||this._localVideoTrack||!this._localImgVideoTrack){e.next=7;break}return e.next=6,az(this._localImgVideoTrack,this._extensionManager);case 6:this._localVideoTrack=e.sent;case 7:return e.next=9,this._updatePublish({mediaType:t});case 9:case"end":return e.stop()}}),e,this)}))),function(e){return Pe.apply(this,arguments)})},{key:"unpublishStream",value:(Ne=c(o().mark((function e(t,r){var n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c0.print("unpublishStream()","mediaType: %o",t),this._checkMediaType(t),this._assertNotInRoom(),!r){e.next=5;break}return e.abrupt("return",null===(n=this._room)||void 0===n?void 0:n.unpublish());case 5:return e.next=7,this._updatePublish({mediaType:t,pubState:zz.UNPUB});case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return Ne.apply(this,arguments)})},{key:"publishScreen",value:(De=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c0.print("publishScreen()","mediaType: %o",t),this._checkMediaType(t),this._assertNotInRoom(),e.prev=3,!VP(t)||this._localScreenVideoTrack||!this._localImgScreenTrack){e.next=8;break}return e.next=7,cz(this._localImgScreenTrack,this._extensionManager);case 7:this._localScreenVideoTrack=e.sent;case 8:return e.next=10,this._updateScreenPublish({mediaType:t,pubState:zz.PUB});case 10:e.next=19;break;case 12:if(e.prev=12,e.t0=e.catch(3),!(e.t0 instanceof hN)){e.next=18;break}throw e.t0;case 18:throw new hN(dN.UNEXPECTED_ERROR,"unexpected error",e.t0);case 19:case"end":return e.stop()}}),e,this,[[3,12]])}))),function(e){return De.apply(this,arguments)})},{key:"unpublishScreen",value:(xe=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return c0.print("unpublishScreen()","mediaType: %o",t),this._checkMediaType(t),this._assertNotInRoom(),e.next=5,this._updateScreenPublish({mediaType:t,pubState:zz.UNPUB});case 5:case"end":return e.stop()}}),e,this)}))),function(e){return xe.apply(this,arguments)})},{key:"subscribeStream",value:(Oe=c(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return c0.print("subscribeStream()","userId: %o, mediaType: %o",t,r),e.abrupt("return",this._subscribe(!1,t,r));case 2:case"end":return e.stop()}}),e,this)}))),function(e,t){return Oe.apply(this,arguments)})},{key:"_subscribe",value:(Ce=c(o().mark((function e(t,r,n){var i,a,s,c,u,d,l,h,f,p,v,_,m,y,g;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._checkMediaType(n),this._assertNotInRoom(),n!==U.AUDIO||null===(i=this._room)||void 0===i||!i.multiChatMode){e.next=5;break}return c0.print("subscribeStream()","due to multiChatMode return"),e.abrupt("return");case 5:if(u=this._room.remoteStreams.get(r),d=null==u?void 0:u.find((function(e){return e.isScreen===t}))){e.next=9;break}throw new hN(dN.STREAM_NOT_EXIST,"stream not exist");case 9:return l=this._pauseAllSubscribeState.audio,h=this._pauseAllSubscribeState.video,this._pauseAllSubscribeState.audio&&(n-=n&U.AUDIO),this._pauseAllSubscribeState.video&&(n-=n&U.VIDEO),c0.print("subscribeStream()","due to pauseAll mediaType: %o",n),f=d.hasSubscribed,p=this._remoteVideoConfig.get(r)||(null===(a=this._roomConfig)||void 0===a?void 0:a.remoteVideoConfig),d.originalMediaType=n,e.next=19,this._room.subscribe(d,n,p);case 19:UP(n)&&this._updateAudioPlayerState(d),VP(n)&&this._updateVideoPlayerState(d),v=0,_=0,l!==this._pauseAllSubscribeState.audio&&(this._pauseAllSubscribeState.audio?v|=U.AUDIO:_|=U.AUDIO),h!==this._pauseAllSubscribeState.video&&(this._pauseAllSubscribeState.video?v|=U.VIDEO:_|=U.VIDEO),v&&this.pauseAllSubscribedStream(v),_&&this.resumeAllSubscribedStream(_),this._pauseAllSubscribeState.resumeStreamIds[d.streamId]=d.streamId,!t&&(null!==(s=this._roomConfig)&&void 0!==s&&s.isAutoSubscribeAudio||null!==(c=this._roomConfig)&&void 0!==c&&c.isAutoSubscribeVideo)&&(d.audioTrack||d.videoTrack)&&(m={userId:r,isScreen:!1,state:D.SUBSCRIBE_SUCC},this.safeEmit(oe.onAutoSubscribeResult,m)),!f&&UP(n)&&d.hasAudio&&(null===(y=d.observer)||void 0===y||y.setSubscribeAudio(!0)),!f&&VP(n)&&d.hasVideo&&(null===(g=d.observer)||void 0===g||g.setSubscribeVideo(!0));case 31:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return Ce.apply(this,arguments)})},{key:"unsubscribeStream",value:(we=c(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:c0.print("unsubscribeStream()","userId: %o, mediaType: %o",t,r),this._unsubscribe(!1,t,r);case 2:case"end":return e.stop()}}),e,this)}))),function(e,t){return we.apply(this,arguments)})},{key:"subscribeScreen",value:(Re=c(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return c0.print("subscribeScreen() userId: %o, mediaType: %o",t,r),e.abrupt("return",this._subscribe(!0,t,r));case 2:case"end":return e.stop()}}),e,this)}))),function(e,t){return Re.apply(this,arguments)})},{key:"unsubscribeScreen",value:(Ae=c(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:c0.print("unsubscribeScreen() userId: %o, mediaType: %o",t,r),this._unsubscribe(!0,t,r);case 2:case"end":return e.stop()}}),e,this)}))),function(e,t){return Ae.apply(this,arguments)})},{key:"_unsubscribe",value:function(e,t,r,n){var i,o=this;if(this._checkMediaType(r),this._assertNotInRoom(),r!==U.AUDIO||null===(i=this._room)||void 0===i||!i.multiChatMode){var a=this._room.remoteStreams.get(t),s=null==a?void 0:a.find((function(t){return t.isScreen===e}));if(null==s||!s.hasSubscribed)throw new hN(dN.STREAM_NOT_EXIST,"stream not exist");return this._room.unsubscribe(s,r).then((function(){n||delete o._pauseAllSubscribeState.resumeStreamIds[s.streamId]}))}c0.print("subscribeStream()","due to multiChatMode return")}},{key:"setRemoteVideoConfig",value:(Ie=c(o().mark((function e(t,r){var n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return c0.print("setRemoteVideoConfig() userId: %o, remoteVideoConfig: %o",t,r),$P(t),aM(r),this._remoteVideoConfig.set(t,r),e.abrupt("return",null===(n=this._room)||void 0===n?void 0:n.updateSubVideoConfig(t,r).then((function(){})));case 5:case"end":return e.stop()}}),e,this)}))),function(e,t){return Ie.apply(this,arguments)})},{key:"startVideoCapture",value:(Te=c(o().mark((function e(t){var r,n,i,a,s,c,u,d,l,h=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c0.print("startVideoCapture()","deviceId: %s",t),QP(t)||zP(t,"deviceId"),t=t||this._localVideoDeviceId,this._localVideoDeviceId=t,this._trackSourceType.video!==R.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=6;break}throw new hN(dN.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as internal first");case 6:if(!(this._cameraCapturing||this._localVideoTrack&&!this._localVideoTrack.dummy)){e.next=8;break}throw new hN(dN.REPEAT_CAPTURE,"Has already capture");case 8:return i=this._videoStreamConstraints,t&&("user"===t||"environment"===t||"left"===t||"right"===t?i.facingMode=t:i.deviceId={exact:t},this._videoStreamConstraints=i),a={},e.prev=11,this._cameraCapturing=!0,e.next=15,dz(i,this._extensionManager);case 15:if(c=e.sent,!this._interruptCameraCapture){e.next=21;break}throw this._interruptCameraCapture=!1,this._removeLocalTrackEvents(c),c.close(),new hN(dN.INTERRUPT,"interrupt by stopVideoCapture");case 21:if(this._initLocalTrackEvents(c),this._localVideoTrack=c,null===(s=this._videoPlayer)||void 0===s||s.playVideo(c),(u=null==c?void 0:c.getTrack())&&(a=u.getSettings(),d={width:a.width,height:a.height},this._localVideoTrack.resolution=d,setTimeout((function(){return h.safeEmit(oe.onLocalVideoSizeChanged,{streamIndex:L.STREAM_INDEX_MAIN,info:d})}))),this._room){e.next=28;break}return e.abrupt("return",a);case 28:return e.prev=28,this._cameraCapturing=!1,e.finish(28);case 31:return l=this._room._roomConfig.isAutoPublish,(this._room.hasPublished||l)&&(this._visibility?this._updatePublish():this.safeEmit(oe.onAutoPublishResult,{isScreen:!1,state:N.PUBLISH_FAIL})),null===(r=this._room.localStream)||void 0===r||null===(n=r.observer)||void 0===n||n.setEnableVideo(!0),e.abrupt("return",a);case 35:case"end":return e.stop()}}),e,this,[[11,,28,31]])}))),function(e){return Te.apply(this,arguments)})},{key:"stopVideoCapture",value:(ke=c(o().mark((function e(){var t,r,n,i,a,s;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c0.print("stopVideoCapture()"),!this._cameraCapturing){e.next=5;break}return this._interruptCameraCapture=!0,c0.print("stopVideoCapture()","capturing"),e.abrupt("return");case 5:if(this._trackSourceType.video!==R.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=7;break}throw new hN(dN.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as internal first");case 7:if(null===(t=this._videoPlayer)||void 0===t||t.stop(),this._localVideoTrack&&(this._localVideoTrack.dummy||(this._removeLocalTrackEvents(this._localVideoTrack),this._localVideoTrack.close(),this._localImgVideoTrack?(null===(s=this._localVideoTrack)||void 0===s||s.setTrack(this._localImgVideoTrack,this._extensionManager),this._localVideoTrack.dummy=!0):this._localVideoTrack=void 0)),this._room){e.next=11;break}return e.abrupt("return");case 11:if(null===(r=this._room)||void 0===r||!r.hasPublished){e.next=14;break}return e.next=14,this._updatePublish();case 14:null===(n=this._room)||void 0===n||null===(i=n.localStream)||void 0===i||null===(a=i.observer)||void 0===a||a.setEnableVideo(!1);case 15:case"end":return e.stop()}}),e,this)}))),function(){return ke.apply(this,arguments)})},{key:"startAudioCapture",value:(Ee=c(o().mark((function e(t){var r,n,i,a,s;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c0.print("startAudioCapture()","deviceId: $o",t),QP(t)||zP(t,"deviceId"),t=t||this._localAudioDeviceId,this._localAudioDeviceId=t,this._trackSourceType.audio!==w.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=6;break}throw new hN(dN.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");case 6:if(!this._micCapturing&&!this._localAudioTrack){e.next=8;break}throw new hN(dN.REPEAT_CAPTURE,"Has already capture");case 8:return i=this._audioStreamConstraints,t&&(i.deviceId={exact:t},this._audioStreamConstraints=i),e.prev=10,this._micCapturing=!0,e.next=14,hz(i,this._extensionManager,this._audioProfileManager);case 14:if(a=e.sent,!this._interruptMicCapture){e.next=20;break}throw this._interruptMicCapture=!1,this._removeLocalTrackEvents(a),a.close(),new hN(dN.INTERRUPT,"interrupt by stopAudioCapture");case 20:if(this._initLocalTrackEvents(a),this._localAudioTrack=a,this._tempMixingAudioTrack&&(this._localAudioTrack.mixType=this._tempMixingAudioTrack.type,this._localAudioTrack.mixedAudioTrack=this._tempMixingAudioTrack.track,delete this._tempMixingAudioTrack),this._room){e.next=25;break}return e.abrupt("return");case 25:return e.prev=25,this._micCapturing=!1,e.finish(25);case 28:s=this._room._roomConfig.isAutoPublish,(this._room.hasPublished||s)&&(this._visibility?this._updatePublish():this.safeEmit(oe.onAutoPublishResult,{isScreen:!1,state:N.PUBLISH_FAIL})),null===(r=this._room.localStream)||void 0===r||null===(n=r.observer)||void 0===n||n.setEnableAudio(!0);case 31:case"end":return e.stop()}}),e,this,[[10,,25,28]])}))),function(e){return Ee.apply(this,arguments)})},{key:"stopAudioCapture",value:(be=c(o().mark((function e(){var t,r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c0.print("stopAudioCapture()"),!this._micCapturing){e.next=5;break}return this._interruptMicCapture=!0,c0.print("stopAudioCapture()","capturing"),e.abrupt("return");case 5:if(this._trackSourceType.audio!==w.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=7;break}throw new hN(dN.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");case 7:if(this._localAudioTrack&&(this._removeLocalTrackEvents(this._localAudioTrack),this._localAudioTrack.close()),this._localAudioTrack=void 0,this._audioMixingManager.stopAll(),this._room){e.next=12;break}return e.abrupt("return");case 12:if(!this._room.hasPublished){e.next=15;break}return e.next=15,this._updatePublish();case 15:null===(t=this._room.localStream)||void 0===t||null===(r=t.observer)||void 0===r||r.setEnableAudio(!1);case 16:case"end":return e.stop()}}),e,this)}))),function(){return be.apply(this,arguments)})},{key:"getAudioMixingManager",value:function(){return c0.print("getAudioMixingManager()"),this._audioMixingManager}},{key:"startScreenCapture",value:(Se=c(o().mark((function e(){var t,r,n,i,a,s,c,u,d,l,h,f,p,v=this,_=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=_.length>0&&void 0!==_[0]?_[0]:{},c0.print("startScreenCapture()","config: %o",a),s=a.enableAudio,c=void 0!==s&&s,this._trackSourceType.screenVideo!==R.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=5;break}throw new hN(dN.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as internal first");case 5:if(this._trackSourceType.screenAudio!==w.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=7;break}throw new hN(dN.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");case 7:return e.next=9,pz(c,this._extensionManager,this._screenStreamEncodeConfig[0]);case 9:if(u=e.sent,d=E(u,2),l=d[0],h=d[1],this._localScreenVideoTrack&&!this._localScreenVideoTrack.dummy&&(this._removeLocalTrackEvents(this._localScreenVideoTrack),this._localScreenVideoTrack.close()),null===(t=this._localScreenAudioTrack)||void 0===t||t.close(),delete this._localScreenAudioTrack,this._localScreenVideoTrack=l,null!==(r=this._screenStreamEncodeConfig[0])&&void 0!==r&&r.contentHint&&l.setContentHint(null===(f=this._screenStreamEncodeConfig[0])||void 0===f?void 0:f.contentHint),(p=null==l?void 0:l.getTrack())&&setTimeout((function(){var e=p.getSettings(),t={width:e.width,height:e.height};l.resolution=t,v.safeEmit(oe.onLocalVideoSizeChanged,{streamIndex:L.STREAM_INDEX_SCREEN,info:{width:e.width,height:e.height}})}),500),h&&(this._localScreenAudioTrack=h,this._initLocalTrackEvents(h)),null===(n=this._screenPlayer)||void 0===n||n.playVideo(this._localScreenVideoTrack),this._initLocalTrackEvents(this._localScreenVideoTrack,!0),null===(i=this._room)||void 0===i||!i.hasScreenPublished){e.next=26;break}return e.next=26,this._updateScreenPublish();case 26:case"end":return e.stop()}}),e,this)}))),function(){return Se.apply(this,arguments)})},{key:"stopScreenCapture",value:(ge=c(o().mark((function e(){var t,r,n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c0.print("stopScreenCapture()"),null===(t=this._screenPlayer)||void 0===t||t.stop(),this._localScreenVideoTrack&&(this._localScreenVideoTrack.dummy||(this._removeLocalTrackEvents(this._localScreenVideoTrack),this._localScreenVideoTrack.close(),this._localImgScreenTrack&&(null===(n=this._localScreenVideoTrack)||void 0===n||n.setTrack(this._localImgScreenTrack,this._extensionManager),this._localScreenVideoTrack.dummy=!0))),this._localScreenAudioTrack&&(this._removeLocalTrackEvents(this._localScreenAudioTrack),this._localScreenAudioTrack.close()),this._localScreenAudioTrack=void 0,null===(r=this._room)||void 0===r||!r.hasScreenPublished){e.next=8;break}return e.next=8,this._updateScreenPublish();case 8:case"end":return e.stop()}}),e,this)}))),function(){return ge.apply(this,arguments)})},{key:"setLocalVideoPlayer",value:function(e,t){if(c0.print("setLocalVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",e,t),XP(e,"streamIndex",[L.STREAM_INDEX_MAIN,L.STREAM_INDEX_SCREEN]),t&&t.renderDom){var r,n,o=i(i({userId:this._getUserId()},t),{},{isLocal:!0});if(nM(o),e===L.STREAM_INDEX_MAIN&&!this._videoPlayer)return this._videoPlayer=new BW(o),this._initPlayerEvents(this._videoPlayer,!1,e),this._videoPlayer.mirror(!!this._mirrorType),this._localVideoTrack&&!this._localVideoTrack.dummy&&(null===(r=this._config)||void 0===r?void 0:r.autoPlayPolicy)!==Q.PLAY_MANUALLY&&this._videoPlayer.playVideo(this._localVideoTrack),this._videoPlayer.domElement;if(e===L.STREAM_INDEX_SCREEN&&!this._screenPlayer)return this._screenPlayer=new BW(i(i({},o),{},{isScreen:!0,isLocal:!0})),this._initPlayerEvents(this._screenPlayer,!1,e),this._localScreenVideoTrack&&!this._localScreenVideoTrack.dummy&&(null===(n=this._config)||void 0===n?void 0:n.autoPlayPolicy)!==Q.PLAY_MANUALLY&&this._screenPlayer.playVideo(this._localScreenVideoTrack),this._screenPlayer.domElement}else{var a,s;e===L.STREAM_INDEX_MAIN?(null===(a=this._videoPlayer)||void 0===a||a.destroy(),delete this._videoPlayer):(null===(s=this._screenPlayer)||void 0===s||s.destroy(),delete this._screenPlayer)}}},{key:"startLiveTranscoding",value:(ye=c(o().mark((function e(t){var r,n,i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c0.print("startLiveTranscoding()","transcode: %o",t),t0.checkStartParams(t),this._liveTranscodeConfig=t,!((n=null===(r=this._room)||void 0===r?void 0:r.roomInfo)&&n.roomId.length+n.userInfo.userId.length>126)){e.next=6;break}throw new hN(dN.INVALID_PARAMS,"The roomId+userId must be within 126 bytes");case 6:if(e.prev=6,this.safeEmit(oe.onStreamMixingEvent,{event:Hz.START,error:0,message:""}),!this._room||this._room.connectionState!==mX.CONNECTED){e.next=11;break}return e.next=11,null===(i=this._room)||void 0===i?void 0:i.liveControlMessage(t0.getStartParams(this._liveTranscodeConfig));case 11:e.next=20;break;case 13:if(e.prev=13,e.t0=e.catch(6),!(e.t0 instanceof hN)){e.next=19;break}throw e.t0;case 19:throw new hN(dN.UNEXPECTED_ERROR,"unexpected error",e.t0);case 20:case"end":return e.stop()}}),e,this,[[6,13]])}))),function(e){return ye.apply(this,arguments)})},{key:"updateLiveTranscoding",value:(me=c(o().mark((function e(t){var r,n,i,a;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c0.print("updateLiveTranscoding()","transcode: %o",t),this._liveTranscodeConfig){e.next=3;break}return e.abrupt("return");case 3:return delete(i=hJ({},t)).audio,null===(r=i.video)||void 0===r||delete r.codec,null===(n=i.video)||void 0===n||delete n.gop,t0.checckUpdateParams(i),this._liveTranscodeConfig=hJ(this._liveTranscodeConfig,i),e.prev=9,this.safeEmit(oe.onStreamMixingEvent,{event:Hz.UPDATE,error:0,message:""}),e.next=13,null===(a=this._room)||void 0===a?void 0:a.liveControlMessage(t0.getUpdateParams(this._liveTranscodeConfig));case 13:e.next=22;break;case 15:if(e.prev=15,e.t0=e.catch(9),!(e.t0 instanceof hN)){e.next=21;break}throw e.t0;case 21:throw new hN(dN.UNEXPECTED_ERROR,"unexpected error",e.t0);case 22:case"end":return e.stop()}}),e,this,[[9,15]])}))),function(e){return me.apply(this,arguments)})},{key:"stopLiveTranscoding",value:(_e=c(o().mark((function e(){var t;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c0.print("stopLiveTranscoding()"),this._liveTranscodeConfig){e.next=3;break}return e.abrupt("return");case 3:return delete this._liveTranscodeConfig,e.prev=4,this.safeEmit(oe.onStreamMixingEvent,{event:Hz.STOP,error:0,message:""}),e.next=8,null===(t=this._room)||void 0===t?void 0:t.liveControlMessage({action:"stopped",type:"transcode"});case 8:e.next=17;break;case 10:if(e.prev=10,e.t0=e.catch(4),!(e.t0 instanceof hN)){e.next=16;break}throw e.t0;case 16:throw new hN(dN.UNEXPECTED_ERROR,"unexpected error",e.t0);case 17:case"end":return e.stop()}}),e,this,[[4,10]])}))),function(){return _e.apply(this,arguments)})},{key:"setBusinessId",value:function(e){return c0.print("setBusinessId()","businessId: %s",e),!function(e){return"string"!=typeof e}(e)&&!this._room&&(VB.setStats({rtc_business_id:e}),EW.setStats({rtc_business_id:e}),this._businessId=e,!0)}},{key:"setUserVisibility",value:(ve=c(o().mark((function e(t){var r,n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c0.print("setUserVisibility()","enable: %o",t),t=!!t,this._visibility!==t){e.next=4;break}return e.abrupt("return");case 4:if(this._room){e.next=7;break}return this._visibility=t,e.abrupt("return");case 7:if(this._assertNotInRoom(),this._room.localStream&&(null===(n=this._room.localStream.observer)||void 0===n||n.setPublisher(t)),e.t0=!t,!e.t0){e.next=13;break}return e.next=13,this._room.unpublish();case 13:return e.next=15,this._room.updateUserAttributes({role:t?F$.NORMAL_USER:F$.SILENT_USER});case 15:this._visibility=t,t&&null!==(r=this._roomConfig)&&void 0!==r&&r.isAutoPublish&&this._updatePublish({mediaType:U.AUDIO_AND_VIDEO});case 17:case"end":return e.stop()}}),e,this)}))),function(e){return ve.apply(this,arguments)})},{key:"_initPlayerEvents",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:L.STREAM_INDEX_MAIN,i=n===L.STREAM_INDEX_SCREEN;e.on("playback_event",(function(n){switch(n.eventName){case"timeupdate":return;case"loadeddata":if("audio"===n.type){var o=e.userId.replace("_screen","");r?t.safeEmit(oe.onFirstPublicStreamAudioFrameDecoded,{publicStreamId:o}):(t.safeEmit(oe.onAudioFirstFrameDecoded,{userId:o,isScreen:i}),t.safeEmit(oe.onRemoteAudioFirstFrame,{userId:o,isScreen:i})),MB.firstRemoteAudioRender("",o||"",{isScreen:i})}else{var a,s,c={userId:e.userId,height:(null===(a=e.domElement)||void 0===a?void 0:a.videoHeight)||0,width:(null===(s=e.domElement)||void 0===s?void 0:s.videoWidth)||0,isScreen:i};r?(c.publicStreamId=c.userId,delete c.userId,delete c.isScreen,t.safeEmit(oe.onFirstPublicStreamVideoFrameRendered,c),t.safeEmit(oe.onFirstPublicStreamVideoFrameDecoded,c)):e.isLocal||(t.safeEmit(oe.onVideoFirstFrameRendered,c),t.safeEmit(oe.onVideoFirstFrameDecoded,c),t.safeEmit(oe.onRemoteVideoFirstFrame,c)),MB.firstRemoteVideoRender("",n.userId||"",{isScreen:i})}break;case"autoplay-error":return r&&(n.publicStreamId=n.userId),MB.rtcInvokeStatus(e instanceof BW?"video":"audio",0,"autoplay-error",n.userId||"",0),void t.safeEmit(oe.onAutoplayFailed,{userId:n.userId,kind:e instanceof BW?"video":"audio",mediaType:e instanceof BW?U.VIDEO:U.AUDIO,streamIndex:e.isScreen?L.STREAM_INDEX_SCREEN:L.STREAM_INDEX_MAIN})}t.safeEmit(oe.onPlayerEvent,n)}))}},{key:"_initLocalTrackEvents",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];e.on("track-ended",(function(e){var r=!1;e!==t._localScreenAudioTrack&&e!==t._localScreenVideoTrack||(r=!0),t.safeEmit(oe.onTrackEnded,{kind:e.getTrack().kind,isScreen:r})})),e.on("resolution-change",(function(e){t.safeEmit(oe.onLocalVideoSizeChanged,{streamIndex:r?L.STREAM_INDEX_SCREEN:L.STREAM_INDEX_MAIN,info:e})}))}},{key:"_removeLocalTrackEvents",value:function(e){e.removeAllListeners("track-ended"),e.removeAllListeners("resolution-change")}},{key:"setRemoteVideoPlayer",value:function(e,t){c0.print("setRemoteVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",e,t),XP(e,"streamIndex",[L.STREAM_INDEX_MAIN,L.STREAM_INDEX_SCREEN]),nM(t);var r,n,o,a=t.userId;if(e===L.STREAM_INDEX_MAIN){var s,c,u;if(null===(s=this._remoteVideoPlayer.get(a))||void 0===s||s.destroy(),!t.renderDom)return;var d=new BW(t);this._initPlayerEvents(d,!1,e),this._remoteVideoPlayer.set(a,d);var l=null===(c=this._room)||void 0===c||null===(u=c.remoteStreams.get(a))||void 0===u?void 0:u.find((function(e){return!e.isScreen}));return l&&this._updateVideoPlayerState(l),d.domElement}if(null===(r=this._remoteScreenPlayer.get(a))||void 0===r||r.destroy(),t.renderDom){var h=new BW(i(i({},t),{},{isScreen:!0}));this._remoteScreenPlayer.set(a,h),this._initPlayerEvents(h,!1,e);var f=null===(n=this._room)||void 0===n||null===(o=n.remoteStreams.get(a))||void 0===o?void 0:o.find((function(e){return e.isScreen}));return f&&this._updateVideoPlayerState(f),h.domElement}}},{key:"setLocalVideoMirrorType",value:function(e){c0.print("setLocalVideoMirrorType()","mirrorType: %o",e),XP(e,"mirrorType",[B.MIRROR_TYPE_NONE,B.MIRROR_TYPE_RENDER]),this._mirrorType=e,this._videoPlayer&&this._videoPlayer.mirror(!!e)}},{key:"setAudioPlaybackDevice",value:(pe=c(o().mark((function e(t){var r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c0.print("setAudioPlaybackDevice()","deviceId: %s",t),zP(t,"deviceId"),void 0!==HTMLAudioElement.prototype.setSinkId){e.next=5;break}return c0.print("setAudioPlaybackDevice failed","setSinkId not supported by current browser"),e.abrupt("return");case 5:return e.next=7,UH.getDeviceById(t);case 7:if(r=e.sent){e.next=10;break}throw new hN(dN.INVALID_DEVICE_ID,"audio playback device id ".concat(t," is invalid"));case 10:this._remoteAudioPlayer.forEach((function(e){e.setPlaybackDevice(t)})),this._remoteScreenAudioPlayer.forEach((function(e){e.setPlaybackDevice(t)})),this._audioPlaybackDeviceId=t,r&&this.safeEmit(oe.onAudioPlaybackDeviceChanged,r),MB.rtcAudioDevice(EB.PLAYOUT_DEVICE_SWITCH,t,0);case 15:case"end":return e.stop()}}),e,this)}))),function(e){return pe.apply(this,arguments)})},{key:"play",value:(fe=c(o().mark((function e(t){var r,n,i,a,s,c,u,d,l,h,f,p,v,_,m,y,g=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=g.length>1&&void 0!==g[1]?g[1]:U.AUDIO_AND_VIDEO,s=g.length>2?g[2]:void 0,c0.print("play()","userId: %s, mediaType: %s, streamIndex: %s",t,a,s),c=!t||t===this._getUserId()||"local_user",u=void 0===s||s===L.STREAM_INDEX_MAIN,d=void 0===s||s===L.STREAM_INDEX_SCREEN,l=a!==U.VIDEO,h=a!==U.AUDIO,f=[],c&&h&&(u&&this._localVideoTrack&&(null===(p=this._videoPlayer)||void 0===p||p.mirror(!!this._mirrorType),f.push(null===(v=this._videoPlayer)||void 0===v?void 0:v.playVideo(this._localVideoTrack))),d&&this._localScreenVideoTrack&&f.push(null===(_=this._screenPlayer)||void 0===_?void 0:_.playVideo(this._localScreenVideoTrack))),t===(null===(r=this._audioMixingManager)||void 0===r?void 0:r.id)&&f.push(this._audioMixingManager.resumeLocalPlay()),m=null===(n=this._room)||void 0===n?void 0:n.remoteStreams,h&&u&&f.push(GW(this._remoteVideoPlayer,t,!1,m)),h&&d&&f.push(GW(this._remoteScreenPlayer,t,!0,m)),l&&u&&f.push(GW(this._remoteAudioPlayer,t,!1,m)),h&&d&&f.push(GW(this._remoteScreenAudioPlayer,t,!0,m)),y=null===(i=this._outsideRoom)||void 0===i?void 0:i.remoteStreams,l&&f.push(GW(this._publicStreamVideoPlayer,t,!1,y)),h&&f.push(GW(this._publicStreamAudioPlayer,t,!1,y)),e.abrupt("return",Promise.all(f).then((function(){})));case 20:case"end":return e.stop()}}),e,this)}))),function(e){return fe.apply(this,arguments)})},{key:"pauseAllSubscribedStream",value:(he=c(o().mark((function e(t){var r,n,i,a,s=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c0.print("pauseAllSubscribedStream()","mediaType: %o",t),this._checkMediaType(t),UP(t)&&(s._pauseAllSubscribeState.audio=!0),VP(t)&&(s._pauseAllSubscribeState.video=!0),this._room){e.next=6;break}return e.abrupt("return",Promise.resolve());case 6:r=[],n=A(this._room.remoteStreams.values());try{for(n.s();!(i=n.n()).done;)a=i.value,Array.isArray(a)&&a.forEach((function(e){if(e.hasSubscribed){s._pauseAllSubscribeState.resumeStreamIds[e.streamId]=e.streamId;var n=s._unsubscribe(e.isScreen,e.userId,t,!0);n&&r.push(n)}}))}catch(o){n.e(o)}finally{n.f()}return e.abrupt("return",Promise.all(r).then((function(){})));case 10:case"end":return e.stop()}}),e,this)}))),function(e){return he.apply(this,arguments)})},{key:"resumeAllSubscribedStream",value:(le=c(o().mark((function e(t){var r,n,i,a,s=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c0.print("resumeAllSubscribedStream()","mediaType: %o",t),this._checkMediaType(t),UP(t)&&(s._pauseAllSubscribeState.audio=!1),VP(t)&&(s._pauseAllSubscribeState.video=!1),this._room){e.next=6;break}return e.abrupt("return",Promise.resolve());case 6:r=[],n=A(this._room.remoteStreams.values());try{for(n.s();!(i=n.n()).done;)a=i.value,Array.isArray(a)&&a.forEach((function(e){if(s._pauseAllSubscribeState.resumeStreamIds[e.streamId]){delete s._pauseAllSubscribeState.resumeStreamIds[e.streamId];var n=s._subscribe(e.isScreen,e.userId,t);n&&r.push(n)}}))}catch(o){n.e(o)}finally{n.f()}return e.abrupt("return",Promise.all(r).then((function(){var e,t;null===(e=s._room)||void 0===e||null===(t=e.remoteStreams)||void 0===t||t.forEach((function(e){Array.isArray(e)&&e.forEach((function(e){s._updateAudioPlayerState(e),s._updateVideoPlayerState(e)}))}))})));case 10:case"end":return e.stop()}}),e,this)}))),function(e){return le.apply(this,arguments)})},{key:"sendUserMessage",value:(de=c(o().mark((function e(t,r){var n,i,a,s=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return $P(t),iM(r),this._assertNotInRoom(),a=Date.now(),e.abrupt("return",null===(n=this._room)||void 0===n||null===(i=n.sendUserMessage(t,r))||void 0===i?void 0:i.then((function(e){return s._messageStatisticsObserver.countP2PMessage(!0,t,!1,a,e),e.id})).catch((function(e){throw s._messageStatisticsObserver.countP2PMessage(!1,t,!1,a,e),e})));case 5:case"end":return e.stop()}}),e,this)}))),function(e,t){return de.apply(this,arguments)})},{key:"sendUserBinaryMessage",value:(ue=c(o().mark((function e(t,r){var n,i,a,s=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return $P(t),WP(r,"message"),iM(r),this._assertNotInRoom(),a=Date.now(),e.abrupt("return",null===(n=this._room)||void 0===n||null===(i=n.sendUserMessage(t,r))||void 0===i?void 0:i.then((function(e){return s._messageStatisticsObserver.countP2PMessage(!0,t,!0,a,e),e.id})).catch((function(e){throw s._messageStatisticsObserver.countP2PMessage(!1,t,!0,a,e),e})));case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return ue.apply(this,arguments)})},{key:"sendRoomMessage",value:(ce=c(o().mark((function e(t){var r,n,i,a=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return iM(t),this._assertNotInRoom(),i=Date.now(),e.abrupt("return",null===(r=this._room)||void 0===r||null===(n=r.sendRoomMessage(t))||void 0===n?void 0:n.then((function(e){var t,r;return a._messageStatisticsObserver.countRoomMessage(!0,null===(t=a._room)||void 0===t||null===(r=t.roomInfo)||void 0===r?void 0:r.roomId,!1,i),e})).catch((function(e){var t,r;throw a._messageStatisticsObserver.countRoomMessage(!1,null===(t=a._room)||void 0===t||null===(r=t.roomInfo)||void 0===r?void 0:r.roomId,!1,i),e})));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return ce.apply(this,arguments)})},{key:"sendRoomBinaryMessage",value:(se=c(o().mark((function e(t){var r,n,i,a=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return iM(t),this._assertNotInRoom(),i=Date.now(),e.abrupt("return",null===(r=this._room)||void 0===r||null===(n=r.sendRoomMessage(t,!0))||void 0===n?void 0:n.then((function(e){var t,r;return a._messageStatisticsObserver.countRoomMessage(!0,null===(t=a._room)||void 0===t||null===(r=t.roomInfo)||void 0===r?void 0:r.roomId,!0,i),e})).catch((function(e){var t,r;throw a._messageStatisticsObserver.countRoomMessage(!1,null===(t=a._room)||void 0===t||null===(r=t.roomInfo)||void 0===r?void 0:r.roomId,!0,i),e})));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return se.apply(this,arguments)})},{key:"setAudioCaptureConfig",value:(ae=c(o().mark((function e(){var t,r,n,i=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=i.length>0&&void 0!==i[0]?i[0]:{},c0.print("setAudioCaptureConfig()","config: %o",t),delete t.deviceId,YP(t),r=this._audioStreamConstraints.deviceId,this._audioStreamConstraints=t,r&&(this._audioStreamConstraints.deviceId=r),!this._localAudioTrack){e.next=11;break}return this._localAudioTrack.audioCaptureConfig=this._audioStreamConstraints,e.next=11,null===(n=this._localAudioTrack)||void 0===n?void 0:n.updateAudioCaptureConfig();case 11:case"end":return e.stop()}}),e,this)}))),function(){return ae.apply(this,arguments)})},{key:"setVideoCaptureConfig",value:(ie=c(o().mark((function e(){var t,r,n,a=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=a.length>0&&void 0!==a[0]?a[0]:{},c0.print("setVideoCaptureConfig()","config: %o",r),delete r.deviceId,YP(r),n=i(i({},r),{},{deviceId:this._videoStreamConstraints.deviceId}),!this._localVideoTrack){e.next=9;break}return e.next=8,this._localVideoTrack.updateVideoCaptureConfig(n);case 8:this._updatePublish();case 9:return this._videoStreamConstraints=n,e.abrupt("return",(null===(t=this._localVideoTrack)||void 0===t?void 0:t.getTrack().getSettings())||{});case 11:case"end":return e.stop()}}),e,this)}))),function(){return ie.apply(this,arguments)})},{key:"enableSimulcastMode",value:function(e){return c0.print("enableSimulcastMode()","enabled: %o",e),this._enableSimulcast=e,!0}},{key:"setVideoEncoderConfig",value:(ne=c(o().mark((function e(t){var r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:c0.print("setVideoEncoderConfig()"," descriptions: %o",t),Array.isArray(t)||(t=[t]),t.length>3&&(t=t.slice(0,3)),t.sort((function(e,t){return t.maxKbps-e.maxKbps})),this._videoStreamEncodeConfig=t,this._updateDummyCaptureImage(L.STREAM_INDEX_MAIN),null!==(r=this._room)&&void 0!==r&&r.hasPublished&&this._updatePublish();case 7:case"end":return e.stop()}}),e,this)}))),function(e){return ne.apply(this,arguments)})},{key:"setScreenEncoderConfig",value:(te=c(o().mark((function e(t){var r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:c0.print("setScreenEncoderConfig()","description: %o",t),this._screenStreamEncodeConfig=[t],this._localScreenVideoTrack&&(this._localScreenVideoTrack.updateVideoCaptureConfig(t),t.contentHint&&this._localScreenVideoTrack.setContentHint(t.contentHint)),this._updateDummyCaptureImage(L.STREAM_INDEX_SCREEN),null!==(r=this._room)&&void 0!==r&&r.hasScreenPublished&&this._updateScreenPublish();case 5:case"end":return e.stop()}}),e,this)}))),function(e){return te.apply(this,arguments)})},{key:"sendSEIMessage",value:function(e,t,r){if(c0.print("sendSEIMessage()","streamIdex: %o, message: %o, repeatCount: %o",e,t,r),!Yj())throw new hN(dN.NOT_SUPPORTED,"Browser does not support sending SEI");XP(e,"streamIndex",[L.STREAM_INDEX_MAIN,L.STREAM_INDEX_SCREEN]),HP(r,"repeatCount",0,30);var n="string"==typeof t?new Uint8Array(_P.str2ab(t)):t;if(t.length){var i;if(e===L.STREAM_INDEX_MAIN){var o,a,s;if(null===(o=this._room)||void 0===o||null===(a=o.localStream)||void 0===a||!a.hasPublished)return;i=null===(s=this._room)||void 0===s?void 0:s.localStream}else{var c,u,d;if(null===(c=this._room)||void 0===c||null===(u=c.localScreenStream)||void 0===u||!u.hasPublished)return;i=null===(d=this._room)||void 0===d?void 0:d.localScreenStream}if(n.byteLength>4096)c0.print("sei size must not bigger than 4KB");else{var l=hP();i.seiList.push({content:n,uuid:l,repeatCount:r}),setTimeout((function(){if(i){var e=i.seiList.findIndex((function(e){return e.uuid===l}));e&&i.seiList.splice(e,1)}}),2e3)}}else c0.print("sei message must not be empty")}},{key:"setAudioVolumeIndicationInterval",value:function(e){var t=this;c0.print("setAudioVolumeIndicationInterval()","interval %o: ",e),("number"!=typeof e||e<200)&&(e=200);var r=[];this._audioVolumeIndicationTimer&&clearInterval(this._audioVolumeIndicationTimer),this._audioVolumeIndicationTimer=setInterval((function(){var e,n;r=[],null===(e=t._room)||void 0===e||e.remoteStreams.forEach((function(e,t){var n;if(0!==e.length){var i=e.find((function(e){return!1===e.isScreen})),o=null==i||null===(n=i.audioTrack)||void 0===n?void 0:n.getAudioLevel();r.push({userId:t,volume:o||0})}}));var i=null===(n=t._localAudioTrack)||void 0===n?void 0:n.getAudioLevel();r.push({userId:t._getUserId(),volume:i||0}),t.safeEmit(oe.onAudioVolumeIndication,{speakers:r})}),e)}},{key:"_sendActiveSpeaker",value:function(e,t){if(this._room&&this._room.remoteUsers.size>=1){var r,n=e[0],i=t.reduce((function(e,t){return e&&e.audioPropertiesInfo.nonlinearVolume>t.audioPropertiesInfo.nonlinearVolume?e:t}),void 0);if((r=n?i?n.audioPropertiesInfo.nonlinearVolume>i.audioPropertiesInfo.nonlinearVolume?n:i:n:i)&&r.audioPropertiesInfo.nonlinearVolume>-35){var o,a;if(r.streamKey)o=this._room.remoteUsers.get(r.streamKey.userId);else o=null===(a=this._room._roomInfo)||void 0===a?void 0:a.userInfo;o&&this.safeEmit(oe.onActiveSpeaker,{userId:o.userId,extraInfo:o.extraInfo})}}}},{key:"enableAudioPropertiesReport",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};c0.print("enableAudioPropertiesReport()","config %o: ",t);var r=t.enableInBackground,n=void 0===r||r,i=t.interval,o=void 0===i?100:i;this._stopAudioPropertiesReport(),o<=0||(o=Math.max(100,o),this._audioPropertiesReportTimer=self.setInterval((function(){if(n||"hidden"!==document.visibilityState){var t=[],r=e._audioDeviceManager.getRecordTrack()||e._localAudioTrack;if(r){var i=r.getAudioLevel();t.push({streamIndex:L.STREAM_INDEX_MAIN,audioPropertiesInfo:{linearVolume:i,nonlinearVolume:LP(i)}})}if(e._localScreenAudioTrack){var o=e._localScreenAudioTrack.getAudioLevel();t.push({streamIndex:L.STREAM_INDEX_SCREEN,audioPropertiesInfo:{linearVolume:o,nonlinearVolume:LP(o)}})}if(e.safeEmit(oe.onLocalAudioPropertiesReport,t),e._room){var a,s=[];if(null!==(a=e._room)&&void 0!==a&&a.multiChatMode)e._room.getActiveSpeakerInMultiChatMode().forEach((function(t){var r,n,i=255*t.audioLevel;s.push({streamKey:{userId:t.userId,streamIndex:L.STREAM_INDEX_MAIN,roomId:null===(r=e._room)||void 0===r||null===(n=r._roomInfo)||void 0===n?void 0:n.roomId},audioPropertiesInfo:{linearVolume:i,nonlinearVolume:LP(i)}})}));else e._room.remoteStreams.forEach((function(t,r){t.forEach((function(t){if(t.audioTrack){var n,i,o=t.audioTrack.getAudioLevel();s.push({streamKey:{userId:r,streamIndex:t.isScreen?L.STREAM_INDEX_SCREEN:L.STREAM_INDEX_MAIN,roomId:null===(n=e._room)||void 0===n||null===(i=n.roomInfo)||void 0===i?void 0:i.roomId},audioPropertiesInfo:{linearVolume:o,nonlinearVolume:LP(o)}})}}))}));e.safeEmit(oe.onRemoteAudioPropertiesReport,s),e._sendActiveSpeaker(t,s.filter((function(e){return e.streamKey.streamIndex!==L.STREAM_INDEX_SCREEN})))}}}),o))}},{key:"setVideoSourceType",value:(ee=c(o().mark((function e(t,r){var n,i,a,s,c,u,d,l,h,f,p,v,_,m,y,g,S,b,E,k,T;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c0.print("setVideoSourceType()","index: %o, videoSourceType: %o",t,r),XP(t,"streamIndex",[L.STREAM_INDEX_MAIN,L.STREAM_INDEX_SCREEN]),XP(r,"VideoSourceType",[R.VIDEO_SOURCE_TYPE_EXTERNAL,R.VIDEO_SOURCE_TYPE_INTERNAL]),n=t===L.STREAM_INDEX_MAIN?"video":"screenVideo",this._trackSourceType[n]===r){e.next=26;break}if(this._trackSourceType[n]=r,c0.print("setVideoSourceType","set ".concat(n," source type to ").concat(r)),!this._localVideoTrack||t!==L.STREAM_INDEX_MAIN){e.next=17;break}if(c=!1,r===R.VIDEO_SOURCE_TYPE_EXTERNAL&&(c=!0,this._removeLocalTrackEvents(this._localVideoTrack),this._localVideoTrack.close()),null===(i=this._videoPlayer)||void 0===i||i.stop(),this._localVideoTrack=void 0,u=null===(a=this._room)||void 0===a?void 0:a._roomConfig.isAutoPublish,c?null===(d=this._room)||void 0===d||null===(l=d.localStream)||void 0===l||null===(h=l.observer)||void 0===h||h.setEnableVideo(!1):null===(f=this._room)||void 0===f||null===(p=f.localStream)||void 0===p||null===(v=p.observer)||void 0===v||v.setPushVideo(!1),!(null!==(s=this._room)&&void 0!==s&&s.hasPublished||u)){e.next=17;break}return e.next=17,this._updatePublish();case 17:if(!this._localScreenVideoTrack||t!==L.STREAM_INDEX_SCREEN){e.next=26;break}if(y=!1,r===R.VIDEO_SOURCE_TYPE_EXTERNAL&&(y=!0,this._removeLocalTrackEvents(this._localScreenVideoTrack),this._localScreenVideoTrack.close()),null===(_=this._screenPlayer)||void 0===_||_.stop(),this._localScreenVideoTrack=void 0,y?null===(g=this._room)||void 0===g||null===(S=g.localScreenStream)||void 0===S||null===(b=S.observer)||void 0===b||b.setEnableVideo(!1):null===(E=this._room)||void 0===E||null===(k=E.localScreenStream)||void 0===k||null===(T=k.observer)||void 0===T||T.setPushVideo(!1),null===(m=this._room)||void 0===m||!m.hasScreenPublished){e.next=26;break}return e.next=26,this._updateScreenPublish();case 26:case"end":return e.stop()}}),e,this)}))),function(e,t){return ee.apply(this,arguments)})},{key:"setExternalVideoTrack",value:($=c(o().mark((function e(t,r){var n,i,a,s,c,u,d,l,h;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c0.print("setExternalVideoTrack()","index: %o, track: %o",t,r),XP(t,"streamIndex",[L.STREAM_INDEX_MAIN,L.STREAM_INDEX_SCREEN]),KP(r),t!==L.STREAM_INDEX_MAIN){e.next=15;break}if(this._trackSourceType.video===R.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=6;break}throw new hN(dN.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as external first");case 6:return e.next=8,mz(r,this._extensionManager);case 8:if(this._localVideoTrack=e.sent,this._initLocalTrackEvents(this._localVideoTrack),null===(n=this._videoPlayer)||void 0===n||n.playVideo(this._localVideoTrack),s=null===(i=this._room)||void 0===i?void 0:i._roomConfig.isAutoPublish,!(null!==(a=this._room)&&void 0!==a&&a.hasPublished||s)){e.next=15;break}return e.next=15,this._updatePublish();case 15:if(t!==L.STREAM_INDEX_SCREEN){e.next=27;break}if(this._trackSourceType.screenVideo===R.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=18;break}throw new hN(dN.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as external first");case 18:return e.next=20,bz(r,this._extensionManager);case 20:if(this._localScreenVideoTrack=e.sent,this._initLocalTrackEvents(this._localScreenVideoTrack,!0),null===(c=this._screenPlayer)||void 0===c||c.playVideo(this._localScreenVideoTrack),null===(u=this._room)||void 0===u||null===(d=u.localScreenStream)||void 0===d||null===(l=d.observer)||void 0===l||l.setPushVideo(!0),null===(h=this._room)||void 0===h||!h.hasScreenPublished){e.next=27;break}return e.next=27,this._updateScreenPublish();case 27:case"end":return e.stop()}}),e,this)}))),function(e,t){return $.apply(this,arguments)})},{key:"setAudioSourceType",value:(Z=c(o().mark((function e(t,r){var n,i,a,s,c,u,d,l,h,f,p,v,_,m,y,g,S,b,E;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c0.print("setAudioSourceType()","index: %o, audioSourceType: %o",t,r),XP(t,"streamIndex",[L.STREAM_INDEX_MAIN,L.STREAM_INDEX_SCREEN]),XP(r,"audioSourceType",[w.AUDIO_SOURCE_TYPE_EXTERNAL,w.AUDIO_SOURCE_TYPE_INTERNAL]),n=t===L.STREAM_INDEX_MAIN?"audio":"screenAudio",this._trackSourceType[n]===r){e.next=24;break}if(this._trackSourceType[n]=r,c0.print("setVideoSourceType","set ".concat(n," source type to ").concat(r)),!this._localAudioTrack||t!==L.STREAM_INDEX_MAIN){e.next=16;break}if(s=!1,this._trackSourceType.audio===w.AUDIO_SOURCE_TYPE_EXTERNAL&&(s=!0,this._removeLocalTrackEvents(this._localAudioTrack),this._localAudioTrack.close()),this._localAudioTrack=void 0,c=null===(i=this._room)||void 0===i?void 0:i._roomConfig.isAutoPublish,s?null===(u=this._room)||void 0===u||null===(d=u.localStream)||void 0===d||null===(l=d.observer)||void 0===l||l.setEnableAudio(!1):null===(h=this._room)||void 0===h||null===(f=h.localStream)||void 0===f||null===(p=f.observer)||void 0===p||p.setPushAudio(!1),!(null!==(a=this._room)&&void 0!==a&&a.hasPublished||c)){e.next=16;break}return e.next=16,this._updatePublish();case 16:if(!this._localScreenAudioTrack||t!==L.STREAM_INDEX_SCREEN){e.next=24;break}if(_=!1,this._trackSourceType.audio===w.AUDIO_SOURCE_TYPE_EXTERNAL&&(_=!0,this._removeLocalTrackEvents(this._localScreenAudioTrack),this._localScreenAudioTrack.close()),this._localScreenAudioTrack=void 0,_?null===(m=this._room)||void 0===m||null===(y=m.localScreenStream)||void 0===y||null===(g=y.observer)||void 0===g||g.setEnableAudio(!1):null===(S=this._room)||void 0===S||null===(b=S.localScreenStream)||void 0===b||null===(E=b.observer)||void 0===E||E.setPushAudio(!1),null===(v=this._room)||void 0===v||!v.hasScreenPublished){e.next=24;break}return e.next=24,this._updateScreenPublish();case 24:case"end":return e.stop()}}),e,this)}))),function(e,t){return Z.apply(this,arguments)})},{key:"setExternalAudioTrack",value:(J=c(o().mark((function e(t,r){var n,i,a,s,c,u,d,l,h,f;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c0.print("setExternalAudioTrack()","index: %o, track: %o",t,r),XP(t,"streamIndex",[L.STREAM_INDEX_MAIN,L.STREAM_INDEX_SCREEN]),KP(r),t!==L.STREAM_INDEX_MAIN){e.next=15;break}if(this._trackSourceType.audio===w.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=6;break}throw new hN(dN.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as external first");case 6:return e.next=8,gz(r,this._extensionManager);case 8:if(this._localAudioTrack=e.sent,this._initLocalTrackEvents(this._localAudioTrack),u=null===(n=this._room)||void 0===n?void 0:n._roomConfig.isAutoPublish,null===(i=this._room)||void 0===i||null===(a=i.localStream)||void 0===a||null===(s=a.observer)||void 0===s||s.setPushAudio(!0),!(null!==(c=this._room)&&void 0!==c&&c.hasPublished||u)){e.next=15;break}return e.next=15,this._updatePublish();case 15:if(t!==L.STREAM_INDEX_SCREEN){e.next=26;break}if(this._trackSourceType.screenAudio===w.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=18;break}throw new hN(dN.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as external first");case 18:return e.next=20,kz(r,this._extensionManager);case 20:if(this._localScreenAudioTrack=e.sent,this._initLocalTrackEvents(this._localScreenAudioTrack),null===(d=this._room)||void 0===d||null===(l=d.localScreenStream)||void 0===l||null===(h=l.observer)||void 0===h||h.setPushAudio(!0),null===(f=this._room)||void 0===f||!f.hasScreenPublished){e.next=26;break}return e.next=26,this._updateScreenPublish();case 26:case"end":return e.stop()}}),e,this)}))),function(e,t){return J.apply(this,arguments)})},{key:"login",value:(W=c(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return c0.print("login()","token: %o, userInfo: %o",t,r),QP(t)||zP(t,"token"),$P(r),e.abrupt("return",this._rtmClient.login(t,r));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return W.apply(this,arguments)})},{key:"logout",value:(q=c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return c0.print("logout()"),e.abrupt("return",this._rtmClient.logout());case 2:case"end":return e.stop()}}),e,this)}))),function(){return q.apply(this,arguments)})},{key:"updateLoginToken",value:(z=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return c0.print("updateLoginToken()","token: %o",t),QP(t)||zP(t,"token"),e.abrupt("return",this._rtmClient.updateLoginToken(t));case 3:case"end":return e.stop()}}),e,this)}))),function(e){return z.apply(this,arguments)})},{key:"getPeerOnlineStatus",value:(H=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return c0.print("getPeerOnlineStatus()","userId: %o",t),$P(t),e.abrupt("return",this._rtmClient.getPeerOnlineStatus(t));case 3:case"end":return e.stop()}}),e,this)}))),function(e){return H.apply(this,arguments)})},{key:"sendUserMessageOutsideRoom",value:(G=c(o().mark((function e(t,r){var n,i=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return $P(t),iM(r),n=Date.now(),e.abrupt("return",this._rtmClient.sendUserMessageOutsideRoom(t,r).then((function(e){return i._messageStatisticsObserver.countUserMessageOutsideRoom(!0,t,!1,n,e),e.id})).catch((function(e){throw i._messageStatisticsObserver.countUserMessageOutsideRoom(!1,t,!1,n,e),e})));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return G.apply(this,arguments)})},{key:"sendUserBinaryMessageOutsideRoom",value:(j=c(o().mark((function e(t,r){var n,i=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return $P(t),WP(r,"message"),iM(r),n=Date.now(),e.abrupt("return",this._rtmClient.sendUserMessageOutsideRoom(t,r).then((function(e){return i._messageStatisticsObserver.countUserMessageOutsideRoom(!0,t,!0,n,e),e.id})).catch((function(e){throw i._messageStatisticsObserver.countUserMessageOutsideRoom(!1,t,!0,n,e),e})));case 5:case"end":return e.stop()}}),e,this)}))),function(e,t){return j.apply(this,arguments)})},{key:"setServerParams",value:(M=c(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return c0.print("setServerParams()","signature: %o, url: %0",t,r),e.abrupt("return",this._rtmClient.setServerParams(t,r));case 2:case"end":return e.stop()}}),e,this)}))),function(e,t){return M.apply(this,arguments)})},{key:"sendServerMessage",value:(P=c(o().mark((function e(t){var r,n=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return zP(t,"message"),iM(t),r=Date.now(),e.abrupt("return",this._rtmClient.sendServerMessage(t).then((function(){n._messageStatisticsObserver.countServerMessage(!0,!1,r)})).catch((function(e){throw n._messageStatisticsObserver.countServerMessage(!1,!1,r,e),e})));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return P.apply(this,arguments)})},{key:"sendServerBinaryMessage",value:(x=c(o().mark((function e(t){var r,n=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return WP(t,"message"),iM(t),r=Date.now(),e.abrupt("return",this._rtmClient.sendServerMessage(t).then((function(){n._messageStatisticsObserver.countServerMessage(!0,!0,r)})).catch((function(e){throw n._messageStatisticsObserver.countServerMessage(!1,!0,r,e),e})));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return x.apply(this,arguments)})},{key:"startCloudProxy",value:function(e){if(this._room)throw new hN(dN.START_CLOUD_PROXY_AFTER_JOIN,"[startCloudProxy] should be invoke before join room ");c0.print("startCloudProxy()",e),zP(e.logProxy,"logProxy"),zP(e.accessProxy,"accessProxy"),zP(e.configProxy,"configProxy"),this._originIceConfigRequestUrls=sj("ICE_CONFIG_REQUEST_URLS"),this._originLogServerUrl=sj("LOG_SERVER_URL"),this._originConfigServerUrls=sj("CONFIG_REQUEST_DOMAINS"),aj("ICE_CONFIG_REQUEST_URLS",e.accessProxy),aj("LOG_SERVER_URL",function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return/^https?:\/\/.+/.test(e)||(e="https://"+e),"".concat(e,"/video/v1/webrtc_log/")}(e.logProxy)),aj("CONFIG_REQUEST_DOMAINS",[e.configProxy]),this._useCloudProxy=!0}},{key:"stopCloudProxy",value:function(){if(this._room)throw new hN(dN.STOP_CLOUD_PROXY_BEFORE_LEAVE,"[stopCloudProxy] should be invoke after leave room ");c0.print("stopCloudProxy()"),aj("ICE_CONFIG_REQUEST_URLS",[]),aj("LOG_SERVER_URL",this._originLogServerUrl),aj("CONFIG_REQUEST_DOMAINS",this._originConfigServerUrls),this._useCloudProxy=!1,this._startCloudProxyTimestamp=void 0}},{key:"startPushPublicStream",value:(O=c(o().mark((function e(t,r){var n,i,a,s=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c0.print("startPushPublicStream()","publicStreamId: %o, publicStreamParam: %o",t,r),eM(t),this._assertNotInRoom(),!this._publicStreamIds.get(t)){e.next=5;break}throw new hN(dN.REPEAT_PUSH,"repeat push public media stream");case 5:return a=cj(t,"started",r),e.abrupt("return",null===(n=this._room)||void 0===n||null===(i=n.publicStreamControlMessage(a))||void 0===i?void 0:i.then((function(){s._publicStreamIds.set(t,t)})));case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return O.apply(this,arguments)})},{key:"updatePublicStreamParam",value:(C=c(o().mark((function e(t,r){var n,i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return c0.print("startPushPublicStream()","publicStreamId: %o, publicStreamParam: %o",t,r),eM(t),this._assertNotInRoom(),i=cj(t,"layoutChanged",r),e.abrupt("return",null===(n=this._room)||void 0===n?void 0:n.publicStreamControlMessage(i));case 5:case"end":return e.stop()}}),e,this)}))),function(e,t){return C.apply(this,arguments)})},{key:"stopPushPublicStream",value:(I=c(o().mark((function e(t){var r,n=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return c0.print("startPushPublicStream()","publicStreamId: %o",t),eM(t),this._assertNotInRoom(),e.abrupt("return",null===(r=this._room)||void 0===r?void 0:r.publicStreamControlMessage({type:"publicstream",action:"stopped",publicStreamID:t}).then((function(){n._publicStreamIds.delete(t)})));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return I.apply(this,arguments)})},{key:"startPlayPublicStream",value:(T=c(o().mark((function e(t){var r,n,i,a,s,c,u=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(eM(t),this._outsideRoom){e.next=8;break}return this._outsideRoom=new G$(this._appId),this._outsideRoom.on(Gz.RESUBSCRIBE,(function(e){var t=e.stream;if(t){var r,n=u._publicStreamAudioPlayer.get(t.streamId);n&&t.audioTrack&&(n.stop(),n.playAudio(null===(r=e.stream)||void 0===r?void 0:r.audioTrack));var i,o=u._publicStreamVideoPlayer.get(t.streamId);o&&t.videoTrack&&o.playVideo(null===(i=e.stream)||void 0===i?void 0:i.videoTrack)}})),null===(r=this._outsideRoom)||void 0===r||r.on("onRemoteStreamStats",(function(e){e.publicStreamId=e.userId,delete e.userId,delete e.isScreen,u.safeEmit(oe.onPublicStreamStats,e)})),null===(n=this._outsideRoom)||void 0===n||n.on(Gz.ON_SEI_MESSAGED_RECEIVED,(function(e){u.safeEmit(oe.onPublicStreamSEIMessageReceived,e)})),e.next=8,this._outsideRoom.connect();case 8:return e.next=10,this._outsideRoom.startPlayPublicStream(t);case 10:i=e.sent,(a=this._publicStreamVideoPlayer.get(t))&&null!=i&&i.videoTrack&&a.playVideo(i.videoTrack,i),!(s=this._publicStreamAudioPlayer.get(t))&&null!=i&&i.audioTrack&&(s=new jW(t,{muted:(null===(c=this._config)||void 0===c?void 0:c.autoPlayPolicy)===Q.VIDEO_ONLY,isScreen:!1}),this._initPlayerEvents(s,!0),s.playAudio(i.audioTrack),this._publicStreamAudioPlayer.set(t,s));case 15:case"end":return e.stop()}}),e,this)}))),function(e){return T.apply(this,arguments)})},{key:"stopPlayPublicStream",value:(k=c(o().mark((function e(t){var r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._outsideRoom){e.next=2;break}return e.abrupt("return");case 2:this._outsideRoom.stopPlayPublicStream(t),(r=this._publicStreamAudioPlayer.get(t))&&(r.destroy(),this._publicStreamAudioPlayer.delete(t));case 5:case"end":return e.stop()}}),e,this)}))),function(e){return k.apply(this,arguments)})},{key:"setAudioProfile",value:(S=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this._audioProfileManager.setAudioProfile(t);case 1:case"end":return e.stop()}}),e,this)}))),function(e){return S.apply(this,arguments)})},{key:"setPublicStreamVideoPlayer",value:function(e,t){var r,n,o,a;c0.print("setPublicStreamVideoPlayer()","publicStreamId: %o, videoPlayerOption: %o",e,t);var s=this._publicStreamVideoPlayer.get(e);if(null===(r=s)||void 0===r||r.destroy(),null!=t&&t.renderDom){s=new BW(i(i({},t),{},{userId:e})),this._initPlayerEvents(s,!0),this._publicStreamVideoPlayer.set(e,s);var c=null===(n=this._outsideRoom)||void 0===n||null===(o=n.remoteStreams)||void 0===o?void 0:o.get(e);null!=c&&c.videoTrack&&(null===(a=this._config)||void 0===a?void 0:a.autoPlayPolicy)!==Q.PLAY_MANUALLY&&s.playVideo(c.videoTrack,c)}else this._publicStreamVideoPlayer.delete(e)}},{key:"setDummyCaptureImagePath",value:(y=c(o().mark((function e(t,r){var n=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e,i){zP(r,"filePath");var o=new Image;o.crossOrigin="anonymous",o.src=r,o.onload=function(){t===L.STREAM_INDEX_MAIN?n._dummyMainImage=o:n._dummyScreenImage=o;try{n._updateDummyCaptureImage(t),e()}catch(r){i(new hN(dN.UNEXPECTED_ERROR,r.message))}},o.onerror=function(){i(new hN(dN.UNEXPECTED_ERROR,"Load image error"))}})));case 1:case"end":return e.stop()}}),e)}))),function(e,t){return y.apply(this,arguments)})},{key:"_updateDummyCaptureImage",value:function(e){var t,r;if(e===L.STREAM_INDEX_MAIN?(t=this._dummyMainImage,r=this._videoStreamEncodeConfig[0]):(t=this._dummyScreenImage,r=this._screenStreamEncodeConfig[0]),t){var n,i,o=document.createElement("canvas"),a=o.getContext("2d");if(!a)throw new hN(dN.UNEXPECTED_ERROR,"Not support canvas");!r||t.width<=r.width&&t.height<=r.height?(n=t.width,i=t.height):(n=Math.min(r.width,t.width*r.height/t.height),i=Math.min(r.height,t.height*r.width/t.width)),o.width=n,o.height=i,a.drawImage(t,0,0,t.width,t.height,0,0,n,i);var s=window.setInterval((function(){t&&a.drawImage(t,0,0,t.width,t.height,0,0,n,i)}),200);e===L.STREAM_INDEX_MAIN?(clearInterval(this._dummyMainTimer),this._dummyMainTimer=s):(clearInterval(this._dummyScreenTimer),this._dummyScreenTimer=s);var c,u,d,l,h=o.captureStream(5).getVideoTracks()[0];if(e===L.STREAM_INDEX_MAIN){if(this._localImgVideoTrack=h,null!==(c=this._localVideoTrack)&&void 0!==c&&c.dummy)null===(u=this._localVideoTrack)||void 0===u||u.setTrack(this._localImgVideoTrack,this._extensionManager)}else if(this._localImgScreenTrack=h,null!==(d=this._localScreenVideoTrack)&&void 0!==d&&d.dummy)null===(l=this._localScreenVideoTrack)||void 0===l||l.setTrack(this._localImgScreenTrack,this._extensionManager)}}},{key:"registerExtension",value:(_=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.monitor=MB,t.isSupported()){e.next=3;break}throw new Error("This extension is not supported.");case 3:return e.next=5,t.init();case 5:this._extensionManager.register(t);case 6:case"end":return e.stop()}}),e,this)}))),function(e){return _.apply(this,arguments)})},{key:"defaultTranscoding",value:function(){return JSON.parse(JSON.stringify(t0.getDefaultValue()))}},{key:"_updatePublish",value:(v=c(o().mark((function e(){var t,r,n,a=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=a.length>0&&void 0!==a[0]?a[0]:{},c0.print("_updatePublish()","config: %o",t),r={mediaType:void 0,invokeByJoinRoom:!1,pubState:zz.PUB},t=i(i({},r),t),this._visibility){e.next=6;break}throw new hN(dN.NO_PUBLISH_PERMISSION,"no publish permission");case 6:return e.next=8,this._pubLock.lock();case 8:if(n=e.sent,this._room&&this._room.connectionState===mX.CONNECTED){e.next=12;break}return n(),e.abrupt("return");case 12:return e.prev=12,e.next=15,this._room.publish(this._videoStreamEncodeConfig,this._enableSimulcast,this._localVideoTrack,this._localAudioTrack,t.mediaType,t.pubState,t.invokeByJoinRoom);case 15:e.next=24;break;case 17:if(e.prev=17,e.t0=e.catch(12),!(e.t0 instanceof hN)){e.next=23;break}throw e.t0;case 23:throw new hN(dN.UNEXPECTED_ERROR,"unexpected error",e.t0);case 24:return e.prev=24,n(),e.finish(24);case 27:case"end":return e.stop()}}),e,this,[[12,17,24,27]])}))),function(){return v.apply(this,arguments)})},{key:"startAudioPlaybackDeviceTest",value:(d=c(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return c0.print("startAudioPlaybackDeviceTest()","filePath: %o, indicationInterval: %o",t,r),zP(t,"filePath"),HP(r,"indicationInterval"),e.next=5,this._audioDeviceManager.startAudioPlaybackDeviceTest(t,r);case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return d.apply(this,arguments)})},{key:"stopAudioPlaybackDeviceTest",value:function(){c0.print("stopAudioPlaybackDeviceTest()"),this._audioDeviceManager.stopAudioPlaybackDeviceTest()}},{key:"startAudioDeviceRecordTest",value:(s=c(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return c0.print("startAudioDeviceRecordTest()","indicationInterval: %o",t),HP(t,"indicationInterval"),e.next=4,this._audioDeviceManager.startAudioDeviceRecordTest(t,r);case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return s.apply(this,arguments)})},{key:"stopAudioDeviceRecordAndPlayTest",value:function(){c0.print("stopAudioDeviceRecordAndPlayTest()"),this._audioDeviceManager.stopAudioDeviceRecordAndPlayTest()}},{key:"stopAudioDevicePlayTest",value:function(){c0.print("stopAudioDevicePlayTest()"),this._audioDeviceManager.stopAudioDevicePlayTest()}},{key:"setRemoteUserPriority",value:function(e,t){var r;c0.print("setRemoteUserPriority()","userId: %o, priority: %o",e,t);try{$P(e),XP(t,"priority",[K.HIGH,K.MEDIUM,K.LOW])}catch(n){return console.warn(n),!1}return this._userPriorityMap.set(e,t),null===(r=this._room)||void 0===r||r.setRemoteUserPriority(e,t),!0}},{key:"takeLocalSnapshot",value:(a=c(o().mark((function e(t){var r,n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c0.print("takeLocalSnapshot()","streamIndex: %o",t),XP(t,"streamIndex",[L.STREAM_INDEX_MAIN,L.STREAM_INDEX_SCREEN]),r=t===L.STREAM_INDEX_MAIN?this.localVideoTrack:this.localScreenVideoTrack){e.next=5;break}throw new hN(dN.INVOKED_BEFORE_CAPTURE,"capture first");case 5:return n=t===L.STREAM_INDEX_MAIN?this._videoPlayer:this._screenPlayer,e.abrupt("return",W$(r.getTrack("preprocessing"),(null==n?void 0:n.mirrorType)===B.MIRROR_TYPE_RENDER,n));case 7:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"takeRemoteSnapshot",value:(n=c(o().mark((function e(t,r){var n,i,a,s,c,u;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c0.print("takeRemoteSnapshot()","id: %o, streamIndex: %o",t,r),zP(t,"id"),XP(r,"streamIndex",[L.STREAM_INDEX_MAIN,L.STREAM_INDEX_SCREEN]),u=(null===(n=this._room)||void 0===n||null===(i=n.remoteStreams.get(t))||void 0===i||null===(a=i.find((function(e){return e.isScreen===(r===L.STREAM_INDEX_SCREEN)})))||void 0===a?void 0:a.videoTrack)||(null===(s=this._outsideRoom)||void 0===s||null===(c=s.remoteStreams.get(t))||void 0===c?void 0:c.videoTrack)){e.next=6;break}throw new hN(dN.STREAM_NOT_EXIST,"stream not exist");case 6:return e.abrupt("return",W$(u.getTrack(),!1,r===L.STREAM_INDEX_MAIN?this._remoteVideoPlayer.get(t):this._remoteScreenPlayer.get(t)));case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return n.apply(this,arguments)})},{key:"setSubscribeFallbackOption",value:function(e){c0.print("setSubscribeFallbackOption()","option: %o",e);try{XP(e,"option",[X.DISABLE,X.VIDEO_STREAM_LOW,X.AUDIO_ONLY])}catch(t){return console.warn(t),!1}return!this._room&&(this._subscribeFallbackOption=e,!0)}},{key:"getLocalStreamTrack",value:function(e,t){var r,n,i=this;if(e===L.STREAM_INDEX_MAIN?(r="video"===t?this.localVideoTrack:this.localAudioTrack,n=function(){var e;return null===(e=i._room)||void 0===e?void 0:e.localStream}):(r="video"===t?this.localScreenVideoTrack:this.localScreenAudioTrack,n=function(){var e;return null===(e=i._room)||void 0===e?void 0:e.localScreenStream}),r){var o=r instanceof Iz&&r.mixedAudioTrack?r.mixedAudioTrack:r.getTrack("preprocessing");if(o){var a=n();return n0(o,"enabled",this._reportMsTrackEvent.bind(this,"enabled",(null==a?void 0:a.streamId)||"","getLocalStreamTrack",t)),n0(o,"readyState",(function(e){"ended"===e&&(i0(o,"enabled"),i0(o,"readyState")),i._reportMsTrackEvent("readyState",(null==a?void 0:a.streamId)||"","getLocalStreamTrack",t,e)})),o.addEventListener("ended",(function(){i0(o,"enabled"),i0(o,"readyState")})),o}}}},{key:"getRemoteStreamTrack",value:function(e,t,r){var n,i,o=this,a=(null===(n=this._room)||void 0===n?void 0:n.remoteStreams.get(e))||[];if(a&&a.length){var s,c,u,d,l;if(t===L.STREAM_INDEX_MAIN)s=a.find((function(e){return!e.isScreen})),i="video"===r?null===(c=s)||void 0===c?void 0:c.videoTrack:null===(u=s)||void 0===u?void 0:u.audioTrack;else s=a.find((function(e){return e.isScreen})),i="video"===r?null===(d=s)||void 0===d?void 0:d.videoTrack:null===(l=s)||void 0===l?void 0:l.audioTrack;if(i){var h=i.getTrack();if(h&&s){var f=s.streamId;return n0(h,"enabled",this._reportMsTrackEvent.bind(this,"enabled",f,"getRemoteStreamTrack",r)),n0(h,"readyState",(function(e){"ended"===e&&(i0(h,"enabled"),i0(h,"readyState")),o._reportMsTrackEvent("readyState",f,"getRemoteStreamTrack",r,e)})),h.addEventListener("ended",(function(){i0(h,"enabled"),i0(h,"readyState")})),h}}}}},{key:"getPublicStreamTrack",value:function(e,t){var r=this;if(this._outsideRoom&&this._outsideRoom.remoteStreams){var n=this._outsideRoom.remoteStreams.get(e);if(n){var i="video"===t?n.videoTrack:n.audioTrack;if(i){var o=i.getTrack();if(o){var a=n.streamId;return n0(o,"enabled",this._reportMsTrackEvent.bind(this,"enabled",a,"getPublicStreamTrack",t)),n0(o,"readyState",(function(e){"ended"===e&&(i0(o,"enabled"),i0(o,"readyState")),r._reportMsTrackEvent("readyState",a,"getPublicStreamTrack",t,e)})),o.addEventListener("ended",(function(){i0(o,"enabled"),i0(o,"readyState")})),o}}}}}},{key:"_reportMsTrackEvent",value:function(e,t,r,n,i){var o;switch(e){case"readyState":o="live"!==i?"".concat(n," stopped"):"unknown";break;case"enabled":o="".concat(n,!0===i?" unmuted":" muted");break;default:o="unknown"}MB.rtcInvokeStatus(o,0,r,t||"",0,{direction:"getLocalStreamTrack"===r?"up":"down"})}},{key:"_updateScreenPublish",value:(r=c(o().mark((function e(){var t,r,n,a=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=a.length>0&&void 0!==a[0]?a[0]:{},c0.print("_updateScreenPublish()"),r={mediaType:void 0,pubState:zz.PUB},t=i(i({},r),t),e.next=6,this._pubLock.lock();case 6:if(n=e.sent,this._room&&this._room.connectionState===mX.CONNECTED){e.next=10;break}return n(),e.abrupt("return");case 10:return e.prev=10,e.next=13,this._room.publishScreen(this._screenStreamEncodeConfig,this._localScreenVideoTrack,this._localScreenAudioTrack,t.mediaType,t.pubState);case 13:e.next=22;break;case 15:if(e.prev=15,e.t0=e.catch(10),!(e.t0 instanceof hN)){e.next=21;break}throw e.t0;case 21:throw new hN(dN.UNEXPECTED_ERROR,"unexpected error",e.t0);case 22:return e.prev=22,n(),e.finish(22);case 25:case"end":return e.stop()}}),e,this,[[10,15,22,25]])}))),function(){return r.apply(this,arguments)})},{key:"_updateAudioPlayerState",value:function(e){c0.print("_updateAudioPlayerState()");var t,r=e.userId,n=e.isScreen,i=n?this._remoteScreenAudioPlayer:this._remoteAudioPlayer,o=i.get(r);if(e.audioTrack&&(e.attributes.audiostream&&e.subAudio||this.multiChatMode)){var a,s;if(!o)o=new jW(r,{muted:(null===(s=this._config)||void 0===s?void 0:s.autoPlayPolicy)===Q.VIDEO_ONLY,isScreen:n}),this._initPlayerEvents(o,!1,n?L.STREAM_INDEX_SCREEN:L.STREAM_INDEX_MAIN),i.set(r,o),this._audioPlaybackDeviceId&&o.setPlaybackDevice(this._audioPlaybackDeviceId);(null===(a=this._config)||void 0===a?void 0:a.autoPlayPolicy)!==Q.PLAY_MANUALLY&&o.playAudio(e.audioTrack),SP&&IP&&(t=this._remoteAudioPlayer,e0&&clearTimeout(e0),e0=setTimeout((function(){var e,r=A(t);try{for(r.s();!(e=r.n()).done;){var n=E(e.value,2),i=n[0],o=n[1];null!=i&&i.startsWith("mux")&&o.pause()}}catch(l){r.e(l)}finally{r.f()}var a,s=A(t);try{for(s.s();!(a=s.n()).done;){var c=E(a.value,2),u=c[0],d=c[1];null!=u&&u.startsWith("mux")&&d.manuallyPlay()}}catch(l){s.e(l)}finally{s.f()}}),2e3))}else{var c;null===(c=o)||void 0===c||c.stop()}}},{key:"_updateVideoPlayerState",value:function(e){var t;c0.print("_updateVideoPlayerState()");var r,n,i=e.userId;if(r=e.isScreen?this._remoteScreenPlayer.get(i):this._remoteVideoPlayer.get(i),e.videoTrack)r&&(null===(n=this._config)||void 0===n?void 0:n.autoPlayPolicy)!==Q.PLAY_MANUALLY&&r.playVideo(e.videoTrack,e);else if(null!==(t=r)&&void 0!==t&&t.played){var o;null===(o=r)||void 0===o||o.stop()}}},{key:"_onAddStream",value:function(e){var t=e.stream,r=null==t?void 0:t.attributes,n=r.localaudio,i=r.audiostream,o=r.localvideo,a=r.videostream,s=Az.NONE;if(i&&(s|=U.AUDIO),a&&(s|=U.VIDEO),s){var c;if(null!=t&&t.isScreen)this.safeEmit(oe.onUserPublishScreen,{userId:t.userId,mediaType:s});else this.safeEmit(oe.onUserPublishStream,{userId:t.userId,mediaType:s,videoStreamDescriptions:null==t||null===(c=t.attributes)||void 0===c?void 0:c.videoDescriptions}),this._handleAutoSubscribe(t,!0);this.safeEmit("onAddStream",{userId:t.userId,mediaType:s,isScreen:!(null==t||!t.isScreen)}),null!=t&&t.isScreen||(n&&this.safeEmit(oe.onUserStartAudioCapture,{userId:t.userId}),o&&this.safeEmit(oe.onUserStartVideoCapture,{userId:t.userId}))}}},{key:"_handleAutoSubscribe",value:function(e,t){var r,n,i=Az.NONE;if(null!==(r=this._roomConfig)&&void 0!==r&&r.isAutoSubscribeAudio&&(i|=U.AUDIO),null!==(n=this._roomConfig)&&void 0!==n&&n.isAutoSubscribeVideo&&(i|=U.VIDEO),i){var o,a;if(t&&UP(i))null===(o=e.observer)||void 0===o||o.setAutoSubscribeAudio(!0);if(t&&VP(i))null===(a=e.observer)||void 0===a||a.setAutoSubscribeVideo(!0);this._subscribe(!1,e.userId,i)}}},{key:"_onRemoveStream",value:function(e){var t,r=this,n=e.stream,i=null!==(t=d0[e.reason])&&void 0!==t?t:V.STREAM_REMOVE_REASON_OTHER,o=n.isScreen?oe.onUserUnpublishScreen:oe.onUserUnpublishStream,a=Az.NONE;n.attributes.audiostream&&(a|=U.AUDIO),n.attributes.videostream&&(a|=U.VIDEO),a!==Az.NONE&&(this.safeEmit(o,{userId:n.userId,mediaType:a,reason:i}),this.safeEmit("onRemoveStream",{userId:n.userId,isScreen:n.isScreen})),this._getRemotePlayer(n.userId,n.isScreen).forEach((function(e){var t=n.isScreen?"".concat(n.userId,"_screen"):n.userId;r._remoteAudioPlayer.delete(t),n.isScreen?r._remoteScreenPlayer.delete(n.userId):r._remoteVideoPlayer.delete(n.userId),null==e||e.destroy()}))}},{key:"_onUserConnection",value:function(e){this.safeEmit(oe.onUserJoined,e)}},{key:"_onUserLeave",value:function(e){this.safeEmit(oe.onUserLeave,e)}},{key:"_onRoomError",value:function(e){var t;this.safeEmit(oe.onError,e),null===(t=this._room)||void 0===t||t.destroy(),this._room=void 0}},{key:"_onNetworkQuality",value:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this.safeEmit.apply(this,[oe.onNetworkQuality].concat(t))}},{key:"_onConnectionStateChange",value:function(e){if(void 0!==this._startCloudProxyTimestamp&&this._useCloudProxy&&e.state===F.CONNECTION_STATE_CONNECTED&&this.safeEmit(oe.onCloudProxyConnected,{interval:Date.now()-this._startCloudProxyTimestamp}),this.safeEmit(oe.onConnectionStateChanged,e),e.state===F.CONNECTION_STATE_RECONNECTING){var t,r=A(this._remoteAudioPlayer);try{for(r.s();!(t=r.n()).done;){var n=E(t.value,2),i=n[0],o=n[1];null!=i&&i.startsWith("mux")&&o.stop()}}catch(a){r.e(a)}finally{r.f()}}}},{key:"_getRemotePlayer",value:function(e,t){return[(t?this._remoteScreenAudioPlayer:this._remoteAudioPlayer).get(e),(t?this._remoteScreenPlayer:this._remoteVideoPlayer).get(e)]}},{key:"_stopAudioPropertiesReport",value:function(){null!==this._audioPropertiesReportTimer&&(clearInterval(this._audioPropertiesReportTimer),this._audioPropertiesReportTimer=null)}},{key:"_onResubscribe",value:function(e){e.stream&&(this._getRemotePlayer(e.stream.userId,e.stream.isScreen).forEach((function(e){return null==e?void 0:e.stop()})),this._updateAudioPlayerState(e.stream),this._updateVideoPlayerState(e.stream))}},{key:"_onSubscribePushTrack",value:function(e){e.stream&&this._updateAudioPlayerState(e.stream)}},{key:"_onRemovePushTrack",value:function(e){e.stream&&this._updateAudioPlayerState(e.stream)}},{key:"_onVideoDeviceStateChange",value:function(e){this.safeEmit(oe.onVideoDeviceStateChanged,e)}},{key:"_onAudioDeviceStateChange",value:function(e){this.safeEmit(oe.onAudioDeviceStateChanged,e)}},{key:"_onUserPublishStateChange",value:function(e){var t,r=e.userId,n=e.isScreen,o=e.mediaType,a=e.pubState,s=e.remoteStream,c={userId:r,mediaType:o};n?a===zz.PUB?this.safeEmit(oe.onUserPublishScreen,c):this.safeEmit(oe.onUserUnpublishScreen,i(i({},c),{},{reason:V.STREAM_REMOVE_REASON_UNPUBLISH})):a===zz.PUB?(c.videoStreamDescriptions=null==s||null===(t=s.attributes)||void 0===t?void 0:t.videoDescriptions,this.safeEmit(oe.onUserPublishStream,c),this._handleAutoSubscribe(s,!0)):this.safeEmit(oe.onUserUnpublishStream,i(i({},c),{},{reason:V.STREAM_REMOVE_REASON_UNPUBLISH}))}},{key:"_onCustomMessage",value:function(e){var t=e.message;e.binary?this.safeEmit(oe.onRoomBinaryMessageReceived,{userId:e.clientId,message:t}):this.safeEmit(oe.onRoomMessageReceived,{userId:e.clientId,message:t})}},{key:"_onUserMessageReceived",value:function(e){this._messageStatisticsObserver.recvP2PMessage(e.userId),this.safeEmit(oe.onUserMessageReceived,e)}},{key:"_onUserBinaryMessageReceived",value:function(e){this._messageStatisticsObserver.recvP2PMessage(e.userId),this.safeEmit(oe.onUserBinaryMessageReceived,e)}},{key:"_onLiveTranscodingResult",value:function(e){this.safeEmit(oe.onLiveTranscodingResult,e)}},{key:"_onStreamMixingEvent",value:function(e){this.safeEmit(oe.onStreamMixingEvent,e)}},{key:"_onUserTokenWillExpire",value:function(){this.safeEmit(oe.onTokenWillExpire)}},{key:"_onPushPublicStreamResult",value:function(e){this.safeEmit(oe.onPushPublicStreamResult,e)}},{key:"_handleRTMClient",value:function(e){var t=this;e.on("onUserMessageReceivedOutsideRoom",(function(e){t._messageStatisticsObserver.recvP2POutRoomMessage(e.userId),t.safeEmit(oe.onUserMessageReceivedOutsideRoom,e)})),e.on("onUserBinaryMessageReceivedOutsideRoom",(function(e){t._messageStatisticsObserver.recvP2POutRoomMessage(e.userId),t.safeEmit(oe.onUserBinaryMessageReceivedOutsideRoom,e)})),e.on("onUserDisconnection",(function(){t.safeEmit(oe.onError,{errorCode:dN.RTM_DUPLICATE_LOGIN})})),e.on("onRTMTokenError",(function(){t.safeEmit(oe.onError,{errorCode:dN.RTM_TOKEN_ERROR})})),e.on("onServerParamsSetResult",(function(e){t.safeEmit(oe.onServerParamsSetResult,null==e?void 0:e.code)}))}},{key:"waitForNewToken",get:function(){return!!this._tempRoomInfo}},{key:"localAudioTrack",get:function(){return this._localAudioTrack}},{key:"localVideoTrack",get:function(){return this._localVideoTrack}},{key:"localScreenAudioTrack",get:function(){return this._localScreenAudioTrack}},{key:"localScreenVideoTrack",get:function(){return this._localScreenVideoTrack}},{key:"remoteStreams",get:function(){var e,t,r=[];null!==(e=this._room)&&void 0!==e&&e.remoteStreams&&(null===(t=this._room)||void 0===t||t.remoteStreams.forEach((function(e){Array.isArray(e)&&e.forEach((function(e){r.push({userId:e.userId,isScreen:e.isScreen,hasVideo:e.hasVideo,hasAudio:e.hasAudio,videoStreamDescriptions:e.attributes.videoDescriptions})}))})));return r}},{key:"iceState",get:function(){var e,t,r,n;return null===(e=this._room)||void 0===e||null===(t=e._mediaServerClient)||void 0===t||null===(r=t.handler)||void 0===r||null===(n=r._peerConnection)||void 0===n?void 0:n.iceConnectionState}},{key:"remoteUsers",get:function(){var e,t,r=[];null!==(e=this._room)&&void 0!==e&&e.remoteUsers&&(null===(t=this._room)||void 0===t||t.remoteUsers.forEach((function(e){r.push({userId:e.userId})})));return r}},{key:"multiChatMode",get:function(){var e,t;return!(null===(e=this._room)||void 0===e||null===(t=e._mediaServerClient)||void 0===t||!t.roomAttributes.multiChatMode)}},{key:"_handleAudioDeviceManager",value:function(){var e=this;this._audioDeviceManager.on("onAudioPlaybackDeviceTestVolume",(function(t){e.safeEmit(oe.onAudioPlaybackDeviceTestVolume,t)}))}},{key:"_assertNotInRoom",value:function(){if(!this._room||this._room.connectionState!==mX.CONNECTED)throw new hN(dN.NOT_CONNECTED_YET,"server not connected")}},{key:"_checkMediaType",value:function(e){XP(e,"mediaType",[U.AUDIO,U.VIDEO,U.AUDIO_AND_VIDEO])}},{key:"_getUserId",value:function(){var e,t;return(null===(e=this._room)||void 0===e||null===(t=e.roomInfo)||void 0===t?void 0:t.userInfo.userId)||"local_user"}},{key:"_switchTrack",value:(t=c(o().mark((function e(t){var r,n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._initLocalTrackEvents(t),this._localVideoTrack=t,null!==(r=this._videoPlayer)&&void 0!==r&&r.played&&(this._videoPlayer.stop(),this._videoPlayer.playVideo(t),this._videoPlayer.mirror(!!this._mirrorType)),null===(n=this._room)||void 0===n||!n.hasPublished){e.next=6;break}return e.next=6,this._updatePublish();case 6:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})}]),je}($L);s0([HB()],u0.prototype,"updateToken",1),s0([HB()],u0.prototype,"setVideoCaptureDevice",1),s0([HB()],u0.prototype,"setAudioCaptureDevice",1),s0([HB()],u0.prototype,"joinRoom",1),s0([HB()],u0.prototype,"leaveRoom",1),s0([HB()],u0.prototype,"destroy",1),s0([HB()],u0.prototype,"publishStream",1),s0([HB()],u0.prototype,"unpublishStream",1),s0([HB()],u0.prototype,"publishScreen",1),s0([HB()],u0.prototype,"unpublishScreen",1),s0([HB()],u0.prototype,"subscribeStream",1),s0([HB()],u0.prototype,"unsubscribeStream",1),s0([HB()],u0.prototype,"subscribeScreen",1),s0([HB()],u0.prototype,"unsubscribeScreen",1),s0([HB()],u0.prototype,"setRemoteVideoConfig",1),s0([HB()],u0.prototype,"startVideoCapture",1),s0([HB()],u0.prototype,"stopVideoCapture",1),s0([HB()],u0.prototype,"startAudioCapture",1),s0([HB()],u0.prototype,"stopAudioCapture",1),s0([HB()],u0.prototype,"getAudioMixingManager",1),s0([HB()],u0.prototype,"startScreenCapture",1),s0([HB()],u0.prototype,"stopScreenCapture",1),s0([HB()],u0.prototype,"setLocalVideoPlayer",1),s0([HB()],u0.prototype,"startLiveTranscoding",1),s0([HB()],u0.prototype,"updateLiveTranscoding",1),s0([HB()],u0.prototype,"stopLiveTranscoding",1),s0([HB()],u0.prototype,"setBusinessId",1),s0([HB()],u0.prototype,"setUserVisibility",1),s0([HB()],u0.prototype,"setRemoteVideoPlayer",1),s0([HB()],u0.prototype,"setLocalVideoMirrorType",1),s0([HB()],u0.prototype,"setAudioPlaybackDevice",1),s0([HB()],u0.prototype,"play",1),s0([HB()],u0.prototype,"pauseAllSubscribedStream",1),s0([HB()],u0.prototype,"resumeAllSubscribedStream",1),s0([HB()],u0.prototype,"sendUserMessage",1),s0([HB()],u0.prototype,"sendUserBinaryMessage",1),s0([HB()],u0.prototype,"sendRoomMessage",1),s0([HB()],u0.prototype,"sendRoomBinaryMessage",1),s0([HB()],u0.prototype,"setAudioCaptureConfig",1),s0([HB()],u0.prototype,"setVideoCaptureConfig",1),s0([HB()],u0.prototype,"enableSimulcastMode",1),s0([HB()],u0.prototype,"setVideoEncoderConfig",1),s0([HB()],u0.prototype,"setScreenEncoderConfig",1),s0([HB()],u0.prototype,"sendSEIMessage",1),s0([HB()],u0.prototype,"setAudioVolumeIndicationInterval",1),s0([HB()],u0.prototype,"enableAudioPropertiesReport",1),s0([HB()],u0.prototype,"setVideoSourceType",1),s0([HB()],u0.prototype,"setExternalVideoTrack",1),s0([HB()],u0.prototype,"setAudioSourceType",1),s0([HB()],u0.prototype,"setExternalAudioTrack",1),s0([HB("rtm")],u0.prototype,"login",1),s0([HB("rtm")],u0.prototype,"logout",1),s0([HB("rtm")],u0.prototype,"updateLoginToken",1),s0([HB("rtm")],u0.prototype,"getPeerOnlineStatus",1),s0([HB("rtm")],u0.prototype,"sendUserMessageOutsideRoom",1),s0([HB("rtm")],u0.prototype,"sendUserBinaryMessageOutsideRoom",1),s0([HB("rtm")],u0.prototype,"setServerParams",1),s0([HB("rtm")],u0.prototype,"sendServerMessage",1),s0([HB("rtm")],u0.prototype,"sendServerBinaryMessage",1),s0([HB()],u0.prototype,"startCloudProxy",1),s0([HB()],u0.prototype,"stopCloudProxy",1),s0([HB()],u0.prototype,"startPushPublicStream",1),s0([HB()],u0.prototype,"updatePublicStreamParam",1),s0([HB()],u0.prototype,"stopPushPublicStream",1),s0([HB("outsideRoom","streamId")],u0.prototype,"startPlayPublicStream",1),s0([HB("outsideRoom","streamId")],u0.prototype,"stopPlayPublicStream",1),s0([HB()],u0.prototype,"setAudioProfile",1),s0([HB("outsideRoom")],u0.prototype,"setPublicStreamVideoPlayer",1),s0([HB()],u0.prototype,"setDummyCaptureImagePath",1),s0([HB()],u0.prototype,"registerExtension",1),s0([HB()],u0.prototype,"startAudioPlaybackDeviceTest",1),s0([HB()],u0.prototype,"stopAudioPlaybackDeviceTest",1),s0([HB()],u0.prototype,"startAudioDeviceRecordTest",1),s0([HB()],u0.prototype,"stopAudioDeviceRecordAndPlayTest",1),s0([HB()],u0.prototype,"stopAudioDevicePlayTest",1),s0([HB()],u0.prototype,"setRemoteUserPriority",1),s0([HB()],u0.prototype,"takeLocalSnapshot",1),s0([HB()],u0.prototype,"takeRemoteSnapshot",1),s0([HB()],u0.prototype,"setSubscribeFallbackOption",1),s0([HB()],u0.prototype,"getLocalStreamTrack",1),s0([HB()],u0.prototype,"getRemoteStreamTrack",1),s0([HB()],u0.prototype,"getPublicStreamTrack",1);var d0={"client unpublished":V.STREAM_REMOVE_REASON_UNPUBLISH,"publish failed":V.STREAM_REMOVE_REASON_PUBLISH_FAILED,"stream removed":V.STREAM_REMOVE_REASON_KEEP_LIVE_FAILED,"client disconnected":V.STREAM_REMOVE_REASON_CLIENT_DISCONNECTED,"client republish":V.STREAM_REMOVE_REASON_REPUBLISH},l0=new JL("VERTC",0);KL.storeKey="".concat(Date.now(),"-").concat(ej.getDeviceId()),[VB,FB,BB].forEach((function(e){var t;return e.setStats({rtc_sdk_version:oj.VERSION,product_line:$F.RTC,report_version:eB.W_5,os:tB.WEB,device_id:ej.getDeviceId(),log_cache_key:KL.storeKey,user_agent:vP()?"":null===(t=navigator)||void 0===t?void 0:t.userAgent})})),EW.setStats({rtc_sdk_version:oj.VERSION,log_cache_key:KL.storeKey});var h0=function(e,t){return l0.print("createEngine","Invoke VERTC.createEngine"),zP(e,"appId"),[VB,FB,BB].forEach((function(r){return r.setStats({rtc_app_id:e,auto_play_policy:null==t?void 0:t.autoPlayPolicy})})),EW.setStats({rtc_app_id:e}),MB.sdkInitEngine(Date.now(),RB.BEGIN),new u0(e,t)},f0=function(e){if(l0.print("destroyEngine","Invoke VERTC.destroyEngine"),!(e instanceof u0))throw new hN(dN.INVALID_ENGINE,"Invalid engine object");e.destroy(),MB.sdkInitEngine(Date.now(),RB.END)},p0=function(){var e=c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",UH.enumerateDevices());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),v0=function(){var e=c(o().mark((function e(){var t,r,n,i,a,s,c=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=c.length>0&&void 0!==c[0]?c[0]:{video:!0,audio:!0},r=t.video,n=t.audio,i={video:!1,audio:!1},!r){e.next=13;break}return e.prev=4,e.next=7,UH.getPermissions({video:!0,force:!0});case 7:a=e.sent,i.video=a.video,e.next=13;break;case 11:e.prev=11,e.t0=e.catch(4);case 13:if(!n){e.next=23;break}return e.prev=14,e.next=17,UH.getPermissions({audio:!0,force:!0});case 17:s=e.sent,i.audio=s.audio,e.next=23;break;case 21:e.prev=21,e.t1=e.catch(14);case 23:return e.abrupt("return",i);case 24:case"end":return e.stop()}}),e,null,[[4,11],[14,21]])})));return function(){return e.apply(this,arguments)}}(),_0=function(){var e=c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",UH.enumerateAudioCaptureDevices());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),m0=function(){var e=c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",UH.enumerateVideoCaptureDevices());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),y0=function(){var e=c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",UH.enumerateAudioPlaybackDevices());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),g0=function(){return oj.VERSION},S0=function(){return MB.rtcSdkApiCall("isSupported",0,""),Kj()},b0=function(){return MB.rtcSdkApiCall("getSupportedCodecs",0,""),Wj()},E0=function(e){var t=e.logLevel,r=e.LogfileSize;t&&(KL.logLevel=t),r&&(KL.LogfileSize=r)},k0=function(e){KL.download(e)};return!vP()&&location.search.includes("_rtc_autotest_"),i(i(i(i({},new(l((function e(){u(this,e),h(this,"getSdkVersion",g0),h(this,"createEngine",h0),h(this,"destroyEngine",f0),h(this,"enumerateDevices",p0),h(this,"enableDevices",v0),h(this,"enumerateAudioCaptureDevices",_0),h(this,"enumerateVideoCaptureDevices",m0),h(this,"enumerateAudioPlaybackDevices",y0),h(this,"getParameter",sj),h(this,"setParameter",aj),h(this,"isSupported",S0),h(this,"getSupportedCodecs",b0),h(this,"events",oe),h(this,"ErrorCode",dN),h(this,"platform","".concat({}.PRODUCT_PLATFORM)),h(this,"_monitor",MB),h(this,"downloadLog",k0),h(this,"setLogConfig",E0)})))),ee),ie),{},{events:oe})}));
|