@byteplus/rtc 4.49.5 → 4.51.0
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-beauty/index.js +1 -1
- package/extension-beauty/index.umd.js +1 -1
- package/index.d.ts +637 -455
- package/index.esm.min.js +2 -2
- package/index.min.js +2 -2
- package/package.json +1 -1
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.
|
|
4
|
+
* version: 4.51.0
|
|
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:b(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 E(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 b(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(E.prototype),u(E.prototype,s,(function(){return this})),e.AsyncIterator=E,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var a=new E(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 E(){return E="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}},E.apply(this,arguments)}function b(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||{}),K=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}(K||{}),X=function(e){return e[e.LOW=0]="LOW",e[e.MEDIUM=100]="MEDIUM",e[e.HIGH=200]="HIGH",e}(X||{}),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:K,RemoteUserPriority:X,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,Ee,be=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,Ke={all:ze,IS_HTMLDDA:void 0===ze&&void 0!==ze},Xe=Ke.all,qe=Ke.IS_HTMLDDA?function(e){return"function"==typeof e||e===Xe}:function(e){return"function"==typeof e},We=qe,Ye=Ke.all,Je=Ke.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&&(Ee=(Se=ct.split("."))[0]>0&&Se[0]<4?1:+(Se[0]+Se[1])),!Ee&&it&&(!(Se=it.match(/Edge\/(\d+)/))||Se[1]>=74)&&(Se=it.match(/Chrome\/(\d+)/))&&(Ee=+Se[1]);var ut=Ee,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"}},Et=qe,bt=St,kt=TypeError,Tt=function(e){if(Et(e))return e;throw kt(bt(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),Kt=Object.hasOwn||function(e,t){return zt(Ht(e),t)},Xt=Re,qt=0,Wt=Math.random(),Yt=Xt(1..toString),Jt=function(e){return"Symbol("+(void 0===e?"":e)+")_"+Yt(++qt+Wt,36)},Qt=ce,Zt=Dt.exports,$t=Kt,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,Er=gr(Sr)&&gr(Sr.createElement),br=function(e){return Er?Sr.createElement(e):{}},kr=br,Tr=!le&&!de((function(){return 7!=Object.defineProperty(kr("div"),"a",{get:function(){return 7}}).a})),Ir=le,Ar=ve,Rr=_e,wr=be,Cr=He,Or=yr,xr=Kt,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,Kr=TypeError,Xr=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 Xr(e,t,r)}:Xr:function(e,t,r){if(Hr(e),t=zr(t),Hr(r),jr)try{return Xr(e,t,r)}catch(n){}if("get"in r||"set"in r)throw Kr("Accessors not supported");return"value"in r&&(e[t]=r.value),e};var Qr=Pr,Zr=be,$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=Kt,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"),En=function(e){return Sn[e]||(Sn[e]=gn(e))},bn={},kn=mn,Tn=ce,In=Je,An=$r,Rn=Kt,wn=Vt,Cn=En,On=bn,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=Kt,Bn=le,jn=sn.CONFIGURABLE,Gn=pn,Hn=Ln.enforce,zn=Ln.get,Kn=Object.defineProperty,Xn=Bn&&!Un((function(){return 8!==Kn((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?Kn(e,"name",{value:t,configurable:!0}):e.name=t),Xn&&r&&Fn(r,"arity")&&e.length!==r.arity&&Kn(e,"length",{value:r.arity});try{r&&Fn(r,"constructor")&&r.constructor?Bn&&Kn(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=Kt,Si=He,Ei=yi.indexOf,bi=bn,ki=Re([].push),Ti=function(e,t){var r,n=Si(e),i=0,o=[];for(r in n)!gi(bi,r)&&gi(n,r)&&ki(o,r);for(;t.length>i;)gi(n,r=t[i++])&&(~Ei(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=Kt,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=Ki[zi(e)];return r==qi||r!=Xi&&(ji(t)?Bi(t):!!t)},zi=Hi.normalize=function(e){return String(e).replace(Gi,".").toLowerCase()},Ki=Hi.data={},Xi=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=be,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},Eo=Re,bo=de,ko=qe,To=So,Io=pn,Ao=function(){},Ro=[],wo=et("Reflect","construct"),Co=/^\s*(?:class|function)\b/,Oo=Eo(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||bo((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"),Ko=function(e){return Ho>=51||!Go((function(){var t=[];return(t.constructor={})[zo]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},Xo=ro,qo=de,Wo=io,Yo=Je,Jo=Gt,Qo=fi,Zo=ao,$o=lo,ea=jo,ta=Ko,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)};Xo({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=br("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,Ea=Le,ba=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=ba(c),v=Ea(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,Ka=Pr,Xa=Fr,qa=He,Wa=Ga;Fa.f=Ha&&!za?Object.defineProperties:function(e,t){Xa(e);for(var r,n=qa(t),i=Wa(t),o=i.length,a=0;o>a;)Ka.f(e,r=i[a++],n[r]);return e};var Ya,Ja=et("document","documentElement"),Qa=Fr,Za=Fa,$a=Ii,es=bn,ts=Ja,rs=br,ns=En("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))},Es=Ss,bs=TypeError,ks=function(e){if(Es(e))throw bs("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},Ks=de,Xs=ce.RegExp,qs=Ks((function(){var e=Xs(".","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,Ec=de,bc=sr,kc=$r,Tc=bc("species"),Ic=RegExp.prototype,Ac=function(e,t,r,n){var i=bc(e),o=!Ec((function(){var t={};return t[i]=function(){return 7},7!=""[e](t)})),a=o&&!Ec((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,Kc=As,Xc=Be,qc=Hc("".charAt),Wc=Hc("".charCodeAt),Yc=Hc("".slice),Jc=function(e){return function(t,r){var n,i,o=Kc(Xc(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,Eu=As,bu=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=bu(Eu(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=Kt,Lu=qe,Uu=Gt,Vu=Pu,Fu=En("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,Ku=Je,Xu=Gu,qu=$n,Wu=sr("iterator"),Yu=!1;[].keys&&("next"in(Du=[].keys())?(xu=Xu(Xu(Du)))!==Object.prototype&&(Ou=xu):Yu=!0),(!Ku(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=Kt,$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=be,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,Ed=ed,bd=$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)),Ed(s,l,!0)),Id&&i==xd&&p&&p.name!==xd&&(Ad?bd(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",Kd=Fd.set,Xd=Fd.getterFor(zd),qd=jd(Array,"Array",(function(e,t){Kd(this,{type:zd,target:Ld(e),index:0,kind:t})}),(function(){var e=Xd(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(y0){}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(y0){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=bn,gl=Je,Sl=Kt,El=Pr.f,bl=ei,kl=Jd,Tl=pl,Il=vl,Al=!1,Rl=Jt("meta"),wl=0,Cl=function(e){El(e,Rl,{value:{objectID:"O"+wl++,weakData:{}}})},Ol=Yd.exports={enable:function(){Ol.enable=function(){},Al=!0;var e=bl.f,t=ml([].splice),r={};r[Rl]=1,e(r).length&&(bl.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,Kl=Bl,Xl=TypeError,ql=function(e,t){var r=arguments.length<2?Kl(e):t;if(Gl(r))return Hl(jl(r,e));throw Xl(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(y0){i=!0,n=y0}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(y0){sh(n,"throw",y0)}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(y0){}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(y0){}return r},Sh=qe,Eh=Je,bh=pd,kh=function(e,t,r){var n,i;return bh&&Sh(n=t.constructor)&&n!==r&&Eh(i=n.prototype)&&i!==r.prototype&&bh(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,Kh=sr("species"),Xh=function(e){var t=Gh(e),r=Hh.f;zh&&t&&!t[Kh]&&r(t,Kh,{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=Xh,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,Ef=$r,bf=sr,kf=bf("iterator"),Tf=bf("toStringTag"),If=Sf.values,Af=function(e,t){if(e){if(e[kf]!==If)try{Ef(e,kf,If)}catch(y0){e[kf]=If}if(e[Tf]||Ef(e,Tf,t),yf[t])for(var r in Sf)if(e[r]!==Sf[r])try{Ef(e,r,Sf[r])}catch(y0){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,Kf=Re("".replace),Xf=String(zf("zxcasd").stack),qf=/\n\s*at [^:]*:[^\n]*/,Wf=qf.test(Xf),Yf=function(e,t){if(Wf&&"string"==typeof e&&!zf.prepareStackTrace)for(;t--;)e=Kf(e,qf,"");return e},Jf=be,Qf=!de((function(){var e=Error("a");return!("stack"in e)||(Object.defineProperty(e,"stack",Jf(1,7)),7!==e.stack)})),Zf=et,$f=Kt,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(y0){}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,Ep=Le,bp=fi,kp=TypeError,Tp=function(e){return function(t,r,n,i){gp(r);var o=Sp(t),a=Ep(o),s=bp(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,Kp=ro,Xp=va,qp=ue.f,Wp=li,Yp=As,Jp=ks,Qp=Be,Zp=ws,$p=Xp("".endsWith),ev=Xp("".slice),tv=Math.min,rv=Zp("endsWith");Kp({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(y0){return y0 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(y0){return y0 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 Ev(){if("object"===("undefined"==typeof window?"undefined":a(window))){if(vv)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function bv(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=Ko("slice"),Kv=Gv("species"),Xv=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===Xv||Mv(r.prototype))||Uv(r)&&null===(r=r[Kv]))&&(r=void 0),r===Xv||void 0===r))return Hv(o,s,c);for(n=new(void 0===r?Xv: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_=Ko("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:!Ko("map")},{map:function(e){return __(this,e,arguments.length>1?arguments[1]:void 0)}});var m_,y_,g_,S_,E_=Po,b_=St,k_=TypeError,T_=function(e){if(E_(e))return e;throw k_(b_(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_=Kt,V_=de,F_=Ja,B_=Nv,j_=br,G_=x_,H_=D_,z_=Ap,K_=N_.setImmediate,X_=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(y0){}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)};K_&&X_||(K_=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_},X_=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:K_,clear:X_},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,Em=D_,bm=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(y0){throw am?cm():sm=void 0,y0}}sm=void 0,e&&e.enter()},Em||Tm||km||!Im||!Am?!bm&&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(y0){return{error:!0,value:y0}}},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,Km=Vm,Xm=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&&(Km||Xm)&&!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=Xh,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))},Ey=Nm,by=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(y0){d&&!i&&d.exit(),u(y0)}},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&&Xy(e)})))},Ky=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)},Xy=function(e){cy(yy,sy,(function(){var t,r=e.facade,n=e.value;if(qy(e)&&(t=Ey((function(){ay?Uy.emit("unhandledRejection",n,r):Ky(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):Ky("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(y0){Jy(r,y0,e)}})):(e.value=t,e.state=1,zy(e,!1))}catch(y0){Jy({done:!1},y0,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(y0){Jy(t,y0)}}).prototype,(ry=function(e){xy(this,{type:Ay,done:!1,notified:!1,parent:!1,reactions:new by,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(y0){}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,Eg=Je,bg=Zm,kg=function(e,t){if(Sg(e),Eg(t)&&t.constructor===e)return t;var r=bg.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(y0){}},jg=et,Gg=de,Hg=cs,zg=be,Kg=Pr.f,Xg=$n,qg=Og,Wg=Kt,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(y0){if(y0.name==iS&&25==y0.code)return y0.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,Kg(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"))),Kg(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),ES=SS.prototype;for(var bS in yS&&aS===SS&&Xg(ES,"toString",Qg),gS&&rS&&aS===SS&&qg(ES,"code",vS((function(){return hS(Jg(this).name)}))),$g)if(Wg($g,bS)){var kS=$g[bS],TS=kS.s,IS=zg(6,kS.c);Wg(SS,TS)||Kg(SS,TS,IS),Wg(ES,TS)||Kg(ES,TS,IS)}var AS=ro,RS=ce,wS=et,CS=be,OS=Pr.f,xS=Kt,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),KS=BS&&US&&Object.getOwnPropertyDescriptor(RS,VS),XS=!(!KS||KS.writable&&KS.configurable),qS=HS&&!XS&&!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 eE=Ra.filter;ro({target:"Array",proto:!0,forced:!Ko("filter")},{filter:function(e){return eE(this,e,arguments.length>1?arguments[1]:void 0)}});var tE=Re,rE=Gt,nE=Math.floor,iE=tE("".charAt),oE=tE("".replace),aE=tE("".slice),sE=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,cE=/\$([$&'`]|\d{1,2})/g,uE=Uf,dE=ve,lE=Re,hE=Ac,fE=de,pE=Fr,vE=qe,_E=Ue,mE=ii,yE=li,gE=As,SE=Be,EE=$c,bE=Rt,kE=function(e,t,r,n,i,o){var a=r+e.length,s=n.length,c=cE;return void 0!==i&&(i=rE(i),c=sE),oE(o,c,(function(o,c){var u;switch(iE(c,0)){case"$":return"$";case"&":return e;case"`":return aE(t,0,r);case"'":return aE(t,a);case"<":u=i[aE(c,1,-1)];break;default:var d=+c;if(0===d)return o;if(d>s){var l=nE(d/10);return 0===l?o:l<=s?void 0===n[l-1]?iE(c,1):n[l-1]+iE(c,1):o}u=n[d-1]}return void 0===u?"":u}))},TE=Pc,IE=sr("replace"),AE=Math.max,RE=Math.min,wE=lE([].concat),CE=lE([].push),OE=lE("".indexOf),xE=lE("".slice),DE="$0"==="a".replace(/./,"$0"),NE=!!/./[IE]&&""===/./[IE]("a","$0"),PE=!fE((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")}));hE("replace",(function(e,t,r){var n=NE?"$":"$0";return[function(e,r){var n=SE(this),i=_E(e)?void 0:bE(e,IE);return i?dE(i,e,n,r):dE(t,gE(n),e,r)},function(e,i){var o=pE(this),a=gE(e);if("string"==typeof i&&-1===OE(i,n)&&-1===OE(i,"$<")){var s=r(t,o,a,i);if(s.done)return s.value}var c=vE(i);c||(i=gE(i));var u=o.global;if(u){var d=o.unicode;o.lastIndex=0}for(var l=[];;){var h=TE(o,a);if(null===h)break;if(CE(l,h),!u)break;""===gE(h[0])&&(o.lastIndex=EE(a,yE(o.lastIndex),d))}for(var f,p="",v=0,_=0;_<l.length;_++){for(var m=gE((h=l[_])[0]),y=AE(RE(mE(h.index),a.length),0),g=[],S=1;S<h.length;S++)CE(g,void 0===(f=h[S])?f:String(f));var E=h.groups;if(c){var b=wE([m],g,y,a);void 0!==E&&CE(b,E);var k=gE(uE(i,void 0,b))}else k=kE(m,a,y,g,E,i);y>=v&&(p+=xE(a,v,y)+k,v=y+m.length)}return p+xE(a,v)}]}),!PE||!DE||NE);var ME=ve,LE=Kt,UE=tt,VE=Vs,FE=RegExp.prototype,BE=function(e){var t=e.flags;return void 0!==t||"flags"in FE||LE(e,"flags")||!UE(FE,e)?t:ME(VE,e)},jE=le,GE=ce,HE=Re,zE=Wi,KE=kh,XE=$r,qE=ei.f,WE=tt,YE=Ss,JE=As,QE=BE,ZE=zs,$E=Ff,eb=$n,tb=de,rb=Kt,nb=Ln.enforce,ib=Xh,ob=qs,ab=Js,sb=sr("match"),cb=GE.RegExp,ub=cb.prototype,db=GE.SyntaxError,lb=HE(ub.exec),hb=HE("".charAt),fb=HE("".replace),pb=HE("".indexOf),vb=HE("".slice),_b=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,mb=/a/g,yb=/a/g,gb=new cb(mb)!==mb,Sb=ZE.MISSED_STICKY,Eb=ZE.UNSUPPORTED_Y,bb=jE&&(!gb||Sb||ob||ab||tb((function(){return yb[sb]=!1,cb(mb)!=mb||cb(yb)==yb||"/a/i"!=cb(mb,"i")})));if(zE("RegExp",bb)){for(var kb=function(e,t){var r,n,i,o,a,s,c=WE(ub,this),u=YE(e),d=void 0===t,l=[],h=e;if(!c&&u&&d&&e.constructor===kb)return e;if((u||WE(ub,e))&&(e=e.source,d&&(t=QE(h))),e=void 0===e?"":JE(e),t=void 0===t?"":JE(t),h=e,ob&&"dotAll"in mb&&(n=!!t&&pb(t,"s")>-1)&&(t=fb(t,/s/g,"")),r=t,Sb&&"sticky"in mb&&(i=!!t&&pb(t,"y")>-1)&&Eb&&(t=fb(t,/y/g,"")),ab&&(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=hb(e,n)))t+=hb(e,++n);else if("]"===t)s=!1;else if(!s)switch(!0){case"["===t:s=!0;break;case"("===t:lb(_b,vb(e,n+1))&&(n+=2,c=!0),i+=t,u++;continue;case">"===t&&c:if(""===d||rb(a,d))throw new db("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=KE(cb(e,t),c?this:ub,kb),(n||i||l.length)&&(s=nb(a),n&&(s.dotAll=!0,s.raw=kb(function(e){for(var t,r=e.length,n=0,i="",o=!1;n<=r;n++)"\\"!==(t=hb(e,n))?o||"."!==t?("["===t?o=!0:"]"===t&&(o=!1),i+=t):i+="[\\s\\S]":i+=t+hb(e,++n);return i}(e),r)),i&&(s.sticky=!0),l.length&&(s.groups=l)),e!==h)try{XE(a,"source",""===h?"(?:)":h)}catch(y0){}return a},Tb=qE(cb),Ib=0;Tb.length>Ib;)$E(kb,cb,Tb[Ib++]);ub.constructor=kb,kb.prototype=ub,eb(GE,"RegExp",kb,{constructor:!0})}ib("RegExp");var Ab=le,Rb=qs,wb=xe,Cb=Og,Ob=Ln.get,xb=RegExp.prototype,Db=TypeError;Ab&&Rb&&Cb(xb,"dotAll",{configurable:!0,get:function(){if(this!==xb){if("RegExp"===wb(this))return!!Ob(this).dotAll;throw Db("Incompatible receiver, RegExp required")}}});var Nb=le,Pb=zs.MISSED_STICKY,Mb=xe,Lb=Og,Ub=Ln.get,Vb=RegExp.prototype,Fb=TypeError;Nb&&Pb&&Lb(Vb,"sticky",{configurable:!0,get:function(){if(this!==Vb){if("RegExp"===Mb(this))return!!Ub(this).sticky;throw Fb("Incompatible receiver, RegExp required")}}});var Bb=sn.PROPER,jb=$n,Gb=Fr,Hb=As,zb=de,Kb=BE,Xb="toString",qb=RegExp.prototype.toString,Wb=zb((function(){return"/a/b"!=qb.call({source:"a",flags:"b"})})),Yb=Bb&&qb.name!=Xb;(Wb||Yb)&&jb(RegExp.prototype,Xb,(function(){var e=Gb(this);return"/"+Hb(e.source)+"/"+Hb(Kb(e))}),{unsafe:!0});var Jb=ro,Qb=de,Zb=He,$b=ue.f,ek=le,tk=Qb((function(){$b(1)}));Jb({target:"Object",stat:!0,forced:!ek||tk,sham:!ek},{getOwnPropertyDescriptor:function(e,t){return $b(Zb(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,Ek=/^[\uD800-\uDBFF]$/,bk=/^[\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(Ek,e)&&!vk(bk,i)||vk(bk,e)&&!vk(Ek,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=Ev;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,Kk=As,Xk=(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:!Xk},{test:function(e){var t=zk(this),r=Kk(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){bv("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;bv("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 ET(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 bT(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:ET,shimCreateOffer:bT,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")?(bv("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=Kt,HT=kh,zT=tt,KT=yt,XT=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=XT(e,"number");return"bigint"==typeof t?t:aI(t)},aI=function(e){var t,r,n,i,o,a,s,c,u=XT(e,"number");if(KT(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 EI(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 bI(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:EI,shimMaxMessageSize:bI,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=Ev,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),EI(t),TI(t),bI(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),ET(t),bT(t),kT(t),SI(t),TI(t),bI(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),EI(t),bI(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,KI=r_,XI=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:XI(t)>XI(r)?1:-1}}(e)),r=zI(i),n=0;n<r;)t[n]=i[n++];for(;n<o;)KI(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=Kt,yA=So,gA=St,SA=$r,EA=$n,bA=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},KA=function(e){var t=TA(e);if(_A(t)){var r=CA(t);return r&&mA(r,BA)?r.TypedArrayConstructor:KA(t)}},XA=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,bA(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(XA(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(y0){try{o.prototype[e]=t}catch(a){}}}MA[e]&&!r||EA(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(y0){}if(PA[e]&&!r)return;try{return EA(PA,e,r?t:jA&&PA[e]||t)}catch(y0){}}for(n in HA)!(i=pA[n])||i[e]&&!r||EA(i,e,t)}},getTypedArrayConstructor:KA,isView:function(e){if(!_A(e))return!1;var t=yA(e);return"DataView"===t||mA(HA,t)||mA(zA,t)},isTypedArray:XA,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,ER=jh,bR=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,KR=vR.DataView,XR=KR&&KR.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(bR((function(){GR(1)}))&&bR((function(){new GR(-1)}))&&!bR((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(XR)!==qR&&CR(XR,qR);var fw=new KR(new HR(2)),pw=_R(XR.setInt8);fw.setInt8(0,2147483648),fw.setInt8(1,2147483649),!fw.getInt8(0)&&fw.getInt8(1)||ER(XR,{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,XR=(KR=function(e,t,r){kR(this,XR),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(KR,"buffer"),aw(KR,"byteLength"),aw(KR,"byteOffset")),ER(XR,{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(KR,BR);var vw={ArrayBuffer:HR,DataView:KR},_w=Je,mw=Math.floor,yw=Number.isInteger||function(e){return!_w(e)&&isFinite(e)&&mw(e)===e},gw=ii,Sw=RangeError,Ew=function(e){var t=gw(e);if(t<0)throw Sw("The argument can't be less than 0");return t},bw=RangeError,kw=function(e,t){var r=Ew(e);if(r%t)throw bw("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,Kw=eR,Xw=qA,qw=vw,Ww=ph,Yw=be,Jw=$r,Qw=yw,Zw=li,$w=iR,eC=kw,tC=yr,rC=Kt,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=Xh,fC=Pr,pC=ue,vC=kh,_C=Ln.get,mC=Ln.set,yC=Ln.enforce,gC=fC.f,SC=pC.f,EC=Math.round,bC=Gw.RangeError,kC=qw.ArrayBuffer,TC=kC.prototype,IC=qw.DataView,AC=Xw.NATIVE_ARRAY_BUFFER_VIEWS,RC=Xw.TYPED_ARRAY_TAG,wC=Xw.TypedArray,CC=Xw.TypedArrayPrototype,OC=Xw.aTypedArrayConstructor,xC=Xw.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=EC(i))<0?0:i>255?255:255&i),o.view[a](t*n+o.byteOffset,i,!0)}(this,t,e)},enumerable:!0})};AC?Kw&&(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 bC(NC);if((a=f-h)<0)throw bC(NC)}else if((a=Zw(i)*n)+h>f)throw bC(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,KC=fi,XC=r_,qC=Math.min,WC=[].copyWithin||function(e,t){var r=HC(this),n=KC(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]:XC(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,EO=qA.aTypedArray;(0,qA.exportTypedArrayMethod)("find",(function(e){return SO(EO(this),e,arguments.length>1?arguments[1]:void 0)}));var bO=Ra.findIndex,kO=qA.aTypedArray;(0,qA.exportTypedArrayMethod)("findIndex",(function(e){return bO(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,KO=sr("iterator"),XO=BO.Uint8Array,qO=GO(zO.values),WO=GO(zO.keys),YO=GO(zO.entries),JO=HO.aTypedArray,QO=HO.exportTypedArrayMethod,ZO=XO&&XO.prototype,$O=!jO((function(){ZO[KO].call([1])})),ex=!!ZO&&ZO.values&&ZO[KO]===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(KO,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 Ex=Ip.left,bx=qA.aTypedArray;(0,qA.exportTypedArrayMethod)("reduce",(function(e){var t=arguments.length;return Ex(bx(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,Kx=qA.aTypedArray;(0,qA.exportTypedArrayMethod)("slice",(function(e,t){for(var r=zx(Kx(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 Xx=Ra.some,qx=qA.aTypedArray;(0,qA.exportTypedArrayMethod)("some",(function(e){return Xx(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,ED=SD&&SD.prototype||{},bD=[].toString,kD=gD([].join);yD((function(){bD.call({})}))&&(bD=function(){return kD(this)});var TD=ED.toString!=bD;mD("toString",bD,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,KD=!!function(){try{new Int8Array(1).with(2,{valueOf:function(){throw 8}})}catch(y0){return 8===y0}}();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,!KD);var XD=ro,qD=Ra.findIndex,WD=ps,YD="findIndex",JD=!0;YD in[]&&Array(1).findIndex((function(){JD=!1})),XD({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 EN=ii,bN=As,kN=Be,TN=RangeError,IN=Re,AN=li,RN=As,wN=function(e){var t=bN(kN(this)),r="",n=EN(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(y0){FN(e,"throw",y0)}},zN=Pl,KN=Po,XN=fi,qN=lo,WN=ql,YN=Bl,JN=Array,QN=function(e){var t=GN(e),r=KN(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=XN(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=b(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(){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 yP="mozilla"===mP(),gP="safari"===mP(),SP=0,EP=!vP()&&(null===(aP=navigator.userAgent.match(/version\/(\d+)/i))||void 0===aP?void 0:aP[1]);gP&&EP&&(SP=+EP);var bP=SP,kP=!vP()&&!!/(iPhone|iPad|iPod)/i.exec(navigator.userAgent);!vP()&&/(iPhone|iPod)/i.exec(navigator.userAgent);var TP=!vP()&&(!!/(iPad)/i.exec(navigator.userAgent)||/Macintosh/i.test(navigator.userAgent)&&"ontouchend"in document),IP=!vP()&&/MicroMessenger/i.test(navigator.userAgent),AP=!vP()&&/Android/i.test(navigator.userAgent),RP=!vP()&&navigator.userAgent.toLowerCase().includes("mobile"),wP=!vP()&&/chrome\/(86)|(87)|(88)|(89)|(90)|(91)|(92)/i.test(navigator.userAgent);function CP(){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 OP=function(){return Math.floor(65535*Math.random())};function xP(e){return"string"==typeof e&&e.indexOf("__web__rtc__rtt__")>-1}function DP(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 NP=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)}}(),PP=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 MP(e){return+Math.max(-127,10*Math.log10(Math.pow(e/255,2))).toFixed(2)}function LP(e){return(e&U.AUDIO)===U.AUDIO}function UP(e){return(e&U.VIDEO)===U.VIDEO}function VP(e){var t={};return Object.keys(e).forEach((function(r){"object"===a(e[r])?t[r]=VP(e[r]):r.startsWith("_")||(t[r]=e[r])})),t}function FP(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 BP(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 jP(e,t){if("boolean"!=typeof e)throw new hN(dN.INVALID_PARAMS,"Invalid ".concat(t,": The value should be boolean type."))}function GP(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 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(null==e)throw new hN(dN.INVALID_PARAMS,"".concat(t," cannot be empty"));if(!YP(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 zP(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 XP(e,t){if(JP(e))throw new hN(dN.INVALID_PARAMS,"Invalid ".concat(t,", should not be empty"))}function qP(e,t){if(!(e instanceof ArrayBuffer))throw new hN(dN.INVALID_PARAMS,"Invalid ".concat(t,", should be ArrayBuffer"))}function WP(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 YP(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 JP(e){return null==e}function QP(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 ZP(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 $P(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 eM(e){XP(e,"userInfo"),ZP(e.userId),JP(e.extraInfo)||HP(e.extraInfo,"userInfo.extraInfo",1,200)}function tM(e){XP(e,"roomConfig"),jP(e.isAutoPublish,"roomConfig.isAutoPublish"),jP(e.isAutoSubscribeAudio,"roomConfig.isAutoSubscribeAudio"),jP(e.isAutoSubscribeVideo,"roomConfig.isAutoSubscribeVideo")}function rM(e){XP(e,"videoPlayerOption")}function nM(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 iM(e){return![oe.onRemoteStreamStats,oe.onLocalStreamStats,oe.onAudioVolumeIndication,oe.onLocalAudioPropertiesReport,oe.onRemoteAudioPropertiesReport].includes(e)}function oM(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 aM={},sM=sr;aM.f=sM;var cM=ce,uM=Kt,dM=aM,lM=Pr.f,hM=function(e){var t=cM.Symbol||(cM.Symbol={});uM(t,e)||lM(t,e,{value:dM.f(e)})},fM=ve,pM=et,vM=sr,_M=$n,mM=ro,yM=ce,gM=ve,SM=Re,EM=le,bM=ht,kM=de,TM=Kt,IM=tt,AM=Fr,RM=He,wM=yr,CM=As,OM=be,xM=cs,DM=Ga,NM=ei,PM=Jd,MM=wi,LM=ue,UM=Pr,VM=Fa,FM=_e,BM=$n,jM=Dt.exports,GM=bn,HM=Jt,zM=sr,KM=aM,XM=hM,qM=function(){var e=pM("Symbol"),t=e&&e.prototype,r=t&&t.valueOf,n=vM("toPrimitive");t&&!t[n]&&_M(t,n,(function(e){return fM(r,this)}),{arity:1})},WM=ed,YM=Ln,JM=Ra.forEach,QM=En("hidden"),ZM="Symbol",$M=YM.set,eL=YM.getterFor(ZM),tL=Object.prototype,rL=yM.Symbol,nL=rL&&rL.prototype,iL=yM.TypeError,oL=yM.QObject,aL=LM.f,sL=UM.f,cL=PM.f,uL=FM.f,dL=SM([].push),lL=jM("symbols"),hL=jM("op-symbols"),fL=jM("wks"),pL=!oL||!oL.prototype||!oL.prototype.findChild,vL=EM&&kM((function(){return 7!=xM(sL({},"a",{get:function(){return sL(this,"a",{value:7}).a}})).a}))?function(e,t,r){var n=aL(tL,t);n&&delete tL[t],sL(e,t,r),n&&e!==tL&&sL(tL,t,n)}:sL,_L=function(e,t){var r=lL[e]=xM(nL);return $M(r,{type:ZM,tag:e,description:t}),EM||(r.description=t),r},mL=function(e,t,r){e===tL&&mL(hL,t,r),AM(e);var n=wM(t);return AM(r),TM(lL,n)?(r.enumerable?(TM(e,QM)&&e[QM][n]&&(e[QM][n]=!1),r=xM(r,{enumerable:OM(0,!1)})):(TM(e,QM)||sL(e,QM,OM(1,{})),e[QM][n]=!0),vL(e,n,r)):sL(e,n,r)},yL=function(e,t){AM(e);var r=RM(t),n=DM(r).concat(bL(r));return JM(n,(function(t){EM&&!gM(gL,r,t)||mL(e,t,r[t])})),e},gL=function(e){var t=wM(e),r=gM(uL,this,t);return!(this===tL&&TM(lL,t)&&!TM(hL,t))&&(!(r||!TM(this,t)||!TM(lL,t)||TM(this,QM)&&this[QM][t])||r)},SL=function(e,t){var r=RM(e),n=wM(t);if(r!==tL||!TM(lL,n)||TM(hL,n)){var i=aL(r,n);return!i||!TM(lL,n)||TM(r,QM)&&r[QM][n]||(i.enumerable=!0),i}},EL=function(e){var t=cL(RM(e)),r=[];return JM(t,(function(e){TM(lL,e)||TM(GM,e)||dL(r,e)})),r},bL=function(e){var t=e===tL,r=cL(t?hL:RM(e)),n=[];return JM(r,(function(e){!TM(lL,e)||t&&!TM(tL,e)||dL(n,lL[e])})),n};bM||(rL=function(){if(IM(nL,this))throw iL("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?CM(arguments[0]):void 0,t=HM(e),r=function(e){this===tL&&gM(r,hL,e),TM(this,QM)&&TM(this[QM],t)&&(this[QM][t]=!1),vL(this,t,OM(1,e))};return EM&&pL&&vL(tL,t,{configurable:!0,set:r}),_L(t,e)},BM(nL=rL.prototype,"toString",(function(){return eL(this).tag})),BM(rL,"withoutSetter",(function(e){return _L(HM(e),e)})),FM.f=gL,UM.f=mL,VM.f=yL,LM.f=SL,NM.f=PM.f=EL,MM.f=bL,KM.f=function(e){return _L(zM(e),e)},EM&&(sL(nL,"description",{configurable:!0,get:function(){return eL(this).description}}),BM(tL,"propertyIsEnumerable",gL,{unsafe:!0}))),mM({global:!0,constructor:!0,wrap:!0,forced:!bM,sham:!bM},{Symbol:rL}),JM(DM(fL),(function(e){XM(e)})),mM({target:ZM,stat:!0,forced:!bM},{useSetter:function(){pL=!0},useSimple:function(){pL=!1}}),mM({target:"Object",stat:!0,forced:!bM,sham:!EM},{create:function(e,t){return void 0===t?xM(e):yL(xM(e),t)},defineProperty:mL,defineProperties:yL,getOwnPropertyDescriptor:SL}),mM({target:"Object",stat:!0,forced:!bM},{getOwnPropertyNames:EL}),qM(),WM(rL,ZM),GM[QM]=!0;var kL=ht&&!!Symbol.for&&!!Symbol.keyFor,TL=ro,IL=et,AL=Kt,RL=As,wL=Dt.exports,CL=kL,OL=wL("string-to-symbol-registry"),xL=wL("symbol-to-string-registry");TL({target:"Symbol",stat:!0,forced:!CL},{for:function(e){var t=RL(e);if(AL(OL,t))return OL[t];var r=IL("Symbol")(t);return OL[t]=r,xL[r]=t,r}});var DL=ro,NL=Kt,PL=yt,ML=St,LL=kL,UL=(0,Dt.exports)("symbol-to-string-registry");DL({target:"Symbol",stat:!0,forced:!LL},{keyFor:function(e){if(!PL(e))throw TypeError(ML(e)+" is not a symbol");if(NL(UL,e))return UL[e]}});var VL=wi,FL=Gt;ro({target:"Object",stat:!0,forced:!ht||de((function(){VL.f(1)}))},{getOwnPropertySymbols:function(e){var t=VL.f;return t?t(FL(e)):[]}});var BL={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}(BL);var jL=BL.exports,GL="@byted/ve-rtc",HL="@byted/ve-rtc-cache-size",zL=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(GL);try{localStorage.removeItem(HL)}catch(y0){}},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(HL);t?this.cachedSize=+t:this.values().then((function(t){e.cachedSize=e._getSize(t),e._setCachedSize()}))}catch(y0){}}},{key:"_setCachedSize",value:function(){try{localStorage.setItem(HL,"".concat(this.cachedSize))}catch(y0){}}},{key:"_getStore",value:function(e){if(this.db)return this.db.transaction(GL,e).objectStore(GL)}},{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 zL,XL="[VERTC]",qL=["#0050b3","#0050b3","#0050b3","#0050b3","#0050b3"],WL=!vP()&&window.location.search.includes("_rtc_debug_"),YL=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(XL,"[").concat(this._module,".").concat(e,"] ").concat(s," ").concat(a.map((function(e){return JSON.stringify(e)})).join(", ")))}catch(y0){}if(WL){for(var c="",u=0;u<this._indent;u++)c+=" ";(t=console).log.apply(t,["%c".concat(JL(),"-").concat(XL).concat(c,"[").concat(this._module,".").concat(e,"] ").concat(o),"color:".concat(qL[this._indent],";")].concat(n))}}}]),e}(),JL=function(){var e=new Date;return e.toTimeString().split(" ")[0]+":"+e.getMilliseconds()},QL=new YL("VERTC",0),ZL=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=E(p(r.prototype),"emit",this)).call.apply(n,[this,e].concat(o))}catch(y0){return QL.print("safaEmit","safeEmit() | event listener threw an error [event:%s]:%o",e,y0),console.error(y0),Boolean(t)}}}]),r}(BL.exports.EventEmitter),$L=Kt,eU=function(e){return void 0!==e&&($L(e,"value")||$L(e,"writable"))},tU=ve,rU=Je,nU=Fr,iU=eU,oU=ue,aU=Gu;ro({target:"Reflect",stat:!0},{get:function e(t,r){var n,i,o=arguments.length<3?t:arguments[2];return nU(t)===o?t[r]:(n=oU.f(t,r))?iU(n)?n.value:void 0===n.get?void 0:tU(n.get,o):rU(i=aU(t))?e(i,r,o):void 0}});var sU=ce,cU=ed;ro({global:!0},{Reflect:{}}),cU(sU.Reflect,"Reflect",!0);var uU=ve,dU=Fr,lU=Je,hU=eU,fU=Pr,pU=ue,vU=Gu,_U=be;ro({target:"Reflect",stat:!0,forced:de((function(){var e=function(){},t=fU.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=pU.f(dU(t),r);if(!c){if(lU(o=vU(t)))return e(o,r,n,s);c=_U(0)}if(hU(c)){if(!1===c.writable||!lU(s))return!1;if(i=pU.f(s,r)){if(i.get||i.set||!1===i.writable)return!1;i.value=n,fU.f(s,r,i)}else fU.f(s,r,_U(0,n))}else{if(void 0===(a=c.set))return!1;uU(a,s,n)}return!0}});var mU=ro,yU=Gt,gU=fi,SU=sv,EU=r_,bU=ao,kU=1!==[].unshift(0),TU=!function(){try{Object.defineProperty([],"length",{writable:!1}).unshift()}catch(y0){return y0 instanceof TypeError}}();mU({target:"Array",proto:!0,arity:1,forced:kU||TU},{unshift:function(e){var t=yU(this),r=gU(t),n=arguments.length;if(n){bU(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 SU(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 IU={};!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)}(IU);var AU={},RU={},wU={},CU=IU;function OU(e){for(var t=e.length;--t>=0;)e[t]=0}var xU=256,DU=286,NU=30,PU=15,MU=[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],LU=[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],UU=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],VU=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],FU=new Array(576);OU(FU);var BU=new Array(60);OU(BU);var jU=new Array(512);OU(jU);var GU=new Array(256);OU(GU);var HU=new Array(29);OU(HU);var zU,KU,XU,qU=new Array(NU);function WU(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 YU(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function JU(e){return e<256?jU[e]:jU[256+(e>>>7)]}function QU(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function ZU(e,t,r){e.bi_valid>16-r?(e.bi_buf|=t<<e.bi_valid&65535,QU(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 $U(e,t,r){ZU(e,r[2*t],r[2*t+1])}function eV(e,t){var r=0;do{r|=1&e,e>>>=1,r<<=1}while(--t>0);return r>>>1}function tV(e,t,r){var n,i,o=new Array(16),a=0;for(n=1;n<=PU;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]=eV(o[s]++,s))}}function rV(e){var t;for(t=0;t<DU;t++)e.dyn_ltree[2*t]=0;for(t=0;t<NU;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 nV(e){e.bi_valid>8?QU(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 iV(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 oV(e,t,r){for(var n=e.heap[r],i=r<<1;i<=e.heap_len&&(i<e.heap_len&&iV(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!iV(t,n,e.heap[i],e.depth));)e.heap[r]=e.heap[i],r=i,i<<=1;e.heap[r]=n}function aV(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?$U(e,i,t):($U(e,(o=GU[i])+xU+1,t),0!==(a=MU[o])&&ZU(e,i-=HU[o],a),$U(e,o=JU(--n),r),0!==(a=LU[o])&&ZU(e,n-=qU[o],a))}while(s<e.last_lit);$U(e,256,t)}function sV(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--)oV(e,o,r);i=c;do{r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],oV(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++,oV(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<=PU;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),tV(o,u,e.bl_count)}function cV(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 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),n=0;n<=r;n++)if(i=a,a=t[2*(n+1)+1],!(++s<c&&i===a)){if(s<u)do{$U(e,i,e.bl_tree)}while(0!=--s);else 0!==i?(i!==o&&($U(e,i,e.bl_tree),s--),$U(e,16,e.bl_tree),ZU(e,s-3,2)):s<=10?($U(e,17,e.bl_tree),ZU(e,s-3,3)):($U(e,18,e.bl_tree),ZU(e,s-11,7));s=0,o=i,0===a?(c=138,u=3):i===a?(c=6,u=3):(c=7,u=4)}}OU(qU);var dV=!1;function lV(e,t,r,n){ZU(e,0+(n?1:0),3),function(e,t,r,n){nV(e),n&&(QU(e,r),QU(e,~r)),CU.arraySet(e.pending_buf,e.window,t,r,e.pending),e.pending+=r}(e,t,r,!0)}wU._tr_init=function(e){dV||(!function(){var e,t,r,n,i,o=new Array(16);for(r=0,n=0;n<28;n++)for(HU[n]=r,e=0;e<1<<MU[n];e++)GU[r++]=n;for(GU[r-1]=n,i=0,n=0;n<16;n++)for(qU[n]=i,e=0;e<1<<LU[n];e++)jU[i++]=n;for(i>>=7;n<NU;n++)for(qU[n]=i<<7,e=0;e<1<<LU[n]-7;e++)jU[256+i++]=n;for(t=0;t<=PU;t++)o[t]=0;for(e=0;e<=143;)FU[2*e+1]=8,e++,o[8]++;for(;e<=255;)FU[2*e+1]=9,e++,o[9]++;for(;e<=279;)FU[2*e+1]=7,e++,o[7]++;for(;e<=287;)FU[2*e+1]=8,e++,o[8]++;for(tV(FU,287,o),e=0;e<NU;e++)BU[2*e+1]=5,BU[2*e]=eV(e,5);zU=new WU(FU,MU,257,DU,PU),KU=new WU(BU,LU,0,NU,PU),XU=new WU(new Array(0),UU,0,19,7)}(),dV=!0),e.l_desc=new YU(e.dyn_ltree,zU),e.d_desc=new YU(e.dyn_dtree,KU),e.bl_desc=new YU(e.bl_tree,XU),e.bi_buf=0,e.bi_valid=0,rV(e)},wU._tr_stored_block=lV,wU._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<xU;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0}(e)),sV(e,e.l_desc),sV(e,e.d_desc),a=function(e){var t;for(cV(e,e.dyn_ltree,e.l_desc.max_code),cV(e,e.dyn_dtree,e.d_desc.max_code),sV(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*VU[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?lV(e,t,r,n):4===e.strategy||o===i?(ZU(e,2+(n?1:0),3),aV(e,FU,BU)):(ZU(e,4+(n?1:0),3),function(e,t,r,n){var i;for(ZU(e,t-257,5),ZU(e,r-1,5),ZU(e,n-4,4),i=0;i<n;i++)ZU(e,e.bl_tree[2*VU[i]+1],3);uV(e,e.dyn_ltree,t-1),uV(e,e.dyn_dtree,r-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),aV(e,e.dyn_ltree,e.dyn_dtree)),rV(e),n&&nV(e)},wU._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*(GU[r]+xU+1)]++,e.dyn_dtree[2*JU(t)]++),e.last_lit===e.lit_bufsize-1},wU._tr_align=function(e){ZU(e,2,3),$U(e,256,FU),function(e){16===e.bi_valid?(QU(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 hV=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 fV=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 pV,vV=function(e,t,r,n){var i=fV,o=n+r;e^=-1;for(var a=n;a<o;a++)e=e>>>8^i[255&(e^t[a])];return-1^e},_V={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"},mV=IU,yV=wU,gV=hV,SV=vV,EV=_V,bV=-2,kV=258,TV=262,IV=103,AV=113,RV=666;function wV(e,t){return e.msg=EV[t],t}function CV(e){return(e<<1)-(e>4?9:0)}function OV(e){for(var t=e.length;--t>=0;)e[t]=0}function xV(e){var t=e.state,r=t.pending;r>e.avail_out&&(r=e.avail_out),0!==r&&(mV.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 DV(e,t){yV._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,xV(e.strm)}function NV(e,t){e.pending_buf[e.pending++]=t}function PV(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function MV(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-TV?e.strstart-(e.w_size-TV):0,u=e.window,d=e.w_mask,l=e.prev,h=e.strstart+kV,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=kV-(h-o),o=h-kV,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 LV(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-TV)){mV.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,mV.arraySet(s,a.input,a.next_in,d,c),1===a.state.wrap?a.adler=gV(a.adler,s,d,c):2===a.state.wrap&&(a.adler=SV(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<TV&&0!==e.strm.avail_in)}function UV(e,t){for(var r,n;;){if(e.lookahead<TV){if(LV(e),e.lookahead<TV&&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-TV&&(e.match_length=MV(e,r)),e.match_length>=3)if(n=yV._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=yV._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(n&&(DV(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,4===t?(DV(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(DV(e,!1),0===e.strm.avail_out)?1:2}function VV(e,t){for(var r,n,i;;){if(e.lookahead<TV){if(LV(e),e.lookahead<TV&&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-TV&&(e.match_length=MV(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=yV._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&&(DV(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if((n=yV._tr_tally(e,0,e.window[e.strstart-1]))&&DV(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=yV._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,4===t?(DV(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(DV(e,!1),0===e.strm.avail_out)?1:2}function FV(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 BV(){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 mV.Buf16(1146),this.dyn_dtree=new mV.Buf16(122),this.bl_tree=new mV.Buf16(78),OV(this.dyn_ltree),OV(this.dyn_dtree),OV(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new mV.Buf16(16),this.heap=new mV.Buf16(573),OV(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new mV.Buf16(573),OV(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 jV(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:AV,e.adler=2===t.wrap?0:1,t.last_flush=0,yV._tr_init(t),0):wV(e,bV)}function GV(e){var t,r=jV(e);return 0===r&&((t=e.state).window_size=2*t.w_size,OV(t.head),t.max_lazy_match=pV[t.level].max_lazy,t.good_match=pV[t.level].good_length,t.nice_match=pV[t.level].nice_length,t.max_chain_length=pV[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 HV(e,t,r,n,i,o){if(!e)return bV;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 wV(e,bV);8===n&&(n=9);var s=new BV;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 mV.Buf8(2*s.w_size),s.head=new mV.Buf16(s.hash_size),s.prev=new mV.Buf16(s.w_size),s.lit_bufsize=1<<i+6,s.pending_buf_size=4*s.lit_bufsize,s.pending_buf=new mV.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,GV(e)}pV=[new FV(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(LV(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,DV(e,!1),0===e.strm.avail_out))return 1;if(e.strstart-e.block_start>=e.w_size-TV&&(DV(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(DV(e,!0),0===e.strm.avail_out?3:4):(e.strstart>e.block_start&&(DV(e,!1),e.strm.avail_out),1)})),new FV(4,4,8,4,UV),new FV(4,5,16,8,UV),new FV(4,6,32,32,UV),new FV(4,4,16,16,VV),new FV(8,16,32,32,VV),new FV(8,16,128,128,VV),new FV(8,32,128,256,VV),new FV(32,128,258,1024,VV),new FV(32,258,258,4096,VV)],RU.deflateInit=function(e,t){return HV(e,t,8,15,8,0)},RU.deflateInit2=HV,RU.deflateReset=GV,RU.deflateResetKeep=jV,RU.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?bV:(e.state.gzhead=t,0):bV},RU.deflate=function(e,t){var r,n,i,o;if(!e||!e.state||t>5||t<0)return e?wV(e,bV):bV;if(n=e.state,!e.output||!e.input&&0!==e.avail_in||n.status===RV&&4!==t)return wV(e,0===e.avail_out?-5:bV);if(n.strm=e,r=n.last_flush,n.last_flush=t,42===n.status)if(2===n.wrap)e.adler=0,NV(n,31),NV(n,139),NV(n,8),n.gzhead?(NV(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)),NV(n,255&n.gzhead.time),NV(n,n.gzhead.time>>8&255),NV(n,n.gzhead.time>>16&255),NV(n,n.gzhead.time>>24&255),NV(n,9===n.level?2:n.strategy>=2||n.level<2?4:0),NV(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(NV(n,255&n.gzhead.extra.length),NV(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=SV(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(NV(n,0),NV(n,0),NV(n,0),NV(n,0),NV(n,0),NV(n,9===n.level?2:n.strategy>=2||n.level<2?4:0),NV(n,3),n.status=AV);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=AV,PV(n,a),0!==n.strstart&&(PV(n,e.adler>>>16),PV(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=SV(e.adler,n.pending_buf,n.pending-i,i)),xV(e),i=n.pending,n.pending!==n.pending_buf_size));)NV(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(e.adler=SV(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=SV(e.adler,n.pending_buf,n.pending-i,i)),xV(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,NV(n,o)}while(0!==o);n.gzhead.hcrc&&n.pending>i&&(e.adler=SV(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=SV(e.adler,n.pending_buf,n.pending-i,i)),xV(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,NV(n,o)}while(0!==o);n.gzhead.hcrc&&n.pending>i&&(e.adler=SV(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.status=IV)}else n.status=IV;if(n.status===IV&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&xV(e),n.pending+2<=n.pending_buf_size&&(NV(n,255&e.adler),NV(n,e.adler>>8&255),e.adler=0,n.status=AV)):n.status=AV),0!==n.pending){if(xV(e),0===e.avail_out)return n.last_flush=-1,0}else if(0===e.avail_in&&CV(t)<=CV(r)&&4!==t)return wV(e,-5);if(n.status===RV&&0!==e.avail_in)return wV(e,-5);if(0!==e.avail_in||0!==n.lookahead||0!==t&&n.status!==RV){var s=2===n.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(LV(e),0===e.lookahead)){if(0===t)return 1;break}if(e.match_length=0,r=yV._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(DV(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(DV(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(DV(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<=kV){if(LV(e),e.lookahead<=kV&&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+kV;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=kV-(o-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(r=yV._tr_tally(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=yV._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(DV(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(DV(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(DV(e,!1),0===e.strm.avail_out)?1:2}(n,t):pV[n.level].func(n,t);if(3!==s&&4!==s||(n.status=RV),1===s||3===s)return 0===e.avail_out&&(n.last_flush=-1),0;if(2===s&&(1===t?yV._tr_align(n):5!==t&&(yV._tr_stored_block(n,0,0,!1),3===t&&(OV(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),xV(e),0===e.avail_out))return n.last_flush=-1,0}return 4!==t?0:n.wrap<=0?1:(2===n.wrap?(NV(n,255&e.adler),NV(n,e.adler>>8&255),NV(n,e.adler>>16&255),NV(n,e.adler>>24&255),NV(n,255&e.total_in),NV(n,e.total_in>>8&255),NV(n,e.total_in>>16&255),NV(n,e.total_in>>24&255)):(PV(n,e.adler>>>16),PV(n,65535&e.adler)),xV(e),n.wrap>0&&(n.wrap=-n.wrap),0!==n.pending?0:1)},RU.deflateEnd=function(e){var t;return e&&e.state?42!==(t=e.state.status)&&69!==t&&73!==t&&91!==t&&t!==IV&&t!==AV&&t!==RV?wV(e,bV):(e.state=null,t===AV?wV(e,-3):0):bV},RU.deflateSetDictionary=function(e,t){var r,n,i,o,a,s,c,u,d=t.length;if(!e||!e.state)return bV;if(2===(o=(r=e.state).wrap)||1===o&&42!==r.status||r.lookahead)return bV;for(1===o&&(e.adler=gV(e.adler,t,d,0)),r.wrap=0,d>=r.w_size&&(0===o&&(OV(r.head),r.strstart=0,r.block_start=0,r.insert=0),u=new mV.Buf8(r.w_size),mV.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,LV(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,LV(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},RU.deflateInfo="pako deflate (from Nodeca project)";var zV={},KV=IU,XV=!0,qV=!0;try{String.fromCharCode.apply(null,[0])}catch(g0){XV=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(g0){qV=!1}for(var WV=new KV.Buf8(256),YV=0;YV<256;YV++)WV[YV]=YV>=252?6:YV>=248?5:YV>=240?4:YV>=224?3:YV>=192?2:1;function JV(e,t){if(t<65534&&(e.subarray&&qV||!e.subarray&&XV))return String.fromCharCode.apply(null,KV.shrinkBuf(e,t));for(var r="",n=0;n<t;n++)r+=String.fromCharCode(e[n]);return r}WV[254]=WV[254]=1,zV.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},zV.buf2binstring=function(e){return JV(e,e.length)},zV.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},zV.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=WV[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 JV(s,n)},zV.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+WV[e[r]]>t?r:t};var QV=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},ZV=RU,$V=IU,eF=zV,tF=_V,rF=QV,nF=Object.prototype.toString;function iF(e){if(!(this instanceof iF))return new iF(e);this.options=$V.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 rF,this.strm.avail_out=0;var r=ZV.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(0!==r)throw new Error(tF[r]);if(t.header&&ZV.deflateSetHeader(this.strm,t.header),t.dictionary){var n;if(n="string"==typeof t.dictionary?eF.string2buf(t.dictionary):"[object ArrayBuffer]"===nF.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,0!==(r=ZV.deflateSetDictionary(this.strm,n)))throw new Error(tF[r]);this._dict_set=!0}}function oF(e,t){var r=new iF(t);if(r.push(e,!0),r.err)throw r.msg||tF[r.err];return r.result}iF.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=eF.string2buf(e):"[object ArrayBuffer]"===nF.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 $V.Buf8(o),i.next_out=0,i.avail_out=o),1!==(r=ZV.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(eF.buf2binstring($V.shrinkBuf(i.output,i.next_out))):this.onData($V.shrinkBuf(i.output,i.next_out)))}while((i.avail_in>0||0===i.avail_out)&&1!==r);return 4===n?(r=ZV.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,0===r):2!==n||(this.onEnd(0),i.avail_out=0,!0)},iF.prototype.onData=function(e){this.chunks.push(e)},iF.prototype.onEnd=function(e){0===e&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=$V.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},AU.Deflate=iF,AU.deflate=oF,AU.deflateRaw=function(e,t){return(t=t||{}).raw=!0,oF(e,t)},AU.gzip=function(e,t){return(t=t||{}).gzip=!0,oF(e,t)};var aF={},sF=le,cF=Og,uF=Vs,dF=de,lF=ce.RegExp,hF=lF.prototype;sF&&dF((function(){var e=!0;try{lF(".","d")}catch(y0){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(hF,"flags").get.call(t)!==n||r!==n}))&&cF(hF,"flags",{configurable:!0,get:uF});var fF={},pF=IU,vF=15,_F=[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],mF=[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],yF=[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],gF=[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],SF=IU,EF=hV,bF=vV,kF=function(e,t){var r,n,i,o,a,s,c,u,d,l,h,f,p,v,_,m,y,g,S,E,b,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}E=65535&g,(S&=15)&&(p<S&&(f+=I[n++]<<p,p+=8),E+=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(b=65535&g,p<(S&=15)&&(f+=I[n++]<<p,(p+=8)<S&&(f+=I[n++]<<p,p+=8)),(b+=f&(1<<S)-1)>c){e.msg="invalid distance too far back",r.mode=30;break e}if(f>>>=S,p-=S,b>(S=o-a)){if((S=b-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<E){E-=S;do{A[o++]=h[k++]}while(--S);k=o-b,T=A}}else if(l<S){if(k+=u+l-S,(S-=l)<E){E-=S;do{A[o++]=h[k++]}while(--S);if(k=0,l<E){E-=S=l;do{A[o++]=h[k++]}while(--S);k=o-b,T=A}}}else if(k+=l-S,S<E){E-=S;do{A[o++]=h[k++]}while(--S);k=o-b,T=A}for(;E>2;)A[o++]=T[k++],A[o++]=T[k++],A[o++]=T[k++],E-=3;E&&(A[o++]=T[k++],E>1&&(A[o++]=T[k++]))}else{k=o-b;do{A[o++]=A[k++],A[o++]=A[k++],A[o++]=A[k++],E-=3}while(E>2);E&&(A[o++]=A[k++],E>1&&(A[o++]=A[k++]))}break}}break}}while(n<i&&o<s);n-=E=p>>3,f&=(1<<(p-=E<<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},TF=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,E=0,b=0,k=0,T=0,I=0,A=0,R=0,w=null,C=0,O=new pF.Buf16(16),x=new pF.Buf16(16),D=null,N=0;for(y=0;y<=vF;y++)O[y]=0;for(g=0;g<n;g++)O[t[r+g]]++;for(b=m,E=vF;E>=1&&0===O[E];E--);if(b>E&&(b=E),0===E)return i[o++]=20971520,i[o++]=20971520,s.bits=1,0;for(S=1;S<E&&0===O[S];S++);for(b<S&&(b=S),I=1,y=1;y<=vF;y++)if(I<<=1,(I-=O[y])<0)return-1;if(I>0&&(0===e||1!==E))return-1;for(x[1]=0,y=1;y<vF;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=_F,C-=257,D=mF,N-=257,f=256):(w=yF,D=gF,f=-1),R=0,g=0,y=S,h=o,k=b,T=0,d=-1,l=(A=1<<b)-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===E)break;y=t[r+a[g]]}if(y>b&&(R&l)!==d){for(0===T&&(T=b),h+=S,I=1<<(k=y-T);k+T<E&&!((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]=b<<24|k<<16|h-o|0}}return 0!==R&&(i[h+R]=y-T<<24|64<<16|0),s.bits=b,0},IF=-2,AF=12,RF=30;function wF(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function CF(){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 SF.Buf16(320),this.work=new SF.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function OF(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 SF.Buf32(852),t.distcode=t.distdyn=new SF.Buf32(592),t.sane=1,t.back=-1,0):IF}function xF(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,OF(e)):IF}function DF(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)?IF:(null!==n.window&&n.wbits!==t&&(n.window=null),n.wrap=r,n.wbits=t,xF(e))):IF}function NF(e,t){var r,n;return e?(n=new CF,e.state=n,n.window=null,0!==(r=DF(e,t))&&(e.state=null),r):IF}var PF,MF,LF=!0;function UF(e){if(LF){var t;for(PF=new SF.Buf32(512),MF=new SF.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(TF(1,e.lens,0,288,PF,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;TF(2,e.lens,0,32,MF,0,e.work,{bits:5}),LF=!1}e.lencode=PF,e.lenbits=9,e.distcode=MF,e.distbits=5}function VF(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 SF.Buf8(o.wsize)),n>=o.wsize?(SF.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),SF.arraySet(o.window,t,r-n,i,o.wnext),(n-=i)?(SF.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}fF.inflateReset=xF,fF.inflateReset2=DF,fF.inflateResetKeep=OF,fF.inflateInit=function(e){return NF(e,15)},fF.inflateInit2=NF,fF.inflate=function(e,t){var r,n,i,o,a,s,c,u,d,l,h,f,p,v,_,m,y,g,S,E,b,k,T,I,A=0,R=new SF.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 IF;(r=e.state).mode===AF&&(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=bF(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=RF;break}if(8!=(15&u)){e.msg="unknown compression method",r.mode=RF;break}if(d-=4,b=8+(15&(u>>>=4)),0===r.wbits)r.wbits=b;else if(b>r.wbits){e.msg="invalid window size",r.mode=RF;break}r.dmax=1<<b,e.adler=r.check=1,r.mode=512&u?10:AF,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=RF;break}if(57344&r.flags){e.msg="unknown header flags set",r.mode=RF;break}r.head&&(r.head.text=u>>8&1),512&r.flags&&(R[0]=255&u,R[1]=u>>>8&255,r.check=bF(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=bF(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=bF(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=bF(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&&(b=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),SF.arraySet(r.head.extra,n,o,f,b)),512&r.flags&&(r.check=bF(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{b=n[o+f++],r.head&&b&&r.length<65536&&(r.head.name+=String.fromCharCode(b))}while(b&&f<s);if(512&r.flags&&(r.check=bF(r.check,n,f,o)),s-=f,o+=f,b)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{b=n[o+f++],r.head&&b&&r.length<65536&&(r.head.comment+=String.fromCharCode(b))}while(b&&f<s);if(512&r.flags&&(r.check=bF(r.check,n,f,o)),s-=f,o+=f,b)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=RF;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=AF;break;case 10:for(;d<32;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}e.adler=r.check=wF(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=AF;case AF: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(UF(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=RF}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=RF;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;SF.arraySet(i,n,o,f,a),s-=f,o+=f,c-=f,a+=f,r.length-=f;break}r.mode=AF;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=RF;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=TF(0,r.lens,0,19,r.lencode,0,r.work,T),r.lenbits=T.bits,k){e.msg="invalid code lengths set",r.mode=RF;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=RF;break}b=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-=_,b=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-=_,b=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=RF;break}for(;f--;)r.lens[r.have++]=b}}if(r.mode===RF)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=RF;break}if(r.lenbits=9,T={bits:r.lenbits},k=TF(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=RF;break}if(r.distbits=6,r.distcode=r.distdyn,T={bits:r.distbits},k=TF(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=RF;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,kF(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===AF&&(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,E=y;m=(A=r.lencode[E+((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=AF;break}if(64&m){e.msg="invalid literal/length code",r.mode=RF;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,E=y;m=(A=r.distcode[E+((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=RF;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=RF;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=RF;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?bF(r.check,i,h,a-h):EF(r.check,i,h,a-h)),h=c,(r.flags?u:wF(u))!==r.check){e.msg="incorrect data check",r.mode=RF;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=RF;break}u=0,d=0}r.mode=29;case 29:k=1;break e;case RF:k=-3;break e;case 31:return-4;default:return IF}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<RF&&(r.mode<27||4!==t))&&VF(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?bF(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===AF?128:0)+(20===r.mode||15===r.mode?256:0),(0===l&&0===h||4===t)&&0===k&&(k=-5),k},fF.inflateEnd=function(e){if(!e||!e.state)return IF;var t=e.state;return t.window&&(t.window=null),e.state=null,0},fF.inflateGetHeader=function(e,t){var r;return e&&e.state?0==(2&(r=e.state).wrap)?IF:(r.head=t,t.done=!1,0):IF},fF.inflateSetDictionary=function(e,t){var r,n=t.length;return e&&e.state?0!==(r=e.state).wrap&&11!==r.mode?IF:11===r.mode&&EF(1,t,n,0)!==r.check?-3:VF(e,t,n,n)?(r.mode=31,-4):(r.havedict=1,0):IF},fF.inflateInfo="pako inflate (from Nodeca project)";var FF={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 BF=fF,jF=IU,GF=zV,HF=FF,zF=_V,KF=QV,XF=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},qF=Object.prototype.toString;function WF(e){if(!(this instanceof WF))return new WF(e);this.options=jF.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=BF.inflateInit2(this.strm,t.windowBits);if(r!==HF.Z_OK)throw new Error(zF[r]);if(this.header=new XF,BF.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=GF.string2buf(t.dictionary):"[object ArrayBuffer]"===qF.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(r=BF.inflateSetDictionary(this.strm,t.dictionary))!==HF.Z_OK))throw new Error(zF[r])}function YF(e,t){var r=new WF(t);if(r.push(e,!0),r.err)throw r.msg||zF[r.err];return r.result}WF.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?HF.Z_FINISH:HF.Z_NO_FLUSH,"string"==typeof e?s.input=GF.binstring2buf(e):"[object ArrayBuffer]"===qF.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 jF.Buf8(c),s.next_out=0,s.avail_out=c),(r=BF.inflate(s,HF.Z_NO_FLUSH))===HF.Z_NEED_DICT&&u&&(r=BF.inflateSetDictionary(this.strm,u)),r===HF.Z_BUF_ERROR&&!0===d&&(r=HF.Z_OK,d=!1),r!==HF.Z_STREAM_END&&r!==HF.Z_OK)return this.onEnd(r),this.ended=!0,!1;s.next_out&&(0!==s.avail_out&&r!==HF.Z_STREAM_END&&(0!==s.avail_in||n!==HF.Z_FINISH&&n!==HF.Z_SYNC_FLUSH)||("string"===this.options.to?(i=GF.utf8border(s.output,s.next_out),o=s.next_out-i,a=GF.buf2string(s.output,i),s.next_out=o,s.avail_out=c-o,o&&jF.arraySet(s.output,s.output,i,o,0),this.onData(a)):this.onData(jF.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!==HF.Z_STREAM_END);return r===HF.Z_STREAM_END&&(n=HF.Z_FINISH),n===HF.Z_FINISH?(r=BF.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===HF.Z_OK):n!==HF.Z_SYNC_FLUSH||(this.onEnd(HF.Z_OK),s.avail_out=0,!0)},WF.prototype.onData=function(e){this.chunks.push(e)},WF.prototype.onEnd=function(e){e===HF.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=jF.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},aF.Inflate=WF,aF.inflate=YF,aF.inflateRaw=function(e,t){return(t=t||{}).raw=!0,YF(e,t)},aF.ungzip=YF;var JF={};(0,IU.assign)(JF,AU,aF,FF);var QF=JF,ZF=function(e){return e.RTC="rtc",e}(ZF||{}),$F=function(e){return e.W_5="5",e}($F||{}),eB=function(e){return e.IOS="ios",e.ANDROID="android",e.WEB="web",e.WINDOWS="windows",e.MAC="mac",e.LINUX="linux",e}(eB||{}),tB=function(e){return e.REQUEST="request",e.RESPONSE="response",e}(tB||{}),rB=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}(rB||{}),nB=function(e){return e.WEBSOCKET="websocket",e.NETWORKCHANGED="networkChanged",e.PEERCONNECTION="peerconnection",e}(nB||{}),iB=function(e){return e.WEBSOCKET_RECONNECTED="websocket reconnected",e.PEERCONNECTION_RECONNECTED="peerconnection reconnected",e}(iB||{}),oB=function(e){return e.WEBSOCKET="websocket",e.NETWORKCHANGED="networkChanged",e.PEERCONNECTION="peerconnection",e}(oB||{}),aB=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}(aB||{}),sB=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}(sB||{}),cB=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}(cB||{}),uB=function(e){return e.UP="up",e.DOWN="down",e.DIRECT="direct",e}(uB||{}),dB=function(e){return e.UP="up",e.DOWN="down",e.PRE="pre",e}(dB||{}),lB=function(e){return e.UP="up",e.DOWN="down",e.PRE="pre",e}(lB||{}),hB=function(e){return e.W_0="0",e.W_1="1",e}(hB||{}),fB=function(e){return e.UP="up",e.DOWN="down",e}(fB||{}),pB=function(e){return e.ANSWER="answer",e.INCRANSWER="incranswer",e}(pB||{}),vB=function(e){return e.UP="up",e.DOWN="down",e}(vB||{}),_B=function(e){return e.SUCCESS="success",e.FAIL="fail",e}(_B||{}),mB=function(e){return e.W_0="0",e.W_1="1",e}(mB||{}),yB=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}(yB||{}),gB=function(e){return e.SUCCESS="success",e.FAIL="fail",e.IGNORE="ignore",e}(gB||{}),SB=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}(SB||{}),EB=function(e){return e.PLAYOUT_DEVICE_SWITCH="playout_device_switch",e.RECORD_DEVICE_SWITCH="record_device_switch",e.UNKNOWN="unknown",e}(EB||{}),bB=function(e){return e.BEGIN_SEND="begin_send",e.SENT_END="sent_end",e.BEGIN_RECV="begin_recv",e.RECV_END="recv_end",e}(bB||{}),kB=function(e){return e.AUDIO="audio",e.VIDEO="video",e.SCREEN_VIDEO="screen_video",e.SCREEN_AUDIO="screen_audio",e}(kB||{}),TB=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}(TB||{}),IB=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}(IB||{}),AB=function(e){return e.BEGIN="begin",e.END="end",e}(AB||{}),RB=function(e){return e.BEGIN="begin",e.END="end",e}(RB||{}),wB=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}(wB||{}),CB=function(e){return e.P2P="p2p",e.P2P_OUTSIDE_ROOM="p2p_outside_room",e.P2SERVER="p2server",e}(CB||{}),OB=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}(OB||{}),xB=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}(xB||{}),DB=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}(),NB=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 DB(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(y0){}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=nj.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=QF.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,E=t.common_extra_info,b=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:E,had_selected_p2p:b,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}(ZL),PB=new NB,MB=new NB,LB=new NB,UB=PB.commonStats,VB=MB.commonStats,FB=LB.commonStats;function BB(e){UB.setStats({app_sate:e}),VB.setStats({app_sate:e}),FB.setStats({app_sate:e})}!vP()&&(BB("active"),document.addEventListener("visibilitychange",(function(){"visible"===document.visibilityState?BB("active"):"hidden"===document.visibilityState&&BB("background")})));var jB={default:PB,rtm:MB,outsideRoom:LB};function GB(){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&&UB.setStats({room_id:i[1]}),jB[e].rtcSdkApiCall(n,0,JSON.stringify(DP(i)),s);var c=o.apply(this,i);return"function"==typeof(null==c?void 0:c.then)?c.then((function(t){return jB[e].rtcSdkCallback(n,0,JSON.stringify(DP([t||{}]))),t})).catch((function(t){throw jB[e].rtcSdkCallback(n,t.code,JSON.stringify(t.message)),t})):(jB[e].rtcSdkCallback(n,0,JSON.stringify(DP([c||{}]))),c)}}}}function HB(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=e===oe.onUserMessageReceivedOutsideRoom||e===oe.onUserBinaryMessageReceivedOutsideRoom;(n?MB:PB).rtcSdkCallback(e,r,JSON.stringify(t))}function zB(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?MB:PB).rtcInvokeStatus(JSON.stringify(t),r,e,"",0)}var KB="BytePlus",XB="RTC_DEVICE_ID",qB="RTC_ACCESS_NODE",WB="RTC_ACCESS_URLS",YB="engine_BAC",JB=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}(),QB=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(XB);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[UB,VB,FB].forEach((function(t){return t.setStats({device_id:e})})),this.set(XB,e),e}},{key:"getAccessNode",value:function(e){return this.get("".concat(qB,"_").concat(e,"-").concat(KB))}},{key:"setAccessNode",value:function(e,t,r){return this.set("".concat(qB,"_").concat(e,"-").concat(KB),t,1e3*r)}},{key:"clearAccessNode",value:function(e){this.delete("".concat(qB,"_").concat(e,"-").concat(KB))}},{key:"getAccessUrls",value:function(){return this.get("".concat(WB,"-").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(WB,"-").concat(KB),t)}},{key:"clearAccessUrls",value:function(){this.delete("".concat(WB,"-").concat(KB))}},{key:"getAudioProfile",value:function(){return this.get(YB)}},{key:"setAudioProfile",value:function(e){return this.set(YB,e)}}]),r}(JB),ZB=new QB,$B="rtc-access.rtcplus.com,rtc-access-sg.rtcplus.com,rtc-access-va.rtcplus.com,rtc-access-fr.rtcplus.com".split(",");function ej(){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 tj="https://web-log-report.rtcplus.com/video/v1/webrtc_log/",rj="rtc.rtcplus.com".split(","),nj={VERSION:"4.49.5",ICE_CONFIG_REQUEST_URLS_INTERNAL:$B.map(ej),ICE_CONFIG_REQUEST_URLS:[],EXPECTED_ADDR:"",LOG_SERVER_URL:tj,CONFIG_REQUEST_DOMAINS:rj,DEVICE_ID:"",OVERSEA:!1,PLATFORM:"",PRODUCT:""};function ij(e,t){if(PB.rtcSdkApiCall("setParameter",0,"key: ".concat(e,", value: ").concat(t)),"VERSION"!==e){if("ICE_CONFIG_REQUEST_URLS"===e)return"string"==typeof t&&(t=[t]),void(nj.ICE_CONFIG_REQUEST_URLS=t.map(ej));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 UB.setStats({overSea:t?"1":"0"}),void(nj.OVERSEA=t);"DEVICE_ID"===e&&ZB.setDeviceId(t),nj[e]=t}else nj.LOG_SERVER_URL=t;else nj.LOG_SERVER_URL=tj;else nj.LOG_SERVER_URL="https://web-log-report.rtcplus.com/video/v1/webrtc_log/";else UB.setStats({product:t});else UB.setStats({platform:t})}}function oj(e){return"DEVICE_ID"===e?ZB.getDeviceId():nj[e]}function aj(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 sj,cj={width:640,height:360,frameRate:15,maxKbps:600},uj={width:1920,height:1080,frameRate:15,maxKbps:3e3},dj=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}(dj||{}),lj=function(e){return e.PushLimitWarn="PushLimitWarn",e}(lj||{}),hj=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}(hj||{}),fj=function(e){return e.RSCP="RSCP",e.RTT="RTT",e}(fj||{}),pj=function(e){return e.ON_CONNECTION_STATE_CHANGE="onConnectionStateChange",e.ABNORMAL_DISCONNECTION="normalConnection",e}(pj||{}),vj=function(e){return e.userLeave="userLeave",e.connectionLost="connectionLost",e.userDuplicateLogin="userDuplicateLogin",e.kickedByAdmin="kickedByAdmin",e.roleChanged="roleChanged",e.onUserTokenDidExpire="onUserTokenDidExpire",e}(vj||{}),_j=function(e){return e[e.roomDismissByAdmin=2]="roomDismissByAdmin",e}(_j||{}),mj=function(e){return e[e.SEND=0]="SEND",e[e.FEEDBACK=1]="FEEDBACK",e}(mj||{}),yj=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}(yj||{}),gj=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}(gj||{}),Sj=(h(sj={},0,[0,"success"]),h(sj,1,[dN.USER_MESSAGE_TIMEOUT,"timeout, failed to send."]),h(sj,2,[dN.USER_MESSAGE_BROKEN,"dataChannel broken, failed to send."]),h(sj,3,[dN.USER_MESSAGE_NO_RECEIVER,"cannot find the receiver."]),h(sj,4,[dN.USER_MESSAGE_NO_RELAYPATH,"cannot find relay path."]),h(sj,17,[dN.USER_MESSAGE_SEND_TO_SERVER_ERROR,"failed to send to business server."]),h(sj,18,[dN.USER_MESSAGE_SERVER_RESPONSE_ERROR,"business server response error."]),h(sj,100,[dN.USER_MESSAGE_NOT_JOIN,"not join room"]),h(sj,101,[dN.USER_MESSAGE_INIT,"not init."]),h(sj,102,[dN.USER_MESSAGE_NO_CONNECTION,"no connection."]),h(sj,105,[dN.USER_MESSAGE_NOT_LOGIN,"not login."]),h(sj,106,[dN.USER_MESSAGE_SERVER_PARAMS_NOTSET,"server param is not set."]),h(sj,1e3,[dN.USER_MESSAGE_UNKNOWN,"unknown."]),sj),Ej=["msg"],bj=new YL("DataChannelSignaling",3),kj=["onSpeakerChange"],Tj=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}(Tj||{}),Ij=6e4,Aj=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 PB.rtcSignaling(0,JSON.stringify(t),"call-".concat(e),"Send",t.streamId,t.streamUserId,uB.UP),new Promise((function(i,o){var a=n._genHeader(r);a.id=CP();var s=a.id.join("-"),c=setTimeout((function(){n._singlingCache.delete(s),o(new hN(dN.TIME_OUT,"".concat(e," message time out")))}),Ij);n._singlingCache.set(s,{signalingType:e,success:function(e){clearTimeout(c),i(e)},error:function(e){clearTimeout(c),o(e)}}),bj.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,Ej),s=n instanceof ArrayBuffer,e.t0=this,e.t1=i,e.t2=i({ver:1,id:this._p2pMessageId++,time:Date.now(),dir:mj.SEND,type:yj.P2P,err:gj.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 xP(e.msg)?this._rttIds[e.id]=e.id:e.dir===mj.SEND&&bj.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:CP()}));if(e.dir===mj.SEND){var s=setTimeout((function(){t._p2pCache.delete(e.id),o(new hN(dN.TIME_OUT,"P2P message timeout"))}),Ij);t._p2pCache.set(e.id,{success:function(e,t){clearTimeout(s),n(t)},error:function(e){clearTimeout(s);var t=b(Sj[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}))});kj.includes(t)||bj.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,E,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 QF.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&&PB.rtcSignalingMsgError(-1,e.t0.message,cB.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],kj.includes(_)||bj.print("Signal","<<<<<< ".concat(_),p,v),this._feedbackSignaling(v,_,_===hj.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)),PB.rtcSignaling(0,f,"on-".concat(_),"Recv",p.streamId,p.clientId,uB.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)===mj.FEEDBACK||xP(null===(s=p)||void 0===s?void 0:s.msg)?delete this._rttIds[m]:bj.print("Signal","<<<<<< p2p response",p),e.t2=p.dir,e.next=e.t2===mj.SEND?40:e.t2===mj.FEEDBACK?78:81;break;case 40:if(xP(null===(c=p)||void 0===c?void 0:c.msg)){e.next=76;break}if(g=(y=p).binary,S=y.msg,E=y.room,k=y.to,T=y.from,I=""===E?g?hj.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM:hj.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM:g?hj.USER_BINARY_MESSAGE_RECEIVED:hj.USER_MESSAGE_RECEIVED,k){e.next=60;break}if(e.t3=this,e.t4=hj.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:mj.FEEDBACK,msg:""})),e.abrupt("break",82);case 78:return(A=this._p2pCache.get(p.id))&&(this._p2pCache.delete(p.id),p.err===gj.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=b(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,PB.rtcSignaling(0,f,"on-".concat(N),"Recv","","",uB.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){bj.print("_handleHandler","dataChannel close",t),e.emit("close",t)},r=function(t){bj.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),bj.print("Signal","<<<<<< [".concat(n.signalingType,"-ack] ").concat(e),t)),PB.rtcSignaling(0,r,null==n?void 0:n.signalingType,"Ack","","",uB.DOWN)}}]),a}(BL.exports.EventEmitter),Rj=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=b(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})}},a.onabort=function(){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}(),wj=new YL("ICE Request",3),Cj=function(){function e(){u(this,e),h(this,"_request",void 0),this._request=new Rj}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=ZB.getAccessNode(t))){e.next=9;break}if(this.getAccessNodeFromServer(t,r,n,i,a,s,c,u),zB("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=ZB.getAccessUrls(),f=!0,zB("es.R.req.cache.urls",h),(null===(d=h)||void 0===d?void 0:d.length)>0||(h=nj.ICE_CONFIG_REQUEST_URLS,f=!1,zB("es.R.req.external.urls",h)),(null===(l=h)||void 0===l?void 0:l.length)>0||(h=nj.ICE_CONFIG_REQUEST_URLS_INTERNAL,f=!1,zB("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 ZB.setAccessNode(t,r,e.ttl||11200),e.dispatchDomains&&ZB.setAccessUrls(e.dispatchDomains),r})).catch((function(e){if(f)return zB("es.R.req.fallback",""),ZB.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:nj.VERSION,isOversea:nj.OVERSEA,expectedAddr:oj("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(),PB.rtcGetAccess(0,JSON.stringify(h),0,aB.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",PP(v).then((function(e){var r=e.result;e.firstNode;var n=e.index;return PB.rtcGetAccess(200,JSON.stringify(r),Date.now()-p,aB.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 PB.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,aB.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&&(wj.print("abort","HTTP Request of [getICEConfigFromServer] abort"),this._request.abort())}}]),e}(),Oj=function(){function e(){u(this,e),h(this,"_request",void 0),this._request=new Rj}return l(e,[{key:"getAudioProfile",value:function(){var e=this,t={keys:["engine_BAC"],labelSelector:"",sdkVersion:"4.49.5",deviceType:"web"},r=nj.CONFIG_REQUEST_DOMAINS.map((function(e){return"https://".concat(e,"/decision/v1/multi")}));PB.rtcGetConfig(0,JSON.stringify(t),0,r.join(","),tB.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){PP(n).then((function(t){var n=t.result,i=t.index;ZB.setAudioProfile(n.engine_BAC),PB.rtcGetConfig(200,JSON.stringify(n),0,r[i],tB.RESPONSE,"",!1),e(n.engine_BAC)})).catch((function(t){PB.rtcGetConfig(500,t.message,0,"",tB.RESPONSE,"",!1),e(ZB.getAudioProfile()||[])}))}))}}]),e}();function xj(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 Dj=[{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 Nj={width:160,height:90,frameRate:15,maxkbps:100},Pj={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 Mj=new Map,Lj=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"===mP()&&void 0===window.InstallTrigger)try{t.getStats((function(t){var r=[];t.result().forEach((function(e){if(!jj.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(y0){r(y0)}else e({all:[],getTrackStats:function(){return[]}})})));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),Uj=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(Bj.codec))||void 0===r||r.forEach((function(e){e.id===u&&t.add(e)})),null===(n=s.get(Bj.transport))||void 0===n||n.forEach((function(e){e.id===d&&(a=e,t.add(e))})),null===(i=s.get(Bj.track))||void 0===i||i.forEach((function(e){e.id===l&&t.add(e)})),null===(o=s.get(Bj.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(Bj.certificate))||void 0===f||f.forEach((function(e){(e.id===_||e.id===m)&&t.add(e)})),null===(p=s.get(Bj.candidatePair))||void 0===p||p.forEach((function(e){e.id===y&&(c=e,t.add(e))}))}if(c){var g,S,E=c,b=E.localCandidateId,k=E.remoteCandidateId;null===(g=s.get(Bj.localCandidate))||void 0===g||g.forEach((function(e){e.id===b&&t.add(e)})),null===(S=s.get(Bj.remoteCandidate))||void 0===S||S.forEach((function(e){e.id===k&&t.add(e)}))}}))},null===(r=s.get(Bj.mediaSource))||void 0===r||r.forEach((function(e){var t,r=new Set;r.add(e);var n=[];null===(t=s.get(Bj.outboundRtp))||void 0===t||t.forEach((function(t){var i;t.mediaSourceId===e.id&&(r.add(t),n.push(t),null===(i=s.get(Bj.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(Bj.inboundRtp))||void 0===n||n.forEach((function(e){var t,r=new Set;r.add(e),null===(t=s.get(Bj.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(Bj.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)}}(),Vj=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(!yP&&!gP){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=Mj.get(t))||Date.now()-s.timestamp>150)&&(s={timestamp:Date.now(),statsPromise:Uj(t),extraStatsPromise:Lj(t)},Mj.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)}}();mP();var Fj,Bj=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}(Bj||{}),jj=["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"],Gj=new YL("isSupported",0),Hj=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,zj();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)}}(),zj=function(){var e=c(o().mark((function e(){var t,r,n,i,a,s,c;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Gj.print("internalGetSupportedCodecs()","Invoke, cachedSupportedCodecs: %o",Fj),!Fj){e.next=3;break}return e.abrupt("return",Fj);case 3:if(t=[],e.prev=4,!navigator.userAgent.includes("VivoBrowser")){e.next=8;break}return e.next=8,NP();case 8:return e.next=10,NP();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 Gj.print("internalGetSupportedCodecs()","".concat(t?"includes":"not found",": ").concat(e)),t}))){for(n=navigator.userAgent.toLowerCase(),i=!1,a=0,s=["heytapbrowser","mqqbrowser","miuibrowser"];a<s.length;a++)c=s[a],n.includes(c)&&(i=!0);!i&&t.push("H264")}else Gj.print("internalGetSupportedCodecs()","sdp: %s",r);return null!=r&&r.includes("VP8")&&t.push("vp8"),Fj=t,e.abrupt("return",t);case 20:return e.prev=20,e.t0=e.catch(4),e.abrupt("return",t);case 23:case"end":return e.stop()}}),e,null,[[4,20]])})));return function(){return e.apply(this,arguments)}}(),Kj=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,zj();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)}}(),Xj=function(){return"undefined"!=typeof TransformStream&&"undefined"!=typeof RTCRtpSender&&"undefined"!=typeof RTCRtpReceiver&&void 0!==RTCRtpSender.prototype.createEncodedStreams&&void 0!==RTCRtpReceiver.prototype.createEncodedStreams},qj={},Wj=Uf,Yj=ve,Jj=Re,Qj=Ac,Zj=Fr,$j=Ue,eG=Ss,tG=Be,rG=C_,nG=$c,iG=li,oG=As,aG=Rt,sG=rl,cG=Pc,uG=mc,dG=de,lG=zs.UNSUPPORTED_Y,hG=4294967295,fG=Math.min,pG=[].push,vG=Jj(/./.exec),_G=Jj(pG),mG=Jj("".slice),yG=!dG((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]}));Qj("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=oG(tG(this)),i=void 0===r?hG:r>>>0;if(0===i)return[];if(void 0===e)return[n];if(!eG(e))return Yj(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=Yj(uG,l,n))&&!((a=l.lastIndex)>d&&(_G(c,mG(n,d,o.index)),o.length>1&&o.index<n.length&&Wj(pG,c,sG(o,1)),s=o[0].length,d=a,c.length>=i));)l.lastIndex===o.index&&l.lastIndex++;return d===n.length?!s&&vG(l,"")||_G(c,""):_G(c,mG(n,d)),c.length>i?sG(c,0,i):c}:"0".split(void 0,0).length?function(e,r){return void 0===e&&0===r?[]:Yj(t,this,e,r)}:t,[function(t,r){var i=tG(this),o=$j(t)?void 0:aG(t,e);return o?Yj(o,t,i,r):Yj(n,oG(i),t,r)},function(e,i){var o=Zj(this),a=oG(e),s=r(n,o,a,i,n!==t);if(s.done)return s.value;var c=rG(o,RegExp),u=o.unicode,d=(o.ignoreCase?"i":"")+(o.multiline?"m":"")+(o.unicode?"u":"")+(lG?"g":"y"),l=new c(lG?"^(?:"+o.source+")":o,d),h=void 0===i?hG:i>>>0;if(0===h)return[];if(0===a.length)return null===cG(l,a)?[a]:[];for(var f=0,p=0,v=[];p<a.length;){l.lastIndex=lG?0:p;var _,m=cG(l,lG?mG(a,p):a);if(null===m||(_=fG(iG(l.lastIndex+(lG?p:0)),a.length))===f)p=nG(a,p,u);else{if(_G(v,mG(a,f,p)),v.length===h)return v;for(var y=1;y<=m.length-1;y++)if(_G(v,m[y]),v.length===h)return v;p=f=_}}return _G(v,mG(a,f)),v}]}),!yG,lG);var gG={},SG={exports:{}},EG=SG.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(EG).forEach((function(e){EG[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=SG.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}}))}))}}(gG);var bG=SG.exports,kG=/%[sdv%]/g,TG=function(e){var t=1,r=arguments,n=r.length;return e.replace(kG,(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""}}))},IG=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 TG.apply(null,n)},AG=["v","o","s","i","u","e","p","c","b","t","r","z","a"],RG=["i","c","b","a"],wG=gG,CG=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||AG,n=t.innerOrder||RG,i=[];return r.forEach((function(t){bG[t].forEach((function(r){r.name in e&&null!=e[r.name]?i.push(IG(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){i.push(IG(t,r,e))}))}))})),e.media.forEach((function(e){i.push(IG("m",bG.m[0],e)),n.forEach((function(t){bG[t].forEach((function(r){r.name in e&&null!=e[r.name]?i.push(IG(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){i.push(IG(t,r,e))}))}))}))})),i.join("\r\n")+"\r\n"};qj.write=CG,qj.parse=wG.parse,qj.parseParams=wG.parseParams,qj.parseFmtpConfig=wG.parseFmtpConfig,qj.parsePayloads=wG.parsePayloads,qj.parseRemoteCandidates=wG.parseRemoteCandidates,qj.parseImageAttributes=wG.parseImageAttributes,qj.parseSimulcastStreamList=wG.parseSimulcastStreamList;var OG=new YL("FirefoxHandler",3),xG=Math.pow(2,32),DG="kp34Za0H+aVf862l",NG="o/i14u9pJrxRKAsu";function PG(e){return e>xG-18?(OG.print("generateAllSsrc","reset start id",e),PG(e=e-xG+1e4+18)):{audio:e,audioFec:e+1,audioRtx:e+2,video:e+3,videoFec:e+4,videoRtx:e+5,next:e+18}}var MG=function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:NG;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)}]},LG=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(MG(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 UG(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 VG=function(e,t,r){var n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],o=i(i({},e),{},{media:[]});return n&&(o.invalid=[{value:"realx-exts:rscp"}]),t&&o.media.push(t),r&&o.media.push(r),delete o.groups,delete o.msidSemantic,qj.write(o)};function FG(e){return BG.apply(this,arguments)}function BG(){return(BG=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,HG(a.serverIceUfrag);case 6:return r.iceUfrag=e.sent,UB.setStats({connection_id:r.iceUfrag}),r.candidates=jG(n),r.setup="active",r.iceOptions="renomination",e.abrupt("return",r);case 12:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function jG(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 GG,HG=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)}}(),zG=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(" ")}},KG=new YL("BasicHandler",3),XG={iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan",encodedInsertableStreams:!!Xj()||void 0};function qG(e){if(void 0===GG){var t=navigator.userAgent.toLowerCase();GG=t.includes("mobile")}return GG?Math.ceil(e):e}var WG=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()*xG+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(XG),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;KG.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){KG.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,sB["".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(){KG.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/Nj.width,i=e.width/Pj.width):(n=e.height/Nj.height,i=e.height/Pj.height),r.push({maxkbps:Nj.maxkbps,scaleResolutionDownBy:n,frameRate:Nj.frameRate,width:Math.floor(e.width/n),height:Math.floor(e.height/n)}),t<=2||n>2&&r.unshift({maxkbps:Pj.maxkbps,scaleResolutionDownBy:i,frameRate:Pj.frameRate,width:Math.floor(e.width/i),height:Math.floor(e.height/i)}),r}(t,o),KG.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},xj(t,e))})),KG.print("simulcast() ","simulcastLayers2: %o",a)),a.forEach((function(e,t){var i,o={maxBitrate:1e3*e.maxkbps,scaleResolutionDownBy:qG(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],_=xj(f,v);e.prevScaleResolutionDownBy=_.scaleResolutionDownBy,e.prevBitrate=v.maxKbps,e.videoInputConfig=f;var m={maxBitrate:1e3*v.maxKbps,scaleResolutionDownBy:qG(_.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"}),!yP&&o){var y,g,S=function(e){for(var t=0,r=e.width*e.height,n=0;n<Dj.length;n++)if(r>=Dj[n].totalPixels){t=n;break}if(0===t)return Dj[t].maxLayers;var i=Dj[t-1].totalPixels;return(i-r)/(i-Dj[t].totalPixels)<.1?Dj[t-1].maxLayers:Dj[t].maxLayers}(_);if(KG.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=d.map((function(e,t){return i(i({},e),{},{video_index:t,sub_index:t})}))),KG.print("subVideoDesc","desc: %o ",l)}}KG.print("publish videoTransceiverInit videoDescriptions","",u,d);var E=null==n?void 0:n.getTrack("preprocessing");(null==n?void 0:n.mixType)!==re.PLAYOUT&&null!=n&&n.mixedAudioTrack&&(E=null==n?void 0:n.mixedAudioTrack),E=a&&E?E:"audio";var b=null==r?void 0:r.getTrack("preprocessing");b=s&&b?b:"video";try{this.monitor.rtcInvokeStatus(JSON.stringify({aTrack:BP(E),vTrack:BP(b),audioTransceiverInit:c,videoTransceiverInit:u}),0,"Handler.internalPublish","",0)}catch(y0){}return{semantics:"unified-plan",videoDescriptions:d,subVideoDescriptions:l,audioTransceiverInit:{track:E,init:c},videoTransceiverInit:{track:b,init:u}}}},{key:"updateMaxBitrate",value:function(e){var t,r,n,i;KG.print("updateMaxBitrate()");var o=null===(t=e.videoTrack)||void 0===t?void 0:t.getTrack(),a=e.videoTransceiver;if(o&&e.pubVideo&&a){var s=null===(r=e.videoEncodeConfig)||void 0===r||null===(n=r[0])||void 0===n?void 0:n.maxKbps;if(s){if(s===e.prevBitrate)return void KG.print("updateMaxBitrate()","no change");e.prevBitrate=s}var c=null===(i=a.sender)||void 0===i?void 0:i.getParameters();if(c){var u;c.encodings=null==c||null===(u=c.encodings)||void 0===u?void 0:u.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==a||a.sender.setParameters(c);try{this.monitor.rtcInvokeStatus(JSON.stringify(c.encodings),0,"Handler.updateScaleResolutionDownBy","",0)}catch(y0){}}}else KG.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(KG.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 KG.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=xj(c,t.videoEncodeConfig[0])).scaleResolutionDownBy===t.prevScaleResolutionDownBy&&KG.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(y0){}}case 12:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"getStats",value:function(e,t){return Vj(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,hB.W_1,"local"===(null==r?void 0:r.streamUserId)?fB.UP:fB.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,hB.W_1,"local"===(null==r?void 0:r.streamUserId)?fB.UP:fB.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,hB.W_0,"local"===(null==r?void 0:r.streamUserId)?fB.UP:fB.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,hB.W_1,"local"===(null==r?void 0:r.streamUserId)?fB.UP:fB.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;qj.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}(BL.exports.EventEmitter),YG=Re,JG=jh,QG=Yd.exports.getWeakData,ZG=ph,$G=Fr,eH=Ue,tH=Je,rH=lh,nH=Kt,iH=Ln.set,oH=Ln.getterFor,aH=Ra.find,sH=Ra.findIndex,cH=YG([].splice),uH=0,dH=function(e){return e.frozen||(e.frozen=new lH)},lH=function(){this.entries=[]},hH=function(e,t){return aH(e.entries,(function(e){return e[0]===t}))};lH.prototype={get:function(e){var t=hH(this,e);if(t)return t[1]},has:function(e){return!!hH(this,e)},set:function(e,t){var r=hH(this,e);r?r[1]=t:this.entries.push([e,t])},delete:function(e){var t=sH(this.entries,(function(t){return t[0]===e}));return~t&&cH(this.entries,t,1),!!~t}};var fH,pH={getConstructor:function(e,t,r,n){var i=e((function(e,i){ZG(e,o),iH(e,{type:t,id:uH++,frozen:void 0}),eH(i)||rH(i,e[n],{that:e,AS_ENTRIES:r})})),o=i.prototype,a=oH(t),s=function(e,t,r){var n=a(e),i=QG($G(t),!0);return!0===i?dH(n).set(t,r):i[n.id]=r,e};return JG(o,{delete:function(e){var t=a(this);if(!tH(e))return!1;var r=QG(e);return!0===r?dH(t).delete(e):r&&nH(r,t.id)&&delete r[t.id]},has:function(e){var t=a(this);if(!tH(e))return!1;var r=QG(e);return!0===r?dH(t).has(e):r&&nH(r,t.id)}}),JG(o,r?{get:function(e){var t=a(this);if(tH(e)){var r=QG(e);return!0===r?dH(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}},vH=ce,_H=Re,mH=jh,yH=Yd.exports,gH=Fh,SH=pH,EH=Je,bH=pl,kH=Ln.enforce,TH=mn,IH=!vH.ActiveXObject&&"ActiveXObject"in vH,AH=function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}},RH=gH("WeakMap",AH,SH);if(TH&&IH){fH=SH.getConstructor(AH,"WeakMap",!0),yH.enable();var wH=RH.prototype,CH=_H(wH.delete),OH=_H(wH.has),xH=_H(wH.get),DH=_H(wH.set);mH(wH,{delete:function(e){if(EH(e)&&!bH(e)){var t=kH(this);return t.frozen||(t.frozen=new fH),CH(this,e)||t.frozen.delete(e)}return CH(this,e)},has:function(e){if(EH(e)&&!bH(e)){var t=kH(this);return t.frozen||(t.frozen=new fH),OH(this,e)||t.frozen.has(e)}return OH(this,e)},get:function(e){if(EH(e)&&!bH(e)){var t=kH(this);return t.frozen||(t.frozen=new fH),OH(this,e)?xH(this,e):t.frozen.get(e)}return xH(this,e)},set:function(e,t){if(EH(e)&&!bH(e)){var r=kH(this);r.frozen||(r.frozen=new fH),OH(this,e)?DH(this,e,t):r.frozen.set(e,t)}else DH(this,e,t);return this}})}var NH=function(e){f(E,e);var t,r,n,i,a,s,d,p,v,_,y,S=g(E);function E(){var e,t,r;return u(this,E),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(E,[{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,!yP){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,!yP){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)})}]),E}(ZL),PH=new NH;!vP()&&(window.__rtc_dd__=PH);var MH=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}(),LH=function(){function e(t){u(this,e),h(this,"_ctx",void 0),h(this,"_analyserNode",void 0),h(this,"_audioSource",void 0);var r=UH.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}(),UH=new MH,VH=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}(VH||{}),FH=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}(),BH=new YL("VERTC",0),jH=new WeakMap,GH=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}(ZL),HH=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(){PB.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}(GH),zH=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}(GH),KH=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 BH.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}(HH),XH=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 LH(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 BH.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}(HH),qH=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)}(zH),WH=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 LH(this.getTrack())),this._audioLevelFetcher.getAudioLevel()}}]),r}(zH),YH=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)}(XH),JH=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)}(KH),QH=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)}(KH),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),h(m(e),"sourceType",0),e}return l(r)}(XH),$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_SCREEN),e}return l(r)}(KH),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_SCREEN),e}return l(r)}(XH),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_SCREEN),h(m(e),"sourceType",0),e}return l(r)}(KH),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),h(m(e),"sourceType",0),e}return l(r)}(XH);function nz(e,t){return iz.apply(this,arguments)}function iz(){return(iz=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 JH(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 oz(e,t){return az.apply(this,arguments)}function az(){return(az=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 sz(e,t){return cz.apply(this,arguments)}function cz(){return(cz=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,BH.print("createCameraVideoTrack","constraints:",t),PB.rtcVideoCaptureEvent({event_type:OB.START,media_device_id:a}),s=fP(),e.next=7,PH.getUserMedia({video:t});case 7:i=e.sent,PB.rtcVideoCaptureEvent({event_type:OB.START_CAPTURE_RESULT,media_device_id:a,reason:xB.SUCCESS,elapse:fP()-s}),e.next=15;break;case 11:throw e.prev=11,e.t0=e.catch(1),PB.rtcVideoCaptureEvent({event_type:OB.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],jH.set(c,i),u=new JH(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 uz(e,t,r){return dz.apply(this,arguments)}function dz(){return(dz=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 BH.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,PB.rtcVideoCaptureEvent({event_type:OB.START,media_device_id:s}),p=fP(),r.getPluginByName(VH.PRE_PROCESSING,"RTCAIAnsExtension")&&(t.autoGainControl=!0,t.noiseSuppression=!1),e.next=14,PH.getUserMedia({audio:t});case 14:a=e.sent,PB.rtcVideoCaptureEvent({event_type:OB.START_CAPTURE_RESULT,media_device_id:s,reason:xB.SUCCESS,elapse:fP()-p}),e.next=22;break;case 18:throw e.prev=18,e.t0=e.catch(8),PB.rtcVideoCaptureEvent({event_type:OB.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],jH.set(v,a),_=new YH(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 lz(){return hz.apply(this,arguments)}function hz(){return hz=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,BH.print("createScreenTracks","withAudio: %o, constraints: %o",t,n),e.prev=4,PB.rtcVideoCaptureEvent({event_type:OB.START,media_device_id:"screen"}),a=fP(),e.next=9,navigator.mediaDevices.getDisplayMedia({video:!(n&&(!gP||16!==bP))||n,audio:!!t&&{channelCount:2,noiseSuppression:!1,echoCancellation:!1,autoGainControl:!1}});case 9:i=e.sent,PB.rtcVideoCaptureEvent({event_type:OB.START_CAPTURE_RESULT,media_device_id:"screen",reason:xB.SUCCESS,elapse:fP()-a}),e.next=17;break;case 13:throw e.prev=13,e.t0=e.catch(4),PB.rtcVideoCaptureEvent({event_type:OB.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 $H(s,hP()),e.next=21,c.generatePreProcessingTrack(r);case 21:if(!(u=i.getAudioTracks()[0])){e.next=27;break}return d=new ez(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]])}))),hz.apply(this,arguments)}function fz(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:hP();return new WH(e,t)}function pz(e,t){return vz.apply(this,arguments)}function vz(){return(vz=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 QH(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 _z(e,t){return mz.apply(this,arguments)}function mz(){return(mz=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 ZH(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 yz(e,t){return gz.apply(this,arguments)}function gz(){return(gz=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 Sz(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 rz(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 bz=XH,kz=function(e){return e[e.NONE=0]="NONE",e}(kz||{}),Tz=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}(),Iz=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}(),Az=function(e){return e[e.internal=0]="internal",e[e.external=1]="external",e[e.bypass=2]="bypass",e}(Az||{}),Rz=new Uint8Array([109,167,53,190,103,90,72,1,170,89,63,164,194,199,19,85]),wz=new Uint8Array([109,167,53,190,103,90,72,1,170,89,63,164,194,199,19,84]),Cz=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 Oz(e){for(var t=[];e>=255;)e-=255,t.push(255);return t.push(e),new Uint8Array(t)}function xz(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 Dz=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?Rz:wz,a=Oz(e.byteLength+o.byteLength),s=Cz(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=b(xz(t,r+=2),2),i=n[0],o=2,a=(r=n[1])+i;return t.byteLength>=wz.byteLength&&i>=wz.byteLength&&t.slice(r,r+wz.byteLength).toString()===wz.toString()?(r+=wz.byteLength,o=1):t.byteLength>=wz.byteLength&&i>=wz.byteLength&&t.slice(r,r+Rz.byteLength).toString()===Rz.toString()&&(r+=Rz.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=b(xz(e.payload,r),2),i=n[0];r=n[1];var o=b(xz(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=b(t.value,2),o=i[0],a=i[1],s=Oz(o),c=Oz(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}(),Nz=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}(),Pz=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(pj.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,E=e.requestsReceived,b=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=E,f.recv_ping_responses=b,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,E=e.googEncodeUsagePercent,b=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,K=e.responsesSent,X=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=X||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=K):"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=E,p.frame_rate_input=b,p.orignal_input_Framerate=+b,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 E=(o-S.bytesSent||0)/i.statsInterval;p.sim_enc_bps.push(Math.round(8e3*E)),p.sim_enc_bandwidth.push(Math.round(8e3*E/1024));var b=1e3*(s-S.framesEncoded)/i.statsInterval;p.sim_enc_framerate.push(Math.round(b)),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(E>=0),p.sim_retransmittedRate.push(i._retransmittedRate),r>0&&!g&&(i.sentKBitrate=8*E,i.encoderOutputFrameRate=b,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}(Nz),Mz=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,E,b=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(pj.ABNORMAL_DISCONNECTION,(function(){b.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(b._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*b._audioStallInterval;b._audioStallCount=c(o().mark((function i(){var a,s,c,u,d,h,f,_,S,E,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,b.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(E=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:E?"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>=b._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(!b._audioStallCount&&b._setAudioStallCount&&b._setAudioStallCount(),!b._audioStallCount){e.next=6;break}return e.next=4,b._audioStallCount();case 4:b._audioStallTimer&&clearTimeout(b._audioStallTimer),b._audioStallTimer=setTimeout(_,b._audioStallInterval);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),b._audioStallTimer&&clearTimeout(b._audioStallTimer),b._audioStallTimer=setTimeout(_,b._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,b.getRemoteAudioStats(n,d);case 4:return a=e.sent,p=0,v=0,m=[],y=0,e.next=11,b.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)}}(),E=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=b.client)||void 0===t||t.emit("onRemoteStreamStats",r),_&&(g=fP(),b._audioStallTimer&&clearTimeout(b._audioStallTimer),b._audioStallTimer=setTimeout(_,b._audioStallInterval)),b._timer&&clearTimeout(b._timer),b._timer=setTimeout(E,2e3);case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),this._timer&&clearTimeout(this._timer),this._timer=setTimeout(E,2e3);case 26:case"end":return e.stop()}}),e,this)}))),function(e,t,r,i){return n.apply(this,arguments)})},{key:"delStatsEvtInterval",value:function(){E(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,E,b,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:LP(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,E=e.audioLevel,b=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,K=e.consentRequestsSent,X=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!==E&&(p.audio_level=E?-10*Math.log10(Math.pow(E,2)):E),void 0!==E&&(p.volume=255*E),void 0!==b&&(p.total_audio_energy=b),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+(K||0),p.sent_ping_responses=X,"succeeded"===g&&(n.rtt=1e3*S,n.total_rtt=1e3*m)}else"track"===t&&void 0!==E?(p.audio_level=E?-10*Math.log10(Math.pow(E,2)):E,p.volume=255*E,p.total_audio_energy=b,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,E=y.stall_list,b=y.stats_count,m.stall_list=E,m.stats_count=b,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:UP(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,E=e.id,b=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,K,X;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=E,f.ice_pair_rtt=b,f.rtt=1e3*b,f.rtt&&null!==(z=m._context)&&void 0!==z&&null!==(K=z.streamRTT)&&void 0!==K&&null!==(X=K[c])&&void 0!==X&&X.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(){E(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}(Nz);h(Mz,"audioStallInterval",void 0),h(Mz,"audioStallRatio",void 0);var Lz,Uz,Vz,Fz=new YL("Stream",0),Bz=function(e){return e[e.INIT=0]="INIT",e[e.SUB_ING=1]="SUB_ING",e[e.SUB_ED=2]="SUB_ED",e}(Bz||{}),jz=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",[cj]),h(this,"subVideoDescriptions",[]),h(this,"enableSimulcast",!1),h(this,"observer",void 0),h(this,"statsReport",void 0),h(this,"prevScaleResolutionDownBy",1),h(this,"prevBitrate",0),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 Pz(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(Xj()){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=Dz.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 Fz.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 Fz.print("no sender found when trying to bind encodedTransform")}},{key:"clean",value:function(){var e;PB.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.prevBitrate=0,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}(),Gz=function(e){f(r,e);var t=g(r);function r(e,n,i,o){var a;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.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=kz.NONE,a.subLayer={spatialLayer:0,spatialSubLayer:-1},a.streamState=0,a.statsReport=new Mz(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){Tz.getNalunits(new Iz(t.data)).forEach((function(t){if(t.sei){var r=Dz.decodeSeiBody(t.body);r&&r.type!==Az.internal&&e.safeEmit("onSEIMessage",r.payload)}})),r.enqueue(t)}})).pipeTo(n)}else Fz.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 Fz.print("no receiver found when trying to bind encodedTransform")}},{key:"ontrack",value:function(e){var t,r,n,i,o,a;try{PB.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:(i=e.transceiver,null==i?"undefined | null":"string"==typeof i?i:JSON.stringify({currentDirection:i.currentDirection,direction:i.direction,mid:i.mid,stopped:i.stopped,receiver:(a=i.receiver,null==a?"undefined | null":"string"==typeof a?a:JSON.stringify({track:BP(a.track)})),sender:(o=i.sender,null==o?"undefined | null":"string"==typeof o?o:JSON.stringify({track:BP(o.track)}))})),track:BP(e.track)}),0,"Stream.ontrack","",0)}catch(y0){}if(null!==(t=e.streams)&&void 0!==t&&null!==(r=t[0])&&void 0!==r&&null!==(n=r.id)&&void 0!==n&&n.includes(this.streamId)){var s,c=e.track;"video"===(null==c?void 0:c.kind)?this._setVideoTrack(c):"audio"===(null===(s=e.track)||void 0===s?void 0:s.kind)&&this._setAudioTrack(c),this._setStream(e.streams[0])}this.safeEmit("ontrack",e)}},{key:"clean",value:function(){var e;Fz.print("clean","exec stream.clean ".concat(this.streamId," ").concat(this.userId)),PB.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:"_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=fz(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 qH(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}(ZL),Hz=new YL("queue",4),zz=function(e){return e[e.ADD=0]="ADD",e[e.CLOSE=1]="CLOSE",e}(zz||{}),Kz=function(e){return e.publish="publish",e.unpublish="unpublish",e.subscribe="subscribe",e.unsubscribe="unsubscribe",e.pushtrack="pushtrack",e.removetrack="removetrack",e}(Kz||{}),Xz=(h(Lz={},"publish","unpublish"),h(Lz,"subscribe","unsubscribe"),h(Lz,"pushtrack","removetrack"),Lz),qz=(h(Uz={},"publish",0),h(Uz,"subscribe",0),h(Uz,"pushtrack",0),h(Uz,"unpublish",1),h(Uz,"unsubscribe",1),h(Uz,"removetrack",1),Uz),Wz=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!==Xz[t.action]||(r=t.streamId,Hz.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;wP&&(e=Math.min(this._queue.length,5));for(var t=qz[this._queue[0].action],r=1;r<e;r++)if(qz[this._queue[r].action]!==t)return{sdpStrategy:t,items:this._queue.splice(0,r)};return{sdpStrategy:t,items:this._queue.splice(0,e)}}}]),r}(jL),Yz=new YL("ChromeHandler",3),Jz=Xj(),Qz=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 Wz,r._sdpQueue.on("start",(function(){r._queueBusy||"stable"!==r._peerConnection.signalingState||(Yz.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 Yz.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,FG(t);case 4:return this._answerIce=e.sent,e.next=7,this._peerConnection.createOffer();case 7:return a=e.sent,s=qj.parse(a.sdp),c=b(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(){Yz.print("connect","dataChannel open"),zB("es.dc.open",""),e("")},d._dataChannel.onerror=function(e){PB.rtcSignalingMsgError(e.error.sdpLineNumber,e.error.errorDetail,cB.INVALID_DATA),zB("es.dc.error",""),t(e)},d._dataChannel.onclose=function(e){zB("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 Yz.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(){E(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=E(p(k.prototype),"internalPublish",this).call(this,t),l=d.videoDescriptions,h=d.subVideoDescriptions,f=d.audioTransceiverInit,v=d.videoTransceiverInit,_=PG(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:MG(c.id,"audio",_.audio,DG)}),S=i(i(i({},this._vSendonlyOfferTpl),this._offerIce),{},{mid:y,msid:"".concat(c.id," ").concat(c.id,"-video")}),u?(Yz.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=LG(c.id,_,{cname:DG}),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=b(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&&zG(S,null===(N=this._context)||void 0===N||null===(P=N.serverConfig)||void 0===P?void 0:P.videoCodec),(gP||kP)&&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||gP||this.addBitrateLimit(S,t.videoEncodeConfig[0].maxKbps),this._mlinesCache[t.stream.id]=[g,S],e.abrupt("return",{partialSdp:VG(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,E,b,k,T,I,A,R,w,C=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Yz.print("subscribe"),s="incroffer",c="unified-plan",this._aRecvonlyOfferTpl&&this._vRecvonlyOfferTpl){e.next=11;break}return e.next=6,NP(!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=VG(this._offerSession,p,v),g=void 0,r.multiChatMode||t.virtual||!this._aSendonlyAnswerTpl||!this._aSendonlyAnswerTpl){e.next=34;break}return g=PG(this._nextSsrc),this._nextSsrc=g.next,k=i(i(i({},this._aSendonlyAnswerTpl),this._answerIce),{},{mid:d,msid:"".concat(t.streamId).concat(null!==(S=this._context)&&void 0!==S&&S.avSync?"":"-audio"," ").concat(t.streamId,"-audio"),ssrcs:MG(t.streamId,"audio",g.audio)}),T=i(i(i({},this._vSendonlyAnswerTpl),this._answerIce),{},{mid:l,msid:"".concat(t.streamId).concat(null!==(E=this._context)&&void 0!==E&&E.avSync?"":"-video"," ").concat(t.streamId,"-video")},LG(t.streamId,g,{flexfec:this._enableSubFlexfec})),I=new Promise((function(e){C._sdpQueue.enqueue({action:Kz.subscribe,streamId:t.streamId,audioMid:d,videoMid:l,audioTransceiverInit:_,videoTransceiverInit:m,signalingAck:{sdp:qj.write(i(i({},C._answerSession),{},{media:[k,T]})),sequenceId:t.sequenceId?++t.sequenceId:0},stream:t,sdp:y,onSuccess:function(){Yz.print("subscribe()","sub success"),e(0)}})})),e.next=33,I;case 33:null===(b=g)||void 0===b||delete b.next;case 34:return(A=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&&(w=null===(R=p)||void 0===R?void 0:R.fmtp.find((function(e){return e.payload===A.payload})))&&this._context&&(w.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(Yz.print("handleAck()","item: %o",t),!t.generatorSsrc){e.next=4;break}return Yz.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(),Yz.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!==zz.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 Gz;if(a.onSuccess&&u.push(a.onSuccess),f&&(null==l?void 0:l.sequenceId)<h.sequenceId)return"break";var p={},v={},m=qj.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===Kz.publish&&(g=null===(y=h.stream)||void 0===y?void 0:y.id),!_._mlinesCache[g])return"break";var S=b(_._mlinesCache[g],2),E=S[0],k=S[1];if(o&&E){h.audioTransceiver=_._peerConnection.addTransceiver(o.track,o.init),_.monitor.rtcInvokeStatus(JSON.stringify({audioStreamTrack:BP(o.track)}),0,"chromeHandler.addTrack","",0);var T=_._inactiveMlineIndex.shift();T||(T=_._offerMlines.length),_._offerMlines[T]=i({},E),_._answerMlines[T]=p,Jz&&h.initAudioEncodedTransform()}if(d&&k){var I;n===Kz.publish&&RP&&(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:BP(d.track)}),0,"chromeHandler.addTrack","",0);var A=_._inactiveMlineIndex.shift();A||(A=_._offerMlines.length),_._offerMlines[A]=i({},k),_._answerMlines[A]=v,Jz&&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!==Kz.removetrack&&(v[r]=r),v[t]=t})),this._offerMlines=this._offerMlines.map((function(e,t){return v[e.mid]&&(e=UG(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=UG(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(y0){}Yz.print("dequeue","loop"),e.next=29;break;case 26:e.prev=26,e.t1=e.catch(6),Yz.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 Yz.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&&PB.rtcBeginCreateOffer("local"===t.streamUserId?dB.UP:dB.DOWN,t.streamId,t.streamUserId),e.next=10,this._peerConnection.createOffer();case 10:return t&&PB.rtcCreateOffer(0,"local"===t.streamUserId?lB.UP:lB.DOWN,t.streamId,t.streamUserId,fP()-n),e.next=13,this.setLocalDescription(qj.write(this._offerSession),t);case 13:return e.next=15,this.setRemoteDescription(qj.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,NP(!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=qj.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:qj.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;qj.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}(WG),Zz=new YL("FirefoxHandler",3),$z=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 Zz.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,FG(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=qj.parse(a.sdp),c=b(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(qj.write(s));case 20:return e.next=22,this.setRemoteDescription(qj.write(d));case 22:return e.next=24,new Promise((function(e,t){l._dataChannel.onopen=function(){Zz.print("connect","dataChannel open"),zB("es.dc.open",""),e("")},l._dataChannel.onerror=function(e){PB.rtcSignalingMsgError(e.error.sdpLineNumber,e.error.errorDetail,cB.INVALID_DATA),zB("es.dc.error",""),t(e)},l._dataChannel.onclose=function(e){zB("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 Zz.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=E(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(),PB.rtcBeginCreateOffer(dB.UP,"",""),e.next=7,this._peerConnection.createOffer();case 7:return h=e.sent,PB.rtcCreateOffer(0,lB.UP,"","",fP()-l),(f=qj.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(qj.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&&zG(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(qj.write(f));case 21:return e.abrupt("return",{partialSdp:VG(f,m,y,!1),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,E,b,k,T=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Zz.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(),PB.rtcBeginCreateOffer(dB.UP,t.streamId,t.userId),e.next=14,this._peerConnection.createOffer();case 14:return _=e.sent,PB.rtcCreateOffer(0,lB.UP,t.streamId,t.userId,fP()-v),(m=qj.parse(_.sdp)).media=null===(n=m.media)||void 0===n?void 0:n.map((function(e){return i(i({},e),T._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(qj.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=PG(this._nextSsrc),this._nextSsrc=y.next,b=i(i(i({},this._aSendonlyAnswerTpl),this._answerIce),{},{mid:u,msid:"".concat(t.streamId).concat(null!==(g=this._context)&&void 0!==g&&g.avSync?"":"-audio"," ").concat(t.streamId,"-audio"),ssrcs:MG(t.streamId,"audio",y.audio)}),k=i(i(i({},this._vSendonlyAnswerTpl),this._answerIce),{},{mid:d,msid:"".concat(t.streamId).concat(null!==(S=this._context)&&void 0!==S&&S.avSync?"":"-video"," ").concat(t.streamId,"-video")},LG(t.streamId,y,{flexfec:this._enableSubFlexfec})),e.next=35,this._internalSetRemoteDescription([b,k],t);case 35:null===(E=y)||void 0===E||delete E.next;case 36:return e.abrupt("return",{partialSdp:VG(m,f,p,!1),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)!==Kz.unpublish&&i!==Kz.unsubscribe&&i!==Kz.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 Zz.print("already set remote"),e.abrupt("return","");case 8:return a=qj.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=qj.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=qj.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(qj.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=qj.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:qj.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 Zz.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 Zz.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=qj.parse(null==c?void 0:c.sdp)).media=u.media.map((function(e){return a[e.mid]&&(e=UG(e)),"inactive"!==e.direction&&s.push(e.mid),i(i({},e),h._offerIce)})),d=qj.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(qj.write(u));case 17:return e.next=19,this.setRemoteDescription(qj.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;qj.parse(e).media.forEach((function(e){"audio"===e.type&&(t._aRecvonlyOfferTpl=e)}))}}]),k}(WG),eK=function(e,t){return yP?new $z(e,t):new Qz(e,t)},tK=new YL("Locker",2),rK=1,nK=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=rK++,t&&(this.name=t),tK.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,tK.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,tK.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}(),iK=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}(iK||{}),oK=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}(oK||{}),aK=function(e){return e[e.PUB=0]="PUB",e[e.UNPUB=1]="UNPUB",e}(aK||{}),sK=function(e){return e[e.SUB=0]="SUB",e[e.UNSUB=1]="UNSUB",e}(sK||{}),cK=(h(Vz={},Y.communication,[0]),h(Vz,Y.chat,[0]),h(Vz,Y.chatRoom,[1,"IES_chatroom"]),h(Vz,Y.coHost,[1,"IES_PK"]),h(Vz,Y.meeting,[16]),h(Vz,Y.classRoom,[0]),Vz),uK=Object.defineProperty,dK=Object.getOwnPropertyDescriptor,lK=function(e,t,r,n){for(var i,o=n>1?void 0:n?dK(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&&uK(t,r,o),o},hK=new YL("MediaServerClient",2),fK=6e4,pK=function(e){return e.DISCONNECTED="disconnected",e.DISCONNECTING="disconnecting",e.CONNECTED="connected",e.CONNECTING="connecting",e}(pK||{}),vK=function(e,t){hK.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)},_K=function(e){f(D,e);var t,r,n,a,s,d,p,v,_,y,S,E,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]:PB;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 nK("pubSubLock"),t._joinLeaveLock=new nK("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(){hK.print("emit ABNORMAL_DISCONNECTION ice"),t.safeEmit(pj.ABNORMAL_DISCONNECTION)}))}},{key:"_addSignalEventHandler",value:function(){var e,t=this;[hj.ON_ADD_STREAM,hj.ON_ADD_STREAM_LIST,hj.ON_REMOVE_STREAM,hj.ON_REMOVE_STREAM_LIST,hj.USER_CONNECTION,hj.USER_CONNECTION_LIST,hj.USER_DISCONNECTION,hj.USER_DISCONNECTION_LIST,hj.ON_UPDATE_STREAM_ATTRIBUTES,hj.ON_UPDATE_ROOM_ATTRIBUTES,hj.ON_PUSH_TRACK,hj.NODE_CHANGE,hj.ON_CUSTOM_MESSAGE,hj.USER_MESSAGE_RECEIVED,hj.USER_BINARY_MESSAGE_RECEIVED,hj.POST_PROCESSING_MESSAGE,hj.ON_USER_TOKEN_WILL_EXPIRE,hj.STREAM_CONTROL_MESSAGE,hj.ON_SCENE_CONFIG,hj.ON_UPDATE_USER_ATTRIBUTES,hj.ON_SPEAKER_CHANGE,fj.RSCP,fj.RTT,hj.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(){hK.print("emit ABNORMAL_DISCONNECTION datachannel"),t.safeEmit(pj.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(pj.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],zB("es.join.nodeChange",i),e.next=20;break;case 11:return Promise.resolve().then((function(){return l.emit("onGetIceConfigHook")})),this._iceConfigRequestManager=new Cj,e.next=15,null===(s=this._iceConfigRequestManager)||void 0===s?void 0:s.getAccessNode(t,r,n,ZB.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 zB("es.join.getNodeFailed",""),new hN(dN.ICE_SERVER_WRONG,"get ICE config failed");case 19:zB("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=eK(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,PP(d);case 26:hK.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 Aj(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,E,b,k,T,I=this,A=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=A.length>1&&void 0!==A[1]?A[1]:{},i=A.length>2&&void 0!==A[2]&&A[2],a=A.length>3?A[3]:void 0,hK.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,zj();case 26:return e.t6=e.sent,e.t7=window.navigator.userAgent,e.t8=nj.VERSION,e.t9=ZB.getDeviceId(),e.t10=this._appId,e.t11=this._roomId,e.t12=this._clientId,e.t13=this._businessId,e.t14=this._useCloudProxy,e.t15=cK[this._roomProfile]?cK[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 I.emit("onSendingJoinMessageHook")})),e.prev=40,_=i?"reconnected":"joinRoom",e.next=44,this._dataChannelSignal.sendSignaling(_,s);case 44:return m=e.sent,hK.print("join","send join message success"),this._authorization=s.Authorization,this.connectionState="connected",this._context&&(k=null===(y=m.config)||void 0===y?void 0:y.engine_WEB,this._context.serverConfig={videoCodec:(null==k?void 0:k.video_codec)||"H264",audioRed:!(null==k||!k.pub_audio_red),muteReplaceUnsub:!(null===(g=m.config)||void 0===g||!g.mute_replace_unsub),simulcastOnDemand:!(yP||!1===(null===(S=m.config)||void 0===S||null===(E=S.engine_VPM)||void 0===E||null===(b=E.ondemand)||void 0===b?void 0:b.enable))},"boolean"==typeof(null==k?void 0:k.av_sync)&&(this._context.avSync=k.av_sync)),Mz.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===(T=this._handler)||void 0===T||T.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,E=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return hK.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 QH),extaudio:!!(n instanceof ZH)},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(PB.rtcRecvAnswer(0,pB.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,vB.UP,"",""),g=new Promise((function(e,r){var n,i,o;null===(n=E._handler)||void 0===n||n.handleAck({action:Kz.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(){hK.print("publish()","publish success"),e(0)}})})),e.t0=!yP,!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(_B.SUCCESS,mB.W_0,a,yB.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(_B.FAIL,mB.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,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:hK.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),RP||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:BP(u),videoStreamTrack:BP(d)}),0,"MediaClient.updatePubTrack","",0)}catch(y0){}for(y={localaudio:!!a,localvideo:!!i,videostream:c,audiostream:s,extvideo:!!(i instanceof QH),extaudio:!!(a instanceof ZH)},g={},S=0,E=Object.entries(y);S<E.length;S++)k=b(E[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(!yP){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(hK.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 hK.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:Kz.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,E,b,k,T,I,A,R,w,C,O,x,D,N,P,M,L,U,V;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.streamState!==Bz.SUB_ED){e.next=2;break}return e.abrupt("return",i._updateSubTrack(t,r,sK.SUB).then(a,s));case 2:if(t.streamState!==Bz.SUB_ING){e.next=7;break}return i._subStreamQueue[t.streamId]||(i._subStreamQueue[t.streamId]=[]),hK.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(hK.print("subscribe()","mediaType: %o",r),vK("subscribe()",t),t.streamState=Bz.SUB_ING,u=!1,d=!1,LP(r)&&(d=!0),UP(r)&&(u=!0),u||!i.multiChatMode()){e.next=17;break}return t.streamState=Bz.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)))}),fK);t.on("ontrack",(function r(i){"video"===i.mediaType&&(hK.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)))}),fK);t.on("ontrack",(function r(i){"audio"===i.mediaType&&(hK.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}},O=i._context||{},x=O.subscribeFallbackOption,D=O.userPriority,"number"==typeof x&&(C.config.fallbackOption=x),null!=D&&D.has(t.userId)&&(C.config.priority=D.get(t.userId)),null!=I&&I.allSsrc&&(C.extra.subscribeSSRC=I.allSsrc),e.next=44,null===(y=i._dataChannelSignal)||void 0===y?void 0:y.sendSignaling("subscribe",C);case 44:if(200===(null==(N=e.sent)?void 0:N.code)){e.next=47;break}throw new hN(dN.SUBSCRIBE_FAILED,(null==N?void 0:N.message)||"subscribe failed");case 47:return P=null==N?void 0:N.relayMessage,M=P.audioMid,L=P.videoMid,h(g={},A,M),h(g,R,L),U=g,hK.print("sub midmap",t.userId,U),t.videoMid=R,t.audioMid=A,t.subMediaType=r,t.streamState=Bz.SUB_ED,t.subLayer=w,PB.rtcRecvAnswer(0,pB.INCRANSWER,(null==N||null===(S=N.relayMessage)||void 0===S?void 0:S.sequenceId)||0,null==N||null===(E=N.relayMessage)||void 0===E?void 0:E.sdp,vB.DOWN,t.streamId,t.userId),e.next=58,null===(b=i._handler)||void 0===b?void 0:b.handleAck({action:Kz.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==N||null===(k=N.relayMessage)||void 0===k?void 0:k.sdp,sequenceId:null==N||null===(T=N.relayMessage)||void 0===T?void 0:T.sequenceId},stream:t,sdp:I.sdp,generatorSsrc:!!I.allSsrc});case 58:return e.next=60,Promise.all(p);case 60:i.multiChatMode()||(t.subAudio=d),i.monitor.rtcSubscribeStat(gB.SUCCESS,l,SB.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=76;break;case 67:return e.prev=67,e.t0=e.catch(27),e.t0 instanceof Error&&i.monitor.rtcSubscribeStat(gB.FAIL,l,e.t0.message,t.userId),t.subVideo=f,t.streamState=Bz.INIT,e.next=74,null===(V=i._handler)||void 0===V?void 0:V.rollback(t.streamId,t);case 74:s(e.t0),i.emit("SUB_END",t.streamId);case 76:case"end":return e.stop()}}),e,null,[[27,67]])})));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){hK.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 hK.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 hK.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:(E=c(o().mark((function e(t){var r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return hK.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 E.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(hK.print("updateSubTrack()","subLayer: %o",r),t.subLayer.spatialLayer!==r.spatialLayer||t.subLayer.spatialSubLayer!==r.spatialSubLayer){e.next=4;break}return hK.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,f,p,v;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(hK.print("updateSubTrack()","mediaType: %o",r),vK("updateSubTrack()",t),!this.multiChatMode()||r!==U.AUDIO){e.next=5;break}return hK.print("updateSubTrack","multiChatMode mediaType only audio"),e.abrupt("return",t);case 5:return s=0,s=n===sK.SUB?t.subMediaType|r:t.subMediaType-(t.subMediaType&r),hK.print("updateSubTrack","prev: %o, direction: %o, mediaType: %o, newMediaType: %o",t.subMediaType,n,r,s),t.subMediaType===s&&hK.print("updateSubTrack","mediaType no change"),c=!1,u=!1,LP(s)&&(u=!0),UP(s)&&(c=!0),d={roomId:this._roomId,streamList:[t.streamId],config:{enableMediaType:{video:c,audio:!!this.multiChatMode()||u}}},l=this._context||{},h=l.subscribeFallbackOption,f=l.userPriority,"number"==typeof h&&(d.config.fallbackOption=h),null!=f&&f.has(t.userId)&&(d.config.priority=f.get(t.userId)),e.next=18,null===(i=this._dataChannelSignal)||void 0===i?void 0:i.sendSignaling("updateSubscribe",d);case 18:if(200===(null==(p=e.sent)?void 0:p.code)){e.next=21;break}throw new hN(dN.UPDATE_TRACK_FAILED,(null==p?void 0:p.message)||"update track failed");case 21:return this.multiChatMode()||(null===(v=t.observer)||void 0===v||v.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 26: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 hK.print("subscribe4pushTrack()","streamInfo: %o",r),vK("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)))}),fK);t.on("ontrack",(function r(i){"audio"===i.mediaType&&(hK.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:Kz.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:vK("unsubscribe4removeTrack()",t),hK.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],vK("unsubscribe()",t),!n){e.next=4;break}return e.abrupt("return",this._unsubscribe(t,r));case 4:if(!this.multiChatMode()||!UP(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!==kz.NONE){e.next=9;break}return e.abrupt("return",this._unsubscribe(t,r));case 9:return e.abrupt("return",this._updateSubTrack(t,r,sK.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,sK.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=Bz.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),!this.multiChatMode()&&(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:Kz.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)})),hK.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(vK("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(hK.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,zj();case 15:return e.t5=e.sent,e.t6=window.navigator.userAgent,e.t7=nj.VERSION,e.t8=ZB.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)))}),fK);t.on("ontrack",(function r(i){"video"===i.mediaType&&(hK.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)))}),fK);t.on("ontrack",(function r(i){"audio"===i.mediaType&&(hK.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=Bz.SUB_ED,t.subAudio=!0,t.subVideo=!0,e.next=44,null===(a=this._handler)||void 0===a?void 0:a.handleAck({action:Kz.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(gB.SUCCESS,c,SB.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 vK("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=Bz.INIT,t.subVideo=!1,t.subAudio=!1,e.next=14,null===(r=this._handler)||void 0===r?void 0:r.handleAck({action:Kz.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;hK.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}(ZL);function mK(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 yK(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}lK([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}],_K.prototype,"join",1),lK([yK,mK],_K.prototype,"publish",1),lK([yK,mK],_K.prototype,"updatePubTrack",1),lK([yK,mK],_K.prototype,"unpublish",1),lK([yK,mK],_K.prototype,"subscribe",1),lK([mK],_K.prototype,"controlMessage",1),lK([mK],_K.prototype,"updateUserAttributes",1),lK([mK],_K.prototype,"updateSubTrack",1),lK([mK],_K.prototype,"updateSubTrackLayer",1),lK([yK,mK],_K.prototype,"subscribe4pushTrack",1),lK([yK,mK],_K.prototype,"unsubscribe4removeTrack",1),lK([yK,mK],_K.prototype,"unsubscribe",1),lK([mK],_K.prototype,"handleRemoveStream",1),lK([yK],_K.prototype,"subscribePublicStream",1),lK([yK],_K.prototype,"unsubscribePublicStream",1);var gK=ro,SK=le,EK=ce,bK=Re,kK=Kt,TK=qe,IK=tt,AK=As,RK=Pr.f,wK=Fi,CK=EK.Symbol,OK=CK&&CK.prototype;if(SK&&TK(CK)&&(!("description"in OK)||void 0!==CK().description)){var xK={},DK=function(){var e=arguments.length<1||void 0===arguments[0]?void 0:AK(arguments[0]),t=IK(OK,this)?new CK(e):void 0===e?CK():CK(e);return""===e&&(xK[t]=!0),t};wK(DK,CK),DK.prototype=OK,OK.constructor=DK;var NK="Symbol(test)"==String(CK("test")),PK=bK(OK.valueOf),MK=bK(OK.toString),LK=/^Symbol\((.*)\)[^)]+$/,UK=bK("".replace),VK=bK("".slice);RK(OK,"description",{configurable:!0,get:function(){var e=PK(this);if(kK(xK,e))return"";var t=MK(e),r=NK?VK(t,7,-1):UK(t,LK,"$1");return""===r?void 0:r}}),gK({global:!0,constructor:!0,forced:!0},{Symbol:DK})}hM("iterator");var FK=Ip.right,BK=ut,jK=Ap;ro({target:"Array",proto:!0,forced:!Ca("reduceRight")||!jK&&BK>79&&BK<83},{reduceRight:function(e){return FK(this,e,arguments.length,arguments.length>1?arguments[1]:void 0)}});var GK={};Object.defineProperty(GK,"__esModule",{value:!0});var HK=function(){return(HK=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 zK(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 KK(e){return"object"==a(e)&&null!==e}function XK(e){return"function"==typeof e}function qK(){if("object"==("undefined"==typeof window?"undefined":a(window))&&KK(window))return window}function WK(){if("object"==("undefined"==typeof document?"undefined":a(document))&&KK(document))return document}var YK=function(e){if(e)return e.__SLARDAR_REGISTRY__||(e.__SLARDAR_REGISTRY__={Slardar:{plugins:[],errors:[],subject:{}}}),e.__SLARDAR_REGISTRY__.Slardar},JK=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))}([],zK(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=YK(qK());r&&(r.errors||(r.errors=[]),r.errors.push(e))}(o),[]}},QK=function(e){return e.requestIdleCallback||function(t){return e.setTimeout(t,1)}},ZK=function(){return Date.now()};var $K=function(e,t){return KK(e)?HK(HK({},t),e):!!e&&t};var eX=["SCRIPT","STYLE","META","HEAD"],tX=["js_error","http","resource_error"],rX=["performance","performance_longtask","performance_timing","custom"],nX=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=eX),!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)},iX=function(e,t,r,n){if(function(){if(qK()&&"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(){QK(r)((function(){r.html2canvas&&r.html2canvas(n.body,{scale:360/r.innerWidth}).then((function(t){e(t.toDataURL("image/jpeg",.1))}))}))}},oX=function(e,t,r,n,i){if(void 0===e&&(e=qK()),void 0===t&&(t=WK()),void 0===r&&(r=function(){if(qK()&&XK(window.PerformanceObserver))return window.PerformanceObserver}()),void 0===n&&(n=function(){if(qK()&&XK(window.MutationObserver))return window.MutationObserver}()),void 0===i&&(i=function(){if(qK()&&KK(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=QK(e),g=zK(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 XK(r)&&r.call(e,t)||[]},function(){var t=(e||{}).clearResourceTimings;XK(t)&&t.call(e)},function(t){var r=(e||{}).getEntriesByName;return XK(r)&&r.call(e,t)||[]}]}(i),2)[1],S=0,E=!1,b=function(e){s&&a&&a({ev_type:"blank_screen",payload:{timestamp:s[0],score:s[1],screenshot:e,error:c}})},k=(d=function(){s&&!E&&(E=!0,I(),p?iX(b,m,e,t):b())},function(){l||(h=ZK(),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=nX(e,0,0,f))<f?(s=[ZK(),e],k()):s=void 0)}))}))}),1e3)}!function(e){var t=zK(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(){!E&&c&&b()}));var I=function(){clearTimeout(u),R&&R(),C&&C()},A=(o=zK(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=zK(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=qK(),r=WK();t&&r&&("loading"!==r.readyState?e():t.addEventListener("DOMContentLoaded",(function(){setTimeout((function(){e()}),0)}),!1))}((function(){var e;A(null===(e=WK())||void 0===e?void 0:e.body,{subtree:!0,childList:!0}),w("longtask","resource"),T()})),[I,function(e){E||function(e){return~rX.indexOf(e.ev_type)}(e)||(S=ZK(),c&&S-c.timestamp>1e4&&(c=void 0),c=function(e,t){if(-1===tX.indexOf(t.ev_type))return e;if("http"===t.ev_type&&t.payload.response.status<400)return e;if(e&&tX.indexOf(e.type)<tX.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:ZK()}}(c,e))},T]}},aX="blankScreen";function sX(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],$K(t,r)}(e,aX,t)||$K(r,t);a&&(a=zK(JK(oX,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 cX={autoDetect:!0,threshold:1.5,screenshot:!0,ssUrl:"https://apm.volccdn.com/mars-web/apmplus/web/html2canvas.min.js"};var uX=GK.blankScreenPlugin=function(e){return{name:aX,setup:function(t){!function(e,t){sX(e,cX,t)}(t,e)}}},dX=Gt,lX=Gu,hX=Pu;ro({target:"Object",stat:!0,forced:de((function(){lX(1)})),sham:!hX},{getPrototypeOf:function(e){return lX(dX(e))}});var fX=PN.start;ro({target:"String",proto:!0,forced:MN},{padStart:function(e){return fX(this,e,arguments.length>1?arguments[1]:void 0)}});var pX,vX={};Object.defineProperty(vX,"__esModule",{value:!0});var _X=function(){return(_X=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 mX(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 yX(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 gX=function(e){return JSON.stringify({ev_type:"batch",list:e})};var SX=["init","start","config","beforeDestroy","provide","beforeReport","report","beforeBuild","build","beforeSend","send","beforeConfig"],EX=function(){return{}};function bX(e){return"object"==a(e)&&null!==e}var kX=Object.prototype;function TX(e){return!!bX(e)&&("function"!=typeof Object.getPrototypeOf?"[object Object]"===kX.toString.call(e):(e=Object.getPrototypeOf(e))===kX||null===e)}function IX(e){return"[object Array]"===kX.toString.call(e)}function AX(e){return"function"==typeof e}function RX(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function wX(e,t){var r,n=_X({},e);for(r in t)RX(t,r)&&void 0!==t[r]&&(bX(t[r])&&TX(t[r])?n[r]=wX(bX(e[r])?e[r]:{},t[r]):IX(t[r])&&IX(e[r])?n[r]=CX(e[r],t[r]):n[r]=t[r]);return n}function CX(e,t){return e=IX(e)?e:[],t=IX(t)?t:[],Array.prototype.concat.call(e,t).map((function(e){return e instanceof RegExp?e:bX(e)&&TX(e)?wX({},e):IX(e)?CX([],e):e}))}function OX(e,t){if(!IX(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 xX=function(e,t){if(!IX(e))return e;var r=e.indexOf(t);return 0<=r?((t=e.slice()).splice(r,1),t):e},DX=function(e,t,r){return function(e,t,r){for(var n,i=(t=mX(t.split(".")))[0],o=t.slice(1);e&&0<o.length;)e=e[i],i=(n=mX(o))[0],o=n.slice(1);if(e)return r(e,i)}(e,t,(function(e,t){if(e&&t in e&&AX(e[t]))try{return e[t].apply(e,r)}catch(n){return}}))};function NX(e){try{return function(e){return"string"==typeof e}(e)?e:JSON.stringify(e)}catch(t){return"[FAILED_TO_STRINGIFY]:"+String(t)}}var PX=0,MX=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];console.error.apply(console,yX(["[SDK]",Date.now(),(""+PX++).padStart(8," ")],mX(e),!1))},LX=0,UX=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];console.warn.apply(console,yX(["[SDK]",Date.now(),(""+LX++).padStart(8," ")],mX(e),!1))},VX=function(e){return function(t){for(var r=t,n=0;n<e.length&&r;n++)try{r=e[n](r)}catch(i){MX(i)}return r}};function FX(){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 BX=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)}},jX=function(e){function t(e){n=xX(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 BX(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 GX=function(e){var t,r,n,i=(t={},r={},n={set:function(e,i){return t[e]=i,r[e]=NX(i),n},merge:function(e){return t=_X(_X({},t),e),Object.keys(e).forEach((function(t){r[t]=NX(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 _X({},r)}},n);e.provide("context",i),e.on("report",(function(e){return e.extra||(e.extra={}),e.extra.context=i.toString(),e}))},HX=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 DX(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(yX([c],mX(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 EX;var a=e[t],s=r.apply(void 0,yX([a],mX(i),!1)),c=s;return AX(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 AX(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=mX(t))[0];var n=n.slice(1);null!=r&&r(e,t,n)})),o[t]=null)})),n};function zX(e,t){var r=t||{};e.provide("initSubject",(function(e){var t=(e=mX(e,2))[0];e=e[1];return r[t]||(r[t]=function(t,r){var n=jX();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 KX(){if("object"==("undefined"==typeof window?"undefined":a(window))&&bX(window))return window}function XX(){var e=function(){if(KX()&&"navigator"in window)return window.navigator}();if(e)return e.connection||e.mozConnection||e.webkitConnection}function qX(){var e=KX()&&KX()&&window.location;return null==e?void 0:e.href}var WX=function(e){var t={url:qX(),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 YX(e){return(null==e?void 0:e.effectiveType)||(null==e?void 0:e.type)||""}var JX=function(e,t,r){var n,i=t.url,o=t.data,a=void 0===(n=t.success)?EX:n,s=void 0===(n=t.fail)?EX:n,c=void 0===(n=t.getResponseText)?EX: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)},QX=function(){var e=function(){if("function"==typeof XMLHttpRequest&&AX(XMLHttpRequest))return XMLHttpRequest}();return e?{get:function(t){JX("GET",t,e)},post:function(t){JX("POST",t,e)}}:{get:EX,post:EX}};function ZX(e){function t(e){n.post(r.getEndpoint(),gX([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?gX(a):""},clear:function(){clearTimeout(s),a=[]}}}(e),n=function(){var e=KX();return e&&e.navigator.sendBeacon?{get:function(){},post:function(t,r){e.navigator.sendBeacon(t,r)}}:{get:EX,post:EX}}();return function(e){var t=mX(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 $X={build:function(e){return{ev_type:e.ev_type,payload:e.payload,common:_X(_X({},e.extra||{}),e.overrides||{})}}};function eq(e){var t,r=e.plugins||{};for(t in r)r[t]&&!bX(r[t])&&(r[t]={});return _X(_X({},e),{plugins:r})}function tq(e){return bX(e)&&"aid"in e}function rq(e){return _X({},e)}var nq="/settings/get/webpro",iq="/monitor_web/collect",oq=[iq,nq,"/monitor_browser/collect"],aq={sample_rate:1,include_users:[],sample_granularity:"session",rules:{}},sq=function(e,t){return void 0===t&&(t=iq),(e&&0<=e.indexOf("//")?"":"https://")+e+t},cq=function(e,t){return void 0===t&&(t=nq),(e&&0<=e.indexOf("//")?"":"https://")+e+t},uq=function(e){return e+"_"+Date.now()},dq=function(e){return"APMPLUS"+e},lq=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=dq(e))||{userId:FX(),deviceId:FX(),r:Math.random()}},hq=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=dq(t),{userId:r,deviceId:n,r:e.r})},fq=function(e){var t,r,n,i=e,o={},a=EX,s=EX;return{getConfig:function(){return i},setConfig:function(e){return o=_X(_X({},o),e||{}),c(),t||(t=e,i.useLocalConfig?(n={},a()):r?u():function(e,t,r,n){e.get({withCredentials:!0,url:cq(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()),hq(i),t()},n&&a()}};function c(){var t=_X(_X(_X({},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=wX(r,e[n++]);return r}(e.plugins,(null==n?void 0:n.plugins)||{},o.plugins||{}),t.sample=pq(pq(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 pq(e,t){if(!e||!t)return e||t;var r=_X(_X({},e),t);return r.include_users=yX(yX([],mX(e.include_users||[]),!1),mX(t.include_users||[]),!1),r.rules=yX(yX([],mX(Object.keys(e.rules||{})),!1),mX(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]=_X(_X({},e.rules[n]),t.rules[n]),r[n].conditional_sample_rules=yX(yX([],mX(e.rules[n].conditional_sample_rules||[]),!1),mX(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 vq=function(e){e.on("report",(function(e){return function(e){var t={url:qX(),timestamp:Date.now()};return _X(_X({},e),{extra:_X(_X({},t),e.extra||{})})}(e)}))},_q=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,_X(_X({},e),{extra:_X(_X({},r),e.extra||{})})}(t,e.config())}))},mq=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 bX(e)?Object.keys(e).reduce((function(t,r){return t+"&"+r+"="+e[r]}),"").replace("&","?"):""}(r))}))},yq=function(e){return e=lq(e.aid),{aid:0,pid:"",token:"",viewId:uq("_"),userId:e.userId,deviceId:e.deviceId,sessionId:FX(),domain:"apmplus.volces.com",plugins:{ajax:{ignoreUrls:oq},fetch:{ignoreUrls:oq},breadcrumb:{},pageview:{},jsError:{},resource:{},resourceError:{},performance:{},tti:{},fmp:{},blankScreen:!1},release:"",env:"production",sample:_X(_X({},aq),{r:e.r}),transport:QX()}};pX=vX.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={};SX.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)UX("already inited");else{if(!(e&&bX(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&&bX(e)&&(m("beforeConfig",!1,e),null!=r&&r.setConfig(e))},config:function(e){if(l)return e&&bX(e)&&(m("beforeConfig",!1,e),null!=r&&r.setConfig(s(e))),null==r?void 0:r.getConfig()},provide:function(e,t){OX(v,e)?UX("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=VX(d.beforeReport)(e))||(e=VX(d.report)(e))&&(h?this.build(e):p.push(e)))},build:function(e){!h||(e=VX(d.beforeBuild)(e))&&(!(e=n.build(e))||(e=VX(d.build)(e))&&this.send(e))},send:function(e){!h||(e=VX(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]=xX(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,yX([],mX(r),!1))}catch(t){}})),t&&(d[e].length=0)}}({validateInitConfig:tq,initConfigNormalizer:eq,userConfigNormalizer:rq,createSender:void 0===t?function(e){return ZX({size:20,endpoint:sq(e.domain),transport:e.transport})}:t,builder:void 0===e?$X:e,createDefaultConfig:void 0===r?yq:r,createConfigManager:fq});return GX(n),r=function(e){if(e)return e.__SLARDAR_REGISTRY__||(e.__SLARDAR_REGISTRY__={Slardar:{plugins:[],errors:[],subject:{}}}),e.__SLARDAR_REGISTRY__.Slardar}(KX()),zX(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),_q(n),vq(n),function(e){var t=XX(),r=YX(t);t&&(t.onchange=function(){r=YX(t)}),e.on("report",(function(e){return _X(_X({},e),{extra:_X(_X({},e.extra||{}),{network_type:r})})}))}(n),mq(n),r=HX(n,WX,(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=mX(r))[0],t=t.slice(1);n[e].apply(n,yX([],mX(t),!1))}))})),function(e){e.on("init",(function(){var t=[],r=e.config();r&&r.integrations&&r.integrations.forEach((function(r){OX(t,r.name)||(t.push(r.name),r.setup(e),r.tearDown&&e.on("beforeDestroy",r.tearDown))}))}))}(r),r},vX.getDefaultConfig=yq;var gq={};Object.defineProperty(gq,"__esModule",{value:!0});var Sq=function(){return(Sq=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 Eq(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 bq(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 kq=function(){return{}};function Tq(e){return"object"==a(e)&&null!==e}var Iq=Object.prototype;function Aq(e){return"function"==typeof e}function Rq(e){return"string"==typeof e}function wq(e){return function(e){return"[object Array]"===Iq.toString.call(e)}(e)&&e.length?function(e){for(var t=[],r=e.length,n=0;n<r;n++){var i=e[n];Rq(i)?t.push(i.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")):i&&i.source&&t.push(i.source)}return new RegExp(t.join("|"),"i")}(e):null}function Cq(e){try{return Rq(e)?e:JSON.stringify(e)}catch(t){return"[FAILED_TO_STRINGIFY]:"+String(t)}}var Oq=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 kq;var a=e[t],s=r.apply(void 0,bq([a],Eq(i),!1)),c=s;return Aq(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 Aq(a)&&a.apply(this,e)}}),e[t]=c,function(r){r||(c===e[t]?e[t]=a:s=a)}}};function xq(){if("object"==("undefined"==typeof window?"undefined":a(window))&&Tq(window))return window}var Dq=function(e){if(e)return e.__SLARDAR_REGISTRY__||(e.__SLARDAR_REGISTRY__={Slardar:{plugins:[],errors:[],subject:{}}}),e.__SLARDAR_REGISTRY__.Slardar},Nq=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=Dq(xq());r&&(r.errors||(r.errors=[]),r.errors.push(e))};function Pq(e,t,r){return function(e,t){return Tq(e)?Sq(Sq({},t),e):!!e&&t}(t=null===(e=e.config())||void 0===e?void 0:e.plugins[t],r)}var Mq=["name","message","stack","filename","lineno","colno"],Lq=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&&Tq(e)?t.reduce((function(t,r){return t[r]=e[r],t}),{}):e}(e,Mq):(function(e){return!!Tq(e)&&("function"!=typeof Object.getPrototypeOf?"[object Object]"===Iq.toString.call(e):(e=Object.getPrototypeOf(e))===Iq||null===e)}(e)||function(e){return"undefined"!=typeof Event&&function(e,t){try{return e instanceof t}catch(r){return!1}}(e,Event)}(e)||Rq(e))&&(t={message:Cq(e)}),t},Uq=function(e){return Lq(e.error)},Vq=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=Lq(r);return Sq(Sq({},n),{name:null!==(t=n&&n.name)&&void 0!==t?t:"UnhandledRejection"})}}catch(i){}},Fq=function(e){return(function(e){return"[object ErrorEvent]"===Object.prototype.toString.call(e)}(e)?Uq:function(e){return"[object PromiseRejectionEvent]"===Object.prototype.toString.call(e)}(e)?Vq:Lq)(e)},Bq=["EventTarget","Window","Node","ApplicationCache","ChannelMergerNode","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","MessagePort","Notification","SVGElementInstance","Screen","TextTrack","TextTrackCue","TextTrackList","WebSocket","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],jq=["setTimeout","setInterval","requestAnimationFrame","requestIdleCallback"],Gq=["onload","onerror","onprogress","onreadystatechange"],Hq="addEventListener",zq=function(e,t,r){function n(t,r){if(!Aq(t))return t;var i={type:"capture-global",data:Sq({},r)},o=t._w_||(t._w_=function(){try{return(t.handleEvent&&Aq(t.handleEvent)?t.handleEvent:t).apply(this,[].map.call(arguments,(function(e){return n(e,r)})))}catch(a){var o=Lq(a);throw o&&e({error:o,source:i}),a}});return o._hook_=!0,o}void 0===t&&(t=xq()),void 0===r&&(r=function(){if("function"==typeof XMLHttpRequest&&Aq(XMLHttpRequest))return XMLHttpRequest}());var i=[];return t&&i.push.apply(i,bq([],Eq(jq.filter((function(e){return t[e]})).map((function(e){return Oq(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,bq([this,n(r,{function:e})],Eq(i),!1))}}),!1)()}))),!1)),r&&r.prototype&&i.push(Oq(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,bq([],Eq(Gq.filter((function(e){return t[e]&&!t[e]._hook_})).map((function(e){var r=Oq(t,e,(function(t){return n(t,{function:e})}),!1)();return function(){r(),t[e]._hook_=void 0}}))),!1)),e.apply(this,r)}}),!1)()),Bq.forEach((function(e){var r=t[e]&&t[e].prototype;r&&r.addEventListener&&(i.push(Oq(r,Hq,(function(t){return function(r,i,o){try{var a=i.handleEvent;Aq(a)&&(i.handleEvent=n(a,{function:"handleEvent",target:e}))}catch(s){}return t&&t.call(this,r,n(i,{function:Hq,target:e}),o)}}),!1)()),i.push(Oq(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},Kq=function(e,t){return e&&t&&e===t},Xq=function(){var e;return function(t){try{if(function(e,t){return!!(e&&t&&Kq(e.message,t.message)&&Kq(e.stack,t.stack))}(t,e))return void(e=t)}catch(r){Nq(r)}return e=t}},qq=function(e){if(e=void 0===e?xq():e)return function(t,r){var n,i,o=t.ignoreErrors,a=t.onerror,s=t.onunhandledrejection,c=t.dedupe,u=(t=t.captureGlobalAsync,wq(o)),d=[],l=Xq(),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:Uq(e),source:{type:"onerror"}})}),d.push((function(){return e.removeEventListener("error",n)}))),s&&(e.addEventListener("unhandledrejection",i=function(e){return h({error:Vq(e),source:{type:"onunhandledrejection"}})}),d.push((function(){return e.removeEventListener("unhandledrejection",i)}))),t&&d.push.apply(d,bq([],Eq(zq(h)),!1)),[function(e,t,r){return h({error:Fq(e),extra:t,react:r,source:{type:"manual"}})},function(){d.forEach((function(e){return e()}))}]}},Wq="jsError",Yq={ignoreErrors:[],onerror:!0,onunhandledrejection:!0,captureGlobalAsync:!1,dedupe:!0};function Jq(e){e.on("init",(function(){window.removeEventListener("error",e.pcErr,!0),window.removeEventListener("unhandledrejection",e.pcRej,!0);var t,r=Pq(e,Wq,Yq);r&&(r=(t=Eq(function(e,t,r,n){void 0===t&&(t={}),void 0===n&&(n=[]);try{var i=e.apply(void 0,bq([],Eq(n),!1));return i&&i(t,r)||[]}catch(o){return Nq(o),[]}}(qq,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 Qq=gq.jsErrorPlugin=function(){return{name:Wq,setup:function(e){Jq(e)}}},Zq={};Object.defineProperty(Zq,"__esModule",{value:!0});var $q=function(){return($q=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 eW(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 tW(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 rW=function(){return{}};function nW(e){return"object"==a(e)&&null!==e}function iW(e){return"function"==typeof e}var oW=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 rW;var a=e[t],s=r.apply(void 0,tW([a],eW(i),!1)),c=s;return iW(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 iW(a)&&a.apply(this,e)}}),e[t]=c,function(r){r||(c===e[t]?e[t]=a:s=a)}}};function aW(){if("object"==("undefined"==typeof window?"undefined":a(window))&&nW(window))return window}var sW=function(e){if(e)return e.__SLARDAR_REGISTRY__||(e.__SLARDAR_REGISTRY__={Slardar:{plugins:[],errors:[],subject:{}}}),e.__SLARDAR_REGISTRY__.Slardar},cW=function(e,t,r,n){void 0===t&&(t={}),void 0===n&&(n=[]);try{var i=e.apply(void 0,tW([],eW(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=sW(aW());r&&(r.errors||(r.errors=[]),r.errors.push(e))}(o),[]}};function uW(e){var t=function(){if("object"==("undefined"==typeof document?"undefined":a(document))&&nW(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 dW(e,t,r){return function(e,t){return nW(e)?$q($q({},t),e):!!e&&t}(t=null===(e=e.config())||void 0===e?void 0:e.plugins[t],r)}var lW=["hash_0",function(e,t){var r,n=aW();n&&(n.addEventListener("hashchange",r=function(){return e(location.href)},!0),t((function(){return n.removeEventListener("hashchange",r,!0)})))}],hW=["history_0",function(e,t){var r,n,i,o=aW()&&window.history;o&&(n=function(){return e(location.href)},(r=[]).push(oW(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()}}})(),oW(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()}))})))}],fW=function(e,t){if(void 0===e&&(e=aW()),void 0===t&&(t=aW()&&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=uW(t).hash)||void 0===r?void 0:r.replace(/^#/,""))||"/":uW(t).path}}(c),f=u||function(){},p=(s=eW(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=eW(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=eW(e(c),1)[0],l.push(e((function(e){return o(c,e)})))),a&&d(),[s,function(){l.forEach((function(e){return e()}))}]}},pW="pageview",vW={sendInit:!0,routeMode:"history"};var _W=Zq.pageviewPlugin=function(){return{name:pW,setup:function(e){var t;(t=e).on("init",(function(){var e,r=dW(t,pW,vW);r&&(r=eW(cW(fW,$q($q({},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?lW:hW)}}),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 mW=pX();mW("init",{aid:432410,token:"d7271e1eac254529abcffc63e36b02c3",integrations:[_W(),Qq(),uX({screenshot:!1})]}),mW("start"),window.__rtc_slardar__=mW}var yW,gW=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}()),SW=function(){function e(t,r){u(this,e),h(this,"_audioEventSessionId",OP()),h(this,"_videoEventSessionId",OP()),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:TB.LOGIN}),h(this,"_currentVideoRecv",{startTime:0,eventSessionId:0,type:TB.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=TB.LOGIN,s=TB.UNMUTE,c=TB.SUBSCRIBE,u=TB.PUSH_TRACK,[a,s,c,u].indexOf(r)>=0&&(n=0,i=!1),t===kB.AUDIO?(i||this._audioEventSessionId++,this._currentAudioRecv={startTime:Date.now(),eventSessionId:this._audioEventSessionId,type:r},h={media_type:t,event_type:bB.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(kB.AUDIO,IB.TIMEOUT),m._firstAudioFrameInterval&&window.clearInterval(m._firstAudioFrameInterval)}),this._timeout),PB.rtcFirstFrame(h),this._watchForFirstAudioFrameRecv(),this._audioFirstFrameState=1,this._login=!0,this._unMuteAudio=!0,this._enableAudio=!0,this._remoteUnmuteAudio=!0):t===kB.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?kB.SCREEN_VIDEO:t,event_type:bB.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(kB.VIDEO,IB.TIMEOUT),m._firstVideoFrameInterval&&window.clearInterval(m._firstVideoFrameInterval)}),this._timeout),this._watchForFirstVideoFrameRecv(),PB.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===kB.AUDIO){var r,n,i;if(1!==this._audioFirstFrameState)return;var o={event_type:bB.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,PB.rtcFirstFrame(o),this._audioFirstFrameState=2}else if(e===kB.VIDEO){var a,s,c,u;if(1!==this._videoFirstFrameState)return;var d={event_type:bB.RECV_END,media_type:null!==(a=this._stream)&&void 0!==a&&a.isScreen?kB.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,PB.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=TB.LOGIN,i=TB.UNMUTE,a=TB.SUBSCRIBE,s=TB.PUSH_TRACK,t!==kB.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:bB.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),PB.rtcFirstFrame(h),this._audioFirstFrameState=3,e.next=30;break;case 18:if(t!==kB.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:bB.RECV_END,media_type:null!==(f=this._stream)&&void 0!==f&&f.isScreen?kB.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),PB.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(kB.AUDIO,TB.LOGIN),e&&null!==(r=this._stream)&&void 0!==r&&r.hasVideo&&o.video&&this.beginRecvFrame(kB.VIDEO,TB.LOGIN),!e&&null!==(n=this._stream)&&void 0!==n&&n.hasAudio&&this.stopRecvFrame(kB.AUDIO,IB.LEAVE_ROOM),!e&&null!==(i=this._stream)&&void 0!==i&&i.hasVideo&&this.stopRecvFrame(kB.VIDEO,IB.LEAVE_ROOM))}},{key:"setUnmuteAudio",value:function(e){var t;this._unMuteAudio!==e&&(this._unMuteAudio=e,this._unMuteAudio?this.beginRecvFrame(kB.AUDIO,TB.UNMUTE):null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(kB.AUDIO,IB.MUTE))}},{key:"setRemoteUnmuteAudio",value:function(e){var t;this._remoteUnmuteAudio!==e&&(this._remoteUnmuteAudio=e,this._remoteUnmuteAudio?this.beginRecvFrame(kB.AUDIO,TB.REMOTE_UNMUTE):null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(kB.AUDIO,IB.REMOTE_MUTE))}},{key:"setEnableAudio",value:function(e){var t;this._enableAudio!==e&&(this._enableAudio=e,this._enableAudio?this.beginRecvFrame(kB.AUDIO,TB.ENABLE):null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(kB.AUDIO,IB.DISABLE))}},{key:"setUnmuteVideo",value:function(e){var t;this._unMuteVideo!==e&&(this._unMuteVideo=e,this._unMuteVideo?this.beginRecvFrame(kB.VIDEO,TB.UNMUTE):null!==(t=this._stream)&&void 0!==t&&t.hasVideo&&this.stopRecvFrame(kB.VIDEO,IB.MUTE))}},{key:"setRemoteUnmuteVideo",value:function(e){var t;this._remoteUnmuteVideo!==e&&(this._remoteUnmuteVideo=e,this._remoteUnmuteVideo?this.beginRecvFrame(kB.VIDEO,TB.REMOTE_UNMUTE):null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(kB.VIDEO,IB.REMOTE_MUTE))}},{key:"setEnableVideo",value:function(e){this._enableVideo!==e&&(this._enableVideo=e,this._enableVideo?this.beginRecvFrame(kB.VIDEO,TB.ENABLE):this.stopRecvFrame(kB.VIDEO,IB.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(kB.AUDIO,TB.PUSH),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.beginRecvFrame(kB.AUDIO,TB.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(kB.VIDEO,TB.PUSH),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasVideo&&this.beginRecvFrame(kB.VIDEO,TB.PUSH)}},{key:"setPublishVideo",value:function(e){var t;this._publishVideo!==e&&(this._publishVideo=e),this._publishVideo&&this.beginRecvFrame(kB.VIDEO,TB.PUBLISH),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasVideo&&this.stopRecvFrame(kB.VIDEO,IB.UNPUBLISH)}},{key:"setPublishAudio",value:function(e){var t;this._publishAudio!==e&&(this._publishAudio=e),this._publishAudio&&this.beginRecvFrame(kB.AUDIO,TB.PUBLISH),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(kB.AUDIO,IB.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(kB.AUDIO,TB.SUBSCRIBE));!e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(kB.AUDIO,IB.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(kB.VIDEO,TB.SUBSCRIBE));!e&&null!==(t=this._stream)&&void 0!==t&&t.hasVideo&&this.stopRecvFrame(kB.VIDEO,IB.UNSUBSCRIBE)}},{key:"setPushTrack",value:function(e){var t;this._pushTrack!==e&&(e&&!this._isScreen&&this.beginRecvFrame(kB.AUDIO,TB.PUSH_TRACK),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(kB.AUDIO,IB.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,Vj(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(kB.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,Vj(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(kB.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,Vj(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:TB.LOGIN},this._currentVideoRecv={startTime:0,eventSessionId:0,type:TB.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}(),EW=function(){function e(t,r){u(this,e),h(this,"_audioEventSessionId",OP()),h(this,"_videoEventSessionId",OP()),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:TB.LOGIN}),h(this,"_currentVideoSend",{startTime:0,eventSessionId:0,type:TB.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===kB.AUDIO){var n;this._audioEventSessionId++,this._currentAudioSend={startTime:Date.now(),eventSessionId:this._audioEventSessionId,type:t};var i={media_type:e,event_type:bB.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(kB.AUDIO,IB.TIMEOUT),r._firstAudioFrameInterval&&window.clearInterval(r._firstAudioFrameInterval)}),this._timeout),PB.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===kB.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?kB.SCREEN_VIDEO:e,event_type:bB.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(kB.VIDEO,IB.TIMEOUT),r._firstVideoFrameInterval&&window.clearInterval(r._firstVideoFrameInterval)}),this._timeout),this._watchForFirstVideoFrameSend(),PB.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===kB.AUDIO){var r,n;if(1!==this._audioFirstFrameState)return;var i={event_type:bB.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,PB.rtcFirstFrame(i),this._audioFirstFrameState=2}else if(e===kB.VIDEO){var o,a,s;if(1!==this._videoFirstFrameState)return;var c={event_type:bB.SENT_END,media_type:null!==(o=this._stream)&&void 0!==o&&o.isScreen?kB.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,PB.rtcFirstFrame(c),this._videoFirstFrameState=2}}},{key:"sendFrameFinish",value:function(e){if(e===kB.AUDIO){if(1!==this._audioFirstFrameState)return;if(!this._currentAudioSend)return;var t=this._currentAudioSend,r=t.type,n=t.startTime,i={event_type:bB.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),PB.rtcFirstFrame(i),this._audioFirstFrameState=3}else if(e===kB.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:bB.SENT_END,media_type:null!==(o=this._stream)&&void 0!==o&&o.isScreen?kB.SCREEN_VIDEO:e,start:c,result:!0,event_session_id:this._videoEventSessionId,type:s};delete this._currentVideoSend,this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),PB.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(kB.VIDEO,TB.LOGIN),null!==(r=this._stream)&&void 0!==r&&r.audioTrack&&this.beginSendFrame(kB.AUDIO,TB.LOGIN);!e&&this._audioSending&&this.stopSendFrame(kB.AUDIO,IB.LEAVE_ROOM),!e&&this._videoSending&&this.stopSendFrame(kB.VIDEO,IB.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(kB.VIDEO,TB.PUBLISH),(null===(r=this._stream)||void 0===r?void 0:r.audioTrack)&&this.beginSendFrame(kB.AUDIO,TB.PUBLISH);!e&&this._audioSending&&this.stopSendFrame(kB.AUDIO,IB.UNPUBLISH),!e&&this._videoSending&&this.stopSendFrame(kB.VIDEO,IB.UNPUBLISH)}}},{key:"setUnmuteAudio",value:function(e){this._unMuteAudio!==e&&(this._unMuteAudio=e,e&&this.beginSendFrame(kB.AUDIO,TB.UNMUTE),!e&&this._audioSending&&this.stopSendFrame(kB.AUDIO,IB.MUTE))}},{key:"setEnableAudio",value:function(e){this._enableAudio!==e&&(this._enableAudio=e,e&&this.beginSendFrame(kB.AUDIO,TB.ENABLE),!e&&this._audioSending&&this.stopSendFrame(kB.AUDIO,IB.DISABLE))}},{key:"setUnmuteVideo",value:function(e){this._unMuteVideo!==e&&(this._unMuteVideo=e,e&&this.beginSendFrame(kB.VIDEO,TB.UNMUTE),!e&&this._videoSending&&this.stopSendFrame(kB.VIDEO,IB.MUTE))}},{key:"setEnableVideo",value:function(e){this._enableVideo!==e&&(this._enableVideo=e,e&&this.beginSendFrame(kB.VIDEO,TB.ENABLE),!e&&this._videoSending&&this.stopSendFrame(kB.VIDEO,IB.DISABLE))}},{key:"setExternalAudioSource",value:function(e){this._audioExternal!==e&&(this._audioExternal=e,e&&(this._audioSending&&this.stopSendFrame(kB.AUDIO,IB.DISABLE),this._enableAudio=!1),e||(this._audioSending&&this.stopSendFrame(kB.AUDIO,IB.STOP_PUSH),this._pushAudio=!1))}},{key:"setPushAudio",value:function(e){this._pushAudio!==e&&(this._pushAudio=e,e&&this.beginSendFrame(kB.AUDIO,TB.PUSH),!e&&this._audioSending&&this.stopSendFrame(kB.AUDIO,IB.STOP_PUSH))}},{key:"setExternalVideoSource",value:function(e){this._videoExternal!==e&&(this._videoExternal=e,e&&(this._videoSending&&this.stopSendFrame(kB.VIDEO,IB.DISABLE),this._enableVideo=!1),e||(this._videoSending&&this.stopSendFrame(kB.VIDEO,IB.STOP_PUSH),this._pushVideo=!1))}},{key:"setPushVideo",value:function(e){this._pushVideo!==e&&(this._pushVideo=e,e&&this.beginSendFrame(kB.VIDEO,TB.PUSH),!e&&this._videoSending&&this.stopSendFrame(kB.VIDEO,IB.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(kB.AUDIO,IB.AUDIENCE),!e&&this._videoSending&&this.stopSendFrame(kB.VIDEO,IB.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,Vj(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,Vj(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(kB.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(kB.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:TB.LOGIN},this._currentVideoSend={startTime:0,eventSessionId:0,type:TB.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}(),bW=(h(yW={},"audio",{delay:1200,stallRadio:.3}),h(yW,"video",{delay:1200,stallRadio:.6}),h(yW,"screen_audio",{delay:1600,stallRadio:.8}),h(yW,"screen_video",{delay:1600,stallRadio:.8}),yW),kW=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",pK.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,E=c.videoLossRate,b=c.stallDuration,T=c.statsInterval,I=c.e2eDelay,A=c._retransmittedRate,R=b/T,w=u?"screen_video":"video",C=this._getQosLevel(S,E||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!==pK.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=bW[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&&LP(t)&&r.localaudio&&r.audiostream,videoActive:n&&UP(t)&&r.localvideo&&r.videostream}}}]),e}(),TW=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}(),IW=new YL("Room",1),AW={audiostream:!0,extaudio:!1,extvideo:!1,localaudio:!0,localvideo:!1,videoDescriptions:[],videostream:!1},RW=function(e){f(M,e);var t,r,n,a,s,d,p,v,_,y,S,E,k,T,I,R,w,O,x,D,P=g(M);function M(e,t){var r;return u(this,M),h(m(r=P.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),"_videoSizeObserver",void 0),h(m(r),"_hasPublished",!1),h(m(r),"_csrcUserIdMap",void 0),h(m(r),"_publishOnDemandItem",void 0),h(m(r),"_publishOnDemandBusy",!1),r._roomConfig=e,r._mediaServerClient=new _K(t),r._reconnectRecord=new wW,r._addHandlerEventHandler(),r._isReconnecting=!1,r._networkQualityManager=new kW,r._networkQualityManager.reportor=r._reportNetworkQuality.bind(m(r)),r._videoSizeObserver=new TW(m(r)),r._videoSizeObserver.onchange=r._emitVideoSizeChange.bind(m(r)),r._context=t,r._csrcUserIdMap={},r}return l(M,[{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,E,b,k,T,I,A,R,w,C,O,x=this;null===(e=this._mediaServerClient)||void 0===e||e.on(hj.ON_ADD_STREAM,this._onAddStream.bind(this)),null===(t=this._mediaServerClient)||void 0===t||t.on(hj.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(hj.ON_REMOVE_STREAM,this._onRemoveStream.bind(this)),null===(n=this._mediaServerClient)||void 0===n||n.on(hj.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(hj.USER_CONNECTION,this._onUserConnection.bind(this)),null===(o=this._mediaServerClient)||void 0===o||o.on(hj.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(hj.USER_DISCONNECTION,this._onUserDisconnection.bind(this)),null===(s=this._mediaServerClient)||void 0===s||s.on(hj.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(hj.ON_UPDATE_ROOM_ATTRIBUTES,this._onUpdateRoomAttributes.bind(this)),null===(u=this._mediaServerClient)||void 0===u||u.on(hj.ON_UPDATE_USER_ATTRIBUTES,this._onUpdateUserAttributes.bind(this)),null===(d=this._mediaServerClient)||void 0===d||d.on(hj.ON_UPDATE_STREAM_ATTRIBUTES,this._onUpdateStreamAttributes.bind(this)),null===(l=this._mediaServerClient)||void 0===l||l.on(hj.ON_PUSH_TRACK,this._onPushTrack.bind(this)),null===(h=this._mediaServerClient)||void 0===h||h.on(hj.ON_REMOVE_TRACK,this._onRemoveTrack.bind(this)),null===(f=this._mediaServerClient)||void 0===f||f.on(hj.NODE_CHANGE,this._nodeChange.bind(this)),null===(p=this._mediaServerClient)||void 0===p||p.on(hj.ON_CUSTOM_MESSAGE,this._onCustomMessage.bind(this)),null===(v=this._mediaServerClient)||void 0===v||v.on(hj.USER_MESSAGE_RECEIVED,this._onUserMessageReceived.bind(this)),null===(_=this._mediaServerClient)||void 0===_||_.on(hj.USER_BINARY_MESSAGE_RECEIVED,this._onUserBinaryMessageReceived.bind(this)),null===(m=this._mediaServerClient)||void 0===m||m.on(hj.POST_PROCESSING_MESSAGE,this._onPostProcessingMessage.bind(this)),null===(y=this._mediaServerClient)||void 0===y||y.on(hj.ON_USER_TOKEN_WILL_EXPIRE,this._onUserTokenWillExpire.bind(this)),null===(g=this._mediaServerClient)||void 0===g||g.on(hj.STREAM_CONTROL_MESSAGE,this._onStreamControlMessage.bind(this)),null===(S=this._mediaServerClient)||void 0===S||S.on(hj.ON_SCENE_CONFIG,this._onSceneConfig.bind(this)),null===(E=this._mediaServerClient)||void 0===E||E.on(hj.ON_STREAM_FAILED,this._onStreamFailed.bind(this)),null===(b=this._mediaServerClient)||void 0===b||b.on(fj.RSCP,(function(e){!!e.find((function(e){var t,r,n;return null==e||null===(t=e.StreamIds)||void 0===t?void 0:t.includes(null===(r=x._localStream)||void 0===r||null===(n=r.stream)||void 0===n?void 0:n.id)}))&&(x._publishOnDemandItem=e,x._onPublishOnDemand())})),null===(k=this._mediaServerClient)||void 0===k||k.on(fj.RTT,this._onRTT.bind(this)),null===(T=this._mediaServerClient)||void 0===T||T.on(pj.ON_CONNECTION_STATE_CHANGE,this._onConnectionStateChange.bind(this)),null===(I=this._mediaServerClient)||void 0===I||I.on(pj.ABNORMAL_DISCONNECTION,this._handleAbnormalDisconnection.bind(this)),null===(A=this._mediaServerClient)||void 0===A||A.on(hj.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(iK.ON_REMOTE_STREAM_STATS,VP(e))})),null===(w=this._mediaServerClient)||void 0===w||w.on("onLocalStreamStats",(function(e){x._networkQualityManager.updateUplinkStats(e),x.emit(iK.ON_LOCAL_STREAM_STATS,VP(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:(D=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 UB.setStats({rtc_app_id:t,room_id:r,user_id:i.userId}),gW.setStats({rtc_session_id:t,rtc_room_id:r}),IW.print("join()"),e.abrupt("return",new Promise((function(e,o){var d,l,h=fP();u._joinResolveCallback=function(t){var r;PB.joinRoom(RB.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;PB.joinRoom(RB.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(),PB.joinRoom(RB.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 D.apply(this,arguments)})},{key:"_join",value:(x=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(),IW.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,PB.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 x.apply(this,arguments)})},{key:"publishScreen",value:(O=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(IW.print("publishScreen()"),this._localScreenStream||(this._localScreenStream=new jz,this._localScreenStream.isScreen=!0,this._mediaServerClient.handler&&(this._localScreenStream.observer=new EW(this._localScreenStream,this._mediaServerClient.handler))),s=!1,c=!1,u=!1,d=!1,!this._localScreenStream.videoTrack&&r?(r instanceof QH&&(c=!0),s=!0):this._localScreenStream.videoTrack&&!r&&(s=!1),!this._localScreenStream.audioTrack&&n?(n instanceof ZH&&(d=!0),u=!0):this._localScreenStream.audioTrack&&!n&&(u=!1),this._localScreenStream.videoTrack=r,this._localScreenStream.audioTrack=n,this._localScreenStream.videoEncodeConfig=t,i&&(LP(i)&&(this._localScreenStream.pubAudio=a===aK.PUB),UP(i)&&(this._localScreenStream.pubVideo=a===aK.PUB),IW.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 O.apply(this,arguments)})},{key:"updatePubScreenTrack",value:(w=c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(IW.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 w.apply(this,arguments)})},{key:"unpublishScreen",value:(R=c(o().mark((function e(){var t;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(IW.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 R.apply(this,arguments)})},{key:"liveControlMessage",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 IW.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 I.apply(this,arguments)})},{key:"publicStreamControlMessage",value:(T=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 T.apply(this,arguments)})},{key:"updateUserAttributes",value:(k=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return IW.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 k.apply(this,arguments)})},{key:"publish",value:(E=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],IW.print("publish","Invoke publish"),u=!1,this._localStream||(this._localStream=new jz,this._mediaServerClient.handler&&(this._localStream.observer=new EW(this._localStream,this._mediaServerClient.handler)),u=!0),this._localStream.videoTrack=n,this._localStream.audioTrack=i,this._localStream.videoEncodeConfig=t,this._localStream.enableSimulcast=r,a&&(LP(a)&&(this._localStream.pubAudio=s===aK.PUB),UP(a)&&(this._localStream.pubVideo=s===aK.PUB),IW.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 QH,p=this._localStream.audioTrack instanceof ZH,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(iK.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(iK.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 E.apply(this,arguments)})},{key:"updatePubTrack",value:(S=c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(IW.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 S.apply(this,arguments)})},{key:"unpublish",value:(y=c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(IW.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 y.apply(this,arguments)})},{key:"subscribe",value:(_=c(o().mark((function e(t,r,n){var i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return IW.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 _.apply(this,arguments)})},{key:"updateSubTrack",value:(v=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(IW.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 v.apply(this,arguments)})},{key:"updateSubVideoConfig",value:(p=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 p.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:(d=c(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return IW.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 d.apply(this,arguments)})},{key:"leave",value:(s=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],IW.print("leave","Invoke leave"),r=fP(),e.prev=3,this._mediaServerClient.connectionState!==pK.CONNECTED&&this._joinRejectCallback&&this._joinRejectCallback(new Error(wB.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(),PB.rtcLeaveRoom(0,"",fP()-r),UB.setStats({room_id:void 0,user_id:void 0,rtc_session_id:void 0}),gW.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&&PB.rtcLeaveRoom(-1,e.t0.message,fP()-r);case 25:case"end":return e.stop()}}),e,this,[[3,17]])}))),function(){return s.apply(this,arguments)})},{key:"updateRemoteUserPriority",value:function(e){var t,r=this;null===(t=this.remoteStreams.get(e))||void 0===t||t.forEach((function(e){e.streamState!==Bz.INIT&&r._mediaServerClient.subscribe(e,e.subMediaType)}))}},{key:"destroy",value:function(){IW.print("destroy","Invoke destroy"),PB.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=b(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 wW,this._removeHandlerEventHandler(),clearTimeout(this._connectionLostTimer),this._userDuplicateLoginTimerMap.forEach((function(e){clearTimeout(e)})),this._userDuplicateLoginTimerMap.clear(),this._networkQualityManager.destroy(),this._videoSizeObserver.destroy(),this._csrcUserIdMap={},this._virtualStreams=[],this._remoteStreamStreamIdUserIdMap={}}},{key:"updateToken",value:(a=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return IW.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 a.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(),UB.setStats({rtc_session_id:this._sessionId}),gW.setStats({rtc_session_id:this._sessionId})}},{key:"sendRoomMessage",value:(n=c(o().mark((function e(t){var r,n,i,a,s,c=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=c.length>1&&void 0!==c[1]&&c[1],s={clientId:null===(r=this._roomInfo)||void 0===r?void 0:r.userInfo.userId,binary:a,message:"",roomId:null===(n=this._roomInfo)||void 0===n?void 0:n.roomId},!a){e.next=8;break}return e.next=5,_P.ab2b64str(t);case 5:s.message=e.sent,e.next=9;break;case 8:s.message=t;case 9:return e.abrupt("return",null===(i=this._mediaServerClient)||void 0===i?void 0:i.sendRoomMessage(s));case 10:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"_destroyAndInitMediaServerClient",value:function(){IW.print("_destroyAndInitMediaServerClient()"),this._mediaServerClient&&(this._mediaServerClient.destroy(),this._removeHandlerEventHandler()),this._mediaServerClient=new _K(this._context),this._addHandlerEventHandler()}},{key:"_onJoinSucc",value:function(e,t){var r,n=this;IW.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(iK.ON_VIDEO_STREAM_BANNED,{uid:t.clientId,banned:1===t.attributes.serverMuteVideo}),t.attributes.serverMuteAudio&&n.safeEmit(iK.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:dj.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,IW.print("start resubscribe ".concat(r.userId," with ").concat(r.subMediaType)),t.next=6,e._mediaServerClient.subscribe(r,r.subMediaType);case 6:IW.print("success resubscribe ".concat(r.userId," with ").concat(r.subMediaType)),e.safeEmit(iK.RESUBSCRIBE,{stream:r}),t.next=15;break;case 10:t.prev=10,t.t0=t.catch(2),IW.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 Gz("ff-stream","ff-stream",!1,AW);s.virtual=!0,s.audioTransceiver=a,s.audioMid="0",s.audioTrack=fz(i),this._virtualStreams.push(s),this.safeEmit(iK.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,v)v.attributes=e.attributes;else if((v=new Gz(e.clientId,e.streamId,e.screen,e.attributes)).virtual=c,this._initStreamListeners(v),!c){var _=this._remoteStreams.get(e.clientId);_?_.push(v):this._remoteStreams.set(e.clientId,[v])}if(this._mediaServerClient.handler&&(v.observer=new SW(v,this._mediaServerClient.handler)),!v.isScreen&&l){var m,y,g,S,E,b,k,T;if(a&&v.hasVideo)if(v.attributes.extvideo)null===(m=v.observer)||void 0===m||m.setExternalVideoSource(!0),null===(y=v.observer)||void 0===y||y.setPushVideo(!0);else null===(g=v.observer)||void 0===g||g.setExternalVideoSource(!1),null===(S=v.observer)||void 0===S||S.setPublishVideo(!0);if(a&&v.hasAudio&&d&&!this._mediaServerClient.roomAttributes.multiChatMode)if(v.attributes.extaudio)null===(E=v.observer)||void 0===E||E.setExternalAudioSource(!0),null===(b=v.observer)||void 0===b||b.setPushAudio(!0);else null===(k=v.observer)||void 0===k||k.setExternalAudioSource(!1),null===(T=v.observer)||void 0===T||T.setPublishAudio(!0);if(!0===i&&!1===a){var I,A=this._roomConfig,R=A.isAutoSubscribeAudio,w=A.isAutoSubscribeVideo;null===(I=v.observer)||void 0===I||I.setLogin(!0,{audio:!!R,video:!!w})}}return i&&this.safeEmit(hj.ON_ADD_STREAM,{stream:v}),v}}},{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(hj.USER_CONNECTION,{userInfo:n}),e.attributes&&(e.attributes.serverMuteVideo&&this.safeEmit(iK.ON_VIDEO_STREAM_BANNED,{uid:e.clientId,banned:1===e.attributes.serverMuteVideo}),e.attributes.serverMuteAudio&&this.safeEmit(iK.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===vj.kickedByAdmin?a=dN.KICKED_OUT:i===vj.onUserTokenDidExpire?a=dN.TOKEN_EXPIRED:i===vj.userDuplicateLogin&&(a=dN.DUPLICATE_LOGIN),o===_j.roomDismissByAdmin&&(a=dN.ROOM_DISMISS),a&&this.safeEmit(iK.ON_ROOM_ERROR,{errorCode:a})}else{var s=C.DROPPED;i===vj.userLeave?s=C.QUIT:i===vj.kickedByAdmin?s=C.KICKED_BY_ADMIN:i===vj.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:dj.clientDisconnected})})),r._remoteStreams.delete(n),r.safeEmit(iK.ON_USER_LEAVE,{userInfo:{userId:n},reason:s})};if(i===vj.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(hj.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(iK.ON_VIDEO_STREAM_BANNED,{uid:e.clientId,banned:1===e.attributes.serverMuteVideo}),e.attributes.serverMuteAudio&&this.safeEmit(iK.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=kz.NONE,S=kz.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(iK.ON_USER_PUBLISH_STATE_CHANGE,{userId:o,mediaType:g,isScreen:c.isScreen,pubState:aK.PUB,remoteStream:c}),S&&this.safeEmit(iK.ON_USER_PUBLISH_STATE_CHANGE,{userId:o,mediaType:S,isScreen:c.isScreen,pubState:aK.UNPUB,remoteStream:c}),c.attributes=h,h.localaudio!==l.localaudio)if(h.localaudio){var E,b,k,T;if(r)if(h.extaudio)null===(E=c.observer)||void 0===E||E.setExternalAudioSource(!0),null===(b=c.observer)||void 0===b||b.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(iK.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(iK.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(iK.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(iK.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,r=this;if(null!==(t=e.streamId)&&void 0!==t&&t.startsWith("audio_mux")){var n=this._onAddStream(i(i({},e),{},{attributes:AW}),{needEmit:!1,fromSignal:!1,virtual:!0});n&&this._mediaServerClient.subscribe4pushTrack(n,e).then((function(){r.safeEmit(iK.SUBSCRIBE_PUSH_TRACK,{stream:n}),r._virtualStreams.push(n)})).catch((function(e){IW.print("subscribe","push track failed %o",e)}))}else PB.rtcError("onPushTrack, userId: ".concat(e.clientId,", ").concat(e.streamId),-1001)}},{key:"_onRemoveTrack",value:function(e){var t,r=e.clientId,n=e.streamId,i=e.message;IW.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=b(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;ZB.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,PB.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()}PB.rtcReconnect(1002,rB.PEERCONNECTION_RECONNECTING,this._roomInfo.userInfo.userId,nB.PEERCONNECTION),this._liveTranscodingOnceSucc||delete this._liveControlMessage,this._join((function(){PB.rtcReconnected(iB.PEERCONNECTION_RECONNECTED,oB.PEERCONNECTION)}),(function(t){e._reconnectRecord.record(t),e._reconnectRecord.shouldReconnect?(IW.print("Reconnecting error, will reconnect after 3s",t),e._reconnectTimer=window.setTimeout(e._reconnect.bind(e),3e3)):(e.safeEmit(iK.RECONNECT_FAILED),e.destroy())}),!0)}},{key:"_handleAbnormalDisconnection",value:function(){IW.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===pK.DISCONNECTED)t=F.CONNECTION_STATE_DISCONNECTED;else if(e.next===pK.CONNECTED)clearTimeout(this._connectionLostTimer),t=this._isReconnecting?F.CONNECTION_STATE_RECONNECTED:F.CONNECTION_STATE_CONNECTED;else{if(e.next!==pK.CONNECTING)return;t=this._isReconnecting?F.CONNECTION_STATE_RECONNECTING:F.CONNECTION_STATE_CONNECTING}e.prev===pK.CONNECTED&&e.next===pK.DISCONNECTED&&(this._connectionLostTimer=window.setTimeout((function(){r.safeEmit(pj.ON_CONNECTION_STATE_CHANGE,{state:F.CONNECTION_STATE_LOST})}),1e4)),this._networkQualityManager.setConnectionState(e.next),this.safeEmit(pj.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(iK.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(hj.ON_CUSTOM_MESSAGE,e)}},{key:"_onUserMessageReceived",value:function(e){this.safeEmit(hj.USER_MESSAGE_RECEIVED,{userId:e.from,message:e.msg})}},{key:"_onUserBinaryMessageReceived",value:function(e){this.safeEmit(hj.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=oK.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=oK.START_FAILED);break;case"TranscodeStateChanged":n=0!==t.error?oK.START_FAILED:oK.START_SUCCESS;break;case"TranscodeStopped":n=0!==t.error?oK.STOP_FAILED:oK.STOP_SUCCESS;break;case"TranscodeUpdated":n=0!==t.error?oK.UPDATE_FAILED:oK.UPDATE_SUCCESS}this.safeEmit(hj.POST_PROCESSING_MESSAGE,{code:r,protocol:t.protocol,error:t.error,eventType:n,message:i[r]})}this.safeEmit(hj.POST_PROCESSING_MESSAGE,{code:r,message:i[r],type:e.type})}}},{key:"_onUserTokenWillExpire",value:function(){this.safeEmit(hj.ON_USER_TOKEN_WILL_EXPIRE,null)}},{key:"_onSceneConfig",value:function(e){try{var t=e.multiSceneConfig,r=cK[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:(r=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(iK.RESUBSCRIBE,{stream:d});case 20:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"_onStreamControlMessage",value:function(e){var t,r;e.type===lj.PushLimitWarn&&(null!==(t=this._localStream)&&void 0!==t&&t.pubAudio||null!==(r=this._localStream)&&void 0!==r&&r.pubVideo||this.unpublish())}},{key:"_onPublishOnDemand",value:(t=c(o().mark((function e(){var t,r,n,i,a,s,c,u,d,l,h,f;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._publishOnDemandBusy&&!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)){e.next=2;break}return e.abrupt("return");case 2:if(s=this._publishOnDemandItem,this._publishOnDemandItem=void 0,s){e.next=6;break}return e.abrupt("return");case 6:if(null===(i=this._localStream)||void 0===i||!i.enableSimulcast||null===(a=this._localStream)||void 0===a||!a.videoTransceiver){e.next=15;break}return this._publishOnDemandBusy=!0,d=null===(c=this._localStream)||void 0===c?void 0:c.stream.id,l=null===(u=this._localStream)||void 0===u?void 0:u.videoTransceiver.sender,h=l.getParameters(),Array.isArray(h.encodings)&&Array.isArray(s)&&(f={},IW.print("_onPublishOnDemand exec","usedDescriptions: %o",s),s.forEach((function(e){var t;if(null!=e&&null!==(t=e.StreamIds)&&void 0!==t&&t.includes(d)){var r=null==e?void 0:e.Metadata.VideoIndex;f[r]=!0}})),h.encodings=h.encodings.map((function(e){return e.rid&&(f[e.rid]?e.active=!0:e.active=!1),e}))),e.next=14,l.setParameters(h);case 14:this._publishOnDemandBusy=!1;case 15:this._onPublishOnDemand();case 16:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{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.emit(iK.ON_NETWORK_QUALITY,e,t)}},{key:"_emitVideoSizeChange",value:function(e,t,r,n){var i;this.emit(iK.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:"multiChatMode",get:function(){var e;return null===(e=this._mediaServerClient)||void 0===e?void 0:e.multiChatMode()}}]),M}(ZL),wW=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}(),CW=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=b(e,2),n=t[0],i=t[1];"muted"===n?r.muted=!0:r.setAttribute(n,i)})),r},OW=new YL("Player",0),xW=["play","playing","pause","ended","error","seeking","seeked","waiting","canplay","canplaythrough","durationchange","volumechange","loadedmetadata","loadeddata","loadstart","timeupdate"],DW={playsinline:"","webkit-playsinline":""},NW={playsinline:"","webkit-playsinline":"","x5-playsinline":"","x5-video-player-type":"h5","x-webkit-airplay":"allow",preload:"",muted:""},PW=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"canplay":case"loadeddata":t._internalPlay();break;case"playing":OW.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||("AbortError"!==e.name?(t._emitPlayFailed=!0,PB.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})):PB.rtcError("video autoplay failed, userId: ".concat(t.userId,", ").concat(e.name),-1e3))}))}}));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(),gP&&15===bP&&(t._safari15VideoTimer=window.setInterval((function(){try{t._videoContainer.style.display="block",setTimeout((function(){t._videoContainer.style.display="flex"}),500)}catch(y0){}}),5e3)),t}return l(n,[{key:"_initVideo",value:function(){this._videoDom||(this._videoDom=CW("video",{style:{width:"100%",height:"100%"},attributes:NW}),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&&xW.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&&xW.forEach((function(t){var r;null===(r=e._videoDom)||void 0===r||r.removeEventListener(t,e.emitVideoEvent)}))}},{key:"_recordFrame",value:function(e){var t=this,r=e.isScreen?1.5:.5;if(gP){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,OW.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{PB.rtcInvokeStatus("play video repeatedly",0,"playVideo",this.userId,0)}catch(y0){}return e.abrupt("return");case 5:a||(this._initVideo(),a=this._videoDom),OW.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(OW.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||IP?this._videoDom.play():Promise.resolve()}},{key:"mirror",value:function(e){OW.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;(OW.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(){OW.print("destroy","video player: ".concat(this.userId)),this.stop(),E(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}(BL.exports.EventEmitter),MW=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&&OW.print("AudioPlayerPlaying","[userId-".concat(t.userId,"] audio element playing")),"pause"===e.type&&OW.print("AudioPlayerPause","[userId-".concat(t.userId,"] audio element pause")),AP&&IP&&("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(zB("_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),PB.rtcError("audio autoplay failed, userId: ".concat(t.userId,": ").concat(e.message," ").concat(e.name),-1e3)})).then((function(){zB("_internalPlay successfully",{userId:t.userId})}))}catch(i){t._autoPlayError(i),PB.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=CW("audio",{style:{display:"none"},attributes:DW}),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&&xW.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&&(xW.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(OW.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(OW.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 OW.print("setPlaybackDevice","setPlaybackDevice: ".concat(t)),e.next=3,PH.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;OW.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(){OW.print("destroy","audio player: ".concat(this.userId)),this.stop(),E(p(i.prototype),"removeAllListeners",this).call(this),this._removeListeners(),this._audioDom&&(this._audioDom.srcObject=null,delete this._audioDom)}}]),i}(BL.exports.EventEmitter);function LW(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 PW&&a.videoTrack&&t.playVideo(a.videoTrack,a),t instanceof MW&&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 UW=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;PB.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===gj.NO_RECEIVER?e.dc_fail_no_receiver++:t.err===gj.NO_RELAYPATH?e.dc_fail_no_relay_path++:t.err===gj.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,CB.P2P,t)}},{key:"recvP2PMessage",value:function(e){this._recvUserMessage(e,CB.P2P)}},{key:"sendP2PFail",value:function(e,t){this._sendUserFail(e,CB.P2P,t)}},{key:"sendP2PAck",value:function(e,t,r,n){this._sendUserAck(e,CB.P2P,t,r,n)}},{key:"sendP2POutRoomMessage",value:function(e,t){this._sendUserMessage(e,CB.P2P_OUTSIDE_ROOM,t)}},{key:"recvP2POutRoomMessage",value:function(e){this._recvUserMessage(e,CB.P2P_OUTSIDE_ROOM)}},{key:"sendP2POutRoomFail",value:function(e,t){this._sendUserFail(e,CB.P2P_OUTSIDE_ROOM,t)}},{key:"sendP2POutRoomAck",value:function(e,t,r,n){this._sendUserAck(e,CB.P2P_OUTSIDE_ROOM,t,r,n)}},{key:"sendP2serverMessage",value:function(e){this._sendUserMessage("",CB.P2SERVER,e)}},{key:"sendP2serverFail",value:function(e){this._sendUserFail("",CB.P2SERVER,e)}},{key:"sendP2serveAck",value:function(e){this._sendUserAck("",CB.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}(),VW="object"==typeof global&&global&&global.Object===Object&&global,FW="object"==typeof self&&self&&self.Object===Object&&self,BW=VW||FW||Function("return this")(),jW=BW.Symbol,GW=Object.prototype,HW=GW.hasOwnProperty,zW=GW.toString,KW=jW?jW.toStringTag:void 0;var XW=Object.prototype.toString;var qW=jW?jW.toStringTag:void 0;function WW(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":qW&&qW in Object(e)?function(e){var t=HW.call(e,KW),r=e[KW];try{e[KW]=void 0;var n=!0}catch(o){}var i=zW.call(e);return n&&(t?e[KW]=r:delete e[KW]),i}(e):function(e){return XW.call(e)}(e)}function YW(e){return null!=e&&"object"==typeof e}var JW=Array.isArray;function QW(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function ZW(e){return e}function $W(e){if(!QW(e))return!1;var t=WW(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}var eY,tY=BW["__core-js_shared__"],rY=(eY=/[^.]+$/.exec(tY&&tY.keys&&tY.keys.IE_PROTO||""))?"Symbol(src)_1."+eY:"";var nY=Function.prototype.toString;var iY=/^\[object .+?Constructor\]$/,oY=Function.prototype,aY=Object.prototype,sY=oY.toString,cY=aY.hasOwnProperty,uY=RegExp("^"+sY.call(cY).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function dY(e){return!(!QW(e)||(t=e,rY&&rY in t))&&($W(e)?uY:iY).test(function(e){if(null!=e){try{return nY.call(e)}catch(t){}try{return e+""}catch(t){}}return""}(e));var t}function lY(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 hY=Date.now;var fY,pY,vY,_Y=function(){try{var e=dY(t=function(e,t){return null==e?void 0:e[t]}(Object,"defineProperty"))?t:void 0;return e({},"",{}),e}catch(r){}var t}(),mY=_Y,yY=mY?function(e,t){return mY(e,"toString",{configurable:!0,enumerable:!1,value:(r=t,function(){return r}),writable:!0});var r}:ZW,gY=(fY=yY,pY=0,vY=0,function(){var e=hY(),t=16-(e-vY);if(vY=e,t>0){if(++pY>=800)return arguments[0]}else pY=0;return fY.apply(void 0,arguments)}),SY=gY,EY=/^(?:0|[1-9]\d*)$/;function bY(e,t){var r=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==r||"symbol"!=r&&EY.test(e))&&e>-1&&e%1==0&&e<t}function kY(e,t,r){"__proto__"==t&&mY?mY(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function TY(e,t){return e===t||e!=e&&t!=t}var IY=Object.prototype.hasOwnProperty;function AY(e,t,r){var n=e[t];IY.call(e,t)&&TY(n,r)&&(void 0!==r||t in e)||kY(e,t,r)}var RY=Math.max;function wY(e,t){return SY(function(e,t,r){return t=RY(void 0===t?e.length-1:t,0),function(){for(var n=arguments,i=-1,o=RY(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),lY(e,this,s)}}(e,t,ZW),e+"")}function CY(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function OY(e){return null!=e&&CY(e.length)&&!$W(e)}var xY=Object.prototype;function DY(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||xY)}function NY(e){return YW(e)&&"[object Arguments]"==WW(e)}var PY=Object.prototype,MY=PY.hasOwnProperty,LY=PY.propertyIsEnumerable,UY=NY(function(){return arguments}())?NY:function(e){return YW(e)&&MY.call(e,"callee")&&!LY.call(e,"callee")},VY=UY;var FY="object"==typeof exports&&exports&&!exports.nodeType&&exports,BY=FY&&"object"==typeof module&&module&&!module.nodeType&&module,jY=BY&&BY.exports===FY?BW.Buffer:void 0,GY=(jY?jY.isBuffer:void 0)||function(){return!1},HY={};HY["[object Float32Array]"]=HY["[object Float64Array]"]=HY["[object Int8Array]"]=HY["[object Int16Array]"]=HY["[object Int32Array]"]=HY["[object Uint8Array]"]=HY["[object Uint8ClampedArray]"]=HY["[object Uint16Array]"]=HY["[object Uint32Array]"]=!0,HY["[object Arguments]"]=HY["[object Array]"]=HY["[object ArrayBuffer]"]=HY["[object Boolean]"]=HY["[object DataView]"]=HY["[object Date]"]=HY["[object Error]"]=HY["[object Function]"]=HY["[object Map]"]=HY["[object Number]"]=HY["[object Object]"]=HY["[object RegExp]"]=HY["[object Set]"]=HY["[object String]"]=HY["[object WeakMap]"]=!1;var zY="object"==typeof exports&&exports&&!exports.nodeType&&exports,KY=zY&&"object"==typeof module&&module&&!module.nodeType&&module,XY=KY&&KY.exports===zY&&VW.process,qY=function(){try{var e=KY&&KY.require&&KY.require("util").types;return e||XY&&XY.binding&&XY.binding("util")}catch(t){}}(),WY=qY&&qY.isTypedArray,YY=WY?function(e){return function(t){return e(t)}}(WY):function(e){return YW(e)&&CY(e.length)&&!!HY[WW(e)]},JY=YY,QY=Object.prototype.hasOwnProperty;function ZY(e,t){var r=JW(e),n=!r&&VY(e),i=!r&&!n&&GY(e),o=!r&&!n&&!i&&JY(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&&!QY.call(e,u)||a&&("length"==u||i&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||bY(u,c))||s.push(u);return s}var $Y=function(e,t){return function(r){return e(t(r))}}(Object.keys,Object),eJ=$Y,tJ=Object.prototype.hasOwnProperty;function rJ(e){return OY(e)?ZY(e):function(e){if(!DY(e))return eJ(e);var t=[];for(var r in Object(e))tJ.call(e,r)&&"constructor"!=r&&t.push(r);return t}(e)}var nJ=Object.prototype.hasOwnProperty;function iJ(e){if(!QW(e))return function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t}(e);var t=DY(e),r=[];for(var n in e)("constructor"!=n||!t&&nJ.call(e,n))&&r.push(n);return r}var oJ,aJ=(oJ=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?kY(r,s,c):AY(r,s,c)}}(t,function(e){return OY(e)?ZY(e,!0):iJ(e)}(t),e)},wY((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=oJ.length>3&&"function"==typeof i?(n--,i):void 0,o&&function(e,t,r){if(!QW(r))return!1;var n=typeof t;return!!("number"==n?OY(r)&&bY(t,r.length):"string"==n&&t in r)&&TY(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&&oJ(e,a,r,i)}return e})));function sJ(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 cJ(e){return null==e?[]:sJ(e,rJ(e))}var uJ=de,dJ=sr("iterator"),lJ=!uJ((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[dJ]||"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})),hJ=Re,fJ=2147483647,pJ=/[^\0-\u007E]/,vJ=/[.\u3002\uFF0E\uFF61]/g,_J="Overflow: input needs wider integers to process",mJ=RangeError,yJ=hJ(vJ.exec),gJ=Math.floor,SJ=String.fromCharCode,EJ=hJ("".charCodeAt),bJ=hJ([].join),kJ=hJ([].push),TJ=hJ("".replace),IJ=hJ("".split),AJ=hJ("".toLowerCase),RJ=function(e){return e+22+75*(e<26)},wJ=function(e,t,r){var n=0;for(e=r?gJ(e/700):e>>1,e+=gJ(e/t);e>455;)e=gJ(e/35),n+=36;return gJ(n+36*e/(e+38))},CJ=function(e){var t=[];e=function(e){for(var t=[],r=0,n=e.length;r<n;){var i=EJ(e,r++);if(i>=55296&&i<=56319&&r<n){var o=EJ(e,r++);56320==(64512&o)?kJ(t,((1023&i)<<10)+(1023&o)+65536):(kJ(t,i),r--)}else kJ(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&&kJ(t,SJ(n));var c=t.length,u=c;for(c&&kJ(t,"-");u<i;){var d=fJ;for(r=0;r<e.length;r++)(n=e[r])>=o&&n<d&&(d=n);var l=u+1;if(d-o>gJ((fJ-a)/l))throw mJ(_J);for(a+=(d-o)*l,o=d,r=0;r<e.length;r++){if((n=e[r])<o&&++a>fJ)throw mJ(_J);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;kJ(t,SJ(RJ(p+v%_))),h=gJ(v/_),f+=36}kJ(t,SJ(RJ(h))),s=wJ(a,l,u==c),a=0,u++}}a++,o++}return bJ(t,"")},OJ=ro,xJ=ce,DJ=ve,NJ=Re,PJ=le,MJ=lJ,LJ=$n,UJ=jh,VJ=ed,FJ=sd,BJ=Ln,jJ=ph,GJ=qe,HJ=Kt,zJ=ga,KJ=So,XJ=Fr,qJ=Je,WJ=As,YJ=cs,JJ=be,QJ=ql,ZJ=Bl,$J=x_,eQ=PI,tQ=sr("iterator"),rQ="URLSearchParams",nQ="URLSearchParamsIterator",iQ=BJ.set,oQ=BJ.getterFor(rQ),aQ=BJ.getterFor(nQ),sQ=Object.getOwnPropertyDescriptor,cQ=function(e){if(!PJ)return xJ[e];var t=sQ(xJ,e);return t&&t.value},uQ=cQ("fetch"),dQ=cQ("Request"),lQ=cQ("Headers"),hQ=dQ&&dQ.prototype,fQ=lQ&&lQ.prototype,pQ=xJ.RegExp,vQ=xJ.TypeError,_Q=xJ.decodeURIComponent,mQ=xJ.encodeURIComponent,yQ=NJ("".charAt),gQ=NJ([].join),SQ=NJ([].push),EQ=NJ("".replace),bQ=NJ([].shift),kQ=NJ([].splice),TQ=NJ("".split),IQ=NJ("".slice),AQ=/\+/g,RQ=Array(4),wQ=function(e){return RQ[e-1]||(RQ[e-1]=pQ("((?:%[\\da-f]{2}){"+e+"})","gi"))},CQ=function(e){try{return _Q(e)}catch(y0){return e}},OQ=function(e){var t=EQ(e,AQ," "),r=4;try{return _Q(t)}catch(y0){for(;r;)t=EQ(t,wQ(r--),CQ);return t}},xQ=/[!'()~]|%20/g,DQ={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},NQ=function(e){return DQ[e]},PQ=function(e){return EQ(mQ(e),xQ,NQ)},MQ=FJ((function(e,t){iQ(this,{type:nQ,iterator:QJ(oQ(e).entries),kind:t})}),"Iterator",(function(){var e=aQ(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),LQ=function(e){this.entries=[],this.url=null,void 0!==e&&(qJ(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===yQ(e,0)?IQ(e,1):e:WJ(e)))};LQ.prototype={type:rQ,bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t,r,n,i,o,a,s,c=ZJ(e);if(c)for(r=(t=QJ(e,c)).next;!(n=DJ(r,t)).done;){if(o=(i=QJ(XJ(n.value))).next,(a=DJ(o,i)).done||(s=DJ(o,i)).done||!DJ(o,i).done)throw vQ("Expected sequence with length 2");SQ(this.entries,{key:WJ(a.value),value:WJ(s.value)})}else for(var u in e)HJ(e,u)&&SQ(this.entries,{key:u,value:WJ(e[u])})},parseQuery:function(e){if(e)for(var t,r,n=TQ(e,"&"),i=0;i<n.length;)(t=n[i++]).length&&(r=TQ(t,"="),SQ(this.entries,{key:OQ(bQ(r)),value:OQ(gQ(r,"="))}))},serialize:function(){for(var e,t=this.entries,r=[],n=0;n<t.length;)e=t[n++],SQ(r,PQ(e.key)+"="+PQ(e.value));return gQ(r,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var UQ=function(){jJ(this,VQ);var e=arguments.length>0?arguments[0]:void 0;iQ(this,new LQ(e))},VQ=UQ.prototype;if(UJ(VQ,{append:function(e,t){$J(arguments.length,2);var r=oQ(this);SQ(r.entries,{key:WJ(e),value:WJ(t)}),r.updateURL()},delete:function(e){$J(arguments.length,1);for(var t=oQ(this),r=t.entries,n=WJ(e),i=0;i<r.length;)r[i].key===n?kQ(r,i,1):i++;t.updateURL()},get:function(e){$J(arguments.length,1);for(var t=oQ(this).entries,r=WJ(e),n=0;n<t.length;n++)if(t[n].key===r)return t[n].value;return null},getAll:function(e){$J(arguments.length,1);for(var t=oQ(this).entries,r=WJ(e),n=[],i=0;i<t.length;i++)t[i].key===r&&SQ(n,t[i].value);return n},has:function(e){$J(arguments.length,1);for(var t=oQ(this).entries,r=WJ(e),n=0;n<t.length;)if(t[n++].key===r)return!0;return!1},set:function(e,t){$J(arguments.length,1);for(var r,n=oQ(this),i=n.entries,o=!1,a=WJ(e),s=WJ(t),c=0;c<i.length;c++)(r=i[c]).key===a&&(o?kQ(i,c--,1):(o=!0,r.value=s));o||SQ(i,{key:a,value:s}),n.updateURL()},sort:function(){var e=oQ(this);eQ(e.entries,(function(e,t){return e.key>t.key?1:-1})),e.updateURL()},forEach:function(e){for(var t,r=oQ(this).entries,n=zJ(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 MQ(this,"keys")},values:function(){return new MQ(this,"values")},entries:function(){return new MQ(this,"entries")}},{enumerable:!0}),LJ(VQ,tQ,VQ.entries,{name:"entries"}),LJ(VQ,"toString",(function(){return oQ(this).serialize()}),{enumerable:!0}),VJ(UQ,rQ),OJ({global:!0,constructor:!0,forced:!MJ},{URLSearchParams:UQ}),!MJ&&GJ(lQ)){var FQ=NJ(fQ.has),BQ=NJ(fQ.set),jQ=function(e){if(qJ(e)){var t,r=e.body;if(KJ(r)===rQ)return t=e.headers?new lQ(e.headers):new lQ,FQ(t,"content-type")||BQ(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),YJ(e,{body:JJ(0,WJ(r)),headers:JJ(0,t)})}return e};if(GJ(uQ)&&OJ({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(e){return uQ(e,arguments.length>1?jQ(arguments[1]):{})}}),GJ(dQ)){var GQ=function(e){return jJ(this,hQ),new dQ(e,arguments.length>1?jQ(arguments[1]):{})};hQ.constructor=GQ,GQ.prototype=hQ,OJ({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:GQ})}}var HQ,zQ=ro,KQ=le,XQ=lJ,qQ=ce,WQ=ga,YQ=Re,JQ=$n,QQ=Og,ZQ=ph,$Q=Kt,eZ=Gp,tZ=QN,rZ=rl,nZ=Qc.codeAt,iZ=function(e){var t,r,n=[],i=IJ(TJ(AJ(e),vJ,"."),".");for(t=0;t<i.length;t++)r=i[t],kJ(n,yJ(pJ,r)?"xn--"+CJ(r):r);return bJ(n,".")},oZ=As,aZ=ed,sZ=x_,cZ={URLSearchParams:UQ,getState:oQ},uZ=Ln,dZ=uZ.set,lZ=uZ.getterFor("URL"),hZ=cZ.URLSearchParams,fZ=cZ.getState,pZ=qQ.URL,vZ=qQ.TypeError,_Z=qQ.parseInt,mZ=Math.floor,yZ=Math.pow,gZ=YQ("".charAt),SZ=YQ(/./.exec),EZ=YQ([].join),bZ=YQ(1..toString),kZ=YQ([].pop),TZ=YQ([].push),IZ=YQ("".replace),AZ=YQ([].shift),RZ=YQ("".split),wZ=YQ("".slice),CZ=YQ("".toLowerCase),OZ=YQ([].unshift),xZ="Invalid scheme",DZ="Invalid host",NZ="Invalid port",PZ=/[a-z]/i,MZ=/[\d+-.a-z]/i,LZ=/\d/,UZ=/^0x/i,VZ=/^[0-7]+$/,FZ=/^\d+$/,BZ=/^[\da-f]+$/i,jZ=/[\0\t\n\r #%/:<>?@[\\\]^|]/,GZ=/[\0\t\n\r #/:<>?@[\\\]^|]/,HZ=/^[\u0000-\u0020]+|[\u0000-\u0020]+$/g,zZ=/[\t\n\r]/g,KZ=function(e){var t,r,n,i;if("number"==typeof e){for(t=[],r=0;r<4;r++)OZ(t,e%256),e=mZ(e/256);return EZ(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+=bZ(e[r],16),r<7&&(t+=":")));return"["+t+"]"}return e},XZ={},qZ=eZ({},XZ,{" ":1,'"':1,"<":1,">":1,"`":1}),WZ=eZ({},qZ,{"#":1,"?":1,"{":1,"}":1}),YZ=eZ({},WZ,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),JZ=function(e,t){var r=nZ(e,0);return r>32&&r<127&&!$Q(t,e)?e:encodeURIComponent(e)},QZ={ftp:21,file:null,http:80,https:443,ws:80,wss:443},ZZ=function(e,t){var r;return 2==e.length&&SZ(PZ,gZ(e,0))&&(":"==(r=gZ(e,1))||!t&&"|"==r)},$Z=function(e){var t;return e.length>1&&ZZ(wZ(e,0,2))&&(2==e.length||"/"===(t=gZ(e,2))||"\\"===t||"?"===t||"#"===t)},e$=function(e){return"."===e||"%2e"===CZ(e)},t$={},r$={},n$={},i$={},o$={},a$={},s$={},c$={},u$={},d$={},l$={},h$={},f$={},p$={},v$={},_$={},m$={},y$={},g$={},S$={},E$={},b$=function(e,t,r){var n,i,o,a=oZ(e);if(t){if(i=this.parse(a))throw vZ(i);this.searchParams=null}else{if(void 0!==r&&(n=new b$(r,!0)),i=this.parse(a,null,n))throw vZ(i);(o=fZ(new hZ)).bindURL(this),this.searchParams=o}};b$.prototype={type:"URL",parse:function(e,t,r){var n,i,o,a,s,c=this,u=t||t$,d=0,l="",h=!1,f=!1,p=!1;for(e=oZ(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=IZ(e,HZ,"")),e=IZ(e,zZ,""),n=tZ(e);d<=n.length;){switch(i=n[d],u){case t$:if(!i||!SZ(PZ,i)){if(t)return xZ;u=n$;continue}l+=CZ(i),u=r$;break;case r$:if(i&&(SZ(MZ,i)||"+"==i||"-"==i||"."==i))l+=CZ(i);else{if(":"!=i){if(t)return xZ;l="",u=n$,d=0;continue}if(t&&(c.isSpecial()!=$Q(QZ,l)||"file"==l&&(c.includesCredentials()||null!==c.port)||"file"==c.scheme&&!c.host))return;if(c.scheme=l,t)return void(c.isSpecial()&&QZ[c.scheme]==c.port&&(c.port=null));l="","file"==c.scheme?u=p$:c.isSpecial()&&r&&r.scheme==c.scheme?u=i$:c.isSpecial()?u=c$:"/"==n[d+1]?(u=o$,d++):(c.cannotBeABaseURL=!0,TZ(c.path,""),u=g$)}break;case n$:if(!r||r.cannotBeABaseURL&&"#"!=i)return xZ;if(r.cannotBeABaseURL&&"#"==i){c.scheme=r.scheme,c.path=rZ(r.path),c.query=r.query,c.fragment="",c.cannotBeABaseURL=!0,u=E$;break}u="file"==r.scheme?p$:a$;continue;case i$:if("/"!=i||"/"!=n[d+1]){u=a$;continue}u=u$,d++;break;case o$:if("/"==i){u=d$;break}u=y$;continue;case a$:if(c.scheme=r.scheme,i==HQ)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=rZ(r.path),c.query=r.query;else if("/"==i||"\\"==i&&c.isSpecial())u=s$;else if("?"==i)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=rZ(r.path),c.query="",u=S$;else{if("#"!=i){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=rZ(r.path),c.path.length--,u=y$;continue}c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=rZ(r.path),c.query=r.query,c.fragment="",u=E$}break;case s$:if(!c.isSpecial()||"/"!=i&&"\\"!=i){if("/"!=i){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,u=y$;continue}u=d$}else u=u$;break;case c$:if(u=u$,"/"!=i||"/"!=gZ(l,d+1))continue;d++;break;case u$:if("/"!=i&&"\\"!=i){u=d$;continue}break;case d$:if("@"==i){h&&(l="%40"+l),h=!0,o=tZ(l);for(var v=0;v<o.length;v++){var _=o[v];if(":"!=_||p){var m=JZ(_,YZ);p?c.password+=m:c.username+=m}else p=!0}l=""}else if(i==HQ||"/"==i||"?"==i||"#"==i||"\\"==i&&c.isSpecial()){if(h&&""==l)return"Invalid authority";d-=tZ(l).length+1,l="",u=l$}else l+=i;break;case l$:case h$:if(t&&"file"==c.scheme){u=_$;continue}if(":"!=i||f){if(i==HQ||"/"==i||"?"==i||"#"==i||"\\"==i&&c.isSpecial()){if(c.isSpecial()&&""==l)return DZ;if(t&&""==l&&(c.includesCredentials()||null!==c.port))return;if(a=c.parseHost(l))return a;if(l="",u=m$,t)return;continue}"["==i?f=!0:"]"==i&&(f=!1),l+=i}else{if(""==l)return DZ;if(a=c.parseHost(l))return a;if(l="",u=f$,t==h$)return}break;case f$:if(!SZ(LZ,i)){if(i==HQ||"/"==i||"?"==i||"#"==i||"\\"==i&&c.isSpecial()||t){if(""!=l){var y=_Z(l,10);if(y>65535)return NZ;c.port=c.isSpecial()&&y===QZ[c.scheme]?null:y,l=""}if(t)return;u=m$;continue}return NZ}l+=i;break;case p$:if(c.scheme="file","/"==i||"\\"==i)u=v$;else{if(!r||"file"!=r.scheme){u=y$;continue}if(i==HQ)c.host=r.host,c.path=rZ(r.path),c.query=r.query;else if("?"==i)c.host=r.host,c.path=rZ(r.path),c.query="",u=S$;else{if("#"!=i){$Z(EZ(rZ(n,d),""))||(c.host=r.host,c.path=rZ(r.path),c.shortenPath()),u=y$;continue}c.host=r.host,c.path=rZ(r.path),c.query=r.query,c.fragment="",u=E$}}break;case v$:if("/"==i||"\\"==i){u=_$;break}r&&"file"==r.scheme&&!$Z(EZ(rZ(n,d),""))&&(ZZ(r.path[0],!0)?TZ(c.path,r.path[0]):c.host=r.host),u=y$;continue;case _$:if(i==HQ||"/"==i||"\\"==i||"?"==i||"#"==i){if(!t&&ZZ(l))u=y$;else if(""==l){if(c.host="",t)return;u=m$}else{if(a=c.parseHost(l))return a;if("localhost"==c.host&&(c.host=""),t)return;l="",u=m$}continue}l+=i;break;case m$:if(c.isSpecial()){if(u=y$,"/"!=i&&"\\"!=i)continue}else if(t||"?"!=i)if(t||"#"!=i){if(i!=HQ&&(u=y$,"/"!=i))continue}else c.fragment="",u=E$;else c.query="",u=S$;break;case y$:if(i==HQ||"/"==i||"\\"==i&&c.isSpecial()||!t&&("?"==i||"#"==i)){if(".."===(s=CZ(s=l))||"%2e."===s||".%2e"===s||"%2e%2e"===s?(c.shortenPath(),"/"==i||"\\"==i&&c.isSpecial()||TZ(c.path,"")):e$(l)?"/"==i||"\\"==i&&c.isSpecial()||TZ(c.path,""):("file"==c.scheme&&!c.path.length&&ZZ(l)&&(c.host&&(c.host=""),l=gZ(l,0)+":"),TZ(c.path,l)),l="","file"==c.scheme&&(i==HQ||"?"==i||"#"==i))for(;c.path.length>1&&""===c.path[0];)AZ(c.path);"?"==i?(c.query="",u=S$):"#"==i&&(c.fragment="",u=E$)}else l+=JZ(i,WZ);break;case g$:"?"==i?(c.query="",u=S$):"#"==i?(c.fragment="",u=E$):i!=HQ&&(c.path[0]+=JZ(i,XZ));break;case S$:t||"#"!=i?i!=HQ&&("'"==i&&c.isSpecial()?c.query+="%27":c.query+="#"==i?"%23":JZ(i,XZ)):(c.fragment="",u=E$);break;case E$:i!=HQ&&(c.fragment+=JZ(i,qZ))}d++}},parseHost:function(e){var t,r,n;if("["==gZ(e,0)){if("]"!=gZ(e,e.length-1))return DZ;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 gZ(e,l)};if(":"==h()){if(":"!=gZ(e,1))return;l+=2,d=++u}for(;h();){if(8==u)return;if(":"!=h()){for(t=r=0;r<4&&SZ(BZ,h());)t=16*t+_Z(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(!SZ(LZ,h()))return;for(;SZ(LZ,h());){if(o=_Z(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}(wZ(e,1,-1)),!t)return DZ;this.host=t}else if(this.isSpecial()){if(e=iZ(e),SZ(jZ,e))return DZ;if(t=function(e){var t,r,n,i,o,a,s,c=RZ(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"==gZ(i,0)&&(o=SZ(UZ,i)?16:8,i=wZ(i,8==o?1:2)),""===i)a=0;else{if(!SZ(10==o?FZ:8==o?VZ:BZ,i))return e;a=_Z(i,o)}TZ(r,a)}for(n=0;n<t;n++)if(a=r[n],n==t-1){if(a>=yZ(256,5-t))return null}else if(a>255)return null;for(s=kZ(r),n=0;n<r.length;n++)s+=r[n]*yZ(256,3-n);return s}(e),null===t)return DZ;this.host=t}else{if(SZ(GZ,e))return DZ;for(t="",r=tZ(e),n=0;n<r.length;n++)t+=JZ(r[n],XZ);this.host=t}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||"file"==this.scheme},includesCredentials:function(){return""!=this.username||""!=this.password},isSpecial:function(){return $Q(QZ,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;!t||"file"==this.scheme&&1==t&&ZZ(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+=KZ(i),null!==o&&(u+=":"+o)):"file"==t&&(u+="//"),u+=e.cannotBeABaseURL?a[0]:a.length?"/"+EZ(a,"/"):"",null!==s&&(u+="?"+s),null!==c&&(u+="#"+c),u},setHref:function(e){var t=this.parse(e);if(t)throw vZ(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if("blob"==e)try{return new k$(e.path[0]).origin}catch(y0){return"null"}return"file"!=e&&this.isSpecial()?e+"://"+KZ(this.host)+(null!==t?":"+t:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse(oZ(e)+":",t$)},getUsername:function(){return this.username},setUsername:function(e){var t=tZ(oZ(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var r=0;r<t.length;r++)this.username+=JZ(t[r],YZ)}},getPassword:function(){return this.password},setPassword:function(e){var t=tZ(oZ(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var r=0;r<t.length;r++)this.password+=JZ(t[r],YZ)}},getHost:function(){var e=this.host,t=this.port;return null===e?"":null===t?KZ(e):KZ(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,l$)},getHostname:function(){var e=this.host;return null===e?"":KZ(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,h$)},getPort:function(){var e=this.port;return null===e?"":oZ(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""==(e=oZ(e))?this.port=null:this.parse(e,f$))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+EZ(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,m$))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){""==(e=oZ(e))?this.query=null:("?"==gZ(e,0)&&(e=wZ(e,1)),this.query="",this.parse(e,S$)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){""!=(e=oZ(e))?("#"==gZ(e,0)&&(e=wZ(e,1)),this.fragment="",this.parse(e,E$)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var k$=function(e){var t=ZQ(this,T$),r=sZ(arguments.length,1)>1?arguments[1]:void 0,n=dZ(t,new b$(e,!1,r));KQ||(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())},T$=k$.prototype,I$=function(e,t){return{get:function(){return lZ(this)[e]()},set:t&&function(e){return lZ(this)[t](e)},configurable:!0,enumerable:!0}};if(KQ&&(QQ(T$,"href",I$("serialize","setHref")),QQ(T$,"origin",I$("getOrigin")),QQ(T$,"protocol",I$("getProtocol","setProtocol")),QQ(T$,"username",I$("getUsername","setUsername")),QQ(T$,"password",I$("getPassword","setPassword")),QQ(T$,"host",I$("getHost","setHost")),QQ(T$,"hostname",I$("getHostname","setHostname")),QQ(T$,"port",I$("getPort","setPort")),QQ(T$,"pathname",I$("getPathname","setPathname")),QQ(T$,"search",I$("getSearch","setSearch")),QQ(T$,"searchParams",I$("getSearchParams")),QQ(T$,"hash",I$("getHash","setHash"))),JQ(T$,"toJSON",(function(){return lZ(this).serialize()}),{enumerable:!0}),JQ(T$,"toString",(function(){return lZ(this).serialize()}),{enumerable:!0}),pZ){var A$=pZ.createObjectURL,R$=pZ.revokeObjectURL;A$&&JQ(k$,"createObjectURL",WQ(A$,pZ)),R$&&JQ(k$,"revokeObjectURL",WQ(R$,pZ))}aZ(k$,"URL"),zQ({global:!0,constructor:!0,forced:!XQ,sham:!KQ},{URL:k$});var w$=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)}}(),C$=Object.defineProperty,O$=Object.getOwnPropertyDescriptor,x$=function(e,t,r,n){for(var i,o=n>1?void 0:n?O$(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&&C$(t,r,o),o},D$=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,zP(a=n.type,"mixingType",cJ(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,w$(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,w$(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){zP(e,"type",cJ(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}();x$([GB("default","id","filePath","options")],D$.prototype,"startAudioMixing",1),x$([GB("default","id")],D$.prototype,"stopAudioMixing",1),x$([GB("default","id")],D$.prototype,"pauseAudioMixing",1),x$([GB("default","id")],D$.prototype,"resumeAudioMixing",1),x$([GB("default","id")],D$.prototype,"preloadAudioMixing",1),x$([GB("default","id")],D$.prototype,"unloadAudioMixing",1),x$([GB("default","id")],D$.prototype,"getAudioMixingVolume",1),x$([GB("default","id","volume")],D$.prototype,"setAudioMixingVolume",1),x$([GB("default","id")],D$.prototype,"getAudioMixingDuration",1),x$([GB("default","id")],D$.prototype,"getAudioMixingCurrentPosition",1),x$([GB("default","id","position")],D$.prototype,"setAudioMixingPosition",1),x$([GB("default","type")],D$.prototype,"enableAudioMixingBuffer",1),x$([GB()],D$.prototype,"disableAudioMixingBuffer",1),x$([GB("default","buffer")],D$.prototype,"pushAudioMixingBuffer",1);var N$=function(e){return e.NORMAL_USER="normalUser",e.SILENT_USER="silentUser",e}(N$||{}),P$=new YL("RTMClient",1),M$=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",pK.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(P$.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,VB.setStats({rtc_app_id:r._appId,user_id:t}),r._loginResolveCallback=n,r._loginRejectCallback=i,r._dataChannelSignal?r._login():(P$.print("login","init dataChannelSingling"),r._dataChannelSignalState=pK.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:Tj.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:Tj.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,HP(t,"signature"),HP(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:Tj.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:yj.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(),E(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:nj.VERSION,deviceId:ZB.getDeviceId(),appId:this._appId,userId:this._userId}},{functionType:Tj.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 Cj,i=this._iceConfigNode){e.next=16;break}return e.prev=3,e.next=6,null==n?void 0:n.getAccessNode(this._appId,"",t,ZB.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),zB("rtm.login.getNodeFailed","",0,!0),new hN(dN.ICE_SERVER_WRONG,"get ICE config failed");case 16:return zB("rtm.login.getNodeSuccess",i,0,!0),P$.print("_createDataChannelSignaling()","get node success",i),this._handler=eK(MB),null===(r=this._handler)||void 0===r||r.once("disconnect",(function(){P$.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,P$.print("_createDataChannelSignaling()","establish peerConnection success"),this._dataChannelSignalState=pK.CONNECTED,e.next=33;break;case 28:throw e.prev=28,e.t1=e.catch(20),this._iceConfigNode=null,this._dataChannelSignalState=pK.DISCONNECTED,new hN(dN.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed",e.t1);case 33:return u=new Aj(s),P$.print("_createDataChannelSignaling()","send ping"),u.sendPingSignaling(),u.once("close",(function(){P$.print("_createDataChannelSignaling()","recv DataChannelSignaling event: close"),d._onDisconnect()})),u.on(hj.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM,(function(e){d.emit("onUserMessageReceivedOutsideRoom",{userId:e.from,message:e.msg})})),u.on(hj.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM,(function(e){d.emit("onUserBinaryMessageReceivedOutsideRoom",{userId:e.from,message:e.msg})})),u.on(hj.USER_DISCONNECTION,(function(){d.emit("onUserDisconnection"),d._clearState()})),u.on(hj.NODE_CHANGE,(function(e){zB("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!==pK.CONNECTED)throw new hN(dN.NOT_CONNECTED_YET,"datachannel not connect")}},{key:"_onDisconnect",value:function(){this._dataChannelSignalState=pK.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&&(P$.print("_reconnect()","start reconnect..."),this._isReconnecting=!0,this._createDataChannelSignaling(this._userId).then((function(t){P$.print("_reconnect()","reconnect success!"),e._dataChannelSignal=t,e._login(),e._reconnectTimer=null})).catch((function(t){P$.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)}}]),_}(BL.exports.EventEmitter),L$=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 _K({avSync:!0}),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 Gz(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=FP(e),i=0;i<t.seiCount;i++)n.emit(iK.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=b(r.value,1)[0];i.remoteStreams.delete(e),i.startPlayPublicStream(e).then((function(){var t=i.remoteStreams.get(e);i.safeEmit(iK.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(pj.ABNORMAL_DISCONNECTION,this._reconnect.bind(this)),null===(t=this._mediaServerClient)||void 0===t||t.on("onRemoteStreamStats",(function(e){r.emit("onRemoteStreamStats",e)}))}}]),a}(ZL),U$=new YL("AudioDeviceManager",1),V$=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,U$.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),U$.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&&(U$.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,U$.print("startAudioDeviceRecordTest()","Invoke"),this._recoderTimer=window.setTimeout((function(){U$.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(){U$.print("stopAudioDeviceRecordAndPlayTest()","Invoke"),void 0!==this._recoderTimer&&(clearTimeout(this._recoderTimer),delete this._recoderTimer),this._stopAudioCaptureAndRecoder()}},{key:"stopAudioDevicePlayTest",value:function(){this._isAudioDeviceRecordTesting&&(U$.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(){U$.print("destroy()","Invoke"),E(p(a.prototype),"removeAllListeners",this).call(this),this.stopAudioPlaybackDeviceTest(),this.stopAudioDevicePlayTest()}},{key:"_playAudioFile",value:function(e,t){var r=this;return U$.print("_playAudioFile()","Invoke url=".concat(e,"; loop=").concat(t.loop)),new Promise((function(n,i){var a,s,u=CW("audio",{attributes:{src:e,crossOrigin:"anonymous"}});r._audioElement=u,u.loop=t.loop,r._audioLevelFetcher=new LH(u),u.onplaying=function(){u.onplaying=null,U$.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:U$.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){U$.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&&(U$.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&&(U$.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&&(U$.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,uz({},this._extensionManager);case 2:return this._audioTrack=e.sent,i=this._audioTrack.getTrack("preprocessing"),r=jH.get(i),U$.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)})),U$.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 U$.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}(BL.exports.EventEmitter),F$=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 Oj,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}(),B$=new YL("VideoSnapshot",1),j$=function(e){var t=null==e?void 0:e.domElement;if(t&&!t.paused&&4===t.readyState)return t},G$=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=j$(n))){e.next=16;break}return B$.print("takeSnapshot","VideoPlayer already set."),e.next=11,s(u,u.videoWidth,u.videoHeight);case 11:return d=e.sent,B$.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 B$.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,B$.print("takeSnapshot","success, cost ".concat(Date.now()-c,"ms")),e.abrupt("return",h);case 29:return B$.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);B$.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)}}(),H$=function(){return{url:"",video:{codec:$.H264,width:640,height:360,fps:15,gop:2,kBitRate:z$(640,360,15)},audio:{codec:"AAC",kBitRate:64,sampleRate:48e3,channels:2,AACProfile:Z.LC},layout:{regions:[],appData:"",backgroundColor:"#000000"}}};function z$(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 K$(e){if("string"!=typeof e||!/^rtmps?:\/\//.test(e))throw new hN(dN.INVALID_PARAMS,"Invalid rtmp address")}function X$(){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 q$(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]}),H$());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:z$(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 W$,Y$={getDefaultValue:H$,checkStartParams:function(e){var t;K$(e.url),X$(null===(t=e.layout)||void 0===t?void 0:t.regions)},checckUpdateParams:function(e){var t;e.url&&K$(e.url),X$(null===(t=e.layout)||void 0===t?void 0:t.regions)},getStartParams:function(e){return q$("started",e)},getUpdateParams:function(e){return q$("layoutChanged",e)}},J$=new WeakMap,Q$=function(e,t,r){var n;if(requestAnimationFrame){var i=J$.get(e);null!==(n=i)&&void 0!==n&&n[t]?Z$(e,t):i||(i={},J$.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))}()}},Z$=function(e,t){var r=J$.get(e);t&&r[t]?cancelAnimationFrame(r[t]):Object.keys(r).length&&Object.keys(r).forEach((function(e){cancelAnimationFrame(r[e])}))},$$=Object.defineProperty,e0=Object.getOwnPropertyDescriptor,t0=function(e,t,r,n){for(var i,o=n>1?void 0:n?e0(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&&$$(t,r,o),o},r0=new YL("Engine",0),n0=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,Ee,be,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",[cj]),h(m(r),"_screenStreamEncodeConfig",[uj]),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 FH),h(m(r),"_audioDeviceManager",new V$(r._extensionManager)),h(m(r),"_audioProfileManager",new F$),h(m(r),"_remoteVideoConfig",new Map),h(m(r),"_userPriorityMap",new Map),h(m(r),"_subscribeFallbackOption",void 0),h(m(r),"_cameraCapturing",!1),h(m(r),"_interruptCameraCapture",!1),h(m(r),"_micCapturing",!1),h(m(r),"_interruptMicCapture",!1),h(m(r),"_avSync",!0),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,r0.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 nK("pubLock"),r._addDeviceEventHandler(),r._audioMixingManager=new D$({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 M$(e),r._handleRTMClient(r._rtmClient),r._useCloudProxy=!1,r._handleAudioDeviceManager(),r._messageStatisticsObserver=new UW,r._extensionManager.setMinotor(PB),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(r0.print("updateToken()","token: %s",t),HP(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(r0.print("setVideoCaptureDevice()","deviceId: %s",t),HP(t,"deviceId"),this._localVideoDeviceId=t,this._localVideoTrack){e.next=5;break}return e.abrupt("return");case 5:return r=aJ({},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),r0.print("setVideoCaptureDevice()","start createCameraVideoTrack..."),e.next=11,sz(r,this._extensionManager).catch((function(e){if(i._localVideoTrack&&!i._localVideoTrack.dummy)return r0.print("setVideoCaptureDevice()","createCameraVideoTrack failed, stop pre VideoTrack."),i._removeLocalTrackEvents(i._localVideoTrack),i._localVideoTrack.close(),delete i._localVideoTrack,sz(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 r0.print("setVideoCaptureDevice()","createCameraVideoTrack failed, rollback."),t.next=3,sz(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,r0.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(r0.print("setAudioCaptureDevice()","deviceId: %s",t),HP(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,uz(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(){PH.on(oe.onVideoDeviceStateChanged,this._onVideoDeviceStateChange.bind(this)),PH.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,E,b,k,T,I,A,R,w,C=this;null===(e=this._room)||void 0===e||e.on(hj.ON_ADD_STREAM,this._onAddStream.bind(this)),null===(t=this._room)||void 0===t||t.on(hj.ON_REMOVE_STREAM,this._onRemoveStream.bind(this)),null===(r=this._room)||void 0===r||r.on(hj.USER_CONNECTION,this._onUserConnection.bind(this)),null===(n=this._room)||void 0===n||n.on(iK.ON_USER_LEAVE,this._onUserLeave.bind(this)),null===(i=this._room)||void 0===i||i.on(iK.ON_ROOM_ERROR,this._onRoomError.bind(this)),null===(o=this._room)||void 0===o||o.on(iK.ON_NETWORK_QUALITY,this._onNetworkQuality.bind(this)),null===(a=this._room)||void 0===a||a.on(hj.ON_CUSTOM_MESSAGE,this._onCustomMessage.bind(this)),null===(s=this._room)||void 0===s||s.on(hj.USER_MESSAGE_RECEIVED,this._onUserMessageReceived.bind(this)),null===(c=this._room)||void 0===c||c.on(hj.USER_BINARY_MESSAGE_RECEIVED,this._onUserBinaryMessageReceived.bind(this)),null===(u=this._room)||void 0===u||u.on(hj.ON_USER_TOKEN_WILL_EXPIRE,this._onUserTokenWillExpire.bind(this)),null===(d=this._room)||void 0===d||d.on(hj.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(pj.ON_CONNECTION_STATE_CHANGE,this._onConnectionStateChange.bind(this)),null===(h=this._room)||void 0===h||h.on(iK.RESUBSCRIBE,this._onResubscribe.bind(this)),null===(f=this._room)||void 0===f||f.on(iK.SUBSCRIBE_PUSH_TRACK,this._onSubscribePushTrack.bind(this)),null===(p=this._room)||void 0===p||p.on(iK.REMOVE_PUSH_TRACK,this._onRemovePushTrack.bind(this)),null===(v=this._room)||void 0===v||v.on(iK.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(iK.ON_REMOTE_STREAM_STATS,(function(e){C.safeEmit(oe.onRemoteStreamStats,e)})),null===(m=this._room)||void 0===m||m.on(iK.ON_LOCAL_STREAM_STATS,(function(e){C.safeEmit(oe.onLocalStreamStats,e)})),null===(y=this._room)||void 0===y||y.on(iK.ON_USER_PUBLISH_STATE_CHANGE,this._onUserPublishStateChange.bind(this)),null===(g=this._room)||void 0===g||g.on(iK.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(iK.ON_USER_STOP_AUDIO_CAPTURE,(function(e){var t=e.userId;C.safeEmit(oe.onUserStopAudioCapture,{userId:t})})),null===(E=this._room)||void 0===E||E.on(iK.ON_USER_START_VIDEO_CAPTURE,(function(e){var t=e.userId;C.safeEmit(oe.onUserStartVideoCapture,{userId:t})})),null===(b=this._room)||void 0===b||b.on(iK.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(iK.ON_SEI_MESSAGED_RECEIVED,(function(e){C.safeEmit(oe.onSEIMessageReceived,e)})),null===(T=this._room)||void 0===T||T.on(iK.ON_REMOTE_VIDEO_SIZE_CHANGED,(function(e,t){C.safeEmit(oe.onRemoteVideoSizeChanged,e,t)})),null===(I=this._room)||void 0===I||I.on(iK.ON_SIMULCAST_SUBSCRIBE_FALLBACK,(function(e){return C.safeEmit(oe.onSimulcastSubscribeFallback,e)})),null===(A=this._room)||void 0===A||A.on(iK.RECONNECT_FAILED,(function(){C.safeEmit(oe.onError,{errorCode:dN.RECONNECT_FAILED})})),null===(R=this._room)||void 0===R||R.on(iK.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(iK.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 iM(e)&&HB(e,DP(n)),(t=E(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(r0.print("joinRoom()","token: %o roomId: %o, userInfo: %o, roomConfig: %o",t,r,n,a),JP(t)||HP(t,"token"),QP(r),eM(n),s={isAutoPublish:!0,isAutoSubscribeAudio:!0,isAutoSubscribeVideo:!0,roomProfileType:Y.communication},aJ(s,a),tM(s),!this._room||this._room.connectionState===pK.DISCONNECTED){e.next=11;break}throw new hN(dN.REPEAT_JOIN,"Already joined");case 11:return this._room=new RW(a,{audioProfileManager:this._audioProfileManager,streamRTT:{},subscribeFallbackOption:this._subscribeFallbackOption,userPriority:this._userPriorityMap,avSync:this._avSync}),this._addHandlerEventHandler(),c=this._liveTranscodeConfig&&Y$.getStartParams(this._liveTranscodeConfig),u=i(i({},n),{},{businessId:this._businessId,role:this._visibility?N$.NORMAL_USER:N$.SILENT_USER}),e.prev=15,this._useCloudProxy&&(this._startCloudProxyTimestamp=Date.now()),e.next=19,this._room.join(this._appId,r,t,u,c,this._useCloudProxy,null===(d=this._config)||void 0===d?void 0:d.expectedIDC);case 19: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 26:throw e.prev=26,e.t0=e.catch(15),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 31:case"end":return e.stop()}}),e,this,[[15,26]])}))),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],r0.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;r0.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=[cj],this._screenStreamEncodeConfig=[uj],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,this._avSync=!0}},{key:"publishStream",value:(Pe=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r0.print("publishStream()","mediaType: %o",t),this._checkMediaType(t),this._assertNotInRoom(),!UP(t)||this._localVideoTrack||!this._localImgVideoTrack){e.next=7;break}return e.next=6,nz(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(r0.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:aK.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(r0.print("publishScreen()","mediaType: %o",t),this._checkMediaType(t),this._assertNotInRoom(),e.prev=3,!UP(t)||this._localScreenVideoTrack||!this._localImgScreenTrack){e.next=8;break}return e.next=7,oz(this._localImgScreenTrack,this._extensionManager);case 7:this._localScreenVideoTrack=e.sent;case 8:return e.next=10,this._updateScreenPublish({mediaType:t,pubState:aK.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 r0.print("unpublishScreen()","mediaType: %o",t),this._checkMediaType(t),this._assertNotInRoom(),e.next=5,this._updateScreenPublish({mediaType:t,pubState:aK.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 r0.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,S;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 r0.print("subscribeStream()","due to multiChatMode return"),e.abrupt("return");case 5:if(d=this._room.remoteStreams.get(r),l=null==d?void 0:d.find((function(e){return e.isScreen===t}))){e.next=9;break}throw new hN(dN.STREAM_NOT_EXIST,"stream not exist");case 9:return h=this._pauseAllSubscribeState.audio,f=this._pauseAllSubscribeState.video,this._pauseAllSubscribeState.audio&&(n-=n&U.AUDIO),this._pauseAllSubscribeState.video&&(n-=n&U.VIDEO),r0.print("subscribeStream()","due to pauseAll mediaType: %o",n),p=l.hasSubscribed,v=this._remoteVideoConfig.get(r)||(null===(a=this._roomConfig)||void 0===a?void 0:a.remoteVideoConfig),l.originalMediaType=n,e.next=19,this._room.subscribe(l,n,v);case 19:LP(n)&&this._updateAudioPlayerState(l),UP(n)&&this._updateVideoPlayerState(l),_=0,m=0,h!==this._pauseAllSubscribeState.audio&&(this._pauseAllSubscribeState.audio?_|=U.AUDIO:m|=U.AUDIO),f!==this._pauseAllSubscribeState.video&&(this._pauseAllSubscribeState.video?_|=U.VIDEO:m|=U.VIDEO),_&&this.pauseAllSubscribedStream(_),m&&this.resumeAllSubscribedStream(m),this._pauseAllSubscribeState.resumeStreamIds[l.streamId]=l.streamId,!t&&(null!==(s=this._roomConfig)&&void 0!==s&&s.isAutoSubscribeAudio||null!==(c=this._roomConfig)&&void 0!==c&&c.isAutoSubscribeVideo)&&(l.audioTrack||l.videoTrack)&&(y={userId:r,isScreen:!1,state:D.SUBSCRIBE_SUCC},this.safeEmit(oe.onAutoSubscribeResult,y)),null!==(u=this._room)&&void 0!==u&&u.multiChatMode||p||!LP(n)||!l.hasAudio||null===(g=l.observer)||void 0===g||g.setSubscribeAudio(!0),!p&&UP(n)&&l.hasVideo&&(null===(S=l.observer)||void 0===S||S.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:r0.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 r0.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:r0.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]}))}r0.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 r0.print("setRemoteVideoConfig() userId: %o, remoteVideoConfig: %o",t,r),ZP(t),oM(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(r0.print("startVideoCapture()","deviceId: %s",t),JP(t)||HP(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,sz(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(r0.print("stopVideoCapture()"),!this._cameraCapturing){e.next=5;break}return this._interruptCameraCapture=!0,r0.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:(be=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(r0.print("startAudioCapture()","deviceId: $o",t),JP(t)||HP(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,uz(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 be.apply(this,arguments)})},{key:"stopAudioCapture",value:(Ee=c(o().mark((function e(){var t,r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r0.print("stopAudioCapture()"),!this._micCapturing){e.next=5;break}return this._interruptMicCapture=!0,r0.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 Ee.apply(this,arguments)})},{key:"getAudioMixingManager",value:function(){return r0.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]:{},r0.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,lz(c,this._extensionManager,this._screenStreamEncodeConfig[0]);case 9:if(u=e.sent,d=b(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(r0.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(r0.print("setLocalVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",e,t),zP(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(rM(o),e===L.STREAM_INDEX_MAIN&&!this._videoPlayer)return this._videoPlayer=new PW(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 PW(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(r0.print("startLiveTranscoding()","transcode: %o",t),Y$.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:oK.START,error:0,message:""}),!this._room||this._room.connectionState!==pK.CONNECTED){e.next=11;break}return e.next=11,null===(i=this._room)||void 0===i?void 0:i.liveControlMessage(Y$.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(r0.print("updateLiveTranscoding()","transcode: %o",t),this._liveTranscodeConfig){e.next=3;break}return e.abrupt("return");case 3:return delete(i=aJ({},t)).audio,null===(r=i.video)||void 0===r||delete r.codec,null===(n=i.video)||void 0===n||delete n.gop,Y$.checckUpdateParams(i),this._liveTranscodeConfig=aJ(this._liveTranscodeConfig,i),e.prev=9,this.safeEmit(oe.onStreamMixingEvent,{event:oK.UPDATE,error:0,message:""}),e.next=13,null===(a=this._room)||void 0===a?void 0:a.liveControlMessage(Y$.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(r0.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:oK.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 r0.print("setBusinessId()","businessId: %s",e),!function(e){return"string"!=typeof e}(e)&&!this._room&&(UB.setStats({rtc_business_id:e}),gW.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(r0.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?N$.NORMAL_USER:N$.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})),PB.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)),PB.firstRemoteVideoRender("",n.userId||"",{isScreen:i})}break;case"autoplay-error":return r&&(n.publicStreamId=n.userId),PB.rtcInvokeStatus(e instanceof PW?"video":"audio",0,"autoplay-error",n.userId||"",0),void t.safeEmit(oe.onAutoplayFailed,{userId:n.userId,kind:e instanceof PW?"video":"audio",mediaType:e instanceof PW?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){r0.print("setRemoteVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",e,t),zP(e,"streamIndex",[L.STREAM_INDEX_MAIN,L.STREAM_INDEX_SCREEN]),rM(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 PW(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 PW(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){r0.print("setLocalVideoMirrorType()","mirrorType: %o",e),zP(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(r0.print("setAudioPlaybackDevice()","deviceId: %s",t),HP(t,"deviceId"),void 0!==HTMLAudioElement.prototype.setSinkId){e.next=5;break}return r0.print("setAudioPlaybackDevice failed","setSinkId not supported by current browser"),e.abrupt("return");case 5:return e.next=7,PH.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),PB.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,r0.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(LW(this._remoteVideoPlayer,t,!1,m)),h&&d&&f.push(LW(this._remoteScreenPlayer,t,!0,m)),l&&u&&f.push(LW(this._remoteAudioPlayer,t,!1,m)),h&&d&&f.push(LW(this._remoteScreenAudioPlayer,t,!0,m)),y=null===(i=this._outsideRoom)||void 0===i?void 0:i.remoteStreams,l&&f.push(LW(this._publicStreamVideoPlayer,t,!1,y)),h&&f.push(LW(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(r0.print("pauseAllSubscribedStream()","mediaType: %o",t),this._checkMediaType(t),LP(t)&&(s._pauseAllSubscribeState.audio=!0),UP(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(r0.print("resumeAllSubscribedStream()","mediaType: %o",t),this._checkMediaType(t),LP(t)&&(s._pauseAllSubscribeState.audio=!1),UP(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 ZP(t),nM(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 ZP(t),qP(r,"message"),nM(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 nM(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 nM(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]:{},r0.print("setAudioCaptureConfig()","config: %o",t),delete t.deviceId,WP(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]:{},r0.print("setVideoCaptureConfig()","config: %o",r),delete r.deviceId,WP(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 r0.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:r0.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:r0.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(r0.print("sendSEIMessage()","streamIdex: %o, message: %o, repeatCount: %o",e,t,r),!Xj())throw new hN(dN.NOT_SUPPORTED,"Browser does not support sending SEI");zP(e,"streamIndex",[L.STREAM_INDEX_MAIN,L.STREAM_INDEX_SCREEN]),GP(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)r0.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 r0.print("sei message must not be empty")}},{key:"setAudioVolumeIndicationInterval",value:function(e){var t=this;r0.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]:{};r0.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:MP(i)}})}if(e._localScreenAudioTrack){var o=e._localScreenAudioTrack.getAudioLevel();t.push({streamIndex:L.STREAM_INDEX_SCREEN,audioPropertiesInfo:{linearVolume:o,nonlinearVolume:MP(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:MP(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:MP(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,E,b,k,T;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r0.print("setVideoSourceType()","index: %o, videoSourceType: %o",t,r),zP(t,"streamIndex",[L.STREAM_INDEX_MAIN,L.STREAM_INDEX_SCREEN]),zP(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,r0.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===(E=S.observer)||void 0===E||E.setEnableVideo(!1):null===(b=this._room)||void 0===b||null===(k=b.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(r0.print("setExternalVideoTrack()","index: %o, track: %o",t,r),zP(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,pz(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,yz(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,E,b;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r0.print("setAudioSourceType()","index: %o, audioSourceType: %o",t,r),zP(t,"streamIndex",[L.STREAM_INDEX_MAIN,L.STREAM_INDEX_SCREEN]),zP(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,r0.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===(E=S.localScreenStream)||void 0===E||null===(b=E.observer)||void 0===b||b.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(r0.print("setExternalAudioTrack()","index: %o, track: %o",t,r),zP(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,_z(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,Sz(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 r0.print("login()","token: %o, userInfo: %o",t,r),JP(t)||HP(t,"token"),ZP(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 r0.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 r0.print("updateLoginToken()","token: %o",t),JP(t)||HP(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 r0.print("getPeerOnlineStatus()","userId: %o",t),ZP(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 ZP(t),nM(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 ZP(t),qP(r,"message"),nM(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 r0.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 HP(t,"message"),nM(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 qP(t,"message"),nM(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 ");r0.print("startCloudProxy()",e),HP(e.logProxy,"logProxy"),HP(e.accessProxy,"accessProxy"),HP(e.configProxy,"configProxy"),this._originIceConfigRequestUrls=oj("ICE_CONFIG_REQUEST_URLS"),this._originLogServerUrl=oj("LOG_SERVER_URL"),this._originConfigServerUrls=oj("CONFIG_REQUEST_DOMAINS"),ij("ICE_CONFIG_REQUEST_URLS",e.accessProxy),ij("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)),ij("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 ");r0.print("stopCloudProxy()"),ij("ICE_CONFIG_REQUEST_URLS",[]),ij("LOG_SERVER_URL",this._originLogServerUrl),ij("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(r0.print("startPushPublicStream()","publicStreamId: %o, publicStreamParam: %o",t,r),$P(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=aj(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 r0.print("startPushPublicStream()","publicStreamId: %o, publicStreamParam: %o",t,r),$P(t),this._assertNotInRoom(),i=aj(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 r0.print("startPushPublicStream()","publicStreamId: %o",t),$P(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($P(t),this._outsideRoom){e.next=8;break}return this._outsideRoom=new L$(this._appId),this._outsideRoom.on(iK.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(iK.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 MW(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;r0.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 PW(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){HP(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=PB,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(Y$.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]:{},r0.print("_updatePublish()","config: %o",t),r={mediaType:void 0,invokeByJoinRoom:!1,pubState:aK.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===pK.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 r0.print("startAudioPlaybackDeviceTest()","filePath: %o, indicationInterval: %o",t,r),HP(t,"filePath"),GP(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(){r0.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 r0.print("startAudioDeviceRecordTest()","indicationInterval: %o",t),GP(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(){r0.print("stopAudioDeviceRecordAndPlayTest()"),this._audioDeviceManager.stopAudioDeviceRecordAndPlayTest()}},{key:"stopAudioDevicePlayTest",value:function(){r0.print("stopAudioDevicePlayTest()"),this._audioDeviceManager.stopAudioDevicePlayTest()}},{key:"setRemoteUserPriority",value:function(e,t){var r;r0.print("setRemoteUserPriority()","userId: %o, priority: %o",e,t);try{ZP(e),zP(t,"priority",[X.HIGH,X.MEDIUM,X.LOW])}catch(n){return console.warn(n),!1}return this._userPriorityMap.set(e,t),null===(r=this._room)||void 0===r||r.updateRemoteUserPriority(e),!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(r0.print("takeLocalSnapshot()","streamIndex: %o",t),zP(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",G$(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(r0.print("takeRemoteSnapshot()","id: %o, streamIndex: %o",t,r),HP(t,"id"),zP(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",G$(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){r0.print("setSubscribeFallbackOption()","option: %o",e);try{zP(e,"option",[K.DISABLE,K.VIDEO_STREAM_LOW,K.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 bz&&r.mixedAudioTrack?r.mixedAudioTrack:r.getTrack("preprocessing");if(o){var a=n();return Q$(o,"enabled",this._reportMsTrackEvent.bind(this,"enabled",(null==a?void 0:a.streamId)||"","getLocalStreamTrack",t)),Q$(o,"readyState",(function(e){"ended"===e&&(Z$(o,"enabled"),Z$(o,"readyState")),i._reportMsTrackEvent("readyState",(null==a?void 0:a.streamId)||"","getLocalStreamTrack",t,e)})),o.addEventListener("ended",(function(){Z$(o,"enabled"),Z$(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 Q$(h,"enabled",this._reportMsTrackEvent.bind(this,"enabled",f,"getRemoteStreamTrack",r)),Q$(h,"readyState",(function(e){"ended"===e&&(Z$(h,"enabled"),Z$(h,"readyState")),o._reportMsTrackEvent("readyState",f,"getRemoteStreamTrack",r,e)})),h.addEventListener("ended",(function(){Z$(h,"enabled"),Z$(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 Q$(o,"enabled",this._reportMsTrackEvent.bind(this,"enabled",a,"getPublicStreamTrack",t)),Q$(o,"readyState",(function(e){"ended"===e&&(Z$(o,"enabled"),Z$(o,"readyState")),r._reportMsTrackEvent("readyState",a,"getPublicStreamTrack",t,e)})),o.addEventListener("ended",(function(){Z$(o,"enabled"),Z$(o,"readyState")})),o}}}}}},{key:"setRemoteStreamRenderSync",value:function(e){return!this._room&&(this._avSync=!!e,!0)}},{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"}PB.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]:{},r0.print("_updateScreenPublish()"),r={mediaType:void 0,pubState:aK.PUB},t=i(i({},r),t),e.next=6,this._pubLock.lock();case 6:if(n=e.sent,this._room&&this._room.connectionState===pK.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){r0.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 MW(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),gP&&TP&&(t=this._remoteAudioPlayer,W$&&clearTimeout(W$),W$=setTimeout((function(){var e,r=A(t);try{for(r.s();!(e=r.n()).done;){var n=b(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=b(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;r0.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=kz.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=kz.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&&LP(i))null===(o=e.observer)||void 0===o||o.setAutoSubscribeAudio(!0);if(t&&UP(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=i0[e.reason])&&void 0!==t?t:V.STREAM_REMOVE_REASON_OTHER,o=n.isScreen?oe.onUserUnpublishScreen:oe.onUserUnpublishStream,a=kz.NONE;n.attributes.audiostream&&(a|=U.AUDIO),n.attributes.videostream&&(a|=U.VIDEO),a!==kz.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=b(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===aK.PUB?this.safeEmit(oe.onUserPublishScreen,c):this.safeEmit(oe.onUserUnpublishScreen,i(i({},c),{},{reason:V.STREAM_REMOVE_REASON_UNPUBLISH})):a===aK.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!==pK.CONNECTED)throw new hN(dN.NOT_CONNECTED_YET,"server not connected")}},{key:"_checkMediaType",value:function(e){zP(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}(ZL);t0([GB()],n0.prototype,"updateToken",1),t0([GB()],n0.prototype,"setVideoCaptureDevice",1),t0([GB()],n0.prototype,"setAudioCaptureDevice",1),t0([GB()],n0.prototype,"joinRoom",1),t0([GB()],n0.prototype,"leaveRoom",1),t0([GB()],n0.prototype,"destroy",1),t0([GB()],n0.prototype,"publishStream",1),t0([GB()],n0.prototype,"unpublishStream",1),t0([GB()],n0.prototype,"publishScreen",1),t0([GB()],n0.prototype,"unpublishScreen",1),t0([GB()],n0.prototype,"subscribeStream",1),t0([GB()],n0.prototype,"unsubscribeStream",1),t0([GB()],n0.prototype,"subscribeScreen",1),t0([GB()],n0.prototype,"unsubscribeScreen",1),t0([GB()],n0.prototype,"setRemoteVideoConfig",1),t0([GB()],n0.prototype,"startVideoCapture",1),t0([GB()],n0.prototype,"stopVideoCapture",1),t0([GB()],n0.prototype,"startAudioCapture",1),t0([GB()],n0.prototype,"stopAudioCapture",1),t0([GB()],n0.prototype,"getAudioMixingManager",1),t0([GB()],n0.prototype,"startScreenCapture",1),t0([GB()],n0.prototype,"stopScreenCapture",1),t0([GB()],n0.prototype,"setLocalVideoPlayer",1),t0([GB()],n0.prototype,"startLiveTranscoding",1),t0([GB()],n0.prototype,"updateLiveTranscoding",1),t0([GB()],n0.prototype,"stopLiveTranscoding",1),t0([GB()],n0.prototype,"setBusinessId",1),t0([GB()],n0.prototype,"setUserVisibility",1),t0([GB()],n0.prototype,"setRemoteVideoPlayer",1),t0([GB()],n0.prototype,"setLocalVideoMirrorType",1),t0([GB()],n0.prototype,"setAudioPlaybackDevice",1),t0([GB()],n0.prototype,"play",1),t0([GB()],n0.prototype,"pauseAllSubscribedStream",1),t0([GB()],n0.prototype,"resumeAllSubscribedStream",1),t0([GB()],n0.prototype,"sendUserMessage",1),t0([GB()],n0.prototype,"sendUserBinaryMessage",1),t0([GB()],n0.prototype,"sendRoomMessage",1),t0([GB()],n0.prototype,"sendRoomBinaryMessage",1),t0([GB()],n0.prototype,"setAudioCaptureConfig",1),t0([GB()],n0.prototype,"setVideoCaptureConfig",1),t0([GB()],n0.prototype,"enableSimulcastMode",1),t0([GB()],n0.prototype,"setVideoEncoderConfig",1),t0([GB()],n0.prototype,"setScreenEncoderConfig",1),t0([GB()],n0.prototype,"sendSEIMessage",1),t0([GB()],n0.prototype,"setAudioVolumeIndicationInterval",1),t0([GB()],n0.prototype,"enableAudioPropertiesReport",1),t0([GB()],n0.prototype,"setVideoSourceType",1),t0([GB()],n0.prototype,"setExternalVideoTrack",1),t0([GB()],n0.prototype,"setAudioSourceType",1),t0([GB()],n0.prototype,"setExternalAudioTrack",1),t0([GB("rtm")],n0.prototype,"login",1),t0([GB("rtm")],n0.prototype,"logout",1),t0([GB("rtm")],n0.prototype,"updateLoginToken",1),t0([GB("rtm")],n0.prototype,"getPeerOnlineStatus",1),t0([GB("rtm")],n0.prototype,"sendUserMessageOutsideRoom",1),t0([GB("rtm")],n0.prototype,"sendUserBinaryMessageOutsideRoom",1),t0([GB("rtm")],n0.prototype,"setServerParams",1),t0([GB("rtm")],n0.prototype,"sendServerMessage",1),t0([GB("rtm")],n0.prototype,"sendServerBinaryMessage",1),t0([GB()],n0.prototype,"startCloudProxy",1),t0([GB()],n0.prototype,"stopCloudProxy",1),t0([GB()],n0.prototype,"startPushPublicStream",1),t0([GB()],n0.prototype,"updatePublicStreamParam",1),t0([GB()],n0.prototype,"stopPushPublicStream",1),t0([GB("outsideRoom","streamId")],n0.prototype,"startPlayPublicStream",1),t0([GB("outsideRoom","streamId")],n0.prototype,"stopPlayPublicStream",1),t0([GB()],n0.prototype,"setAudioProfile",1),t0([GB("outsideRoom")],n0.prototype,"setPublicStreamVideoPlayer",1),t0([GB()],n0.prototype,"setDummyCaptureImagePath",1),t0([GB()],n0.prototype,"registerExtension",1),t0([GB()],n0.prototype,"startAudioPlaybackDeviceTest",1),t0([GB()],n0.prototype,"stopAudioPlaybackDeviceTest",1),t0([GB()],n0.prototype,"startAudioDeviceRecordTest",1),t0([GB()],n0.prototype,"stopAudioDeviceRecordAndPlayTest",1),t0([GB()],n0.prototype,"stopAudioDevicePlayTest",1),t0([GB()],n0.prototype,"setRemoteUserPriority",1),t0([GB()],n0.prototype,"takeLocalSnapshot",1),t0([GB()],n0.prototype,"takeRemoteSnapshot",1),t0([GB()],n0.prototype,"setSubscribeFallbackOption",1),t0([GB()],n0.prototype,"getLocalStreamTrack",1),t0([GB()],n0.prototype,"getRemoteStreamTrack",1),t0([GB()],n0.prototype,"getPublicStreamTrack",1),t0([GB()],n0.prototype,"setRemoteStreamRenderSync",1);var i0={"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},o0=new YL("VERTC",0);KL.storeKey="".concat(Date.now(),"-").concat(ZB.getDeviceId()),[UB,VB,FB].forEach((function(e){var t;return e.setStats({rtc_sdk_version:nj.VERSION,product_line:ZF.RTC,report_version:$F.W_5,os:eB.WEB,device_id:ZB.getDeviceId(),log_cache_key:KL.storeKey,user_agent:vP()?"":null===(t=navigator)||void 0===t?void 0:t.userAgent})})),gW.setStats({rtc_sdk_version:nj.VERSION,log_cache_key:KL.storeKey});var a0=function(e,t){return o0.print("createEngine","Invoke VERTC.createEngine"),HP(e,"appId"),[UB,VB,FB].forEach((function(r){return r.setStats({rtc_app_id:e,auto_play_policy:null==t?void 0:t.autoPlayPolicy})})),gW.setStats({rtc_app_id:e}),PB.sdkInitEngine(Date.now(),AB.BEGIN),new n0(e,t)},s0=function(e){if(o0.print("destroyEngine","Invoke VERTC.destroyEngine"),!(e instanceof n0))throw new hN(dN.INVALID_ENGINE,"Invalid engine object");e.destroy(),PB.sdkInitEngine(Date.now(),AB.END)},c0=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",PH.enumerateDevices());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),u0=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,PH.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,PH.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)}}(),d0=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",PH.enumerateAudioCaptureDevices());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),l0=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",PH.enumerateVideoCaptureDevices());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),h0=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",PH.enumerateAudioPlaybackDevices());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),f0=function(){return nj.VERSION},p0=function(){return PB.rtcSdkApiCall("isSupported",0,""),Hj()},v0=function(){return PB.rtcSdkApiCall("getSupportedCodecs",0,""),Kj()},_0=function(e){var t=e.logLevel,r=e.LogfileSize;t&&(KL.logLevel=t),r&&(KL.LogfileSize=r)},m0=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",f0),h(this,"createEngine",a0),h(this,"destroyEngine",s0),h(this,"enumerateDevices",c0),h(this,"enableDevices",u0),h(this,"enumerateAudioCaptureDevices",d0),h(this,"enumerateVideoCaptureDevices",l0),h(this,"enumerateAudioPlaybackDevices",h0),h(this,"getParameter",oj),h(this,"setParameter",ij),h(this,"isSupported",p0),h(this,"getSupportedCodecs",v0),h(this,"events",oe),h(this,"ErrorCode",dN),h(this,"platform","".concat({}.PRODUCT_PLATFORM)),h(this,"_monitor",PB),h(this,"downloadLog",m0),h(this,"setLogConfig",_0)})))),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"}))}var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},r=function(e){return e&&e.Math==Math&&e},n=r("object"==typeof globalThis&&globalThis)||r("object"==typeof window&&window)||r("object"==typeof self&&self)||r("object"==typeof t&&t)||function(){return this}()||Function("return this")(),i=function(e){try{return!!e()}catch(t){return!0}},o=!i((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),a=o,s=Function.prototype,c=s.apply,u=s.call,d="object"==typeof Reflect&&Reflect.apply||(a?u.bind(c):function(){return u.apply(c,arguments)}),l=o,h=Function.prototype,f=h.call,p=l&&h.bind.bind(f,f),v=l?p:function(e){return function(){return f.apply(e,arguments)}},_=v,m=_({}.toString),g=_("".slice),y=function(e){return g(m(e),8,-1)},S=y,E=v,b=function(e){if("Function"===S(e))return E(e)},k="object"==typeof document&&document.all,T={all:k,IS_HTMLDDA:void 0===k&&void 0!==k},I=T.all,R=T.IS_HTMLDDA?function(e){return"function"==typeof e||e===I}:function(e){return"function"==typeof e},A={},w=!i((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),C=o,O=Function.prototype.call,D=C?O.bind(O):function(){return O.apply(O,arguments)},x={},N={}.propertyIsEnumerable,P=Object.getOwnPropertyDescriptor,M=P&&!N.call({1:2},1);x.f=M?function(e){var t=P(this,e);return!!t&&t.enumerable}:N;var L,U,V=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},F=i,B=y,j=Object,G=b("".split),H=F((function(){return!j("z").propertyIsEnumerable(0)}))?function(e){return"String"==B(e)?G(e,""):j(e)}:j,z=function(e){return null==e},K=z,X=TypeError,q=function(e){if(K(e))throw X("Can't call method on "+e);return e},W=H,Y=q,Q=function(e){return W(Y(e))},J=R,Z=T.all,$=T.IS_HTMLDDA?function(e){return"object"==typeof e?null!==e:J(e)||e===Z}:function(e){return"object"==typeof e?null!==e:J(e)},ee={},te=ee,re=n,ne=R,ie=function(e){return ne(e)?e:void 0},oe=function(e,t){return arguments.length<2?ie(te[e])||ie(re[e]):te[e]&&te[e][t]||re[e]&&re[e][t]},ae=b({}.isPrototypeOf),se=oe("navigator","userAgent")||"",ce=n,ue=se,de=ce.process,le=ce.Deno,he=de&&de.versions||le&&le.version,fe=he&&he.v8;fe&&(U=(L=fe.split("."))[0]>0&&L[0]<4?1:+(L[0]+L[1])),!U&&ue&&(!(L=ue.match(/Edge\/(\d+)/))||L[1]>=74)&&(L=ue.match(/Chrome\/(\d+)/))&&(U=+L[1]);var pe=U,ve=pe,_e=i,me=!!Object.getOwnPropertySymbols&&!_e((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&ve&&ve<41})),ge=me&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,ye=oe,Se=R,Ee=ae,be=Object,ke=ge?function(e){return"symbol"==typeof e}:function(e){var t=ye("Symbol");return Se(t)&&Ee(t.prototype,be(e))},Te=String,Ie=function(e){try{return Te(e)}catch(t){return"Object"}},Re=R,Ae=Ie,we=TypeError,Ce=function(e){if(Re(e))return e;throw we(Ae(e)+" is not a function")},Oe=Ce,De=z,xe=function(e,t){var r=e[t];return De(r)?void 0:Oe(r)},Ne=D,Pe=R,Me=$,Le=TypeError,Ue={exports:{}},Ve=n,Fe=Object.defineProperty,Be=function(e,t){try{Fe(Ve,e,{value:t,configurable:!0,writable:!0})}catch(r){Ve[e]=t}return t},je="__core-js_shared__",Ge=n[je]||Be(je,{}),He=Ge;(Ue.exports=function(e,t){return He[e]||(He[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.26.0",mode:"pure",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.26.0/LICENSE",source:"https://github.com/zloirock/core-js"});var ze=q,Ke=Object,Xe=function(e){return Ke(ze(e))},qe=Xe,We=b({}.hasOwnProperty),Ye=Object.hasOwn||function(e,t){return We(qe(e),t)},Qe=b,Je=0,Ze=Math.random(),$e=Qe(1..toString),et=function(e){return"Symbol("+(void 0===e?"":e)+")_"+$e(++Je+Ze,36)},tt=n,rt=Ue.exports,nt=Ye,it=et,ot=me,at=ge,st=rt("wks"),ct=tt.Symbol,ut=ct&&ct.for,dt=at?ct:ct&&ct.withoutSetter||it,lt=function(e){if(!nt(st,e)||!ot&&"string"!=typeof st[e]){var t="Symbol."+e;ot&&nt(ct,e)?st[e]=ct[e]:st[e]=at&&ut?ut(t):dt(t)}return st[e]},ht=D,ft=$,pt=ke,vt=xe,_t=function(e,t){var r,n;if("string"===t&&Pe(r=e.toString)&&!Me(n=Ne(r,e)))return n;if(Pe(r=e.valueOf)&&!Me(n=Ne(r,e)))return n;if("string"!==t&&Pe(r=e.toString)&&!Me(n=Ne(r,e)))return n;throw Le("Can't convert object to primitive value")},mt=TypeError,gt=lt("toPrimitive"),yt=function(e,t){if(!ft(e)||pt(e))return e;var r,n=vt(e,gt);if(n){if(void 0===t&&(t="default"),r=ht(n,e,t),!ft(r)||pt(r))return r;throw mt("Can't convert object to primitive value")}return void 0===t&&(t="number"),_t(e,t)},St=ke,Et=function(e){var t=yt(e,"string");return St(t)?t:t+""},bt=$,kt=n.document,Tt=bt(kt)&&bt(kt.createElement),It=function(e){return Tt?kt.createElement(e):{}},Rt=It,At=!w&&!i((function(){return 7!=Object.defineProperty(Rt("div"),"a",{get:function(){return 7}}).a})),wt=w,Ct=D,Ot=x,Dt=V,xt=Q,Nt=Et,Pt=Ye,Mt=At,Lt=Object.getOwnPropertyDescriptor;A.f=wt?Lt:function(e,t){if(e=xt(e),t=Nt(t),Mt)try{return Lt(e,t)}catch(r){}if(Pt(e,t))return Dt(!Ct(Ot.f,e,t),e[t])};var Ut=i,Vt=R,Ft=/#|\.prototype\./,Bt=function(e,t){var r=Gt[jt(e)];return r==zt||r!=Ht&&(Vt(t)?Ut(t):!!t)},jt=Bt.normalize=function(e){return String(e).replace(Ft,".").toLowerCase()},Gt=Bt.data={},Ht=Bt.NATIVE="N",zt=Bt.POLYFILL="P",Kt=Bt,Xt=Ce,qt=o,Wt=b(b.bind),Yt=function(e,t){return Xt(e),void 0===t?e:qt?Wt(e,t):function(){return e.apply(t,arguments)}},Qt={},Jt=w&&i((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Zt=$,$t=String,er=TypeError,tr=function(e){if(Zt(e))return e;throw er($t(e)+" is not an object")},rr=w,nr=At,ir=Jt,or=tr,ar=Et,sr=TypeError,cr=Object.defineProperty,ur=Object.getOwnPropertyDescriptor,dr="enumerable",lr="configurable",hr="writable";Qt.f=rr?ir?function(e,t,r){if(or(e),t=ar(t),or(r),"function"==typeof e&&"prototype"===t&&"value"in r&&hr in r&&!r.writable){var n=ur(e,t);n&&n.writable&&(e[t]=r.value,r={configurable:lr in r?r.configurable:n.configurable,enumerable:dr in r?r.enumerable:n.enumerable,writable:!1})}return cr(e,t,r)}:cr:function(e,t,r){if(or(e),t=ar(t),or(r),nr)try{return cr(e,t,r)}catch(n){}if("get"in r||"set"in r)throw sr("Accessors not supported");return"value"in r&&(e[t]=r.value),e};var fr=Qt,pr=V,vr=w?function(e,t,r){return fr.f(e,t,pr(1,r))}:function(e,t,r){return e[t]=r,e},_r=n,mr=d,gr=b,yr=R,Sr=A.f,Er=Kt,br=ee,kr=Yt,Tr=vr,Ir=Ye,Rr=function(e){var t=function(r,n,i){if(this instanceof t){switch(arguments.length){case 0:return new e;case 1:return new e(r);case 2:return new e(r,n)}return new e(r,n,i)}return mr(e,this,arguments)};return t.prototype=e.prototype,t},Ar=function(e,t){var r,n,i,o,a,s,c,u,d=e.target,l=e.global,h=e.stat,f=e.proto,p=l?_r:h?_r[d]:(_r[d]||{}).prototype,v=l?br:br[d]||Tr(br,d,{})[d],_=v.prototype;for(i in t)r=!Er(l?i:d+(h?".":"#")+i,e.forced)&&p&&Ir(p,i),a=v[i],r&&(s=e.dontCallGetSet?(u=Sr(p,i))&&u.value:p[i]),o=r&&s?s:t[i],r&&typeof a==typeof o||(c=e.bind&&r?kr(o,_r):e.wrap&&r?Rr(o):f&&yr(o)?gr(o):o,(e.sham||o&&o.sham||a&&a.sham)&&Tr(c,"sham",!0),Tr(v,i,c),f&&(Ir(br,n=d+"Prototype")||Tr(br,n,{}),Tr(br[n],i,o),e.real&&_&&!_[i]&&Tr(_,i,o)))},wr=Math.ceil,Cr=Math.floor,Or=Math.trunc||function(e){var t=+e;return(t>0?Cr:wr)(t)},Dr=function(e){var t=+e;return t!=t||0===t?0:Or(t)},xr=Dr,Nr=Math.max,Pr=Math.min,Mr=function(e,t){var r=xr(e);return r<0?Nr(r+t,0):Pr(r,t)},Lr=Dr,Ur=Math.min,Vr=function(e){return e>0?Ur(Lr(e),9007199254740991):0},Fr=Vr,Br=function(e){return Fr(e.length)},jr=Q,Gr=Mr,Hr=Br,zr=function(e){return function(t,r,n){var i,o=jr(t),a=Hr(o),s=Gr(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}},Kr={includes:zr(!0),indexOf:zr(!1)},Xr={},qr=Ye,Wr=Q,Yr=Kr.indexOf,Qr=Xr,Jr=b([].push),Zr=function(e,t){var r,n=Wr(e),i=0,o=[];for(r in n)!qr(Qr,r)&&qr(n,r)&&Jr(o,r);for(;t.length>i;)qr(n,r=t[i++])&&(~Yr(o,r)||Jr(o,r));return o},$r=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],en=Zr,tn=$r,rn=Object.keys||function(e){return en(e,tn)},nn=Xe,on=rn;Ar({target:"Object",stat:!0,forced:i((function(){on(1)}))},{keys:function(e){return on(nn(e))}});var an=ee.Object.keys,sn={};sn[lt("toStringTag")]="z";var cn="[object z]"===String(sn),un=cn,dn=R,ln=y,hn=lt("toStringTag"),fn=Object,pn="Arguments"==ln(function(){return arguments}()),vn=un?ln: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=fn(e),hn))?r:pn?ln(t):"Object"==(n=ln(t))&&dn(t.callee)?"Arguments":n},_n=vn,mn=String,gn=function(e){if("Symbol"===_n(e))throw TypeError("Cannot convert a Symbol value to a string");return mn(e)},yn={},Sn=w,En=Jt,bn=Qt,kn=tr,Tn=Q,In=rn;yn.f=Sn&&!En?Object.defineProperties:function(e,t){kn(e);for(var r,n=Tn(t),i=In(t),o=i.length,a=0;o>a;)bn.f(e,r=i[a++],n[r]);return e};var Rn,An=oe("document","documentElement"),wn=Ue.exports,Cn=et,On=wn("keys"),Dn=function(e){return On[e]||(On[e]=Cn(e))},xn=tr,Nn=yn,Pn=$r,Mn=Xr,Ln=An,Un=It,Vn=Dn("IE_PROTO"),Fn=function(){},Bn=function(e){return"<script>"+e+"</"+"script>"},jn=function(e){e.write(Bn("")),e.close();var t=e.parentWindow.Object;return e=null,t},Gn=function(){try{Rn=new ActiveXObject("htmlfile")}catch(n){}var e,t;Gn="undefined"!=typeof document?document.domain&&Rn?jn(Rn):((t=Un("iframe")).style.display="none",Ln.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(Bn("document.F=Object")),e.close(),e.F):jn(Rn);for(var r=Pn.length;r--;)delete Gn.prototype[Pn[r]];return Gn()};Mn[Vn]=!0;var Hn=Object.create||function(e,t){var r;return null!==e?(Fn.prototype=xn(e),r=new Fn,Fn.prototype=null,r[Vn]=e):r=Gn(),void 0===t?r:Nn.f(r,t)},zn={},Kn=Zr,Xn=$r.concat("length","prototype");zn.f=Object.getOwnPropertyNames||function(e){return Kn(e,Xn)};var qn={},Wn=Et,Yn=Qt,Qn=V,Jn=function(e,t,r){var n=Wn(t);n in e?Yn.f(e,n,Qn(0,r)):e[n]=r},Zn=Mr,$n=Br,ei=Jn,ti=Array,ri=Math.max,ni=function(e,t,r){for(var n=$n(e),i=Zn(t,n),o=Zn(void 0===r?n:r,n),a=ti(ri(o-i,0)),s=0;i<o;i++,s++)ei(a,s,e[i]);return a.length=s,a},ii=y,oi=Q,ai=zn.f,si=ni,ci="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];qn.f=function(e){return ci&&"Window"==ii(e)?function(e){try{return ai(e)}catch(t){return si(ci)}}(e):ai(oi(e))};var ui={};ui.f=Object.getOwnPropertySymbols;var di=vr,li=function(e,t,r,n){return n&&n.enumerable?e[t]=r:di(e,t,r),e},hi={},fi=lt;hi.f=fi;var pi,vi,_i,mi=ee,gi=Ye,yi=hi,Si=Qt.f,Ei=function(e){var t=mi.Symbol||(mi.Symbol={});gi(t,e)||Si(t,e,{value:yi.f(e)})},bi=D,ki=oe,Ti=lt,Ii=li,Ri=function(){var e=ki("Symbol"),t=e&&e.prototype,r=t&&t.valueOf,n=Ti("toPrimitive");t&&!t[n]&&Ii(t,n,(function(e){return bi(r,this)}),{arity:1})},Ai=vn,wi=cn?{}.toString:function(){return"[object "+Ai(this)+"]"},Ci=cn,Oi=Qt.f,Di=vr,xi=Ye,Ni=wi,Pi=lt("toStringTag"),Mi=function(e,t,r,n){if(e){var i=r?e:e.prototype;xi(i,Pi)||Oi(i,Pi,{configurable:!0,value:t}),n&&!Ci&&Di(i,"toString",Ni)}},Li=R,Ui=n.WeakMap,Vi=Li(Ui)&&/native code/.test(String(Ui)),Fi=Vi,Bi=n,ji=$,Gi=vr,Hi=Ye,zi=Ge,Ki=Dn,Xi=Xr,qi="Object already initialized",Wi=Bi.TypeError,Yi=Bi.WeakMap;if(Fi||zi.state){var Qi=zi.state||(zi.state=new Yi);Qi.get=Qi.get,Qi.has=Qi.has,Qi.set=Qi.set,pi=function(e,t){if(Qi.has(e))throw Wi(qi);return t.facade=e,Qi.set(e,t),t},vi=function(e){return Qi.get(e)||{}},_i=function(e){return Qi.has(e)}}else{var Ji=Ki("state");Xi[Ji]=!0,pi=function(e,t){if(Hi(e,Ji))throw Wi(qi);return t.facade=e,Gi(e,Ji,t),t},vi=function(e){return Hi(e,Ji)?e[Ji]:{}},_i=function(e){return Hi(e,Ji)}}var Zi={set:pi,get:vi,has:_i,enforce:function(e){return _i(e)?vi(e):pi(e,{})},getterFor:function(e){return function(t){var r;if(!ji(t)||(r=vi(t)).type!==e)throw Wi("Incompatible receiver, "+e+" required");return r}}},$i=y,eo=Array.isArray||function(e){return"Array"==$i(e)},to=R,ro=Ge,no=b(Function.toString);to(ro.inspectSource)||(ro.inspectSource=function(e){return no(e)});var io=ro.inspectSource,oo=b,ao=i,so=R,co=vn,uo=io,lo=function(){},ho=[],fo=oe("Reflect","construct"),po=/^\s*(?:class|function)\b/,vo=oo(po.exec),_o=!po.exec(lo),mo=function(e){if(!so(e))return!1;try{return fo(lo,ho,e),!0}catch(t){return!1}},go=function(e){if(!so(e))return!1;switch(co(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return _o||!!vo(po,uo(e))}catch(t){return!0}};go.sham=!0;var yo=!fo||ao((function(){var e;return mo(mo.call)||!mo(Object)||!mo((function(){e=!0}))||e}))?go:mo,So=eo,Eo=yo,bo=$,ko=lt("species"),To=Array,Io=function(e){var t;return So(e)&&(t=e.constructor,(Eo(t)&&(t===To||So(t.prototype))||bo(t)&&null===(t=t[ko]))&&(t=void 0)),void 0===t?To:t},Ro=function(e,t){return new(Io(e))(0===t?0:t)},Ao=Yt,wo=H,Co=Xe,Oo=Br,Do=Ro,xo=b([].push),No=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=Co(c),v=wo(p),_=Ao(u,d),m=Oo(v),g=0,y=l||Do,S=t?y(c,m):r||a?y(c,0):void 0;m>g;g++)if((s||g in v)&&(f=_(h=v[g],g,p),e))if(t)S[g]=f;else if(f)switch(e){case 3:return!0;case 5:return h;case 6:return g;case 2:xo(S,h)}else switch(e){case 4:return!1;case 7:xo(S,h)}return o?-1:n||i?i:S}},Po={forEach:No(0),map:No(1),filter:No(2),some:No(3),every:No(4),find:No(5),findIndex:No(6),filterReject:No(7)},Mo=Ar,Lo=n,Uo=D,Vo=b,Fo=w,Bo=me,jo=i,Go=Ye,Ho=ae,zo=tr,Ko=Q,Xo=Et,qo=gn,Wo=V,Yo=Hn,Qo=rn,Jo=zn,Zo=qn,$o=ui,ea=A,ta=Qt,ra=yn,na=x,ia=li,oa=Ue.exports,aa=Xr,sa=et,ca=lt,ua=hi,da=Ei,la=Ri,ha=Mi,fa=Zi,pa=Po.forEach,va=Dn("hidden"),_a="Symbol",ma=fa.set,ga=fa.getterFor(_a),ya=Object.prototype,Sa=Lo.Symbol,Ea=Sa&&Sa.prototype,ba=Lo.TypeError,ka=Lo.QObject,Ta=ea.f,Ia=ta.f,Ra=Zo.f,Aa=na.f,wa=Vo([].push),Ca=oa("symbols"),Oa=oa("op-symbols"),Da=oa("wks"),xa=!ka||!ka.prototype||!ka.prototype.findChild,Na=Fo&&jo((function(){return 7!=Yo(Ia({},"a",{get:function(){return Ia(this,"a",{value:7}).a}})).a}))?function(e,t,r){var n=Ta(ya,t);n&&delete ya[t],Ia(e,t,r),n&&e!==ya&&Ia(ya,t,n)}:Ia,Pa=function(e,t){var r=Ca[e]=Yo(Ea);return ma(r,{type:_a,tag:e,description:t}),Fo||(r.description=t),r},Ma=function(e,t,r){e===ya&&Ma(Oa,t,r),zo(e);var n=Xo(t);return zo(r),Go(Ca,n)?(r.enumerable?(Go(e,va)&&e[va][n]&&(e[va][n]=!1),r=Yo(r,{enumerable:Wo(0,!1)})):(Go(e,va)||Ia(e,va,Wo(1,{})),e[va][n]=!0),Na(e,n,r)):Ia(e,n,r)},La=function(e,t){zo(e);var r=Ko(t),n=Qo(r).concat(Ba(r));return pa(n,(function(t){Fo&&!Uo(Ua,r,t)||Ma(e,t,r[t])})),e},Ua=function(e){var t=Xo(e),r=Uo(Aa,this,t);return!(this===ya&&Go(Ca,t)&&!Go(Oa,t))&&(!(r||!Go(this,t)||!Go(Ca,t)||Go(this,va)&&this[va][t])||r)},Va=function(e,t){var r=Ko(e),n=Xo(t);if(r!==ya||!Go(Ca,n)||Go(Oa,n)){var i=Ta(r,n);return!i||!Go(Ca,n)||Go(r,va)&&r[va][n]||(i.enumerable=!0),i}},Fa=function(e){var t=Ra(Ko(e)),r=[];return pa(t,(function(e){Go(Ca,e)||Go(aa,e)||wa(r,e)})),r},Ba=function(e){var t=e===ya,r=Ra(t?Oa:Ko(e)),n=[];return pa(r,(function(e){!Go(Ca,e)||t&&!Go(ya,e)||wa(n,Ca[e])})),n};Bo||(Sa=function(){if(Ho(Ea,this))throw ba("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?qo(arguments[0]):void 0,t=sa(e),r=function(e){this===ya&&Uo(r,Oa,e),Go(this,va)&&Go(this[va],t)&&(this[va][t]=!1),Na(this,t,Wo(1,e))};return Fo&&xa&&Na(ya,t,{configurable:!0,set:r}),Pa(t,e)},ia(Ea=Sa.prototype,"toString",(function(){return ga(this).tag})),ia(Sa,"withoutSetter",(function(e){return Pa(sa(e),e)})),na.f=Ua,ta.f=Ma,ra.f=La,ea.f=Va,Jo.f=Zo.f=Fa,$o.f=Ba,ua.f=function(e){return Pa(ca(e),e)},Fo&&Ia(Ea,"description",{configurable:!0,get:function(){return ga(this).description}})),Mo({global:!0,constructor:!0,wrap:!0,forced:!Bo,sham:!Bo},{Symbol:Sa}),pa(Qo(Da),(function(e){da(e)})),Mo({target:_a,stat:!0,forced:!Bo},{useSetter:function(){xa=!0},useSimple:function(){xa=!1}}),Mo({target:"Object",stat:!0,forced:!Bo,sham:!Fo},{create:function(e,t){return void 0===t?Yo(e):La(Yo(e),t)},defineProperty:Ma,defineProperties:La,getOwnPropertyDescriptor:Va}),Mo({target:"Object",stat:!0,forced:!Bo},{getOwnPropertyNames:Fa}),la(),ha(Sa,_a),aa[va]=!0;var ja=me&&!!Symbol.for&&!!Symbol.keyFor,Ga=Ar,Ha=oe,za=Ye,Ka=gn,Xa=Ue.exports,qa=ja,Wa=Xa("string-to-symbol-registry"),Ya=Xa("symbol-to-string-registry");Ga({target:"Symbol",stat:!0,forced:!qa},{for:function(e){var t=Ka(e);if(za(Wa,t))return Wa[t];var r=Ha("Symbol")(t);return Wa[t]=r,Ya[r]=t,r}});var Qa=Ar,Ja=Ye,Za=ke,$a=Ie,es=ja,ts=(0,Ue.exports)("symbol-to-string-registry");Qa({target:"Symbol",stat:!0,forced:!es},{keyFor:function(e){if(!Za(e))throw TypeError($a(e)+" is not a symbol");if(Ja(ts,e))return ts[e]}});var rs=b([].slice),ns=Ar,is=oe,os=d,as=D,ss=b,cs=i,us=eo,ds=R,ls=$,hs=ke,fs=rs,ps=me,vs=is("JSON","stringify"),_s=ss(/./.exec),ms=ss("".charAt),gs=ss("".charCodeAt),ys=ss("".replace),Ss=ss(1..toString),Es=/[\uD800-\uDFFF]/g,bs=/^[\uD800-\uDBFF]$/,ks=/^[\uDC00-\uDFFF]$/,Ts=!ps||cs((function(){var e=is("Symbol")();return"[null]"!=vs([e])||"{}"!=vs({a:e})||"{}"!=vs(Object(e))})),Is=cs((function(){return'"\\udf06\\ud834"'!==vs("\udf06\ud834")||'"\\udead"'!==vs("\udead")})),Rs=function(e,t){var r=fs(arguments),n=t;if((ls(t)||void 0!==e)&&!hs(e))return us(t)||(t=function(e,t){if(ds(n)&&(t=as(n,this,e,t)),!hs(t))return t}),r[1]=t,os(vs,null,r)},As=function(e,t,r){var n=ms(r,t-1),i=ms(r,t+1);return _s(bs,e)&&!_s(ks,i)||_s(ks,e)&&!_s(bs,n)?"\\u"+Ss(gs(e,0),16):e};vs&&ns({target:"JSON",stat:!0,arity:3,forced:Ts||Is},{stringify:function(e,t,r){var n=fs(arguments),i=os(Ts?Rs:vs,null,n);return Is&&"string"==typeof i?ys(i,Es,As):i}});var ws=ui,Cs=Xe;Ar({target:"Object",stat:!0,forced:!me||i((function(){ws.f(1)}))},{getOwnPropertySymbols:function(e){var t=ws.f;return t?t(Cs(e)):[]}});var Os=ee.Object.getOwnPropertySymbols,Ds=i,xs=pe,Ns=lt("species"),Ps=function(e){return xs>=51||!Ds((function(){var t=[];return(t.constructor={})[Ns]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},Ms=Po.filter;Ar({target:"Array",proto:!0,forced:!Ps("filter")},{filter:function(e){return Ms(this,e,arguments.length>1?arguments[1]:void 0)}});var Ls=ee,Us=function(e){return Ls[e+"Prototype"]},Vs=Us("Array").filter,Fs=ae,Bs=Vs,js=Array.prototype,Gs=function(e){var t=e.filter;return e===js||Fs(js,e)&&t===js.filter?Bs:t},Hs={exports:{}},zs=Ar,Ks=i,Xs=Q,qs=A.f,Ws=w,Ys=Ks((function(){qs(1)}));zs({target:"Object",stat:!0,forced:!Ws||Ys,sham:!Ws},{getOwnPropertyDescriptor:function(e,t){return qs(Xs(e),t)}});var Qs=ee.Object,Js=Hs.exports=function(e,t){return Qs.getOwnPropertyDescriptor(e,t)};Qs.getOwnPropertyDescriptor.sham&&(Js.sham=!0);var Zs,$s,ec,tc=Hs.exports,rc={},nc=w,ic=Ye,oc=Function.prototype,ac=nc&&Object.getOwnPropertyDescriptor,sc=ic(oc,"name"),cc={EXISTS:sc,PROPER:sc&&"something"===function(){}.name,CONFIGURABLE:sc&&(!nc||nc&&ac(oc,"name").configurable)},uc=!i((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),dc=Ye,lc=R,hc=Xe,fc=uc,pc=Dn("IE_PROTO"),vc=Object,_c=vc.prototype,mc=fc?vc.getPrototypeOf:function(e){var t=hc(e);if(dc(t,pc))return t[pc];var r=t.constructor;return lc(r)&&t instanceof r?r.prototype:t instanceof vc?_c:null},gc=i,yc=R,Sc=$,Ec=Hn,bc=mc,kc=li,Tc=lt("iterator"),Ic=!1;[].keys&&("next"in(ec=[].keys())?($s=bc(bc(ec)))!==Object.prototype&&(Zs=$s):Ic=!0);var Rc=!Sc(Zs)||gc((function(){var e={};return Zs[Tc].call(e)!==e}));yc((Zs=Rc?{}:Ec(Zs))[Tc])||kc(Zs,Tc,(function(){return this}));var Ac={IteratorPrototype:Zs,BUGGY_SAFARI_ITERATORS:Ic},wc=Ac.IteratorPrototype,Cc=Hn,Oc=V,Dc=Mi,xc=rc,Nc=function(){return this},Pc=function(e,t,r,n){var i=t+" Iterator";return e.prototype=Cc(wc,{next:Oc(+!n,r)}),Dc(e,i,!1,!0),xc[i]=Nc,e},Mc=R,Lc=String,Uc=TypeError,Vc=b,Fc=tr,Bc=function(e){if("object"==typeof e||Mc(e))return e;throw Uc("Can't set "+Lc(e)+" as a prototype")},jc=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=Vc(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(r,[]),t=r instanceof Array}catch(n){}return function(r,n){return Fc(r),Bc(n),t?e(r,n):r.__proto__=n,r}}():void 0),Gc=Ar,Hc=D,zc=Pc,Kc=mc,Xc=Mi,qc=li,Wc=rc,Yc=cc.PROPER,Qc=Ac.BUGGY_SAFARI_ITERATORS,Jc=lt("iterator"),Zc="keys",$c="values",eu="entries",tu=function(){return this},ru=function(e,t,r,n,i,o,a){zc(r,t,n);var s,c,u,d=function(e){if(e===i&&v)return v;if(!Qc&&e in f)return f[e];switch(e){case Zc:case $c:case eu:return function(){return new r(this,e)}}return function(){return new r(this)}},l=t+" Iterator",h=!1,f=e.prototype,p=f[Jc]||f["@@iterator"]||i&&f[i],v=!Qc&&p||d(i),_="Array"==t&&f.entries||p;if(_&&(s=Kc(_.call(new e)))!==Object.prototype&&s.next&&(Xc(s,l,!0,!0),Wc[l]=tu),Yc&&i==$c&&p&&p.name!==$c&&(h=!0,v=function(){return Hc(p,this)}),i)if(c={values:d($c),keys:o?v:d(Zc),entries:d(eu)},a)for(u in c)(Qc||h||!(u in f))&&qc(f,u,c[u]);else Gc({target:t,proto:!0,forced:Qc||h},c);return a&&f[Jc]!==v&&qc(f,Jc,v,{name:i}),Wc[t]=v,c},nu=function(e,t){return{value:e,done:t}},iu=Q,ou=function(){},au=rc,su=Zi,cu=(Qt.f,ru),uu=nu,du="Array Iterator",lu=su.set,hu=su.getterFor(du);cu(Array,"Array",(function(e,t){lu(this,{type:du,target:iu(e),index:0,kind:t})}),(function(){var e=hu(this),t=e.target,r=e.kind,n=e.index++;return!t||n>=t.length?(e.target=void 0,uu(void 0,!0)):uu("keys"==r?n:"values"==r?t[n]:[n,t[n]],!1)}),"values");au.Arguments=au.Array;ou(),ou(),ou();var fu={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},pu=n,vu=vn,_u=vr,mu=rc,gu=lt("toStringTag");for(var yu in fu){var Su=pu[yu],Eu=Su&&Su.prototype;Eu&&vu(Eu)!==gu&&_u(Eu,gu,yu),mu[yu]=mu.Array}var bu=i,ku=function(e,t){var r=[][e];return!!r&&bu((function(){r.call(null,t||function(){return 1},1)}))},Tu=Po.forEach,Iu=ku("forEach")?[].forEach:function(e){return Tu(this,e,arguments.length>1?arguments[1]:void 0)};Ar({target:"Array",proto:!0,forced:[].forEach!=Iu},{forEach:Iu});var Ru=Us("Array").forEach,Au=vn,wu=Ye,Cu=ae,Ou=Ru,Du=Array.prototype,xu={DOMTokenList:!0,NodeList:!0},Nu=function(e){var t=e.forEach;return e===Du||Cu(Du,e)&&t===Du.forEach||wu(xu,Au(e))?Ou:t},Pu=oe,Mu=zn,Lu=ui,Uu=tr,Vu=b([].concat),Fu=Pu("Reflect","ownKeys")||function(e){var t=Mu.f(Uu(e)),r=Lu.f;return r?Vu(t,r(e)):t},Bu=Fu,ju=Q,Gu=A,Hu=Jn;Ar({target:"Object",stat:!0,sham:!w},{getOwnPropertyDescriptors:function(e){for(var t,r,n=ju(e),i=Gu.f,o=Bu(n),a={},s=0;o.length>s;)void 0!==(r=i(n,t=o[s++]))&&Hu(a,t,r);return a}});var zu=ee.Object.getOwnPropertyDescriptors,Ku={exports:{}},Xu=Ar,qu=w,Wu=yn.f;Xu({target:"Object",stat:!0,forced:Object.defineProperties!==Wu,sham:!qu},{defineProperties:Wu});var Yu=ee.Object,Qu=Ku.exports=function(e,t){return Yu.defineProperties(e,t)};Yu.defineProperties.sham&&(Qu.sham=!0);var Ju=Ku.exports,Zu={exports:{}},$u=Ar,ed=w,td=Qt.f;$u({target:"Object",stat:!0,forced:Object.defineProperty!==td,sham:!ed},{defineProperty:td});var rd=ee.Object,nd=Zu.exports=function(e,t,r){return rd.defineProperty(e,t,r)};rd.defineProperty.sham&&(nd.sham=!0);var id=Zu.exports;function od(e,t,r){return t in e?id(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ad(e,t){var r=an(e);if(Os){var n=Os(e);t&&(n=Gs(n).call(n,(function(t){return tc(e,t).enumerable}))),r.push.apply(r,n)}return r}function sd(e){for(var t=1;t<arguments.length;t++){var r,n,i=null!=arguments[t]?arguments[t]:{};t%2?Nu(r=ad(Object(i),!0)).call(r,(function(t){od(e,t,i[t])})):zu?Ju(e,zu(i)):Nu(n=ad(Object(i))).call(n,(function(t){id(e,t,tc(i,t))}))}return e}var cd=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}(cd||{}),ud=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}(ud||{}),dd=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}(dd||{}),ld=function(e){return e[e.CHANNEL_PROFILE_COMMUNICATION=0]="CHANNEL_PROFILE_COMMUNICATION",e[e.CHANNEL_PROFILE_LIVE_BROADCASTING=1]="CHANNEL_PROFILE_LIVE_BROADCASTING",e}(ld||{}),hd=function(e){return e[e.AUTO_SUBSCRIBE_MODE=0]="AUTO_SUBSCRIBE_MODE",e[e.MANUAL_SUBSCRIBE_MODE=1]="MANUAL_SUBSCRIBE_MODE",e}(hd||{}),fd=function(e){return e[e.SUBSCRIBE_SUCC=0]="SUBSCRIBE_SUCC",e[e.SUBSCRIBE_FAIL=1]="SUBSCRIBE_FAIL",e}(fd||{}),pd=function(e){return e[e.PUBLISH_SUCC=0]="PUBLISH_SUCC",e[e.PUBLISH_FAIL=1]="PUBLISH_FAIL",e}(pd||{}),vd=function(e){return e[e.MIRROR_MODE_OFF=0]="MIRROR_MODE_OFF",e[e.MIRROR_MODE_ON=1]="MIRROR_MODE_ON",e}(vd||{}),_d=function(e){return e[e.RENDER_MODE_HIDDEN=0]="RENDER_MODE_HIDDEN",e[e.RENDER_MODE_FIT=1]="RENDER_MODE_FIT",e}(_d||{}),md=function(e){return e[e.STREAM_INDEX_MAIN=0]="STREAM_INDEX_MAIN",e[e.STREAM_INDEX_SCREEN=1]="STREAM_INDEX_SCREEN",e}(md||{}),gd=function(e){return e[e.AUDIO=1]="AUDIO",e[e.VIDEO=2]="VIDEO",e[e.AUDIO_AND_VIDEO=3]="AUDIO_AND_VIDEO",e}(gd||{}),yd=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}(yd||{}),Sd=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}(Sd||{}),Ed=function(e){return e[e.MIRROR_TYPE_NONE=0]="MIRROR_TYPE_NONE",e[e.MIRROR_TYPE_RENDER=1]="MIRROR_TYPE_RENDER",e}(Ed||{}),bd=function(e){return e[e.domestic=0]="domestic",e[e.overseas=1]="overseas",e}(bd||{}),kd=function(e){return e[e.OFFLINE=0]="OFFLINE",e[e.ONLINE=1]="ONLINE",e[e.UNREACHABLE=2]="UNREACHABLE",e}(kd||{}),Td=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}(Td||{}),Id=function(e){return e[e.PREV_FRAME=0]="PREV_FRAME",e[e.OTHER_FRAME=1]="OTHER_FRAME",e}(Id||{}),Rd=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}(Rd||{}),Ad=function(e){return e[e.LOW=0]="LOW",e[e.MEDIUM=100]="MEDIUM",e[e.HIGH=200]="HIGH",e}(Ad||{}),wd=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}(wd||{}),Cd=function(e){return e[e.Unknown=-1]="Unknown",e[e.SubscribeFallbackByBandwidth=0]="SubscribeFallbackByBandwidth",e[e.SubscribeRecoverByBandwidth=2]="SubscribeRecoverByBandwidth",e}(Cd||{}),Od=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}(Od||{}),Dd=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}(Dd||{}),xd=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}(xd||{}),Nd=function(e){return e.LC="LC",e.HEv1="HEv1",e.HEv2="HEv2",e}(Nd||{}),Pd=function(e){return e.H264="H264",e.H265="H265",e}(Pd||{}),Md=function(e){return e[e.ASR_ONLY=0]="ASR_ONLY",e[e.ASR_AND_TRANSLATION=1]="ASR_AND_TRANSLATION",e}(Md||{}),Ld=function(e){return e[e.STARTED=0]="STARTED",e[e.STOPPED=1]="STOPPED",e[e.ERROR=2]="ERROR",e}(Ld||{}),Ud=Object.freeze(Object.defineProperty({__proto__:null,VideoSourceType:cd,AudioSourceType:ud,UserOfflineReason:dd,ChannelProfile:ld,SubscribeMode:hd,SubscribeState:fd,PublishState:pd,MirrorMode:vd,VideoRenderMode:_d,StreamIndex:md,MediaType:gd,StreamRemoveReason:yd,ConnectionState:Sd,MirrorType:Ed,LogChannel:bd,USER_ONLINE_STATUS:kd,PublicStreamType:Td,PublicInterpolationMode:Id,SubscribeFallbackOption:Rd,RemoteUserPriority:Ad,NetworkQuality:wd,FallbackOrRecoverReason:Cd,RoomProfileType:Od,AudioProfileType:Dd,RTCAutoPlayPolicy:xd,AAC_PROFILE:Nd,TRANSCODING_VIDEO_CODEC:Pd,SUBTITLE_MODE:Md,SubtitleEventType:Ld},Symbol.toStringTag,{value:"Module"})),Vd=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}(Vd||{}),Fd=function(e){return e[e.PLAYOUT=0]="PLAYOUT",e[e.PUBLISH=1]="PUBLISH",e[e.PLAYOUT_AND_PUBLISH=2]="PLAYOUT_AND_PUBLISH",e}(Fd||{}),Bd=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}(Bd||{}),jd=Object.freeze(Object.defineProperty({__proto__:null,AudioMixingDualMonoMode:Vd,AudioMixingType:Fd,AudioMixingState:Bd},Symbol.toStringTag,{value:"Module"})),Gd=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.onSubtitleStateChanged="onSubtitleStateChanged",e.onSubtitleMessageReceived="onSubtitleMessageReceived",e.onServerParamsSetResult="onServerParamsSetResult",e}(Gd||{});function Hd(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),id(e,n.key,n)}}function zd(e,t,r){return t&&Hd(e.prototype,t),r&&Hd(e,r),id(e,"prototype",{writable:!1}),e}function Kd(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var Xd=TypeError,qd=function(e){if(e>9007199254740991)throw Xd("Maximum allowed index exceeded");return e},Wd=Ar,Yd=i,Qd=eo,Jd=$,Zd=Xe,$d=Br,el=qd,tl=Jn,rl=Ro,nl=Ps,il=pe,ol=lt("isConcatSpreadable"),al=il>=51||!Yd((function(){var e=[];return e[ol]=!1,e.concat()[0]!==e})),sl=nl("concat"),cl=function(e){if(!Jd(e))return!1;var t=e[ol];return void 0!==t?!!t:Qd(e)};Wd({target:"Array",proto:!0,arity:1,forced:!al||!sl},{concat:function(e){var t,r,n,i,o,a=Zd(this),s=rl(a,0),c=0;for(t=-1,n=arguments.length;t<n;t++)if(cl(o=-1===t?a:arguments[t]))for(i=$d(o),el(c+i),r=0;r<i;r++,c++)r in o&&tl(s,c,o[r]);else el(c+1),tl(s,c++,o);return s.length=c,s}}),Ei("asyncIterator"),Ei("hasInstance"),Ei("isConcatSpreadable"),Ei("iterator"),Ei("match"),Ei("matchAll"),Ei("replace"),Ei("search"),Ei("species"),Ei("split");var ul=Ri;Ei("toPrimitive"),ul();var dl=oe,ll=Mi;Ei("toStringTag"),ll(dl("Symbol"),"Symbol"),Ei("unscopables"),Mi(n.JSON,"JSON",!0);var hl=ee.Symbol;Ei("asyncDispose"),Ei("dispose"),Ei("matcher"),Ei("metadataKey"),Ei("observable"),Ei("metadata"),Ei("patternMatch"),Ei("replaceAll");var fl=hl,pl=b,vl=Dr,_l=gn,ml=q,gl=pl("".charAt),yl=pl("".charCodeAt),Sl=pl("".slice),El=function(e){return function(t,r){var n,i,o=_l(ml(t)),a=vl(r),s=o.length;return a<0||a>=s?e?"":void 0:(n=yl(o,a))<55296||n>56319||a+1===s||(i=yl(o,a+1))<56320||i>57343?e?gl(o,a):n:e?Sl(o,a,a+2):i-56320+(n-55296<<10)+65536}},bl={codeAt:El(!1),charAt:El(!0)},kl=bl.charAt,Tl=gn,Il=Zi,Rl=ru,Al=nu,wl="String Iterator",Cl=Il.set,Ol=Il.getterFor(wl);Rl(String,"String",(function(e){Cl(this,{type:wl,string:Tl(e),index:0})}),(function(){var e,t=Ol(this),r=t.string,n=t.index;return n>=r.length?Al(void 0,!0):(e=kl(r,n),t.index+=e.length,Al(e,!1))}));var Dl=hi.f("iterator");function xl(e){return(xl="function"==typeof fl&&"symbol"==typeof Dl?function(e){return typeof e}:function(e){return e&&"function"==typeof fl&&e.constructor===fl&&e!==fl.prototype?"symbol":typeof e})(e)}Ar({target:"Object",stat:!0,sham:!w},{create:Hn});var Nl=ee.Object,Pl=function(e,t){return Nl.create(e,t)},Ml=Xe,Ll=mc,Ul=uc;Ar({target:"Object",stat:!0,forced:i((function(){Ll(1)})),sham:!Ul},{getPrototypeOf:function(e){return Ll(Ml(e))}});var Vl=ee.Object.getPrototypeOf;Ar({target:"Object",stat:!0},{setPrototypeOf:jc});var Fl=ee.Object.setPrototypeOf,Bl=Ye,jl=Fu,Gl=A,Hl=Qt,zl=Error,Kl=b("".replace),Xl=String(zl("zxcasd").stack),ql=/\n\s*at [^:]*:[^\n]*/,Wl=ql.test(Xl),Yl=$,Ql=vr,Jl=rc,Zl=lt("iterator"),$l=Array.prototype,eh=function(e){return void 0!==e&&(Jl.Array===e||$l[Zl]===e)},th=vn,rh=xe,nh=z,ih=rc,oh=lt("iterator"),ah=function(e){if(!nh(e))return rh(e,oh)||rh(e,"@@iterator")||ih[th(e)]},sh=D,ch=Ce,uh=tr,dh=Ie,lh=ah,hh=TypeError,fh=function(e,t){var r=arguments.length<2?lh(e):t;if(ch(r))return uh(sh(r,e));throw hh(dh(e)+" is not iterable")},ph=D,vh=tr,_h=xe,mh=function(e,t,r){var n,i;vh(e);try{if(!(n=_h(e,"return"))){if("throw"===t)throw r;return r}n=ph(n,e)}catch(o){i=!0,n=o}if("throw"===t)throw r;if(i)throw n;return vh(n),r},gh=Yt,yh=D,Sh=tr,Eh=Ie,bh=eh,kh=Br,Th=ae,Ih=fh,Rh=ah,Ah=mh,wh=TypeError,Ch=function(e,t){this.stopped=e,this.result=t},Oh=Ch.prototype,Dh=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=gh(t,d),_=function(e){return n&&Ah(n,"normal",e),new Ch(!0,e)},m=function(e){return l?(Sh(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=Rh(e)))throw wh(Eh(e)+" is not iterable");if(bh(i)){for(o=0,a=kh(e);a>o;o++)if((s=m(e[o]))&&Th(Oh,s))return s;return new Ch(!1)}n=Ih(e,i)}for(c=h?e.next:n.next;!(u=yh(c,n)).done;){try{s=m(u.value)}catch(g){Ah(n,"throw",g)}if("object"==typeof s&&s&&Th(Oh,s))return s}return new Ch(!1)},xh=gn,Nh=V,Ph=!i((function(){var e=Error("a");return!("stack"in e)||(Object.defineProperty(e,"stack",Nh(1,7)),7!==e.stack)})),Mh=Ar,Lh=ae,Uh=mc,Vh=jc,Fh=function(e,t,r){for(var n=jl(t),i=Hl.f,o=Gl.f,a=0;a<n.length;a++){var s=n[a];Bl(e,s)||r&&Bl(r,s)||i(e,s,o(t,s))}},Bh=Hn,jh=vr,Gh=V,Hh=function(e,t){if(Wl&&"string"==typeof e&&!zl.prepareStackTrace)for(;t--;)e=Kl(e,ql,"");return e},zh=function(e,t){Yl(t)&&"cause"in t&&Ql(e,"cause",t.cause)},Kh=Dh,Xh=function(e,t){return void 0===e?arguments.length<2?"":t:xh(e)},qh=Ph,Wh=lt("toStringTag"),Yh=Error,Qh=[].push,Jh=function(e,t){var r,n=arguments.length>2?arguments[2]:void 0,i=Lh(Zh,this);Vh?r=Vh(Yh(),i?Uh(this):Zh):(r=i?this:Bh(Zh),jh(r,Wh,"Error")),void 0!==t&&jh(r,"message",Xh(t)),qh&&jh(r,"stack",Hh(r.stack,1)),zh(r,n);var o=[];return Kh(e,Qh,{that:o}),jh(r,"errors",o),r};Vh?Vh(Jh,Yh):Fh(Jh,Yh,{name:!0});var Zh=Jh.prototype=Bh(Yh.prototype,{constructor:Gh(1,Jh),message:Gh(1,""),name:Gh(1,"AggregateError")});Mh({global:!0,constructor:!0,arity:2},{AggregateError:Jh});var $h,ef,tf,rf,nf="process"==y(n.process),of=oe,af=Qt,sf=w,cf=lt("species"),uf=function(e){var t=of(e),r=af.f;sf&&t&&!t[cf]&&r(t,cf,{configurable:!0,get:function(){return this}})},df=ae,lf=TypeError,hf=function(e,t){if(df(t,e))return e;throw lf("Incorrect invocation")},ff=yo,pf=Ie,vf=TypeError,_f=function(e){if(ff(e))return e;throw vf(pf(e)+" is not a constructor")},mf=tr,gf=_f,yf=z,Sf=lt("species"),Ef=function(e,t){var r,n=mf(e).constructor;return void 0===n||yf(r=mf(n)[Sf])?t:gf(r)},bf=TypeError,kf=function(e,t){if(e<t)throw bf("Not enough arguments");return e},Tf=/(?:ipad|iphone|ipod).*applewebkit/i.test(se),If=n,Rf=d,Af=Yt,wf=R,Cf=Ye,Of=i,Df=An,xf=rs,Nf=It,Pf=kf,Mf=Tf,Lf=nf,Uf=If.setImmediate,Vf=If.clearImmediate,Ff=If.process,Bf=If.Dispatch,jf=If.Function,Gf=If.MessageChannel,Hf=If.String,zf=0,Kf={},Xf="onreadystatechange";try{$h=If.location}catch(nW){}var qf=function(e){if(Cf(Kf,e)){var t=Kf[e];delete Kf[e],t()}},Wf=function(e){return function(){qf(e)}},Yf=function(e){qf(e.data)},Qf=function(e){If.postMessage(Hf(e),$h.protocol+"//"+$h.host)};Uf&&Vf||(Uf=function(e){Pf(arguments.length,1);var t=wf(e)?e:jf(e),r=xf(arguments,1);return Kf[++zf]=function(){Rf(t,void 0,r)},ef(zf),zf},Vf=function(e){delete Kf[e]},Lf?ef=function(e){Ff.nextTick(Wf(e))}:Bf&&Bf.now?ef=function(e){Bf.now(Wf(e))}:Gf&&!Mf?(rf=(tf=new Gf).port2,tf.port1.onmessage=Yf,ef=Af(rf.postMessage,rf)):If.addEventListener&&wf(If.postMessage)&&!If.importScripts&&$h&&"file:"!==$h.protocol&&!Of(Qf)?(ef=Qf,If.addEventListener("message",Yf,!1)):ef=Xf in Nf("script")?function(e){Df.appendChild(Nf("script")).onreadystatechange=function(){Df.removeChild(this),qf(e)}}:function(e){setTimeout(Wf(e),0)});var Jf,Zf,$f,ep,tp,rp,np,ip,op={set:Uf,clear:Vf},ap=n,sp=/ipad|iphone|ipod/i.test(se)&&void 0!==ap.Pebble,cp=/web0s(?!.*chrome)/i.test(se),up=n,dp=Yt,lp=A.f,hp=op.set,fp=Tf,pp=sp,vp=cp,_p=nf,mp=up.MutationObserver||up.WebKitMutationObserver,gp=up.document,yp=up.process,Sp=up.Promise,Ep=lp(up,"queueMicrotask"),bp=Ep&&Ep.value;bp||(Jf=function(){var e,t;for(_p&&(e=yp.domain)&&e.exit();Zf;){t=Zf.fn,Zf=Zf.next;try{t()}catch(nW){throw Zf?ep():$f=void 0,nW}}$f=void 0,e&&e.enter()},fp||_p||vp||!mp||!gp?!pp&&Sp&&Sp.resolve?((np=Sp.resolve(void 0)).constructor=Sp,ip=dp(np.then,np),ep=function(){ip(Jf)}):_p?ep=function(){yp.nextTick(Jf)}:(hp=dp(hp,up),ep=function(){hp(Jf)}):(tp=!0,rp=gp.createTextNode(""),new mp(Jf).observe(rp,{characterData:!0}),ep=function(){rp.data=tp=!tp}));var kp=bp||function(e){var t={fn:e,next:void 0};$f&&($f.next=t),Zf||(Zf=t,ep()),$f=t},Tp=n,Ip=function(e){try{return{error:!1,value:e()}}catch(nW){return{error:!0,value:nW}}},Rp=function(){this.head=null,this.tail=null};Rp.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 Ap=Rp,wp=n.Promise,Cp="object"==typeof Deno&&Deno&&"object"==typeof Deno.version,Op=!Cp&&!nf&&"object"==typeof window&&"object"==typeof document,Dp=n,xp=wp,Np=R,Pp=Kt,Mp=io,Lp=lt,Up=Op,Vp=Cp,Fp=pe,Bp=xp&&xp.prototype,jp=Lp("species"),Gp=!1,Hp=Np(Dp.PromiseRejectionEvent),zp={CONSTRUCTOR:Pp("Promise",(function(){var e=Mp(xp),t=e!==String(xp);if(!t&&66===Fp)return!0;if(!Bp.catch||!Bp.finally)return!0;if(!Fp||Fp<51||!/native code/.test(e)){var r=new xp((function(e){e(1)})),n=function(e){e((function(){}),(function(){}))};if((r.constructor={})[jp]=n,!(Gp=r.then((function(){}))instanceof n))return!0}return!t&&(Up||Vp)&&!Hp})),REJECTION_EVENT:Hp,SUBCLASSING:Gp},Kp={},Xp=Ce,qp=TypeError,Wp=function(e){var t,r;this.promise=new e((function(e,n){if(void 0!==t||void 0!==r)throw qp("Bad Promise constructor");t=e,r=n})),this.resolve=Xp(t),this.reject=Xp(r)};Kp.f=function(e){return new Wp(e)};var Yp,Qp,Jp=Ar,Zp=nf,$p=n,ev=D,tv=li,rv=Mi,nv=uf,iv=Ce,ov=R,av=$,sv=hf,cv=Ef,uv=op.set,dv=kp,lv=function(e,t){var r=Tp.console;r&&r.error&&(1==arguments.length?r.error(e):r.error(e,t))},hv=Ip,fv=Ap,pv=Zi,vv=wp,_v=zp,mv=Kp,gv="Promise",yv=_v.CONSTRUCTOR,Sv=_v.REJECTION_EVENT,Ev=pv.getterFor(gv),bv=pv.set,kv=vv&&vv.prototype,Tv=vv,Iv=kv,Rv=$p.TypeError,Av=$p.document,wv=$p.process,Cv=mv.f,Ov=Cv,Dv=!!(Av&&Av.createEvent&&$p.dispatchEvent),xv="unhandledrejection",Nv=function(e){var t;return!(!av(e)||!ov(t=e.then))&&t},Pv=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&&Fv(t),t.rejection=1),!0===s?r=o:(d&&d.enter(),r=s(o),d&&(d.exit(),i=!0)),r===e.promise?u(Rv("Promise-chain cycle")):(n=Nv(r))?ev(n,r,c,u):c(r)):u(o)}catch(nW){d&&!i&&d.exit(),u(nW)}},Mv=function(e,t){e.notified||(e.notified=!0,dv((function(){for(var r,n=e.reactions;r=n.get();)Pv(r,e);e.notified=!1,t&&!e.rejection&&Uv(e)})))},Lv=function(e,t,r){var n,i;Dv?((n=Av.createEvent("Event")).promise=t,n.reason=r,n.initEvent(e,!1,!0),$p.dispatchEvent(n)):n={promise:t,reason:r},!Sv&&(i=$p["on"+e])?i(n):e===xv&&lv("Unhandled promise rejection",r)},Uv=function(e){ev(uv,$p,(function(){var t,r=e.facade,n=e.value;if(Vv(e)&&(t=hv((function(){Zp?wv.emit("unhandledRejection",n,r):Lv(xv,r,n)})),e.rejection=Zp||Vv(e)?2:1,t.error))throw t.value}))},Vv=function(e){return 1!==e.rejection&&!e.parent},Fv=function(e){ev(uv,$p,(function(){var t=e.facade;Zp?wv.emit("rejectionHandled",t):Lv("rejectionhandled",t,e.value)}))},Bv=function(e,t,r){return function(n){e(t,n,r)}},jv=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=2,Mv(e,!0))},Gv=function(e,t,r){if(!e.done){e.done=!0,r&&(e=r);try{if(e.facade===t)throw Rv("Promise can't be resolved itself");var n=Nv(t);n?dv((function(){var r={done:!1};try{ev(n,t,Bv(Gv,r,e),Bv(jv,r,e))}catch(nW){jv(r,nW,e)}})):(e.value=t,e.state=1,Mv(e,!1))}catch(nW){jv({done:!1},nW,e)}}};yv&&(Iv=(Tv=function(e){sv(this,Iv),iv(e),ev(Yp,this);var t=Ev(this);try{e(Bv(Gv,t),Bv(jv,t))}catch(nW){jv(t,nW)}}).prototype,(Yp=function(e){bv(this,{type:gv,done:!1,notified:!1,parent:!1,reactions:new fv,rejection:!1,state:0,value:void 0})}).prototype=tv(Iv,"then",(function(e,t){var r=Ev(this),n=Cv(cv(this,Tv));return r.parent=!0,n.ok=!ov(e)||e,n.fail=ov(t)&&t,n.domain=Zp?wv.domain:void 0,0==r.state?r.reactions.add(n):dv((function(){Pv(n,r)})),n.promise})),Qp=function(){var e=new Yp,t=Ev(e);this.promise=e,this.resolve=Bv(Gv,t),this.reject=Bv(jv,t)},mv.f=Cv=function(e){return e===Tv||undefined===e?new Qp(e):Ov(e)}),Jp({global:!0,constructor:!0,wrap:!0,forced:yv},{Promise:Tv}),rv(Tv,gv,!1,!0),nv(gv);var Hv=lt("iterator"),zv=!1;try{var Kv=0,Xv={next:function(){return{done:!!Kv++}},return:function(){zv=!0}};Xv[Hv]=function(){return this},Array.from(Xv,(function(){throw 2}))}catch(nW){}var qv=function(e,t){if(!t&&!zv)return!1;var r=!1;try{var n={};n[Hv]=function(){return{next:function(){return{done:r=!0}}}},e(n)}catch(nW){}return r},Wv=wp,Yv=zp.CONSTRUCTOR||!qv((function(e){Wv.all(e).then(void 0,(function(){}))})),Qv=D,Jv=Ce,Zv=Kp,$v=Ip,e_=Dh;Ar({target:"Promise",stat:!0,forced:Yv},{all:function(e){var t=this,r=Zv.f(t),n=r.resolve,i=r.reject,o=$v((function(){var r=Jv(t.resolve),o=[],a=0,s=1;e_(e,(function(e){var c=a++,u=!1;s++,Qv(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 t_=Ar,r_=zp.CONSTRUCTOR;wp&&wp.prototype,t_({target:"Promise",proto:!0,forced:r_,real:!0},{catch:function(e){return this.then(void 0,e)}});var n_=D,i_=Ce,o_=Kp,a_=Ip,s_=Dh;Ar({target:"Promise",stat:!0,forced:Yv},{race:function(e){var t=this,r=o_.f(t),n=r.reject,i=a_((function(){var i=i_(t.resolve);s_(e,(function(e){n_(i,t,e).then(r.resolve,n)}))}));return i.error&&n(i.value),r.promise}});var c_=D,u_=Kp;Ar({target:"Promise",stat:!0,forced:zp.CONSTRUCTOR},{reject:function(e){var t=u_.f(this);return c_(t.reject,void 0,e),t.promise}});var d_=tr,l_=$,h_=Kp,f_=function(e,t){if(d_(e),l_(t)&&t.constructor===e)return t;var r=h_.f(e);return(0,r.resolve)(t),r.promise},p_=Ar,v_=wp,__=zp.CONSTRUCTOR,m_=f_,g_=oe("Promise"),y_=!__;p_({target:"Promise",stat:!0,forced:true},{resolve:function(e){return m_(y_&&this===g_?v_:this,e)}});var S_=D,E_=Ce,b_=Kp,k_=Ip,T_=Dh;Ar({target:"Promise",stat:!0},{allSettled:function(e){var t=this,r=b_.f(t),n=r.resolve,i=r.reject,o=k_((function(){var r=E_(t.resolve),i=[],o=0,a=1;T_(e,(function(e){var s=o++,c=!1;a++,S_(r,t,e).then((function(e){c||(c=!0,i[s]={status:"fulfilled",value:e},--a||n(i))}),(function(e){c||(c=!0,i[s]={status:"rejected",reason:e},--a||n(i))}))})),--a||n(i)}));return o.error&&i(o.value),r.promise}});var I_=D,R_=Ce,A_=oe,w_=Kp,C_=Ip,O_=Dh,D_="No one promise resolved";Ar({target:"Promise",stat:!0},{any:function(e){var t=this,r=A_("AggregateError"),n=w_.f(t),i=n.resolve,o=n.reject,a=C_((function(){var n=R_(t.resolve),a=[],s=0,c=1,u=!1;O_(e,(function(e){var d=s++,l=!1;c++,I_(n,t,e).then((function(e){l||u||(u=!0,i(e))}),(function(e){l||u||(l=!0,a[d]=e,--c||o(new r(a,D_)))}))})),--c||o(new r(a,D_))}));return a.error&&o(a.value),n.promise}});var x_=Ar,N_=wp,P_=i,M_=oe,L_=R,U_=Ef,V_=f_,F_=N_&&N_.prototype;x_({target:"Promise",proto:!0,real:!0,forced:!!N_&&P_((function(){F_.finally.call({then:function(){}},(function(){}))}))},{finally:function(e){var t=U_(this,M_("Promise")),r=L_(e);return this.then(r?function(r){return V_(t,e()).then((function(){return r}))}:e,r?function(r){return V_(t,e()).then((function(){throw r}))}:e)}});var B_=ee.Promise,j_=Kp,G_=Ip;Ar({target:"Promise",stat:!0,forced:!0},{try:function(e){var t=j_.f(this),r=G_(e);return(r.error?t.reject:t.resolve)(r.value),t.promise}});var H_=B_,z_=Ar,K_=eo,X_=b([].reverse),q_=[1,2];z_({target:"Array",proto:!0,forced:String(q_)===String(q_.reverse())},{reverse:function(){return K_(this)&&(this.length=this.length),X_(this)}});var W_=Us("Array").reverse,Y_=ae,Q_=W_,J_=Array.prototype,Z_=function(e){var t=e.reverse;return e===J_||Y_(J_,e)&&t===J_.reverse?Q_:t},$_=Ar,em=eo,tm=yo,rm=$,nm=Mr,im=Br,om=Q,am=Jn,sm=lt,cm=rs,um=Ps("slice"),dm=sm("species"),lm=Array,hm=Math.max;$_({target:"Array",proto:!0,forced:!um},{slice:function(e,t){var r,n,i,o=om(this),a=im(o),s=nm(e,a),c=nm(void 0===t?a:t,a);if(em(o)&&(r=o.constructor,(tm(r)&&(r===lm||em(r.prototype))||rm(r)&&null===(r=r[dm]))&&(r=void 0),r===lm||void 0===r))return cm(o,s,c);for(n=new(void 0===r?lm:r)(hm(c-s,0)),i=0;s<c;s++,i++)s in o&&am(n,i,o[s]);return n.length=i,n}});var fm=Us("Array").slice,pm=ae,vm=fm,_m=Array.prototype,mm=function(e){var t=e.slice;return e===_m||pm(_m,e)&&t===_m.slice?vm:t};function gm(){gm=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=id||function(e,t,r){e[t]=r.value},i="function"==typeof fl?fl:{},o=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function c(e,t,r){return id(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(A){c=function(e,t,r){return e[t]=r}}function u(e,t,r,i){var o=t&&t.prototype instanceof h?t:h,a=Pl(o.prototype),s=new T(i||[]);return n(a,"_invoke",{value:S(e,r,s)}),a}function d(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(A){return{type:"throw",arg:A}}}e.wrap=u;var l={};function h(){}function f(){}function p(){}var v={};c(v,o,(function(){return this}));var _=Vl&&Vl(Vl(I([])));_&&_!==t&&r.call(_,o)&&(v=_);var m=p.prototype=h.prototype=Pl(v);function g(e){var t;Nu(t=["next","throw","return"]).call(t,(function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function y(e,t){function i(n,o,a,s){var c=d(e[n],e,o);if("throw"!==c.type){var u=c.arg,l=u.value;return l&&"object"==xl(l)&&r.call(l,"__await")?t.resolve(l.__await).then((function(e){i("next",e,a,s)}),(function(e){i("throw",e,a,s)})):t.resolve(l).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 S(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=E(a,r);if(s){if(s===l)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=d(e,t,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===l)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}function E(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,E(e,t),"throw"===t.method))return l;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=d(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,l;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,l):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,l)}function b(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function k(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function T(e){this.tryEntries=[{tryLoc:"root"}],Nu(e).call(e,b,this),this.reset(!0)}function I(e){if(e){var t=e[o];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:R}}function R(){return{value:void 0,done:!0}}return f.prototype=p,n(m,"constructor",{value:p,configurable:!0}),n(p,"constructor",{value:f,configurable:!0}),f.displayName=c(p,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Fl?Fl(e,p):(e.__proto__=p,c(e,s,"GeneratorFunction")),e.prototype=Pl(m),e},e.awrap=function(e){return{__await:e}},g(y.prototype),c(y.prototype,a,(function(){return this})),e.AsyncIterator=y,e.async=function(t,r,n,i,o){void 0===o&&(o=H_);var a=new y(u(t,r,n,i),o);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},g(m),c(m,s,"Generator"),c(m,o,(function(){return this})),c(m,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return Z_(r).call(r),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=I,T.prototype={constructor:T,reset:function(e){var t;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,Nu(t=this.tryEntries).call(t,k),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+mm(n).call(n,1))&&(this[n]=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,l):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),l},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),k(r),l}},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;k(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:I(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},e}function ym(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(nW){return void r(nW)}s.done?t(c):H_.resolve(c).then(n,i)}function Sm(e){return function(){var t=this,r=arguments;return new H_((function(n,i){var o=e.apply(t,r);function a(e){ym(o,n,i,a,s,"next",e)}function s(e){ym(o,n,i,a,s,"throw",e)}a(void 0)}))}}var Em=Us("Array").concat,bm=ae,km=Em,Tm=Array.prototype,Im=function(e){var t=e.concat;return e===Tm||bm(Tm,e)&&t===Tm.concat?km:t},Rm=Kr.includes;Ar({target:"Array",proto:!0,forced:i((function(){return!Array(1).includes()}))},{includes:function(e){return Rm(this,e,arguments.length>1?arguments[1]:void 0)}});var Am=Us("Array").includes,wm=$,Cm=y,Om=lt("match"),Dm=function(e){var t;return wm(e)&&(void 0!==(t=e[Om])?!!t:"RegExp"==Cm(e))},xm=TypeError,Nm=function(e){if(Dm(e))throw xm("The method doesn't accept regular expressions");return e},Pm=lt("match"),Mm=function(e){var t=/./;try{"/./"[e](t)}catch(r){try{return t[Pm]=!1,"/./"[e](t)}catch(nW){}}return!1},Lm=Ar,Um=Nm,Vm=q,Fm=gn,Bm=Mm,jm=b("".indexOf);Lm({target:"String",proto:!0,forced:!Bm("includes")},{includes:function(e){return!!~jm(Fm(Vm(this)),Fm(Um(e)),arguments.length>1?arguments[1]:void 0)}});var Gm=Us("String").includes,Hm=ae,zm=Am,Km=Gm,Xm=Array.prototype,qm=String.prototype,Wm=function(e){var t=e.includes;return e===Xm||Hm(Xm,e)&&t===Xm.includes?zm:"string"==typeof e||e===qm||Hm(qm,e)&&t===qm.includes?Km:t},Ym="\t\n\v\f\r \u2028\u2029\ufeff",Qm=q,Jm=gn,Zm=b("".replace),$m="[\t\n\v\f\r \u2028\u2029\ufeff]",eg=RegExp("^"+$m+$m+"*"),tg=RegExp($m+$m+"*$"),rg=function(e){return function(t){var r=Jm(Qm(t));return 1&e&&(r=Zm(r,eg,"")),2&e&&(r=Zm(r,tg,"")),r}},ng={start:rg(1),end:rg(2),trim:rg(3)},ig=n,og=i,ag=b,sg=gn,cg=ng.trim,ug=Ym,dg=ig.parseInt,lg=ig.Symbol,hg=lg&&lg.iterator,fg=/^[+-]?0x/i,pg=ag(fg.exec),vg=8!==dg(ug+"08")||22!==dg(ug+"0x16")||hg&&!og((function(){dg(Object(hg))}))?function(e,t){var r=cg(sg(e));return dg(r,t>>>0||(pg(fg,r)?16:10))}:dg;Ar({global:!0,forced:parseInt!=vg},{parseInt:vg});var _g=ee.parseInt,mg={exports:{}},gg=i((function(){if("function"==typeof ArrayBuffer){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}})),yg=i,Sg=$,Eg=y,bg=gg,kg=Object.isExtensible,Tg=yg((function(){kg(1)}))||bg?function(e){return!!Sg(e)&&((!bg||"ArrayBuffer"!=Eg(e))&&(!kg||kg(e)))}:kg,Ig=!i((function(){return Object.isExtensible(Object.preventExtensions({}))})),Rg=Ar,Ag=b,wg=Xr,Cg=$,Og=Ye,Dg=Qt.f,xg=zn,Ng=qn,Pg=Tg,Mg=Ig,Lg=!1,Ug=et("meta"),Vg=0,Fg=function(e){Dg(e,Ug,{value:{objectID:"O"+Vg++,weakData:{}}})},Bg=mg.exports={enable:function(){Bg.enable=function(){},Lg=!0;var e=xg.f,t=Ag([].splice),r={};r[Ug]=1,e(r).length&&(xg.f=function(r){for(var n=e(r),i=0,o=n.length;i<o;i++)if(n[i]===Ug){t(n,i,1);break}return n},Rg({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:Ng.f}))},fastKey:function(e,t){if(!Cg(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!Og(e,Ug)){if(!Pg(e))return"F";if(!t)return"E";Fg(e)}return e[Ug].objectID},getWeakData:function(e,t){if(!Og(e,Ug)){if(!Pg(e))return!0;if(!t)return!1;Fg(e)}return e[Ug].weakData},onFreeze:function(e){return Mg&&Lg&&Pg(e)&&!Og(e,Ug)&&Fg(e),e}};wg[Ug]=!0;var jg=Ar,Gg=n,Hg=mg.exports,zg=i,Kg=vr,Xg=Dh,qg=hf,Wg=R,Yg=$,Qg=Mi,Jg=Qt.f,Zg=Po.forEach,$g=w,ey=Zi.set,ty=Zi.getterFor,ry=function(e,t,r){var n,i=-1!==e.indexOf("Map"),o=-1!==e.indexOf("Weak"),a=i?"set":"add",s=Gg[e],c=s&&s.prototype,u={};if($g&&Wg(s)&&(o||c.forEach&&!zg((function(){(new s).entries().next()})))){var d=(n=t((function(t,r){ey(qg(t,d),{type:e,collection:new s}),null!=r&&Xg(r,t[a],{that:t,AS_ENTRIES:i})}))).prototype,l=ty(e);Zg(["add","clear","delete","forEach","get","has","set","keys","values","entries"],(function(e){var t="add"==e||"set"==e;!(e in c)||o&&"clear"==e||Kg(d,e,(function(r,n){var i=l(this).collection;if(!t&&o&&!Yg(r))return"get"==e&&void 0;var a=i[e](0===r?0:r,n);return t?this:a}))})),o||Jg(d,"size",{configurable:!0,get:function(){return l(this).collection.size}})}else n=r.getConstructor(t,e,i,a),Hg.enable();return Qg(n,e,!1,!0),u[e]=n,jg({global:!0,forced:!0},u),o||r.setStrong(n,e,i),n},ny=li,iy=function(e,t,r){for(var n in t)r&&r.unsafe&&e[n]?e[n]=t[n]:ny(e,n,t[n],r);return e},oy=Qt.f,ay=Hn,sy=iy,cy=Yt,uy=hf,dy=z,ly=Dh,hy=ru,fy=nu,py=uf,vy=w,_y=mg.exports.fastKey,my=Zi.set,gy=Zi.getterFor,yy={getConstructor:function(e,t,r,n){var i=e((function(e,i){uy(e,o),my(e,{type:t,index:ay(null),first:void 0,last:void 0,size:0}),vy||(e.size=0),dy(i)||ly(i,e[n],{that:e,AS_ENTRIES:r})})),o=i.prototype,a=gy(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=_y(t,!0),key:t,value:r,previous:n=o.last,next:void 0,removed:!1},o.first||(o.first=s),n&&(n.next=s),vy?o.size++:e.size++,"F"!==i&&(o.index[i]=s)),e},c=function(e,t){var r,n=a(e),i=_y(t);if("F"!==i)return n.index[i];for(r=n.first;r;r=r.next)if(r.key==t)return r};return sy(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,vy?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),vy?r.size--:t.size--}return!!n},forEach:function(e){for(var t,r=a(this),n=cy(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)}}),sy(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)}}),vy&&oy(o,"size",{get:function(){return a(this).size}}),i},setStrong:function(e,t,r){var n=t+" Iterator",i=gy(t),o=gy(n);hy(e,t,(function(e,t){my(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)?fy("keys"==t?r.key:"values"==t?r.value:[r.key,r.value],!1):(e.target=void 0,fy(void 0,!0))}),r?"entries":"values",!r,!0),py(t)}};ry("Map",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),yy);var Sy=ee.Map,Ey=Yt,by=D,ky=Ce,Ty=_f,Iy=z,Ry=Dh,Ay=[].push,wy=function(e){var t,r,n,i,o=arguments.length,a=o>1?arguments[1]:void 0;return Ty(this),(t=void 0!==a)&&ky(a),Iy(e)?new this:(r=[],t?(n=0,i=Ey(a,o>2?arguments[2]:void 0),Ry(e,(function(e){by(Ay,r,i(e,n++))}))):Ry(e,Ay,{that:r}),new this(r))};Ar({target:"Map",stat:!0,forced:!0},{from:wy});var Cy=rs,Oy=function(){return new this(Cy(arguments))};Ar({target:"Map",stat:!0,forced:!0},{of:Oy});var Dy=D,xy=Ce,Ny=tr,Py=function(){for(var e,t=Ny(this),r=xy(t.delete),n=!0,i=0,o=arguments.length;i<o;i++)e=Dy(r,t,arguments[i]),n=n&&e;return!!n};Ar({target:"Map",proto:!0,real:!0,forced:!0},{deleteAll:Py});var My=D,Ly=Ce,Uy=tr,Vy=function(e,t){var r,n,i=Uy(this),o=Ly(i.get),a=Ly(i.has),s=Ly(i.set);return My(a,i,e)?(r=My(o,i,e),"update"in t&&(r=t.update(r,e,i),My(s,i,e,r)),r):(n=t.insert(e,i),My(s,i,e,n),n)};Ar({target:"Map",proto:!0,real:!0,forced:!0},{emplace:Vy});var Fy=fh,By=tr,jy=Yt,Gy=Fy,Hy=Dh;Ar({target:"Map",proto:!0,real:!0,forced:!0},{every:function(e){var t=By(this),r=Gy(t),n=jy(e,arguments.length>1?arguments[1]:void 0);return!Hy(r,(function(e,r,i){if(!n(r,e,t))return i()}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}});var zy=oe,Ky=Yt,Xy=D,qy=Ce,Wy=tr,Yy=Ef,Qy=Fy,Jy=Dh;Ar({target:"Map",proto:!0,real:!0,forced:!0},{filter:function(e){var t=Wy(this),r=Qy(t),n=Ky(e,arguments.length>1?arguments[1]:void 0),i=new(Yy(t,zy("Map"))),o=qy(i.set);return Jy(r,(function(e,r){n(r,e,t)&&Xy(o,i,e,r)}),{AS_ENTRIES:!0,IS_ITERATOR:!0}),i}});var Zy=tr,$y=Yt,eS=Fy,tS=Dh;Ar({target:"Map",proto:!0,real:!0,forced:!0},{find:function(e){var t=Zy(this),r=eS(t),n=$y(e,arguments.length>1?arguments[1]:void 0);return tS(r,(function(e,r,i){if(n(r,e,t))return i(r)}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).result}});var rS=tr,nS=Yt,iS=Fy,oS=Dh;Ar({target:"Map",proto:!0,real:!0,forced:!0},{findKey:function(e){var t=rS(this),r=iS(t),n=nS(e,arguments.length>1?arguments[1]:void 0);return oS(r,(function(e,r,i){if(n(r,e,t))return i(e)}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).result}});var aS=Ar,sS=D,cS=Ce,uS=fh,dS=Dh,lS=b([].push);aS({target:"Map",stat:!0,forced:!0},{groupBy:function(e,t){cS(t);var r=uS(e),n=new this,i=cS(n.has),o=cS(n.get),a=cS(n.set);return dS(r,(function(e){var r=t(e);sS(i,n,r)?lS(sS(o,n,r),e):sS(a,n,r,[e])}),{IS_ITERATOR:!0}),n}});var hS=tr,fS=Fy,pS=function(e,t){return e===t||e!=e&&t!=t},vS=Dh;Ar({target:"Map",proto:!0,real:!0,forced:!0},{includes:function(e){return vS(fS(hS(this)),(function(t,r,n){if(pS(r,e))return n()}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}});var _S=D,mS=Dh,gS=Ce;Ar({target:"Map",stat:!0,forced:!0},{keyBy:function(e,t){var r=new this;gS(t);var n=gS(r.set);return mS(e,(function(e){_S(n,r,t(e),e)})),r}});var yS=tr,SS=Fy,ES=Dh;Ar({target:"Map",proto:!0,real:!0,forced:!0},{keyOf:function(e){return ES(SS(yS(this)),(function(t,r,n){if(r===e)return n(t)}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).result}});var bS=oe,kS=Yt,TS=D,IS=Ce,RS=tr,AS=Ef,wS=Fy,CS=Dh;Ar({target:"Map",proto:!0,real:!0,forced:!0},{mapKeys:function(e){var t=RS(this),r=wS(t),n=kS(e,arguments.length>1?arguments[1]:void 0),i=new(AS(t,bS("Map"))),o=IS(i.set);return CS(r,(function(e,r){TS(o,i,n(r,e,t),r)}),{AS_ENTRIES:!0,IS_ITERATOR:!0}),i}});var OS=oe,DS=Yt,xS=D,NS=Ce,PS=tr,MS=Ef,LS=Fy,US=Dh;Ar({target:"Map",proto:!0,real:!0,forced:!0},{mapValues:function(e){var t=PS(this),r=LS(t),n=DS(e,arguments.length>1?arguments[1]:void 0),i=new(MS(t,OS("Map"))),o=NS(i.set);return US(r,(function(e,r){xS(o,i,e,n(r,e,t))}),{AS_ENTRIES:!0,IS_ITERATOR:!0}),i}});var VS=Ce,FS=tr,BS=Dh;Ar({target:"Map",proto:!0,real:!0,arity:1,forced:!0},{merge:function(e){for(var t=FS(this),r=VS(t.set),n=arguments.length,i=0;i<n;)BS(arguments[i++],r,{that:t,AS_ENTRIES:!0});return t}});var jS=tr,GS=Ce,HS=Fy,zS=Dh,KS=TypeError;Ar({target:"Map",proto:!0,real:!0,forced:!0},{reduce:function(e){var t=jS(this),r=HS(t),n=arguments.length<2,i=n?void 0:arguments[1];if(GS(e),zS(r,(function(r,o){n?(n=!1,i=o):i=e(i,o,r,t)}),{AS_ENTRIES:!0,IS_ITERATOR:!0}),n)throw KS("Reduce of empty map with no initial value");return i}});var XS=tr,qS=Yt,WS=Fy,YS=Dh;Ar({target:"Map",proto:!0,real:!0,forced:!0},{some:function(e){var t=XS(this),r=WS(t),n=qS(e,arguments.length>1?arguments[1]:void 0);return YS(r,(function(e,r,i){if(n(r,e,t))return i()}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}});var QS=D,JS=tr,ZS=Ce,$S=TypeError;Ar({target:"Map",proto:!0,real:!0,forced:!0},{update:function(e,t){var r=JS(this),n=ZS(r.get),i=ZS(r.has),o=ZS(r.set),a=arguments.length;ZS(t);var s=QS(i,r,e);if(!s&&a<3)throw $S("Updating absent value");var c=s?QS(n,r,e):ZS(a>2?arguments[2]:void 0)(e,r);return QS(o,r,e,t(c,e,r)),r}});var eE=D,tE=Ce,rE=R,nE=tr,iE=TypeError,oE=function(e,t){var r,n=nE(this),i=tE(n.get),o=tE(n.has),a=tE(n.set),s=arguments.length>2?arguments[2]:void 0;if(!rE(t)&&!rE(s))throw iE("At least one callback required");return eE(o,n,e)?(r=eE(i,n,e),rE(t)&&(r=t(r),eE(a,n,e,r))):rE(s)&&(r=s(),eE(a,n,e,r)),r};Ar({target:"Map",proto:!0,real:!0,forced:!0},{upsert:oE}),Ar({target:"Map",proto:!0,real:!0,name:"upsert",forced:!0},{updateOrInsert:oE});var aE=Sy,sE=Ce,cE=Xe,uE=H,dE=Br,lE=TypeError,hE=function(e){return function(t,r,n,i){sE(r);var o=cE(t),a=uE(o),s=dE(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 lE("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}},fE={left:hE(!1),right:hE(!0)},pE=fE.left,vE=pe,_E=nf;Ar({target:"Array",proto:!0,forced:!ku("reduce")||!_E&&vE>79&&vE<83},{reduce:function(e){var t=arguments.length;return pE(this,e,t,t>1?arguments[1]:void 0)}});var mE=Us("Array").reduce,gE=ae,yE=mE,SE=Array.prototype,EE=function(e){var t=e.reduce;return e===SE||gE(SE,e)&&t===SE.reduce?yE:t},bE=w,kE=b,TE=D,IE=i,RE=rn,AE=ui,wE=x,CE=Xe,OE=H,DE=Object.assign,xE=Object.defineProperty,NE=kE([].concat),PE=!DE||IE((function(){if(bE&&1!==DE({b:1},DE(xE({},"a",{enumerable:!0,get:function(){xE(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!=DE({},e)[r]||RE(DE({},t)).join("")!=n}))?function(e,t){for(var r=CE(e),n=arguments.length,i=1,o=AE.f,a=wE.f;n>i;)for(var s,c=OE(arguments[i++]),u=o?NE(RE(c),o(c)):RE(c),d=u.length,l=0;d>l;)s=u[l++],bE&&!TE(a,c,s)||(r[s]=c[s]);return r}:DE,ME=PE;Ar({target:"Object",stat:!0,arity:2,forced:Object.assign!==ME},{assign:ME});var LE=ee.Object.assign,UE=Ar,VE=b;A.f;var FE=Vr,BE=gn,jE=Nm,GE=q,HE=Mm,zE=VE("".endsWith),KE=VE("".slice),XE=Math.min;UE({target:"String",proto:!0,forced:!HE("endsWith")},{endsWith:function(e){var t=BE(GE(this));jE(e);var r=arguments.length>1?arguments[1]:void 0,n=t.length,i=void 0===r?n:XE(FE(r),n),o=BE(e);return zE?zE(t,o,i):KE(t,i-o.length,i)===o}});var qE=Us("String").endsWith,WE=ae,YE=qE,QE=String.prototype,JE=function(e){var t=e.endsWith;return"string"==typeof e||e===QE||WE(QE,e)&&t===QE.endsWith?YE:t},ZE=!0,$E=!0;function eb(e,t,r){var n=e.match(t);return n&&n.length>=r&&_g(n[r],10)}function tb(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 aE),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===an(this._eventMap).length&&delete this._eventMap,o.apply(this,[e,n])},id(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 rb(e){return"boolean"!=typeof e?new Error("Argument type: "+xl(e)+". Please use a boolean."):(ZE=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function nb(e){return"boolean"!=typeof e?new Error("Argument type: "+xl(e)+". Please use a boolean."):($E=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function ib(){if("object"===("undefined"==typeof window?"undefined":xl(window))){if(ZE)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function ob(e,t){$E&&console.warn(e+" is deprecated, please use "+t+" instead.")}function ab(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=eb(r.userAgent,/Firefox\/(\d+)\./,1);else if(r.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection)t.browser="chrome",t.version=eb(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=eb(r.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return t}function sb(e){return"[object Object]"===Object.prototype.toString.call(e)}function cb(e){var t;return sb(e)?EE(t=an(e)).call(t,(function(t,r){var n=sb(e[r]),i=n?cb(e[r]):e[r],o=n&&!an(i).length;return void 0===i||o?t:LE(t,od({},r,i))}),{}):e}function ub(e,t,r){t&&!r.has(t.id)&&(r.set(t.id,t),an(t).forEach((function(n){JE(n).call(n,"Id")?ub(e,e.get(t[n]),r):JE(n).call(n,"Ids")&&t[n].forEach((function(t){ub(e,e.get(t),r)}))})))}function db(e,t,r){var n=r?"outbound-rtp":"inbound-rtp",i=new aE;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&&ub(e,r,i)}))})),i}var lb=Ar,hb=Po.find,fb="find",pb=!0;fb in[]&&Array(1).find((function(){pb=!1})),lb({target:"Array",proto:!0,forced:pb},{find:function(e){return hb(this,e,arguments.length>1?arguments[1]:void 0)}});var vb=Us("Array").find,_b=ae,mb=vb,gb=Array.prototype,yb=function(e){var t=e.find;return e===gb||_b(gb,e)&&t===gb.find?mb:t},Sb=Ar,Eb=Kr.indexOf,bb=ku,kb=b([].indexOf),Tb=!!kb&&1/kb([1],1,-0)<0,Ib=bb("indexOf");Sb({target:"Array",proto:!0,forced:Tb||!Ib},{indexOf:function(e){var t=arguments.length>1?arguments[1]:void 0;return Tb?kb(this,e,t)||0:Eb(this,e,t)}});var Rb=Us("Array").indexOf,Ab=ae,wb=Rb,Cb=Array.prototype,Ob=function(e){var t=e.indexOf;return e===Cb||Ab(Cb,e)&&t===Cb.indexOf?wb:t},Db=w,xb=eo,Nb=TypeError,Pb=Object.getOwnPropertyDescriptor,Mb=Db&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(nW){return nW instanceof TypeError}}(),Lb=Ie,Ub=TypeError,Vb=function(e,t){if(!delete e[t])throw Ub("Cannot delete property "+Lb(t)+" of "+Lb(e))},Fb=Ar,Bb=Xe,jb=Mr,Gb=Dr,Hb=Br,zb=Mb?function(e,t){if(xb(e)&&!Pb(e,"length").writable)throw Nb("Cannot set read only .length");return e.length=t}:function(e,t){return e.length=t},Kb=qd,Xb=Ro,qb=Jn,Wb=Vb,Yb=Ps("splice"),Qb=Math.max,Jb=Math.min;Fb({target:"Array",proto:!0,forced:!Yb},{splice:function(e,t){var r,n,i,o,a,s,c=Bb(this),u=Hb(c),d=jb(e,u),l=arguments.length;for(0===l?r=n=0:1===l?(r=0,n=u-d):(r=l-2,n=Jb(Qb(Gb(t),0),u-d)),Kb(u+r-n),i=Xb(c,n),o=0;o<n;o++)(a=d+o)in c&&qb(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]:Wb(c,s);for(o=u;o>u-n+r;o--)Wb(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]:Wb(c,s);for(o=0;o<r;o++)c[o+d]=arguments[o+2];return zb(c,u-n+r),i}});var Zb=Us("Array").splice,$b=ae,ek=Zb,tk=Array.prototype,rk=function(e){var t=e.splice;return e===tk||$b(tk,e)&&t===tk.splice?ek:t},nk=Po.map;Ar({target:"Array",proto:!0,forced:!Ps("map")},{map:function(e){return nk(this,e,arguments.length>1?arguments[1]:void 0)}});var ik=Us("Array").map,ok=ae,ak=ik,sk=Array.prototype,ck=function(e){var t=e.map;return e===sk||ok(sk,e)&&t===sk.map?ak:t},uk=ee,dk=d;uk.JSON||(uk.JSON={stringify:JSON.stringify});var lk=function(e,t,r){return dk(uk.JSON.stringify,null,arguments)},hk=lk,fk=ib;function pk(e,t){var r=e&&e.navigator;if(r.mediaDevices){var n=function(e){if("object"!==xl(e)||e.mandatory||e.optional)return e;var t,r={};(an(e).forEach((function(t){if("require"!==t&&"advanced"!==t&&"mediaSource"!==t){var n="object"===xl(e[t])?e[t]:{ideal:e[t]};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()+mm(t).call(t,1):"deviceId"===t?"sourceId":t};if(void 0!==n.ideal){r.optional=r.optional||[];var o={};"number"==typeof n.ideal?(o[i("min",t)]=n.ideal,r.optional.push(o),(o={})[i("max",t)]=n.ideal,r.optional.push(o)):(o[i("",t)]=n.ideal,r.optional.push(o))}void 0!==n.exact&&"number"!=typeof n.exact?(r.mandatory=r.mandatory||{},r.mandatory[i("",t)]=n.exact):["min","max"].forEach((function(e){void 0!==n[e]&&(r.mandatory=r.mandatory||{},r.mandatory[i(e,t)]=n[e])}))}})),e.advanced)&&(r.optional=Im(t=r.optional||[]).call(t,e.advanced));return r},i=function(e,i){if(t.version>=61)return i(e);if((e=JSON.parse(hk(e)))&&"object"===xl(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(hk(e))).audio,"autoGainControl","googAutoGainControl"),o(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=n(e.audio)}if(e&&"object"===xl(e.video)){var a=e.video.facingMode;a=a&&("object"===xl(a)?a:{ideal:a});var s,c=t.version<66;if(a&&("user"===a.exact||"environment"===a.exact||"user"===a.ideal||"environment"===a.ideal)&&(!r.mediaDevices.getSupportedConstraints||!r.mediaDevices.getSupportedConstraints().facingMode||c))if(delete e.video.facingMode,"environment"===a.exact||"environment"===a.ideal?s=["back","rear"]:"user"!==a.exact&&"user"!==a.ideal||(s=["front"]),s)return r.mediaDevices.enumerateDevices().then((function(t){t=Gs(t).call(t,(function(e){return"videoinput"===e.kind}));var r=yb(t).call(t,(function(e){return s.some((function(t){var r;return Wm(r=e.label.toLowerCase()).call(r,t)}))}));return!r&&t.length&&Wm(s).call(s,"back")&&(r=t[t.length-1]),r&&(e.video.deviceId=a.exact?{exact:r.deviceId}:{ideal:r.deviceId}),e.video=n(e.video),fk("chrome: "+hk(e)),i(e)}));e.video=n(e.video)}return fk("chrome: "+hk(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 a=r.mediaDevices.getUserMedia.bind(r.mediaDevices);r.mediaDevices.getUserMedia=function(e){return i(e,(function(e){return a(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 H_.reject(o(e))}))}))}}}}function vk(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function _k(e){if("object"===xl(e)&&e.RTCPeerConnection&&!("ontrack"in e.RTCPeerConnection.prototype)){id(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,o;e.RTCPeerConnection.prototype.getReceivers?i=yb(o=r.getReceivers()).call(o,(function(e){return e.track&&e.track.id===n.track.id})):i={track:n.track};var a=new Event("track");a.track=n.track,a.receiver=i,a.transceiver={receiver:i},a.streams=[t.stream],r.dispatchEvent(a)})),t.stream.getTracks().forEach((function(n){var i,o;e.RTCPeerConnection.prototype.getReceivers?i=yb(o=r.getReceivers()).call(o,(function(e){return e.track&&e.track.id===n.id})):i={track:n};var a=new Event("track");a.track=n,a.receiver=i,a.transceiver={receiver:i},a.streams=[t.stream],r.dispatchEvent(a)}))},this.addEventListener("addstream",this._ontrackpoly)),t.apply(this,arguments)}}else tb(e,"track",(function(e){return e.transceiver||id(e,"transceiver",{value:{receiver:e.receiver}}),e}))}function mk(e){if("object"===xl(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(){var e;return this._senders=this._senders||[],mm(e=this._senders).call(e)};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){var t;n.apply(this,arguments);var r,i=Ob(t=this._senders).call(t,e);-1!==i&&rk(r=this._senders).call(r,i,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,n,i,o=yb(r=t._senders).call(r,(function(t){return t.track===e}));o&&rk(n=t._senders).call(n,Ob(i=t._senders).call(i,o),1)}))}}else if("object"===xl(e)&&e.RTCPeerConnection&&"getSenders"in e.RTCPeerConnection.prototype&&"createDTMFSender"in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)){var a=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){var e=this,t=a.apply(this,[]);return t.forEach((function(t){return t._pc=e})),t},id(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 gk(e){if(e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){var e=this,r=mm(Array.prototype).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){var t;return new aE(ck(t=an(e)).call(t,(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 H_((function(r,n){t.apply(e,[function(e){r(s(a(e)))},n])})).then(i,o)}}}function yk(e){if("object"===xl(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 db(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}),tb(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 db(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?H_.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):t?t.getStats():r?r.getStats():H_.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return i.apply(this,arguments)}}}}function Sk(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){var e,t=this;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},ck(e=an(this._shimmedLocalStreams)).call(e,(function(e){return t._shimmedLocalStreams[e][0]}))};var t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,r){var n;if(!r)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};var i=t.apply(this,arguments);return this._shimmedLocalStreams[r.id]?-1===Ob(n=this._shimmedLocalStreams[r.id]).call(n,i)&&this._shimmedLocalStreams[r.id].push(i):this._shimmedLocalStreams[r.id]=[r,i],i};var r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){var t,n,i=this;this._shimmedLocalStreams=this._shimmedLocalStreams||{},e.getTracks().forEach((function(e){var t;if(yb(t=i.getSenders()).call(t,(function(t){return t.track===e})))throw new DOMException("Track already exists.","InvalidAccessError")}));var o=this.getSenders();r.apply(this,arguments);var a=Gs(t=this.getSenders()).call(t,(function(e){return-1===Ob(o).call(o,e)}));this._shimmedLocalStreams[e.id]=Im(n=[e]).call(n,a)};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&&an(this._shimmedLocalStreams).forEach((function(r){var n,i,o=Ob(n=t._shimmedLocalStreams[r]).call(n,e);-1!==o&&rk(i=t._shimmedLocalStreams[r]).call(i,o,1);1===t._shimmedLocalStreams[r].length&&delete t._shimmedLocalStreams[r]})),i.apply(this,arguments)}}function Ek(e,t){if(e.RTCPeerConnection){if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return Sk(e);var r=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){var e=this,t=r.apply(this);return this._reverseStreams=this._reverseStreams||{},ck(t).call(t,(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){var t;if(yb(t=r.getSenders()).call(t,(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,i,o,a=this;if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");var s=mm([]).call(arguments,1);if(1!==s.length||!yb(n=s[0].getTracks()).call(n,(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 c=yb(i=this.getSenders()).call(i,(function(e){return e.track===t}));if(c)throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};var u=this._streams[r.id];if(u)u.addTrack(t),H_.resolve().then((function(){a.dispatchEvent(new Event("negotiationneeded"))}));else{var d=new e.MediaStream([t]);this._streams[r.id]=d,this._reverseStreams[d.id]=r,this.addStream(d)}return yb(o=this.getSenders()).call(o,(function(e){return e.track===t}))},["createOffer","createAnswer"].forEach((function(t){var r=e.RTCPeerConnection.prototype[t],n=od({},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=tc(e.RTCPeerConnection.prototype,"localDescription");id(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||{},an(this._streams).forEach((function(n){var i;yb(i=r._streams[n].getTracks()).call(i,(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 an(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 an(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 bk(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=od({},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 kk(e,t){tb(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 Tk=Object.freeze(Object.defineProperty({__proto__:null,shimMediaStream:vk,shimOnTrack:_k,shimGetSendersWithDtmf:mk,shimGetStats:gk,shimSenderReceiverGetStats:yk,shimAddTrackRemoveTrackWithNative:Sk,shimAddTrackRemoveTrack:Ek,shimPeerConnection:bk,fixNegotiationNeeded:kk,shimGetUserMedia:pk,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"}));Ar({target:"Array",stat:!0},{isArray:eo});var Ik=ee.Array.isArray;function Rk(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}var Ak=ah,wk=tr,Ck=mh,Ok=Yt,Dk=D,xk=Xe,Nk=function(e,t,r,n){try{return n?t(wk(r)[0],r[1]):t(r)}catch(nW){Ck(e,"throw",nW)}},Pk=eh,Mk=yo,Lk=Br,Uk=Jn,Vk=fh,Fk=ah,Bk=Array,jk=function(e){var t=xk(e),r=Mk(this),n=arguments.length,i=n>1?arguments[1]:void 0,o=void 0!==i;o&&(i=Ok(i,n>2?arguments[2]:void 0));var a,s,c,u,d,l,h=Fk(t),f=0;if(!h||this===Bk&&Pk(h))for(a=Lk(t),s=r?new this(a):Bk(a);a>f;f++)l=o?i(t[f],f):t[f],Uk(s,f,l);else for(d=(u=Vk(t,h)).next,s=r?new this:[];!(c=Dk(d,u)).done;f++)l=o?Nk(u,i,[c.value,f],!0):c.value,Uk(s,f,l);return s.length=f,s},Gk=jk;Ar({target:"Array",stat:!0,forced:!qv((function(e){Array.from(e)}))},{from:Gk});var Hk=ee.Array.from;function zk(e,t){var r;if(e){if("string"==typeof e)return Rk(e,t);var n=mm(r=Object.prototype.toString.call(e)).call(r,8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Hk(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Rk(e,t):void 0}}function Kk(e){return function(e){if(Ik(e))return Rk(e)}(e)||function(e){if(void 0!==fl&&null!=Ak(e)||null!=e["@@iterator"])return Hk(e)}(e)||zk(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.")}()}var Xk=n,qk=i,Wk=gn,Yk=ng.trim,Qk=b("".charAt),Jk=Xk.parseFloat,Zk=Xk.Symbol,$k=Zk&&Zk.iterator,eT=1/Jk("\t\n\v\f\r \u2028\u2029\ufeff-0")!=-1/0||$k&&!qk((function(){Jk(Object($k))}))?function(e){var t=Yk(Wk(e)),r=Jk(t);return 0===r&&"-"==Qk(t,0)?-0:r}:Jk;Ar({global:!0,forced:parseFloat!=eT},{parseFloat:eT});var tT=ee.parseFloat;function rT(e,t){var r=e&&e.navigator,n=e&&e.MediaStreamTrack;if(r.getUserMedia=function(e,t,n){ob("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"===xl(e)&&"object"===xl(e.audio)&&(e=JSON.parse(hk(e)),i(e.audio,"autoGainControl","mozAutoGainControl"),i(e.audio,"noiseSuppression","mozNoiseSuppression")),o(e)},n&&n.prototype.getSettings){var a=n.prototype.getSettings;n.prototype.getSettings=function(){var e=a.apply(this,arguments);return i(e,"mozAutoGainControl","autoGainControl"),i(e,"mozNoiseSuppression","noiseSuppression"),e}}if(n&&n.prototype.applyConstraints){var s=n.prototype.applyConstraints;n.prototype.applyConstraints=function(e){return"audio"===this.kind&&"object"===xl(e)&&(e=JSON.parse(hk(e)),i(e,"autoGainControl","mozAutoGainControl"),i(e,"noiseSuppression","mozNoiseSuppression")),s.apply(this,[e])}}}}function nT(e){"object"===xl(e)&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&id(e.RTCTrackEvent.prototype,"transceiver",{get:function(){return{receiver:this.receiver}}})}function iT(e,t){if("object"===xl(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=od({},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=mm(Array.prototype).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,LE({},t,{type:r[t.type]||t.type}))}))}return e})).then(o,a)}}}function oT(e){if("object"===xl(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):H_.resolve(new aE)}}}function aT(e){if("object"===xl(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}),tb(e,"track",(function(e){return e.receiver._pc=e.srcElement,e})),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}}function sT(e){e.RTCPeerConnection&&!("removeStream"in e.RTCPeerConnection.prototype)&&(e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;ob("removeStream","removeTrack"),this.getSenders().forEach((function(r){var n;r.track&&Wm(n=e.getTracks()).call(n,r.track)&&t.removeTrack(r)}))})}function cT(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function uT(e){if("object"===xl(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=Kk(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&&!(tT(e.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in e&&!(tT(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===an(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 dT(e){if("object"===xl(e)&&e.RTCRtpSender){var t=e.RTCRtpSender.prototype.getParameters;t&&(e.RTCRtpSender.prototype.getParameters=function(){var e,r=t.apply(this,arguments);"encodings"in r||(r.encodings=Im(e=[]).call(e,this.sendEncodings||[{}]));return r})}}function lT(e){if("object"===xl(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?H_.all(this.setParametersPromises).then((function(){return t.apply(r,e)})).finally((function(){r.setParametersPromises=[]})):t.apply(this,arguments)}}}function hT(e){if("object"===xl(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?H_.all(this.setParametersPromises).then((function(){return t.apply(r,e)})).finally((function(){r.setParametersPromises=[]})):t.apply(this,arguments)}}}var fT=Object.freeze(Object.defineProperty({__proto__:null,shimOnTrack:nT,shimPeerConnection:iT,shimSenderGetStats:oT,shimReceiverGetStats:aT,shimRemoveStream:sT,shimRTCDataChannel:cT,shimAddTransceiver:uT,shimGetParameters:dT,shimCreateOffer:lT,shimCreateAnswer:hT,shimGetUserMedia:rT,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,H_.reject(n)}return!0===r.video?r.video={mediaSource:t}:r.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(r)})}},Symbol.toStringTag,{value:"Module"}));function pT(e){if("object"===xl(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,n=this;this._localStreams||(this._localStreams=[]),Wm(r=this._localStreams).call(r,e)||this._localStreams.push(e),e.getAudioTracks().forEach((function(r){return t.call(n,r,e)})),e.getVideoTracks().forEach((function(r){return t.call(n,r,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){var t;r._localStreams?Wm(t=r._localStreams).call(t,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,r,n=this;this._localStreams||(this._localStreams=[]);var i=Ob(t=this._localStreams).call(t,e);if(-1!==i){rk(r=this._localStreams).call(r,i,1);var o=e.getTracks();this.getSenders().forEach((function(e){Wm(o).call(o,e.track)&&n.removeTrack(e)}))}})}}function vT(e){if("object"===xl(e)&&e.RTCPeerConnection&&("getRemoteStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in e.RTCPeerConnection.prototype))){id(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){var r;if(t._remoteStreams||(t._remoteStreams=[]),!Wm(r=t._remoteStreams).call(r,e)){t._remoteStreams.push(e);var n=new Event("addstream");n.stream=e,t.dispatchEvent(n)}}))})}});var t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){var e=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(t){t.streams.forEach((function(t){var r;if(e._remoteStreams||(e._remoteStreams=[]),!(Ob(r=e._remoteStreams).call(r,t)>=0)){e._remoteStreams.push(t);var n=new Event("addstream");n.stream=t,e.dispatchEvent(n)}}))}),t.apply(e,arguments)}}}function _T(e){if("object"===xl(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype,r=t.createOffer,n=t.createAnswer,i=t.setLocalDescription,o=t.setRemoteDescription,a=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),H_.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),H_.resolve()):i};var s=function(e,t,r){var n=i.apply(this,[e]);return r?(n.then(t,r),H_.resolve()):n};t.setLocalDescription=s,s=function(e,t,r){var n=o.apply(this,[e]);return r?(n.then(t,r),H_.resolve()):n},t.setRemoteDescription=s,s=function(e,t,r){var n=a.apply(this,[e]);return r?(n.then(t,r),H_.resolve()):n},t.addIceCandidate=s}}function mT(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(gT(e))}}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,r,n){t.mediaDevices.getUserMedia(e).then(r,n)}.bind(t))}function gT(e){return e&&void 0!==e.video?LE({},e,{video:cb(e.video)}):e}function yT(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")?(ob("RTCIceServer.url","RTCIceServer.urls"),(o=JSON.parse(hk(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&&id(e.RTCPeerConnection,"generateCertificate",{get:function(){return t.generateCertificate}})}}function ST(e){"object"===xl(e)&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&id(e.RTCTrackEvent.prototype,"transceiver",{get:function(){return{receiver:this.receiver}}})}function ET(e){var t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(e){if(e){var r,n;void 0!==e.offerToReceiveAudio&&(e.offerToReceiveAudio=!!e.offerToReceiveAudio);var i=yb(r=this.getTransceivers()).call(r,(function(e){return"audio"===e.receiver.track.kind}));!1===e.offerToReceiveAudio&&i?"sendrecv"===i.direction?i.setDirection?i.setDirection("sendonly"):i.direction="sendonly":"recvonly"===i.direction&&(i.setDirection?i.setDirection("inactive"):i.direction="inactive"):!0!==e.offerToReceiveAudio||i||this.addTransceiver("audio",{direction:"recvonly"}),void 0!==e.offerToReceiveVideo&&(e.offerToReceiveVideo=!!e.offerToReceiveVideo);var o=yb(n=this.getTransceivers()).call(n,(function(e){return"video"===e.receiver.track.kind}));!1===e.offerToReceiveVideo&&o?"sendrecv"===o.direction?o.setDirection?o.setDirection("sendonly"):o.direction="sendonly":"recvonly"===o.direction&&(o.setDirection?o.setDirection("inactive"):o.direction="inactive"):!0!==e.offerToReceiveVideo||o||this.addTransceiver("video",{direction:"recvonly"})}return t.apply(this,arguments)}}function bT(e){"object"!==xl(e)||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var kT=Object.freeze(Object.defineProperty({__proto__:null,shimLocalStreamsAPI:pT,shimRemoteStreamsAPI:vT,shimCallbacksAPI:_T,shimGetUserMedia:mT,shimConstraints:gT,shimRTCIceServerUrls:yT,shimTrackEventTransceiver:ST,shimCreateOfferLegacy:ET,shimAudioContext:bT},Symbol.toStringTag,{value:"Module"})),TT=cc.PROPER,IT=i,RT=Ym,AT=ng.trim;Ar({target:"String",proto:!0,forced:function(e){return IT((function(){return!!RT[e]()||"
"!=="
"[e]()||TT&&RT[e].name!==e}))}("trim")},{trim:function(){return AT(this)}});var wT,CT,OT=Us("String").trim,DT=ae,xT=OT,NT=String.prototype,PT=function(e){var t=e.trim;return"string"==typeof e||e===NT||DT(NT,e)&&t===NT.trim?xT:t},MT={exports:{}};wT=MT,(CT={generateIdentifier:function(){return Math.random().toString(36).substr(2,10)}}).localCName=CT.generateIdentifier(),CT.splitLines=function(e){var t;return ck(t=PT(e).call(e).split("\n")).call(t,(function(e){return PT(e).call(e)}))},CT.splitSections=function(e){var t=e.split("\nm=");return ck(t).call(t,(function(e,t){var r;return PT(r=t>0?"m="+e:e).call(r)+"\r\n"}))},CT.getDescription=function(e){var t=CT.splitSections(e);return t&&t[0]},CT.getMediaSections=function(e){var t=CT.splitSections(e);return t.shift(),t},CT.matchPrefix=function(e,t){var r;return Gs(r=CT.splitLines(e)).call(r,(function(e){return 0===Ob(e).call(e,t)}))},CT.parseCandidate=function(e){for(var t,r={foundation:(t=0===Ob(e).call(e,"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:_g(t[3],10),ip:t[4],address:t[4],port:_g(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=_g(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},CT.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(" ")},CT.parseIceOptions=function(e){return e.substr(14).split(" ")},CT.parseRtpMap=function(e){var t=e.substr(9).split(" "),r={payloadType:_g(t.shift(),10)};return t=t[0].split("/"),r.name=t[0],r.clockRate=_g(t[1],10),r.channels=3===t.length?_g(t[2],10):1,r.numChannels=r.channels,r},CT.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"},CT.parseExtmap=function(e){var t,r=e.substr(9).split(" ");return{id:_g(r[0],10),direction:Ob(t=r[0]).call(t,"/")>0?r[0].split("/")[1]:"sendrecv",uri:r[1]}},CT.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+"\r\n"},CT.parseFmtp=function(e){for(var t,r={},n=e.substr(Ob(e).call(e," ")+1).split(";"),i=0;i<n.length;i++){var o,a;t=PT(o=n[i]).call(o).split("="),r[PT(a=t[0]).call(a)]=t[1]}return r},CT.writeFmtp=function(e){var t="",r=e.payloadType;if(void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.parameters&&an(e.parameters).length){var n=[];an(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},CT.parseRtcpFb=function(e){var t=e.substr(Ob(e).call(e," ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},CT.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},CT.parseSsrcMedia=function(e){var t=Ob(e).call(e," "),r={ssrc:_g(e.substr(7,t-7),10)},n=Ob(e).call(e,":",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},CT.parseSsrcGroup=function(e){var t=e.substr(13).split(" ");return{semantics:t.shift(),ssrcs:ck(t).call(t,(function(e){return _g(e,10)}))}},CT.getMid=function(e){var t=CT.matchPrefix(e,"a=mid:")[0];if(t)return t.substr(6)},CT.parseFingerprint=function(e){var t=e.substr(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1].toUpperCase()}},CT.getDtlsParameters=function(e,t){var r=CT.matchPrefix(e+t,"a=fingerprint:");return{role:"auto",fingerprints:ck(r).call(r,CT.parseFingerprint)}},CT.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},CT.parseCryptoLine=function(e){var t=e.substr(9).split(" ");return{tag:_g(t[0],10),cryptoSuite:t[1],keyParams:t[2],sessionParams:mm(t).call(t,3)}},CT.writeCryptoLine=function(e){return"a=crypto:"+e.tag+" "+e.cryptoSuite+" "+("object"===xl(e.keyParams)?CT.writeCryptoKeyParams(e.keyParams):e.keyParams)+(e.sessionParams?" "+e.sessionParams.join(" "):"")+"\r\n"},CT.parseCryptoKeyParams=function(e){if(0!==Ob(e).call(e,"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}},CT.writeCryptoKeyParams=function(e){return e.keyMethod+":"+e.keySalt+(e.lifeTime?"|"+e.lifeTime:"")+(e.mkiValue&&e.mkiLength?"|"+e.mkiValue+":"+e.mkiLength:"")},CT.getCryptoParameters=function(e,t){var r=CT.matchPrefix(e+t,"a=crypto:");return ck(r).call(r,CT.parseCryptoLine)},CT.getIceParameters=function(e,t){var r=CT.matchPrefix(e+t,"a=ice-ufrag:")[0],n=CT.matchPrefix(e+t,"a=ice-pwd:")[0];return r&&n?{usernameFragment:r.substr(12),password:n.substr(10)}:null},CT.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},CT.parseRtpParameters=function(e){for(var t={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},r=CT.splitLines(e)[0].split(" "),n=3;n<r.length;n++){var i=r[n],o=CT.matchPrefix(e,"a=rtpmap:"+i+" ")[0];if(o){var a,s=CT.parseRtpMap(o),c=CT.matchPrefix(e,"a=fmtp:"+i+" ");switch(s.parameters=c.length?CT.parseFmtp(c[0]):{},s.rtcpFeedback=ck(a=CT.matchPrefix(e,"a=rtcp-fb:"+i+" ")).call(a,CT.parseRtcpFb),t.codecs.push(s),s.name.toUpperCase()){case"RED":case"ULPFEC":t.fecMechanisms.push(s.name.toUpperCase())}}}return CT.matchPrefix(e,"a=extmap:").forEach((function(e){t.headerExtensions.push(CT.parseExtmap(e))})),t},CT.writeRtpDescription=function(e,t){var r,n="";n+="m="+e+" ",n+=t.codecs.length>0?"9":"0",n+=" UDP/TLS/RTP/SAVPF ",n+=ck(r=t.codecs).call(r,(function(e){return void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType})).join(" ")+"\r\n",n+="c=IN IP4 0.0.0.0\r\n",n+="a=rtcp:9 IN IP4 0.0.0.0\r\n",t.codecs.forEach((function(e){n+=CT.writeRtpMap(e),n+=CT.writeFmtp(e),n+=CT.writeRtcpFb(e)}));var i=0;return t.codecs.forEach((function(e){e.maxptime>i&&(i=e.maxptime)})),i>0&&(n+="a=maxptime:"+i+"\r\n"),t.headerExtensions&&t.headerExtensions.forEach((function(e){n+=CT.writeExtmap(e)})),n},CT.parseRtpEncodingParameters=function(e){var t,r,n,i,o,a,s=[],c=CT.parseRtpParameters(e),u=-1!==Ob(t=c.fecMechanisms).call(t,"RED"),d=-1!==Ob(r=c.fecMechanisms).call(r,"ULPFEC"),l=Gs(n=ck(i=CT.matchPrefix(e,"a=ssrc:")).call(i,(function(e){return CT.parseSsrcMedia(e)}))).call(n,(function(e){return"cname"===e.attribute})),h=l.length>0&&l[0].ssrc,f=ck(o=CT.matchPrefix(e,"a=ssrc-group:FID")).call(o,(function(e){var t=e.substr(17).split(" ");return ck(t).call(t,(function(e){return _g(e,10)}))}));f.length>0&&f[0].length>1&&f[0][0]===h&&(a=f[0][1]),c.codecs.forEach((function(e){if("RTX"===e.name.toUpperCase()&&e.parameters.apt){var t={ssrc:h,codecPayloadType:_g(e.parameters.apt,10)};h&&a&&(t.rtx={ssrc:a}),s.push(t),u&&((t=JSON.parse(hk(t))).fec={ssrc:h,mechanism:d?"red+ulpfec":"red"},s.push(t))}})),0===s.length&&h&&s.push({ssrc:h});var p,v,_=CT.matchPrefix(e,"b=");return _.length&&(_=0===Ob(p=_[0]).call(p,"b=TIAS:")?_g(_[0].substr(7),10):0===Ob(v=_[0]).call(v,"b=AS:")?1e3*_g(_[0].substr(5),10)*.95-16e3:void 0,s.forEach((function(e){e.maxBitrate=_}))),s},CT.parseRtcpParameters=function(e){var t,r,n={},i=Gs(t=ck(r=CT.matchPrefix(e,"a=ssrc:")).call(r,(function(e){return CT.parseSsrcMedia(e)}))).call(t,(function(e){return"cname"===e.attribute}))[0];i&&(n.cname=i.value,n.ssrc=i.ssrc);var o=CT.matchPrefix(e,"a=rtcp-rsize");n.reducedSize=o.length>0,n.compound=0===o.length;var a=CT.matchPrefix(e,"a=rtcp-mux");return n.mux=a.length>0,n},CT.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},CT.parseMsid=function(e){var t,r,n,i=CT.matchPrefix(e,"a=msid:");if(1===i.length)return{stream:(n=i[0].substr(7).split(" "))[0],track:n[1]};var o=Gs(t=ck(r=CT.matchPrefix(e,"a=ssrc:")).call(r,(function(e){return CT.parseSsrcMedia(e)}))).call(t,(function(e){return"msid"===e.attribute}));return o.length>0?{stream:(n=o[0].value.split(" "))[0],track:n[1]}:void 0},CT.parseSctpDescription=function(e){var t,r=CT.parseMLine(e),n=CT.matchPrefix(e,"a=max-message-size:");n.length>0&&(t=_g(n[0].substr(19),10)),isNaN(t)&&(t=65536);var i=CT.matchPrefix(e,"a=sctp-port:");if(i.length>0)return{port:_g(i[0].substr(12),10),protocol:r.fmt,maxMessageSize:t};var o=CT.matchPrefix(e,"a=sctpmap:");if(o.length>0){var a=o[0].substr(10).split(" ");return{port:_g(a[0],10),protocol:a[1],maxMessageSize:t}}},CT.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("")},CT.generateSessionId=function(){return Math.random().toString().substr(2,21)},CT.writeSessionBoilerplate=function(e,t,r){var n=void 0!==t?t:2;return"v=0\r\no="+(r||"thisisadapterortc")+" "+(e||CT.generateSessionId())+" "+n+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},CT.getDirection=function(e,t){for(var r=CT.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?CT.getDirection(t):"sendrecv"},CT.getKind=function(e){return CT.splitLines(e)[0].split(" ")[0].substr(2)},CT.isRejected=function(e){return"0"===e.split(" ",2)[1]},CT.parseMLine=function(e){var t=CT.splitLines(e)[0].substr(2).split(" ");return{kind:t[0],port:_g(t[1],10),protocol:t[2],fmt:mm(t).call(t,3).join(" ")}},CT.parseOLine=function(e){var t=CT.matchPrefix(e,"o=")[0].substr(2).split(" ");return{username:t[0],sessionId:t[1],sessionVersion:_g(t[2],10),netType:t[3],addressType:t[4],address:t[5]}},CT.isValidSDP=function(e){if("string"!=typeof e||0===e.length)return!1;for(var t=CT.splitLines(e),r=0;r<t.length;r++)if(t[r].length<2||"="!==t[r].charAt(1))return!1;return!0},wT.exports=CT;var LT=MT.exports,UT=e({__proto__:null,default:LT},[MT.exports]);function VT(e){if(!(!e.RTCIceCandidate||e.RTCIceCandidate&&"foundation"in e.RTCIceCandidate.prototype)){var t=e.RTCIceCandidate;e.RTCIceCandidate=function(e){var r;if("object"===xl(e)&&e.candidate&&0===Ob(r=e.candidate).call(r,"a=")&&((e=JSON.parse(hk(e))).candidate=e.candidate.substr(2)),e.candidate&&e.candidate.length){var n=new t(e),i=LT.parseCandidate(e.candidate),o=LE(n,i);return o.toJSON=function(){return{candidate:o.candidate,sdpMid:o.sdpMid,sdpMLineIndex:o.sdpMLineIndex,usernameFragment:o.usernameFragment}},o}return new t(e)},e.RTCIceCandidate.prototype=t.prototype,tb(e,"icecandidate",(function(t){return t.candidate&&id(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t}))}}function FT(e){!e.RTCIceCandidate||e.RTCIceCandidate&&"relayProtocol"in e.RTCIceCandidate.prototype||tb(e,"icecandidate",(function(e){if(e.candidate){var t=LT.parseCandidate(e.candidate.candidate);"relay"===t.type&&(e.candidate.relayProtocol={0:"tls",1:"tcp",2:"udp"}[t.priority>>24])}return e}))}function BT(e,t){if(e.RTCPeerConnection){"sctp"in e.RTCPeerConnection.prototype||id(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=LT.splitSections(e.sdp);return t.shift(),t.some((function(e){var t,r=LT.parseMLine(e);return r&&"application"===r.kind&&-1!==Ob(t=r.protocol).call(t,"SCTP")}))},n=function(e){var t=e.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===t||t.length<2)return-1;var r=_g(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=LT.matchPrefix(e.sdp,"a=max-message-size:");return i.length>0?n=_g(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&&id(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={};id(h,"maxMessageSize",{get:function(){return c}}),this._sctp=h}return a.apply(this,arguments)}}}function jT(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},tb(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 GT(e){if(e.RTCPeerConnection&&!("connectionState"in e.RTCPeerConnection.prototype)){var t=e.RTCPeerConnection.prototype;id(t,"connectionState",{get:function(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),id(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 HT(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){var n;if(t&&t.sdp&&-1!==Ob(n=t.sdp).call(n,"\na=extmap-allow-mixed")){var i,o=Gs(i=t.sdp.split("\n")).call(i,(function(e){return"a=extmap-allow-mixed"!==PT(e).call(e)})).join("\n");e.RTCSessionDescription&&t instanceof e.RTCSessionDescription?arguments[0]=new e.RTCSessionDescription({type:t.type,sdp:o}):t.sdp=o}return r.apply(this,arguments)}}}function zT(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?H_.resolve():r.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),H_.resolve())})}}function KT(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"!==xl(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 XT=Object.freeze(Object.defineProperty({__proto__:null,shimRTCIceCandidate:VT,shimRTCIceCandidateRelayProtocol:FT,shimMaxMessageSize:BT,shimSendThrowTypeError:jT,shimConnectionState:GT,removeExtmapAllowMixed:HT,shimAddIceCandidateNullOrEmpty:zT,shimParameterlessSetLocalDescription:KT},Symbol.toStringTag,{value:"Module"}));function qT(e,t){var r=void 0!==fl&&Ak(e)||e["@@iterator"];if(!r){if(Ik(e)||(r=zk(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}}}}function WT(e,t){return function(e){if(Ik(e))return e}(e)||function(e,t){var r=null==e?null:void 0!==fl&&Ak(e)||e["@@iterator"];if(null!=r){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)||zk(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 YT(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}!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=ib,i=ab(t),o={browserDetails:i,commonShim:XT,extractVersion:eb,disableLog:rb,disableWarnings:nb,sdp:UT};switch(i.browser){case"chrome":if(!Tk||!bk||!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=Tk,zT(t,i),KT(t),pk(t,i),vk(t),bk(t,i),_k(t),Ek(t,i),mk(t),gk(t),yk(t),kk(t,i),VT(t),FT(t),GT(t),BT(t,i),jT(t),HT(t,i);break;case"firefox":if(!fT||!iT||!r.shimFirefox)return n("Firefox shim is not included in this adapter release."),o;n("adapter.js shimming firefox."),o.browserShim=fT,zT(t,i),KT(t),rT(t,i),iT(t,i),nT(t),sT(t),oT(t),aT(t),cT(t),uT(t),dT(t),lT(t),hT(t),VT(t),GT(t),BT(t,i),jT(t);break;case"safari":if(!kT||!r.shimSafari)return n("Safari shim is not included in this adapter release."),o;n("adapter.js shimming safari."),o.browserShim=kT,zT(t,i),KT(t),yT(t),ET(t),_T(t),pT(t),vT(t),ST(t),mT(t),bT(t),VT(t),FT(t),BT(t,i),jT(t),HT(t,i);break;default:n("Unsupported browser!")}}({window:"undefined"==typeof window?void 0:window});var QT=Ye,JT=function(e){return void 0!==e&&(QT(e,"value")||QT(e,"writable"))},ZT=D,$T=$,eI=tr,tI=JT,rI=A,nI=mc;Ar({target:"Reflect",stat:!0},{get:function e(t,r){var n,i,o=arguments.length<3?t:arguments[2];return eI(t)===o?t[r]:(n=rI.f(t,r))?tI(n)?n.value:void 0===n.get?void 0:ZT(n.get,o):$T(i=nI(t))?e(i,r,o):void 0}});var iI=ee.Reflect.get,oI=b,aI=Ce,sI=$,cI=Ye,uI=rs,dI=o,lI=Function,hI=oI([].concat),fI=oI([].join),pI={},vI=function(e,t,r){if(!cI(pI,t)){for(var n=[],i=0;i<t;i++)n[i]="a["+i+"]";pI[t]=lI("C,a","return new C("+fI(n,",")+")")}return pI[t](e,r)},_I=dI?lI.bind:function(e){var t=aI(this),r=t.prototype,n=uI(arguments,1),i=function(){var r=hI(n,uI(arguments));return this instanceof i?vI(t,r.length,r):t.apply(e,r)};return sI(r)&&(i.prototype=r),i},mI=_I;Ar({target:"Function",proto:!0,forced:Function.bind!==mI},{bind:mI});var gI=Us("Function").bind,yI=ae,SI=gI,EI=Function.prototype,bI=function(e){var t=e.bind;return e===EI||yI(EI,e)&&t===EI.bind?SI:t};function kI(e){var t;return(kI=Fl?bI(t=Vl).call(t):function(e){return e.__proto__||Vl(e)})(e)}function TI(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=kI(e)););return e}function II(){var e;"undefined"!=typeof Reflect&&iI?II=bI(e=iI).call(e):II=function(e,t,r){var n=TI(e,t);if(n){var i=tc(n,t);return i.get?i.get.call(arguments.length<3?e:r):i.value}};return II.apply(this,arguments)}function RI(e,t){var r;return(RI=Fl?bI(r=Fl).call(r):function(e,t){return e.__proto__=t,e})(e,t)}function AI(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Pl(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),id(e,"prototype",{writable:!1}),t&&RI(e,t)}var wI=Ar,CI=d,OI=_I,DI=_f,xI=tr,NI=$,PI=Hn,MI=i,LI=oe("Reflect","construct"),UI=Object.prototype,VI=[].push,FI=MI((function(){function e(){}return!(LI((function(){}),[],e)instanceof e)})),BI=!MI((function(){LI((function(){}))})),jI=FI||BI;wI({target:"Reflect",stat:!0,forced:jI,sham:jI},{construct:function(e,t){DI(e),xI(t);var r=arguments.length<3?e:DI(arguments[2]);if(BI&&!FI)return LI(e,t,r);if(e==r){switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3])}var n=[null];return CI(VI,n,t),new(CI(OI,e,n))}var i=r.prototype,o=PI(NI(i)?i:UI),a=CI(e,o,t);return NI(a)?a:o}});var GI=ee.Reflect.construct;function HI(e,t){if(t&&("object"===xl(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return YT(e)}function zI(e){var t=function(){if("undefined"==typeof Reflect||!GI)return!1;if(GI.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(GI(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=kI(e);if(t){var i=kI(this).constructor;r=GI(n,arguments,i)}else r=n.apply(this,arguments);return HI(this,r)}}var KI=Us("Array").values,XI=vn,qI=Ye,WI=ae,YI=KI,QI=Array.prototype,JI={DOMTokenList:!0,NodeList:!0},ZI=function(e){var t=e.values;return e===QI||WI(QI,e)&&t===QI.values||qI(JI,XI(e))?YI:t},$I=ni,eR=Math.floor,tR=function(e,t){var r=e.length,n=eR(r/2);return r<8?rR(e,t):nR(e,tR($I(e,0,n),t),tR($I(e,n),t),t)},rR=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},nR=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},iR=tR,oR=se.match(/firefox\/(\d+)/i),aR=!!oR&&+oR[1],sR=/MSIE|Trident/.test(se),cR=se.match(/AppleWebKit\/(\d+)\./),uR=!!cR&&+cR[1],dR=Ar,lR=b,hR=Ce,fR=Xe,pR=Br,vR=Vb,_R=gn,mR=i,gR=iR,yR=ku,SR=aR,ER=sR,bR=pe,kR=uR,TR=[],IR=lR(TR.sort),RR=lR(TR.push),AR=mR((function(){TR.sort(void 0)})),wR=mR((function(){TR.sort(null)})),CR=yR("sort"),OR=!mR((function(){if(bR)return bR<70;if(!(SR&&SR>3)){if(ER)return!0;if(kR)return kR<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++)TR.push({k:t+n,v:r})}for(TR.sort((function(e,t){return t.v-e.v})),n=0;n<TR.length;n++)t=TR[n].k.charAt(0),i.charAt(i.length-1)!==t&&(i+=t);return"DGBEFHACIJK"!==i}}));dR({target:"Array",proto:!0,forced:AR||!wR||!CR||!OR},{sort:function(e){void 0!==e&&hR(e);var t=fR(this);if(OR)return void 0===e?IR(t):IR(t,e);var r,n,i=[],o=pR(t);for(n=0;n<o;n++)n in t&&RR(i,t[n]);for(gR(i,function(e){return function(t,r){return void 0===r?-1:void 0===t?1:void 0!==e?+e(t,r)||0:_R(t)>_R(r)?1:-1}}(e)),r=pR(i),n=0;n<r;)t[n]=i[n++];for(;n<o;)vR(t,n++);return t}});var DR=Us("Array").sort,xR=ae,NR=DR,PR=Array.prototype,MR=function(e){var t=e.sort;return e===PR||xR(PR,e)&&t===PR.sort?NR:t},LR=Ar,UR=Po.findIndex,VR="findIndex",FR=!0;VR in[]&&Array(1).findIndex((function(){FR=!1})),LR({target:"Array",proto:!0,forced:FR},{findIndex:function(e){return UR(this,e,arguments.length>1?arguments[1]:void 0)}});var BR=Us("Array").findIndex,jR=ae,GR=BR,HR=Array.prototype,zR=function(e){var t=e.findIndex;return e===HR||jR(HR,e)&&t===HR.findIndex?GR:t},KR=Ar,XR=b;A.f;var qR=Vr,WR=gn,YR=Nm,QR=q,JR=Mm,ZR=XR("".startsWith),$R=XR("".slice),eA=Math.min;KR({target:"String",proto:!0,forced:!JR("startsWith")},{startsWith:function(e){var t=WR(QR(this));YR(e);var r=qR(eA(arguments.length>1?arguments[1]:void 0,t.length)),n=WR(e);return ZR?ZR(t,n,r):$R(t,r,r+n.length)===n}});var tA=Us("String").startsWith,rA=ae,nA=tA,iA=String.prototype,oA=function(e){var t=e.startsWith;return"string"==typeof e||e===iA||rA(iA,e)&&t===iA.startsWith?nA:t},aA=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_EXCEED_QPS="USER_MESSAGE_EXCEED_QPS",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.SUBTITLE_ALREADY_ON="SUBTITLE_ALREADY_ON",e.SUBTITLE_NOT_TURNED_ON="SUBTITLE_NOT_TURNED_ON",e.SUBTITLE_ERR_POSTPROCESS="SUBTITLE_ERR_POSTPROCESS",e.SUBTITLE_ERR_CONNECTION_ERROR="SUBTITLE_ERR_CONNECTION_ERROR",e.SUBTITLE_ERR_PROCESS_ERROR="SUBTITLE_ERR_PROCESS_ERROR",e.SUBTITLE_ERR_UNKNOWN="SUBTITLE_ERR_UNKNOWN",e}(aA||{}),sA=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}(sA||{}),cA=zd((function e(t,r,n){Kd(this,e),od(this,"code",void 0),od(this,"message",void 0),od(this,"error",void 0),this.code=t,this.message=r,this.error=n})),uA=w,dA=b,lA=rn,hA=Q,fA=dA(x.f),pA=dA([].push),vA=function(e){return function(t){for(var r,n=hA(t),i=lA(n),o=i.length,a=0,s=[];o>a;)r=i[a++],uA&&!fA(n,r)||pA(s,e?[r,n[r]]:n[r]);return s}},_A={entries:vA(!0),values:vA(!1)}.entries;Ar({target:"Object",stat:!0},{entries:function(e){return _A(e)}});var mA=ee.Object.entries,gA=Dr,yA=gn,SA=q,EA=RangeError,bA=b,kA=Vr,TA=gn,IA=function(e){var t=yA(SA(this)),r="",n=gA(e);if(n<0||n==1/0)throw EA("Wrong number of repetitions");for(;n>0;(n>>>=1)&&(t+=t))1&n&&(r+=t);return r},RA=q,AA=bA(IA),wA=bA("".slice),CA=Math.ceil,OA=function(e){return function(t,r,n){var i,o,a=TA(RA(t)),s=kA(r),c=a.length,u=void 0===n?" ":TA(n);return s<=c||""==u?a:((o=AA(u,CA((i=s-c)/u.length))).length>i&&(o=wA(o,0,i)),e?a+o:o+a)}},DA={start:OA(!1),end:OA(!0)},xA=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(se),NA=DA.end;Ar({target:"String",proto:!0,forced:xA},{padEnd:function(e){return NA(this,e,arguments.length>1?arguments[1]:void 0)}});var PA=Us("String").padEnd,MA=ae,LA=PA,UA=String.prototype,VA=function(e){var t=e.padEnd;return"string"==typeof e||e===UA||MA(UA,e)&&t===UA.padEnd?LA:t},FA=vg;Ar({target:"Number",stat:!0,forced:Number.parseInt!=FA},{parseInt:FA});var BA=ee.Number.parseInt,jA=Math.log,GA=Math.LOG10E;Ar({target:"Math",stat:!0},{log10:Math.log10||function(e){return jA(e)*GA}});var HA,zA=ee.Math.log10,KA=new Uint8Array(16);function XA(){if(!HA&&!(HA="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 HA(KA)}var qA=/^(?:[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 WA(e){return"string"==typeof e&&qA.test(e)}for(var YA,QA,JA,ZA=[],$A=0;$A<256;++$A)ZA.push(($A+256).toString(16).substr(1));function ew(e,t,r){var n=(e=e||{}).random||(e.rng||XA)();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=(ZA[e[t+0]]+ZA[e[t+1]]+ZA[e[t+2]]+ZA[e[t+3]]+"-"+ZA[e[t+4]]+ZA[e[t+5]]+"-"+ZA[e[t+6]]+ZA[e[t+7]]+"-"+ZA[e[t+8]]+ZA[e[t+9]]+"-"+ZA[e[t+10]]+ZA[e[t+11]]+ZA[e[t+12]]+ZA[e[t+13]]+ZA[e[t+14]]+ZA[e[t+15]]).toLowerCase();if(!WA(r))throw TypeError("Stringified UUID is invalid");return r}(n)}var tw=new TextDecoder,rw=new TextEncoder,nw=function(){return ew()},iw=function(){return Date.now()};function ow(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 aw=function(){return"undefined"==typeof window},sw=function(){function e(){Kd(this,e)}var t,r;return zd(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){var n;return window.btoa(Gs(n=[e,t,r]).call(n,(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=mA(t);n<i.length;n++){var o=WT(i[n],2),a=o[0],s=o[1];null!==s&&"object"===xl(s)?e.merge(t[a],r[a]):void 0!==r[a]&&(t[a]=r[a])}}},{key:"ab2str",value:function(e){return tw.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 rw.encode(e).buffer}},{key:"ab2b64str",value:(r=Sm(gm().mark((function e(t){var r;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,new H_((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=Sm(gm().mark((function e(t){return gm().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 cw(){var e="none";return aw()||(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 uw="mozilla"===cw(),dw="safari"===cw(),lw=0,hw=!aw()&&(null===(YA=navigator.userAgent.match(/version\/(\d+)/i))||void 0===YA?void 0:YA[1]);dw&&hw&&(lw=+hw);var fw=!aw()&&(null===(QA=navigator.userAgent.match(/Firefox\/(\d+)/i))||void 0===QA?void 0:QA[1]);uw&&fw&&(lw=+fw);var pw=lw,vw=lw,_w=!aw()&&!!/(iPhone|iPad|iPod)/i.exec(navigator.userAgent);!aw()&&/(iPhone|iPod)/i.exec(navigator.userAgent);var mw=!aw()&&(!!/(iPad)/i.exec(navigator.userAgent)||/Macintosh/i.test(navigator.userAgent)&&"ontouchend"in document),gw=!aw()&&/MicroMessenger/i.test(navigator.userAgent),yw=!aw()&&/Android/i.test(navigator.userAgent);!aw()&&Wm(JA=navigator.userAgent.toLowerCase()).call(JA,"mobile");var Sw=!aw()&&/chrome\/(86)|(87)|(88)|(89)|(90)|(91)|(92)/i.test(navigator.userAgent);function Ew(){for(var e,t,r=(+VA(e=mm(t="".concat(Math.random())).call(t,-7)).call(e,7,"0")).toString(2),n=VA(r).call(r,28,"1").split(""),i=[];n.length;)i.push(rk(n).call(n,0,7));return ck(i).call(i,(function(e,t){var r=t===i.length-1?"0":"1";return BA(r+e.join(""),2)}))}var bw=function(){return Math.floor(65535*Math.random())};function kw(e){return"string"==typeof e&&Ob(e).call(e,"__web__rtc__rtt__")>-1}function Tw(e){return ck(e).call(e,(function e(t){var r;if(null!=t&&t._reportName)return t._reportName;if(t instanceof HTMLElement)return t.toString();if(t instanceof ArrayBuffer||ArrayBuffer.isView(t)){var n,i,o=ArrayBuffer.isView(t)?t.buffer:t,a=o.byteLength,s=[];if(a>10){var c,u,d,l,h=new DataView(o),f=ck(c=Hk({length:5})).call(c,(function(e,t){return h.getUint8(t)})),p=ck(u=ck(d=Hk({length:5})).call(d,(function(e,t){return a-1-t})).reverse()).call(u,(function(e){return h.getUint8(e)}));s=Im(l=[]).call(l,Kk(f),["..."],Kk(p))}else s=Hk(new Uint8Array(o));return Im(n=Im(i="".concat(t.constructor.name,"(")).call(i,a,") [")).call(n,s.join(", "),"]")}if(t instanceof ImageData)return"ImageData";if(Array.isArray(t))return ck(t).call(t,e);if(Wm(r=["[object Object]","[object MediaStreamTrack]"]).call(r,Object.prototype.toString.call(t))){var v={};for(var _ in t)v[_]=e(t[_]);return v}return t}))}var Iw=function(){var e=Sm(gm().mark((function e(){var t,r,n,i=arguments;return gm().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)}}(),Rw=function(e){return new H_((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 Aw(e){return+Math.max(-127,10*zA(Math.pow(e/255,2))).toFixed(2)}function ww(e){return(e&gd.AUDIO)===gd.AUDIO}function Cw(e){return(e&gd.VIDEO)===gd.VIDEO}function Ow(e){var t={};return an(e).forEach((function(r){"object"===xl(e[r])?t[r]=Ow(e[r]):oA(r).call(r,"_")||(t[r]=e[r])})),t}function Dw(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 xw(e){return null==e?"undefined | null":"string"==typeof e?e:hk({contentHint:e.contentHint,enabled:e.enabled,id:e.id,kind:e.kind,label:e.label,muted:e.muted,readyState:e.readyState})}function Nw(e){return void 0===e}function Pw(e){return function(t,r,n){var i=n.value;n.value=function(){var t;console.warn(Im(t="[RTC WebSDK]: Api: ".concat(r," has been abandoned from version ")).call(t,e));for(var n=arguments.length,o=new Array(n),a=0;a<n;a++)o[a]=arguments[a];return i.apply(this,o)}}}function Mw(e){console.warn("[RTC WebSDK]: "+e)}function Lw(e){return"number"==typeof e?e:"number"==typeof(null==e?void 0:e.exact)?e.exact:"number"==typeof(null==e?void 0:e.ideal)?e.ideal:"number"==typeof(null==e?void 0:e.max)?e.max:"number"==typeof(null==e?void 0:e.min)?e.min:1}function Uw(e,t){if("boolean"!=typeof e)throw new cA(aA.INVALID_PARAMS,"Invalid ".concat(t,": The value should be boolean type."))}function Vw(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,o,a=new cA(aA.INVALID_PARAMS,Im(i=Im(o="Invalid ".concat(t,": the value range is [")).call(o,r,", ")).call(i,n,"]. integer only"));throw a}}function Fw(e,t){var r,n,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Number.POSITIVE_INFINITY;if(null==e)throw new cA(aA.INVALID_PARAMS,"".concat(t," cannot be empty"));if(!Kw(e,i,o))throw new cA(aA.INVALID_PARAMS,Im(r=Im(n="Invalid ".concat(t,": The value should be string type. Length of the string: [")).call(n,i,",")).call(r,o,"]"))}function Bw(e,t,r){var n;if(!Wm(r).call(r,e))throw new cA(aA.INVALID_PARAMS,Im(n="Invalid ".concat(t,": The value can only be set as ")).call(n,hk(r)))}function jw(e){if(!(e instanceof MediaStreamTrack))throw new cA(aA.INVALID_PARAMS,"Invalid track, The value should be MediaStreamTrack type.")}function Gw(e,t){if(Xw(e))throw new cA(aA.INVALID_PARAMS,"Invalid ".concat(t,", should not be empty"))}function Hw(e,t){if(!(e instanceof ArrayBuffer))throw new cA(aA.INVALID_PARAMS,"Invalid ".concat(t,", should be ArrayBuffer"))}function zw(e){try{for(var t=navigator.mediaDevices.getSupportedConstraints(),r=0,n=an(e);r<n.length;r++){var i=n[r];t[i]||delete e[i]}}catch(o){}}function Kw(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 Xw(e){return null==e}function qw(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new cA(aA.INVALID_PARAMS,"The RoomId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function Ww(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new cA(aA.INVALID_PARAMS,"The userId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function Yw(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new cA(aA.INVALID_PARAMS,"The publicStreamId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function Qw(e){Gw(e,"userInfo"),Ww(e.userId),Xw(e.extraInfo)||Fw(e.extraInfo,"userInfo.extraInfo",1,200)}function Jw(e){Gw(e,"roomConfig"),Uw(e.isAutoPublish,"roomConfig.isAutoPublish"),Uw(e.isAutoSubscribeAudio,"roomConfig.isAutoSubscribeAudio"),Uw(e.isAutoSubscribeVideo,"roomConfig.isAutoSubscribeVideo"),Xw(e.roomProfileType)||Bw(e.roomProfileType,"roomConfig",[Od.communication,Od.chat,Od.chatRoom,Od.coHost,Od.meeting,Od.classRoom])}function Zw(e){Gw(e,"videoPlayerOption")}function $w(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 cA(aA.INVALID_PARAMS,"The message cannot be empty");if((null===(t=e instanceof ArrayBuffer?e:sw.str2ab(hk(e)))||void 0===t?void 0:t.byteLength)>1e3*r)throw new cA(aA.INVALID_PARAMS,"The message length must be less than ".concat(r,"K"))}function eC(e){var t;return!Wm(t=[Gd.onRemoteStreamStats,Gd.onLocalStreamStats,Gd.onAudioVolumeIndication,Gd.onLocalAudioPropertiesReport,Gd.onRemoteAudioPropertiesReport]).call(t,e)}function tC(e){if("number"!=typeof(null==e?void 0:e.width)||"number"!=typeof(null==e?void 0:e.height))throw new cA(aA.INVALID_PARAMS,"remoteVideoConfig must contain width, height, frameRate")}function rC(e,t){if("number"!=typeof e||Number.isNaN(e)||!(e>=1)){var r=e;if(!(null!=r&&r.min||null!=r&&r.max||null!=r&&r.exact||null!=r&&r.ideal))throw new cA(aA.INVALID_PARAMS,"".concat(t," is not a valid ConstrainULong"))}}function nC(e){var t,r=qT(e);try{for(r.s();!(t=r.n()).done;){var n=t.value;Vw(null==n?void 0:n.maxKbps,"maxKbps"),rC(null==n?void 0:n.width,"width"),rC(null==n?void 0:n.height,"height"),rC(null==n?void 0:n.frameRate,"frameRate")}}catch(i){r.e(i)}finally{r.f()}}var iC={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?mm(n).call(n,1):n);return Os?Im(i).call(i,Os(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}(iC);var oC,aC=iC.exports,sC=Us("Array").keys,cC=vn,uC=Ye,dC=ae,lC=sC,hC=Array.prototype,fC={DOMTokenList:!0,NodeList:!0},pC=function(e){var t=e.keys;return e===hC||dC(hC,e)&&t===hC.keys||uC(fC,cC(e))?lC:t},vC="@byted/ve-rtc",_C="@byted/ve-rtc-cache-size",mC=function(){function e(){Kd(this,e),od(this,"storeKey",void 0),od(this,"logLevel",void 0),od(this,"LogfileSize",void 0),od(this,"db",void 0),od(this,"logId",void 0),od(this,"cacheLog",void 0),od(this,"cachedSize",void 0),od(this,"preCacheTime",void 0),od(this,"timer",void 0),od(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 zd(e,[{key:"_createStore",value:function(){var e=this;if(!aw()){var t=indexedDB.open("@byted/ve-rtc");t.onupgradeneeded=function(){t.result.createObjectStore(vC);try{localStorage.removeItem(_C)}catch(nW){}},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(_C);if(t)this.cachedSize=+t;else ZI(this).call(this).then((function(t){e.cachedSize=e._getSize(t),e._setCachedSize()}))}catch(nW){}}},{key:"_setCachedSize",value:function(){try{localStorage.setItem(_C,"".concat(this.cachedSize))}catch(nW){}}},{key:"_getStore",value:function(e){if(this.db)return this.db.transaction(vC,e).objectStore(vC)}},{key:"set",value:function(e){var t=this;return new H_((function(r,n){if("none"===t.logLevel)return r();var i;if(e&&t.preCacheTime&&t.preCacheTime-Date.now()<1e3)return t.cacheLog+=Im(i="\n\n".concat(t.logId,": ")).call(i,e),t.logId++,t.timer||(t.timer=setTimeout((function(){t.set("")}),1e3-(t.preCacheTime-Date.now()))),r();clearTimeout(t.timer),t.timer=null;var o=t._getStore("readwrite");if(!o)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 a=o.get(t.storeKey);a.onsuccess=function(){try{var i,s,c,u,d,l=Im(i="".concat(a.result||"")).call(i,t.cacheLog),h=e?Im(s=Im(c="".concat(l?"\n\n":"")).call(c,t.logId,": ")).call(s,e):"";o.put(Im(u="".concat(l)).call(u,h),t.storeKey),e&&t.logId++,t.cacheLog="",t.cachedSize=(t.cachedSize||0)+t._getSize([Im(d="".concat(t.cacheLog)).call(d,h)]),t._setCachedSize(),t.preCacheTime=Date.now(),r()}catch(p){var f;if(!e)return n(p);t.cacheLog+=Im(f="\n\n".concat(t.logId,": ")).call(f,e),t.logId++,n(p)}},a.onerror=function(r){var i;if(!e)return n(r);t.cacheLog+=Im(i="\n\n".concat(t.logId,": ")).call(i,e),t.logId++,n(r)}}))}},{key:"get",value:function(e){var t=this;return new H_((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 H_((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 pC(this).call(this).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 H_((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 H_((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}(),gC=new mC,yC="[VERTC]",SC=["#0050b3","#0050b3","#0050b3","#0050b3","#0050b3"],EC=!aw()&&Wm(oC=window.location.search).call(oC,"_rtc_debug_"),bC=function(){function e(t,r,n){Kd(this,e),od(this,"_indent",void 0),od(this,"_module",void 0),od(this,"_id",void 0),this._module=t,this._indent=r}return zd(e,[{key:"print",value:function(e){for(var t,r,n,i,o,a,s,c=arguments.length,u=new Array(c>1?c-1:0),d=1;d<c;d++)u[d-1]=arguments[d];var l=u.shift();try{var h,f,p,v,_=Im(h=[]).call(h,u),m="".concat(l).replace(/\%o/gi,(function(){var e=_.shift();return hk(e)}));gC.set(Im(f=Im(p=Im(v="".concat(yC,"[").concat(this._module,".")).call(v,e,"] ")).call(p,m," ")).call(f,ck(_).call(_,(function(e){return hk(e)})).join(", ")))}catch(nW){}if(EC){for(var g="",y=0;y<this._indent;y++)g+=" ";(t=console).log.apply(t,Im(r=[Im(n=Im(i=Im(o=Im(a=Im(s="%c".concat(kC(),"-")).call(s,yC)).call(a,g,"[")).call(o,this._module,".")).call(i,e,"] ")).call(n,l),"color:".concat(SC[this._indent],";")]).call(r,u))}}}]),e}(),kC=function(){var e=new Date;return e.toTimeString().split(" ")[0]+":"+e.getMilliseconds()},TC=new bC("VERTC",0),IC=function(e){AI(r,e);var t=zI(r);function r(){return Kd(this,r),t.apply(this,arguments)}return zd(r,[{key:"safeEmit",value:function(e){var t=this.listenerCount(e);try{for(var n,i,o=arguments.length,a=new Array(o>1?o-1:0),s=1;s<o;s++)a[s-1]=arguments[s];return(n=II(kI(r.prototype),"emit",this)).call.apply(n,Im(i=[this,e]).call(i,a))}catch(nW){return TC.print("safeEmit","safeEmit() | event listener threw an error [event:%s]:%o",e,nW),console.error(nW),Boolean(t)}}}]),r}(iC.exports.EventEmitter),RC=D,AC=tr,wC=$,CC=JT,OC=Qt,DC=A,xC=mc,NC=V;Ar({target:"Reflect",stat:!0,forced:i((function(){var e=function(){},t=OC.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=DC.f(AC(t),r);if(!c){if(wC(o=xC(t)))return e(o,r,n,s);c=NC(0)}if(CC(c)){if(!1===c.writable||!wC(s))return!1;if(i=DC.f(s,r)){if(i.get||i.set||!1===i.writable)return!1;i.value=n,OC.f(s,r,i)}else OC.f(s,r,NC(0,n))}else{if(void 0===(a=c.set))return!1;RC(a,s,n)}return!0}});var PC=ee.Reflect.set,MC={};!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=mm(Array.prototype).call(arguments,1);t.length;){var n=t.shift();if(n){if("object"!==xl(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 Im([]).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)}(MC);var LC={},UC={},VC={},FC=MC;function BC(e){for(var t=e.length;--t>=0;)e[t]=0}var jC=256,GC=286,HC=30,zC=15,KC=[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],XC=[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],qC=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],WC=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],YC=new Array(576);BC(YC);var QC=new Array(60);BC(QC);var JC=new Array(512);BC(JC);var ZC=new Array(256);BC(ZC);var $C=new Array(29);BC($C);var eO,tO,rO,nO=new Array(HC);function iO(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 oO(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function aO(e){return e<256?JC[e]:JC[256+(e>>>7)]}function sO(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function cO(e,t,r){e.bi_valid>16-r?(e.bi_buf|=t<<e.bi_valid&65535,sO(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 uO(e,t,r){cO(e,r[2*t],r[2*t+1])}function dO(e,t){var r=0;do{r|=1&e,e>>>=1,r<<=1}while(--t>0);return r>>>1}function lO(e,t,r){var n,i,o=new Array(16),a=0;for(n=1;n<=zC;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]=dO(o[s]++,s))}}function hO(e){var t;for(t=0;t<GC;t++)e.dyn_ltree[2*t]=0;for(t=0;t<HC;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 fO(e){e.bi_valid>8?sO(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 pO(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 vO(e,t,r){for(var n=e.heap[r],i=r<<1;i<=e.heap_len&&(i<e.heap_len&&pO(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!pO(t,n,e.heap[i],e.depth));)e.heap[r]=e.heap[i],r=i,i<<=1;e.heap[r]=n}function _O(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?uO(e,i,t):(uO(e,(o=ZC[i])+jC+1,t),0!==(a=KC[o])&&cO(e,i-=$C[o],a),uO(e,o=aO(--n),r),0!==(a=XC[o])&&cO(e,n-=nO[o],a))}while(s<e.last_lit);uO(e,256,t)}function mO(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--)vO(e,o,r);i=c;do{r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],vO(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++,vO(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<=zC;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),lO(o,u,e.bl_count)}function gO(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 yO(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{uO(e,i,e.bl_tree)}while(0!=--s);else 0!==i?(i!==o&&(uO(e,i,e.bl_tree),s--),uO(e,16,e.bl_tree),cO(e,s-3,2)):s<=10?(uO(e,17,e.bl_tree),cO(e,s-3,3)):(uO(e,18,e.bl_tree),cO(e,s-11,7));s=0,o=i,0===a?(c=138,u=3):i===a?(c=6,u=3):(c=7,u=4)}}BC(nO);var SO=!1;function EO(e,t,r,n){cO(e,0+(n?1:0),3),function(e,t,r,n){fO(e),n&&(sO(e,r),sO(e,~r)),FC.arraySet(e.pending_buf,e.window,t,r,e.pending),e.pending+=r}(e,t,r,!0)}VC._tr_init=function(e){SO||(!function(){var e,t,r,n,i,o=new Array(16);for(r=0,n=0;n<28;n++)for($C[n]=r,e=0;e<1<<KC[n];e++)ZC[r++]=n;for(ZC[r-1]=n,i=0,n=0;n<16;n++)for(nO[n]=i,e=0;e<1<<XC[n];e++)JC[i++]=n;for(i>>=7;n<HC;n++)for(nO[n]=i<<7,e=0;e<1<<XC[n]-7;e++)JC[256+i++]=n;for(t=0;t<=zC;t++)o[t]=0;for(e=0;e<=143;)YC[2*e+1]=8,e++,o[8]++;for(;e<=255;)YC[2*e+1]=9,e++,o[9]++;for(;e<=279;)YC[2*e+1]=7,e++,o[7]++;for(;e<=287;)YC[2*e+1]=8,e++,o[8]++;for(lO(YC,287,o),e=0;e<HC;e++)QC[2*e+1]=5,QC[2*e]=dO(e,5);eO=new iO(YC,KC,257,GC,zC),tO=new iO(QC,XC,0,HC,zC),rO=new iO(new Array(0),qC,0,19,7)}(),SO=!0),e.l_desc=new oO(e.dyn_ltree,eO),e.d_desc=new oO(e.dyn_dtree,tO),e.bl_desc=new oO(e.bl_tree,rO),e.bi_buf=0,e.bi_valid=0,hO(e)},VC._tr_stored_block=EO,VC._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<jC;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0}(e)),mO(e,e.l_desc),mO(e,e.d_desc),a=function(e){var t;for(gO(e,e.dyn_ltree,e.l_desc.max_code),gO(e,e.dyn_dtree,e.d_desc.max_code),mO(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*WC[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?EO(e,t,r,n):4===e.strategy||o===i?(cO(e,2+(n?1:0),3),_O(e,YC,QC)):(cO(e,4+(n?1:0),3),function(e,t,r,n){var i;for(cO(e,t-257,5),cO(e,r-1,5),cO(e,n-4,4),i=0;i<n;i++)cO(e,e.bl_tree[2*WC[i]+1],3);yO(e,e.dyn_ltree,t-1),yO(e,e.dyn_dtree,r-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),_O(e,e.dyn_ltree,e.dyn_dtree)),hO(e),n&&fO(e)},VC._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*(ZC[r]+jC+1)]++,e.dyn_dtree[2*aO(t)]++),e.last_lit===e.lit_bufsize-1},VC._tr_align=function(e){cO(e,2,3),uO(e,256,YC),function(e){16===e.bi_valid?(sO(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 bO=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 kO=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 TO,IO=function(e,t,r,n){var i=kO,o=n+r;e^=-1;for(var a=n;a<o;a++)e=e>>>8^i[255&(e^t[a])];return-1^e},RO={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"},AO=MC,wO=VC,CO=bO,OO=IO,DO=RO,xO=-2,NO=258,PO=262,MO=103,LO=113,UO=666;function VO(e,t){return e.msg=DO[t],t}function FO(e){return(e<<1)-(e>4?9:0)}function BO(e){for(var t=e.length;--t>=0;)e[t]=0}function jO(e){var t=e.state,r=t.pending;r>e.avail_out&&(r=e.avail_out),0!==r&&(AO.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 GO(e,t){wO._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,jO(e.strm)}function HO(e,t){e.pending_buf[e.pending++]=t}function zO(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function KO(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-PO?e.strstart-(e.w_size-PO):0,u=e.window,d=e.w_mask,l=e.prev,h=e.strstart+NO,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=NO-(h-o),o=h-NO,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 XO(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-PO)){AO.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,AO.arraySet(s,a.input,a.next_in,d,c),1===a.state.wrap?a.adler=CO(a.adler,s,d,c):2===a.state.wrap&&(a.adler=OO(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<PO&&0!==e.strm.avail_in)}function qO(e,t){for(var r,n;;){if(e.lookahead<PO){if(XO(e),e.lookahead<PO&&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-PO&&(e.match_length=KO(e,r)),e.match_length>=3)if(n=wO._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=wO._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(n&&(GO(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,4===t?(GO(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(GO(e,!1),0===e.strm.avail_out)?1:2}function WO(e,t){for(var r,n,i;;){if(e.lookahead<PO){if(XO(e),e.lookahead<PO&&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-PO&&(e.match_length=KO(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=wO._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&&(GO(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if((n=wO._tr_tally(e,0,e.window[e.strstart-1]))&&GO(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=wO._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,4===t?(GO(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(GO(e,!1),0===e.strm.avail_out)?1:2}function YO(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 QO(){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 AO.Buf16(1146),this.dyn_dtree=new AO.Buf16(122),this.bl_tree=new AO.Buf16(78),BO(this.dyn_ltree),BO(this.dyn_dtree),BO(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new AO.Buf16(16),this.heap=new AO.Buf16(573),BO(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new AO.Buf16(573),BO(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 JO(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:LO,e.adler=2===t.wrap?0:1,t.last_flush=0,wO._tr_init(t),0):VO(e,xO)}function ZO(e){var t,r=JO(e);return 0===r&&((t=e.state).window_size=2*t.w_size,BO(t.head),t.max_lazy_match=TO[t.level].max_lazy,t.good_match=TO[t.level].good_length,t.nice_match=TO[t.level].nice_length,t.max_chain_length=TO[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 $O(e,t,r,n,i,o){if(!e)return xO;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 VO(e,xO);8===n&&(n=9);var s=new QO;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 AO.Buf8(2*s.w_size),s.head=new AO.Buf16(s.hash_size),s.prev=new AO.Buf16(s.w_size),s.lit_bufsize=1<<i+6,s.pending_buf_size=4*s.lit_bufsize,s.pending_buf=new AO.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,ZO(e)}TO=[new YO(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(XO(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,GO(e,!1),0===e.strm.avail_out))return 1;if(e.strstart-e.block_start>=e.w_size-PO&&(GO(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(GO(e,!0),0===e.strm.avail_out?3:4):(e.strstart>e.block_start&&(GO(e,!1),e.strm.avail_out),1)})),new YO(4,4,8,4,qO),new YO(4,5,16,8,qO),new YO(4,6,32,32,qO),new YO(4,4,16,16,WO),new YO(8,16,32,32,WO),new YO(8,16,128,128,WO),new YO(8,32,128,256,WO),new YO(32,128,258,1024,WO),new YO(32,258,258,4096,WO)],UC.deflateInit=function(e,t){return $O(e,t,8,15,8,0)},UC.deflateInit2=$O,UC.deflateReset=ZO,UC.deflateResetKeep=JO,UC.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?xO:(e.state.gzhead=t,0):xO},UC.deflate=function(e,t){var r,n,i,o;if(!e||!e.state||t>5||t<0)return e?VO(e,xO):xO;if(n=e.state,!e.output||!e.input&&0!==e.avail_in||n.status===UO&&4!==t)return VO(e,0===e.avail_out?-5:xO);if(n.strm=e,r=n.last_flush,n.last_flush=t,42===n.status)if(2===n.wrap)e.adler=0,HO(n,31),HO(n,139),HO(n,8),n.gzhead?(HO(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)),HO(n,255&n.gzhead.time),HO(n,n.gzhead.time>>8&255),HO(n,n.gzhead.time>>16&255),HO(n,n.gzhead.time>>24&255),HO(n,9===n.level?2:n.strategy>=2||n.level<2?4:0),HO(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(HO(n,255&n.gzhead.extra.length),HO(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=OO(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(HO(n,0),HO(n,0),HO(n,0),HO(n,0),HO(n,0),HO(n,9===n.level?2:n.strategy>=2||n.level<2?4:0),HO(n,3),n.status=LO);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=LO,zO(n,a),0!==n.strstart&&(zO(n,e.adler>>>16),zO(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=OO(e.adler,n.pending_buf,n.pending-i,i)),jO(e),i=n.pending,n.pending!==n.pending_buf_size));)HO(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(e.adler=OO(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=OO(e.adler,n.pending_buf,n.pending-i,i)),jO(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,HO(n,o)}while(0!==o);n.gzhead.hcrc&&n.pending>i&&(e.adler=OO(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=OO(e.adler,n.pending_buf,n.pending-i,i)),jO(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,HO(n,o)}while(0!==o);n.gzhead.hcrc&&n.pending>i&&(e.adler=OO(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.status=MO)}else n.status=MO;if(n.status===MO&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&jO(e),n.pending+2<=n.pending_buf_size&&(HO(n,255&e.adler),HO(n,e.adler>>8&255),e.adler=0,n.status=LO)):n.status=LO),0!==n.pending){if(jO(e),0===e.avail_out)return n.last_flush=-1,0}else if(0===e.avail_in&&FO(t)<=FO(r)&&4!==t)return VO(e,-5);if(n.status===UO&&0!==e.avail_in)return VO(e,-5);if(0!==e.avail_in||0!==n.lookahead||0!==t&&n.status!==UO){var s=2===n.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(XO(e),0===e.lookahead)){if(0===t)return 1;break}if(e.match_length=0,r=wO._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(GO(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(GO(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(GO(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<=NO){if(XO(e),e.lookahead<=NO&&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+NO;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=NO-(o-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(r=wO._tr_tally(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=wO._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(GO(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(GO(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(GO(e,!1),0===e.strm.avail_out)?1:2}(n,t):TO[n.level].func(n,t);if(3!==s&&4!==s||(n.status=UO),1===s||3===s)return 0===e.avail_out&&(n.last_flush=-1),0;if(2===s&&(1===t?wO._tr_align(n):5!==t&&(wO._tr_stored_block(n,0,0,!1),3===t&&(BO(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),jO(e),0===e.avail_out))return n.last_flush=-1,0}return 4!==t?0:n.wrap<=0?1:(2===n.wrap?(HO(n,255&e.adler),HO(n,e.adler>>8&255),HO(n,e.adler>>16&255),HO(n,e.adler>>24&255),HO(n,255&e.total_in),HO(n,e.total_in>>8&255),HO(n,e.total_in>>16&255),HO(n,e.total_in>>24&255)):(zO(n,e.adler>>>16),zO(n,65535&e.adler)),jO(e),n.wrap>0&&(n.wrap=-n.wrap),0!==n.pending?0:1)},UC.deflateEnd=function(e){var t;return e&&e.state?42!==(t=e.state.status)&&69!==t&&73!==t&&91!==t&&t!==MO&&t!==LO&&t!==UO?VO(e,xO):(e.state=null,t===LO?VO(e,-3):0):xO},UC.deflateSetDictionary=function(e,t){var r,n,i,o,a,s,c,u,d=t.length;if(!e||!e.state)return xO;if(2===(o=(r=e.state).wrap)||1===o&&42!==r.status||r.lookahead)return xO;for(1===o&&(e.adler=CO(e.adler,t,d,0)),r.wrap=0,d>=r.w_size&&(0===o&&(BO(r.head),r.strstart=0,r.block_start=0,r.insert=0),u=new AO.Buf8(r.w_size),AO.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,XO(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,XO(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},UC.deflateInfo="pako deflate (from Nodeca project)";var eD={},tD=MC,rD=!0,nD=!0;try{String.fromCharCode.apply(null,[0])}catch(iW){rD=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(iW){nD=!1}for(var iD=new tD.Buf8(256),oD=0;oD<256;oD++)iD[oD]=oD>=252?6:oD>=248?5:oD>=240?4:oD>=224?3:oD>=192?2:1;function aD(e,t){if(t<65534&&(e.subarray&&nD||!e.subarray&&rD))return String.fromCharCode.apply(null,tD.shrinkBuf(e,t));for(var r="",n=0;n<t;n++)r+=String.fromCharCode(e[n]);return r}iD[254]=iD[254]=1,eD.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 tD.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},eD.buf2binstring=function(e){return aD(e,e.length)},eD.binstring2buf=function(e){for(var t=new tD.Buf8(e.length),r=0,n=t.length;r<n;r++)t[r]=e.charCodeAt(r);return t},eD.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=iD[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 aD(s,n)},eD.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+iD[e[r]]>t?r:t};var sD=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},cD=UC,uD=MC,dD=eD,lD=RO,hD=sD,fD=Object.prototype.toString;function pD(e){if(!(this instanceof pD))return new pD(e);this.options=uD.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 hD,this.strm.avail_out=0;var r=cD.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(0!==r)throw new Error(lD[r]);if(t.header&&cD.deflateSetHeader(this.strm,t.header),t.dictionary){var n;if(n="string"==typeof t.dictionary?dD.string2buf(t.dictionary):"[object ArrayBuffer]"===fD.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,0!==(r=cD.deflateSetDictionary(this.strm,n)))throw new Error(lD[r]);this._dict_set=!0}}function vD(e,t){var r=new pD(t);if(r.push(e,!0),r.err)throw r.msg||lD[r.err];return r.result}pD.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=dD.string2buf(e):"[object ArrayBuffer]"===fD.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 uD.Buf8(o),i.next_out=0,i.avail_out=o),1!==(r=cD.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(dD.buf2binstring(uD.shrinkBuf(i.output,i.next_out))):this.onData(uD.shrinkBuf(i.output,i.next_out)))}while((i.avail_in>0||0===i.avail_out)&&1!==r);return 4===n?(r=cD.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,0===r):2!==n||(this.onEnd(0),i.avail_out=0,!0)},pD.prototype.onData=function(e){this.chunks.push(e)},pD.prototype.onEnd=function(e){0===e&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=uD.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},LC.Deflate=pD,LC.deflate=vD,LC.deflateRaw=function(e,t){return(t=t||{}).raw=!0,vD(e,t)},LC.gzip=function(e,t){return(t=t||{}).gzip=!0,vD(e,t)};var _D={},mD=tr,gD=D,yD=Ye,SD=ae,ED=function(){var e=mD(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},bD=RegExp.prototype,kD=ae,TD=function(e){var t=e.flags;return void 0!==t||"flags"in bD||yD(e,"flags")||!SD(bD,e)?t:gD(ED,e)},ID=RegExp.prototype,RD=function(e){return e===ID||kD(ID,e)?TD(e):e.flags},AD={},wD=MC,CD=15,OD=[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],DD=[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],xD=[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],ND=[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],PD=MC,MD=bO,LD=IO,UD=function(e,t){var r,n,i,o,a,s,c,u,d,l,h,f,p,v,_,m,g,y,S,E,b,k,T,I,R;r=e.state,n=e.next_in,I=e.input,i=n+(e.avail_in-5),o=e.next_out,R=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,g=(1<<r.distbits)-1;e:do{p<15&&(f+=I[n++]<<p,p+=8,f+=I[n++]<<p,p+=8),y=v[f&m];t:for(;;){if(f>>>=S=y>>>24,p-=S,0===(S=y>>>16&255))R[o++]=65535&y;else{if(!(16&S)){if(0==(64&S)){y=v[(65535&y)+(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}E=65535&y,(S&=15)&&(p<S&&(f+=I[n++]<<p,p+=8),E+=f&(1<<S)-1,f>>>=S,p-=S),p<15&&(f+=I[n++]<<p,p+=8,f+=I[n++]<<p,p+=8),y=_[f&g];r:for(;;){if(f>>>=S=y>>>24,p-=S,!(16&(S=y>>>16&255))){if(0==(64&S)){y=_[(65535&y)+(f&(1<<S)-1)];continue r}e.msg="invalid distance code",r.mode=30;break e}if(b=65535&y,p<(S&=15)&&(f+=I[n++]<<p,(p+=8)<S&&(f+=I[n++]<<p,p+=8)),(b+=f&(1<<S)-1)>c){e.msg="invalid distance too far back",r.mode=30;break e}if(f>>>=S,p-=S,b>(S=o-a)){if((S=b-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<E){E-=S;do{R[o++]=h[k++]}while(--S);k=o-b,T=R}}else if(l<S){if(k+=u+l-S,(S-=l)<E){E-=S;do{R[o++]=h[k++]}while(--S);if(k=0,l<E){E-=S=l;do{R[o++]=h[k++]}while(--S);k=o-b,T=R}}}else if(k+=l-S,S<E){E-=S;do{R[o++]=h[k++]}while(--S);k=o-b,T=R}for(;E>2;)R[o++]=T[k++],R[o++]=T[k++],R[o++]=T[k++],E-=3;E&&(R[o++]=T[k++],E>1&&(R[o++]=T[k++]))}else{k=o-b;do{R[o++]=R[k++],R[o++]=R[k++],R[o++]=R[k++],E-=3}while(E>2);E&&(R[o++]=R[k++],E>1&&(R[o++]=R[k++]))}break}}break}}while(n<i&&o<s);n-=E=p>>3,f&=(1<<(p-=E<<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},VD=function(e,t,r,n,i,o,a,s){var c,u,d,l,h,f,p,v,_,m=s.bits,g=0,y=0,S=0,E=0,b=0,k=0,T=0,I=0,R=0,A=0,w=null,C=0,O=new wD.Buf16(16),D=new wD.Buf16(16),x=null,N=0;for(g=0;g<=CD;g++)O[g]=0;for(y=0;y<n;y++)O[t[r+y]]++;for(b=m,E=CD;E>=1&&0===O[E];E--);if(b>E&&(b=E),0===E)return i[o++]=20971520,i[o++]=20971520,s.bits=1,0;for(S=1;S<E&&0===O[S];S++);for(b<S&&(b=S),I=1,g=1;g<=CD;g++)if(I<<=1,(I-=O[g])<0)return-1;if(I>0&&(0===e||1!==E))return-1;for(D[1]=0,g=1;g<CD;g++)D[g+1]=D[g]+O[g];for(y=0;y<n;y++)0!==t[r+y]&&(a[D[t[r+y]]++]=y);if(0===e?(w=x=a,f=19):1===e?(w=OD,C-=257,x=DD,N-=257,f=256):(w=xD,x=ND,f=-1),A=0,y=0,g=S,h=o,k=b,T=0,d=-1,l=(R=1<<b)-1,1===e&&R>852||2===e&&R>592)return 1;for(;;){p=g-T,a[y]<f?(v=0,_=a[y]):a[y]>f?(v=x[N+a[y]],_=w[C+a[y]]):(v=96,_=0),c=1<<g-T,S=u=1<<k;do{i[h+(A>>T)+(u-=c)]=p<<24|v<<16|_|0}while(0!==u);for(c=1<<g-1;A&c;)c>>=1;if(0!==c?(A&=c-1,A+=c):A=0,y++,0==--O[g]){if(g===E)break;g=t[r+a[y]]}if(g>b&&(A&l)!==d){for(0===T&&(T=b),h+=S,I=1<<(k=g-T);k+T<E&&!((I-=O[k+T])<=0);)k++,I<<=1;if(R+=1<<k,1===e&&R>852||2===e&&R>592)return 1;i[d=A&l]=b<<24|k<<16|h-o|0}}return 0!==A&&(i[h+A]=g-T<<24|64<<16|0),s.bits=b,0},FD=-2,BD=12,jD=30;function GD(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function HD(){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 PD.Buf16(320),this.work=new PD.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function zD(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 PD.Buf32(852),t.distcode=t.distdyn=new PD.Buf32(592),t.sane=1,t.back=-1,0):FD}function KD(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,zD(e)):FD}function XD(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)?FD:(null!==n.window&&n.wbits!==t&&(n.window=null),n.wrap=r,n.wbits=t,KD(e))):FD}function qD(e,t){var r,n;return e?(n=new HD,e.state=n,n.window=null,0!==(r=XD(e,t))&&(e.state=null),r):FD}var WD,YD,QD=!0;function JD(e){if(QD){var t;for(WD=new PD.Buf32(512),YD=new PD.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(VD(1,e.lens,0,288,WD,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;VD(2,e.lens,0,32,YD,0,e.work,{bits:5}),QD=!1}e.lencode=WD,e.lenbits=9,e.distcode=YD,e.distbits=5}function ZD(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 PD.Buf8(o.wsize)),n>=o.wsize?(PD.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),PD.arraySet(o.window,t,r-n,i,o.wnext),(n-=i)?(PD.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}AD.inflateReset=KD,AD.inflateReset2=XD,AD.inflateResetKeep=zD,AD.inflateInit=function(e){return qD(e,15)},AD.inflateInit2=qD,AD.inflate=function(e,t){var r,n,i,o,a,s,c,u,d,l,h,f,p,v,_,m,g,y,S,E,b,k,T,I,R=0,A=new PD.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 FD;(r=e.state).mode===BD&&(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,A[0]=255&u,A[1]=u>>>8&255,r.check=LD(r.check,A,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=jD;break}if(8!=(15&u)){e.msg="unknown compression method",r.mode=jD;break}if(d-=4,b=8+(15&(u>>>=4)),0===r.wbits)r.wbits=b;else if(b>r.wbits){e.msg="invalid window size",r.mode=jD;break}r.dmax=1<<b,e.adler=r.check=1,r.mode=512&u?10:BD,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&RD(r))){e.msg="unknown compression method",r.mode=jD;break}if(57344&RD(r)){e.msg="unknown header flags set",r.mode=jD;break}r.head&&(r.head.text=u>>8&1),512&RD(r)&&(A[0]=255&u,A[1]=u>>>8&255,r.check=LD(r.check,A,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&RD(r)&&(A[0]=255&u,A[1]=u>>>8&255,A[2]=u>>>16&255,A[3]=u>>>24&255,r.check=LD(r.check,A,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&RD(r)&&(A[0]=255&u,A[1]=u>>>8&255,r.check=LD(r.check,A,2,0)),u=0,d=0,r.mode=5;case 5:if(1024&RD(r)){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&RD(r)&&(A[0]=255&u,A[1]=u>>>8&255,r.check=LD(r.check,A,2,0)),u=0,d=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&RD(r)&&((f=r.length)>s&&(f=s),f&&(r.head&&(b=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),PD.arraySet(r.head.extra,n,o,f,b)),512&RD(r)&&(r.check=LD(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&RD(r)){if(0===s)break e;f=0;do{b=n[o+f++],r.head&&b&&r.length<65536&&(r.head.name+=String.fromCharCode(b))}while(b&&f<s);if(512&RD(r)&&(r.check=LD(r.check,n,f,o)),s-=f,o+=f,b)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=8;case 8:if(4096&RD(r)){if(0===s)break e;f=0;do{b=n[o+f++],r.head&&b&&r.length<65536&&(r.head.comment+=String.fromCharCode(b))}while(b&&f<s);if(512&RD(r)&&(r.check=LD(r.check,n,f,o)),s-=f,o+=f,b)break e}else r.head&&(r.head.comment=null);r.mode=9;case 9:if(512&RD(r)){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=jD;break}u=0,d=0}r.head&&(r.head.hcrc=RD(r)>>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=BD;break;case 10:for(;d<32;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}e.adler=r.check=GD(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=BD;case BD: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(JD(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=jD}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=jD;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;PD.arraySet(i,n,o,f,a),s-=f,o+=f,c-=f,a+=f,r.length-=f;break}r.mode=BD;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=jD;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=VD(0,r.lens,0,19,r.lencode,0,r.work,T),r.lenbits=T.bits,k){e.msg="invalid code lengths set",r.mode=jD;break}r.have=0,r.mode=19;case 19:for(;r.have<r.nlen+r.ndist;){for(;m=(R=r.lencode[u&(1<<r.lenbits)-1])>>>16&255,g=65535&R,!((_=R>>>24)<=d);){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(g<16)u>>>=_,d-=_,r.lens[r.have++]=g;else{if(16===g){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=jD;break}b=r.lens[r.have-1],f=3+(3&u),u>>>=2,d-=2}else if(17===g){for(I=_+3;d<I;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}d-=_,b=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-=_,b=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=jD;break}for(;f--;)r.lens[r.have++]=b}}if(r.mode===jD)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=jD;break}if(r.lenbits=9,T={bits:r.lenbits},k=VD(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=jD;break}if(r.distbits=6,r.distcode=r.distdyn,T={bits:r.distbits},k=VD(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=jD;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,UD(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===BD&&(r.back=-1);break}for(r.back=0;m=(R=r.lencode[u&(1<<r.lenbits)-1])>>>16&255,g=65535&R,!((_=R>>>24)<=d);){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(m&&0==(240&m)){for(y=_,S=m,E=g;m=(R=r.lencode[E+((u&(1<<y+S)-1)>>y)])>>>16&255,g=65535&R,!(y+(_=R>>>24)<=d);){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}u>>>=y,d-=y,r.back+=y}if(u>>>=_,d-=_,r.back+=_,r.length=g,0===m){r.mode=26;break}if(32&m){r.back=-1,r.mode=BD;break}if(64&m){e.msg="invalid literal/length code",r.mode=jD;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=(R=r.distcode[u&(1<<r.distbits)-1])>>>16&255,g=65535&R,!((_=R>>>24)<=d);){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(0==(240&m)){for(y=_,S=m,E=g;m=(R=r.distcode[E+((u&(1<<y+S)-1)>>y)])>>>16&255,g=65535&R,!(y+(_=R>>>24)<=d);){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}u>>>=y,d-=y,r.back+=y}if(u>>>=_,d-=_,r.back+=_,64&m){e.msg="invalid distance code",r.mode=jD;break}r.offset=g,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=jD;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=jD;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=RD(r)?LD(r.check,i,h,a-h):MD(r.check,i,h,a-h)),h=c,(RD(r)?u:GD(u))!==r.check){e.msg="incorrect data check",r.mode=jD;break}u=0,d=0}r.mode=28;case 28:if(r.wrap&&RD(r)){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=jD;break}u=0,d=0}r.mode=29;case 29:k=1;break e;case jD:k=-3;break e;case 31:return-4;default:return FD}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<jD&&(r.mode<27||4!==t))&&ZD(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=RD(r)?LD(r.check,i,h,e.next_out-h):MD(r.check,i,h,e.next_out-h)),e.data_type=r.bits+(r.last?64:0)+(r.mode===BD?128:0)+(20===r.mode||15===r.mode?256:0),(0===l&&0===h||4===t)&&0===k&&(k=-5),k},AD.inflateEnd=function(e){if(!e||!e.state)return FD;var t=e.state;return t.window&&(t.window=null),e.state=null,0},AD.inflateGetHeader=function(e,t){var r;return e&&e.state?0==(2&(r=e.state).wrap)?FD:(r.head=t,t.done=!1,0):FD},AD.inflateSetDictionary=function(e,t){var r,n=t.length;return e&&e.state?0!==(r=e.state).wrap&&11!==r.mode?FD:11===r.mode&&MD(1,t,n,0)!==r.check?-3:ZD(e,t,n,n)?(r.mode=31,-4):(r.havedict=1,0):FD},AD.inflateInfo="pako inflate (from Nodeca project)";var $D={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 ex=AD,tx=MC,rx=eD,nx=$D,ix=RO,ox=sD,ax=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},sx=Object.prototype.toString;function cx(e){if(!(this instanceof cx))return new cx(e);this.options=tx.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 ox,this.strm.avail_out=0;var r=ex.inflateInit2(this.strm,t.windowBits);if(r!==nx.Z_OK)throw new Error(ix[r]);if(this.header=new ax,ex.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=rx.string2buf(t.dictionary):"[object ArrayBuffer]"===sx.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(r=ex.inflateSetDictionary(this.strm,t.dictionary))!==nx.Z_OK))throw new Error(ix[r])}function ux(e,t){var r=new cx(t);if(r.push(e,!0),r.err)throw r.msg||ix[r.err];return r.result}cx.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?nx.Z_FINISH:nx.Z_NO_FLUSH,"string"==typeof e?s.input=rx.binstring2buf(e):"[object ArrayBuffer]"===sx.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 tx.Buf8(c),s.next_out=0,s.avail_out=c),(r=ex.inflate(s,nx.Z_NO_FLUSH))===nx.Z_NEED_DICT&&u&&(r=ex.inflateSetDictionary(this.strm,u)),r===nx.Z_BUF_ERROR&&!0===d&&(r=nx.Z_OK,d=!1),r!==nx.Z_STREAM_END&&r!==nx.Z_OK)return this.onEnd(r),this.ended=!0,!1;s.next_out&&(0!==s.avail_out&&r!==nx.Z_STREAM_END&&(0!==s.avail_in||n!==nx.Z_FINISH&&n!==nx.Z_SYNC_FLUSH)||("string"===this.options.to?(i=rx.utf8border(s.output,s.next_out),o=s.next_out-i,a=rx.buf2string(s.output,i),s.next_out=o,s.avail_out=c-o,o&&tx.arraySet(s.output,s.output,i,o,0),this.onData(a)):this.onData(tx.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!==nx.Z_STREAM_END);return r===nx.Z_STREAM_END&&(n=nx.Z_FINISH),n===nx.Z_FINISH?(r=ex.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===nx.Z_OK):n!==nx.Z_SYNC_FLUSH||(this.onEnd(nx.Z_OK),s.avail_out=0,!0)},cx.prototype.onData=function(e){this.chunks.push(e)},cx.prototype.onEnd=function(e){e===nx.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=tx.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},_D.Inflate=cx,_D.inflate=ux,_D.inflateRaw=function(e,t){return(t=t||{}).raw=!0,ux(e,t)},_D.ungzip=ux;var dx={};(0,MC.assign)(dx,LC,_D,$D);var lx=dx,hx=function(e){return e.RTC="rtc",e}(hx||{}),fx=function(e){return e.W_5="5",e}(fx||{}),px=function(e){return e.IOS="ios",e.ANDROID="android",e.WEB="web",e.WINDOWS="windows",e.MAC="mac",e.LINUX="linux",e}(px||{}),vx=function(e){return e.REQUEST="request",e.RESPONSE="response",e}(vx||{}),_x=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}(_x||{}),mx=function(e){return e.WEBSOCKET="websocket",e.NETWORKCHANGED="networkChanged",e.PEERCONNECTION="peerconnection",e}(mx||{}),gx=function(e){return e.WEBSOCKET_RECONNECTED="websocket reconnected",e.PEERCONNECTION_RECONNECTED="peerconnection reconnected",e}(gx||{}),yx=function(e){return e.WEBSOCKET="websocket",e.NETWORKCHANGED="networkChanged",e.PEERCONNECTION="peerconnection",e}(yx||{}),Sx=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}(Sx||{}),Ex=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}(Ex||{}),bx=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}(bx||{}),kx=function(e){return e.UP="up",e.DOWN="down",e.DIRECT="direct",e}(kx||{}),Tx=function(e){return e.UP="up",e.DOWN="down",e.PRE="pre",e}(Tx||{}),Ix=function(e){return e.UP="up",e.DOWN="down",e.PRE="pre",e}(Ix||{}),Rx=function(e){return e.W_0="0",e.W_1="1",e}(Rx||{}),Ax=function(e){return e.UP="up",e.DOWN="down",e}(Ax||{}),wx=function(e){return e.ANSWER="answer",e.INCRANSWER="incranswer",e}(wx||{}),Cx=function(e){return e.UP="up",e.DOWN="down",e}(Cx||{}),Ox=function(e){return e.SUCCESS="success",e.FAIL="fail",e}(Ox||{}),Dx=function(e){return e.W_0="0",e.W_1="1",e}(Dx||{}),xx=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}(xx||{}),Nx=function(e){return e.SUCCESS="success",e.FAIL="fail",e.IGNORE="ignore",e}(Nx||{}),Px=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}(Px||{}),Mx=function(e){return e.PLAYOUT_DEVICE_SWITCH="playout_device_switch",e.RECORD_DEVICE_SWITCH="record_device_switch",e.UNKNOWN="unknown",e}(Mx||{}),Lx=function(e){return e.BEGIN_SEND="begin_send",e.SENT_END="sent_end",e.BEGIN_RECV="begin_recv",e.RECV_END="recv_end",e}(Lx||{}),Ux=function(e){return e.AUDIO="audio",e.VIDEO="video",e.SCREEN_VIDEO="screen_video",e.SCREEN_AUDIO="screen_audio",e}(Ux||{}),Vx=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}(Vx||{}),Fx=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}(Fx||{}),Bx=function(e){return e.BEGIN="begin",e.END="end",e}(Bx||{}),jx=function(e){return e.BEGIN="begin",e.END="end",e}(jx||{}),Gx=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}(Gx||{}),Hx=function(e){return e.P2P="p2p",e.P2P_OUTSIDE_ROOM="p2p_outside_room",e.P2SERVER="p2server",e}(Hx||{}),zx=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}(zx||{}),Kx=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}(Kx||{}),Xx=function(){function e(t){Kd(this,e),od(this,"_event_key",void 0),od(this,"_device_id",void 0),od(this,"_rtc_app_id",void 0),od(this,"_product_line",void 0),od(this,"_report_version",void 0),od(this,"_os",void 0),od(this,"_rtc_sdk_version",void 0),od(this,"_rtc_timestamp",void 0),od(this,"_rtc_sdk_git_commit",void 0),od(this,"_report_id",void 0),od(this,"_connection_id",void 0),od(this,"_rtc_sid",void 0),od(this,"_engine_session_id",void 0),od(this,"_rtc_business_id",void 0),od(this,"_app_state",void 0),od(this,"_project_key",void 0),od(this,"_network_type",void 0),od(this,"_app_version",void 0),od(this,"_aid",void 0),od(this,"_device_model",void 0),od(this,"_device_brand",void 0),od(this,"_common_extra_info",void 0),od(this,"_had_selected_p2p",void 0),od(this,"_rtc_env_type",void 0),od(this,"_room_id",void 0),od(this,"_user_id",void 0),od(this,"_rtc_session_id",void 0),od(this,"_user_agent",void 0),od(this,"_auto_play_policy",void 0),od(this,"_platform",void 0),od(this,"_product",void 0),od(this,"_log_cache_key",void 0),od(this,"_overSea","0"),this.monitor=t}return zd(e,[{key:"setStats",value:function(e){var t=this;an(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_state",get:function(){return this._app_state}},{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}(),qx=function(e){AI(r,e);var t=zI(r);function r(){var e;return Kd(this,r),od(YT(e=t.call(this)),"report_id",void 0),od(YT(e),"report_common",void 0),od(YT(e),"modify_ids",void 0),od(YT(e),"dataBuffer",void 0),od(YT(e),"posting",void 0),od(YT(e),"sucSendTimer",void 0),od(YT(e),"preSucTime",void 0),od(YT(e),"errSendTimer",void 0),od(YT(e),"errSendDelay",void 0),od(YT(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 Xx(YT(e)),aw()||window.addEventListener("beforeunload",(function(){clearTimeout(e.errSendTimer),clearTimeout(e.sucSendTimer),e.send(null,!0)})),e}return zd(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=Im(e).call(e,this.dataBuffer)}},{key:"send",value:function(e,t){var r,n,i=this;if(e||this.dataBuffer.length){var o={data:e||rk(r=this.dataBuffer).call(r,0,4e3),header:this.report_common,from:"web",os:"web",version:"1"},a=new XMLHttpRequest;a.timeout=1e4,a.onreadystatechange=function(){if(4===a.readyState){var r,n;if(e||(i.posting=!1),200===a.status||304===a.status)try{r=JSON.parse(a.responseText)}catch(nW){}if(r&&0===r.StatusCode){if(!e&&!t)!aw()&&Wm(n=location.search).call(n,"_rtc_autotest_")&&i.safeEmit("report_event",o),i.sucSend()}else e?i.send(e):(i.unshift(o.data),t?i.send():i.errSend())}};var s=mN.LOG_SERVER_URL;if(a.open("POST",s,!0),e||(this.posting=!0),!aw()&&Wm(n=location.search).call(n,"_rtc_debug_"))a.send(hk(o));else{var c=lx.gzip(hk(o));a.setRequestHeader("Content-Encoding","gzip"),a.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"),a.send(c)}}}},{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,g=t.aid,y=t.device_model,S=t.device_brand,E=t.common_extra_info,b=t.had_selected_p2p,k=t.rtc_env_type,T=t.user_agent,I=t.auto_play_policy,R=t.platform,A=t.product,w=t.log_cache_key,C=t.overSea;LE(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:g,device_model:y,device_brand:S,common_extra_info:E,had_selected_p2p:b,rtc_env_type:k,user_agent:T,auto_play_policy:I,platform:R,product:A,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_state=this.commonStats.app_state}},{key:"rtcSdkApiCall",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=sd(sd({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:hk(n)});n.streamId&&(i.stream_id=n.streamId),this.push(i)}},{key:"rtcSdkCallback",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=sd(sd({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:hk(n)});this.push(i)}},{key:"rtcGetConfig",value:function(e,t,r,n,i,o,a){var s=arguments.length>7&&void 0!==arguments[7]?arguments[7]:{},c=sd(sd({event_key:"rtc_get_config",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,elapse:r,host:n,type:i,config_id:o,enable_cloud_proxy:a},this.modify_ids),{},{common_extra_info:hk(s)});this.push(c)}},{key:"rtcReconnect",value:function(e,t,r,n){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},o=sd(sd({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:hk(i)});this.push(o)}},{key:"rtcReconnected",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=sd(sd({event_key:"rtc_reconnected",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,reconnect_type:t},this.modify_ids),{},{common_extra_info:hk(r)});this.push(n)}},{key:"rtcGetAccess",value:function(e,t,r,n,i,o){var a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:{},s=sd(sd({event_key:"rtc_get_access",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,elapse:r,type:n,host:i,connect_session_id:o},this.modify_ids),{},{common_extra_info:hk(a)});this.push(s)}},{key:"rtcPreIceState",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=sd(sd({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:hk(r)});this.push(n)}},{key:"rtcNodeChange",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=sd(sd({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:hk(n)});this.push(i)}},{key:"rtcSignalingMsgError",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=sd(sd({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:hk(n)});this.push(i)}},{key:"rtcSignaling",value:function(e,t,r,n,i,o,a){var s=arguments.length>7&&void 0!==arguments[7]?arguments[7]:{},c=sd(sd({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:i,stream_user_id:o,direction:a},this.modify_ids),{},{common_extra_info:hk(s)});this.push(c)}},{key:"rtcJoinRoom",value:function(e,t,r,n){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},o=sd(sd({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:hk(i)});this.push(o)}},{key:"rtcLeaveRoom",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=sd(sd({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:hk(n)});this.push(i)}},{key:"rtcBeginCreateOffer",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=sd(sd({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:hk(n)});this.push(i)}},{key:"rtcCreateOffer",value:function(e,t,r,n,i){var o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},a=sd(sd({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:i},this.modify_ids),{},{common_extra_info:hk(o)});this.push(a)}},{key:"rtcSetDescription",value:function(e,t,r,n,i,o,a){var s=arguments.length>7&&void 0!==arguments[7]?arguments[7]:{},c=sd(sd({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:i,stream_user_id:o,elapse:a},this.modify_ids),{},{common_extra_info:hk(s)});this.push(c)}},{key:"rtcRecvAnswer",value:function(e,t,r,n,i,o,a){var s=arguments.length>7&&void 0!==arguments[7]?arguments[7]:{},c=sd(sd({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:i,stream_id:o,stream_user_id:a},this.modify_ids),{},{common_extra_info:hk(s)});this.push(c)}},{key:"firstRemoteAudioRender",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=sd(sd({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:hk(r)});this.push(n)}},{key:"firstRemoteVideoRender",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=sd(sd({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:hk(r)});this.push(n)}},{key:"rtcPublishStat",value:function(e,t,r,n){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},o=sd(sd({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:hk(i)});this.push(o)}},{key:"rtcSubscribeStat",value:function(e,t,r,n){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},o=sd(sd({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:hk(i)});this.push(o)}},{key:"rtcAudioDevice",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=sd(sd({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:hk(n)});this.push(i)}},{key:"rtcMediaStatistics",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=sd(sd(sd(sd({event_key:"rtc_media_statistics",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{},{common_extra_info:hk(r)});this.push(n)}},{key:"rtcMessageStatistics",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=sd(sd({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:hk(n)});this.push(i)}},{key:"rtsMessageReport",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=sd(sd(sd({event_key:"rts_message",report_id:this.report_id++,rtc_timestamp:Date.now()},e),this.modify_ids),{},{common_extra_info:hk(t)});this.push(r)}},{key:"rtcError",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=sd(sd({event_key:"rtc_error",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,error_code:t},this.modify_ids),{},{common_extra_info:hk(r)});this.push(n)}},{key:"rtcInvokeStatus",value:function(e,t,r,n,i){var o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},a=sd(sd({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:i},this.modify_ids),{},{common_extra_info:hk(o),direction:o.direction});this.push(a)}},{key:"rtcFirstFrame",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=sd(sd(sd({event_key:"rtc_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),this.modify_ids),{},{common_extra_info:hk(t)});this.push(r)}},{key:"rtcMuteRemote",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=sd(sd({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:hk(r)});this.push(n)}},{key:"sdkInitEngine",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=sd(sd({event_key:"sdk_init_engine",report_id:this.report_id++,rtc_timestamp:Date.now(),start:e,type:t},this.modify_ids),{},{common_extra_info:hk(r)});this.push(n)}},{key:"joinRoom",value:function(e,t,r,n){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},o=sd(sd({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:hk(i)});this.push(o)}},{key:"p2pConnectionStatus",value:function(e,t,r,n,i){var o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},a=sd(sd({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:i},this.modify_ids),{},{common_extra_info:hk(o)});this.push(a)}},{key:"p2pConnectClosed",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=sd(sd({event_key:"p2p_connect_closed",report_id:this.report_id++,rtc_timestamp:Date.now(),p2p_selected:e},this.modify_ids),{},{common_extra_info:hk(t)});this.push(r)}},{key:"rtcDeviceError",value:function(e,t,r,n,i,o,a,s,c,u,d,l,h,f,p,v){var _=arguments.length>16&&void 0!==arguments[16]?arguments[16]:{},m=sd(sd({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:i,call_parameters:o,location:a,message:s,media_device_id:c,media_device_name:u,elapse:d,scenario:l,event_session_id:h,device_pid:f,device_vid:p,media_mode:v},this.modify_ids),{},{common_extra_info:hk(_)});this.push(m)}},{key:"rtcVideoDevice",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=sd(sd({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:hk(r)});this.push(n)}},{key:"rtcVideoCaptureEvent",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=sd(sd(sd({event_key:"rtc_video_capture_event",report_id:this.report_id++,rtc_timestamp:Date.now()},e),this.modify_ids),{},{common_extra_info:hk(t)});this.push(r)}},{key:"rtcEncodeFirstFrame",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=sd(sd(sd(sd({event_key:"rtc_encode_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{},{common_extra_info:hk(r)});this.push(n)}},{key:"rtcFirstFrameEncoded",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=sd(sd(sd(sd({event_key:"rtc_first_frame_encoded",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{},{common_extra_info:hk(r)});this.push(n)}},{key:"rtcSendFirstPacket",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=sd(sd(sd(sd({event_key:"rtc_send_first_packet",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{},{common_extra_info:hk(r)});this.push(n)}},{key:"rtcRecvFirstPacket",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=sd(sd(sd(sd({event_key:"rtc_recv_first_packet",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{},{common_extra_info:hk(r)});this.push(n)}},{key:"rtcRecvFirstFrame",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=sd(sd(sd(sd({event_key:"rtc_recv_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{},{common_extra_info:hk(r)});this.push(n)}},{key:"rtcDecodeFirstFrame",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=sd(sd(sd(sd({event_key:"rtc_decode_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{},{common_extra_info:hk(r)});this.push(n)}}]),r}(IC),Wx=new qx,Yx=new qx,Qx=new qx,Jx=Wx.commonStats,Zx=Yx.commonStats,$x=Qx.commonStats;function eN(e){Jx.setStats({app_state:e}),Zx.setStats({app_state:e}),$x.setStats({app_state:e})}!aw()&&(eN("active"),document.addEventListener("visibilitychange",(function(){"visible"===document.visibilityState?eN("active"):"hidden"===document.visibilityState&&eN("background")})));var tN={default:Wx,rtm:Yx,outsideRoom:Qx};function rN(){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&&Jx.setStats({room_id:i[1]}),tN[e].rtcSdkApiCall(n,0,hk(Tw(i)),s);var c=o.apply(this,i);return"function"==typeof(null==c?void 0:c.then)?c.then((function(t){return tN[e].rtcSdkCallback(n,0,hk(Tw([t||{}]))),t})).catch((function(t){throw tN[e].rtcSdkCallback(n,t.code,hk(t.message)),t})):(tN[e].rtcSdkCallback(n,0,hk(Tw([c||{}]))),c)}}}}function nN(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=e===Gd.onUserMessageReceivedOutsideRoom||e===Gd.onUserBinaryMessageReceivedOutsideRoom;(n?Yx:Wx).rtcSdkCallback(e,r,hk(t))}function iN(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?Yx:Wx).rtcInvokeStatus(hk(t),r,e,"",0)}var oN="BytePlus",aN="RTC_DEVICE_ID",sN="RTC_ACCESS_NODE",cN="RTC_ACCESS_URLS",uN="ENGINE_WEB_CONFIG",dN=function(){function e(){Kd(this,e)}return zd(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,hk(n)),!0}catch(i){return!1}}},{key:"delete",value:function(e){try{return localStorage.removeItem(e),!0}catch(t){return!1}}}]),e}(),lN=function(e){AI(r,e);var t=zI(r);function r(){return Kd(this,r),t.apply(this,arguments)}return zd(r,[{key:"getDeviceId",value:function(){if(aw())return"";var e=this.get(aN);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[Jx,Zx,$x].forEach((function(t){return t.setStats({device_id:e})})),this.set(aN,e),e}},{key:"getAccessNode",value:function(e){var t;return this.get(Im(t="".concat(sN,"_").concat(e,"-")).call(t,oN))}},{key:"setAccessNode",value:function(e,t,r){var n;return this.set(Im(n="".concat(sN,"_").concat(e,"-")).call(n,oN),t,1e3*r)}},{key:"clearAccessNode",value:function(e){var t;this.delete(Im(t="".concat(sN,"_").concat(e,"-")).call(t,oN))}},{key:"getAccessUrls",value:function(){return this.get("".concat(cN,"-").concat(oN))}},{key:"setAccessUrls",value:function(e){var t=ck(e).call(e,(function(e){var t,r=e.host,n=e.path;return Im(t="https://".concat(r)).call(t,n)}));return this.set("".concat(cN,"-").concat(oN),t)}},{key:"clearAccessUrls",value:function(){this.delete("".concat(cN,"-").concat(oN))}},{key:"getEngineWebConfig",value:function(e,t){var r,n,i,o=Im(r=Im(n="".concat(e,"_")).call(n,t,"_")).call(r,this.getDeviceId()),a=this.get(uN);return(null==a||null===(i=yb(a).call(a,(function(e){return e.key===o})))||void 0===i?void 0:i.config)||{}}},{key:"setEngineWebConfig",value:function(e,t,r){var n,i;if(r){var o=Im(n=Im(i="".concat(e,"_")).call(i,t,"_")).call(n,this.getDeviceId()),a=this.get(uN)||[];return(a=Gs(a).call(a,(function(e){return e.key!==o}))).push({key:o,config:r}),this.set(uN,mm(a).call(a,-5))}}}]),r}(dN),hN=new lN,fN="rtc-access.rtcplus.com,rtc-access-sg.rtcplus.com,rtc-access-va.rtcplus.com,rtc-access-fr.rtcplus.com".split(",");function pN(){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 vN="https://web-log-report.rtcplus.com/video/v1/webrtc_log/",_N="rtc.rtcplus.com".split(","),mN={VERSION:"4.51.0",ICE_CONFIG_REQUEST_URLS_INTERNAL:ck(fN).call(fN,pN),ICE_CONFIG_REQUEST_URLS:[],EXPECTED_ADDR:"",LOG_SERVER_URL:vN,CONFIG_REQUEST_DOMAINS:_N,DEVICE_ID:"",OVERSEA:!1,PLATFORM:"",PRODUCT:""};function gN(e,t){var r;if(Wx.rtcSdkApiCall("setParameter",0,Im(r="key: ".concat(e,", value: ")).call(r,t)),"VERSION"!==e){if("ICE_CONFIG_REQUEST_URLS"===e)return"string"==typeof t&&(t=[t]),void(mN.ICE_CONFIG_REQUEST_URLS=ck(t).call(t,pN));if("PLATFORM"!==e||"string"!=typeof t)if("PRODUCT"!==e||"string"!=typeof t)if("LOG_SERVER_URL"!==e||t!==bd.overseas)if("LOG_SERVER_URL"!==e||t!==bd.domestic)if("LOG_SERVER_URL"!==e||"string"!=typeof t){if("OVERSEA"===e)return Jx.setStats({overSea:t?"1":"0"}),void(mN.OVERSEA=t);"DEVICE_ID"===e&&hN.setDeviceId(t),mN[e]=t}else mN.LOG_SERVER_URL=t;else mN.LOG_SERVER_URL=vN;else mN.LOG_SERVER_URL="https://web-log-report.rtcplus.com/video/v1/webrtc_log/";else Jx.setStats({product:t});else Jx.setStats({platform:t})}}function yN(e){return"DEVICE_ID"===e?hN.getDeviceId():mN[e]}function SN(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)||Id.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:ck(l).call(l,(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 EN={width:640,height:480,frameRate:15,maxKbps:600},bN={width:1920,height:1080,frameRate:15,maxKbps:3e3};function kN(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},o=an(e);for(n=0;n<o.length;n++)r=o[n],Ob(t).call(t,r)>=0||(i[r]=e[r]);return i}(e,t);if(Os){var o=Os(e);for(n=0;n<o.length;n++)r=o[n],Ob(t).call(t,r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var TN,IN=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}(IN||{}),RN=function(e){return e.PushLimitWarn="PushLimitWarn",e}(RN||{}),AN=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_SPEAKER_CHANGE="onSpeakerChange",e.ON_STREAM_FAILED="streamFailed",e}(AN||{}),wN=function(e){return e.RSCP="RSCP",e.RTT="RTT",e}(wN||{}),CN=function(e){return e.ON_CONNECTION_STATE_CHANGE="onConnectionStateChange",e.ABNORMAL_DISCONNECTION="normalConnection",e}(CN||{}),ON=function(e){return e.userLeave="userLeave",e.connectionLost="connectionLost",e.userDuplicateLogin="userDuplicateLogin",e.kickedByAdmin="kickedByAdmin",e.roleChanged="roleChanged",e.onUserTokenDidExpire="onUserTokenDidExpire",e}(ON||{}),DN=function(e){return e[e.roomDismissByAdmin=2]="roomDismissByAdmin",e}(DN||{}),xN=function(e){return e[e.SEND=0]="SEND",e[e.FEEDBACK=1]="FEEDBACK",e}(xN||{}),NN=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}(NN||{}),PN=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.EXCEED_QPS=5]="EXCEED_QPS",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.NOT_LOGIN=105]="NOT_LOGIN",e[e.SERVER_PARAMS_NOTSET=106]="SERVER_PARAMS_NOTSET",e[e.UNKNOWN=1e3]="UNKNOWN",e}(PN||{}),MN=(od(TN={},0,[0,"success"]),od(TN,1,[aA.USER_MESSAGE_TIMEOUT,"timeout, failed to send."]),od(TN,2,[aA.USER_MESSAGE_BROKEN,"dataChannel broken, failed to send."]),od(TN,3,[aA.USER_MESSAGE_NO_RECEIVER,"cannot find the receiver."]),od(TN,4,[aA.USER_MESSAGE_NO_RECEIVER,"cannot find relay path."]),od(TN,5,[aA.USER_MESSAGE_EXCEED_QPS,"cannot find relay path."]),od(TN,17,[aA.USER_MESSAGE_SEND_TO_SERVER_ERROR,"failed to send to business server."]),od(TN,18,[aA.USER_MESSAGE_SERVER_RESPONSE_ERROR,"business server response error."]),od(TN,100,[aA.USER_MESSAGE_NOT_JOIN,"not join room"]),od(TN,105,[aA.USER_MESSAGE_NOT_LOGIN,"not login."]),od(TN,106,[aA.USER_MESSAGE_SERVER_PARAMS_NOTSET,"server param is not set."]),od(TN,1e3,[aA.USER_MESSAGE_UNKNOWN,"unknown."]),TN),LN=new bC("RTSMsgReportor",1),UN=function(){function e(t){Kd(this,e),od(this,"_preTime",Date.now()),od(this,"_one2oneNum",0),od(this,"_one2manyNum",0),od(this,"_one2oneMsgCache",new aE),od(this,"_one2manyMsgCache",new aE),od(this,"roomInfo",void 0),od(this,"rtsSessionId",""),this.id=t}return zd(e,[{key:"needReport",value:function(t){return!!e.config&&(Date.now()-this._preTime>=36e5&&(this._preTime=Date.now(),this._one2oneNum=0,this._one2manyNum=0),"one2one"===t&&this._one2oneNum<e.config.max_one2one_fpt_per_hour&&Math.random()<=e.config.one2one_fpt_ratio/100||"one2many"===t&&this._one2manyNum<e.config.max_one2many_fpt_per_hour&&Math.random()<=e.config.one2many_fpt_ratio/100)}},{key:"cacheP2PMsg",value:function(t){var r;this._one2oneMsgCache.set(t.msg_id,sd({config_version:(null===(r=e.config)||void 0===r?void 0:r.version)||""},t))}},{key:"updateP2PMsg",value:function(e,t){var r=this._one2oneMsgCache.get(e);r&&this._one2oneMsgCache.set(e,sd(sd({},r),t))}},{key:"cacheCustomMsg",value:function(t){var r;this._one2manyMsgCache.set(t.msg_id,sd({config_version:(null===(r=e.config)||void 0===r?void 0:r.version)||""},t))}},{key:"updateOne2ManyMsg",value:function(e,t){var r=this._one2manyMsgCache.get(e);r&&this._one2manyMsgCache.set(e,sd(sd({},r),t))}},{key:"reportP2PMsg",value:function(e){var t=this._one2oneMsgCache.get(e);t&&(LN.print("reportP2PMsg",t.msg_type,hk(t)),Wx.rtsMessageReport(t))}},{key:"reportOne2ManyMsg",value:function(e){var t=this._one2manyMsgCache.get(e);t&&(LN.print("reportOne2ManyMsg",t.msg_type,hk(t)),Wx.rtsMessageReport(t))}},{key:"reportMsgRecv",value:function(t){var r;t.config_version=(null===(r=e.config)||void 0===r?void 0:r.version)||"",LN.print("reportMsgRecv",t.msg_type,hk(t)),Wx.rtsMessageReport(t)}},{key:"destroy",value:function(){this._one2manyNum=0,this._one2oneNum=0,this._one2manyMsgCache.clear(),this._one2oneMsgCache.clear(),this._preTime=Date.now(),delete this.roomInfo,this.rtsSessionId=""}}]),e}();od(UN,"config",void 0);var VN=new aE,FN=function(e){LN.print("setConfig","get config: "+hk(e)),UN.config=e},BN=function(e){var t=VN.get(e)||new UN(e);return VN.set(e,t),t},jN=function(e){var t=VN.get(e);t&&(t.destroy(),VN.delete(e))},GN=function(e,t){var r=VN.get(e);r&&(r.roomInfo=t)},HN=function(e,t){var r=VN.get(e);r&&(r.rtsSessionId=t)},zN=function(e,t,r){var n,i;t.enable_report&&t.report_msg_id&&(null===(n=VN.get(e))||void 0===n||n.updateP2PMsg(Im(i="".concat(t.from)).call(i,t.report_msg_id),{send_ts:Date.now(),msg_size:r}))},KN=function(e,t,r){if(t.enable_report&&t.report_msg_id){var n,i,o=VN.get(e);null==o||o.updateP2PMsg(Im(n="".concat(t.from)).call(n,t.report_msg_id),{ack_ts:Date.now(),error_code:r}),null==o||o.reportP2PMsg(Im(i="".concat(t.from)).call(i,t.report_msg_id))}},XN=function(e,t,r){var n,i,o,a=VN.get(e);null!=a&&a.needReport("one2many")&&(r.enable_report=!0,r.report_msg_id=t,a.cacheCustomMsg({rts_session_id:a.rtsSessionId,msg_id:Im(n="".concat(r.clientId)).call(n,t),node_role:"src_sdk",from:r.clientId,to:(null===(i=a.roomInfo)||void 0===i?void 0:i.roomId)||"",msg_type:"one2many",rts_room_id:(null===(o=a.roomInfo)||void 0===o?void 0:o.roomId)||"",req_ts:Date.now(),send_ts:Date.now(),ack_ts:Date.now(),msg_size:0}));return r},qN=function(e,t,r){if(t.enable_report&&t.report_msg_id){var n,i=VN.get(e);if(i)i.updateOne2ManyMsg(Im(n="".concat(t.clientId)).call(n,t.report_msg_id),{send_ts:Date.now(),msg_size:r})}},WN=function(e,t,r){if(t.enable_report&&t.report_msg_id){var n,i,o=VN.get(e);if(o)null==o||o.updateOne2ManyMsg(Im(n="".concat(t.clientId)).call(n,t.report_msg_id),{ack_ts:Date.now(),error_code:r}),null==o||o.reportOne2ManyMsg(Im(i="".concat(t.clientId)).call(i,t.report_msg_id))}},YN=function(e,t,r){if(t.enable_report&&t.report_msg_id){var n,i,o=VN.get(e);null==o||o.reportMsgRecv({rts_session_id:o.rtsSessionId,msg_id:Im(n="".concat(t.from)).call(n,t.report_msg_id),msg_size:r.msg_size,node_role:"dst_sdk",msg_type:t.to?"one2one":"one2many",rts_room_id:t.room,from:t.from,to:t.to||t.room,error_code:0,recv_msg_ts:r.recv_msg_ts,fwd_msg_ts:r.fwd_msg_ts,reply_ack_ts:Date.now(),cur_dst_uid:t.to?"":null===(i=o.roomInfo)||void 0===i?void 0:i.userInfo.userId})}},QN=function(e,t,r){if(t.enable_report&&t.report_msg_id){var n,i,o=VN.get(e);null==o||o.reportMsgRecv({rts_session_id:o.rtsSessionId,msg_id:Im(n="".concat(t.clientId)).call(n,t.report_msg_id),msg_size:r.msg_size,node_role:"dst_sdk",msg_type:"one2many",rts_room_id:t.roomId,from:t.clientId,to:t.roomId,error_code:0,recv_msg_ts:r.recv_msg_ts,fwd_msg_ts:r.fwd_msg_ts,reply_ack_ts:Date.now(),cur_dst_uid:null===(i=o.roomInfo)||void 0===i?void 0:i.userInfo.userId})}},JN=Object.freeze(Object.defineProperty({__proto__:null,_cache:VN,setConfig:FN,setRtsSessionId:HN,createRTSMsgReportor:BN,destroyRTSMsgReportor:jN,setRoomInfo:GN,samplingP2PMsg:function(e,t){var r=VN.get(e);if(null!=r&&r.needReport("one2one")){var n,i=Im(n="".concat(t.from)).call(n,t.id);t.enable_report=!0,t.report_msg_id=t.id,r.cacheP2PMsg({rts_session_id:r.rtsSessionId,msg_id:i,node_role:"src_sdk",from:t.from,to:t.to||"server",msg_type:t.to?"one2one":"one2server",rts_room_id:t.room,req_ts:Date.now(),send_ts:Date.now(),ack_ts:Date.now(),msg_size:0})}return t},updateP2PMsgReq:zN,updateP2PMsgAck:KN,samplingOne2ManyMsg:XN,reportP2PMsgRecv:YN,updateOne2ManyMsgAck:WN,updateOne2ManyMsgReq:qN,reportOne2ManyMsgRecv:QN},Symbol.toStringTag,{value:"Module"})),ZN=["msg"],$N=new bC("DataChannelSignaling",3),eP=["onSpeakerChange"],tP=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}(tP||{}),rP=function(e){AI(i,e);var t,r,n=zI(i);function i(e,t){var r;return Kd(this,i),od(YT(r=n.call(this)),"_singlingCache",new aE),od(YT(r),"_p2pCache",new aE),od(YT(r),"_rttIds",{}),od(YT(r),"_p2pMessageId",0),od(YT(r),"_clearDataChannelListener",void 0),r.id=e,r._dataChannel=t,r._clearDataChannelListener=r._handleHandler(),window.__rtc_mock_signaling__=r.emit.bind(YT(r)),r}return zd(i,[{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 Wx.rtcSignaling(0,hk(t),"call-".concat(e),"Send",t.streamId,t.streamUserId,kx.UP),new H_((function(i,o){var a,s=n._genHeader(r);s.id=Ew();var c=s.id.join("-"),u="customMessage"===e;u&&XN(n.id,+s.id.join(""),t);var d=setTimeout((function(){n._singlingCache.delete(c),o(new cA(aA.TIME_OUT,"".concat(e," message time out"))),u&&WN(n.id,t,999)}),6e4);n._singlingCache.set(c,{signalingType:e,success:function(e){clearTimeout(d),i(e),u&&WN(n.id,t,0)},error:function(e){clearTimeout(d),o(e),u&&WN(n.id,t,e.code)}}),$N.print("Signal",Im(a=">>>>>> [".concat(e,"][")).call(a,c,"]"),t),n._sendMessage(e,s,t)}))}},{key:"sendPingSignaling",value:function(){return this.sendSignaling("CheckConnectivity",{ts:Date.now()},{functionType:2})}},{key:"sendP2PMessage",value:(r=Sm(gm().mark((function e(t,r){var n,i,o;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.msg,i=kN(t,ZN),o=n instanceof ArrayBuffer,e.t0=this,e.t1=JN,e.t2=this.id,e.t3=sd,e.t4=sd({ver:1,id:this._p2pMessageId++,time:Date.now(),dir:xN.SEND,type:NN.P2P,err:PN.SUCCESS},i),e.t5={},e.t6=o,!o){e.next=15;break}return e.next=12,sw.ab2b64str(n);case 12:e.t7=e.sent,e.next=16;break;case 15:e.t7=n;case 16:return e.t8=e.t7,e.t9={binary:e.t6,msg:e.t8},e.t10=(0,e.t3)(e.t4,e.t5,e.t9),e.t11=e.t1.samplingP2PMsg.call(e.t1,e.t2,e.t10),e.t12=r,e.abrupt("return",e.t0._sendP2PMessage.call(e.t0,e.t11,e.t12));case 22: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 kw(e.msg)?this._rttIds[e.id]=e.id:e.dir===xN.SEND&&$N.print("_sendP2PMessage [DC Signaling p2p >>]",hk(e)),new H_((function(n,i){var o=t._genHeader(sd(sd({needAck:!0,functionType:1},r),{},{id:Ew()}));if(e.dir===xN.SEND){var a=setTimeout((function(){t._p2pCache.delete(e.id),i(new cA(aA.USER_MESSAGE_TIMEOUT,"P2P message timeout")),KN(t.id,e,999)}),12e3);t._p2pCache.set(e.id,{success:function(r,i){clearTimeout(a),n(i),KN(t.id,e,0)},error:function(r){var n;clearTimeout(a),KN(t.id,e,r.err);var o=WT(MN[r.err]||[aA.USER_MESSAGE_UNKNOWN,Im(n="err: ".concat(r.err,", msg: ")).call(n,r.msg)],2),s=o[0],c=o[1];i({err:r.err,code:s,message:r.msg||c})}})}try{t._sendMessage("p2p",o,e)}catch(s){throw s.code===aA.SIGNALING_CHANNEL_NOT_OPEN&&(s.code=aA.USER_MESSAGE_BROKEN),s}}))}},{key:"_sendMessage",value:function(e,t,r){var n;if(!this._dataChannel||"open"!==this._dataChannel.readyState)throw new cA(aA.SIGNALING_CHANNEL_NOT_OPEN,"DataChannel not open");var i=t.version+(+t.zip<<5)+(+t.encrypt<<6),o=+t.needAck+(+t.direction<<1)+(+t.functionType<<2)+(+t.binary<<6),a=sw.str2ab(hk([e,r])),s=ow(Uint8Array,Im(n=[i,o]).call(n,Kk(t.id||[])),new Uint8Array(a));this._dataChannel.send(s.buffer),"p2p"===e?zN(this.id,r,s.buffer.byteLength):"customMessage"===e&&qN(this.id,r,s.buffer.byteLength)}},{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=Hk(mm(t).call(t,2,r))}return{header:o,data:mm(t).call(t,r)}}},{key:"_feedbackSignaling",value:function(e,t,r){var n,i,o=this._genHeader({needAck:!0,direction:1,id:ck(n=e.split("-")).call(n,(function(e){return+e}))});Wm(eP).call(eP,t)||$N.print("Signal",Im(i=">>>>>> [".concat(t,"-res][")).call(i,e,"]"));this._sendMessage("".concat(t,"-res"),o,r)}},{key:"_handleMessage",value:(t=Sm(gm().mark((function e(t){var r,n,i,o,a,s,c,u,d,l,h,f,p,v,_,m,g,y,S,E,b,k,T,I,R,A,w,C,O,D,x,N,P,M,L;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:s=Date.now(),c=t.byteLength,u=this._dispartData(t),d=u.data,(l=u.header).zip&&((h=new lx.Inflate).push(d,!0),d=h.result),f=sw.ab2str(d),p=[],e.prev=8,p=JSON.parse(f),e.next=16;break;case 12:return e.prev=12,e.t0=e.catch(8),e.t0 instanceof Error&&Wx.rtcSignalingMsgError(-1,e.t0.message,bx.MESSAGE_PARSE_FAILED),e.abrupt("return");case 16:e.t1=l.functionType,e.next=0===e.t1?19:1===e.t1?38:2===e.t1?88:106;break;case 19:if(v=(null===(r=l.id)||void 0===r?void 0:r.join("-"))||"",1!==l.direction){e.next=24;break}this._handleAckMessage(v,p[0]||{},f),e.next=37;break;case 24:if(!Array.isArray(p)){e.next=37;break}if(_=p[0],p=p[1],Wm(eP).call(eP,_)||$N.print("Signal","<<<<<< ".concat(_),p,v),this._feedbackSignaling(v,_,_===AN.ON_CUSTOM_MESSAGE?sd(sd({},p),{},{message:""}):""),!p.binary||"string"!=typeof p.message){e.next=33;break}return e.next=32,sw.b64str2ab(p.message);case 32:p.message=e.sent;case 33:m=Date.now(),this.emit(_,sd({},p)),_===AN.ON_CUSTOM_MESSAGE&&QN(this.id,p,{msg_size:c,recv_msg_ts:s,fwd_msg_ts:m}),Wx.rtcSignaling(0,f,"on-".concat(_),"Recv",p.streamId,p.clientId,kx.DOWN);case 37:return e.abrupt("break",107);case 38:Array.isArray(p)&&(p=p[1]),g=null===(n=p)||void 0===n?void 0:n.id,this._rttIds[g]||(null===(i=p)||void 0===i?void 0:i.dir)===xN.FEEDBACK||kw(null===(o=p)||void 0===o?void 0:o.msg)?delete this._rttIds[g]:$N.print("Signal","<<<<<< p2p response",p),e.t2=p.dir,e.next=e.t2===xN.SEND?44:e.t2===xN.FEEDBACK?84:86;break;case 44:if(y=Date.now(),kw(null===(a=p)||void 0===a?void 0:a.msg)){e.next=81;break}if(E=(S=p).binary,b=S.msg,k=S.room,T=S.to,I=S.from,R=""===k?E?AN.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM:AN.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM:E?AN.USER_BINARY_MESSAGE_RECEIVED:AN.USER_MESSAGE_RECEIVED,T){e.next=65;break}if(e.t3=this,e.t4=AN.ON_CUSTOM_MESSAGE,e.t5=I,e.t6=E,!E){e.next=59;break}return e.next=56,sw.b64str2ab(b);case 56:e.t7=e.sent,e.next=60;break;case 59:e.t7=b;case 60: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=81;break;case 65:if(e.t10=this,e.t11=R,e.t12=sd,e.t13=sd({},p),e.t14={},!E){e.next=76;break}return e.next=73,sw.b64str2ab(b);case 73:e.t15=e.sent,e.next=77;break;case 76:e.t15=b;case 77: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 81:return this._sendP2PMessage(sd(sd({},p),{},{dir:xN.FEEDBACK,msg:""})),YN(this.id,p,{msg_size:c,recv_msg_ts:s,fwd_msg_ts:y}),e.abrupt("break",87);case 84:return this._handleP2PMsgFeedback(p),e.abrupt("break",87);case 86:return e.abrupt("break",87);case 87:return e.abrupt("break",107);case 88:if(1!==l.direction){e.next=93;break}w=(null===(A=l.id)||void 0===A?void 0:A.join("-"))||"",this._handleAckMessage(w,p[0]||{},f),e.next=105;break;case 93:if(C=WT(p,2),O=C[0],D=C[1],x=void 0===D?{}:D,"RXMediaMsg"!==O){e.next=105;break}N=x.type,P=x.data,Wx.rtcSignaling(0,f,"on-".concat(N),"Recv","","",kx.DOWN),e.t19=N,e.next="RSCP"===e.t19?100:"RTT"===e.t19?102:104;break;case 100:try{M=JSON.parse(P),Array.isArray(M)&&this.emit(N,M)}catch(U){}return e.abrupt("break",105);case 102:try{(L=JSON.parse(P)).length&&this.emit(N,L[0])}catch(U){}return e.abrupt("break",105);case 104:return e.abrupt("break",105);case 105:case 106:return e.abrupt("break",107);case 107:case"end":return e.stop()}}),e,this,[[8,12]])}))),function(e){return t.apply(this,arguments)})},{key:"_handleHandler",value:function(){var e=this,t=function(t){$N.print("_handleHandler","dataChannel close",t),e.emit("close",t)},r=function(t){$N.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 sd({version:2,zip:!1,encrypt:!1,needAck:!0,direction:0,functionType:0,binary:!1},e)}},{key:"_handleAckMessage",value:function(e,t,r){var n,i=this._singlingCache.get(e);i&&(this._singlingCache.delete(e),200===t.code?i.success(t):i.error(t),$N.print("Signal",Im(n="<<<<<< [".concat(i.signalingType,"-ack] ")).call(n,e),t));Wx.rtcSignaling(0,r,null==i?void 0:i.signalingType,"Ack","","",kx.DOWN)}},{key:"_handleP2PMsgFeedback",value:function(e){var t=this._p2pCache.get(e.id);t&&(this._p2pCache.delete(e.id),e.err===PN.SUCCESS?t.success(e.id,e):t.error(e))}}]),i}(iC.exports.EventEmitter),nP=function(){function e(){Kd(this,e),od(this,"xhr",void 0),od(this,"isSending",void 0),od(this,"timeout",void 0),this.isSending=!1}return zd(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 H_((function(e,i){t.isSending=!0;var a=new XMLHttpRequest;a.open(r,n,!0);for(var c=0,d=mA(s);c<d.length;c++){var l=WT(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})}},a.onabort=function(){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=hk(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}(),iP=new bC("ICE Request",3),oP=function(){function e(){Kd(this,e),od(this,"_request",void 0),this._request=new nP}var t,r,n;return zd(e,[{key:"getAccessNode",value:(n=Sm(gm().mark((function e(t,r,n,i,o,a,s,c){var u;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(u=hN.getAccessNode(t))){e.next=9;break}if(this.getAccessNodeFromServer(t,r,n,i,o,a,s,c),iN("es.R.node.cache",u),!Array.isArray(u)){e.next=8;break}return e.abrupt("return",H_.resolve(u));case 8:return e.abrupt("return",H_.resolve([u]));case 9:return e.abrupt("return",this.getAccessNodeFromServer(t,r,n,i,o,a,s,c));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=Sm(gm().mark((function e(t,r,n,i,o,a,s,c){var u,d,l,h,f=this;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return l=hN.getAccessUrls(),h=!0,iN("es.R.req.cache.urls",l),(null===(u=l)||void 0===u?void 0:u.length)>0||(l=mN.ICE_CONFIG_REQUEST_URLS,h=!1,iN("es.R.req.external.urls",l)),(null===(d=l)||void 0===d?void 0:d.length)>0||(l=mN.ICE_CONFIG_REQUEST_URLS_INTERNAL,h=!1,iN("es.R.req.internal.urls",l)),e.abrupt("return",this.getICEConfigFromServer(l,t,r,n,i,o,a,s,c).then((function(e){var r=e.nodes;return hN.setAccessNode(t,r,e.ttl||11200),e.dispatchDomains&&hN.setAccessUrls(e.dispatchDomains),r})).catch((function(e){if(h)return iN("es.R.req.fallback",""),hN.clearAccessUrls(),f.getAccessNodeFromServer(t,r,n,i,o,a,s);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=Sm(gm().mark((function e(t,r,n,i,o,a,s,c,u){var d,l,h,f,p=this;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return d={appID:r,userID:i,deviceID:o,connectSessionID:nw(),os:"web",sdkVersion:mN.VERSION,isOversea:mN.OVERSEA,expectedAddr:yN("EXPECTED_ADDR"),productPlatform:"BytePlus",enableCloudProxy:c,expectedIDC:u},a&&s&&(d.feedbackInfo=[{feedbackIP:null===(l=s.publicIPs[0])||void 0===l?void 0:l.ip,feedbackReason:{type:"NODE_CHANGED",reason:a}}],delete d.expectedAddr),h=Date.now(),Wx.rtcGetAccess(0,hk(d),0,Sx.REQUEST,t.join(","),d.connectSessionID),f=ck(t).call(t,function(){var e=Sm(gm().mark((function e(t,r){var n,i;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,p._request.post(t,d);case 3:n=e.sent,e.next=9;break;case 6:throw e.prev=6,e.t0=e.catch(0),new cA(aA.ICE_SERVER_WRONG,"get ICE config failed",e.t0);case 9:if(200===n.code){e.next=11;break}throw new cA(aA.ICE_SERVER_WRONG,"get ICE config failed",{server_code:n.code,message:hk(n)});case 11:if(i=n.nodes[0]){e.next=14;break}throw new cA(aA.ICE_SERVER_WRONG,"ICE config server return empty nodes",{code:n.code,message:hk(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",Rw(f).then((function(e){var r=e.result;e.firstNode;var n=e.index;return Wx.rtcGetAccess(200,hk(r),Date.now()-h,Sx.RESPONSE,t[n],d.connectSessionID),r})).catch((function(e){var r,n,i=null===(r=e[0])||void 0===r?void 0:r.error;throw Wx.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()-h,Sx.RESPONSE,t.join(","),d.connectSessionID,{error:hk(i)}),e})));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&&(iP.print("abort","HTTP Request of [getICEConfigFromServer] abort"),this._request.abort())}}]),e}(),aP=function(){function e(){Kd(this,e),od(this,"_request",void 0),this._request=new nP}return zd(e,[{key:"getConfig",value:function(e){var t,r=this,n={keys:["rts_report"],labelSelector:"",sdkVersion:"4.51.0",deviceType:"web",appId:e},i=ck(t=mN.CONFIG_REQUEST_DOMAINS).call(t,(function(e){return"https://".concat(e,"/decision/v1/multi")}));Wx.rtcGetConfig(0,hk(n),0,i.join(","),vx.REQUEST,"",!1);var o=ck(i).call(i,function(){var e=Sm(gm().mark((function e(t,i){var o;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,r._request.post(t,n);case 3:o=e.sent,e.next=9;break;case 6:throw e.prev=6,e.t0=e.catch(0),new cA(aA.ICE_SERVER_WRONG,"get config failed");case 9:return e.abrupt("return",{result:o,index:i});case 10:case"end":return e.stop()}}),e,null,[[0,6]])})));return function(t,r){return e.apply(this,arguments)}}());return new H_((function(e){Rw(o).then((function(t){var r=t.result,n=t.index;Wx.rtcGetConfig(200,hk(r),0,i[n],vx.RESPONSE,"",!1),e(r)})).catch((function(e){Wx.rtcGetConfig(500,e.message,0,"",vx.RESPONSE,"",!1)}))}))}}]),e}(),sP=hi.f("asyncIterator");function cP(e){var t,r,n,i=2;for(void 0!==fl&&(r=sP,n=Dl);i--;){if(r&&null!=(t=e[r]))return t.call(e);if(n&&null!=(t=e[n]))return new uP(t.call(e));r="@@asyncIterator",n="@@iterator"}throw new TypeError("Object is not async iterable")}function uP(e){function t(e){if(Object(e)!==e)return H_.reject(new TypeError(e+" is not an object."));var t=e.done;return H_.resolve(e.value).then((function(e){return{value:e,done:t}}))}return(uP=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?H_.resolve({value:e,done:!0}):t(r.apply(this.s,arguments))},throw:function(e){var r=this.s.return;return void 0===r?H_.reject(e):t(r.apply(this.s,arguments))}},new uP(e)}var dP=[{maxLayers:3,totalPixels:2073600},{maxLayers:3,totalPixels:921600},{maxLayers:3,totalPixels:518400},{maxLayers:2,totalPixels:230400},{maxLayers:2,totalPixels:129600},{maxLayers:1,totalPixels:57600},{maxLayers:1,totalPixels:0}];ry("Set",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),yy);var lP=ee.Set;Ar({target:"Set",stat:!0,forced:!0},{from:wy}),Ar({target:"Set",stat:!0,forced:!0},{of:Oy});var hP=D,fP=Ce,pP=tr,vP=function(){for(var e=pP(this),t=fP(e.add),r=0,n=arguments.length;r<n;r++)hP(t,e,arguments[r]);return e};Ar({target:"Set",proto:!0,real:!0,forced:!0},{addAll:vP}),Ar({target:"Set",proto:!0,real:!0,forced:!0},{deleteAll:Py});var _P=fh,mP=tr,gP=Yt,yP=_P,SP=Dh;Ar({target:"Set",proto:!0,real:!0,forced:!0},{every:function(e){var t=mP(this),r=yP(t),n=gP(e,arguments.length>1?arguments[1]:void 0);return!SP(r,(function(e,r){if(!n(e,e,t))return r()}),{IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}});var EP=oe,bP=D,kP=Ce,TP=tr,IP=Ef,RP=Dh;Ar({target:"Set",proto:!0,real:!0,forced:!0},{difference:function(e){var t=TP(this),r=new(IP(t,EP("Set")))(t),n=kP(r.delete);return RP(e,(function(e){bP(n,r,e)})),r}});var AP=oe,wP=D,CP=Ce,OP=tr,DP=Yt,xP=Ef,NP=_P,PP=Dh;Ar({target:"Set",proto:!0,real:!0,forced:!0},{filter:function(e){var t=OP(this),r=NP(t),n=DP(e,arguments.length>1?arguments[1]:void 0),i=new(xP(t,AP("Set"))),o=CP(i.add);return PP(r,(function(e){n(e,e,t)&&wP(o,i,e)}),{IS_ITERATOR:!0}),i}});var MP=tr,LP=Yt,UP=_P,VP=Dh;Ar({target:"Set",proto:!0,real:!0,forced:!0},{find:function(e){var t=MP(this),r=UP(t),n=LP(e,arguments.length>1?arguments[1]:void 0);return VP(r,(function(e,r){if(n(e,e,t))return r(e)}),{IS_ITERATOR:!0,INTERRUPTED:!0}).result}});var FP=oe,BP=D,jP=Ce,GP=tr,HP=Ef,zP=Dh;Ar({target:"Set",proto:!0,real:!0,forced:!0},{intersection:function(e){var t=GP(this),r=new(HP(t,FP("Set"))),n=jP(t.has),i=jP(r.add);return zP(e,(function(e){BP(n,t,e)&&BP(i,r,e)})),r}});var KP=D,XP=Ce,qP=tr,WP=Dh;Ar({target:"Set",proto:!0,real:!0,forced:!0},{isDisjointFrom:function(e){var t=qP(this),r=XP(t.has);return!WP(e,(function(e,n){if(!0===KP(r,t,e))return n()}),{INTERRUPTED:!0}).stopped}});var YP=oe,QP=D,JP=Ce,ZP=R,$P=tr,eM=fh,tM=Dh;Ar({target:"Set",proto:!0,real:!0,forced:!0},{isSubsetOf:function(e){var t=eM(this),r=$P(e),n=r.has;return ZP(n)||(r=new(YP("Set"))(e),n=JP(r.has)),!tM(t,(function(e,t){if(!1===QP(n,r,e))return t()}),{IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}});var rM=D,nM=Ce,iM=tr,oM=Dh;Ar({target:"Set",proto:!0,real:!0,forced:!0},{isSupersetOf:function(e){var t=iM(this),r=nM(t.has);return!oM(e,(function(e,n){if(!1===rM(r,t,e))return n()}),{INTERRUPTED:!0}).stopped}});var aM=Ar,sM=tr,cM=gn,uM=_P,dM=Dh,lM=b([].join),hM=[].push;aM({target:"Set",proto:!0,real:!0,forced:!0},{join:function(e){var t=sM(this),r=uM(t),n=void 0===e?",":cM(e),i=[];return dM(r,hM,{that:i,IS_ITERATOR:!0}),lM(i,n)}});var fM=oe,pM=Yt,vM=D,_M=Ce,mM=tr,gM=Ef,yM=_P,SM=Dh;Ar({target:"Set",proto:!0,real:!0,forced:!0},{map:function(e){var t=mM(this),r=yM(t),n=pM(e,arguments.length>1?arguments[1]:void 0),i=new(gM(t,fM("Set"))),o=_M(i.add);return SM(r,(function(e){vM(o,i,n(e,e,t))}),{IS_ITERATOR:!0}),i}});var EM=Ce,bM=tr,kM=_P,TM=Dh,IM=TypeError;Ar({target:"Set",proto:!0,real:!0,forced:!0},{reduce:function(e){var t=bM(this),r=kM(t),n=arguments.length<2,i=n?void 0:arguments[1];if(EM(e),TM(r,(function(r){n?(n=!1,i=r):i=e(i,r,r,t)}),{IS_ITERATOR:!0}),n)throw IM("Reduce of empty set with no initial value");return i}});var RM=tr,AM=Yt,wM=_P,CM=Dh;Ar({target:"Set",proto:!0,real:!0,forced:!0},{some:function(e){var t=RM(this),r=wM(t),n=AM(e,arguments.length>1?arguments[1]:void 0);return CM(r,(function(e,r){if(n(e,e,t))return r()}),{IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}});var OM=oe,DM=D,xM=Ce,NM=tr,PM=Ef,MM=Dh;Ar({target:"Set",proto:!0,real:!0,forced:!0},{symmetricDifference:function(e){var t=NM(this),r=new(PM(t,OM("Set")))(t),n=xM(r.delete),i=xM(r.add);return MM(e,(function(e){DM(n,r,e)||DM(i,r,e)})),r}});var LM=oe,UM=Ce,VM=tr,FM=Ef,BM=Dh;Ar({target:"Set",proto:!0,real:!0,forced:!0},{union:function(e){var t=VM(this),r=new(FM(t,LM("Set")))(t);return BM(e,UM(r.add),{that:r}),r}});var jM=lP,GM=new aE,HM=function(){var e=Sm(gm().mark((function e(t){return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new H_((function(e,r){if("chrome-stable"===cw()&&void 0===window.InstallTrigger)try{t.getStats((function(t){var r=[];t.result().forEach((function(e){if(!Wm(WM).call(WM,e.type)){var t={};e.names().forEach((function(r){t[r]=e.stat(r)})),r.push(sd(sd({},t),{},{id:e.id,type:e.type,timestamp:e.timestamp}))}})),e({all:r,getTrackStats:function(e){return Gs(r).call(r,(function(t){return"ssrc"!==t.type||t.googTrackId===e}))}})}))}catch(nW){r(nW)}else e({all:[],getTrackStats:function(){return[]}})})));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),zM=function(){var e=Sm(gm().mark((function e(t){var r,n,i,o,a,s;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getStats();case 2:return i=e.sent,o={all:[]},a=new aE,i.forEach((function(e){var t=a.get(e.type)||new aE;t.set(e.id,e),a.set(e.type,t),o.all.push(e)})),s=function(e,t){e.forEach((function(e){var r,n,i,o,s,c,u=e.codecId,d=e.transportId,l=e.trackId,h=e.playoutId;if(null===(r=a.get(qM.codec))||void 0===r||r.forEach((function(e){e.id===u&&t.add(e)})),null===(n=a.get(qM.transport))||void 0===n||n.forEach((function(e){e.id===d&&(s=e,t.add(e))})),null===(i=a.get(qM.track))||void 0===i||i.forEach((function(e){e.id===l&&t.add(e)})),null===(o=a.get(qM.mediaPlayout))||void 0===o||o.forEach((function(e){e.id===h&&t.add(e)})),s){var f,p,v=s,_=v.localCertificateId,m=v.remoteCertificateId,g=v.selectedCandidatePairId;null===(f=a.get(qM.certificate))||void 0===f||f.forEach((function(e){(e.id===_||e.id===m)&&t.add(e)})),null===(p=a.get(qM.candidatePair))||void 0===p||p.forEach((function(e){e.id===g&&(c=e,t.add(e))}))}if(c){var y,S,E=c,b=E.localCandidateId,k=E.remoteCandidateId;null===(y=a.get(qM.localCandidate))||void 0===y||y.forEach((function(e){e.id===b&&t.add(e)})),null===(S=a.get(qM.remoteCandidate))||void 0===S||S.forEach((function(e){e.id===k&&t.add(e)}))}}))},null===(r=a.get(qM.mediaSource))||void 0===r||r.forEach((function(e){var t,r=new jM;r.add(e);var n=[];null===(t=a.get(qM.outboundRtp))||void 0===t||t.forEach((function(t){var i;t.mediaSourceId===e.id&&(r.add(t),n.push(t),null===(i=a.get(qM.remoteInboundRtp))||void 0===i||i.forEach((function(e){e.localId===t.id&&r.add(e)})))})),s(n,r),o[e.trackIdentifier]=Hk(r)})),null===(n=a.get(qM.inboundRtp))||void 0===n||n.forEach((function(e){var t,r=new jM;r.add(e),null===(t=a.get(qM.remoteOutboundRtp))||void 0===t||t.forEach((function(t){t.localId===e.id&&r.add(t)})),s([e],r);var n,i=e.trackIdentifier;i||(null===(n=a.get(qM.track))||void 0===n||n.forEach((function(t){t.id===e.trackId&&(i=t.trackIdentifier)})));o[i]=Hk(r)})),e.abrupt("return",o);case 10:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),KM=function(){var e=Sm(gm().mark((function e(t,r,n){var i,o,a,s,c,u;return gm().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(!uw&&!dw){e.next=10;break}return o=[],e.next=7,t.getStats(r);case 7:return e.sent.forEach((function(e){o.push(e)})),e.abrupt("return",o);case 10:return(!(a=GM.get(t))||Date.now()-a.timestamp>150)&&(a={timestamp:Date.now(),statsPromise:zM(t),extraStatsPromise:HM(t)},GM.set(t,a)),e.next=14,a.statsPromise;case 14:if(s=e.sent,c=(i?s[i]:s.all)||[],n){e.next=21;break}return e.next=19,a.extraStatsPromise;case 19:u=e.sent,c=Im(c).call(c,(i?u.getTrackStats(i):u.all)||[]);case 21:return e.abrupt("return",c);case 22:case"end":return e.stop()}}),e)})));return function(t,r,n){return e.apply(this,arguments)}}();cw();var XM,qM=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}(qM||{}),WM=["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"],YM=new bC("isSupported",0),QM=function(){var e=Sm(gm().mark((function e(){var t;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,!aw()&&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,JM();case 5:return t=e.sent,e.abrupt("return",(null==t?void 0:Wm(t).call(t,"H264"))||(null==t?void 0:Wm(t).call(t,"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)}}(),JM=function(){var e=Sm(gm().mark((function e(){var t,r,n,i,o,a,s,c,u;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(YM.print("internalGetSupportedCodecs()","Invoke, cachedSupportedCodecs: %o",XM),!XM){e.next=3;break}return e.abrupt("return",XM);case 3:if(t=[],e.prev=4,!Wm(r=navigator.userAgent).call(r,"VivoBrowser")){e.next=8;break}return e.next=8,Iw();case 8:return e.next=10,Iw();case 10:if(i=e.sent){e.next=13;break}return e.abrupt("return",t);case 13:if(yb(n=["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"]).call(n,(function(e){var t,r=null==i?void 0:Wm(i).call(i,e);return YM.print("internalGetSupportedCodecs()",Im(t="".concat(r?"includes":"not found",": ")).call(t,e)),r}))){for(o=navigator.userAgent.toLowerCase(),a=!1,s=0,c=["heytapbrowser","mqqbrowser","miuibrowser"];s<c.length;s++)u=c[s],Wm(o).call(o,u)&&(a=!0);!a&&t.push("H264")}else YM.print("internalGetSupportedCodecs()","sdp: %s",i);return null!=i&&Wm(i).call(i,"VP8")&&t.push("vp8"),XM=t,e.abrupt("return",t);case 20:return e.prev=20,e.t0=e.catch(4),e.abrupt("return",t);case 23:case"end":return e.stop()}}),e,null,[[4,20]])})));return function(){return e.apply(this,arguments)}}(),ZM=function(){var e=Sm(gm().mark((function e(){var t;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,JM();case 2:return t=e.sent,e.abrupt("return",ck(t).call(t,(function(e){return e.toUpperCase()})));case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),$M=function(){return"undefined"!=typeof TransformStream&&"undefined"!=typeof RTCRtpSender&&"undefined"!=typeof RTCRtpReceiver&&void 0!==RTCRtpSender.prototype.createEncodedStreams&&void 0!==RTCRtpReceiver.prototype.createEncodedStreams},eL={},tL={},rL={exports:{}},nL=rL.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"]}]};an(nL).forEach((function(e){nL[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=rL.exports,i=RegExp.prototype.test.bind(/^([a-z])=(.*)/);e.parse=function(e){var t,o={},a=[],s=o;return Gs(t=e.split(/(\r\n|\r|\n)/)).call(t,i).forEach((function(e){var t=e[0],i=mm(e).call(e,2);"m"===t&&(a.push({rtp:[],fmtp:[]}),s=a[a.length-1]);for(var o=0;o<(n[t]||[]).length;o+=1){var c=n[t][o];if(c.reg.test(i))return r(c,s,i)}})),o.media=a,o};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){var t;return EE(t=e.split(/;\s?/)).call(t,o,{})},e.parseFmtpConfig=e.parseParams,e.parsePayloads=function(e){var t;return ck(t=e.toString().split(" ")).call(t,Number)},e.parseRemoteCandidates=function(e){for(var r,n=[],i=ck(r=e.split(" ")).call(r,t),o=0;o<i.length;o+=3)n.push({component:i[o],ip:i[o+1],port:i[o+2]});return n},e.parseImageAttributes=function(e){var t;return ck(t=e.split(" ")).call(t,(function(e){var t;return EE(t=e.substring(1,e.length-1).split(",")).call(t,o,{})}))},e.parseSimulcastStreamList=function(e){var r;return ck(r=e.split(";")).call(r,(function(e){var r;return ck(r=e.split(",")).call(r,(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}}))}))}}(tL);var iL=rL.exports,oL=/%[sdv%]/g,aL=function(e){var t=1,r=arguments,n=r.length;return e.replace(oL,(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""}}))},sL=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 aL.apply(null,n)},cL=["v","o","s","i","u","e","p","c","b","t","r","z","a"],uL=["i","c","b","a"],dL=tL,lL=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||cL,n=t.innerOrder||uL,i=[];return r.forEach((function(t){iL[t].forEach((function(r){r.name in e&&null!=e[r.name]?i.push(sL(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){i.push(sL(t,r,e))}))}))})),e.media.forEach((function(e){i.push(sL("m",iL.m[0],e)),n.forEach((function(t){iL[t].forEach((function(r){r.name in e&&null!=e[r.name]?i.push(sL(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){i.push(sL(t,r,e))}))}))}))})),i.join("\r\n")+"\r\n"};eL.write=lL,eL.parse=dL.parse,eL.parseParams=dL.parseParams,eL.parseFmtpConfig=dL.parseFmtpConfig,eL.parsePayloads=dL.parsePayloads,eL.parseRemoteCandidates=dL.parseRemoteCandidates,eL.parseImageAttributes=dL.parseImageAttributes,eL.parseSimulcastStreamList=dL.parseSimulcastStreamList;var hL=new bC("FirefoxHandler",3),fL=Math.pow(2,32),pL="kp34Za0H+aVf862l",vL="o/i14u9pJrxRKAsu";function _L(e){return e>fL-18?(hL.print("generateAllSsrc","reset start id",e),_L(e=e-fL+1e4+18)):{audio:e,audioFec:e+1,audioRtx:e+2,video:e+3,videoFec:e+4,videoRtx:e+5,next:e+18}}var mL=function(e,t,r){var n,i,o,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:vL;return[{id:r,attribute:"cname",value:a},{id:r,attribute:"msid",value:Im(n=Im(i="".concat(e," ")).call(i,e,"-")).call(n,t)},{id:r,attribute:"mslabel",value:"".concat(e)},{id:r,attribute:"label",value:Im(o="".concat(e,"-")).call(o,t)}]},gL=function(e,t){var r,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=t.video,o=t.videoRtx,a=t.videoFec,s=[i,o],c=n.cname,u=n.flexfec;u&&s.push(a);var d,l=EE(s).call(s,(function(t,r){return Im(t).call(t,mL(e,"video",r,c))}),[]),h=[{semantics:"FID",ssrcs:Im(r="".concat(i," ")).call(r,o)}];u&&h.push({semantics:"FEC-FR",ssrcs:Im(d="".concat(i," ")).call(d,a)});return{ssrcs:l,ssrcGroups:h}};function yL(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 SL=function(e,t,r){var n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i=sd(sd({},e),{},{media:[]});return n&&(i.invalid=[{value:"realx-exts:rscp"}]),t&&i.media.push(t),r&&i.media.push(r),delete i.groups,delete i.msidSemantic,eL.write(i)};function EL(e){return bL.apply(this,arguments)}function bL(){return(bL=Sm(gm().mark((function e(t){var r,n,i,o;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r={},n=t.publicIPs,i=t.certFingerprint,o=t.iceParams,r.fingerprint={type:"sha-256",hash:i},r.icePwd=o.serverIcePwd,e.next=6,TL(o.serverIceUfrag);case 6:return r.iceUfrag=e.sent,Jx.setStats({connection_id:r.iceUfrag}),r.candidates=kL(n),r.setup="active",r.iceOptions="renomination",e.abrupt("return",r);case 12:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function kL(e){if(!Array.isArray(e))return[];var t=0,r=2130706431,n=[];return e.forEach((function(e){var i={component:1,ip:e.ip,type:"host",generation:e.generation};e.udpPorts&&e.udpPorts.forEach((function(e){n.push(sd(sd({},i),{},{foundation:t++,transport:"udp",port:e,priority:r}))})),e.tcpPorts&&e.tcpPorts.forEach((function(e){n.push(sd(sd({},i),{},{foundation:t++,transport:"tcp",port:e,tcptype:"passive",priority:2130705431}))}))})),n}var TL=function(){var e=Sm(gm().mark((function e(t){var r,n,i,o,a,s,c,u;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new TextEncoder,i=n.encode("PREC"),e.t0=Uint8Array,e.next=5,sw.b64str2ab(t);case 5:return e.t1=e.sent,o=new e.t0(e.t1),a=mm(r=n.encode(Date.now().toString())).call(r,-4),(s=new Uint8Array(2))[0]=0,s[1]=1,c=ow(Uint8Array,i,o,a,s),e.next=14,sw.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)}}(),IL=function(e,t){var r=0;if(Array.isArray(e.fmtp)&&Array.isArray(e.rtp)){var n,i=qT(e.fmtp);try{for(i.s();!(n=i.n()).done;){var o,a,s,c=n.value;if(Wm(o=c.config).call(o,"level-asymmetry-allowed=1")&&Wm(a=c.config).call(a,"packetization-mode=1")&&Wm(s=c.config).call(s,"profile-level-id=42e01f")){r=c.payload;break}}}catch(p){i.e(p)}finally{i.f()}for(var u=0;u<e.rtp.length;u++){var d=e.rtp[u];if("H264"===t){if(d.payload===r){var l;e.rtp.unshift(rk(l=e.rtp).call(l,u,1)[0]);break}}else if(d.codec===t){var h;e.rtp.unshift(rk(h=e.rtp).call(h,u,1)[0]);break}}var f=[];e.rtp.forEach((function(e){return f.push(e.payload)})),e.payloads=f.join(" ")}},RL=new bC("BasicHandler",3),AL={iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan",encodedInsertableStreams:!!$M()||void 0},wL=function(e){AI(o,e);var t,r,n,i=zI(o);function o(e,t){var r;return Kd(this,o),od(YT(r=i.call(this)),"_peerConnection",void 0),od(YT(r),"_dataChannel",void 0),od(YT(r),"_context",void 0),od(YT(r),"monitor",void 0),od(YT(r),"_offerIce",{}),od(YT(r),"_answerIce",{}),od(YT(r),"_initSctpEvents",!1),od(YT(r),"_nextSsrc",Math.floor(Math.random()*fL+1e4)),od(YT(r),"_aSendonlyAnswerTpl",void 0),od(YT(r),"_vSendonlyAnswerTpl",void 0),od(YT(r),"_enableSubFlexfec",!1),od(YT(r),"audioTrack4ff",void 0),r.monitor=e,r._peerConnection=new RTCPeerConnection(AL),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,o,a=null===(t=e.streams)||void 0===t||null===(n=t[0])||void 0===n?void 0:n.id;RL.print("constructor",Im(i=Im(o="pc.ontrack ".concat(e.track.kind," ")).call(o,e.track.id," ")).call(i,a)),"ff-stream"===a&&(r.audioTrack4ff=e.track),r.emit("ontrack",e)},r._peerConnection.onconnectionstatechange=function(e){var t;RL.print("constructor",Im(t="onconnectionstatechange ".concat(r._peerConnection.iceConnectionState," -> ")).call(t,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,Ex["".concat(t.toUpperCase())])},r}return zd(o,[{key:"disconnect",value:function(){this._peerConnection.close(),this._dataChannel.close(),this._peerConnection.ontrack=null}},{key:"destroy",value:function(){RL.print("destroy"),this.disconnect(),this._context=void 0}},{key:"getTransceivers",value:function(){return this._peerConnection.getTransceivers()}},{key:"_simulcast",value:function(e,t,r,n,i){var o,a,s,c=[];1===e.videoEncodeConfig.length?(c=function(e,t){var r=[];if(t<=1)return r;var n=Math.min(e.width,e.height)/90;return r.push({scaleResolutionDownBy:n,width:Math.floor(e.width/n),height:Math.floor(e.height/n),maxkbps:100,frameRate:10}),t<=2||r.unshift({scaleResolutionDownBy:2,width:Math.floor(e.width/2),height:Math.floor(e.height/2),maxkbps:Math.floor(e.maxKbps/2),frameRate:e.frameRate>=30?Math.floor(e.frameRate/2):e.frameRate}),r}(t,i),RL.print("simulcast() ","simulcastLayers: %o",c)):(c=ck(o=mm(a=mm(s=e.videoEncodeConfig).call(s,1)).call(a,1-i)).call(o,(function(e){var r=Lw(e.width),n=t.width/r;return{width:r,height:Math.floor(t.height/n),scaleResolutionDownBy:n,frameRate:Lw(e.frameRate)||15,maxkbps:e.maxKbps||600}})),RL.print("simulcast() ","simulcastLayers2: %o",c));var u=[!0];c.forEach((function(e,t){var i,o={maxBitrate:1e3*e.maxkbps,scaleResolutionDownBy: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)}),u.push(!0)})),this._context&&(this._context.activeSimStreams=u)}},{key:"internalPublish",value:function(e){var t=e.stream,r=e.videoTrack,n=e.audioTrack,i=e.enableSimulcast,o=e.pubAudio,a=e.pubVideo,s={direction:"sendonly",streams:[t]},c={direction:"sendonly",streams:[t]},u=[],d=[];if(Array.isArray(null==e?void 0:e.videoEncodeConfig)&&e.videoEncodeConfig.length){var l=null==r?void 0:r.getTrack(),h=sd({},EN);if(l){var f=null==l?void 0:l.getSettings();h={width:Math.floor(f.width),height:Math.floor(f.height),frameRate:Math.floor(f.frameRate)}}var p=null==e?void 0:e.videoEncodeConfig[0],v={maxBitrate:1e3*p.maxKbps,rid:"0"};if(e.prevBitrate=p.maxKbps,c.sendEncodings=[v],u.push({width:h.width,height:h.height,framerate:h.frameRate,maxkbps:p.maxKbps,rid:"0"}),!uw&&i){var _,m,g=function(e){for(var t=0,r=e.width*e.height,n=0;n<dP.length;n++)if(r>=dP[n].totalPixels){t=n;break}if(0===t)return dP[t].maxLayers;var i=dP[t-1].totalPixels;return(i-r)/(i-dP[t].totalPixels)<.1?dP[t-1].maxLayers:dP[t].maxLayers}(h);if(RL.print("simulcast() ","maxLayers: %o",g),g>1)this._simulcast(e,sd(sd({},h),{},{maxKbps:p.maxKbps}),c,u,g),null!==(_=this._context)&&void 0!==_&&null!==(m=_.serverConfig)&&void 0!==m&&m.simulcastOnDemand&&(d=ck(u).call(u,(function(e,t){return sd(sd({},e),{},{video_index:t,sub_index:t})})))}}RL.print("publish videoTransceiverInit videoDescriptions","",c,u);var y=null==n?void 0:n.getTrack("preprocessing");(null==n?void 0:n.mixType)!==Fd.PLAYOUT&&null!=n&&n.mixedAudioTrack&&(y=null==n?void 0:n.mixedAudioTrack),y=o&&y?y:"audio";var S=null==r?void 0:r.getTrack("preprocessing");S=a&&S?S:"video";try{this.monitor.rtcInvokeStatus(hk({aTrack:xw(y),vTrack:xw(S),audioTransceiverInit:s,videoTransceiverInit:c}),0,"Handler.internalPublish","",0)}catch(nW){}return{semantics:"unified-plan",videoDescriptions:u,subVideoDescriptions:d,audioTransceiverInit:{track:y,init:s},videoTransceiverInit:{track:S,init:c}}}},{key:"updateMaxBitrate",value:function(e){var t,r,n,i;RL.print("updateMaxBitrate()");var o=null===(t=e.videoTrack)||void 0===t?void 0:t.getTrack(),a=e.videoTransceiver;if(o&&e.pubVideo&&a){var s=null===(r=e.videoEncodeConfig)||void 0===r||null===(n=r[0])||void 0===n?void 0:n.maxKbps;if(s){if(s===e.prevBitrate)return void RL.print("updateMaxBitrate()","no change");e.prevBitrate=s}var c=null===(i=a.sender)||void 0===i?void 0:i.getParameters();if(c){var u;c.encodings=null==c||null===(u=c.encodings)||void 0===u?void 0:ck(u).call(u,(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==a||a.sender.setParameters(c);try{this.monitor.rtcInvokeStatus(hk(c.encodings),0,"Handler.updateScaleResolutionDownBy","",0)}catch(nW){}}}else RL.print("updateMaxBitrate()","no pub")}},{key:"getStats",value:function(e,t){return KM(this._peerConnection,e,t)}},{key:"setLocalDescription",value:(n=Sm(gm().mark((function e(t,r){var n,i,o,a=this;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=iw(),e.prev=1,e.next=4,this._peerConnection.setLocalDescription(new RTCSessionDescription({type:"offer",sdp:t}));case 4:this.monitor.rtcSetDescription(0,t,Rx.W_1,"local"===(null==r?void 0:r.streamUserId)?Ax.UP:Ax.DOWN,(null==r?void 0:r.streamId)||"",(null==r?void 0:r.streamUserId)||"",iw()-n,{type:"offer"}),this._initSctpEvents||(this._initSctpEvents=!0,(o=null===(i=this._peerConnection)||void 0===i?void 0:i.sctp)&&(o.onstatechange=function(){a.monitor.rtcInvokeStatus("sctp state change TO: ".concat(o.state),0,"sctp","",0)},o.transport&&(o.transport.onstatechange=function(){var e;a.monitor.rtcInvokeStatus("dtls state change TO: ".concat(null==o||null===(e=o.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,Rx.W_1,"local"===(null==r?void 0:r.streamUserId)?Ax.UP:Ax.DOWN,"","",iw()-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=Sm(gm().mark((function e(t,r){var n;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=iw(),e.prev=1,e.next=4,this._peerConnection.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:t}));case 4:this.monitor.rtcSetDescription(0,t,Rx.W_0,"local"===(null==r?void 0:r.streamUserId)?Ax.UP:Ax.DOWN,(null==r?void 0:r.streamId)||"",(null==r?void 0:r.streamUserId)||"",iw()-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,Rx.W_1,"local"===(null==r?void 0:r.streamUserId)?Ax.UP:Ax.DOWN,(null==r?void 0:r.streamId)||"",(null==r?void 0:r.streamUserId)||"",iw()-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=Sm(gm().mark((function e(){return gm().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;eL.parse(e).media.forEach((function(e){if("audio"===e.type){if("sendonly"===e.direction){var r,n=null==e?void 0:yb(r=e.rtp).call(r,(function(e){return"opus"===e.codec}));if(n&&null!=e&&e.fmtp){var i,o=null==e?void 0:yb(i=e.fmtp).call(i,(function(e){return e.payload===n.payload}));o&&t._context&&(o.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&&Wm(r).call(r,"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,i=r.codec,o=r.payload;if(Wm(n=["vp8","h264"]).call(n,i.toLocaleLowerCase())){var a,s,c=yb(a=e.fmtp).call(a,(function(e){return e.payload===o}));if(c)c.config=Im(s=[]).call(s,Kk(c.config.split(";")),["x-google-min-bitrate=100","x-google-start-bitrate=".concat(t)]).join(";");else e.fmtp.push({payload:o,config:"x-google-min-bitrate=100;x-google-start-bitrate=".concat(t)})}}))}}]),o}(iC.exports.EventEmitter),CL=b,OL=iy,DL=mg.exports.getWeakData,xL=hf,NL=tr,PL=z,ML=$,LL=Dh,UL=Ye,VL=Zi.set,FL=Zi.getterFor,BL=Po.find,jL=Po.findIndex,GL=CL([].splice),HL=0,zL=function(e){return e.frozen||(e.frozen=new KL)},KL=function(){this.entries=[]},XL=function(e,t){return BL(e.entries,(function(e){return e[0]===t}))};KL.prototype={get:function(e){var t=XL(this,e);if(t)return t[1]},has:function(e){return!!XL(this,e)},set:function(e,t){var r=XL(this,e);r?r[1]=t:this.entries.push([e,t])},delete:function(e){var t=jL(this.entries,(function(t){return t[0]===e}));return~t&&GL(this.entries,t,1),!!~t}};var qL,WL={getConstructor:function(e,t,r,n){var i=e((function(e,i){xL(e,o),VL(e,{type:t,id:HL++,frozen:void 0}),PL(i)||LL(i,e[n],{that:e,AS_ENTRIES:r})})),o=i.prototype,a=FL(t),s=function(e,t,r){var n=a(e),i=DL(NL(t),!0);return!0===i?zL(n).set(t,r):i[n.id]=r,e};return OL(o,{delete:function(e){var t=a(this);if(!ML(e))return!1;var r=DL(e);return!0===r?zL(t).delete(e):r&&UL(r,t.id)&&delete r[t.id]},has:function(e){var t=a(this);if(!ML(e))return!1;var r=DL(e);return!0===r?zL(t).has(e):r&&UL(r,t.id)}}),OL(o,r?{get:function(e){var t=a(this);if(ML(e)){var r=DL(e);return!0===r?zL(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}},YL=n,QL=b,JL=iy,ZL=mg.exports,$L=ry,eU=WL,tU=$,rU=Tg,nU=Zi.enforce,iU=Vi,oU=!YL.ActiveXObject&&"ActiveXObject"in YL,aU=function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}},sU=$L("WeakMap",aU,eU);if(iU&&oU){qL=eU.getConstructor(aU,"WeakMap",!0),ZL.enable();var cU=sU.prototype,uU=QL(cU.delete),dU=QL(cU.has),lU=QL(cU.get),hU=QL(cU.set);JL(cU,{delete:function(e){if(tU(e)&&!rU(e)){var t=nU(this);return t.frozen||(t.frozen=new qL),uU(this,e)||t.frozen.delete(e)}return uU(this,e)},has:function(e){if(tU(e)&&!rU(e)){var t=nU(this);return t.frozen||(t.frozen=new qL),dU(this,e)||t.frozen.has(e)}return dU(this,e)},get:function(e){if(tU(e)&&!rU(e)){var t=nU(this);return t.frozen||(t.frozen=new qL),dU(this,e)?lU(this,e):t.frozen.get(e)}return lU(this,e)},set:function(e,t){if(tU(e)&&!rU(e)){var r=nU(this);r.frozen||(r.frozen=new qL),dU(this,e)?hU(this,e,t):r.frozen.set(e,t)}else hU(this,e,t);return this}})}var fU=ee.WeakMap;Ar({target:"WeakMap",proto:!0,real:!0,forced:!0},{emplace:Vy}),Ar({target:"WeakMap",stat:!0,forced:!0},{from:wy}),Ar({target:"WeakMap",stat:!0,forced:!0},{of:Oy}),Ar({target:"WeakMap",proto:!0,real:!0,forced:!0},{deleteAll:Py}),Ar({target:"WeakMap",proto:!0,real:!0,forced:!0},{upsert:oE});var pU=fU,vU=function(e){AI(f,e);var t,r,n,i,o,a,s,c,u,d,l,h=zI(f);function f(){var e,t,r;return Kd(this,f),od(YT(r=h.call(this)),"inited",!1),od(YT(r),"deviceMap",{audioinput:new aE,audiooutput:new aE,videoinput:new aE}),od(YT(r),"checkDeviceChangeTimer",null),od(YT(r),"isSupportedPermissionsQuery",!1),od(YT(r),"isGrantedMicrophonePermission",!1),od(YT(r),"isGrantedCameraPermission",!1),r.isSupportedPermissionsQuery=!aw()&&!(null===(e=navigator)||void 0===e||null===(t=e.permissions)||void 0===t||!t.query),r._handleDeviceChange=r._handleDeviceChange.bind(YT(r)),!aw()&&r.refreshDevices(),r}return zd(f,[{key:"refreshDevices",value:(l=Sm(gm().mark((function e(){var t,r,n=this;return gm().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,!uw){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 l.apply(this,arguments)})},{key:"initListener",value:(d=Sm(gm().mark((function e(){var t,r,n,i,o=this;return gm().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(){o._handleDeviceChange(),setTimeout((function(){o._handleDeviceChange()}),300)})):this.checkDeviceChangeTimer=window.setInterval((function(){o._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(){o.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(){o.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 d.apply(this,arguments)})},{key:"_handleDeviceChange",value:(u=Sm(gm().mark((function e(){var t,r,n,i,o,a,s,c=this;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=void 0,!uw){e.next=5;break}return e.next=4,navigator.mediaDevices.getUserMedia({audio:!0});case 4:o=e.sent;case 5:return e.next=7,navigator.mediaDevices.enumerateDevices();case 7:a=e.sent,a=Gs(a).call(a,(function(e){return!!e.deviceId})),o&&o.getTracks().forEach((function(e){return e.stop()})),s=Hk(Im(t=[]).call(t,Kk(ZI(r=this.deviceMap.audioinput).call(r)),Kk(ZI(n=this.deviceMap.videoinput).call(n)),Kk(ZI(i=this.deviceMap.audiooutput).call(i)))),a.forEach((function(e){var t,r,n=c.deviceMap[e.kind].get(e.deviceId);c.deviceMap[e.kind].set(e.deviceId,e),n||(Wm(t=e.kind).call(t,"video")?c.emit(Gd.onVideoDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"active"}):Wm(r=e.kind).call(r,"audio")&&c.emit(Gd.onAudioDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"active"}))})),s.forEach((function(e){var t,r;yb(a).call(a,(function(t){return t.deviceId===e.deviceId&&t.kind===e.kind}))||(c.deviceMap[e.kind].delete(e.deviceId),Wm(t=e.kind).call(t,"video")?c.emit(Gd.onVideoDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"inactive"}):Wm(r=e.kind).call(r,"audio")&&c.emit(Gd.onAudioDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"inactive"}))}));case 13:case"end":return e.stop()}}),e,this)}))),function(){return u.apply(this,arguments)})},{key:"getUserMedia",value:(c=Sm(gm().mark((function e(t){var r;return gm().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 c.apply(this,arguments)})},{key:"checkPermissionsByDevices",value:(s=Sm(gm().mark((function e(){var t,r;return gm().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=Gs(r).call(r,(function(e){return"audioinput"===e.kind&&e.label&&e.deviceId})).length>0,t.video=Gs(r).call(r,(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 s.apply(this,arguments)})},{key:"getPermissions",value:(a=Sm(gm().mark((function e(){var t,r,n,i,o,a,s,c=this,u=arguments;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=u.length>0&&void 0!==u[0]?u[0]:{},n=r.audio,i=r.video,o=r.force,n||i||(n=!0,i=!0),a={audio:!1,video:!1},o){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 a.audio=!0,a.video=!0,e.abrupt("return",a);case 12:e.next=18;break;case 14:if(!(n&&this.isGrantedMicrophonePermission||i&&this.isGrantedCameraPermission)){e.next=18;break}return a.audio=this.isGrantedMicrophonePermission,a.video=this.isGrantedCameraPermission,e.abrupt("return",a);case 18:case 26:e.next=30;break;case 20:return e.next=22,this.checkPermissionsByDevices();case 22:if(s=e.sent,!n||!i){e.next=28;break}if(!s.audio||!s.video){e.next=26;break}return e.abrupt("return",s);case 28:if(!(n&&s.audio||i&&s.video)){e.next=30;break}return e.abrupt("return",s);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&&(a.audio=!0,c.isGrantedMicrophonePermission=!0),i&&(a.video=!0,c.isGrantedCameraPermission=!0))})).catch((function(){}));case 33:return e.next=35,this.refreshDevices();case 35:return e.abrupt("return",a);case 36:case"end":return e.stop()}}),e,this)}))),function(){return a.apply(this,arguments)})},{key:"enumerateDevices",value:(o=Sm(gm().mark((function e(){var t,r,n,i;return gm().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",Hk(Im(t=[]).call(t,Kk(ZI(r=this.deviceMap.audioinput).call(r)),Kk(ZI(n=this.deviceMap.videoinput).call(n)),Kk(ZI(i=this.deviceMap.audiooutput).call(i)))));case 5:case"end":return e.stop()}}),e,this)}))),function(){return o.apply(this,arguments)})},{key:"enumerateAudioCaptureDevices",value:(i=Sm(gm().mark((function e(){var t;return gm().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",Hk(ZI(t=this.deviceMap.audioinput).call(t)));case 5:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"enumerateVideoCaptureDevices",value:(n=Sm(gm().mark((function e(){var t;return gm().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",Hk(ZI(t=this.deviceMap.videoinput).call(t)));case 5:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"enumerateAudioPlaybackDevices",value:(r=Sm(gm().mark((function e(){var t;return gm().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",Hk(ZI(t=this.deviceMap.audiooutput).call(t)));case 5:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"getDeviceById",value:(t=Sm(gm().mark((function e(t){var r;return gm().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",yb(r).call(r,(function(e){return e.deviceId===t})));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})}]),f}(IC),_U=new vU;!aw()&&(window.__rtc_dd__=_U);var mU=function(){function e(){Kd(this,e),od(this,"_audioContextInstance",void 0)}return zd(e,[{key:"getAudioContextInstance",value:function(){if(!this._audioContextInstance){var e=window.AudioContext||window.webkitAudioContext;this._audioContextInstance=new e}return this._audioContextInstance}}]),e}(),gU=function(){function e(t){Kd(this,e),od(this,"_ctx",void 0),od(this,"_analyserNode",void 0),od(this,"_audioSource",void 0);var r=yU.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 zd(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;t.forEach((function(e){return r=Math.max(r,Math.abs(e-128))}));var n=r/128*255;return n>2?n:0}},{key:"resume",value:(t=Sm(gm().mark((function e(){var t;return gm().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}(),yU=new mU,SU=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}(SU||{}),EU=function(){function e(){Kd(this,e),od(this,"_plugins",new aE),od(this,"_monitor",void 0)}var t;return zd(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(zR(t).call(t,(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){var r;return yb(r=this._plugins.get(e)||[]).call(r,(function(e){return e.name===t}))}},{key:"getPreProcessingTrack",value:(t=Sm(gm().mark((function e(t){var r,n,i,o,a;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=this._plugins.get(1)||[],n=t.getTrack(),i=qT(r),e.prev=3,i.s();case 5:if((o=i.n()).done){e.next=12;break}return a=o.value,e.next=9,a.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}(),bU=function(e){return e[e.EXTERNAL=0]="EXTERNAL",e[e.INTERNAL=1]="INTERNAL",e}(bU||{}),kU=new bC("VERTC",0),TU=new pU,IU=function(e){AI(r,e);var t=zI(r);function r(e,n){var i;return Kd(this,r),od(YT(i=t.call(this)),"sourceType",1),od(YT(i),"mediaType",void 0),od(YT(i),"_trackId",void 0),i._trackId=e,i.mediaType=n,i}return zd(r,[{key:"getId",value:function(){return this._trackId}}]),r}(IC),RU=function(e){AI(n,e);var t,r=zI(n);function n(e,t,i){var o;return Kd(this,n),od(YT(o=r.call(this,t,i)),"_mediaTrack",void 0),od(YT(o),"_preProcessingTrack",void 0),od(YT(o),"handleTrackEnded",(function(){Wx.rtcError("track-ended mediaType: ".concat(o._mediaTrack.kind),-1001),o.emit("track-ended",YT(o))})),o._mediaTrack=e,o._initListeners(),o}return zd(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=Sm(gm().mark((function e(t){var r;return gm().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}(IU),AU=function(e){AI(r,e);var t=zI(r);function r(e,n,i){var o;return Kd(this,r),od(YT(o=t.call(this,n,i)),"_mediaTrack",void 0),o._mediaTrack=e,o}return zd(r,[{key:"getTrack",value:function(){return this._mediaTrack}}]),r}(IU),wU=function(e){AI(n,e);var t,r=zI(n);function n(e,t){var i;return Kd(this,n),od(YT(i=r.call(this,e,t,"video")),"resolution",void 0),od(YT(i),"dummy",!1),i.resolution={width:0,height:0},i}return zd(n,[{key:"updateVideoCaptureConfig",value:(t=Sm(gm().mark((function e(t){var r,n;return gm().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 kU.print("updateVideoEncoderConfig","update localVideoTrack: ",t),delete(r=sd({},t)).contentHint,uw&&(r.frameRate={ideal:30,max:30}),e.next=8,this.getTrack().applyConstraints(r);case 8:((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 10: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){var t;this._mediaTrack&&"contentHint"in this._mediaTrack&&Wm(t=["text","motion","detail"]).call(t,e)&&(this._mediaTrack.contentHint=e)}}]),n}(RU),CU=function(e){AI(n,e);var t,r=zI(n);function n(e,t){var i;return Kd(this,n),od(YT(i=r.call(this,e,t,"audio")),"audioCaptureConfig",void 0),od(YT(i),"_audioLevelFetcher",void 0),od(YT(i),"mixedAudioTrack",void 0),od(YT(i),"mixType",Fd.PLAYOUT_AND_PUBLISH),i}return zd(n,[{key:"getAudioLevel",value:function(){return this._audioLevelFetcher||(this._audioLevelFetcher=new gU(this.getTrack("preprocessing"))),this._audioLevelFetcher.getAudioLevel()}},{key:"updateAudioCaptureConfig",value:(t=Sm(gm().mark((function e(){var t;return gm().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 kU.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}(RU),OU=function(e){AI(r,e);var t=zI(r);function r(e,n){return Kd(this,r),t.call(this,e,n,"video")}return zd(r)}(AU),DU=function(e){AI(r,e);var t=zI(r);function r(e,n){var i;return Kd(this,r),od(YT(i=t.call(this,e,n,"audio")),"_audioLevelFetcher",void 0),i}return zd(r,[{key:"getAudioLevel",value:function(){return this._audioLevelFetcher||(this._audioLevelFetcher=new gU(this.getTrack())),this._audioLevelFetcher.getAudioLevel()}}]),r}(AU),xU=function(e){AI(r,e);var t=zI(r);function r(){var e,n;Kd(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return od(YT(n=t.call.apply(t,Im(e=[this]).call(e,o))),"streamIndex",md.STREAM_INDEX_MAIN),n}return zd(r)}(CU),NU=function(e){AI(r,e);var t=zI(r);function r(){var e,n;Kd(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return od(YT(n=t.call.apply(t,Im(e=[this]).call(e,o))),"streamIndex",md.STREAM_INDEX_MAIN),n}return zd(r)}(wU),PU=function(e){AI(r,e);var t=zI(r);function r(){var e,n;Kd(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return od(YT(n=t.call.apply(t,Im(e=[this]).call(e,o))),"streamIndex",md.STREAM_INDEX_MAIN),od(YT(n),"sourceType",0),n}return zd(r)}(wU),MU=function(e){AI(r,e);var t=zI(r);function r(){var e,n;Kd(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return od(YT(n=t.call.apply(t,Im(e=[this]).call(e,o))),"streamIndex",md.STREAM_INDEX_MAIN),od(YT(n),"sourceType",0),n}return zd(r)}(CU),LU=function(e){AI(r,e);var t=zI(r);function r(){var e,n;Kd(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return od(YT(n=t.call.apply(t,Im(e=[this]).call(e,o))),"streamIndex",md.STREAM_INDEX_SCREEN),n}return zd(r)}(wU),UU=function(e){AI(r,e);var t=zI(r);function r(){var e,n;Kd(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return od(YT(n=t.call.apply(t,Im(e=[this]).call(e,o))),"streamIndex",md.STREAM_INDEX_SCREEN),n}return zd(r)}(CU),VU=function(e){AI(r,e);var t=zI(r);function r(){var e,n;Kd(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return od(YT(n=t.call.apply(t,Im(e=[this]).call(e,o))),"streamIndex",md.STREAM_INDEX_SCREEN),od(YT(n),"sourceType",0),n}return zd(r)}(wU),FU=function(e){AI(r,e);var t=zI(r);function r(){var e,n;Kd(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return od(YT(n=t.call.apply(t,Im(e=[this]).call(e,o))),"streamIndex",md.STREAM_INDEX_SCREEN),od(YT(n),"sourceType",0),n}return zd(r)}(CU);function BU(e,t){return jU.apply(this,arguments)}function jU(){return(jU=Sm(gm().mark((function e(t,r){var n;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=new NU(t,nw())).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 GU(e,t){return HU.apply(this,arguments)}function HU(){return(HU=Sm(gm().mark((function e(t,r){var n;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=new LU(t,nw())).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 zU(e,t){return KU.apply(this,arguments)}function KU(){return(KU=Sm(gm().mark((function e(t,r){var n,i,o,a,s,c,u;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=(null==t||null===(n=t.deviceId)||void 0===n?void 0:n.exact)||"default",e.prev=1,kU.print("createCameraVideoTrack","constraints:",t),Wx.rtcVideoCaptureEvent({event_type:zx.START,media_device_id:o}),a=iw(),uw&&(t.frameRate={ideal:30,max:30}),e.next=8,_U.getUserMedia({video:t});case 8:i=e.sent,Wx.rtcVideoCaptureEvent({event_type:zx.START_CAPTURE_RESULT,media_device_id:o,reason:Kx.SUCCESS,elapse:iw()-a}),e.next=16;break;case 12:throw e.prev=12,e.t0=e.catch(1),Wx.rtcVideoCaptureEvent({event_type:zx.RUNNING_FAILED,media_device_id:o,error_code:e.t0.code,reason:e.t0.name+e.t0.message}),new cA(aA.GET_VIDEO_TRACK_FAILED,Im(s="throw error from getUserMedia. [".concat(e.t0.name||"unknown name","]: ")).call(s,e.t0.message||"unknown message","."),e.t0);case 16:return c=i.getVideoTracks()[0],TU.set(c,i),u=new NU(c,nw()),e.next=21,u.generatePreProcessingTrack(r);case 21:return e.abrupt("return",u);case 22:case"end":return e.stop()}}),e,null,[[1,12]])})))).apply(this,arguments)}function XU(e,t){return qU.apply(this,arguments)}function qU(){return(qU=Sm(gm().mark((function e(t,r){var n,i,o,a,s,c,u;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return kU.print("createMicrophoneAudioTrack","constraints:",t),o=(null==t||null===(n=t.deviceId)||void 0===n?void 0:n.exact)||"default",e.prev=2,Wx.rtcVideoCaptureEvent({event_type:zx.START,media_device_id:o}),a=iw(),r.getPluginByName(SU.PRE_PROCESSING,"RTCAIAnsExtension")&&(t.autoGainControl=!0,t.noiseSuppression=!1),e.next=8,_U.getUserMedia({audio:t});case 8:i=e.sent,Wx.rtcVideoCaptureEvent({event_type:zx.START_CAPTURE_RESULT,media_device_id:o,reason:Kx.SUCCESS,elapse:iw()-a}),e.next=16;break;case 12:throw e.prev=12,e.t0=e.catch(2),Wx.rtcVideoCaptureEvent({event_type:zx.RUNNING_FAILED,media_device_id:o,error_code:e.t0.code,reason:e.t0.name+e.t0.message}),new cA(aA.GET_AUDIO_TRACK_FAILED,Im(s="throw error from getUserMedia. [".concat(e.t0.name||"unknown name","]: ")).call(s,e.t0.message||"unknown message","."),e.t0);case 16:return c=i.getAudioTracks()[0],TU.set(c,i),u=new xU(c,nw()),e.next=21,u.generatePreProcessingTrack(r);case 21:return e.abrupt("return",u);case 22:case"end":return e.stop()}}),e,null,[[2,12]])})))).apply(this,arguments)}function WU(){return YU.apply(this,arguments)}function YU(){return YU=Sm(gm().mark((function e(){var t,r,n,i,o,a,s,c,u,d=arguments;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=d.length>0&&void 0!==d[0]&&d[0],r=d.length>1?d[1]:void 0,n=d.length>2?d[2]:void 0,kU.print("createScreenTracks","withAudio: %o, constraints: %o",t,n),e.prev=4,Wx.rtcVideoCaptureEvent({event_type:zx.START,media_device_id:"screen"}),o=iw(),e.next=9,navigator.mediaDevices.getDisplayMedia({video:!(n&&(!dw||16!==pw))||n,audio:!!t&&{channelCount:2,noiseSuppression:!1,echoCancellation:!1,autoGainControl:!1}});case 9:i=e.sent,Wx.rtcVideoCaptureEvent({event_type:zx.START_CAPTURE_RESULT,media_device_id:"screen",reason:Kx.SUCCESS,elapse:iw()-o}),e.next=17;break;case 13:throw e.prev=13,e.t0=e.catch(4),Wx.rtcVideoCaptureEvent({event_type:zx.RUNNING_FAILED,media_device_id:"screen",error_code:e.t0.code,reason:e.t0.name+e.t0.message}),new cA(aA.GET_SCREEN_TRACK_FAILED,"throw error from getDisplayMedia",e.t0);case 17:return a=i.getVideoTracks()[0],s=new LU(a,nw()),e.next=21,s.generatePreProcessingTrack(r);case 21:if(!(c=i.getAudioTracks()[0])){e.next=27;break}return u=new UU(c,nw()),e.next=26,u.generatePreProcessingTrack(r);case 26:return e.abrupt("return",[s,u]);case 27:return e.abrupt("return",[s,void 0]);case 28:case"end":return e.stop()}}),e,null,[[4,13]])}))),YU.apply(this,arguments)}function QU(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:nw();return new DU(e,t)}function JU(e,t){return ZU.apply(this,arguments)}function ZU(){return(ZU=Sm(gm().mark((function e(t,r){var n;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new PU(t,nw()),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 $U(e,t){return eV.apply(this,arguments)}function eV(){return(eV=Sm(gm().mark((function e(t,r){var n;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new MU(t,nw()),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 tV(e,t){return rV.apply(this,arguments)}function rV(){return(rV=Sm(gm().mark((function e(t,r){var n;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new VU(t,nw()),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 nV(e,t){return iV.apply(this,arguments)}function iV(){return(iV=Sm(gm().mark((function e(t,r){var n;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new FU(t,nw()),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 oV=CU,aV=function(e){return e[e.NONE=0]="NONE",e}(aV||{}),sV=function(){function e(){Kd(this,e)}return zd(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,s,c=new Uint8Array(mm(a=t.buffer).call(a,i,i+n.headerLength));n.pos===t.position&&t.skip(n.headerLength),o=(n=e.getHeaderPositionAnnexB(t)).pos;var u={header:c,body:new Uint8Array(mm(s=t.buffer).call(s,i+c.byteLength,o)),type:-1};e.analyseNal(u),u.type<=9&&0!==u.type&&r.push(u),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,o,a=new Uint8Array(mm(i=t.buffer).call(i,t.position,t.position+4));t.skip(4);var s=new Uint8Array(mm(o=t.buffer).call(o,t.position,t.position+n));t.skip(n);var c={header:a,body:s,type:-1};e.analyseNal(c),c.type<=9&&0!==c.type&&r.push(c)}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}(),cV=function(){function e(t){Kd(this,e),od(this,"_position",0),od(this,"_dataview",void 0),this._dataview=new DataView(t)}return zd(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}(),uV=function(e){return e[e.internal=0]="internal",e[e.external=1]="external",e[e.bypass=2]="bypass",e}(uV||{}),dV=new Uint8Array([109,167,53,190,103,90,72,1,170,89,63,164,194,199,19,85]),lV=new Uint8Array([109,167,53,190,103,90,72,1,170,89,63,164,194,199,19,84]),hV=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 fV(e){for(var t=[];e>=255;)e-=255,t.push(255);return t.push(e),new Uint8Array(t)}function pV(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 vV=function(){function e(){Kd(this,e)}return zd(e,null,[{key:"generateSEI",value:function(e){var t,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=new Uint8Array([0,0,0,1]),i=new Uint8Array([6]),o=new Uint8Array([5]),a=r?dV:lV,s=fV(e.byteLength+a.byteLength),c=hV(e);return new Uint8Array(Im(t=[]).call(t,Kk(n),Kk(i),Kk(o),Kk(s),Kk(a),Kk(c),[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=mm(e).call(e,0,e.length-1));if(!(t.byteLength<2)){var r=0;if(5===t[1]||100===t[1]){var n=WT(pV(t,r+=2),2),i=n[0],o=2,a=(r=n[1])+i;return t.byteLength>=lV.byteLength&&i>=lV.byteLength&&mm(t).call(t,r,r+lV.byteLength).toString()===lV.toString()?(r+=lV.byteLength,o=1):t.byteLength>=lV.byteLength&&i>=lV.byteLength&&mm(t).call(t,r,r+dV.byteLength).toString()===dV.toString()&&(r+=dV.byteLength,o=0),{type:o,payload:mm(t).call(t,r,a)}}}}},{key:"parseInternalSEI",value:function(e){var t=new aE,r=0;if(0===e.type){for(;e.payload.byteLength-r>=2;){var n=WT(pV(e.payload,r),2),i=n[0];r=n[1];var o,a=WT(pV(e.payload,r),2),s=a[0];if(r=a[1],t.get(i)||!(s<=e.payload.byteLength-r))break;t.set(i,mm(o=e.payload).call(o,r,r+s)),r+=s}return t}}},{key:"makeInternalSei",value:function(e){var t,r=[],n=qT(e);try{for(n.s();!(t=n.n()).done;){var i=WT(t.value,2),o=i[0],a=i[1],s=fV(o),c=fV(a.byteLength);r.push(s,c,a)}}catch(l){n.e(l)}finally{n.f()}var u=EE(r).call(r,(function(e,t){return e+t.byteLength}),0),d=new Uint8Array(u);return EE(r).call(r,(function(e,t){return d.set(t,e),e+t.byteLength}),0),d}}]),e}(),_V=function(){function e(t){Kd(this,e),od(this,"player",void 0),od(this,"_stream",void 0),od(this,"_timer",void 0),od(this,"client",void 0),od(this,"handler",void 0),od(this,"monitor",void 0),this._stream=t}return zd(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 an(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}(),mV=function(e){AI(i,e);var t,r,n=zI(i);function i(e){var t;return Kd(this,i),od(YT(t=n.call(this,e)),"_context",void 0),t._stream=e,t}return zd(i,[{key:"setLocalStreamStatsEvtInterval",value:function(e,t,r,n){var i,o,a,s=this;if(!this._timer){this.setVar(e,t,r),this._context=n,e.once(CN.ABNORMAL_DISCONNECTION,(function(){s.destroy()}));var c={audio:{},video:{}},u=this._stream,d=null===(i=u.audioTrack)||void 0===i?void 0:i.getTrack("preprocessing"),l=null===(o=u.videoTrack)||void 0===o?void 0:o.getTrack("preprocessing");this.getAudioStats(d,c,null===(a=u.audioTrack)||void 0===a?void 0:a.getAudioLevel()),this.getVideoStats(l,c),this.delStatsEvtInterval();var h=function(){var e=Sm(gm().mark((function e(){var t,r,n,i,o,a,d;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=null===(t=u.audioTrack)||void 0===t?void 0:t.getTrack("preprocessing"),o=null===(r=u.videoTrack)||void 0===r?void 0:r.getTrack("preprocessing"),e.next=4,s.getAudioStats(i,c,null===(n=u.audioTrack)||void 0===n?void 0:n.getAudioLevel());case 4:return a=e.sent,e.next=7,s.getVideoStats(o,c);case 7:return d=e.sent,e.abrupt("return",{audioStats:a,videoStats:d,isScreen:u.isScreen});case 9:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),f=function(){var e=Sm(gm().mark((function e(){var t,r;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,h();case 2:r=e.sent,null===(t=s.client)||void 0===t||t.emit("onLocalStreamStats",r),s._timer&&clearTimeout(s._timer),s._timer=setTimeout(f,2e3);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();this._timer&&clearTimeout(this._timer),this._timer=setTimeout(f,2e3)}}},{key:"unpublish",value:function(){this.delStatsEvtInterval()}},{key:"getAudioStats",value:(r=Sm(gm().mark((function e(t,r,n){var i,o,a,s,c,u,d,l,h,f,p;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i={},o={timestamp:Date.now()},a=this._stream,s=a.streamId,c=a.audioMid,u=a.isScreen,d=a.pubAttributes,l=a.pubAudio,h={media_type:"audio",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.localaudio?"capture_state_on":"capture_state_off",mute_state:l?"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((f=e.sent).length){e.next=11;break}return e.abrupt("return",i);case 11:if(f.forEach((function(e){var t=e.type,r=e.packetsSent,n=e.packetsLost,a=e.bytesSent,s=e.clockRate,c=e.roundTripTime,u=e.channels,d=e.audioLevel;e.googRtt;var l=e.mimeType,f=e.availableIncomingBitrate,p=e.availableOutgoingBitrate,v=e.bytesReceived,_=e.nominated,m=e.id,g=e.currentRoundTripTime,y=e.state,S=e.writable,E=e.requestsReceived,b=e.responsesReceived,k=e.requestsSent,T=e.consentRequestsSent,I=e.responsesSent,R=e.jitter,A=e.candidateType,w=e.ip,C=e.address,O=e.networkType,D=e.port,x=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?(o.packetsSent=r,o.bytesSent=a,h.bytes=a,h.packetsSent=r,h.nackCount=N,h.ssrc=U,h.retransmitted_bytes_sent=P,h.retransmitted_packets_sent=M,o.retransmittedBytesSent=P,o.retransmittedPacketsSent=M):"remote-inbound-rtp"===t?(o.packetsLost=n,h.packetsLost=n,h.net_jitter=1e3*R,i.rtt=1e3*c,h.rtt=i.rtt,i._fractionLost=j||0):"codec"===t?(i.recordSampleRate=s,i.numChannels=u,h.codecName=l):"media-source"===t&&void 0!==d?(h.audio_level=d?-10*zA(Math.pow(d,2)):d,h.volume=255*d,h.total_audio_energy=V,h.totalInputDuration=F):"ssrc"===t&&"audio"===B?h.send_level=L:"candidate-pair"===t?(h.ice_available_incoming_bitrate=f,h.ice_available_outgoing_bitrate=p,h.ice_bytes_received=v,h.ice_bytes_sent=a,h.ice_nominated=+_,h.ice_pair_id=m,h.ice_pair_rtt=g,h.ice_pair_state=y,h.ice_pair_writable=S,h.recv_ping_requests=E,h.recv_ping_responses=b,h.sent_ping_requests_before_first_response=k,h.sent_ping_requests_total=k+(T||0),h.sent_ping_responses=I):"local-candidate"===t?(h.local_candidate_type=A,h.local_ip=w||C,h.local_network_type=O,h.local_port=D,h.protocol=x):"remote-candidate"===t&&(h.remote_candidate_type=A,h.remote_ip=w||C,h.remote_port=D)})),void 0===h.volume&&void 0!==n&&(h.volume=n,h.audio_level=n?-10*zA(Math.pow(n/255,2)):n),(p=r.audio).timestamp){e.next=17;break}return r.audio=o,e.abrupt("return",this.filterIllegal(i));case 17:return void 0!==o.packetsLost&&(i.audioLossRate=(o.packetsLost-p.packetsLost)/(o.packetsSent-p.packetsSent),i.audioLossRate=Number.isNaN(i.audioLossRate)?0:i.audioLossRate,h.fraction_lost=i.audioLossRate),i.statsInterval=o.timestamp-p.timestamp,h.stats_interval=i.statsInterval,i.sendKBitrate=(o.bytesSent-p.bytesSent||0)/i.statsInterval*8,h.mediaBitratebps=Math.round(1e3*i.sendKBitrate),h.bandwidth=Math.round(h.mediaBitratebps/1024),void 0!==o.retransmittedBytesSent&&(h.retransmitBitratebps=(o.retransmittedBytesSent-p.retransmittedBytesSent||0)/i.statsInterval),r.audio=o,this.monitor.rtcMediaStatistics(h,{}),i._retransmittedRate=(o.retransmittedPacketsSent-p.retransmittedPacketsSent)/(o.packetsSent-p.packetsSent),void 0===i.audioLossRate&&(i.audioLossRate=i._retransmittedRate,h.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=Sm(gm().mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h,f,p,v,_,m,g,y,S;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o={},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",o);case 6:return p.cap_frame_width=t.getSettings().width,p.cap_frame_height=t.getSettings().height,o.isScreen=d,e.next=11,this.handler.getStats(t);case 11:if((v=e.sent).length){e.next=14;break}return e.abrupt("return",o);case 14:if(null===(n=this.monitor)||void 0===n||n.rtcInvokeStatus(Im(i="reports.length: ".concat(v.length,"; videoTrack: ")).call(i,t.id),0,"get_video_stats",c||"",0),_=0,v.forEach((function(e){var t=e.type,r=e.framesEncoded,n=e.packetsLost,i=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,g=e.googAvailableSendBandwidth,y=e.googAvgEncodeMs,S=e.googBucketDelay,E=e.googEncodeUsagePercent,b=e.googFrameRateInput,k=e.availableIncomingBitrate,T=e.availableOutgoingBitrate,I=e.bytesReceived,R=e.nominated,A=e.id,w=e.currentRoundTripTime,C=e.state,O=e.writable,D=e.candidateType,x=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,K=e.responsesSent,X=e.ssrc,q=e.googTargetEncBitrate,W=e.googTransmitBitrate,Y=e.retransmittedPacketsSent,Q=e.encoderImplementation,J=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=i||a.bytesSent||0,a.framesSent=s||a.framesSent||0,p.bytes=i||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=X||p.ssrc||0,p.retransmitted_packets_sent=Y,a.retransmittedPacketsSent=Y,p.encoder_implementation=Q,p.qualityLimitationReason=te,p.qualityLimitationDurations=re,void 0!==d&&((!o.encodedFrameWidth||d>o.encodedFrameWidth)&&(o.encodedFrameWidth=d),(!o.encodedFrameHeight||l>o.encodedFrameHeight)&&(o.encodedFrameHeight=l),p.frame_size_height=l,p.frame_size_width=d)):"track"===t?(o.encodedFrameWidth=d,o.encodedFrameHeight=l,p.frame_size_height=l,p.frame_size_width=d):"remote-inbound-rtp"===t?(a.packetsLost=n,o.rtt=1e3*c,p.rtt=o.rtt,p.jitter=J,p.packetsLost=n,o._fractionLost=$||0):"codec"===t?(o.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=i,p.ice_nominated=+R,p.ice_pair_id=A,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=K):"local-candidate"===t?(p.local_candidate_type=D,p.local_ip=x||N,p.local_network_type=P,p.local_port=M,p.protocol=V):"remote-candidate"===t?(p.remote_candidate_type=D,p.remote_ip=x||N,p.remote_port=M):"VideoBwe"===t?(p.encBitratebps=v,p.available_receive_bandwidth=m,p.available_send_bandwidth=g,p.bucket_delay=S,p.retransmitBitratebps=G,p.targetEncBitratebps=q,p.transmit_bitrate=W,o._sendBandWidth=+g):"ssrc"===t&&(p.avg_encode_ms=y,p.encodeUsage=E,p.frame_rate_input=b,p.orignal_input_Framerate=+b,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(o));case 21:return o.statsInterval=a.timestamp-m.timestamp,p.stats_interval=o.statsInterval,g=an(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=(null===(y=this._context)||void 0===y?void 0:y.activeSimStreams)||[],p.sim_retransmittedRate=[],S=!1,MR(g).call(g,(function(e,t){return+e-+t})).forEach((function(e){var t=a.simulcast[e],r=t.frameWidth,n=t.frameHeight,i=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,g=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 y=m.simulcast[e];if(p.sim_enc_width.push(r||0),p.sim_enc_height.push(n||0),p.sim_enc_key_frames.push(g||0),y){var E=(i-y.bytesSent||0)/o.statsInterval;p.sim_enc_bps.push(Math.round(8e3*E)),p.sim_enc_bandwidth.push(Math.round(8e3*E/1024));var b=1e3*(s-y.framesEncoded)/o.statsInterval;p.sim_enc_framerate.push(Math.round(b)),p.sim_rids.push(e);var k=void 0!==c?c-y.framesSent:s-y.framesEncoded,T=1e3*k/o.statsInterval;p.sim_sent_framerate.push(Math.round(T));var I=(u-y.packetsLost)/(d-y.packetsSent);o._retransmittedRate=(v-y.retransmittedPacketsSent)/(d-y.packetsSent),I=Number.isNaN(I)?0:I,p.sim_fraction_lost.push(I),p.sim_keyencoded.push(_-y.pliCount>0),p.sim_retransmittedRate.push(o._retransmittedRate),r>0&&!S&&(o.sentKBitrate=8*E,o.encoderOutputFrameRate=b,o.encodedFrameCount=k,o.sentFrameRate=T,o.videoLossRate=I,S=!0)}})),this.monitor.rtcMediaStatistics(p,{})):(o.encodedFrameCount=void 0!==a.framesSent?a.framesSent-m.framesSent:a.framesEncoded-m.framesEncoded,o.sentKBitrate=(a.bytesSent-m.bytesSent||0)/o.statsInterval*8,p.bitrate=Math.round(1e3*o.sentKBitrate),p.bandwidth=Math.round(p.bitrate/1024),o.encoderOutputFrameRate=1e3*(a.framesEncoded-m.framesEncoded)/o.statsInterval,p.frame_rate_encoded=Math.round(o.encoderOutputFrameRate),o.sentFrameRate=1e3*o.encodedFrameCount/o.statsInterval,p.frame_rate_sent=Math.round(o.sentFrameRate),o.videoLossRate=(a.packetsLost-m.packetsLost)/(a.packetsSent-m.packetsSent),o.videoLossRate=Number.isNaN(o.videoLossRate)?0:o.videoLossRate,p.fraction_lost=o.videoLossRate,o._retransmittedRate=(a.retransmittedPacketsSent-m.retransmittedPacketsSent)/(a.packetsSent-m.packetsSent),this.monitor.rtcMediaStatistics(p,{})),r.video=a,o._fractionLost=Math.max(o._fractionLost,o.videoLossRate),e.abrupt("return",this.filterIllegal(o));case 28:case"end":return e.stop()}}),e,this)}))),function(e,r){return t.apply(this,arguments)})}]),i}(_V),gV=function(e){AI(o,e);var t,r,n,i=zI(o);function o(e){var t;return Kd(this,o),od(YT(t=i.call(this,e)),"isPaused",void 0),od(YT(t),"pauseStart",void 0),od(YT(t),"pauseDuration",void 0),od(YT(t),"_audioStallCount",void 0),od(YT(t),"_setAudioStallCount",void 0),od(YT(t),"_audioStallTimer",void 0),od(YT(t),"_audioStallInterval",void 0),od(YT(t),"_audioStallRatio",void 0),od(YT(t),"_videoInWaiting",void 0),od(YT(t),"_context",void 0),t._videoInWaiting=!1,t.pauseDuration=0,t}return zd(o,[{key:"setRemoteStreamStatsEvtInterval",value:(n=Sm(gm().mark((function e(t,r,n,i){var a,s,c,u,d,l,h,f,p,v,_,m,g,y,S=this;return gm().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(CN.ABNORMAL_DISCONNECTION,(function(){S.destroy()})),this._audioStallInterval=o.audioStallInterval||100,this._audioStallRatio=o.audioStallRatio||.6,c={audio:{},video:{}},u=this._stream,d=null===(a=u.audioTrack)||void 0===a?void 0:a.getTrack(),l=null===(s=u.videoTrack)||void 0===s?void 0:s.getTrack(),this.getRemoteVideoStats(l,c),e.next=14,this.getRemoteAudioStats(d,c);case 14:this.delStatsEvtInterval(),h=0,f=0,v=[],_=0,m=iw(),this._setAudioStallCount=function(){if(S._audioStallInterval>0&&void 0!==c.audio.concealedSamples){var e=c.audio.concealedSamples,t=c.audio.totalSamplesReceived;m=iw();var r={isStall:!1,counted:!1,diff:0},n=.5*S._audioStallInterval;S._audioStallCount=Sm(gm().mark((function i(){var o,a,s,c,d,l,p,g,y,E,b,k,T,I,R,A,w;return gm().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(a=u.hasAudio,s=u.subAudio,a&&s){i.next=7;break}return r.isStall=!1,r.counted=!1,v.push({reason:Im(c="hasAudio: ".concat(a,", subAudio: ")).call(c,s)}),m=iw(),i.abrupt("return",{stall_count:h,stall_duration:f,stall_list:v,stats_count:_});case 7:return d=null===(o=u.audioTrack)||void 0===o?void 0:o.getTrack(),l=Date.now(),i.next=11,S.handler.getStats(d,!0);case 11:if(p=i.sent,g=Date.now(),y=iw(),!((E=y-m)<n)){i.next=18;break}return v.push({diff:E,start:m,end:y,get_stats_cost:g-l,get_stats_start:l,get_stats_end:g,reason:Im(b="diff(".concat(E,") < minInterval(")).call(b,n,")")}),i.abrupt("return",{stall_count:h,stall_duration:f,stall_list:v,stats_count:_});case 18:if(k=p.length,T=yb(p).call(p,(function(e){return"inbound-rtp"===e.type}))){i.next=23;break}return v.push({diff:E,start:m,end:y,get_stats_cost:g-l,get_stats_start:l,get_stats_end:g,reason:k?"no inbound-rtp":"no report"}),i.abrupt("return",{stall_count:h,stall_duration:f,stall_list:v,stats_count:_});case 23:return I=T.concealedSamples,R=T.totalSamplesReceived,w=R-t,(A=I-e)>=0&&w>=0&&A>=S._audioStallRatio*w?(v.push({concealed:A,received:w,diff:E,start:m,end:y,get_stats_cost:g-l,get_stats_start:l,get_stats_end:g,is_stall:!0}),r.isStall?(r.counted?f+=E:(f=f+r.diff+E,h++),r.counted=!0):E>=200?(f+=E,h++,r.counted=!0):(r.counted=!1,r.diff=E),r.isStall=!0):(v.push({concealed:A,received:w,diff:E,start:m,end:y,get_stats_cost:g-l,get_stats_start:l,get_stats_end:g}),r.isStall=!1,r.counted=!1),e=I,t=R,m=y,_++,i.abrupt("return",{stall_count:h,stall_duration:f,stall_list:v,stats_count:_});case 32:case"end":return i.stop()}}),i)}))),p=function(){var e=Sm(gm().mark((function e(){return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!S._audioStallCount&&S._setAudioStallCount&&S._setAudioStallCount(),!S._audioStallCount){e.next=6;break}return e.next=4,S._audioStallCount();case 4:S._audioStallTimer&&clearTimeout(S._audioStallTimer),S._audioStallTimer=setTimeout(p,S._audioStallInterval);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),S._audioStallTimer&&clearTimeout(S._audioStallTimer),S._audioStallTimer=setTimeout(p,S._audioStallInterval)}},this._setAudioStallCount(),g=function(){var e=Sm(gm().mark((function e(){var t,r,n,i,o,a;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=null===(t=u.audioTrack)||void 0===t?void 0:t.getTrack(),i=null===(r=u.videoTrack)||void 0===r?void 0:r.getTrack(),e.next=4,S.getRemoteAudioStats(n,c);case 4:return o=e.sent,h=0,f=0,v=[],_=0,e.next=11,S.getRemoteVideoStats(i,c);case 11:return a=e.sent,e.abrupt("return",{audioStats:o,videoStats:a,isScreen:u.isScreen,userId:u.userId});case 13:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),y=function(){var e=Sm(gm().mark((function e(){var t,r;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,g();case 2:r=e.sent,null===(t=S.client)||void 0===t||t.emit("onRemoteStreamStats",r),p&&(m=iw(),S._audioStallTimer&&clearTimeout(S._audioStallTimer),S._audioStallTimer=setTimeout(p,S._audioStallInterval)),S._timer&&clearTimeout(S._timer),S._timer=setTimeout(y,2e3);case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),this._timer&&clearTimeout(this._timer),this._timer=setTimeout(y,2e3);case 26:case"end":return e.stop()}}),e,this)}))),function(e,t,r,i){return n.apply(this,arguments)})},{key:"delStatsEvtInterval",value:function(){II(kI(o.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=Sm(gm().mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h,f,p,v,_,m,g,y,S,E,b=this;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n={},i={},o=this._stream,a=o.streamId,s=o.userId,c=o.isScreen,u=o.audioMid,d=o.subMediaType,l=o._attributes,h=o.virtual,f={media_type:"audio",is_screen:!!c,direction:"down",stream_id:a,stream_user_id:s,vid:u,audio_mux:h,connection_status:navigator.onLine,track_enabled:null==t?void 0:t.enabled,mute_state:ww(d)?"mute_state_off":"mute_state_on",remote_user_capture_state:l.localaudio?"capture_state_on":"capture_state_off",remote_user_mute_state:l.localaudio&&l.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((p=e.sent).length){e.next=11;break}return e.abrupt("return",n);case 11:if(p.forEach((function(e){var t=e.type,r=e.packetsLost,o=e.packetsReceived,s=e.bytesReceived,c=e.jitterBufferDelay,u=e.jitterBufferEmittedCount,d=e.clockRate,l=e.channels,h=e.totalSamplesReceived,p=e.concealedSamples,v=e.silentConcealedSamples,_=e.concealmentEvents,m=e.totalRoundTripTime,g=e.packetsDiscarded,y=e.state,S=e.currentRoundTripTime,E=e.audioLevel,k=e.totalAudioEnergy,T=e.totalSamplesDuration,I=e.mimeType,R=e.googDecodingNormal,A=e.googDecodingMuted,w=e.availableIncomingBitrate,C=e.availableOutgoingBitrate,O=e.bytesSent,D=e.nominated,x=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,K=e.consentRequestsSent,X=e.responsesSent,q=e.ssrc;e.kind;var W=e.nackCount,Y=e.lastPacketReceivedTimestamp,Q=e.concealmentevents,J=e.fecPacketsReceived;if("inbound-rtp"===t)i.packetsLost=r,i.packetsReceived=o,f.packetsReceived=o,f.packetsDiscarded=g,f.nackCount=W,f.lastPacketReceivedTimestamp=Y,f.concealmentevents=Q,i.bytesReceived=s,void 0!==c&&(n.jitterBufferDelay=c/u*1e3,f.average_jitter_buffer_delay_ms=n.jitterBufferDelay),void 0!==h&&(i.totalSamplesReceived=h,n.concealedSamples=p,i.concealedSamples=p,i.silentConcealedSamples=v,f.concealedSamples=p,n.concealmentEvents=_,f.totalSamplesReceived=h),void 0!==J&&(f.fec_packets_received=J,i.fecPacketsReceived=J),f.jitter=1e3*P,f.ssrc=q,void 0!==E&&(f.audio_level=E?-10*zA(Math.pow(E,2)):E),void 0!==E&&(f.volume=255*E),void 0!==k&&(f.total_audio_energy=k),void 0!==T&&(f.totalAudioDuration=T);else if("codec"===t)n.recordSampleRate=d,l&&(n.numChannels=l),f.codecName=I;else if("candidate-pair"===t){var Z,$,ee;f.ice_available_incoming_bitrate=w,f.ice_available_outgoing_bitrate=C,f.ice_bytes_received=s,f.ice_bytes_sent=O,f.ice_nominated=+D,f.ice_pair_id=x,f.ice_pair_rtt=S,f.rtt=1e3*S,f.rtt&&null!==(Z=b._context)&&void 0!==Z&&null!==($=Z.streamRTT)&&void 0!==$&&null!==(ee=$[a])&&void 0!==ee&&ee.audio&&(f.total_rtt_ms=f.rtt+b._context.streamRTT[a].audio),f.ice_pair_state=y,f.ice_pair_writable=N,f.recv_ping_requests=G,f.recv_ping_responses=H,f.sent_ping_requests_before_first_response=z,f.sent_ping_requests_total=z+(K||0),f.sent_ping_responses=X,"succeeded"===y&&(n.rtt=1e3*S,n.total_rtt=1e3*m)}else"track"===t&&void 0!==E?(f.audio_level=E?-10*zA(Math.pow(E,2)):E,f.volume=255*E,f.total_audio_energy=k,f.totalAudioDuration=T):"ssrc"===t?(f.decodingNormal=R,f.recvAudioLevel=j,f.decodingMuted=A):"local-candidate"===t?(f.local_candidate_type=M,f.local_ip=L||U,f.local_network_type=V,f.local_port=F,f.protocol=B):"remote-candidate"===t&&(f.remote_candidate_type=M,f.remote_ip=L||U,f.remote_port=F)})),(v=r.audio).timestamp){e.next=17;break}return i.timestamp=Date.now(),r.audio=i,e.abrupt("return",this.filterIllegal(n));case 17:if(_={},void 0!==i.concealedSamples&&(f.interval_concealed_samples=i.concealedSamples-v.concealedSamples,f.interval_samples_received=i.totalSamplesReceived-v.totalSamplesReceived,f.interval_silent_concealed_samples=i.silentConcealedSamples-v.silentConcealedSamples),!(this._audioStallInterval>0&&void 0!==v.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:m=e.sent,g=m.stall_count,y=m.stall_duration,S=m.stall_list,E=m.stats_count,_.stall_list=S,_.stats_count=E,f.concealedSamples===f.interval_concealed_samples&&f.totalSamplesReceived===f.interval_samples_received?(f.stall_count=0,f.stall_duration=0):(f.stall_count=g,f.stall_duration=y),n.stallCount=f.stall_count,n.stallDuration=f.stall_duration;case 35:return i.timestamp=Date.now(),n.audioLossRate=(i.packetsLost-v.packetsLost)/(i.packetsReceived-v.packetsReceived+(i.packetsLost-v.packetsLost)),n.audioLossRate=Number.isNaN(n.audioLossRate)?0:n.audioLossRate,f.packetsLost=Math.round(i.packetsLost-v.packetsLost),f.fraction_lost=n.audioLossRate,n.statsInterval=i.timestamp-v.timestamp,f.stats_interval=n.statsInterval,n.receivedKBitrate=(i.bytesReceived-v.bytesReceived||0)/n.statsInterval*8,f.bandwidth=Math.round(1e3*n.receivedKBitrate/1024),void 0!==i.concealedSamples&&(n.receivedSampleRate=1e3*f.interval_samples_received/n.statsInterval),void 0!==i.fecPacketsReceived&&(f.fecBitratebps=(i.fecPacketsReceived-v.fecPacketsReceived||0)/n.statsInterval),f.average_jitter_buffer_delay_ms&&f.total_rtt_ms&&(n.e2eDelay=f.average_jitter_buffer_delay_ms+f.total_rtt_ms),r.audio=i,this.monitor.rtcMediaStatistics(f,{},_),e.abrupt("return",this.filterIllegal(n));case 50:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"getRemoteVideoStats",value:(t=Sm(gm().mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h,f,p,v,_,m=this;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o={},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:Cw(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",o);case 6:return o.isScreen=d,e.next=9,this.handler.getStats(t);case 9:if(p=e.sent,null===(n=this.monitor)||void 0===n||n.rtcInvokeStatus(Im(i="reports.length: ".concat(p.length,"; videoTrack: ")).call(i,t.id),0,"get_remote_video_stats",c,0),p.length){e.next=13;break}return e.abrupt("return",o);case 13:if(p.forEach((function(e){var t=e.type,r=e.frameHeight,n=e.frameWidth,i=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,g=e.availableOutgoingBitrate,y=e.bytesSent,S=e.nominated,E=e.id,b=e.currentRoundTripTime,k=e.state,T=e.writable,I=e.candidateType,R=e.ip,A=e.address,w=e.networkType,C=e.port,O=e.nackCount,D=e.pliCount,x=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.totalDecodeTime,H=e.decoderImplementation,z=e.lastPacketReceivedTimestamp;if("inbound-rtp"===t)a.packetsLost=i,f.packetsLost=i,a.packetsReceived=s,f.packetsReceived=s,a.bytesReceived=u,f.bytes=u,a.framesDecoded=d,a.totalDecodeTime=G,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=D,f.ssrc=V,f.jitter=F,f.framesReceived=B,a.framesReceived=B,f.framesDecoded=d,f.key_frames_decoded=j,f.decoder_name=H,f.last_packet_received_timestamp=z,void 0!==n&&(o.width=n,f.frame_size_width=n,o.height=r,f.frame_size_height=r);else if("track"===t&&void 0!==n)o.width=n,f.frame_size_width=n,o.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 K,X,q;f.ice_available_incoming_bitrate=_,f.ice_available_outgoing_bitrate=g,f.ice_bytes_received=u,f.ice_bytes_sent=y,f.ice_nominated=+S,f.ice_pair_id=E,f.ice_pair_rtt=b,f.rtt=1e3*b,f.rtt&&null!==(K=m._context)&&void 0!==K&&null!==(X=K.streamRTT)&&void 0!==X&&null!==(q=X[c])&&void 0!==q&&q.video&&(f.total_rtt_ms=f.rtt+m._context.streamRTT[c].video),o.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=R||A,f.local_network_type=w,f.local_port=C,f.protocol=x):"remote-candidate"===t&&(f.remote_candidate_type=I,f.remote_ip=R||A,f.remote_port=C)})),(v=r.video).timestamp){e.next=18;break}return r.video=a,e.abrupt("return",this.filterIllegal(o));case 18:return o.videoLossRate=(a.packetsLost-v.packetsLost)/(a.packetsReceived-v.packetsReceived+(a.packetsLost-v.packetsLost)),v.totalDecodeTime&&v.framesDecoded&&a.framesDecoded!==v.framesDecoded&&(f.decode_elapse_per_frame=+((a.totalDecodeTime-v.totalDecodeTime)/(a.framesDecoded-v.framesDecoded)*1e3).toFixed(2)),o._retransmittedRate=(a.nackCount-v.nackCount)/(a.packetsReceived-v.packetsReceived+(a.packetsLost-v.packetsLost)),o.videoLossRate=Number.isNaN(o.videoLossRate)?0:o.videoLossRate,f.fraction_lost=o.videoLossRate,o.statsInterval=a.timestamp-v.timestamp,f.stats_interval=o.statsInterval,o.receivedKBitrate=(a.bytesReceived-v.bytesReceived||0)/o.statsInterval*8,f.bitrate=Math.round(1e3*o.receivedKBitrate),f.bandwidth=Math.round(f.bitrate/1024),o.decoderOutputFrameRate=1e3*(a.framesDecoded-v.framesDecoded)/o.statsInterval,o.receivedFrameRate=1e3*(a.framesReceived-v.framesReceived)/o.statsInterval,f.frame_rate_decoded=Math.round(o.decoderOutputFrameRate),f.frame_rate_received=Math.round(o.receivedFrameRate),f.average_jitter_buffer_delay_ms&&f.total_rtt_ms&&(o.e2eDelay=f.average_jitter_buffer_delay_ms+f.total_rtt_ms),r.video=a,this.processStall(this._stream,f,o,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.stuck_length||0,f.pause_duration),this.pauseDuration=0,this.monitor.rtcMediaStatistics(f,{}),e.abrupt("return",this.filterIllegal(o));case 40: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=Math.min(o,t.stats_interval),t.stall_duration=void 0):(t.stall_duration=Math.min(o,t.stats_interval),t.stuck_length=void 0),t.play_time=a,r.stallCount=i,r.stallDuration=o}},{key:"destroy",value:function(){II(kI(o.prototype),"destroy",this).call(this),this.delStatsEvtInterval(),this._videoInWaiting=!1}}],[{key:"audioStallConfig",set:function(e){o.audioStallInterval=((null==e?void 0:e.audio_stall_interval)||200)/2,o.audioStallRatio=null==e?void 0:e.audio_stall_ratio}}]),o}(_V);od(gV,"audioStallInterval",void 0),od(gV,"audioStallRatio",void 0);var yV,SV,EV,bV=new bC("Stream",0),kV=function(e){return e[e.INIT=0]="INIT",e[e.SUB_ING=1]="SUB_ING",e[e.SUB_ED=2]="SUB_ED",e}(kV||{}),TV=function(){function e(){Kd(this,e),od(this,"isScreen",!1),od(this,"stream",void 0),od(this,"streamId",void 0),od(this,"audioMid",void 0),od(this,"videoMid",void 0),od(this,"seiList",[]),od(this,"videoTrack",void 0),od(this,"audioTrack",void 0),od(this,"videoTransceiver",void 0),od(this,"audioTransceiver",void 0),od(this,"videoEncodeConfig",[EN]),od(this,"subVideoDescriptions",[]),od(this,"enableSimulcast",!1),od(this,"observer",void 0),od(this,"statsReport",void 0),od(this,"prevBitrate",0),od(this,"pubAudio",!1),od(this,"pubVideo",!1),od(this,"pubAttributes",void 0),this.stream=new MediaStream,this.pubAttributes={localaudio:!1,localvideo:!1,videostream:!1,audiostream:!1,extvideo:!1,extaudio:!1},this.statsReport=new mV(this)}return zd(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($M()){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,o=vV.generateSEI(n.content),a=new Uint8Array(o.byteLength+t.data.byteLength);if(0===n.repeatCount)rk(i=e.seiList).call(i,0,1);n.repeatCount--,a.set(new Uint8Array(t.data)),a.set(o,t.data.byteLength),t.data=a.buffer,r.enqueue(t)}else r.enqueue(t)}});n.pipeThrough(o).pipeTo(i)}}else bV.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 bV.print("no sender found when trying to bind encodedTransform")}},{key:"clean",value:function(){var e;Wx.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.prevBitrate=0,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}(),IV=function(e){AI(r,e);var t=zI(r);function r(e,n,i,o){var a;return Kd(this,r),od(YT(a=t.call(this)),"streamId",void 0),od(YT(a),"userId",void 0),od(YT(a),"isScreen",void 0),od(YT(a),"hasVideo",void 0),od(YT(a),"hasAudio",void 0),od(YT(a),"_attributes",void 0),od(YT(a),"streamState",void 0),od(YT(a),"observer",void 0),od(YT(a),"statsReport",void 0),od(YT(a),"subVideo",void 0),od(YT(a),"subAudio",void 0),od(YT(a),"subMediaType",void 0),od(YT(a),"subLayer",void 0),od(YT(a),"audioMid",void 0),od(YT(a),"videoMid",void 0),od(YT(a),"_sequenceId",void 0),od(YT(a),"stream",void 0),od(YT(a),"videoTrack",void 0),od(YT(a),"audioTrack",void 0),od(YT(a),"videoTransceiver",void 0),od(YT(a),"audioTransceiver",void 0),od(YT(a),"recordedVideoFrames",void 0),od(YT(a),"stillExist",void 0),od(YT(a),"originalMediaType",void 0),od(YT(a),"originalStreamIndex",0),od(YT(a),"virtual",void 0),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=aV.NONE,a.subLayer={spatialLayer:0,spatialSubLayer:-1},a.streamState=0,a.statsReport=new gV(YT(a)),a}return zd(r,[{key:"audioHasCapture",get:function(){return this._attributes.localaudio}},{key:"audioHasPublish",get:function(){return this._attributes.audiostream}},{key:"videoHasCapture",get:function(){return this._attributes.localvideo}},{key:"videoHasPublish",get:function(){return this._attributes.videostream}},{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){sV.getNalunits(new cV(t.data)).forEach((function(t){if(t.sei){var r=vV.decodeSeiBody(t.body);r&&r.type!==uV.internal&&e.safeEmit("onSEIMessage",r.payload)}})),r.enqueue(t)}})).pipeTo(n)}else bV.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 bV.print("no receiver found when trying to bind encodedTransform")}},{key:"ontrack",value:function(e){var t,r,n,i,o,a;try{var s;Wx.rtcInvokeStatus(hk({uid:this.userId,streamId:this.streamId,streams:EE(s=e.streams).call(s,(function(e,t){return e+(null==(r=t)?"undefined | null":"string"==typeof r?r:hk({id:r.id,active:r.active}));var r}),""),transceiver:(i=e.transceiver,null==i?"undefined | null":"string"==typeof i?i:hk({currentDirection:i.currentDirection,direction:i.direction,mid:i.mid,stopped:i.stopped,receiver:(a=i.receiver,null==a?"undefined | null":"string"==typeof a?a:hk({track:xw(a.track)})),sender:(o=i.sender,null==o?"undefined | null":"string"==typeof o?o:hk({track:xw(o.track)}))})),track:xw(e.track)}),0,"Stream.ontrack","",0)}catch(nW){}if(null!==(t=e.streams)&&void 0!==t&&null!==(r=t[0])&&void 0!==r&&null!==(n=r.id)&&void 0!==n&&Wm(n).call(n,this.streamId)){var c,u=e.track;"video"===(null==u?void 0:u.kind)?this._setVideoTrack(u):"audio"===(null===(c=e.track)||void 0===c?void 0:c.kind)&&this._setAudioTrack(u),this._setStream(e.streams[0])}this.safeEmit("ontrack",e)}},{key:"clean",value:function(){var e,t;bV.print("clean",Im(e="exec stream.clean ".concat(this.streamId," ")).call(e,this.userId)),Wx.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===(t=this.observer)||void 0===t||t.reset(),this.statsReport.destroy()}},{key:"resetHasSubscribed",value:function(){this.streamState=0}},{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=QU(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]:nw();return new OU(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=yb(i).call(i,(function(e){return e.width===a&&e.height===s}));return{spatialLayer:e,spatialSubLayer:(null==c?void 0:c.sub_index)||-1}}}]),r}(IC),RV=new bC("queue",4),AV=function(e){return e[e.ADD=0]="ADD",e[e.CLOSE=1]="CLOSE",e}(AV||{}),wV=function(e){return e.publish="publish",e.unpublish="unpublish",e.subscribe="subscribe",e.unsubscribe="unsubscribe",e.pushtrack="pushtrack",e.removetrack="removetrack",e}(wV||{}),CV=(od(yV={},"publish","unpublish"),od(yV,"subscribe","unsubscribe"),od(yV,"pushtrack","removetrack"),yV),OV=(od(SV={},"publish",0),od(SV,"subscribe",0),od(SV,"pushtrack",0),od(SV,"unpublish",1),od(SV,"unsubscribe",1),od(SV,"removetrack",1),SV),DV=function(e){AI(r,e);var t=zI(r);function r(){var e;return Kd(this,r),od(YT(e=t.call(this)),"_queue",void 0),e._queue=[],e}return zd(r,[{key:"queue",get:function(){return this._queue}},{key:"enqueue",value:function(e){var t,r=this._queue.length,n="";return this._queue=Gs(t=this._queue).call(t,(function(t){return t.streamId!==e.streamId||e.action!==CV[t.action]||(n=t.streamId,RV.print("offsetStreamId",n),!1)})),this._queue.length===r&&this._queue.push(e),this.emit("start"),n}},{key:"dequeue",value:function(){var e;if(!this._queue.length)return null;var t=this._queue.length;Sw&&(t=Math.min(this._queue.length,5));for(var r=OV[this._queue[0].action],n=1;n<t;n++){var i;if(OV[this._queue[n].action]!==r)return{sdpStrategy:r,items:rk(i=this._queue).call(i,0,n)}}return{sdpStrategy:r,items:rk(e=this._queue).call(e,0,t)}}}]),r}(aC),xV=new bC("ChromeHandler",3),NV=$M(),PV=function(e){AI(d,e);var t,r,n,i,o,a,s,c,u=zI(d);function d(e,t){var r;return Kd(this,d),od(YT(r=u.call(this,e,t)),"name","chrome"),od(YT(r),"_queueBusy",!1),od(YT(r),"_sdpQueue",void 0),od(YT(r),"_aSendonlyOfferTpl",void 0),od(YT(r),"_vSendonlyOfferTpl",void 0),od(YT(r),"_aRecvonlyOfferTpl",void 0),od(YT(r),"_vRecvonlyOfferTpl",void 0),od(YT(r),"_mid",10),od(YT(r),"_offerSession",void 0),od(YT(r),"_answerSession",void 0),od(YT(r),"_offerMlines",[]),od(YT(r),"_answerMlines",[]),od(YT(r),"_inactiveMlineIndex",[]),od(YT(r),"_mlinesCache",{}),r._sdpQueue=new DV,r._sdpQueue.on("start",(function(){r._queueBusy||"stable"!==r._peerConnection.signalingState||(xV.print("dequeue start"),r.dequeue())})),r}return zd(d,[{key:"connect",value:(c=Sm(gm().mark((function e(t){var r,n,i,o,a,s,c=this;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return xV.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,EL(t);case 4:return this._answerIce=e.sent,e.next=7,this._peerConnection.createOffer();case 7:return i=e.sent,o=eL.parse(i.sdp),a=WT(o.media,1),s=a[0],this._offerIce.fingerprint=o.fingerprint||s.fingerprint,delete o.media,this._offerSession=sd({},o),this._answerSession=sd({},o),this._answerSession.fingerprint&&(this._answerSession.fingerprint=this._answerIce.fingerprint),this._offerMlines=[sd(sd(sd({},s),this._offerIce),{},{mid:"".concat(0)})],this._answerMlines=[sd(sd(sd({},s),this._answerIce),{},{sctpmap:{sctpmapNumber:5e3,app:"webrtc-datachannel",maxMessageSize:262144},mid:"".concat(0)})],this.setDescription(),e.next=21,new H_((function(e,t){c._dataChannel.onopen=function(){xV.print("connect","dataChannel open"),iN("es.dc.open",""),e("")},c._dataChannel.onerror=function(e){Wx.rtcSignalingMsgError(e.error.sdpLineNumber,e.error.errorDetail,bx.INVALID_DATA),iN("es.dc.error",""),t(e)},c._dataChannel.onclose=function(e){iN("es.dc.close",""),t(e)},c._peerConnection.addEventListener("connectionstatechange",(function(e){"failed"!==c._peerConnection.iceConnectionState&&"closed"!==c._peerConnection.iceConnectionState&&"failed"!==c._peerConnection.connectionState||t(e)}))}));case 21:return xV.print("connect","dataChannel establish success"),e.abrupt("return",this._dataChannel);case 23:case"end":return e.stop()}}),e,this)}))),function(e){return c.apply(this,arguments)})},{key:"disconnect",value:function(){this._peerConnection.close(),this._dataChannel.close(),this._peerConnection.ontrack=null}},{key:"destroy",value:function(){II(kI(d.prototype),"destroy",this).call(this),this._mlinesCache={}}},{key:"publish",value:(s=Sm(gm().mark((function e(t){var r,n,i,o,a,s,c,u,l,h,f,p,v,_,m,g,y,S,E,b,k,T,I,R,A,w,C,O,D,x,N,P,M,L,U,V,F;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return u=t.stream,l=t.enableSimulcast,h=II(kI(d.prototype),"internalPublish",this).call(this,t),f=h.videoDescriptions,p=h.subVideoDescriptions,v=h.audioTransceiverInit,_=h.videoTransceiverInit,m=_L(this._nextSsrc),this._nextSsrc=m.next,g="".concat(this._mid++),y="".concat(this._mid++),S=sd(sd(sd({},this._aSendonlyOfferTpl),this._offerIce),{},{mid:g,msid:Im(r="".concat(u.id," ")).call(r,u.id,"-audio"),ssrcs:mL(u.id,"audio",m.audio,pL)}),E=sd(sd(sd({},this._vSendonlyOfferTpl),this._offerIce),{},{mid:y,msid:Im(n="".concat(u.id," ")).call(n,u.id,"-video")}),l?(xV.print("subVideoDesc","desc: %o ",p),delete E.ssrcGroups,delete E.ssrcs,b=[],E.rids=ck(f).call(f,(function(e){var t=e.rid;return b.unshift(t),{id:t,direction:"send"}})),E.simulcast={dir1:"send",list1:b.join(";")}):(k=gL(u.id,m,{cname:pL}),T=k.ssrcs,I=k.ssrcGroups,E.ssrcs=T,E.ssrcGroups=I),null!==(i=this._context)&&void 0!==i&&null!==(o=i.serverConfig)&&void 0!==o&&o.audioRed&&Array.isArray(S.rtp)&&(-1!==(A=zR(R=S.rtp).call(R,(function(e){return"red"===e.codec})))&&(C=rk(w=S.rtp).call(w,A,1),O=WT(C,1),D=O[0],S.rtp.unshift(D)),x=[],S.rtp.forEach((function(e){return x.push(e.payload)})),S.payloads=x.join(" ")),null!==(a=this._context)&&void 0!==a&&null!==(s=a.serverConfig)&&void 0!==s&&s.videoCodec&&IL(E,null===(N=this._context)||void 0===N||null===(P=N.serverConfig)||void 0===P?void 0:P.videoCodec),(dw||_w)&&Array.isArray(E.ext)&&(E.ext=Gs(M=E.ext).call(M,(function(e){var t;return!(null!=e&&null!==(t=e.uri)&&void 0!==t&&Wm(t).call(t,"video-orientation"))}))),(L=null==S?void 0:yb(c=S.rtp).call(c,(function(e){return"opus"===e.codec})))&&S.fmtp&&(F=yb(U=S.fmtp).call(U,(function(e){return e.payload===L.payload})))&&null!==(V=this._context)&&void 0!==V&&V.audioProfileManager&&(F.config=this._context.audioProfileManager.getOpusConfigStr(F.config)),l||dw||this.addBitrateLimit(E,t.videoEncodeConfig[0].maxKbps),this._mlinesCache[t.stream.id]=[S,E],e.abrupt("return",{partialSdp:SL(this._offerSession,S,E),audioMid:g,videoMid:y,type:"incroffer",semantics:"unified-plan",videoDescriptions:f,subVideoDescriptions:p,audioTransceiverInit:v,videoTransceiverInit:_});case 17:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"subscribe",value:(a=Sm(gm().mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h,f,p,v,_,m,g,y,S,E,b,k,T,I,R,A,w,C,O,D,x,N=this;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(xV.print("subscribe"),a="incroffer",s="unified-plan",this._aRecvonlyOfferTpl&&this._vRecvonlyOfferTpl){e.next=11;break}return e.next=6,Iw(!0);case 6:if(c=e.sent){e.next=9;break}throw new cA(aA.NOT_SUPPORTED,"Get offer Error");case 9:return e.next=11,this.createAVMlineOfferTpl(c);case 11:if(u="",d="",l=!1,h=!1,f=void 0,p=void 0,this._mlinesCache[t.streamId]=[f,p],t.virtual?(u="".concat(this._mid++),l=!0):r.multiChatMode?(u="".concat(this._mid++),d="".concat(this._mid++),h=!0):(l=!0,h=!0,u="".concat(this._mid++),d="".concat(this._mid++)),u&&(f=sd(sd({},this._aRecvonlyOfferTpl),{},{mid:u})),l&&(this._mlinesCache[t.streamId][0]=f,v={track:"audio",init:{direction:"recvonly"}}),d&&(p=sd(sd({},this._vRecvonlyOfferTpl),{},{mid:d})),h&&(this._mlinesCache[t.streamId][1]=p,_={track:"video",init:{direction:"recvonly"}}),m=SL(this._offerSession,f,p),g=void 0,r.multiChatMode||t.virtual||!this._aSendonlyAnswerTpl||!this._vSendonlyAnswerTpl){e.next=34;break}return g=_L(this._nextSsrc),this._nextSsrc=g.next,R=sd(sd(sd({},this._aSendonlyAnswerTpl),this._answerIce),{},{mid:u,msid:Im(y=Im(S="".concat(t.streamId)).call(S,null!==(E=this._context)&&void 0!==E&&E.avSync?"":"-audio"," ")).call(y,t.streamId,"-audio"),ssrcs:mL(t.streamId,"audio",g.audio)}),A=sd(sd(sd({},this._vSendonlyAnswerTpl),this._answerIce),{},{mid:d,msid:Im(b=Im(k="".concat(t.streamId)).call(k,null!==(T=this._context)&&void 0!==T&&T.avSync?"":"-video"," ")).call(b,t.streamId,"-video")},gL(t.streamId,g,{flexfec:this._enableSubFlexfec})),w=new H_((function(e){N._sdpQueue.enqueue({action:wV.subscribe,streamId:t.streamId,audioMid:u,videoMid:d,audioTransceiverInit:v,videoTransceiverInit:_,signalingAck:{sdp:eL.write(sd(sd({},N._answerSession),{},{media:[R,A]})),sequenceId:t.sequenceId?++t.sequenceId:0},stream:t,sdp:m,onSuccess:function(){xV.print("subscribe()","sub success"),e(0)}})})),e.next=33,w;case 33:null===(I=g)||void 0===I||delete I.next;case 34:return(C=null===(n=f)||void 0===n?void 0:yb(i=n.rtp).call(i,(function(e){return"opus"===e.codec})))&&null!==(o=f)&&void 0!==o&&o.fmtp&&(x=null===(O=f)||void 0===O?void 0:yb(D=O.fmtp).call(D,(function(e){return e.payload===C.payload})))&&this._context&&(x.config+=";stereo=1;sprop-stereo=1"),e.abrupt("return",{partialSdp:m,audioMid:u,videoMid:d,type:a,semantics:s,audioTransceiverInit:v,videoTransceiverInit:_,allSsrc:g});case 37:case"end":return e.stop()}}),e,this)}))),function(e,t){return a.apply(this,arguments)})},{key:"handleAck",value:(o=Sm(gm().mark((function e(t){return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(xV.print("handleAck()","item: %o",t),!t.generatorSsrc){e.next=4;break}return xV.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 o.apply(this,arguments)})},{key:"dequeue",value:(i=Sm(gm().mark((function e(){var t,r,n,i,o,a,s,c,u,d,l,h,f,p,v,_=this;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._queueBusy=!0,t=this._sdpQueue.dequeue(),xV.print("dequeue()","ret: %o",t),t){e.next=6;break}return this._queueBusy=!1,e.abrupt("return");case 6:if(e.prev=6,r=t.items,n=t.sdpStrategy,i=[],o=[],a=[],n!==AV.ADD){e.next=15;break}return e.delegateYield(gm().mark((function e(){var t,n;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:delete(t=sd({},_._answerIce)).candidates,s=!1,c=!1,e.prev=4,d=cP(r);case 6:return e.next=8,d.next();case 8:if(!(s=!(l=e.sent).done)){e.next=16;break}if(n=l.value,"break"!==function(){var e=n.audioMid,r=n.videoMid,s=n.action,c=n.audioTransceiverInit,u=n.videoTransceiverInit,d=n.signalingAck,l=n.stream,h=l instanceof IV;if(n.onSuccess&&a.push(n.onSuccess),h&&(null==d?void 0:d.sequenceId)<l.sequenceId)return"break";var f,p={},v={},m=eL.parse(d.sdp);Array.isArray(m.media)&&MR(f=m.media).call(f,(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=sd(sd({},n),t)).type?(p=n).mid=e:(v=n).mid=r}));var g,y=l.streamId;if(s===wV.publish&&(y=null===(g=l.stream)||void 0===g?void 0:g.id),!_._mlinesCache[y])return"break";var S=WT(_._mlinesCache[y],2),E=S[0],b=S[1];if(c&&E){l.audioTransceiver=_._peerConnection.addTransceiver(c.track,c.init),_.monitor.rtcInvokeStatus(hk({audioStreamTrack:xw(c.track)}),0,"chromeHandler.addTrack","",0);var k=_._inactiveMlineIndex.shift();k||(k=_._offerMlines.length),_._offerMlines[k]=sd({},E),_._answerMlines[k]=p,NV&&l.initAudioEncodedTransform()}if(u&&b){var T,I;l.videoTransceiver=_._peerConnection.addTransceiver(u.track,u.init),_.monitor.rtcInvokeStatus(hk({videoStreamTrack:xw(u.track)}),0,"chromeHandler.addTrack","",0);var R,A,w=_._inactiveMlineIndex.shift();w||(w=_._offerMlines.length),_._offerMlines[w]=sd({},b),s===wV.publish&&null!==(T=_._context)&&void 0!==T&&null!==(I=T.serverConfig)&&void 0!==I&&I.videoCodec&&IL(v,null===(R=_._context)||void 0===R||null===(A=R.serverConfig)||void 0===A?void 0:A.videoCodec),_._answerMlines[w]=v,NV&&l.initVideoEncodedTransform()}i.push(l.streamId||""),o.push(h?l.userId:"local"),h&&(l.sequenceId=null==d?void 0:d.sequenceId),delete _._mlinesCache[y]}()){e.next=13;break}return e.abrupt("break",16);case 13:s=!1,e.next=6;break;case 16:e.next=22;break;case 18:e.prev=18,e.t0=e.catch(4),c=!0,u=e.t0;case 22:if(e.prev=22,e.prev=23,!s||null==d.return){e.next=27;break}return e.next=27,d.return();case 27:if(e.prev=27,!c){e.next=30;break}throw u;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={},r.forEach((function(e){var t=e.audioMid,r=e.videoMid,n=e.action;v[t]=t,n!==wV.removetrack&&(v[r]=r),v[t]=t})),this._offerMlines=ck(h=this._offerMlines).call(h,(function(e,t){return v[e.mid]&&(e=yL(e),_._inactiveMlineIndex.push(t)),e})),MR(f=this._inactiveMlineIndex).call(f,(function(e,t){return e-t})),this._answerMlines=ck(p=this._answerMlines).call(p,(function(e){return v[e.mid]&&(e=yL(e)),e}));case 20:return e.next=22,this.setDescription(i.length?{streamId:i.join(","),streamUserId:o.join(",")}:void 0);case 22:try{a.forEach((function(e){return e()}))}catch(nW){}xV.print("dequeue","loop"),e.next=29;break;case 26:e.prev=26,e.t1=e.catch(6),xV.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 i.apply(this,arguments)})},{key:"setDescription",value:(n=Sm(gm().mark((function e(t){var r,n;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return xV.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=iw(),t&&Wx.rtcBeginCreateOffer("local"===t.streamUserId?Tx.UP:Tx.DOWN,t.streamId,t.streamUserId),e.next=10,this._peerConnection.createOffer();case 10:return t&&Wx.rtcCreateOffer(0,"local"===t.streamUserId?Ix.UP:Ix.DOWN,t.streamId,t.streamUserId,iw()-n),e.next=13,this.setLocalDescription(eL.write(this._offerSession),t);case 13:return e.next=15,this.setRemoteDescription(eL.write(this._answerSession),t);case 15:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"getDefaultSdp",value:(r=Sm(gm().mark((function e(){var t,r,n,i;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Iw(!0);case 2:if(r=e.sent){e.next=5;break}throw new cA(aA.NOT_SUPPORTED,"Get offer Error");case 5:return this.createAVMlineOfferTpl(r),n=eL.parse(r),i=[],n.media=Gs(t=n.media).call(t,(function(e){var t;return"recvonly"===e.direction&&(Array.isArray(e.ext)&&(e.ext=Gs(t=e.ext).call(t,(function(e){return"urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id"!==e.uri}))),i.push(e.mid+""),!0)})),n.groups=[{mids:i.join(" "),type:"BUNDLE"}],e.abrupt("return",{sdp:eL.write(n),semantics:"unified-plan",type:"incroffer"});case 11:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"rollback",value:(t=Sm(gm().mark((function e(t){return gm().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 t.apply(this,arguments)})},{key:"createAVMlineOfferTpl",value:function(e){var t=this;eL.parse(e).media.forEach((function(e){if("audio"===e.type)if("sendonly"===e.direction)t._aSendonlyOfferTpl=e;else{var r;if(Array.isArray(e.ext))e.ext=Gs(r=e.ext).call(r,(function(e){return"urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id"!==e.uri}));t._aRecvonlyOfferTpl=e}else if("video"===e.type)if("sendonly"===e.direction)t._vSendonlyOfferTpl=e;else{var n;if(Array.isArray(e.ext))e.ext=Gs(n=e.ext).call(n,(function(e){return"urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id"!==e.uri}));t._vRecvonlyOfferTpl=e}}))}}]),d}(wL),MV=new bC("FirefoxHandler",3),LV=function(e){AI(l,e);var t,r,n,i,o,a,s,c,u,d=zI(l);function l(){var e,t;Kd(this,l);for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return od(YT(t=d.call.apply(d,Im(e=[this]).call(e,n))),"name","firefox"),od(YT(t),"_aRecvonlyOfferTpl",void 0),t}return zd(l,[{key:"connect",value:(u=Sm(gm().mark((function e(t){var r,n,i,o,a,s,c,u,d,l,h=this;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return MV.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,EL(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 s=e.sent,c=eL.parse(s.sdp),u=WT(c.media,1),d=u[0],this._offerIce.fingerprint=c.fingerprint||d.fingerprint,c.media=ck(i=c.media).call(i,(function(e){return sd(sd({},e),h._offerIce)})),ck(o=c.media).call(o,(function(e){var t,r;"video"===e.type&&(e.ext=null===(t=e.ext)||void 0===t?void 0:Gs(t).call(t,(function(e){var t;return-1===Ob(t=e.uri).call(t,"abs-send-time")})),e.rtcpFb=null===(r=e.rtcpFb)||void 0===r?void 0:Gs(r).call(r,(function(e){return"goog-remb"!==e.type})))})),(l=sd({},c)).fingerprint=this._answerIce.fingerprint,l.media=ck(a=l.media).call(a,(function(e){return delete(e=sd(sd({},e),h._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(eL.write(c));case 20:return e.next=22,this.setRemoteDescription(eL.write(l));case 22:return e.next=24,new H_((function(e,t){h._dataChannel.onopen=function(){MV.print("connect","dataChannel open"),iN("es.dc.open",""),e("")},h._dataChannel.onerror=function(e){Wx.rtcSignalingMsgError(e.error.sdpLineNumber,e.error.errorDetail,bx.INVALID_DATA),iN("es.dc.error",""),t(e)},h._dataChannel.onclose=function(e){iN("es.dc.close",""),t(e)},h._peerConnection.addEventListener("connectionstatechange",(function(e){"failed"!==h._peerConnection.iceConnectionState&&"closed"!==h._peerConnection.iceConnectionState&&"failed"!==h._peerConnection.connectionState||t(e)}))}));case 24:return MV.print("connect","dataChannel establish success"),e.abrupt("return",this._dataChannel);case 26:case"end":return e.stop()}}),e,this)}))),function(e){return u.apply(this,arguments)})},{key:"publish",value:(c=Sm(gm().mark((function e(t){var r,n,i,o,a,s,c,u,d,h,f,p,v,_,m=this;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=II(kI(l.prototype),"internalPublish",this).call(this,t),o=i.videoDescriptions,a=i.subVideoDescriptions,s=i.audioTransceiverInit,c=i.videoTransceiverInit,t.audioTransceiver=this._peerConnection.addTransceiver(s.track,s.init),t.videoTransceiver=this._peerConnection.addTransceiver(c.track,c.init),u=iw(),Wx.rtcBeginCreateOffer(Tx.UP,"",""),e.next=7,this._peerConnection.createOffer();case 7:return d=e.sent,Wx.rtcCreateOffer(0,Ix.UP,"","",iw()-u),(h=eL.parse(d.sdp)).media=null===(r=h.media)||void 0===r?void 0:ck(r).call(r,(function(e){return sd(sd({},e),m._offerIce)})),e.next=13,this.setLocalDescription(eL.write(h));case 13:return f=t.audioTransceiver.mid,p=t.videoTransceiver.mid,v=null,_=null,h.media=null===(n=h.media)||void 0===n?void 0:ck(n).call(n,(function(e){if("".concat(e.mid)===f){var t,r,n=null===(t=v=e)||void 0===t?void 0:yb(r=t.rtp).call(r,(function(e){return"opus"===e.codec}));if(n&&v.fmtp){var i,o,a=yb(i=v.fmtp).call(i,(function(e){return e.payload===n.payload}));a&&null!==(o=m._context)&&void 0!==o&&o.audioProfileManager&&(a.config=m._context.audioProfileManager.getOpusConfigStr(a.config))}}else if("".concat(e.mid)===p){var s,c,u,d;null!==(s=m._context)&&void 0!==s&&null!==(c=s.serverConfig)&&void 0!==c&&c.videoCodec&&IL(e,null===(u=m._context)||void 0===u||null===(d=u.serverConfig)||void 0===d?void 0:d.videoCodec),_=e}return e})),this.addBitrateLimit(_,t.videoEncodeConfig[0].maxKbps),e.next=21,this.setLocalDescription(eL.write(h));case 21:return e.abrupt("return",{partialSdp:SL(h,v,_,!1),audioMid:f,videoMid:p,type:"incroffer",semantics:"unified-plan",videoDescriptions:o,subVideoDescriptions:a,audioTransceiverInit:s,videoTransceiverInit:c});case 22:case"end":return e.stop()}}),e,this)}))),function(e){return c.apply(this,arguments)})},{key:"subscribe",value:(s=Sm(gm().mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h,f,p,v,_,m,g,y,S,E,b,k,T,I,R,A=this;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return MV.print("subscribe()"),c="",u="",d=!1,l=!1,h=void 0,f=void 0,t.virtual?d=!0:(r.multiChatMode||(d=!0),l=!0),d&&(t.audioTransceiver=this._peerConnection.addTransceiver("audio",{direction:"recvonly"})),l&&(t.videoTransceiver=this._peerConnection.addTransceiver("video",{direction:"recvonly"})),p=iw(),Wx.rtcBeginCreateOffer(Tx.UP,t.streamId,t.userId),e.next=14,this._peerConnection.createOffer();case 14:return v=e.sent,Wx.rtcCreateOffer(0,Ix.UP,t.streamId,t.userId,iw()-p),(_=eL.parse(v.sdp)).media=null===(n=_.media)||void 0===n?void 0:ck(n).call(n,(function(e){return sd(sd({},e),A._offerIce)})),ck(i=_.media).call(i,(function(e){var t,r;"video"===e.type&&(e.ext=null===(t=e.ext)||void 0===t?void 0:Gs(t).call(t,(function(e){var t;return-1===Ob(t=e.uri).call(t,"abs-send-time")})),e.rtcpFb=null===(r=e.rtcpFb)||void 0===r?void 0:Gs(r).call(r,(function(e){return"goog-remb"!==e.type})))})),e.next=21,this.setLocalDescription(eL.write(_),{streamId:t.streamId||"",streamUserId:t.userId});case 21:if(c=null===(o=t.audioTransceiver)||void 0===o?void 0:o.mid,u=null===(a=t.videoTransceiver)||void 0===a?void 0:a.mid,null===(s=_.media)||void 0===s||s.forEach((function(e){"".concat(e.mid)===c?h=e:"".concat(e.mid)===u&&(f=e)})),c&&h||(c="audio_".concat(u),h=sd(sd({},this._aRecvonlyOfferTpl),{},{mid:c})),t.audioMid=c,t.videoMid=u,m=void 0,r.multiChatMode||t.virtual||!this._aSendonlyAnswerTpl||!this._aSendonlyAnswerTpl){e.next=36;break}return m=_L(this._nextSsrc),this._nextSsrc=m.next,I=sd(sd(sd({},this._aSendonlyAnswerTpl),this._answerIce),{},{mid:c,msid:Im(g=Im(y="".concat(t.streamId)).call(y,null!==(S=this._context)&&void 0!==S&&S.avSync?"":"-audio"," ")).call(g,t.streamId,"-audio"),ssrcs:mL(t.streamId,"audio",m.audio)}),R=sd(sd(sd({},this._vSendonlyAnswerTpl),this._answerIce),{},{mid:u,msid:Im(E=Im(b="".concat(t.streamId)).call(b,null!==(k=this._context)&&void 0!==k&&k.avSync?"":"-video"," ")).call(E,t.streamId,"-video")},gL(t.streamId,m,{flexfec:this._enableSubFlexfec})),e.next=35,this._internalSetRemoteDescription([I,R],t);case 35:null===(T=m)||void 0===T||delete T.next;case 36:return e.abrupt("return",{partialSdp:SL(_,h,f,!1),audioMid:c,videoMid:u,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:m});case 37:case"end":return e.stop()}}),e,this)}))),function(e,t){return s.apply(this,arguments)})},{key:"handleAck",value:(a=Sm(gm().mark((function e(t){var r,n,i,o;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.signalingAck,n=t.stream,(i=t.action)!==wV.unpublish&&i!==wV.unsubscribe&&i!==wV.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 MV.print("already set remote"),e.abrupt("return","");case 8:return o=eL.parse(null==r?void 0:r.sdp),e.next=11,this._internalSetRemoteDescription(o.media,n);case 11:return e.abrupt("return","");case 12:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"_internalSetRemoteDescription",value:(o=Sm(gm().mark((function e(t,r){var n,i,o,a,s,c,u,d,l=this;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s={},(c=eL.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){if("audio"===(e=sd(sd({},e),l._answerIce)).type&&(r.audioMid?(e.mid=r.audioMid,s[r.audioMid]=e):s[e.mid]=e),"video"===e.type){if(r instanceof TV&&vw<=87){var t,n,i,o,a={};Array.isArray(e.rtp)&&(e.rtp=Gs(t=e.rtp).call(t,(function(e){return"rtx"!==e.codec||(a[e.payload]=e.payload,!1)}))),"string"==typeof e.payloads&&(e.payloads=Gs(n=e.payloads.split(" ")).call(n,(function(e){return!a[e]})).join(" ")),Array.isArray(e.fmtp)&&(e.fmtp=Gs(i=e.fmtp).call(i,(function(e){return!a[e.payload]}))),Array.isArray(e.rtcpFb)&&(e.fmtp=Gs(o=e.fmtp).call(o,(function(e){return!a[e.payload]})))}r.videoMid?(e.mid=r.videoMid,s[r.videoMid]=e):s[e.mid]=e}})),u=eL.parse(null===(i=this._peerConnection.localDescription)||void 0===i?void 0:i.sdp),d=ck(o=u.media).call(o,(function(e){var t=s[e.mid];return"inactive"===e.direction?e:t})),c.groups=u.groups,c.media=d,ck(a=c.media).call(a,(function(e){var t,r;"video"===e.type&&(e.ext=null===(t=e.ext)||void 0===t?void 0:Gs(t).call(t,(function(e){var t;return-1===Ob(t=e.uri).call(t,"abs-send-time")})),e.rtcpFb=null===(r=e.rtcpFb)||void 0===r?void 0:Gs(r).call(r,(function(e){return"goog-remb"!==e.type})))})),e.next=11,this.setRemoteDescription(eL.write(c));case 11:case"end":return e.stop()}}),e,this)}))),function(e,t){return o.apply(this,arguments)})},{key:"getDefaultSdp",value:(i=Sm(gm().mark((function e(){var t,r,n,i,o;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=eL.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),o=[],i.media=Gs(n=i.media).call(n,(function(e){return"recvonly"===e.direction&&(e.mid=e.mid+1,o.push(e.mid+""),!0)})),i.groups=[{mids:o.join(" "),type:"BUNDLE"}],e.abrupt("return",{sdp:eL.write(i),semantics:"unified-plan",type:"incroffer"});case 6:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"rollback",value:(n=Sm(gm().mark((function e(t,r,n){return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return MV.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=Sm(gm().mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h=this;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return MV.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=eL.parse(null==c?void 0:c.sdp)).media=ck(n=u.media).call(n,(function(e){return a[e.mid]&&(e=yL(e)),"inactive"!==e.direction&&s.push(e.mid),sd(sd({},e),h._offerIce)})),d=eL.parse(null===(i=this._peerConnection.remoteDescription)||void 0===i?void 0:i.sdp),l={},d.media.forEach((function(e){void 0!==e.mid&&(l[e.mid]=e)})),d.media=ck(o=u.media).call(o,(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(eL.write(u));case 17:return e.next=19,this.setRemoteDescription(eL.write(d));case 19:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"setCurrentDescription",value:(t=Sm(gm().mark((function e(){return gm().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;eL.parse(e).media.forEach((function(e){"audio"===e.type&&(t._aRecvonlyOfferTpl=e)}))}}]),l}(wL),UV=function(e,t){return uw?new LV(e,t):new PV(e,t)},VV=new bC("Locker",2),FV=1,BV=function(){function e(t){var r;Kd(this,e),od(this,"lockingPromise",H_.resolve()),od(this,"locks",0),od(this,"name",""),od(this,"lockId",void 0),this.lockId=FV++,t&&(this.name=t),VV.print(Im(r="[lock-".concat(this.name,"-")).call(r,this.lockId,"] is created."))}return zd(e,[{key:"isLocked",get:function(){return this.locks>0}},{key:"lock",value:function(){var e,t,r,n=this;this.locks+=1,VV.print(Im(e=Im(t="[lock-".concat(this.name,"-")).call(t,this.lockId,"] locked, current queue ")).call(e,this.locks,"."));var i=new H_((function(e){r=function(){var t,r;n.locks-=1,VV.print(Im(t=Im(r="[lock-".concat(n.name,"-")).call(r,n.lockId,"] unlocked, current queue ")).call(t,n.locks,".")),e()}})),o=this.lockingPromise.then((function(){return r}));return this.lockingPromise=this.lockingPromise.then((function(){return i})),o}}]),e}(),jV=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_SUBTITLE_STATE_CHANGED="ON_SUBTITLE_STATE_CHANGED",e.ON_SUBTITLE_MESSAGE_RECEIVED="ON_SUBTITLE_MESSAGE_RECEIVED",e.ON_VIDEO_STREAM_BANNED="ON_VIDEO_STREAM_BANNED",e.ON_AUDIO_STREAM_BANNED="ON_AUDIO_STREAM_BANNED",e}(jV||{}),GV=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}(GV||{}),HV=function(e){return e[e.PUB=0]="PUB",e[e.UNPUB=1]="UNPUB",e}(HV||{}),zV=function(e){return e[e.SUB=0]="SUB",e[e.UNSUB=1]="UNSUB",e}(zV||{}),KV=(od(EV={},Od.communication,[0]),od(EV,Od.chat,[0]),od(EV,Od.chatRoom,[1,"IES_chatroom"]),od(EV,Od.coHost,[1,"IES_PK"]),od(EV,Od.meeting,[16]),od(EV,Od.classRoom,[0]),EV),XV=id,qV=tc,WV=function(e,t,r,n){for(var i,o=n>1?void 0:n?qV(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&&XV(t,r,o),o},YV=new bC("MediaServerClient",2),QV=6e4,JV=function(e){return e.DISCONNECTED="disconnected",e.DISCONNECTING="disconnecting",e.CONNECTED="connected",e.CONNECTING="connecting",e}(JV||{}),ZV=function(e,t){YV.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)},$V=function(e){AI(b,e);var t,r,n,i,o,a,s,c,u,d,l,h,f,p,v,_,m,g,y,S,E=zI(b);function b(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Wx;return Kd(this,b),od(YT(t=E.call(this)),"id",void 0),od(YT(t),"_token",void 0),od(YT(t),"_appId",void 0),od(YT(t),"_roomId",void 0),od(YT(t),"_roomAttributes",void 0),od(YT(t),"_clientId",void 0),od(YT(t),"_businessId",void 0),od(YT(t),"_userInfo",void 0),od(YT(t),"_useCloudProxy",void 0),od(YT(t),"_expectedIDC",void 0),od(YT(t),"_authorization",void 0),od(YT(t),"_sessionId",void 0),od(YT(t),"_iceConfigRequestManager",void 0),od(YT(t),"_ontrackCallbackMap",new aE),od(YT(t),"_subResolves",{}),od(YT(t),"supportConcurrent",!1),od(YT(t),"_handler",void 0),od(YT(t),"_pubSubLock",void 0),od(YT(t),"_joinLeaveLock",void 0),od(YT(t),"_state",void 0),od(YT(t),"_dataChannelSignal",void 0),od(YT(t),"_subConfig",{}),od(YT(t),"monitor",void 0),od(YT(t),"_roomProfile",Od.communication),od(YT(t),"_context",void 0),od(YT(t),"_subStreamQueue",{}),t.id=null==e?void 0:e.id,t.monitor=r,t._pubSubLock=new BV("pubSubLock"),t._joinLeaveLock=new BV("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 zd(b,[{key:"_addHandlerEvents",value:function(){var e,t=this;null===(e=this._handler)||void 0===e||e.once("disconnect",(function(){YV.print("emit ABNORMAL_DISCONNECTION ice"),t.safeEmit(CN.ABNORMAL_DISCONNECTION)}))}},{key:"_addSignalEventHandler",value:function(){var e,t=this;[AN.ON_ADD_STREAM,AN.ON_ADD_STREAM_LIST,AN.ON_REMOVE_STREAM,AN.ON_REMOVE_STREAM_LIST,AN.USER_CONNECTION,AN.USER_CONNECTION_LIST,AN.USER_DISCONNECTION,AN.USER_DISCONNECTION_LIST,AN.ON_UPDATE_STREAM_ATTRIBUTES,AN.ON_UPDATE_ROOM_ATTRIBUTES,AN.ON_PUSH_TRACK,AN.NODE_CHANGE,AN.ON_CUSTOM_MESSAGE,AN.USER_MESSAGE_RECEIVED,AN.USER_BINARY_MESSAGE_RECEIVED,AN.POST_PROCESSING_MESSAGE,AN.ON_USER_TOKEN_WILL_EXPIRE,AN.STREAM_CONTROL_MESSAGE,AN.ON_UPDATE_USER_ATTRIBUTES,AN.ON_SPEAKER_CHANGE,wN.RSCP,wN.RTT,AN.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(){YV.print("emit ABNORMAL_DISCONNECTION datachannel"),t.safeEmit(CN.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(CN.ON_CONNECTION_STATE_CHANGE,{prev:this._state,next:e}),this._state=e)}},{key:"businessId",set:function(e){this._businessId=e}},{key:"connect",value:(S=Sm(gm().mark((function e(t){var r,n,i,o,a,s,c,u,d=this,l=arguments;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=l.length>1&&void 0!==l[1]?l[1]:"",n=l.length>2&&void 0!==l[2]?l[2]:"",i=l.length>3&&void 0!==l[3]?l[3]:{},this.connectionState="connecting",this._appId=t,this._handler&&(this._removeSignalEventHandler(),this._handler.destroy()),!i.node){e.next=11;break}o=[i.node],iN("es.join.nodeChange",i),e.next=20;break;case 11:return H_.resolve().then((function(){return d.emit("onGetIceConfigHook")})),this._iceConfigRequestManager=new oP,e.next=15,null===(a=this._iceConfigRequestManager)||void 0===a?void 0:a.getAccessNode(t,r,n,hN.getDeviceId(),null==i?void 0:i.reason,null==i?void 0:i.feedbackNode,this._useCloudProxy,this._expectedIDC);case 15:if(o=e.sent){e.next=19;break}throw iN("es.join.getNodeFailed",""),new cA(aA.ICE_SERVER_WRONG,"get ICE config failed");case 19:iN("es.join.getNodeSuccess",o);case 20:return H_.resolve().then((function(){return d.emit("onEstablishConnectionHook")})),e.prev=21,c=!1,u=ck(o).call(o,(function(e){var t=UV(d.monitor,d._context);return t.connect(e).then((function(r){c?t.destroy():(c=!0,s=r,d.safeEmit("prevIceNode",e),d._handler=t,d.supportConcurrent="chrome"===t.name,d._addHandlerEvents())})).catch((function(){t.destroy()}))})),e.next=26,Rw(u);case 26:YV.print("join","establish peerConnection success"),e.next=33;break;case 29:throw e.prev=29,e.t0=e.catch(21),this.connectionState="disconnected",new cA(aA.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed",e.t0);case 33:if(!s){e.next=39;break}this._dataChannelSignal=new rP(this.id,s),this._addSignalEventHandler(),this._dataChannelSignal.sendPingSignaling(),e.next=41;break;case 39:throw this.connectionState="disconnected",new cA(aA.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed");case 41:case"end":return e.stop()}}),e,this,[[21,29]])}))),function(e){return S.apply(this,arguments)})},{key:"join",value:(y=Sm(gm().mark((function e(t){var r,n,i,o,a,s,c,u,d,l,h,f,p,v,_,m=this,g=arguments;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=g.length>1&&void 0!==g[1]?g[1]:{},i=g.length>2&&void 0!==g[2]&&g[2],o=g.length>3?g[3]:void 0,YV.print("join()","info: %o, params: %o, reconnect: %o, controlMessage: %o",t,n,i,o),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=sw.token2auth(this._appId,this._roomId,this._clientId,this._token),e.t1=this._sessionId||"",e.t2=Date.now(),e.t3=o,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,JM();case 26:return e.t6=e.sent,e.t7=window.navigator.userAgent,e.t8=mN.VERSION,e.t9=hN.getDeviceId(),e.t10=this._appId,e.t11=this._roomId,e.t12=this._clientId,e.t13=this._businessId,e.t14=this._useCloudProxy,e.t15=KV[this._roomProfile]?KV[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},a={Authorization:e.t0,sessionId:e.t1,timestamp:e.t2,controlMessage:e.t3,userAttributes:e.t4,sdpInfo:e.t5,params:e.t16,options:e.t17},H_.resolve().then((function(){return m.emit("onSendingJoinMessageHook")})),e.prev=40,c=i?"reconnected":"joinRoom",e.next=44,this._dataChannelSignal.sendSignaling(c,a);case 44:return u=e.sent,YV.print("join","send join message success"),d=u.config||{},l=d.engine_WEB,this._authorization=a.Authorization,this.connectionState="connected",hN.setEngineWebConfig(this._appId,this._roomId,l),this._context&&(this._context.serverConfig={videoCodec:(null==l?void 0:l.video_codec)||"H264",audioRed:!(null==l||!l.pub_audio_red),muteReplaceUnsub:!(null===(h=u.config)||void 0===h||!h.mute_replace_unsub),simulcastOnDemand:!(uw||!1===(null===(f=u.config)||void 0===f||null===(p=f.engine_VPM)||void 0===p||null===(v=p.ondemand)||void 0===v?void 0:v.enable))},"boolean"==typeof(null==l?void 0:l.av_sync)&&(this._context.avSync=l.av_sync)),gV.audioStallConfig=l,null!=u&&null!==(s=u.relayMessage)&&void 0!==s&&s.sdp&&(null===(_=this._handler)||void 0===_||_.createAVMlineAnswerTpl(u.relayMessage.sdp)),e.abrupt("return",u);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 cA(aA.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 cA(aA.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 y.apply(this,arguments)})},{key:"publish",value:(g=Sm(gm().mark((function e(t){var r,n,i,o,a,s,c,u,d,l,h,f,p,v,_,m,g,y,S=this;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return YV.print("publish()","localStream: %o",t),r=t.videoTrack,n=t.audioTrack,i=iw(),o="",a="",e.prev=6,e.next=9,null===(s=this._handler)||void 0===s?void 0:s.publish(t);case 9:if(p=e.sent){e.next=12;break}throw new cA(aA.ADD_TRANSCEIVER_FAILED,"add transceiver failed");case 12:return o=p.audioMid,a=p.videoMid,t.pubAttributes={localaudio:!!n,localvideo:!!r,videostream:t.pubVideo,audiostream:t.pubAudio,extvideo:!!(r instanceof PU),extaudio:!!(n instanceof MU)},v={attributes:sd({videoDescriptions:p.videoDescriptions},t.pubAttributes),audio:!0,video:!0,screen:t.isScreen,audioMid:o,videoMid:a,sdpInfo:{msid:t.stream.id,type:p.type,sdp:p.partialSdp,semantics:p.semantics}},(_=t.enableSimulcast&&(null===(c=this._context)||void 0===c||null===(u=c.serverConfig)||void 0===u?void 0:u.simulcastOnDemand)&&(null===(d=p.subVideoDescriptions)||void 0===d?void 0:d.length))&&(v.attributes.subVideoDescriptions=p.subVideoDescriptions),e.next=20,null===(l=this._dataChannelSignal)||void 0===l?void 0:l.sendSignaling("publish",v);case 20:if(200===(null==(m=e.sent)?void 0:m.code)){e.next=23;break}throw new cA(aA.PUBLISH_FAILED,(null==m?void 0:m.message)||"publish failed");case 23:if(Wx.rtcRecvAnswer(0,wx.INCRANSWER,(null==m||null===(h=m.relayMessage)||void 0===h?void 0:h.sequenceId)||0,null==m||null===(f=m.relayMessage)||void 0===f?void 0:f.sdp,Cx.UP,"",""),g=new H_((function(e,r){var n,i,s;null===(n=S._handler)||void 0===n||n.handleAck({action:wV.publish,streamId:m.streamId,audioMid:o,videoMid:a,audioTransceiverInit:null==p?void 0:p.audioTransceiverInit,videoTransceiverInit:null==p?void 0:p.videoTransceiverInit,signalingAck:{sdp:null==m||null===(i=m.relayMessage)||void 0===i?void 0:i.sdp,sequenceId:null==m||null===(s=m.relayMessage)||void 0===s?void 0:s.sequenceId},sdp:p.sdp,stream:t,onSuccess:function(){YV.print("publish()","publish success"),e(0)}})})),e.t0=!uw,!e.t0){e.next=29;break}return e.next=29,g;case 29:return _&&this.emit(wN.RSCP,[{StreamIds:[t.stream.id],Metadata:{VideoIndex:0}}]),t.streamId=m.streamId,t.videoMid=a,t.audioMid=o,t.subVideoDescriptions=p.subVideoDescriptions,this.monitor.rtcPublishStat(Ox.SUCCESS,Dx.W_0,i,xx.UNKNOWN),t.statsReport.setLocalStreamStatsEvtInterval(this,this._handler,this.monitor,this._context),e.abrupt("return");case 39:return e.prev=39,e.t1=e.catch(6),e.t1 instanceof Error&&this.monitor.rtcPublishStat(Ox.FAIL,Dx.W_0,i,e.t1.message),e.next=44,null===(y=this._handler)||void 0===y?void 0:y.rollback(t.stream.id,t);case 44:throw e.t1;case 45:case"end":return e.stop()}}),e,this,[[6,39]])}))),function(e){return g.apply(this,arguments)})},{key:"updatePubTrack",value:(m=Sm(gm().mark((function e(t){var r,n,i,o,a,s,c,u,d,l,h,f,p,v,_,m,g,y,S,E,b,k,T,I,R,A,w,C,O,D,x;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:YV.print("updatePubTrack()","localStream: %o",t),i=t.videoTrack,o=t.audioTrack,a=t.pubAudio,s=t.pubVideo,c=null==o?void 0:o.getTrack("preprocessing"),u=null==i?void 0:i.getTrack("preprocessing"),s&&u?null===(d=t.videoTransceiver)||void 0===d||d.sender.replaceTrack(u):null===(l=t.videoTransceiver)||void 0===l||l.sender.replaceTrack(null),null===(r=this._handler)||void 0===r||r.updateMaxBitrate(t),a&&c?(f=o.mixType,(p=o.mixedAudioTrack)&&f!==Fd.PLAYOUT&&!0===c.enabled&&(c=p),null===(h=t.audioTransceiver)||void 0===h||h.sender.replaceTrack(c)):(null===(v=t.audioTransceiver)||void 0===v||v.sender.replaceTrack(null),this.monitor.rtcInvokeStatus("null",0,"MediaClient.updatePubTrack(audio)","",0));try{this.monitor.rtcInvokeStatus(hk({audioStreamTrack:xw(c),videoStreamTrack:xw(u)}),0,"MediaClient.updatePubTrack","",0)}catch(nW){}for(m={},g=0,y=mA(_={localaudio:!!o,localvideo:!!i,videostream:s,audiostream:a,extvideo:!!(i instanceof PU),extaudio:!!(o instanceof MU)});g<y.length;g++)S=WT(y[g],2),E=S[0],(b=S[1])!==iI(t.pubAttributes,E)&&PC(m,E,b);if(an(m).length){e.next=13;break}return e.abrupt("return");case 13:return t.observer&&(k=t.observer,T=m.audiostream,I=m.videostream,R=m.localaudio,A=m.localvideo,w=m.extaudio,C=m.extvideo,void 0!==A?void 0!==C?k.setPushVideo(C):k.setEnableVideo(A):void 0!==I&&k.setUnmuteVideo(I),void 0!==R?void 0!==w?k.setPushAudio(w):k.setEnableAudio(R):void 0!==T&&k.setUnmuteAudio(T)),t.pubAttributes=_,O={roomId:this._roomId,streamId:t.streamId,attributes:m},e.next=18,null===(n=this._dataChannelSignal)||void 0===n?void 0:n.sendSignaling("updateStreamAttributes",O);case 18:if(200===(null==(D=e.sent)?void 0:D.code)){e.next=21;break}throw new cA(aA.UPDATE_TRACK_FAILED,(null==D?void 0:D.message)||"update track failed");case 21:if(!uw){e.next=24;break}return e.next=24,null===(x=this._handler)||void 0===x?void 0:x.setCurrentDescription();case 24:case"end":return e.stop()}}),e,this)}))),function(e){return m.apply(this,arguments)})},{key:"updateToken",value:(_=Sm(gm().mark((function e(t){var r,n,i,o,a;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(YV.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===(o=this._dataChannelSignal)||void 0===o?void 0:o.sendSignaling("updateToken",i);case 8:if(200===(null==(a=e.sent)?void 0:a.code)){e.next=11;break}throw new cA(aA.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 cA(aA.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 _.apply(this,arguments)})},{key:"unpublish",value:(v=Sm(gm().mark((function e(t){var r,n,i;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return YV.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:wV.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 v.apply(this,arguments)})},{key:"subscribe",value:(p=Sm(gm().mark((function e(t,r,n){var i=this;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new H_(function(){var e=Sm(gm().mark((function e(o,a){var s,c,u,d,l,h,f,p,v,_,m,g,y,S,E,b,k,T,I,R,A,w,C,O,D,x,N,P,M,L;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.streamState!==kV.SUB_ED){e.next=2;break}return e.abrupt("return",i._updateSubTrack(t,r,zV.SUB).then(o,a));case 2:if(t.streamState!==kV.SUB_ING){e.next=7;break}return i._subStreamQueue[t.streamId]||(i._subStreamQueue[t.streamId]=[]),YV.print("_subStreamQueue","streamId: %o, enqueue",t.streamId),i._subStreamQueue[t.streamId].push({fn:i.subscribe,args:[t,r,n],resolve:o,reject:a}),e.abrupt("return");case 7:if(YV.print("subscribe()","mediaType: %o",r),ZV("subscribe()",t),t.streamState=kV.SUB_ING,c=!1,u=!1,ww(r)&&(u=!0),Cw(r)&&(c=!0),c||!i.multiChatMode()){e.next=17;break}return t.streamState=kV.INIT,i.emit("SUB_END",t.streamId),e.abrupt("return",o(null));case 17:return d=iw(),l=t.subVideo,h=[],f=!i.multiChatMode(),i._subResolves[t.streamId]||(i._subResolves[t.streamId]=[]),h.push(new H_((function(e,r){i._subResolves[t.streamId].push(e);var n=setTimeout((function(){return r(new cA(aA.TIME_OUT,"wait video timeout for userId: ".concat(t.userId)))}),QV);t.on("ontrack",(function r(i){"video"===i.mediaType&&(YV.print("remoteStream ".concat(t.userId," received video track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),f&&h.push(new H_((function(e,r){i._subResolves[t.streamId].push(e);var n=setTimeout((function(){return r(new cA(aA.TIME_OUT,"wait audio timeout for userId: ".concat(t.userId)))}),QV);t.on("ontrack",(function r(i){"audio"===i.mediaType&&(YV.print("remoteStream ".concat(t.userId," received audio track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),p=function(e){t.ontrack(e)},null===(s=i._handler)||void 0===s||s.on("ontrack",p),i._ontrackCallbackMap.set(t,p),e.prev=27,e.next=30,null===(v=i._handler)||void 0===v?void 0:v.subscribe(t,{multiChatMode:i.multiChatMode()});case 30:if(k=e.sent){e.next=33;break}throw new cA(aA.ADD_TRANSCEIVER_FAILED,"add transceiver failed");case 33:return T=k.audioMid,I=k.videoMid,t.subVideo=c,R={spatialLayer:(null==n?void 0:n.spatialLayer)||0,temporalLayer:0,spatialSubLayer:(null==n?void 0:n.spatialSubLayer)||-1},A={audio:!i.multiChatMode(),video:!0,data:!0,screen:t.isScreen,browser:"chrome-stable",videoMid:I,audioMid:T,sdpInfo:{sdp:null==k?void 0:k.partialSdp,semantics:null==k?void 0:k.semantics,type:null==k?void 0:k.type},streamUserId:t.userId,streamId:t.streamId,config:{enableMediaType:{audio:!!i.multiChatMode()||u,video:c},qualityLayer:R},extra:{enableSendRTT:!0}},w=i._context||{},C=w.subscribeFallbackOption,O=w.userPriority,"number"==typeof C&&(A.config.fallbackOption=C),null!=O&&O.has(t.userId)&&(A.config.priority=O.get(t.userId)),null!=k&&k.allSsrc&&(A.extra.subscribeSSRC=k.allSsrc),e.next=44,null===(_=i._dataChannelSignal)||void 0===_?void 0:_.sendSignaling("subscribe",A);case 44:if(200===(null==(D=e.sent)?void 0:D.code)){e.next=47;break}throw new cA(aA.SUBSCRIBE_FAILED,(null==D?void 0:D.message)||"subscribe failed");case 47:return x=null==D?void 0:D.relayMessage,N=x.audioMid,P=x.videoMid,od(m={},T,N),od(m,I,P),M=m,YV.print("sub midmap",t.userId,M),t.videoMid=I,t.audioMid=T,t.subMediaType=r,t.streamState=kV.SUB_ED,t.subLayer=R,Wx.rtcRecvAnswer(0,wx.INCRANSWER,(null==D||null===(g=D.relayMessage)||void 0===g?void 0:g.sequenceId)||0,null==D||null===(y=D.relayMessage)||void 0===y?void 0:y.sdp,Cx.DOWN,t.streamId,t.userId),e.next=58,null===(S=i._handler)||void 0===S?void 0:S.handleAck({action:wV.subscribe,streamId:t.streamId,audioMid:T,videoMid:I,audioTransceiverInit:null==k?void 0:k.audioTransceiverInit,videoTransceiverInit:null==k?void 0:k.videoTransceiverInit,signalingAck:{sdp:null==D||null===(E=D.relayMessage)||void 0===E?void 0:E.sdp,sequenceId:null==D||null===(b=D.relayMessage)||void 0===b?void 0:b.sequenceId},stream:t,sdp:k.sdp,generatorSsrc:!!k.allSsrc});case 58:return e.next=60,H_.all(h);case 60:i.multiChatMode()||(t.subAudio=u),i.monitor.rtcSubscribeStat(Nx.SUCCESS,d,Px.UNKNOWN,t.userId),i._context&&t.statsReport.setRemoteStreamStatsEvtInterval(i,i._handler,i.monitor,i._context),o(null),i.emit("SUB_END",t.streamId),e.next=76;break;case 67:return e.prev=67,e.t0=e.catch(27),e.t0 instanceof Error&&i.monitor.rtcSubscribeStat(Nx.FAIL,d,e.t0.message,t.userId),t.subVideo=l,t.streamState=kV.INIT,e.next=74,null===(L=i._handler)||void 0===L?void 0:L.rollback(t.streamId,t);case 74:a(e.t0),i.emit("SUB_END",t.streamId);case 76:case"end":return e.stop()}}),e,null,[[27,67]])})));return function(t,r){return e.apply(this,arguments)}}()));case 1:case"end":return e.stop()}}),e)}))),function(e,t,r){return p.apply(this,arguments)})},{key:"_handleSubStreamQueue",value:function(e){var t,r=this;if(null!==(t=this._subStreamQueue[e])&&void 0!==t&&t.length){YV.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 YV.print("_subStreamQueue","streamId: %o, END",e)}},{key:"controlMessage",value:(f=Sm(gm().mark((function e(t){var r,n;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return YV.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 f.apply(this,arguments)})},{key:"updateUserAttributes",value:(h=Sm(gm().mark((function e(t){var r;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return YV.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 h.apply(this,arguments)})},{key:"updateSubTrack",value:(l=Sm(gm().mark((function e(t,r,n){return gm().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 l.apply(this,arguments)})},{key:"updateSubTrackLayer",value:(d=Sm(gm().mark((function e(t,r){var n,i,o;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(YV.print("updateSubTrack()","subLayer: %o",r),t.subLayer.spatialLayer!==r.spatialLayer||t.subLayer.spatialSubLayer!==r.spatialSubLayer){e.next=4;break}return YV.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==(o=e.sent)?void 0:o.code)){e.next=10;break}throw new cA(aA.UPDATE_TRACK_FAILED,(null==o?void 0:o.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 d.apply(this,arguments)})},{key:"_updateSubTrack",value:(u=Sm(gm().mark((function e(t,r,n){var i,o,a,s,c,u,d,l,h,f,p;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(YV.print("updateSubTrack()","mediaType: %o",r),ZV("updateSubTrack()",t),!this.multiChatMode()||r!==gd.AUDIO){e.next=5;break}return YV.print("updateSubTrack","multiChatMode mediaType only audio"),e.abrupt("return",t);case 5:return a=0,a=n===zV.SUB?t.subMediaType|r:t.subMediaType-(t.subMediaType&r),YV.print("updateSubTrack","prev: %o, direction: %o, mediaType: %o, newMediaType: %o",t.subMediaType,n,r,a),t.subMediaType===a&&YV.print("updateSubTrack","mediaType no change"),s=!1,c=!1,ww(a)&&(c=!0),Cw(a)&&(s=!0),u={roomId:this._roomId,streamList:[t.streamId],config:{enableMediaType:{video:s,audio:!!this.multiChatMode()||c}}},d=this._context||{},l=d.subscribeFallbackOption,h=d.userPriority,"number"==typeof l&&(u.config.fallbackOption=l),null!=h&&h.has(t.userId)&&(u.config.priority=h.get(t.userId)),e.next=18,null===(i=this._dataChannelSignal)||void 0===i?void 0:i.sendSignaling("updateSubscribe",u);case 18:if(200===(null==(f=e.sent)?void 0:f.code)){e.next=21;break}throw new cA(aA.UPDATE_TRACK_FAILED,(null==f?void 0:f.message)||"update track failed");case 21:return this.multiChatMode()||(null===(p=t.observer)||void 0===p||p.setUnmuteAudio(c),t.subAudio=c),null===(o=t.observer)||void 0===o||o.setUnmuteVideo(s),t.subVideo=s,t.subMediaType=a,e.abrupt("return",t);case 26:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return u.apply(this,arguments)})},{key:"subscribe4pushTrack",value:(c=Sm(gm().mark((function e(t,r){var n,i,o,a,s,c,u,d,l;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return YV.print("subscribe4pushTrack()","streamInfo: %o",r),ZV("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(s=e.sent){e.next=9;break}throw new cA(aA.ADD_TRANSCEIVER_FAILED,"add transceiver failed");case 9:return c=s.audioMid,u=s.videoMid,(d=[]).push(new H_((function(e,r){var n=setTimeout((function(){return r(new cA(aA.TIME_OUT,"wait audio timeout for userId: ".concat(t.userId)))}),QV);t.on("ontrack",(function r(i){"audio"===i.mediaType&&(YV.print("remoteStream ".concat(t.userId," received audio track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),l=function(e){t.ontrack(e)},null===(o=this._handler)||void 0===o||o.on("ontrack",l),this._ontrackCallbackMap.set(t,l),e.next=18,null===(a=this._handler)||void 0===a?void 0:a.handleAck({action:wV.pushtrack,streamId:t.streamId,audioMid:c,videoMid:u,stream:t,audioTransceiverInit:null==s?void 0:s.audioTransceiverInit,videoTransceiverInit:null==s?void 0:s.videoTransceiverInit,signalingAck:null==r?void 0:r.message,sdp:s.sdp});case 18:return e.next=20,H_.all(d);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 c.apply(this,arguments)})},{key:"unsubscribe4removeTrack",value:(s=Sm(gm().mark((function e(t,r){return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:ZV("unsubscribe4removeTrack()",t),YV.print("unsubscribe4removeTrack()","sequenceId: ",r.sequenceId);case 2:case"end":return e.stop()}}),e)}))),function(e,t){return s.apply(this,arguments)})},{key:"unsubscribe",value:(a=Sm(gm().mark((function e(t,r){var n,i,o=arguments;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=o.length>2&&void 0!==o[2]&&o[2],ZV("unsubscribe()",t),!n){e.next=4;break}return e.abrupt("return",this._unsubscribe(t,r));case 4:if(!this.multiChatMode()||!Cw(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!==aV.NONE){e.next=9;break}return e.abrupt("return",this._unsubscribe(t,r));case 9:return e.abrupt("return",this._updateSubTrack(t,r,zV.UNSUB));case 10:case"end":return e.stop()}}),e,this)}))),function(e,t){return a.apply(this,arguments)})},{key:"_unsubscribe",value:(o=Sm(gm().mark((function e(t,r){var n,i,o,a,s,c;return gm().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,zV.UNSUB));case 4:return s={roomId:this._roomId,streamId:t.streamId,userId:t.userId},null===(n=this._dataChannelSignal)||void 0===n||n.sendSignaling("unsubscribe",s).catch((function(){})),t.streamState=kV.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),!this.multiChatMode()&&(null===(o=t.observer)||void 0===o||o.setSubscribeAudio(!1)),e.next=13,null===(a=this._handler)||void 0===a?void 0:a.handleAck({action:wV.unsubscribe,streamId:t.streamId,audioMid:t.audioMid,videoMid:t.videoMid,stream:t});case 13:c=e.sent,this._subResolves[c]&&this._subResolves[c].forEach((function(e){return e(0)})),YV.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 o.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:(i=Sm(gm().mark((function e(t,r){return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(ZV("handleRemoveStream()",t),t.subVideo=!1,t.hasSubscribed){e.next=4;break}return e.abrupt("return");case 4:this.unsubscribe(t,gd.AUDIO_AND_VIDEO,!0);case 5:case"end":return e.stop()}}),e,this)}))),function(e,t){return i.apply(this,arguments)})},{key:"leave",value:(n=Sm(gm().mark((function e(){var t,r,n;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(YV.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",H_.reject(new cA(aA.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=Sm(gm().mark((function e(t){var r,n,i,o,a,s,c,u,d,l,h,f,p,v,_,m=this;return gm().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(a=e.sent){e.next=5;break}throw new cA(aA.ADD_TRANSCEIVER_FAILED,"add transceiver failed");case 5:return s=iw(),c=a.audioMid,u=a.videoMid,e.t0=this._appId,e.t1=t.streamId,e.t2=c,e.t3=u,e.t4={sdp:null==a?void 0:a.partialSdp,semantics:null==a?void 0:a.semantics,type:null==a?void 0:a.type},e.next=15,JM();case 15:return e.t5=e.sent,e.t6=window.navigator.userAgent,e.t7=mN.VERSION,e.t8=hN.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}},d={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",d);case 27:return l=e.sent,h=[],this._subResolves[t.streamId]=[],h.push(new H_((function(e,r){m._subResolves[t.streamId].push(e);var n=setTimeout((function(){return r(new cA(aA.TIME_OUT,"wait video timeout for streamId: ".concat(t.streamId)))}),QV);t.on("ontrack",(function r(i){"video"===i.mediaType&&(YV.print("remoteStream ".concat(t.userId," received video track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),h.push(new H_((function(e,r){m._subResolves[t.streamId].push(e);var n=setTimeout((function(){return r(new cA(aA.TIME_OUT,"wait audio timeout for streamId: ".concat(t.streamId)))}),QV);t.on("ontrack",(function r(i){"audio"===i.mediaType&&(YV.print("remoteStream ".concat(t.userId," received audio track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),f=function(e){t.ontrack(e)},null===(i=this._handler)||void 0===i||i.on("ontrack",f),this._ontrackCallbackMap.set(t,f),p=null==l?void 0:l.relayMessage,v=p.sequenceId,_=p.sdp,t.videoMid=u,t.audioMid=c,t.sequenceId=v,t.streamState=kV.SUB_ED,t.subAudio=!0,t.subVideo=!0,e.next=44,null===(o=this._handler)||void 0===o?void 0:o.handleAck({action:wV.subscribe,streamId:t.streamId,audioMid:c,videoMid:u,audioTransceiverInit:null==a?void 0:a.audioTransceiverInit,videoTransceiverInit:null==a?void 0:a.videoTransceiverInit,signalingAck:{sdp:_,sequenceId:v},stream:t});case 44:return e.next=46,H_.all(h);case 46:this.monitor.rtcSubscribeStat(Nx.SUCCESS,s,Px.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=Sm(gm().mark((function e(t){var r,n,i;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return ZV("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=kV.INIT,t.subVideo=!1,t.subAudio=!1,e.next=14,null===(r=this._handler)||void 0===r?void 0:r.handleAck({action:wV.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;YV.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}}]),b}(IC);function eF(e,t,r){var n=r.value;return r.value=Sm(gm().mark((function e(){var r,i,o,a=arguments;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._handler||"connected"!==this._state){e.next=6;break}for(r=a.length,i=new Array(r),o=0;o<r;o++)i[o]=a[o];return e.next=4,n.apply(this,i);case 4:e.next=7;break;case 6:throw new cA(aA.NOT_CONNECTED_YET,"error in ".concat(t,": try again after joined"));case 7:case"end":return e.stop()}}),e,this)}))),r}function tF(e,t,r){var n=r.value;return r.value=Sm(gm().mark((function e(){var t,r,i,o,a=arguments;return gm().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=a.length,i=new Array(r),o=0;o<r;o++)i[o]=a[o];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}WV([function(e,t,r){var n=r.value;return r.value=Sm(gm().mark((function e(){var t,r,i,o,a=this,s=arguments;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(t=s.length,r=new Array(t),i=0;i<t;i++)r[i]=s[i];return o=!1,e.abrupt("return",new H_(function(){var e=Sm(gm().mark((function e(t,i){var s;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a.on("INTERRUPT",(function(){o=!0,i(new cA(aA.OPERATION_CANCEL,"operation not finish when leave"))})),e.prev=1,e.next=4,n.apply(a,r);case 4:s=e.sent,t(s),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(1),o||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}],$V.prototype,"join",1),WV([tF,eF],$V.prototype,"publish",1),WV([tF,eF],$V.prototype,"updatePubTrack",1),WV([tF,eF],$V.prototype,"unpublish",1),WV([tF,eF],$V.prototype,"subscribe",1),WV([eF],$V.prototype,"controlMessage",1),WV([eF],$V.prototype,"updateUserAttributes",1),WV([eF],$V.prototype,"updateSubTrack",1),WV([eF],$V.prototype,"updateSubTrackLayer",1),WV([tF,eF],$V.prototype,"subscribe4pushTrack",1),WV([tF,eF],$V.prototype,"unsubscribe4removeTrack",1),WV([tF,eF],$V.prototype,"unsubscribe",1),WV([eF],$V.prototype,"handleRemoveStream",1),WV([tF],$V.prototype,"subscribePublicStream",1),WV([tF],$V.prototype,"unsubscribePublicStream",1);var rF=fE.right,nF=pe,iF=nf;Ar({target:"Array",proto:!0,forced:!ku("reduceRight")||!iF&&nF>79&&nF<83},{reduceRight:function(e){return rF(this,e,arguments.length,arguments.length>1?arguments[1]:void 0)}});var oF=Us("Array").reduceRight,aF=ae,sF=oF,cF=Array.prototype,uF=function(e){var t=e.reduceRight;return e===cF||aF(cF,e)&&t===cF.reduceRight?sF:t},dF={};id(dF,"__esModule",{value:!0});var lF=function(){return(lF=LE||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 hF(e,t){var r="function"==typeof fl&&Ak(e);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 fF(e){return"object"==xl(e)&&null!==e}function pF(e){return"function"==typeof e}function vF(){if("object"==("undefined"==typeof window?"undefined":xl(window))&&fF(window))return window}function _F(){if("object"==("undefined"==typeof document?"undefined":xl(document))&&fF(document))return document}var mF=function(e){if(e)return e.__SLARDAR_REGISTRY__||(e.__SLARDAR_REGISTRY__={Slardar:{plugins:[],errors:[],subject:{}}}),e.__SLARDAR_REGISTRY__.Slardar},gF=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||mm(Array.prototype).call(t,0,i))[i]=t[i]);return Im(e).call(e,n||mm(Array.prototype).call(t))}([],hF(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=mF(vF());r&&(r.errors||(r.errors=[]),r.errors.push(e))}(o),[]}},yF=function(e){return e.requestIdleCallback||function(t){return e.setTimeout(t,1)}},SF=function(){return Date.now()};var EF=function(e,t){return fF(e)?lF(lF({},t),e):!!e&&t};var bF=["SCRIPT","STYLE","META","HEAD"],kF=["js_error","http","resource_error"],TF=["performance","performance_longtask","performance_timing","custom"],IF=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=bF),!t||-1<Ob(o).call(o,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 uF([]).call(t.children,(function(t,n){return e(n,r+1,t,i,o)}),n+a)},RF=function(e,t,r,n){if(function(){if(vF()&&"Promise"in window)return H_}()&&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(){yF(r)((function(){r.html2canvas&&r.html2canvas(n.body,{scale:360/r.innerWidth}).then((function(t){e(t.toDataURL("image/jpeg",.1))}))}))}},AF=function(e,t,r,n,i){if(void 0===e&&(e=vF()),void 0===t&&(t=_F()),void 0===r&&(r=function(){if(vF()&&pF(window.PerformanceObserver))return window.PerformanceObserver}()),void 0===n&&(n=function(){if(vF()&&pF(window.MutationObserver))return window.MutationObserver}()),void 0===i&&(i=function(){if(vF()&&fF(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,g=yF(e),y=hF(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 pF(r)&&r.call(e,t)||[]},function(){var t=(e||{}).clearResourceTimings;pF(t)&&t.call(e)},function(t){var r=(e||{}).getEntriesByName;return pF(r)&&r.call(e,t)||[]}]}(i),2)[1],S=0,E=!1,b=function(e){s&&a&&a({ev_type:"blank_screen",payload:{timestamp:s[0],score:s[1],screenshot:e,error:c}})},k=(d=function(){s&&!E&&(E=!0,I(),p?RF(b,m,e,t):b())},function(){l||(h=SF(),l=e.setTimeout((function(){l=0,h<S||d()}),y()>1e4?2e3:8e3))});function T(){u&&clearTimeout(u),u=e.setTimeout((function(){g((function(){e.requestAnimationFrame((function(){var e=v?t.querySelector(v):t.body;e&&((e=IF(e,0,0,f))<f?(s=[SF(),e],k()):s=void 0)}))}))}),1e3)}!function(e){var t=hF(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(){!E&&c&&b()}));var I=function(){clearTimeout(u),A&&A(),C&&C()},R=(o=hF(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]),A=o[1],w=(o=hF(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){var r;-1<Ob(r=e.supportedEntryTypes).call(r,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=vF(),r=_F();t&&r&&("loading"!==r.readyState?e():t.addEventListener("DOMContentLoaded",(function(){setTimeout((function(){e()}),0)}),!1))}((function(){var e;R(null===(e=_F())||void 0===e?void 0:e.body,{subtree:!0,childList:!0}),w("longtask","resource"),T()})),[I,function(e){E||function(e){return~Ob(TF).call(TF,e.ev_type)}(e)||(S=SF(),c&&S-c.timestamp>1e4&&(c=void 0),c=function(e,t){if(-1===Ob(kF).call(kF,t.ev_type))return e;if("http"===t.ev_type&&t.payload.response.status<400)return e;if(e&&Ob(kF).call(kF,e.type)<Ob(kF).call(kF,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:SF()}}(c,e))},T]}},wF="blankScreen";function CF(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],EF(t,r)}(e,wF,t)||EF(r,t);a&&(a=hF(gF(AF,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 OF={autoDetect:!0,threshold:1.5,screenshot:!0,ssUrl:"https://apm.volccdn.com/mars-web/apmplus/web/html2canvas.min.js"};var DF=dF.blankScreenPlugin=function(e){return{name:wF,setup:function(t){!function(e,t){CF(e,OF,t)}(t,e)}}},xF=DA.start;Ar({target:"String",proto:!0,forced:xA},{padStart:function(e){return xF(this,e,arguments.length>1?arguments[1]:void 0)}});var NF,PF=Us("String").padStart,MF=ae,LF=PF,UF=String.prototype,VF=function(e){var t=e.padStart;return"string"==typeof e||e===UF||MF(UF,e)&&t===UF.padStart?LF:t},FF={};id(FF,"__esModule",{value:!0});var BF=function(){return(BF=LE||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 jF(e,t){var r="function"==typeof fl&&Ak(e);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 GF(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||mm(Array.prototype).call(t,0,i))[i]=t[i]);return Im(e).call(e,n||mm(Array.prototype).call(t))}var HF=function(e){return hk({ev_type:"batch",list:e})};var zF=["init","start","config","beforeDestroy","provide","beforeReport","report","beforeBuild","build","beforeSend","send","beforeConfig"],KF=function(){return{}};function XF(e){return"object"==xl(e)&&null!==e}var qF=Object.prototype;function WF(e){return!!XF(e)&&("function"!=typeof Vl?"[object Object]"===qF.toString.call(e):(e=Vl(e))===qF||null===e)}function YF(e){return"[object Array]"===qF.toString.call(e)}function QF(e){return"function"==typeof e}function JF(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function ZF(e,t){var r,n=BF({},e);for(r in t)JF(t,r)&&void 0!==t[r]&&(XF(t[r])&&WF(t[r])?n[r]=ZF(XF(e[r])?e[r]:{},t[r]):YF(t[r])&&YF(e[r])?n[r]=$F(e[r],t[r]):n[r]=t[r]);return n}function $F(e,t){var r;return e=YF(e)?e:[],t=YF(t)?t:[],ck(r=Im(Array.prototype).call(e,t)).call(r,(function(e){return e instanceof RegExp?e:XF(e)&&WF(e)?ZF({},e):YF(e)?$F([],e):e}))}function eB(e,t){if(!YF(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 tB=function(e,t){if(!YF(e))return e;var r=Ob(e).call(e,t);return 0<=r?(t=mm(e).call(e),rk(t).call(t,r,1),t):e},rB=function(e,t,r){return function(e,t,r){for(var n,i=(t=jF(t.split(".")))[0],o=mm(t).call(t,1);e&&0<o.length;)e=e[i],i=(n=jF(o))[0],o=mm(n).call(n,1);if(e)return r(e,i)}(e,t,(function(e,t){if(e&&t in e&&QF(e[t]))try{return e[t].apply(e,r)}catch(n){return}}))};function nB(e){try{return function(e){return"string"==typeof e}(e)?e:hk(e)}catch(t){return"[FAILED_TO_STRINGIFY]:"+String(t)}}var iB=0,oB=function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];console.error.apply(console,GF(["[SDK]",Date.now(),VF(e=""+iB++).call(e,8," ")],jF(t),!1))},aB=0,sB=function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];console.warn.apply(console,GF(["[SDK]",Date.now(),VF(e=""+aB++).call(e,8," ")],jF(t),!1))},cB=function(e){return function(t){for(var r=t,n=0;n<e.length&&r;n++)try{r=e[n](r)}catch(i){oB(i)}return r}};function uB(){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 dB=function e(t,r){var n=EE(r).call(r,(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)}},lB=function(e){function t(e){n=tB(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 dB(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 hB=function(e){var t,r,n,i=(t={},r={},n={set:function(e,i){return t[e]=i,r[e]=nB(i),n},merge:function(e){return t=BF(BF({},t),e),an(e).forEach((function(t){r[t]=nB(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 BF({},r)}},n);e.provide("context",i),e.on("report",(function(e){return e.extra||(e.extra={}),e.extra.context=i.toString(),e}))},fB=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 rB(n,c,mm([]).call(r,1));var s=o[a]||[],c=null!==(c=null==t?void 0:t(e))&&void 0!==c?c:{};s.push(GF([c],jF(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 KF;var a=e[t],s=r.apply(void 0,GF([a],jF(i),!1)),c=s;return QF(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 QF(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=jF(t))[0];var n=mm(n).call(n,1);null!=r&&r(e,t,n)})),o[t]=null)})),n};function pB(e,t){var r=t||{};e.provide("initSubject",(function(e){var t=(e=jF(e,2))[0];e=e[1];return r[t]||(r[t]=function(t,r){var n=lB();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 vB(){if("object"==("undefined"==typeof window?"undefined":xl(window))&&XF(window))return window}function _B(){var e=function(){if(vB()&&"navigator"in window)return window.navigator}();if(e)return e.connection||e.mozConnection||e.webkitConnection}function mB(){var e=vB()&&vB()&&window.location;return null==e?void 0:e.href}var gB=function(e){var t={url:mB(),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 yB(e){return(null==e?void 0:e.effectiveType)||(null==e?void 0:e.type)||""}var SB=function(e,t,r){var n,i=t.url,o=t.data,a=void 0===(n=t.success)?KF:n,s=void 0===(n=t.fail)?KF:n,c=void 0===(n=t.getResponseText)?KF: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)},EB=function(){var e=function(){if("function"==typeof XMLHttpRequest&&QF(XMLHttpRequest))return XMLHttpRequest}();return e?{get:function(t){SB("GET",t,e)},post:function(t){SB("POST",t,e)}}:{get:KF,post:KF}};function bB(e){function t(e){n.post(r.getEndpoint(),HF([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?HF(a):""},clear:function(){clearTimeout(s),a=[]}}}(e),n=function(){var e=vB();return e&&e.navigator.sendBeacon?{get:function(){},post:function(t,r){e.navigator.sendBeacon(t,r)}}:{get:KF,post:KF}}();return function(e){var t=jF(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 kB={build:function(e){return{ev_type:e.ev_type,payload:e.payload,common:BF(BF({},e.extra||{}),e.overrides||{})}}};function TB(e){var t,r=e.plugins||{};for(t in r)r[t]&&!XF(r[t])&&(r[t]={});return BF(BF({},e),{plugins:r})}function IB(e){return XF(e)&&"aid"in e}function RB(e){return BF({},e)}var AB="/settings/get/webpro",wB="/monitor_web/collect",CB=[wB,AB,"/monitor_browser/collect"],OB={sample_rate:1,include_users:[],sample_granularity:"session",rules:{}},DB=function(e,t){return void 0===t&&(t=wB),(e&&0<=Ob(e).call(e,"//")?"":"https://")+e+t},xB=function(e,t){return void 0===t&&(t=AB),(e&&0<=Ob(e).call(e,"//")?"":"https://")+e+t},NB=function(e){return e+"_"+Date.now()},PB=function(e){return"APMPLUS"+e},MB=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=PB(e))||{userId:uB(),deviceId:uB(),r:Math.random()}},LB=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:hk(t);localStorage.setItem(e,r)}catch(n){}}(t=PB(t),{userId:r,deviceId:n,r:e.r})},UB=function(e){var t,r,n,i=e,o={},a=KF,s=KF;return{getConfig:function(){return i},setConfig:function(e){return o=BF(BF({},o),e||{}),c(),t||(t=e,i.useLocalConfig?(n={},a()):r?u():function(e,t,r,n){e.get({withCredentials:!0,url:xB(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()),LB(i),t()},n&&a()}};function c(){var t=BF(BF(BF({},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=ZF(r,e[n++]);return r}(e.plugins,(null==n?void 0:n.plugins)||{},o.plugins||{}),t.sample=VB(VB(e.sample,null==n?void 0:n.sample),o.sample),i=t,s()}function u(){n=function(e){var t;if(!e)return{};var r=e.sample,n=e.timestamp,i=e.status;if(!r)return{};var o=r.sample_rate;return e=r.sample_granularity,{sample:{include_users:r.include_users,sample_rate:i&&4===i?0:o,sample_granularity:e,rules:EE(t=r.rules).call(t,(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:n}}(r),c(),a()}};function VB(e,t){var r;if(!e||!t)return e||t;var n=BF(BF({},e),t);return n.include_users=GF(GF([],jF(e.include_users||[]),!1),jF(t.include_users||[]),!1),n.rules=EE(r=GF(GF([],jF(an(e.rules||{})),!1),jF(an(t.rules||{})),!1)).call(r,(function(r,n){var i;return n in r||(n in(e.rules||{})&&n in(t.rules||{})?(r[n]=BF(BF({},e.rules[n]),t.rules[n]),r[n].conditional_sample_rules=GF(GF([],jF(e.rules[n].conditional_sample_rules||[]),!1),jF(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}),{}),n}var FB=function(e){e.on("report",(function(e){return function(e){var t={url:mB(),timestamp:Date.now()};return BF(BF({},e),{extra:BF(BF({},t),e.extra||{})})}(e)}))},BB=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,BF(BF({},e),{extra:BF(BF({},r),e.extra||{})})}(t,e.config())}))},jB=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){var t;return XF(e)?EE(t=an(e)).call(t,(function(t,r){return t+"&"+r+"="+e[r]}),"").replace("&","?"):""}(r))}))},GB=function(e){return e=MB(e.aid),{aid:0,pid:"",token:"",viewId:NB("_"),userId:e.userId,deviceId:e.deviceId,sessionId:uB(),domain:"apmplus.volces.com",plugins:{ajax:{ignoreUrls:CB},fetch:{ignoreUrls:CB},breadcrumb:{},pageview:{},jsError:{},resource:{},resourceError:{},performance:{},tti:{},fmp:{},blankScreen:!1},release:"",env:"production",sample:BF(BF({},OB),{r:e.r}),transport:EB()}};NF=FF.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={};zF.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)sB("already inited");else{if(!(e&&XF(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&&XF(e)&&(m("beforeConfig",!1,e),null!=r&&r.setConfig(e))},config:function(e){if(l)return e&&XF(e)&&(m("beforeConfig",!1,e),null!=r&&r.setConfig(s(e))),null==r?void 0:r.getConfig()},provide:function(e,t){eB(v,e)?sB("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=cB(d.beforeReport)(e))||(e=cB(d.report)(e))&&(h?this.build(e):p.push(e)))},build:function(e){!h||(e=cB(d.beforeBuild)(e))&&(!(e=n.build(e))||(e=cB(d.build)(e))&&this.send(e))},send:function(e){!h||(e=cB(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]=tB(d[e],t))}};return v=an(_),_;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,GF([],jF(r),!1))}catch(t){}})),t&&(d[e].length=0)}}({validateInitConfig:IB,initConfigNormalizer:TB,userConfigNormalizer:RB,createSender:void 0===t?function(e){return bB({size:20,endpoint:DB(e.domain),transport:e.transport})}:t,builder:void 0===e?kB:e,createDefaultConfig:void 0===r?GB:r,createConfigManager:UB});return hB(n),r=function(e){if(e)return e.__SLARDAR_REGISTRY__||(e.__SLARDAR_REGISTRY__={Slardar:{plugins:[],errors:[],subject:{}}}),e.__SLARDAR_REGISTRY__.Slardar}(vB()),pB(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),BB(n),FB(n),function(e){var t=_B(),r=yB(t);t&&(t.onchange=function(){r=yB(t)}),e.on("report",(function(e){return BF(BF({},e),{extra:BF(BF({},e.extra||{}),{network_type:r})})}))}(n),jB(n),r=fB(n,gB,(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=jF(r))[0],t=mm(t).call(t,1);n[e].apply(n,GF([],jF(t),!1))}))})),function(e){e.on("init",(function(){var t=[],r=e.config();r&&r.integrations&&r.integrations.forEach((function(r){eB(t,r.name)||(t.push(r.name),r.setup(e),r.tearDown&&e.on("beforeDestroy",r.tearDown))}))}))}(r),r},FF.getDefaultConfig=GB;var HB={};id(HB,"__esModule",{value:!0});var zB=function(){return(zB=LE||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 KB(e,t){var r="function"==typeof fl&&Ak(e);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 XB(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||mm(Array.prototype).call(t,0,i))[i]=t[i]);return Im(e).call(e,n||mm(Array.prototype).call(t))}var qB=function(){return{}};function WB(e){return"object"==xl(e)&&null!==e}var YB=Object.prototype;function QB(e){return"function"==typeof e}function JB(e){return"string"==typeof e}function ZB(e){return function(e){return"[object Array]"===YB.toString.call(e)}(e)&&e.length?function(e){for(var t=[],r=e.length,n=0;n<r;n++){var i=e[n];JB(i)?t.push(i.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")):i&&i.source&&t.push(i.source)}return new RegExp(t.join("|"),"i")}(e):null}function $B(e){try{return JB(e)?e:hk(e)}catch(t){return"[FAILED_TO_STRINGIFY]:"+String(t)}}var ej=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 qB;var a=e[t],s=r.apply(void 0,XB([a],KB(i),!1)),c=s;return QB(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 QB(a)&&a.apply(this,e)}}),e[t]=c,function(r){r||(c===e[t]?e[t]=a:s=a)}}};function tj(){if("object"==("undefined"==typeof window?"undefined":xl(window))&&WB(window))return window}var rj=function(e){if(e)return e.__SLARDAR_REGISTRY__||(e.__SLARDAR_REGISTRY__={Slardar:{plugins:[],errors:[],subject:{}}}),e.__SLARDAR_REGISTRY__.Slardar},nj=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=rj(tj());r&&(r.errors||(r.errors=[]),r.errors.push(e))};function ij(e,t,r){return function(e,t){return WB(e)?zB(zB({},t),e):!!e&&t}(t=null===(e=e.config())||void 0===e?void 0:e.plugins[t],r)}var oj=["name","message","stack","filename","lineno","colno"],aj=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&&WB(e)?EE(t).call(t,(function(t,r){return t[r]=e[r],t}),{}):e}(e,oj):(function(e){return!!WB(e)&&("function"!=typeof Vl?"[object Object]"===YB.toString.call(e):(e=Vl(e))===YB||null===e)}(e)||function(e){return"undefined"!=typeof Event&&function(e,t){try{return e instanceof t}catch(r){return!1}}(e,Event)}(e)||JB(e))&&(t={message:$B(e)}),t},sj=function(e){return aj(e.error)},cj=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=aj(r);return zB(zB({},n),{name:null!==(t=n&&n.name)&&void 0!==t?t:"UnhandledRejection"})}}catch(i){}},uj=function(e){return(function(e){return"[object ErrorEvent]"===Object.prototype.toString.call(e)}(e)?sj:function(e){return"[object PromiseRejectionEvent]"===Object.prototype.toString.call(e)}(e)?cj:aj)(e)},dj=["EventTarget","Window","Node","ApplicationCache","ChannelMergerNode","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","MessagePort","Notification","SVGElementInstance","Screen","TextTrack","TextTrackCue","TextTrackList","WebSocket","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],lj=["setTimeout","setInterval","requestAnimationFrame","requestIdleCallback"],hj=["onload","onerror","onprogress","onreadystatechange"],fj="addEventListener",pj=function(e,t,r){var n;function i(t,r){if(!QB(t))return t;var n={type:"capture-global",data:zB({},r)},o=t._w_||(t._w_=function(){try{return(t.handleEvent&&QB(t.handleEvent)?t.handleEvent:t).apply(this,ck([]).call(arguments,(function(e){return i(e,r)})))}catch(a){var o=aj(a);throw o&&e({error:o,source:n}),a}});return o._hook_=!0,o}void 0===t&&(t=tj()),void 0===r&&(r=function(){if("function"==typeof XMLHttpRequest&&QB(XMLHttpRequest))return XMLHttpRequest}());var o=[];return t&&o.push.apply(o,XB([],KB(ck(n=Gs(lj).call(lj,(function(e){return t[e]}))).call(n,(function(e){return ej(t,e,(function(t){return function(r){for(var n=[],o=1;o<arguments.length;o++)n[o-1]=arguments[o];return t&&t.call.apply(t,XB([this,i(r,{function:e})],KB(n),!1))}}),!1)()}))),!1)),r&&r.prototype&&o.push(ej(r.prototype,"send",(function(e){return function(){for(var t,r=this,n=[],a=0;a<arguments.length;a++)n[a]=arguments[a];return o.push.apply(o,XB([],KB(ck(t=Gs(hj).call(hj,(function(e){return r[e]&&!r[e]._hook_}))).call(t,(function(e){var t=ej(r,e,(function(t){return i(t,{function:e})}),!1)();return function(){t(),r[e]._hook_=void 0}}))),!1)),e.apply(this,n)}}),!1)()),dj.forEach((function(e){var r=t[e]&&t[e].prototype;r&&r.addEventListener&&(o.push(ej(r,fj,(function(t){return function(r,n,o){try{var a=n.handleEvent;QB(a)&&(n.handleEvent=i(a,{function:"handleEvent",target:e}))}catch(s){}return t&&t.call(this,r,i(n,{function:fj,target:e}),o)}}),!1)()),o.push(ej(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)()))})),o},vj=function(e,t){return e&&t&&e===t},_j=function(){var e;return function(t){try{if(function(e,t){return!!(e&&t&&vj(e.message,t.message)&&vj(e.stack,t.stack))}(t,e))return void(e=t)}catch(r){nj(r)}return e=t}},mj=function(e){if(e=void 0===e?tj():e)return function(t,r){var n,i,o=t.ignoreErrors,a=t.onerror,s=t.onunhandledrejection,c=t.dedupe,u=(t=t.captureGlobalAsync,ZB(o)),d=[],l=_j(),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:sj(e),source:{type:"onerror"}})}),d.push((function(){return e.removeEventListener("error",n)}))),s&&(e.addEventListener("unhandledrejection",i=function(e){return h({error:cj(e),source:{type:"onunhandledrejection"}})}),d.push((function(){return e.removeEventListener("unhandledrejection",i)}))),t&&d.push.apply(d,XB([],KB(pj(h)),!1)),[function(e,t,r){return h({error:uj(e),extra:t,react:r,source:{type:"manual"}})},function(){d.forEach((function(e){return e()}))}]}},gj="jsError",yj={ignoreErrors:[],onerror:!0,onunhandledrejection:!0,captureGlobalAsync:!1,dedupe:!0};function Sj(e){e.on("init",(function(){window.removeEventListener("error",e.pcErr,!0),window.removeEventListener("unhandledrejection",e.pcRej,!0);var t,r=ij(e,gj,yj);r&&(r=(t=KB(function(e,t,r,n){void 0===t&&(t={}),void 0===n&&(n=[]);try{var i=e.apply(void 0,XB([],KB(n),!1));return i&&i(t,r)||[]}catch(o){return nj(o),[]}}(mj,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 Ej=HB.jsErrorPlugin=function(){return{name:gj,setup:function(e){Sj(e)}}},bj={};id(bj,"__esModule",{value:!0});var kj=function(){return(kj=LE||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 Tj(e,t){var r="function"==typeof fl&&Ak(e);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 Ij(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||mm(Array.prototype).call(t,0,i))[i]=t[i]);return Im(e).call(e,n||mm(Array.prototype).call(t))}var Rj=function(){return{}};function Aj(e){return"object"==xl(e)&&null!==e}function wj(e){return"function"==typeof e}var Cj=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 Rj;var a=e[t],s=r.apply(void 0,Ij([a],Tj(i),!1)),c=s;return wj(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 wj(a)&&a.apply(this,e)}}),e[t]=c,function(r){r||(c===e[t]?e[t]=a:s=a)}}};function Oj(){if("object"==("undefined"==typeof window?"undefined":xl(window))&&Aj(window))return window}var Dj=function(e){if(e)return e.__SLARDAR_REGISTRY__||(e.__SLARDAR_REGISTRY__={Slardar:{plugins:[],errors:[],subject:{}}}),e.__SLARDAR_REGISTRY__.Slardar},xj=function(e,t,r,n){void 0===t&&(t={}),void 0===n&&(n=[]);try{var i=e.apply(void 0,Ij([],Tj(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=Dj(Oj());r&&(r.errors||(r.errors=[]),r.errors.push(e))}(o),[]}};function Nj(e){var t,r=function(){if("object"==("undefined"==typeof document?"undefined":xl(document))&&Aj(document))return document}();return r&&e?((r=r.createElement("a")).href=e,"/"!==(e=r.pathname||"/")[0]&&(e="/"+e),{url:r.href,protocol:mm(t=r.protocol).call(t,0,-1),domain:r.hostname,query:r.search.substring(1),path:e,hash:r.hash}):{url:e,protocol:"",domain:"",query:"",path:"",hash:""}}function Pj(e,t,r){return function(e,t){return Aj(e)?kj(kj({},t),e):!!e&&t}(t=null===(e=e.config())||void 0===e?void 0:e.plugins[t],r)}var Mj=["hash_0",function(e,t){var r,n=Oj();n&&(n.addEventListener("hashchange",r=function(){return e(location.href)},!0),t((function(){return n.removeEventListener("hashchange",r,!0)})))}],Lj=["history_0",function(e,t){var r,n,i,o=Oj()&&window.history;o&&(n=function(){return e(location.href)},(r=[]).push(Cj(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()}}})(),Cj(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()}))})))}],Uj=function(e,t){if(void 0===e&&(e=Oj()),void 0===t&&(t=Oj()&&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=Nj(t).hash)||void 0===r?void 0:r.replace(/^#/,""))||"/":Nj(t).path}}(c),f=u||function(){},p=(s=Tj(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=Tj(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=Tj(e(c),1)[0],l.push(e((function(e){return o(c,e)})))),a&&d(),[s,function(){l.forEach((function(e){return e()}))}]}},Vj="pageview",Fj={sendInit:!0,routeMode:"history"};var Bj=bj.pageviewPlugin=function(){return{name:Vj,setup:function(e){var t;(t=e).on("init",(function(){var e,r=Pj(t,Vj,Fj);r&&(r=Tj(xj(Uj,kj(kj({},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?Mj:Lj)}}),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(!aw()&&!window.__rtc_slardar__){var jj=NF();jj("init",{aid:432410,token:"d7271e1eac254529abcffc63e36b02c3",integrations:[Bj(),Ej(),DF({screenshot:!1})]}),jj("on","beforeSend",(function(e){return"blank_screen"===e.ev_type&&Wx.rtcError("blank_screen",0,e),e})),jj("start"),window.__rtc_slardar__=jj}var Gj,Hj=new(function(){function e(){Kd(this,e)}return zd(e,[{key:"setStats",value:function(e){!aw()&&window.__rtc_slardar__&&an(e).forEach((function(t){window.__rtc_slardar__("context.set",t,e[t])}))}}]),e}()),zj=new bC("RecvFrameObserver",0),Kj=function(){function e(t,r){Kd(this,e),od(this,"_audioEventSessionId",bw()),od(this,"_videoEventSessionId",bw()),od(this,"_handler",void 0),od(this,"_stream",void 0),od(this,"_firstAudioFrameTimer",void 0),od(this,"_firstVideoFrameTimer",void 0),od(this,"_transportDelayInterval",void 0),od(this,"_transportDelay",void 0),od(this,"_firstVideoFrameInterval",void 0),od(this,"_firstAudioFrameInterval",void 0),od(this,"_isScreen",!1),od(this,"_audioFirstFrameState",0),od(this,"_videoFirstFrameState",0),od(this,"_timeout",1e4),od(this,"_currentAudioRecv",{startTime:0,eventSessionId:0,type:Vx.LOGIN}),od(this,"_currentVideoRecv",{startTime:0,eventSessionId:0,type:Vx.LOGIN}),od(this,"_login",!1),od(this,"_unMuteAudio",!1),od(this,"_enableAudio",!1),od(this,"_unMuteVideo",!1),od(this,"_enableVideo",!1),od(this,"_remoteUnmuteAudio",!1),od(this,"_remoteUnmuteVideo",!1),od(this,"_audioExternal",!1),od(this,"_pushAudio",!1),od(this,"_videoExternal",!1),od(this,"_pushVideo",!1),od(this,"_autoSubscribeVideo",!1),od(this,"_autoSubscribeAudio",!1),od(this,"_autoSubscribe",!1),od(this,"_publishVideo",!1),od(this,"_publishAudio",!1),od(this,"_subscribeAudio",!1),od(this,"_subscribeVideo",!1),od(this,"_subscribe",!1),od(this,"_pushTrack",!1),od(this,"_multiChatMode",!1),this._stream=t,this._handler=r,this.getTransportDelay()}var t,r,n,i;return zd(e,[{key:"beginRecvFrame",value:(i=Sm(gm().mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h,f,p,v,_,m,g=this;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getTransportDelay();case 2:i=this._transportDelay,o=!0,a=Vx.LOGIN,s=Vx.UNMUTE,c=Vx.SUBSCRIBE,u=Vx.PUSH_TRACK,Ob(n=[a,s,c,u]).call(n,r)>=0&&(i=0,o=!1),t===Ux.AUDIO?(o||this._audioEventSessionId++,this._currentAudioRecv={startTime:Date.now(),eventSessionId:this._audioEventSessionId,type:r},f={media_type:t,event_type:Lx.BEGIN_RECV,type:r,is_screen:!(null===(d=this._stream)||void 0===d||!d.isScreen),start:null===(l=this._currentAudioRecv)||void 0===l?void 0:l.startTime,event_session_id:this._audioEventSessionId,stream_user_id:null===(h=this._stream)||void 0===h?void 0:h.userId,transport_delay:i},this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),this._firstAudioFrameTimer=window.setTimeout((function(){g.stopRecvFrame(Ux.AUDIO,Fx.TIMEOUT),g._firstAudioFrameInterval&&window.clearInterval(g._firstAudioFrameInterval)}),this._timeout),zj.print("rtcFirstFrameRecv",hk(f)),Wx.rtcFirstFrame(f),this._watchForFirstAudioFrameRecv(),this._audioFirstFrameState=1,this._login=!0,this._unMuteAudio=!0,this._enableAudio=!0,this._remoteUnmuteAudio=!0):t===Ux.VIDEO&&(o||this._videoEventSessionId++,this._currentVideoRecv={startTime:Date.now(),eventSessionId:this._videoEventSessionId,type:r},m={media_type:t,event_type:Lx.BEGIN_RECV,type:r,is_screen:!(null===(p=this._stream)||void 0===p||!p.isScreen),start:null===(v=this._currentVideoRecv)||void 0===v?void 0:v.startTime,event_session_id:this._videoEventSessionId,stream_user_id:null===(_=this._stream)||void 0===_?void 0:_.userId,transport_delay:i},this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),this._firstVideoFrameTimer=window.setTimeout((function(){g.stopRecvFrame(Ux.VIDEO,Fx.TIMEOUT),g._firstVideoFrameInterval&&window.clearInterval(g._firstVideoFrameInterval)}),this._timeout),this._watchForFirstVideoFrameRecv(),zj.print("rtcFirstFrameRecv",hk(m)),Wx.rtcFirstFrame(m),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===Ux.AUDIO){var r,n,i,o;if(1!==this._audioFirstFrameState)return;var a={event_type:Lx.RECV_END,media_type:e,is_screen:!(null===(r=this._stream)||void 0===r||!r.isScreen),start:null===(n=this._currentAudioRecv)||void 0===n?void 0:n.startTime,reason:t,result:!1,stream_user_id:null===(i=this._stream)||void 0===i?void 0:i.userId,event_session_id:this._audioEventSessionId,type:null===(o=this._currentAudioRecv)||void 0===o?void 0:o.type};this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),delete this._currentAudioRecv,zj.print("rtcFirstFrameRecv",hk(a)),Wx.rtcFirstFrame(a),this._audioFirstFrameState=2}else if(e===Ux.VIDEO){var s,c,u,d;if(1!==this._videoFirstFrameState)return;var l={event_type:Lx.RECV_END,media_type:e,is_screen:!(null===(s=this._stream)||void 0===s||!s.isScreen),start:null===(c=this._currentVideoRecv)||void 0===c?void 0:c.startTime,reason:t,result:!1,stream_user_id:null===(u=this._stream)||void 0===u?void 0:u.userId,event_session_id:this._videoEventSessionId,type:null===(d=this._currentVideoRecv)||void 0===d?void 0:d.type};this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),delete this._currentVideoRecv,zj.print("rtcFirstFrameRecv",hk(l)),Wx.rtcFirstFrame(l),this._videoFirstFrameState=2}}},{key:"recvFrameFinish",value:(n=Sm(gm().mark((function e(t){var r,n,i,o,a,s,c,u,d,l,h,f,p,v,_,m,g,y,S;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getTransportDelay();case 2:if(r=this._transportDelay,n=Vx.LOGIN,i=Vx.UNMUTE,o=Vx.SUBSCRIBE,a=Vx.PUSH_TRACK,t!==Ux.AUDIO){e.next=19;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:d=this._currentAudioRecv,l=d.type,h=d.startTime,Ob(s=[n,i,o,a]).call(s,l)>=0&&(r=0),f={event_type:Lx.RECV_END,media_type:t,start:h,result:!0,is_screen:!(null===(c=this._stream)||void 0===c||!c.isScreen),stream_user_id:null===(u=this._stream)||void 0===u?void 0:u.userId,event_session_id:this._audioEventSessionId,type:l,transport_delay:r},delete this._currentAudioRecv,this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),zj.print("rtcFirstFrameRecv",hk(f)),Wx.rtcFirstFrame(f),this._audioFirstFrameState=3,e.next=32;break;case 19:if(t!==Ux.VIDEO){e.next=32;break}if(1===this._videoFirstFrameState){e.next=22;break}return e.abrupt("return");case 22:if(this._currentVideoRecv){e.next=24;break}return e.abrupt("return");case 24:m=this._currentVideoRecv,g=m.type,y=m.startTime,Ob(p=[n,i,o,a]).call(p,g)>=0&&(r=0),S={event_type:Lx.RECV_END,media_type:t,is_screen:!(null===(v=this._stream)||void 0===v||!v.isScreen),start:y,result:!0,stream_user_id:null===(_=this._stream)||void 0===_?void 0:_.userId,event_session_id:this._videoEventSessionId,type:g,transport_delay:r},delete this._currentVideoRecv,this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),zj.print("rtcFirstFrameRecv",hk(S)),Wx.rtcFirstFrame(S),this._videoFirstFrameState=3;case 32: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(Ux.AUDIO,Vx.LOGIN),e&&null!==(r=this._stream)&&void 0!==r&&r.hasVideo&&o.video&&this.beginRecvFrame(Ux.VIDEO,Vx.LOGIN),!e&&null!==(n=this._stream)&&void 0!==n&&n.hasAudio&&this.stopRecvFrame(Ux.AUDIO,Fx.LEAVE_ROOM),!e&&null!==(i=this._stream)&&void 0!==i&&i.hasVideo&&this.stopRecvFrame(Ux.VIDEO,Fx.LEAVE_ROOM))}},{key:"setUnmuteAudio",value:function(e){var t,r,n;if(this._unMuteAudio!==e){this._unMuteAudio=e;var i=!(null===(t=this._stream)||void 0===t||!t.hasAudio);null!==(r=this._stream)&&void 0!==r&&r.audioHasCapture&&null!==(n=this._stream)&&void 0!==n&&n.audioHasPublish&&(this._unMuteAudio&&i?this.beginRecvFrame(Ux.AUDIO,Vx.UNMUTE):i&&this.stopRecvFrame(Ux.AUDIO,Fx.MUTE))}}},{key:"setRemoteUnmuteAudio",value:function(e){var t;this._remoteUnmuteAudio!==e&&(this._remoteUnmuteAudio=e,this._remoteUnmuteAudio?this.beginRecvFrame(Ux.AUDIO,Vx.REMOTE_UNMUTE):null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(Ux.AUDIO,Fx.REMOTE_MUTE))}},{key:"setEnableAudio",value:function(e){var t;this._enableAudio!==e&&(this._enableAudio=e,this._enableAudio?this.beginRecvFrame(Ux.AUDIO,Vx.ENABLE):null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(Ux.AUDIO,Fx.DISABLE))}},{key:"setUnmuteVideo",value:function(e){var t,r,n;if(this._unMuteVideo!==e){this._unMuteVideo=e;var i=!(null===(t=this._stream)||void 0===t||!t.hasVideo);null!==(r=this._stream)&&void 0!==r&&r.videoHasCapture&&null!==(n=this._stream)&&void 0!==n&&n.videoHasPublish&&(this._unMuteVideo&&i?this.beginRecvFrame(Ux.VIDEO,Vx.UNMUTE):i&&this.stopRecvFrame(Ux.VIDEO,Fx.MUTE))}}},{key:"setRemoteUnmuteVideo",value:function(e){var t;this._remoteUnmuteVideo!==e&&(this._remoteUnmuteVideo=e,this._remoteUnmuteVideo?this.beginRecvFrame(Ux.VIDEO,Vx.REMOTE_UNMUTE):null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(Ux.VIDEO,Fx.REMOTE_MUTE))}},{key:"setEnableVideo",value:function(e){this._enableVideo!==e&&(this._enableVideo=e,this._enableVideo?this.beginRecvFrame(Ux.VIDEO,Vx.ENABLE):this.stopRecvFrame(Ux.VIDEO,Fx.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(Ux.AUDIO,Vx.PUSH),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.beginRecvFrame(Ux.AUDIO,Vx.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(Ux.VIDEO,Vx.PUSH),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasVideo&&this.beginRecvFrame(Ux.VIDEO,Vx.PUSH)}},{key:"setPublishVideo",value:function(e){var t;this._publishVideo!==e&&(this._publishVideo=e),this._publishVideo&&this.beginRecvFrame(Ux.VIDEO,Vx.PUBLISH),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasVideo&&this.stopRecvFrame(Ux.VIDEO,Fx.UNPUBLISH)}},{key:"setPublishAudio",value:function(e){var t;this._publishAudio!==e&&(this._publishAudio=e),this._publishAudio&&this.beginRecvFrame(Ux.AUDIO,Vx.PUBLISH),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(Ux.AUDIO,Fx.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(Ux.AUDIO,Vx.SUBSCRIBE));!e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(Ux.AUDIO,Fx.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(Ux.VIDEO,Vx.SUBSCRIBE));!e&&null!==(t=this._stream)&&void 0!==t&&t.hasVideo&&this.stopRecvFrame(Ux.VIDEO,Fx.UNSUBSCRIBE)}},{key:"setPushTrack",value:function(e){var t;this._pushTrack!==e&&(e&&!this._isScreen&&this.beginRecvFrame(Ux.AUDIO,Vx.PUSH_TRACK),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(Ux.AUDIO,Fx.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(Sm(gm().mark((function n(){var i,o,a,s,c,u,d,l;return gm().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(null===(i=e._handler)||void 0===i||!i.pc||null===(o=e._stream)||void 0===o||null===(a=o.videoTrack)||void 0===a||!a.getTrack()){n.next=12;break}return n.next=3,KM(null===(s=e._handler)||void 0===s?void 0:s.pc,null===(c=e._stream)||void 0===c||null===(u=c.videoTrack)||void 0===u?void 0:u.getTrack());case 3:if(d=n.sent,!(l=yb(d).call(d,(function(e){return"inbound-rtp"===e.type})))||!(l.framesReceived>t||l.packetsReceived>r)){n.next=12;break}if(-1!==t||-1!==r){n.next=10;break}return t=l.framesReceived,r=l.packetsReceived,n.abrupt("return");case 10:e.recvFrameFinish(Ux.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(Sm(gm().mark((function n(){var i,o,a,s,c,u,d,l;return gm().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(null===(i=e._handler)||void 0===i||!i.pc||null===(o=e._stream)||void 0===o||null===(a=o.audioTrack)||void 0===a||!a.getTrack()){n.next=12;break}return n.next=3,KM(null===(s=e._handler)||void 0===s?void 0:s.pc,null===(c=e._stream)||void 0===c||null===(u=c.audioTrack)||void 0===u?void 0:u.getTrack());case 3:if(d=n.sent,!(l=yb(d).call(d,(function(e){return"inbound-rtp"===e.type})))||!(l.totalSamplesReceived>t||l.packetsReceived>r)){n.next=12;break}if(-1!==t||-1!==r){n.next=10;break}return t=l.totalSamplesReceived,r=l.packetsReceived,n.abrupt("return");case 10:e.recvFrameFinish(Ux.AUDIO),window.clearInterval(e._firstAudioFrameInterval);case 12:case"end":return n.stop()}}),n)}))),200)}},{key:"getTransportDelay",value:(r=Sm(gm().mark((function e(){var t=this;return gm().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(Sm(gm().mark((function e(){return gm().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=Sm(gm().mark((function e(){var t,r,n,i,o;return gm().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,KM(null===(r=this._handler)||void 0===r?void 0:r.pc);case 3:n=e.sent,i=yb(n).call(n,(function(e){return"transport"===e.type&&"connected"===e.dtlsState})),(o=yb(n).call(n,(function(e){return"candidate-pair"===e.type&&"succeeded"===e.state&&e.id===(null==i?void 0:i.selectedCandidatePairId)})))&&(this._transportDelay=Math.round(1e3*o.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:Vx.LOGIN},this._currentVideoRecv={startTime:0,eventSessionId:0,type:Vx.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}(),Xj=new bC("SendFrameObserver",0),qj=function(){function e(t,r){Kd(this,e),od(this,"_audioEventSessionId",bw()),od(this,"_videoEventSessionId",bw()),od(this,"_pcSessionId",void 0),od(this,"_handler",void 0),od(this,"_firstAudioFrameTimer",void 0),od(this,"_firstVideoFrameTimer",void 0),od(this,"_stream",void 0),od(this,"_firstVideoFrameInterval",void 0),od(this,"_firstAudioFrameInterval",void 0),od(this,"_currentAudioSend",{startTime:0,eventSessionId:0,type:Vx.LOGIN}),od(this,"_currentVideoSend",{startTime:0,eventSessionId:0,type:Vx.LOGIN}),od(this,"_login",!1),od(this,"_publisher",!1),od(this,"_unMuteAudio",!1),od(this,"_enableAudio",!1),od(this,"_unMuteVideo",!1),od(this,"_enableVideo",!1),od(this,"_audioExternal",!1),od(this,"_pushAudio",!1),od(this,"_videoExternal",!1),od(this,"_pushVideo",!1),od(this,"_autoPublish",!1),od(this,"_publish",!1),od(this,"_timeout",1e4),od(this,"_audioFirstFrameState",0),od(this,"_videoFirstFrameState",0),this._stream=t,this._handler=r}var t,r;return zd(e,[{key:"beginSendFrame",value:function(e,t){var r=this;if(e===Ux.AUDIO){var n,i;this._audioEventSessionId++,this._currentAudioSend={startTime:Date.now(),eventSessionId:this._audioEventSessionId,type:t};var o={event_type:Lx.BEGIN_SEND,media_type:e,is_screen:!(null===(n=this._stream)||void 0===n||!n.isScreen),type:t,start:null===(i=this._currentAudioSend)||void 0===i?void 0:i.startTime,event_session_id:this._audioEventSessionId};this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),this._firstAudioFrameTimer=window.setTimeout((function(){r.stopSendFrame(Ux.AUDIO,Fx.TIMEOUT),r._firstAudioFrameInterval&&window.clearInterval(r._firstAudioFrameInterval)}),this._timeout),Xj.print("rtcFirstFrameSend",hk(o)),Wx.rtcFirstFrame(o),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===Ux.VIDEO){var a,s;this._videoEventSessionId++,this._currentVideoSend={startTime:Date.now(),eventSessionId:this._videoEventSessionId,type:t};var c={event_type:Lx.BEGIN_SEND,media_type:e,is_screen:!(null===(a=this._stream)||void 0===a||!a.isScreen),type:t,start:null===(s=this._currentVideoSend)||void 0===s?void 0:s.startTime,event_session_id:this._videoEventSessionId};this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),this._firstVideoFrameTimer=window.setTimeout((function(){r.stopSendFrame(Ux.VIDEO,Fx.TIMEOUT),r._firstVideoFrameInterval&&window.clearInterval(r._firstVideoFrameInterval)}),this._timeout),this._watchForFirstVideoFrameSend(),Xj.print("rtcFirstFrameSend",hk(c)),Wx.rtcFirstFrame(c),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===Ux.AUDIO){var r,n,i;if(1!==this._audioFirstFrameState)return;var o={event_type:Lx.SENT_END,media_type:e,is_screen:!(null===(r=this._stream)||void 0===r||!r.isScreen),start:null===(n=this._currentAudioSend)||void 0===n?void 0:n.startTime,reason:t,result:!1,event_session_id:this._audioEventSessionId,type:null===(i=this._currentAudioSend)||void 0===i?void 0:i.type};this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),delete this._currentAudioSend,Xj.print("rtcFirstFrameSend",hk(o)),Wx.rtcFirstFrame(o),this._audioFirstFrameState=2}else if(e===Ux.VIDEO){var a,s,c;if(1!==this._videoFirstFrameState)return;var u={event_type:Lx.SENT_END,media_type:e,start:null===(a=this._currentVideoSend)||void 0===a?void 0:a.startTime,is_screen:!(null===(s=this._stream)||void 0===s||!s.isScreen),reason:t,result:!1,event_session_id:this._videoEventSessionId,type:null===(c=this._currentVideoSend)||void 0===c?void 0:c.type};this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),delete this._currentVideoSend,Xj.print("rtcFirstFrameSend",hk(u)),Wx.rtcFirstFrame(u),this._videoFirstFrameState=2}}},{key:"sendFrameFinish",value:function(e){if(e===Ux.AUDIO){var t;if(1!==this._audioFirstFrameState)return;if(!this._currentAudioSend)return;var r=this._currentAudioSend,n=r.type,i=r.startTime,o={event_type:Lx.SENT_END,media_type:e,is_screen:!(null===(t=this._stream)||void 0===t||!t.isScreen),start:i,result:!0,event_session_id:this._audioEventSessionId,type:n};delete this._currentAudioSend,this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),Xj.print("rtcFirstFrameSend",hk(o)),Wx.rtcFirstFrame(o),this._audioFirstFrameState=3}else if(e===Ux.VIDEO){var a;if(1!==this._videoFirstFrameState)return;if(!this._currentVideoSend)return;var s=this._currentVideoSend,c=s.type,u=s.startTime,d={event_type:Lx.SENT_END,media_type:e,is_screen:!(null===(a=this._stream)||void 0===a||!a.isScreen),start:u,result:!0,event_session_id:this._videoEventSessionId,type:c};delete this._currentVideoSend,this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),Xj.print("rtcFirstFrameSend",hk(d)),Wx.rtcFirstFrame(d),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(Ux.VIDEO,Vx.LOGIN),null!==(r=this._stream)&&void 0!==r&&r.audioTrack&&this.beginSendFrame(Ux.AUDIO,Vx.LOGIN);!e&&this._audioSending&&this.stopSendFrame(Ux.AUDIO,Fx.LEAVE_ROOM),!e&&this._videoSending&&this.stopSendFrame(Ux.VIDEO,Fx.LEAVE_ROOM)}}},{key:"setPublish",value:function(e){if(this._publish!==e){var t,r,n,i;if(this._publish=e,e)(null===(t=this._stream)||void 0===t?void 0:t.videoTrack)&&(null===(r=this._stream)||void 0===r?void 0:r.pubVideo)&&this.beginSendFrame(Ux.VIDEO,Vx.PUBLISH),(null===(n=this._stream)||void 0===n?void 0:n.audioTrack)&&(null===(i=this._stream)||void 0===i?void 0:i.pubAudio)&&this.beginSendFrame(Ux.AUDIO,Vx.PUBLISH);!e&&this._audioSending&&this.stopSendFrame(Ux.AUDIO,Fx.UNPUBLISH),!e&&this._videoSending&&this.stopSendFrame(Ux.VIDEO,Fx.UNPUBLISH)}}},{key:"setUnmuteAudio",value:function(e){this._unMuteAudio!==e&&(this._unMuteAudio=e,e&&this.beginSendFrame(Ux.AUDIO,Vx.UNMUTE),!e&&this._audioSending&&this.stopSendFrame(Ux.AUDIO,Fx.MUTE))}},{key:"setEnableAudio",value:function(e){this._enableAudio!==e&&(this._enableAudio=e,e&&this.beginSendFrame(Ux.AUDIO,Vx.ENABLE),!e&&this._audioSending&&this.stopSendFrame(Ux.AUDIO,Fx.DISABLE))}},{key:"setUnmuteVideo",value:function(e){this._unMuteVideo!==e&&(this._unMuteVideo=e,e&&this.beginSendFrame(Ux.VIDEO,Vx.UNMUTE),!e&&this._videoSending&&this.stopSendFrame(Ux.VIDEO,Fx.MUTE))}},{key:"setEnableVideo",value:function(e){this._enableVideo!==e&&(this._enableVideo=e,e&&this.beginSendFrame(Ux.VIDEO,Vx.ENABLE),!e&&this._videoSending&&this.stopSendFrame(Ux.VIDEO,Fx.DISABLE))}},{key:"setExternalAudioSource",value:function(e){this._audioExternal!==e&&(this._audioExternal=e,e&&(this._audioSending&&this.stopSendFrame(Ux.AUDIO,Fx.DISABLE),this._enableAudio=!1),e||(this._audioSending&&this.stopSendFrame(Ux.AUDIO,Fx.STOP_PUSH),this._pushAudio=!1))}},{key:"setPushAudio",value:function(e){this._pushAudio!==e&&(this._pushAudio=e,e&&this.beginSendFrame(Ux.AUDIO,Vx.PUSH),!e&&this._audioSending&&this.stopSendFrame(Ux.AUDIO,Fx.STOP_PUSH))}},{key:"setExternalVideoSource",value:function(e){this._videoExternal!==e&&(this._videoExternal=e,e&&(this._videoSending&&this.stopSendFrame(Ux.VIDEO,Fx.DISABLE),this._enableVideo=!1),e||(this._videoSending&&this.stopSendFrame(Ux.VIDEO,Fx.STOP_PUSH),this._pushVideo=!1))}},{key:"setPushVideo",value:function(e){this._pushVideo!==e&&(this._pushVideo=e,e&&this.beginSendFrame(Ux.VIDEO,Vx.PUSH),!e&&this._videoSending&&this.stopSendFrame(Ux.VIDEO,Fx.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(Ux.AUDIO,Fx.AUDIENCE),!e&&this._videoSending&&this.stopSendFrame(Ux.VIDEO,Fx.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=Sm(gm().mark((function e(){var t,r,n,i,o,a,s;return gm().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=5;break}return e.next=3,KM(null===(i=this._handler)||void 0===i?void 0:i.pc,null===(o=this._stream)||void 0===o||null===(a=o.videoTrack)||void 0===a?void 0:a.getTrack("preprocessing"));case 3:return s=e.sent,e.abrupt("return",yb(s).call(s,(function(e){return"outbound-rtp"===e.type})));case 5:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"_getFirstAudioFrameStats",value:(t=Sm(gm().mark((function e(){var t,r,n,i,o,a,s;return gm().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=5;break}return e.next=3,KM(null===(i=this._handler)||void 0===i?void 0:i.pc,null===(o=this._stream)||void 0===o||null===(a=o.audioTrack)||void 0===a?void 0:a.getTrack("preprocessing"));case 3:return s=e.sent,e.abrupt("return",yb(s).call(s,(function(e){return"outbound-rtp"===e.type})));case 5: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(Sm(gm().mark((function n(){var i;return gm().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(Ux.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(Sm(gm().mark((function r(){var n;return gm().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(Ux.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:Vx.LOGIN},this._currentVideoSend={startTime:0,eventSessionId:0,type:Vx.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}(),Wj=(od(Gj={},"audio",{delay:1200,stallRadio:.3}),od(Gj,"video",{delay:1200,stallRadio:.6}),od(Gj,"screen_audio",{delay:1600,stallRadio:.8}),od(Gj,"screen_video",{delay:1600,stallRadio:.8}),Gj),Yj=function(){function e(){Kd(this,e),od(this,"_preUplinkStats",new aE),od(this,"_preDownlinkStats",new aE),od(this,"_timer",void 0),od(this,"_delayTimer",void 0),od(this,"_connectionState",JV.CONNECTED),od(this,"reportor",void 0)}return zd(e,[{key:"updateUplinkStats",value:function(e){var t=e.audioStats,r=e.videoStats,n=e.isScreen;if(t.sendKBitrate>0&&t.rtt){var i,o,a=n?"screen_audio":"audio",s=t.rtt,c=t._fractionLost,u=t._retransmittedRate,d=this._getQosLevel(s,c||0,u||0),l=this._preUplinkStats.get(a)||[d];this._preUplinkStats.set(a,mm(i=Im(o=[]).call(o,Kk(l),[d])).call(i,-2))}if(r.sentKBitrate>0&&r.rtt){var h,f,p=n?"screen_video":"video",v=r._fractionLost,_=r.rtt,m=r._sendBandWidth,g=r._retransmittedRate;0===m&&(v=Math.max(.65,v));var y=this._getQosLevel(_,v||0,g||0),S=this._preUplinkStats.get(p)||[y];this._preUplinkStats.set(p,mm(h=Im(f=[]).call(f,Kk(S),[y])).call(h,-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=wd.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",g=this._getQosLevel(l,h||0,c._retransmittedRate||0),y=this._getDownlinkQoE(m,_,v);r=this._getNetworkQuality(g,y)}if(a)if(0===c.receivedKBitrate||0===c.rtt)n=wd.VBAD;else{var S=c.rtt,E=c.videoLossRate,b=c.stallDuration,k=c.statsInterval,T=c.e2eDelay,I=c._retransmittedRate,R=b/k,A=u?"screen_video":"video",w=this._getQosLevel(S,E||0,I||0),C=this._getDownlinkQoE(A,R,T);n=this._getNetworkQuality(w,C)}var O=r&&n?Math.ceil((r+n)/2):r||n;if(O){var D,x,N,P=Im(D="".concat(d)).call(D,u?"_screen":""),M=this._preDownlinkStats.get(P)||[O];this._preDownlinkStats.set(P,mm(x=Im(N=[]).call(N,Kk(M),[O])).call(x,-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!==JV.CONNECTED)e=t=wd.VBAD;else{var n,i,o,a=this._getBetterQualityAndRemoveOldest("audio","up"),s=this._getBetterQualityAndRemoveOldest("video","up");e=a&&s?Math.ceil((a+s)/2):a||s||this._getBetterQualityAndRemoveOldest("screen_video","up")||this._getBetterQualityAndRemoveOldest("screen_audio","up")||wd.EXCELLENT;var c=Gs(n=ck(i=Hk(pC(o=this._preDownlinkStats).call(o))).call(i,(function(e){return r._getBetterQualityAndRemoveOldest(e,"down")}))).call(n,(function(e){return e}));t=Math.ceil(EE(c).call(c,(function(e,t){return t+e}),0)/c.length)||wd.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=Wj[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=wd.UNKNOWN,n="up"===t?this._preUplinkStats:this._preDownlinkStats,i=n.get(e);if(i){var o=Gs(i).call(i,(function(e){return e}));o.length>0&&(r=Math.min.apply(Math,Kk(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&&ww(t)&&r.localaudio&&r.audiostream,videoActive:n&&Cw(t)&&r.localvideo&&r.videostream}}}]),e}(),Qj=function(){function e(t){Kd(this,e),od(this,"_timer",void 0),od(this,"_remoteVideoSizeCache",{}),od(this,"_remoteScreenSizeCache",{}),od(this,"onchange",void 0),this._room=t,this._start()}return zd(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}}}))})),an(e._remoteVideoSizeCache).forEach((function(t){"function"==typeof e.onchange&&e.onchange(t,!1,0,0)})),an(e._remoteScreenSizeCache).forEach((function(t){"function"==typeof e.onchange&&e.onchange(t,!0,0,0)})),e._remoteVideoSizeCache=t,e._remoteScreenSizeCache=r}),1e3))}}]),e}(),Jj=Hk((new TextEncoder).encode("subt")),Zj={1:aA.SUBTITLE_ERR_POSTPROCESS,2:aA.SUBTITLE_ERR_CONNECTION_ERROR,3:aA.SUBTITLE_ERR_PROCESS_ERROR},$j=new bC("SubtitleTool",1),eG=function(e){if(e.extraInfo)try{var t,r=JSON.parse(e.extraInfo);r.source_language&&-1===Ob(t=["zh","en","ja"]).call(t,r.source_language)&&(delete r.source_language,e.extraInfo=hk(r))}catch(a){}else{var n,i,o=(null===(n=navigator.language)||void 0===n?void 0:n.substring(0,2))||"";Ob(i=["zh","en","ja"]).call(i,o)>-1&&(e.extraInfo=hk({source_language:o}))}},tG=function(){function e(t){var r,n,i;Kd(this,e),od(this,"_taskId",void 0),od(this,"_appId",void 0),od(this,"_roomId",void 0),od(this,"_userId",void 0),od(this,"onEvent",void 0),od(this,"onMessage",void 0),od(this,"_preConfig",void 0),od(this,"_timer",void 0),this._room=t,this._appId=null===(r=this._room._roomInfo)||void 0===r?void 0:r.appId,this._roomId=null===(n=this._room._roomInfo)||void 0===n?void 0:n.roomId,this._userId=null===(i=this._room._roomInfo)||void 0===i?void 0:i.userInfo.userId}var t,r,n;return zd(e,[{key:"start",value:(n=Sm(gm().mark((function e(t){var r=this;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if($j.print("start","Invoke config: %o",t),Bw(t.mode,"mode",[Md.ASR_ONLY,Md.ASR_AND_TRANSLATION]),t.mode!==Md.ASR_AND_TRANSLATION||-1!==Ob(nG).call(nG,t.targetLanguage||"")){e.next=4;break}throw new cA(aA.INVALID_PARAMS,"Invalid targetLanguage.");case 4:if(!this._taskId){e.next=6;break}throw new cA(aA.SUBTITLE_ALREADY_ON,"Already turned on subtitle");case 6:return this._preConfig=t,this._taskId=(Date.now().toString()+this._roomId+this._userId).substring(0,20),e.next=10,this._room.subtitleControlMessage(this._genSubtitleSignaling("started",t,this._taskId));case 10:this._preConfig=t,this._timer=self.setTimeout((function(){var e;null===(e=r.onEvent)||void 0===e||e.call(r,{event:Ld.ERROR,errorCode:aA.TIME_OUT,errorMessage:"start subtitle timeout."}),delete r._timer,r.stop()}),3e4);case 12:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"update",value:(r=Sm(gm().mark((function e(t){var r;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Bw(t.mode,"mode",[Md.ASR_ONLY,Md.ASR_AND_TRANSLATION]),t.mode!==Md.ASR_AND_TRANSLATION||-1!==Ob(nG).call(nG,t.targetLanguage||"")){e.next=3;break}throw new cA(aA.INVALID_PARAMS,"Invalid targetLanguage.");case 3:if(!this._taskId){e.next=5;break}throw new cA(aA.SUBTITLE_ALREADY_ON,"Already started subtitle");case 5:if(this._taskId){e.next=7;break}throw new cA(aA.SUBTITLE_NOT_TURNED_ON,"Start subtitle first.");case 7:if((null===(r=this._preConfig)||void 0===r?void 0:r.mode)===t.mode&&this._preConfig.targetLanguage===t.targetLanguage){e.next=11;break}return this._preConfig=t,e.next=11,this._room.subtitleControlMessage(this._genSubtitleSignaling("update",t,this._taskId));case 11:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"stop",value:function(){var e=this;$j.print("stop","Invoke"),this._taskId&&this._room.subtitleControlMessage({type:"subtitle",action:"stopped",appId:this._appId,roomId:this._roomId,userId:this._userId,taskId:this._taskId}).finally((function(){var t;delete e._taskId,null===(t=e.onEvent)||void 0===t||t.call(e,{event:Ld.STOPPED}),e._clearTimer()}))}},{key:"reconnect",value:(t=Sm(gm().mark((function e(){return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._taskId||!this._preConfig){e.next=5;break}return e.next=3,this._room.subtitleControlMessage({type:"subtitle",action:"stopped",appId:this._appId,roomId:this._roomId,userId:this._userId,taskId:this._taskId});case 3:delete this._taskId,this.start(this._preConfig);case 5:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"getConfig",value:function(){return this._preConfig}},{key:"destroy",value:function(){$j.print("destroy","Invoke"),this.stop(),delete this._preConfig,delete this._taskId}},{key:"onResult",value:function(e){var t=e.body,r=t.error,n=t.errorMessage,i=t.eventType;if(0!==r){var o,a=new cA(Zj[r]||aA.SUBTITLE_ERR_UNKNOWN,n||"");null===(o=this.onEvent)||void 0===o||o.call(this,{event:Ld.ERROR,errorCode:a.code,errorMessage:a.message}),this._clearTimer()}else if("SubtitleStarted"===i){var s;null===(s=this.onEvent)||void 0===s||s.call(this,{event:Ld.STARTED}),this._clearTimer()}}},{key:"onMessageRecv",value:function(e){if(this._taskId&&this._preConfig){var t=rG(e);if(t&&t.length>0){var r,n,i=this._preConfig,o=i.mode,a=i.targetLanguage,s=ck(r=Gs(t).call(t,(function(e){return o===Md.ASR_ONLY?e.mode===o:o===Md.ASR_AND_TRANSLATION&&e.language===a}))).call(r,(function(e){return{userId:e.userId,text:e.text,definite:e.definite,sequence:e.sequence}}));if(s.length>0)null===(n=this.onMessage)||void 0===n||n.call(this,s)}return!!t}return!1}},{key:"_genSubtitleSignaling",value:function(e,t,r){return{taskId:r,type:"subtitle",action:e,roomId:this._roomId,appId:this._appId,userId:this._userId,subtitleMeta:{subtitleConfig:{mode:t.mode,usersConfig:[{userId:this._userId,targetLanguages:[t.targetLanguage||""]}]},vendorConfig:{type:0}}}}},{key:"_clearTimer",value:function(){this._timer&&(self.clearTimeout(this._timer),delete this._timer)}}]),e}(),rG=function(e){var t=e.message;if(t instanceof ArrayBuffer&&t.byteLength>8)try{var r=new DataView(t,0),n=0;if(Jj.every((function(e){return r.getUint8(n++)===e}))){var i=r.getUint32(n);if(n+=4,i===r.byteLength-8){var o=sw.ab2str(mm(t).call(t,8)),a=JSON.parse(o),s=a.data;if("subtitle"===a.type)return s}}}catch(c){}return!1},nG=["zh","zh-Hant","tn","vi","iu","it","id","hi","en","ho","he","es","el","uk","ur","tk","tr","ti","ty","tl","to","th","ta","te","sl","sk","ss","eo","sm","sg","st","sv","ja","tw","qu","pt","pa","no","nb","nr","my","bn","mn","mh","mk","ml","mr","ms","lu","ro","lt","lv","lo","kj","hr","kn","ki","cs","ca","nl","ko","ht","gu","ka","kl","km","lg","kg","fi","fj","fr","ru","ng","de","tt","da","ts","cv","fa","bs","pl","bi","nd","ba","bg","az","ar","af","sq","ab","os","ee","et","ay","lzh","am","ckb","cy","gl","ha","hy","ig","kmr","ln","nso","ny","om","sn","so","sr","sw","xh","yo","zu"],iG=new bC("Room",1),oG={audiostream:!0,extaudio:!1,extvideo:!1,localaudio:!0,localvideo:!1,videoDescriptions:[],videostream:!1},aG=function(e){AI(I,e);var t,r,n,i,o,a,s,c,u,d,l,h,f,p,v,_,m,g,y,S,E,b,k,T=zI(I);function I(e,t){var r;return Kd(this,I),od(YT(r=T.call(this)),"id",void 0),od(YT(r),"_mediaServerClient",void 0),od(YT(r),"_localStream",void 0),od(YT(r),"_localScreenStream",void 0),od(YT(r),"_remoteUsers",new aE),od(YT(r),"_remoteStreams",new aE),od(YT(r),"_remoteStreamStreamIdUserIdMap",{}),od(YT(r),"_virtualStreams",[]),od(YT(r),"_joinResolveCallback",void 0),od(YT(r),"_joinRejectCallback",void 0),od(YT(r),"_getAccessNode",void 0),od(YT(r),"_getAccessFeedback",void 0),od(YT(r),"_getAccessFeedbackIceNode",void 0),od(YT(r),"_reconnectTimer",void 0),od(YT(r),"_isReconnecting",void 0),od(YT(r),"_context",void 0),od(YT(r),"_sessionId",void 0),od(YT(r),"_reconnectRecord",void 0),od(YT(r),"_connectionLostTimer",void 0),od(YT(r),"_liveControlMessage",void 0),od(YT(r),"_serverConfig",void 0),od(YT(r),"_liveTranscodingOnceSucc",!1),od(YT(r),"_roomConfig",void 0),od(YT(r),"_roomInfo",void 0),od(YT(r),"_waitForNewToken",!1),od(YT(r),"_userDuplicateLoginTimerMap",new aE),od(YT(r),"_networkQualityManager",void 0),od(YT(r),"_videoSizeObserver",void 0),od(YT(r),"_hasPublished",!1),od(YT(r),"_subtitleTool",void 0),od(YT(r),"_csrcUserIdMap",void 0),od(YT(r),"_publishOnDemandItem",void 0),od(YT(r),"_publishOnDemandBusy",!1),r.id=null==t?void 0:t.id,r._roomConfig=e,r._mediaServerClient=new $V(t),r._reconnectRecord=new sG,r._addHandlerEventHandler(),r._isReconnecting=!1,r._networkQualityManager=new Yj,r._networkQualityManager.reportor=r._reportNetworkQuality.bind(YT(r)),r._videoSizeObserver=new Qj(YT(r)),r._videoSizeObserver.onchange=r._emitVideoSizeChange.bind(YT(r)),r._context=t,r._csrcUserIdMap={},r}return zd(I,[{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,g,y,S,E,b,k,T,I,R,A,w,C,O=this;null===(e=this._mediaServerClient)||void 0===e||e.on(AN.ON_ADD_STREAM,this._onAddStream.bind(this)),null===(t=this._mediaServerClient)||void 0===t||t.on(AN.ON_ADD_STREAM_LIST,(function(e){Array.isArray(null==e?void 0:e.streamList)&&e.streamList.forEach((function(e){return O._onAddStream(e)}))})),null===(r=this._mediaServerClient)||void 0===r||r.on(AN.ON_REMOVE_STREAM,this._onRemoveStream.bind(this)),null===(n=this._mediaServerClient)||void 0===n||n.on(AN.ON_REMOVE_STREAM_LIST,(function(e){Array.isArray(null==e?void 0:e.streamList)&&e.streamList.forEach((function(e){return O._onRemoveStream(e)}))})),null===(i=this._mediaServerClient)||void 0===i||i.on(AN.USER_CONNECTION,this._onUserConnection.bind(this)),null===(o=this._mediaServerClient)||void 0===o||o.on(AN.USER_CONNECTION_LIST,(function(e){Array.isArray(null==e?void 0:e.userList)&&e.userList.forEach((function(e){return O._onUserConnection(e)}))})),null===(a=this._mediaServerClient)||void 0===a||a.on(AN.USER_DISCONNECTION,this._onUserDisconnection.bind(this)),null===(s=this._mediaServerClient)||void 0===s||s.on(AN.USER_DISCONNECTION_LIST,(function(e){Array.isArray(null==e?void 0:e.userList)&&e.userList.forEach((function(e){return O._onUserDisconnection(e)}))})),null===(c=this._mediaServerClient)||void 0===c||c.on(AN.ON_UPDATE_ROOM_ATTRIBUTES,this._onUpdateRoomAttributes.bind(this)),null===(u=this._mediaServerClient)||void 0===u||u.on(AN.ON_UPDATE_USER_ATTRIBUTES,this._onUpdateUserAttributes.bind(this)),null===(d=this._mediaServerClient)||void 0===d||d.on(AN.ON_UPDATE_STREAM_ATTRIBUTES,this._onUpdateStreamAttributes.bind(this)),null===(l=this._mediaServerClient)||void 0===l||l.on(AN.ON_PUSH_TRACK,this._onPushTrack.bind(this)),null===(h=this._mediaServerClient)||void 0===h||h.on(AN.ON_REMOVE_TRACK,this._onRemoveTrack.bind(this)),null===(f=this._mediaServerClient)||void 0===f||f.on(AN.NODE_CHANGE,this._nodeChange.bind(this)),null===(p=this._mediaServerClient)||void 0===p||p.on(AN.ON_CUSTOM_MESSAGE,this._onCustomMessage.bind(this)),null===(v=this._mediaServerClient)||void 0===v||v.on(AN.USER_MESSAGE_RECEIVED,this._onUserMessageReceived.bind(this)),null===(_=this._mediaServerClient)||void 0===_||_.on(AN.USER_BINARY_MESSAGE_RECEIVED,this._onUserBinaryMessageReceived.bind(this)),null===(m=this._mediaServerClient)||void 0===m||m.on(AN.POST_PROCESSING_MESSAGE,this._onPostProcessingMessage.bind(this)),null===(g=this._mediaServerClient)||void 0===g||g.on(AN.ON_USER_TOKEN_WILL_EXPIRE,this._onUserTokenWillExpire.bind(this)),null===(y=this._mediaServerClient)||void 0===y||y.on(AN.STREAM_CONTROL_MESSAGE,this._onStreamControlMessage.bind(this)),null===(S=this._mediaServerClient)||void 0===S||S.on(AN.ON_STREAM_FAILED,this._onStreamFailed.bind(this)),null===(E=this._mediaServerClient)||void 0===E||E.on(wN.RSCP,(function(e){!!yb(e).call(e,(function(e){var t,r,n;return null==e||null===(t=e.StreamIds)||void 0===t?void 0:Wm(t).call(t,null===(r=O._localStream)||void 0===r||null===(n=r.stream)||void 0===n?void 0:n.id)}))&&(O._publishOnDemandItem=e,O._onPublishOnDemand())})),null===(b=this._mediaServerClient)||void 0===b||b.on(wN.RTT,this._onRTT.bind(this)),null===(k=this._mediaServerClient)||void 0===k||k.on(CN.ON_CONNECTION_STATE_CHANGE,this._onConnectionStateChange.bind(this)),null===(T=this._mediaServerClient)||void 0===T||T.on(CN.ABNORMAL_DISCONNECTION,this._handleAbnormalDisconnection.bind(this)),null===(I=this._mediaServerClient)||void 0===I||I.on(AN.ON_SPEAKER_CHANGE,this._onMeetingSpeakerChange.bind(this)),null===(R=this._mediaServerClient)||void 0===R||R.on("onRemoteStreamStats",(function(e){O._networkQualityManager.updateDownlinkStats(e,O._findRemoteStreamByScreen(e.userId,e.isScreen)),O.emit(jV.ON_REMOTE_STREAM_STATS,Ow(e))})),null===(A=this._mediaServerClient)||void 0===A||A.on("onLocalStreamStats",(function(e){O._networkQualityManager.updateUplinkStats(e),O.emit(jV.ON_LOCAL_STREAM_STATS,Ow(e))})),null===(w=this._mediaServerClient)||void 0===w||w.on("prevIceNode",(function(e){O._getAccessFeedbackIceNode=e})),null===(C=this._mediaServerClient)||void 0===C||C.on("prevIceNode",(function(e){O._getAccessFeedbackIceNode=e}))}},{key:"_removeHandlerEventHandler",value:function(){var e;null===(e=this._mediaServerClient)||void 0===e||e.removeAllListeners()}},{key:"join",value:(k=Sm(gm().mark((function e(t,r,n,i,o,a,s){var c=this;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Jx.setStats({rtc_app_id:t,room_id:r,user_id:i.userId}),Hj.setStats({rtc_session_id:t,rtc_room_id:r}),iG.print("join()"),e.abrupt("return",new H_((function(e,u){var d,l,h=iw();c._joinResolveCallback=function(t){var r;Wx.joinRoom(jx.END,h,!0,"",{enable_cloud_proxy:null===(r=c._roomInfo)||void 0===r?void 0:r.useCloudProxy}),c._initSubtitleTool(),e(t)},c._joinRejectCallback=function(e){var t;Array.isArray(e)&&e.length&&(e=e[0]),Wx.joinRoom(jx.END,h,!1,e.message,{enable_cloud_proxy:null===(t=c._roomInfo)||void 0===t?void 0:t.useCloudProxy}),u(e)},c._liveControlMessage=o,c._roomInfo={appId:t,roomId:r,token:n,userInfo:i,useCloudProxy:a,roomProfile:c._roomConfig.roomProfileType,expectedIDC:s},c.setSessionId(),Wx.joinRoom(jx.BEGIN,h,!1,"",{enable_cloud_proxy:null===(d=c._roomInfo)||void 0===d?void 0:d.useCloudProxy,expectedIDC:null===(l=c._roomInfo)||void 0===l?void 0:l.expectedIDC}),c._join(c._joinResolveCallback,c._joinRejectCallback,!1)})));case 4:case"end":return e.stop()}}),e)}))),function(e,t,r,n,i,o,a){return k.apply(this,arguments)})},{key:"_join",value:(b=Sm(gm().mark((function e(t,r){var n,i,o,a,s=arguments;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=s.length>2&&void 0!==s[2]&&s[2],i=iw(),iG.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:a=e.sent,this._mediaServerClient.roomAttributes=a.roomAttributes,null!==(o=a.roomAttributes)&&void 0!==o&&o.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:a.clients,streams:a.streams}),this._isReconnecting=!1,Wx.rtcJoinRoom(0,"web","web",iw()-i),this._onJoinSucc(a,n),e.next=26;break;case 20:if(e.prev=20,e.t0=e.catch(3),this._getAccessFeedback=void 0,this._getAccessNode=void 0,e.t0.code===aA.OPERATION_CANCEL||"function"!=typeof r){e.next=26;break}return e.abrupt("return",r(e.t0));case 26:case"end":return e.stop()}}),e,this,[[3,20]])}))),function(e,t){return b.apply(this,arguments)})},{key:"publishScreen",value:(E=Sm(gm().mark((function e(t,r,n,i,o){var a,s,c,u,d,l,h,f,p,v;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(iG.print("publishScreen()"),this._localScreenStream||(this._localScreenStream=new TV,this._localScreenStream.isScreen=!0,this._mediaServerClient.handler&&(this._localScreenStream.observer=new qj(this._localScreenStream,this._mediaServerClient.handler))),a=!1,s=!1,c=!1,u=!1,!this._localScreenStream.videoTrack&&r?(r instanceof PU&&(s=!0),a=!0):this._localScreenStream.videoTrack&&!r&&(a=!1),!this._localScreenStream.audioTrack&&n?(n instanceof MU&&(u=!0),c=!0):this._localScreenStream.audioTrack&&!n&&(c=!1),this._localScreenStream.videoTrack=r,this._localScreenStream.audioTrack=n,this._localScreenStream.videoEncodeConfig=t,i&&(ww(i)&&(this._localScreenStream.pubAudio=o===HV.PUB),Cw(i)&&(this._localScreenStream.pubVideo=o===HV.PUB),iG.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===(d=this._localScreenStream)||void 0===d||!d.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===(l=this._localScreenStream.observer)||void 0===l||l.setPublish(!0),e.next=22,this._mediaServerClient.publish(this._localScreenStream);case 22:e.next=28;break;case 24:return s?null===(h=this._localScreenStream.observer)||void 0===h||h.setPushVideo(a):null===(f=this._localScreenStream.observer)||void 0===f||f.setEnableVideo(a),u?null===(p=this._localScreenStream.observer)||void 0===p||p.setPushAudio(c):null===(v=this._localScreenStream.observer)||void 0===v||v.setEnableAudio(c),e.next=28,this.updatePubScreenTrack();case 28:case"end":return e.stop()}}),e,this)}))),function(e,t,r,n,i){return E.apply(this,arguments)})},{key:"updatePubScreenTrack",value:(S=Sm(gm().mark((function e(){return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(iG.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 S.apply(this,arguments)})},{key:"unpublishScreen",value:(y=Sm(gm().mark((function e(){var t;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(iG.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 y.apply(this,arguments)})},{key:"liveControlMessage",value:(g=Sm(gm().mark((function e(t){var r,n=this;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return iG.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 g.apply(this,arguments)})},{key:"publicStreamControlMessage",value:(m=Sm(gm().mark((function e(t){return gm().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 m.apply(this,arguments)})},{key:"subtitleControlMessage",value:(_=Sm(gm().mark((function e(t){return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._mediaServerClient.controlMessage(t);case 2:case"end":return e.stop()}}),e,this)}))),function(e){return _.apply(this,arguments)})},{key:"updateUserAttributes",value:(v=Sm(gm().mark((function e(t){return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return iG.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 v.apply(this,arguments)})},{key:"publish",value:(p=Sm(gm().mark((function e(t,r,n,i,o,a){var s,c,u,d,l,h,f,p,v,_,m,g,y=arguments;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s=y.length>6&&void 0!==y[6]&&y[6],iG.print("publish","Invoke publish"),c=!1,this._localStream||(this._localStream=new TV,this._mediaServerClient.handler&&(this._localStream.observer=new qj(this._localStream,this._mediaServerClient.handler)),c=!0),this._localStream.videoTrack=n,this._localStream.audioTrack=i,this._localStream.videoEncodeConfig=t,this._localStream.enableSimulcast=r,o&&(ww(o)&&(this._localStream.pubAudio=a===HV.PUB),Cw(o)&&(this._localStream.pubVideo=a===HV.PUB),iG.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,s?null===(u=this._localStream.observer)||void 0===u||u.setLogin(!0):c&&(d=!!this._localStream.videoTrack,l=!!this._localStream.audioTrack,h=this._localStream.videoTrack instanceof PU,f=this._localStream.audioTrack instanceof MU,this._roomConfig.isAutoPublish&&!this._hasPublished?(d&&(h?null===(p=this._localStream.observer)||void 0===p||p.setPushVideo(!0):null===(v=this._localStream.observer)||void 0===v||v.setEnableVideo(!0)),l&&(f?null===(_=this._localStream.observer)||void 0===_||_.setPushAudio(!0):null===(m=this._localStream.observer)||void 0===m||m.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(jV.ON_PUBLISH_RESULT,{isScreen:!1,state:pd.PUBLISH_SUCC}),e.next=24;break;case 20:throw e.prev=20,e.t0=e.catch(12),this.emit(jV.ON_PUBLISH_RESULT,{isScreen:!1,state:pd.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 p.apply(this,arguments)})},{key:"updatePubTrack",value:(f=Sm(gm().mark((function e(){return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(iG.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 f.apply(this,arguments)})},{key:"unpublish",value:(h=Sm(gm().mark((function e(){return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(iG.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 h.apply(this,arguments)})},{key:"subscribe",value:(l=Sm(gm().mark((function e(t,r,n){var i;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return iG.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 l.apply(this,arguments)})},{key:"updateSubTrack",value:(d=Sm(gm().mark((function e(t,r,n,i){var o,a;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(iG.print("updateSubTrack","Invoke updateSubTrack"),!i){e.next=4;break}return e.next=4,null===(a=this._mediaServerClient)||void 0===a?void 0:a.updateSubTrackLayer(t,i);case 4:return e.abrupt("return",null===(o=this._mediaServerClient)||void 0===o?void 0:o.updateSubTrack(t,r,n));case 5:case"end":return e.stop()}}),e,this)}))),function(e,t,r,n){return d.apply(this,arguments)})},{key:"updateSubVideoConfig",value:(u=Sm(gm().mark((function e(t,r){var n,i,o,a,s;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((a=this._findRemoteStreamByScreen(t,!1))&&a.hasSubscribed&&!((null==a||null===(n=a.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 s=this._getSubLayer(r,a),a.originalStreamIndex=s.spatialLayer,e.abrupt("return",null===(o=this._mediaServerClient)||void 0===o?void 0:o.updateSubTrackLayer(a,s));case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return u.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,g=(m-h)/(m-d[l].width*d[l].height);_=g<.1?d[l-1]:d[l],l=g<.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:(c=Sm(gm().mark((function e(t,r){return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return iG.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 c.apply(this,arguments)})},{key:"startSubtitle",value:(s=Sm(gm().mark((function e(t){return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._subtitleTool){e.next=5;break}return e.next=3,this._subtitleTool.start(t);case 3:e.next=6;break;case 5:throw new cA(aA.INVOKED_BEFORE_JOIN_ROOM,"join first");case 6:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"stopSubtitle",value:(a=Sm(gm().mark((function e(){var t;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:null===(t=this._subtitleTool)||void 0===t||t.stop();case 1:case"end":return e.stop()}}),e,this)}))),function(){return a.apply(this,arguments)})},{key:"leave",value:(o=Sm(gm().mark((function e(){var t,r,n,i,o,a,s,c,u=arguments;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=u.length>0&&void 0!==u[0]&&u[0],iG.print("leave","Invoke leave"),n=iw(),null===(t=this._subtitleTool)||void 0===t||t.destroy(),delete this._subtitleTool,e.prev=5,this._mediaServerClient.connectionState!==JV.CONNECTED&&this._joinRejectCallback&&this._joinRejectCallback(new Error(Gx.LEAVE_ROOM)),clearTimeout(this._reconnectTimer),o=qT(ZI(i=this._remoteStreams).call(i));try{for(o.s();!(a=o.n()).done;)s=a.value,Array.isArray(s)&&s.forEach((function(e){var t;null===(t=e.observer)||void 0===t||t.setLogin(!1)}))}catch(d){o.e(d)}finally{o.f()}return this._localStream&&(null===(c=this._localStream.observer)||void 0===c||c.setLogin(!1)),e.next=13,this._mediaServerClient.leave();case 13:this.destroy(),Wx.rtcLeaveRoom(0,"",iw()-n),Jx.setStats({room_id:void 0,user_id:void 0,rtc_session_id:void 0}),Hj.setStats({rtc_room_id:void 0}),e.next=27;break;case 19:if(e.prev=19,e.t0=e.catch(5),!r){e.next=25;break}throw e.t0;case 25:this.destroy();case 26:e.t0 instanceof Error&&Wx.rtcLeaveRoom(-1,e.t0.message,iw()-n);case 27:case"end":return e.stop()}}),e,this,[[5,19]])}))),function(){return o.apply(this,arguments)})},{key:"updateRemoteUserPriority",value:function(e){var t,r=this;null===(t=this.remoteStreams.get(e))||void 0===t||t.forEach((function(e){e.streamState!==kV.INIT&&r._mediaServerClient.subscribe(e,e.subMediaType)}))}},{key:"destroy",value:function(){var e;iG.print("destroy","Invoke destroy"),Wx.rtcInvokeStatus("".concat((new Error).stack),0,"room_destroy","",0),null===(e=this._subtitleTool)||void 0===e||e.destroy(),delete this._subtitleTool,this._destroyAndInitMediaServerClient(),this._roomInfo=void 0,this._remoteUsers=new aE;var t,r,n,i=qT(this._remoteStreams);try{for(i.s();!(t=i.n()).done;){var o=WT(t.value,2)[1];Array.isArray(o)&&o.forEach((function(e){e&&e.clean()}))}}catch(a){i.e(a)}finally{i.f()}(this._virtualStreams.forEach((function(e){null==e||e.clean()})),this._remoteStreams=new aE,this._localStream)&&(null===(r=this._localStream)||void 0===r||r.clean(),this._localStream=void 0);this._localScreenStream&&(null===(n=this._localScreenStream)||void 0===n||n.clean(),this._localScreenStream=void 0);this._context=void 0,this._reconnectRecord=new sG,this._removeHandlerEventHandler(),clearTimeout(this._connectionLostTimer),this._userDuplicateLoginTimerMap.forEach((function(e){clearTimeout(e)})),this._userDuplicateLoginTimerMap.clear(),this._networkQualityManager.destroy(),this._videoSizeObserver.destroy(),this._csrcUserIdMap={},this._virtualStreams=[],this._remoteStreamStreamIdUserIdMap={}}},{key:"updateToken",value:(i=Sm(gm().mark((function e(t){return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return iG.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 i.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=ew(),Jx.setStats({rtc_session_id:this._sessionId}),Hj.setStats({rtc_session_id:this._sessionId})}},{key:"sendRoomMessage",value:(n=Sm(gm().mark((function e(t){var r,n,i,o,a,s=arguments;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=s.length>1&&void 0!==s[1]&&s[1],a={clientId:null===(r=this._roomInfo)||void 0===r?void 0:r.userInfo.userId,binary:o,message:"",roomId:null===(n=this._roomInfo)||void 0===n?void 0:n.roomId},!o){e.next=8;break}return e.next=5,sw.ab2b64str(t);case 5:a.message=e.sent,e.next=9;break;case 8:a.message=t;case 9:return e.abrupt("return",null===(i=this._mediaServerClient)||void 0===i?void 0:i.sendRoomMessage(a));case 10:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"_destroyAndInitMediaServerClient",value:function(){iG.print("_destroyAndInitMediaServerClient()"),this._mediaServerClient&&(this._mediaServerClient.destroy(),this._removeHandlerEventHandler()),this._mediaServerClient=new $V(this._context),this._addHandlerEventHandler()}},{key:"_onJoinSucc",value:function(e,t){var r,n,i,o=this;iG.print("JoinSuccess()"),this._serverConfig=e.config;var a=[],s=[],c=[],u=[],d=[];null===(r=e.clientsDetail)||void 0===r||r.forEach((function(t){if(t.attributes&&(t.attributes.serverMuteVideo&&o.safeEmit(jV.ON_VIDEO_STREAM_BANNED,{uid:t.clientId,banned:1===t.attributes.serverMuteVideo}),t.attributes.serverMuteAudio&&o.safeEmit(jV.ON_AUDIO_STREAM_BANNED,{uid:t.clientId,banned:1===t.attributes.serverMuteAudio})),t.clientId!==e.clientId){var r=o._remoteUsers.get(t.clientId);r?r._stillExist=!0:a.push(t)}}));var l,h=qT(ZI(n=this._remoteUsers).call(n));try{for(h.s();!(l=h.n()).done;){var f=l.value;f._stillExist||s.push({clientId:f.userId}),delete f._stillExist}}catch(m){h.e(m)}finally{h.f()}e.streams.forEach((function(e){var t=o._findRemoteStreamByScreen(e.clientId,e.screen);t?(t.stillExist=!0,t.streamId=e.streamId,d.push(e)):u.push(e)}));var p,v=qT(ZI(i=this._remoteStreams).call(i));try{for(v.s();!(p=v.n()).done;){var _=p.value;Array.isArray(_)&&_.forEach((function(e){e.stillExist?delete e.stillExist:c.push({clientId:e.userId,streamId:e.streamId,message:IN.clientDisconnected})}))}}catch(m){v.e(m)}finally{v.f()}setTimeout((function(){s.forEach((function(e){return o._onUserDisconnection(e)})),a.forEach((function(e){return o._onUserConnection(e)})),c.forEach((function(e){return o._onRemoveStream(e)})),u.forEach((function(e){return o._onAddStream(e,{fromSignal:!1})})),d.forEach((function(e){return o._onUpdateStreamAttributes(e)})),t&&o._handleSendOrRecvStreamAfterReconnect()}))}},{key:"_handleSendOrRecvStreamAfterReconnect",value:function(){var e,t,r=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 n,i=qT(ZI(t=this._remoteStreams).call(t));try{for(i.s();!(n=i.n()).done;){var o=n.value;Array.isArray(o)&&o.forEach(function(){var e=Sm(gm().mark((function e(t){var n,i,o,a;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.hasSubscribed){e.next=15;break}return t.resetHasSubscribed(),e.prev=2,iG.print(Im(n="start resubscribe ".concat(t.userId," with ")).call(n,t.subMediaType)),e.next=6,r._mediaServerClient.subscribe(t,t.subMediaType);case 6:iG.print(Im(i="success resubscribe ".concat(t.userId," with ")).call(i,t.subMediaType)),r.safeEmit(jV.RESUBSCRIBE,{stream:t}),e.next=15;break;case 10:e.prev=10,e.t0=e.catch(2),iG.print(Im(o=Im(a="failed resubscribe ".concat(t.userId," with ")).call(a,t.subMediaType,", error:")).call(o,e.t0)),t.clean(),null==t||t.resetHasSubscribed();case 15:case"end":return e.stop()}}),e,null,[[2,10]])})));return function(t){return e.apply(this,arguments)}}())}}catch(a){i.e(a)}finally{i.f()}null===(e=this._subtitleTool)||void 0===e||e.reconnect()}},{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=yb(o).call(o,(function(e){var t;return(null==e||null===(t=e.receiver)||void 0===t?void 0:t.track)===i}));if(a){var s=new IV("ff-stream","ff-stream",!1,oG);s.virtual=!0,s.audioTransceiver=a,s.audioMid="0",s.audioTrack=QU(i),this._virtualStreams.push(s),this.safeEmit(jV.SUBSCRIBE_PUSH_TRACK,{stream:s})}}}},{key:"_findRemoteStream",value:function(e,t){var r=this._remoteStreams.get(e);return Array.isArray(r)?yb(r).call(r,(function(e){return e.streamId===t})):null}},{key:"_findRemoteStreamByScreen",value:function(e,t){var r=this._remoteStreams.get(e);return Array.isArray(r)?yb(r).call(r,(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:Gs(f).call(f,(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,v)v.attributes=e.attributes;else if((v=new IV(e.clientId,e.streamId,e.screen,e.attributes)).virtual=c,this._initStreamListeners(v),!c){var _=this._remoteStreams.get(e.clientId);_?_.push(v):this._remoteStreams.set(e.clientId,[v])}if(this._mediaServerClient.handler&&(v.observer=new Kj(v,this._mediaServerClient.handler)),!v.isScreen&&l){var m,g,y,S,E,b,k,T;if(a&&v.hasVideo)if(v.attributes.extvideo)null===(m=v.observer)||void 0===m||m.setExternalVideoSource(!0),null===(g=v.observer)||void 0===g||g.setPushVideo(!0);else null===(y=v.observer)||void 0===y||y.setExternalVideoSource(!1),null===(S=v.observer)||void 0===S||S.setPublishVideo(!0);if(a&&v.hasAudio&&d&&!this._mediaServerClient.roomAttributes.multiChatMode)if(v.attributes.extaudio)null===(E=v.observer)||void 0===E||E.setExternalAudioSource(!0),null===(b=v.observer)||void 0===b||b.setPushAudio(!0);else null===(k=v.observer)||void 0===k||k.setExternalAudioSource(!1),null===(T=v.observer)||void 0===T||T.setPublishAudio(!0);if(!0===i&&!1===a){var I,R=this._roomConfig,A=R.isAutoSubscribeAudio,w=R.isAutoSubscribeVideo;null===(I=v.observer)||void 0===I||I.setLogin(!0,{audio:!!A,video:!!w})}}return i&&this.safeEmit(AN.ON_ADD_STREAM,{stream:v}),v}}},{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,sd({},n)),this.safeEmit(AN.USER_CONNECTION,{userInfo:n}),e.attributes&&(e.attributes.serverMuteVideo&&this.safeEmit(jV.ON_VIDEO_STREAM_BANNED,{uid:e.clientId,banned:1===e.attributes.serverMuteVideo}),e.attributes.serverMuteAudio&&this.safeEmit(jV.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===ON.kickedByAdmin?a=aA.KICKED_OUT:i===ON.onUserTokenDidExpire?a=aA.TOKEN_EXPIRED:i===ON.userDuplicateLogin&&(a=aA.DUPLICATE_LOGIN),o===DN.roomDismissByAdmin&&(a=aA.ROOM_DISMISS),a&&this.safeEmit(jV.ON_ROOM_ERROR,{errorCode:a})}else{var s=dd.DROPPED;i===ON.userLeave?s=dd.QUIT:i===ON.kickedByAdmin?s=dd.KICKED_BY_ADMIN:i===ON.roleChanged&&(s=dd.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:IN.clientDisconnected})})),r._remoteStreams.delete(n),r.safeEmit(jV.ON_USER_LEAVE,{userInfo:{userId:n},reason:s})};if(i===ON.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=yb(n).call(n,(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=Gs(t).call(t,(function(t){return t.streamId!==e.streamId||(t.clean(),!1)})),r._remoteStreams.set(e.clientId,t))})).finally((function(){r.safeEmit(AN.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(jV.ON_VIDEO_STREAM_BANNED,{uid:e.clientId,banned:1===e.attributes.serverMuteVideo}),e.attributes.serverMuteAudio&&this.safeEmit(jV.ON_AUDIO_STREAM_BANNED,{uid:e.clientId,banned:1===e.attributes.serverMuteAudio}))}},{key:"_onUpdateRoomAttributes",value:function(e){var t;e.roomAttributes&&(this._mediaServerClient.roomAttributes=sd(sd({},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,i=e.clientId,o=e.streamId,a=e.attributes,s=this._findRemoteStream(i,o);if(s){var c,u,d=s.attributes,l=sd(sd({},d),a),h=!1,f=l.localaudio!==d.localaudio,p=!1,v=!1,_=l.localvideo!==d.localvideo,m=!1,g=aV.NONE,y=aV.NONE;if(l.audiostream!==d.audiostream&&(h=l.localaudio,p=!!l.audiostream,l.audiostream?g|=gd.AUDIO:y|=gd.AUDIO),l.videostream!==d.videostream&&(v=l.localvideo,m=!!l.videostream,l.videostream?g|=gd.VIDEO:y|=gd.VIDEO),g&&this.safeEmit(jV.ON_USER_PUBLISH_STATE_CHANGE,{userId:i,mediaType:g,isScreen:s.isScreen,pubState:HV.PUB,remoteStream:s}),y&&this.safeEmit(jV.ON_USER_PUBLISH_STATE_CHANGE,{userId:i,mediaType:y,isScreen:s.isScreen,pubState:HV.UNPUB,remoteStream:s}),s.attributes=l,l.localaudio!==d.localaudio)if(l.localaudio){var S,E,b,k;if(r)if(l.extaudio)null===(S=s.observer)||void 0===S||S.setExternalAudioSource(!0),null===(E=s.observer)||void 0===E||E.setPushAudio(!0);else null===(b=s.observer)||void 0===b||b.setExternalAudioSource(!1),null===(k=s.observer)||void 0===k||k.setEnableAudio(!0);this.safeEmit(jV.ON_USER_START_AUDIO_CAPTURE,{userId:i},s)}else{var T,I,R,A;if(l.extaudio)null===(T=s.observer)||void 0===T||T.setExternalAudioSource(!0),null===(I=s.observer)||void 0===I||I.setPushAudio(!1);else null===(R=s.observer)||void 0===R||R.setExternalAudioSource(!1),null===(A=s.observer)||void 0===A||A.setEnableAudio(!1);!s.isScreen&&this.safeEmit(jV.ON_USER_STOP_AUDIO_CAPTURE,{userId:i})}if(l.localvideo!==d.localvideo)if(l.localvideo){var w,C,O,D;if(n)if(l.extvideo)null===(w=s.observer)||void 0===w||w.setExternalVideoSource(!0),null===(C=s.observer)||void 0===C||C.setPushVideo(!0);else null===(O=s.observer)||void 0===O||O.setExternalVideoSource(!1),null===(D=s.observer)||void 0===D||D.setEnableVideo(!0);this.safeEmit(jV.ON_USER_START_VIDEO_CAPTURE,{userId:i})}else{var x,N,P,M;if(l.extvideo)null===(x=s.observer)||void 0===x||x.setExternalVideoSource(!0),null===(N=s.observer)||void 0===N||N.setPushVideo(!1);else null===(P=s.observer)||void 0===P||P.setExternalVideoSource(!1),null===(M=s.observer)||void 0===M||M.setEnableVideo(!1);!s.isScreen&&this.safeEmit(jV.ON_USER_STOP_VIDEO_CAPTURE,{userId:i})}if(h&&!f)null===(c=s.observer)||void 0===c||c.setRemoteUnmuteAudio(p);if(v&&!_)null===(u=s.observer)||void 0===u||u.setRemoteUnmuteVideo(m)}}},{key:"_onPushTrack",value:function(e){var t,r=this;if(null!==(t=e.streamId)&&void 0!==t&&oA(t).call(t,"audio_mux")){var n=this._onAddStream(sd(sd({},e),{},{attributes:oG}),{needEmit:!1,fromSignal:!1,virtual:!0});n&&this._mediaServerClient.subscribe4pushTrack(n,e).then((function(){r.safeEmit(jV.SUBSCRIBE_PUSH_TRACK,{stream:n}),r._virtualStreams.push(n)})).catch((function(e){iG.print("subscribe","push track failed %o",e)}))}else{var i;Wx.rtcError(Im(i="onPushTrack, userId: ".concat(e.clientId,", ")).call(i,e.streamId),-1001)}}},{key:"_onRemoveTrack",value:function(e){var t,r=e.clientId,n=e.streamId,i=e.message;iG.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=WT(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&&MR(t).call(t,(function(e,t){return e.audioLevel-t.audioLevel})),t}},{key:"_nodeChange",value:function(e){var t,r=e.nodes,n=e.reason;hN.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,Wx.rtcNodeChange(0,hk(e),hk(n)),this._joinResolveCallback&&this._joinRejectCallback?this._join(this._joinResolveCallback,this._joinRejectCallback):this._reconnect()}},{key:"_reconnect",value:function(){var e,t=this;this._isReconnecting=!0;var r,n=qT(ZI(e=this._remoteStreams).call(e));try{for(n.s();!(r=n.n()).done;){var i=r.value;Array.isArray(i)&&i.forEach((function(e){return e.clean()}))}}catch(o){n.e(o)}finally{n.f()}Wx.rtcReconnect(1002,_x.PEERCONNECTION_RECONNECTING,this._roomInfo.userInfo.userId,mx.PEERCONNECTION),this._liveTranscodingOnceSucc||delete this._liveControlMessage,this._join((function(){Wx.rtcReconnected(gx.PEERCONNECTION_RECONNECTED,yx.PEERCONNECTION)}),(function(e){t._reconnectRecord.record(e),t._reconnectRecord.shouldReconnect?(iG.print("Reconnecting error, will reconnect after 3s",e),t._reconnectTimer=window.setTimeout(t._reconnect.bind(t),3e3)):(t.safeEmit(jV.RECONNECT_FAILED),t.destroy())}),!0)}},{key:"_handleAbnormalDisconnection",value:function(){iG.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===JV.DISCONNECTED)t=Sd.CONNECTION_STATE_DISCONNECTED;else if(e.next===JV.CONNECTED)clearTimeout(this._connectionLostTimer),t=this._isReconnecting?Sd.CONNECTION_STATE_RECONNECTED:Sd.CONNECTION_STATE_CONNECTED;else{if(e.next!==JV.CONNECTING)return;t=this._isReconnecting?Sd.CONNECTION_STATE_RECONNECTING:Sd.CONNECTION_STATE_CONNECTING}e.prev===JV.CONNECTED&&e.next===JV.DISCONNECTED&&(this._connectionLostTimer=window.setTimeout((function(){r.safeEmit(CN.ON_CONNECTION_STATE_CHANGE,{state:Sd.CONNECTION_STATE_LOST})}),1e4)),this._networkQualityManager.setConnectionState(e.next),this.safeEmit(CN.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(jV.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?md.STREAM_INDEX_SCREEN:md.STREAM_INDEX_MAIN}})}))}},{key:"_onCustomMessage",value:function(e){this.safeEmit(AN.ON_CUSTOM_MESSAGE,e)}},{key:"_onUserMessageReceived",value:function(e){this.safeEmit(AN.USER_MESSAGE_RECEIVED,{userId:e.from,message:e.msg})}},{key:"_onUserBinaryMessageReceived",value:function(e){var t,r={userId:e.from,message:e.msg};null!==(t=this._subtitleTool)&&void 0!==t&&t.onMessageRecv(r)||this.safeEmit(AN.USER_BINARY_MESSAGE_RECEIVED,r)}},{key:"_initSubtitleTool",value:function(){var e=this;this._subtitleTool=new tG(this),this._subtitleTool.onEvent=function(t){e.emit(jV.ON_SUBTITLE_STATE_CHANGED,t)},this._subtitleTool.onMessage=function(t){e.emit(jV.ON_SUBTITLE_MESSAGE_RECEIVED,t)}}},{key:"_onPostProcessingMessage",value:function(e){if(e.body)if("subtitleCallback"!==e.type){var t=e.body,r=t.error||0,n=GV.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=GV.START_FAILED);break;case"TranscodeStateChanged":n=0!==t.error?GV.START_FAILED:GV.START_SUCCESS;break;case"TranscodeStopped":n=0!==t.error?GV.STOP_FAILED:GV.STOP_SUCCESS;break;case"TranscodeUpdated":n=0!==t.error?GV.UPDATE_FAILED:GV.UPDATE_SUCCESS}this.safeEmit(AN.POST_PROCESSING_MESSAGE,{code:r,protocol:t.protocol,error:t.error,eventType:n,message:i[r]})}this.safeEmit(AN.POST_PROCESSING_MESSAGE,{code:r,message:i[r],type:e.type})}else{var o;null===(o=this._subtitleTool)||void 0===o||o.onResult(e)}}},{key:"_onUserTokenWillExpire",value:function(){this.safeEmit(AN.ON_USER_TOKEN_WILL_EXPIRE,null)}},{key:"_onStreamFailed",value:(r=Sm(gm().mark((function e(t){var r,n,i,o,a,s,c,u,d,l;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("publish"!==t.type){e.next=11;break}if(s=void 0,(null===(r=this.localStream)||void 0===r?void 0:r.streamId)===t.streamId?s=this.localStream:(null===(n=this.localScreenStream)||void 0===n?void 0:n.streamId)===t.streamId&&(s=this.localScreenStream),s){e.next=5;break}return e.abrupt("return");case 5:return null===(i=s)||void 0===i||i.clean(),e.next=8,null===(o=this._mediaServerClient)||void 0===o?void 0:o.unpublish(s).catch((function(){}));case 8:null===(a=this._mediaServerClient)||void 0===a||a.publish(s).catch((function(){})),e.next=20;break;case 11:if("subscribe"!==t.type){e.next=20;break}if(c=this._remoteStreamStreamIdUserIdMap[t.streamId],!(u=this._findRemoteStream(c,t.streamId))){e.next=20;break}return e.next=17,null===(d=this._mediaServerClient)||void 0===d?void 0:d.unsubscribe(u,gd.AUDIO_AND_VIDEO);case 17:return e.next=19,null===(l=this._mediaServerClient)||void 0===l?void 0:l.subscribe(u,u.subMediaType,u.subLayer);case 19:this.safeEmit(jV.RESUBSCRIBE,{stream:u});case 20:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"_onStreamControlMessage",value:function(e){var t,r;e.type===RN.PushLimitWarn&&(null!==(t=this._localStream)&&void 0!==t&&t.pubAudio||null!==(r=this._localStream)&&void 0!==r&&r.pubVideo||this.unpublish())}},{key:"_onPublishOnDemand",value:(t=Sm(gm().mark((function e(){var t,r,n,i,o,a,s,c,u,d,l,h,f,p;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._publishOnDemandBusy&&!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)){e.next=2;break}return e.abrupt("return");case 2:if(a=this._publishOnDemandItem,this._publishOnDemandItem=void 0,a){e.next=6;break}return e.abrupt("return");case 6:if(null===(i=this._localStream)||void 0===i||!i.enableSimulcast||null===(o=this._localStream)||void 0===o||!o.videoTransceiver){e.next=16;break}return u=[],this._publishOnDemandBusy=!0,d=null===(s=this._localStream)||void 0===s?void 0:s.stream.id,l=null===(c=this._localStream)||void 0===c?void 0:c.videoTransceiver.sender,h=l.getParameters(),Array.isArray(h.encodings)&&Array.isArray(a)&&(p={},iG.print("_onPublishOnDemand exec","usedDescriptions: %o",a),a.forEach((function(e){var t;if(null!=e&&null!==(t=e.StreamIds)&&void 0!==t&&Wm(t).call(t,d)){var r=null==e?void 0:e.Metadata.VideoIndex;p[r]=!0}})),h.encodings=ck(f=h.encodings).call(f,(function(e){if(e.rid){p[e.rid]?e.active=!0:e.active=!1;var t=+e.rid;u[t]=e.active}return e})),this._context&&(this._context.activeSimStreams=u)),e.next=15,l.setParameters(h);case 15:this._publishOnDemandBusy=!1;case 16:this._onPublishOnDemand();case 17:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{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.emit(jV.ON_NETWORK_QUALITY,e,t)}},{key:"_emitVideoSizeChange",value:function(e,t,r,n){var i;this.emit(jV.ON_REMOTE_VIDEO_SIZE_CHANGED,{roomId:null===(i=this.roomInfo)||void 0===i?void 0:i.roomId,userId:e,streamIndex:t?md.STREAM_INDEX_SCREEN:md.STREAM_INDEX_MAIN},{width:r,height:n})}},{key:"multiChatMode",get:function(){var e;return null===(e=this._mediaServerClient)||void 0===e?void 0:e.multiChatMode()}}]),I}(IC),sG=function(){function e(){Kd(this,e),od(this,"_all_201_count",void 0),od(this,"_has_4xx",void 0),this._all_201_count=0,this._has_4xx=!1}return zd(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;ck(e).call(e,(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}(),cG=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&&LE(r.style,t.style),t.attributes&&mA(t.attributes).forEach((function(e){var t=WT(e,2),n=t[0],i=t[1];"muted"===n?r.muted=!0:r.setAttribute(n,i)})),r},uG=new bC("Player",0),dG=["play","playing","pause","ended","error","seeking","seeked","waiting","canplay","canplaythrough","durationchange","volumechange","loadedmetadata","loadeddata","loadstart","timeupdate"],lG={playsinline:"","webkit-playsinline":""},hG={playsinline:"","webkit-playsinline":"","x5-playsinline":"","x5-video-player-type":"h5","x-webkit-airplay":"allow",preload:"",muted:""},fG=function(e){AI(n,e);var t,r=zI(n);function n(e){var t;Kd(this,n),od(YT(t=r.call(this)),"_containerDom",void 0),od(YT(t),"_videoDom",void 0),od(YT(t),"__cumulativeTime",void 0),od(YT(t),"userId",void 0),od(YT(t),"renderMode",void 0),od(YT(t),"mirrorType",Ed.MIRROR_TYPE_NONE),od(YT(t),"isScreen",void 0),od(YT(t),"isLocal",void 0),od(YT(t),"played",!1),od(YT(t),"_emitPlayFailed",!1),od(YT(t),"_videoContainer",void 0),od(YT(t),"_safari15VideoTimer",void 0),od(YT(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"canplay":case"loadeddata":t._internalPlay();break;case"playing":uG.print("VideoPlayerPlaying","[userId-".concat(t.userId,"] video element playing"))}})),od(YT(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,i,o;t._emitPlayFailed||("AbortError"!==e.name?(t._emitPlayFailed=!0,Wx.rtcError(Im(r="video autoplay failed, userId: ".concat(t.userId,", ")).call(r,e.name),-1e3),t.emit("playback_event",{type:"video",rawEvent:e,readyState:(null===(n=t._videoDom)||void 0===n?void 0:n.readyState)||0,userId:t.userId,eventName:"autoplay-error",currentTime:(null===(i=t._videoDom)||void 0===i?void 0:i.currentTime)||0,isScreen:t.isScreen})):Wx.rtcError(Im(o="video autoplay failed, userId: ".concat(t.userId,", ")).call(o,e.name),-1e3))}))}}));var i=e.renderDom,o=e.userId;t.renderMode=void 0!==e.renderMode?e.renderMode:_d.RENDER_MODE_FIT;var a="string"==typeof i?document.getElementById(i):i;if(!a)throw new cA(aA.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(),t}return zd(n,[{key:"_initVideo",value:function(){var e;this._videoDom||(this._videoDom=cG("video",{style:{width:"100%",height:"100%"},attributes:hG}),this._videoDom.id=Im(e="".concat(this.userId,"_")).call(e,nw()),this.renderMode===_d.RENDER_MODE_FIT?this._videoDom.style.objectFit="contain":this._videoDom.style.objectFit="cover",this.mirror(this.mirrorType===Ed.MIRROR_TYPE_RENDER));this._videoContainer.appendChild(this._videoDom),this._containerDom.appendChild(this._videoContainer),this._initListeners()}},{key:"_initListeners",value:function(){var e=this;this._videoDom&&dG.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&&dG.forEach((function(t){var r;null===(r=e._videoDom)||void 0===r||r.removeEventListener(t,e.emitVideoEvent)}))}},{key:"_recordFrame",value:function(e){var t=this,r=e.isScreen?1.5:.5;if(dw){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=iw();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=iw()-(e.statsReport.pauseStart||0);i>500&&(e.statsReport.pauseDuration+=i)}}}))}},{key:"playVideo",value:(t=Sm(gm().mark((function e(t,r){var n,i,o,a,s=this;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=this._videoDom,uG.print("playVideo","play video track: ".concat(this.userId)),!(o&&o.srcObject instanceof MediaStream&&o.srcObject.getTrackById(null===(n=t.getTrack())||void 0===n?void 0:n.id))){e.next=5;break}try{Wx.rtcInvokeStatus("play video repeatedly",0,"playVideo",this.userId,0)}catch(nW){}return e.abrupt("return");case 5:o||(this._initVideo(),o=this._videoDom),uG.print("playVideo","play video by dom: ".concat(null===(i=o)||void 0===i?void 0:i.id)),(a=new MediaStream).addTrack(t.getTrack("preprocessing")),o.srcObject=a,o&&!this._containerDom.contains(this._videoContainer)&&this._containerDom.appendChild(this._videoContainer),o&&!this._videoContainer.contains(o)&&this._videoContainer.appendChild(o),setTimeout((function(){return s._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(uG.print("Invoke VideoPlayer.manuallyPlay",this.userId,this.isScreen),this._emitPlayFailed=!1,!this._videoDom)throw new cA(aA.INVALID_PARAMS,"Player not found");return 0!==this._videoDom.readyState||gw?this._videoDom.play():H_.resolve()}},{key:"mirror",value:function(e){var t;uG.print("mirror",Im(t="".concat(this.userId," set mirror: ")).call(t,e)),this.mirrorType=e?Ed.MIRROR_TYPE_RENDER:Ed.MIRROR_TYPE_NONE,this._videoDom&&(this._videoDom.style.transform=e?"rotateY(180deg)":"")}},{key:"stop",value:function(){var e,t=this._containerDom;(uG.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(){uG.print("destroy","video player: ".concat(this.userId)),this.stop(),II(kI(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}(iC.exports.EventEmitter),pG=function(e){AI(i,e);var t,r,n=zI(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(Kd(this,i),od(YT(t=n.call(this)),"_containerDom",void 0),od(YT(t),"_audioDom",void 0),od(YT(t),"_fakeAudioDom",void 0),od(YT(t),"userId",void 0),od(YT(t),"muted",!1),od(YT(t),"_emitPlayFailed",!1),od(YT(t),"played",!1),od(YT(t),"isScreen",void 0),od(YT(t),"_wechatTimer",void 0),od(YT(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&&uG.print("AudioPlayerPlaying","[userId-".concat(t.userId,"] audio element playing")),"pause"===e.type&&uG.print("AudioPlayerPause","[userId-".concat(t.userId,"] audio element pause")),yw&&gw&&("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)})),od(YT(t),"_internalPlay",(function(){var e,r;if(iN("_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){var r,n;t._autoPlayError(e),Wx.rtcError(Im(r=Im(n="audio autoplay failed, userId: ".concat(t.userId,": ")).call(n,e.message," ")).call(r,e.name),-1e3)})).then((function(){iN("_internalPlay successfully",{userId:t.userId})}))}catch(a){var i,o;t._autoPlayError(a),Wx.rtcError(Im(i=Im(o="audio autoplay failed, userId: ".concat(t.userId,": ")).call(o,a.message," ")).call(i,a.name),-1e3)}})),o){var c=document.getElementById(o);if(!c)throw new cA(aA.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 zd(i,[{key:"_initAudio",value:function(){var e;this._audioDom||(this._audioDom=cG("audio",{style:{display:"none"},attributes:lG}),this._audioDom.volume=this.muted?0:1,this._audioDom.muted=this.muted,this._audioDom.id=Im(e="".concat(this.userId,"_")).call(e,nw()),this._containerDom.appendChild(this._audioDom));this._initListeners()}},{key:"_initListeners",value:function(){var e=this;this._audioDom&&dG.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&&(dG.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=Sm(gm().mark((function e(t){var r,n,i,o,a,s=this;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(uG.print("playAudio","play audio track: ".concat(this.userId)),!((o=this._audioDom)&&o.srcObject instanceof MediaStream&&o.srcObject.getTrackById(null===(r=t.getTrack())||void 0===r?void 0:r.id))){e.next=4;break}return e.abrupt("return");case 4:o||(this._initAudio(),o=this._audioDom),(a=new MediaStream).addTrack(t.getTrack("preprocessing")),o.srcObject=a,null===(n=o)||void 0===n||n.addEventListener("canplay",this._internalPlay),null===(i=o)||void 0===i||i.addEventListener("loadeddata",this._internalPlay),setTimeout((function(){return s._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 cA(aA.INVALID_PARAMS,"Player not found");this._audioDom.pause()}},{key:"manuallyPlay",value:function(){var e;if(uG.print("Invoke AudioPlayer.manuallyPlay"),this._emitPlayFailed=!1,!this._audioDom)throw new cA(aA.INVALID_PARAMS,"Player not found");if(!this.played)return H_.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:H_.resolve(t)}},{key:"setPlaybackDevice",value:(t=Sm(gm().mark((function e(t){var r,n;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return uG.print("setPlaybackDevice","setPlaybackDevice: ".concat(t)),e.next=3,_U.enumerateAudioPlaybackDevices();case 3:if(r=e.sent,n=ck(r).call(r,(function(e){return e.deviceId})),Wm(n).call(n,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;uG.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(){uG.print("destroy","audio player: ".concat(this.userId)),this.stop(),II(kI(i.prototype),"removeAllListeners",this).call(this),this._removeListeners(),this._audioDom&&(this._audioDom.srcObject=null,delete this._audioDom)}}]),i}(iC.exports.EventEmitter);function vG(e,t,r,n){var i=function(){var e=Sm(gm().mark((function e(t,i){var o,a;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=null==n?void 0:n.get(i),Array.isArray(o)&&(o=null===(a=o)||void 0===a?void 0:yb(a).call(a,(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:o&&(t instanceof fG&&o.videoTrack&&t.playVideo(o.videoTrack,o),t instanceof pG&&o.audioTrack&&t.playAudio(o.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 o=[];return e.forEach((function(e,t){return o.push(i(e,t))})),H_.all(o)}var _G=function(){function e(){Kd(this,e),od(this,"_timer",void 0),od(this,"userMessage",void 0),od(this,"roomMessage",void 0),this.userMessage={},this.roomMessage={},this._setTimer()}return zd(e,[{key:"_setTimer",value:function(){var e=this;!function t(){e._reportAndgReset(),clearTimeout(e._timer),e._timer=setTimeout(t,1e4)}()}},{key:"_reportAndgReset",value:function(){(an(this.userMessage).length||an(this.roomMessage).length)&&(this._report(),this._reset())}},{key:"_report",value:function(){var e,t,r=this;Wx.rtcMessageStatistics(ck(e=an(this.userMessage)).call(e,(function(e){return r.userMessage[e]})),ck(t=an(this.roomMessage)).call(t,(function(e){return r.roomMessage[e]})),"")}},{key:"_reset",value:function(){this.userMessage={},this.roomMessage={}}},{key:"_checkInitUserMessage",value:function(e,t){var r,n;this.userMessage[Im(r="".concat(t,"-")).call(r,e)]||(this.userMessage[Im(n="".concat(t,"-")).call(n,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){var n,i;(this._checkInitUserMessage(e,t),this.userMessage[Im(n="".concat(t,"-")).call(n,e)].dc_send_total++,r)&&this.userMessage[Im(i="".concat(t,"-")).call(i,e)].dc_send_binary++}},{key:"_recvUserMessage",value:function(e,t){var r;this._checkInitUserMessage(e,t),this.userMessage[Im(r="".concat(t,"-")).call(r,e)].dc_recv_total++}},{key:"_sendUserFail",value:function(e,t,r){var n,i=this.userMessage[Im(n="".concat(t,"-")).call(n,e)];i&&(i.dc_send_fail++,this._handleUserFail(i,r))}},{key:"_handleUserFail",value:function(e,t){t&&(t.code||t.err)&&(t.code===aA.TIME_OUT||t.code===aA.USER_MESSAGE_TIMEOUT?e.dc_fail_timeout++:t.err===PN.NO_RECEIVER?e.dc_fail_no_receiver++:t.err===PN.NO_RELAYPATH?e.dc_fail_no_relay_path++:t.err===PN.TIMEOUT&&e.dc_fail_timeout++)}},{key:"_sendUserAck",value:function(e,t,r,n,i){var o,a=this.userMessage[Im(o="".concat(t,"-")).call(o,e)];a&&(a.dc_send_ack++,a.dc_cost_time+=r,a.dc_cost_s2s+=n||0,a.dc_cost_peer_s2e+=i,a.dc_cost_e2s+=r-(n||0)-i,r<=100?(a.dc_send_ack_100++,a.dc_send_ack_200++,a.dc_send_ack_400++,a.dc_send_ack_1s++):r<=200?(a.dc_send_ack_200++,a.dc_send_ack_400++,a.dc_send_ack_1s++):r<=400?(a.dc_send_ack_400++,a.dc_send_ack_1s++):r<=1e3&&a.dc_send_ack_1s++,r<a.dc_least_time&&(a.dc_least_time=r),r>a.dc_most_time&&(a.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,Hx.P2P,t)}},{key:"recvP2PMessage",value:function(e){this._recvUserMessage(e,Hx.P2P)}},{key:"sendP2PFail",value:function(e,t){this._sendUserFail(e,Hx.P2P,t)}},{key:"sendP2PAck",value:function(e,t,r,n){this._sendUserAck(e,Hx.P2P,t,r,n)}},{key:"sendP2POutRoomMessage",value:function(e,t){this._sendUserMessage(e,Hx.P2P_OUTSIDE_ROOM,t)}},{key:"recvP2POutRoomMessage",value:function(e){this._recvUserMessage(e,Hx.P2P_OUTSIDE_ROOM)}},{key:"sendP2POutRoomFail",value:function(e,t){this._sendUserFail(e,Hx.P2P_OUTSIDE_ROOM,t)}},{key:"sendP2POutRoomAck",value:function(e,t,r,n){this._sendUserAck(e,Hx.P2P_OUTSIDE_ROOM,t,r,n)}},{key:"sendP2serverMessage",value:function(e){this._sendUserMessage("",Hx.P2SERVER,e)}},{key:"sendP2serverFail",value:function(e){this._sendUserFail("",Hx.P2SERVER,e)}},{key:"sendP2serveAck",value:function(e,t,r){this._sendUserAck("",Hx.P2SERVER,e,t,r)}},{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?(n=n||{},this.sendP2serveAck(Date.now()-r,n.s2s_time||0,n.s2e_time||0)):this.sendP2serverFail(n)}},{key:"destroy",value:function(){this._reset(),clearTimeout(this._timer)}}]),e}(),mG="object"==typeof global&&global&&global.Object===Object&&global,gG="object"==typeof self&&self&&self.Object===Object&&self,yG=mG||gG||Function("return this")(),SG=yG.Symbol,EG=Object.prototype,bG=EG.hasOwnProperty,kG=EG.toString,TG=SG?SG.toStringTag:void 0;var IG=Object.prototype.toString;var RG=SG?SG.toStringTag:void 0;function AG(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":RG&&RG in Object(e)?function(e){var t=bG.call(e,TG),r=e[TG];try{e[TG]=void 0;var n=!0}catch(o){}var i=kG.call(e);return n&&(t?e[TG]=r:delete e[TG]),i}(e):function(e){return IG.call(e)}(e)}function wG(e){return null!=e&&"object"==typeof e}var CG=Array.isArray;function OG(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function DG(e){return e}function xG(e){if(!OG(e))return!1;var t=AG(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}var NG,PG=yG["__core-js_shared__"],MG=(NG=/[^.]+$/.exec(PG&&PG.keys&&PG.keys.IE_PROTO||""))?"Symbol(src)_1."+NG:"";var LG=Function.prototype.toString;var UG=/^\[object .+?Constructor\]$/,VG=Function.prototype,FG=Object.prototype,BG=VG.toString,jG=FG.hasOwnProperty,GG=RegExp("^"+BG.call(jG).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function HG(e){return!(!OG(e)||(t=e,MG&&MG in t))&&(xG(e)?GG:UG).test(function(e){if(null!=e){try{return LG.call(e)}catch(t){}try{return e+""}catch(t){}}return""}(e));var t}function zG(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 KG=Date.now;var XG,qG,WG,YG=function(){try{var e=HG(t=function(e,t){return null==e?void 0:e[t]}(Object,"defineProperty"))?t:void 0;return e({},"",{}),e}catch(r){}var t}(),QG=YG,JG=QG?function(e,t){return QG(e,"toString",{configurable:!0,enumerable:!1,value:(r=t,function(){return r}),writable:!0});var r}:DG,ZG=(XG=JG,qG=0,WG=0,function(){var e=KG(),t=16-(e-WG);if(WG=e,t>0){if(++qG>=800)return arguments[0]}else qG=0;return XG.apply(void 0,arguments)}),$G=ZG,eH=/^(?:0|[1-9]\d*)$/;function tH(e,t){var r=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==r||"symbol"!=r&&eH.test(e))&&e>-1&&e%1==0&&e<t}function rH(e,t,r){"__proto__"==t&&QG?QG(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function nH(e,t){return e===t||e!=e&&t!=t}var iH=Object.prototype.hasOwnProperty;function oH(e,t,r){var n=e[t];iH.call(e,t)&&nH(n,r)&&(void 0!==r||t in e)||rH(e,t,r)}var aH=Math.max;function sH(e,t){return $G(function(e,t,r){return t=aH(void 0===t?e.length-1:t,0),function(){for(var n=arguments,i=-1,o=aH(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),zG(e,this,s)}}(e,t,DG),e+"")}function cH(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function uH(e){return null!=e&&cH(e.length)&&!xG(e)}var dH=Object.prototype;function lH(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||dH)}function hH(e){return wG(e)&&"[object Arguments]"==AG(e)}var fH=Object.prototype,pH=fH.hasOwnProperty,vH=fH.propertyIsEnumerable,_H=hH(function(){return arguments}())?hH:function(e){return wG(e)&&pH.call(e,"callee")&&!vH.call(e,"callee")},mH=_H;var gH="object"==typeof exports&&exports&&!exports.nodeType&&exports,yH=gH&&"object"==typeof module&&module&&!module.nodeType&&module,SH=yH&&yH.exports===gH?yG.Buffer:void 0,EH=(SH?SH.isBuffer:void 0)||function(){return!1},bH={};bH["[object Float32Array]"]=bH["[object Float64Array]"]=bH["[object Int8Array]"]=bH["[object Int16Array]"]=bH["[object Int32Array]"]=bH["[object Uint8Array]"]=bH["[object Uint8ClampedArray]"]=bH["[object Uint16Array]"]=bH["[object Uint32Array]"]=!0,bH["[object Arguments]"]=bH["[object Array]"]=bH["[object ArrayBuffer]"]=bH["[object Boolean]"]=bH["[object DataView]"]=bH["[object Date]"]=bH["[object Error]"]=bH["[object Function]"]=bH["[object Map]"]=bH["[object Number]"]=bH["[object Object]"]=bH["[object RegExp]"]=bH["[object Set]"]=bH["[object String]"]=bH["[object WeakMap]"]=!1;var kH="object"==typeof exports&&exports&&!exports.nodeType&&exports,TH=kH&&"object"==typeof module&&module&&!module.nodeType&&module,IH=TH&&TH.exports===kH&&mG.process,RH=function(){try{var e=TH&&TH.require&&TH.require("util").types;return e||IH&&IH.binding&&IH.binding("util")}catch(t){}}(),AH=RH&&RH.isTypedArray,wH=AH?function(e){return function(t){return e(t)}}(AH):function(e){return wG(e)&&cH(e.length)&&!!bH[AG(e)]},CH=wH,OH=Object.prototype.hasOwnProperty;function DH(e,t){var r=CG(e),n=!r&&mH(e),i=!r&&!n&&EH(e),o=!r&&!n&&!i&&CH(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&&!OH.call(e,u)||a&&("length"==u||i&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||tH(u,c))||s.push(u);return s}var xH=function(e,t){return function(r){return e(t(r))}}(Object.keys,Object),NH=xH,PH=Object.prototype.hasOwnProperty;function MH(e){return uH(e)?DH(e):function(e){if(!lH(e))return NH(e);var t=[];for(var r in Object(e))PH.call(e,r)&&"constructor"!=r&&t.push(r);return t}(e)}var LH=Object.prototype.hasOwnProperty;function UH(e){if(!OG(e))return function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t}(e);var t=lH(e),r=[];for(var n in e)("constructor"!=n||!t&&LH.call(e,n))&&r.push(n);return r}var VH,FH=(VH=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?rH(r,s,c):oH(r,s,c)}}(t,function(e){return uH(e)?DH(e,!0):UH(e)}(t),e)},sH((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=VH.length>3&&"function"==typeof i?(n--,i):void 0,o&&function(e,t,r){if(!OG(r))return!1;var n=typeof t;return!!("number"==n?uH(r)&&tH(t,r.length):"string"==n&&t in r)&&nH(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&&VH(e,a,r,i)}return e})));function BH(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 jH(e){return null==e?[]:BH(e,MH(e))}var GH=i,HH=lt("iterator"),zH=!GH((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})),!e.toJSON||!t.sort||"http://a/c%20d?a=1&c=3"!==e.href||"3"!==t.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!t[HH]||"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})),KH=Qt,XH=b,qH=2147483647,WH=/[^\0-\u007E]/,YH=/[.\u3002\uFF0E\uFF61]/g,QH="Overflow: input needs wider integers to process",JH=RangeError,ZH=XH(YH.exec),$H=Math.floor,ez=String.fromCharCode,tz=XH("".charCodeAt),rz=XH([].join),nz=XH([].push),iz=XH("".replace),oz=XH("".split),az=XH("".toLowerCase),sz=function(e){return e+22+75*(e<26)},cz=function(e,t,r){var n=0;for(e=r?$H(e/700):e>>1,e+=$H(e/t);e>455;)e=$H(e/35),n+=36;return $H(n+36*e/(e+38))},uz=function(e){var t=[];e=function(e){for(var t=[],r=0,n=e.length;r<n;){var i=tz(e,r++);if(i>=55296&&i<=56319&&r<n){var o=tz(e,r++);56320==(64512&o)?nz(t,((1023&i)<<10)+(1023&o)+65536):(nz(t,i),r--)}else nz(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&&nz(t,ez(n));var c=t.length,u=c;for(c&&nz(t,"-");u<i;){var d=qH;for(r=0;r<e.length;r++)(n=e[r])>=o&&n<d&&(d=n);var l=u+1;if(d-o>$H((qH-a)/l))throw JH(QH);for(a+=(d-o)*l,o=d,r=0;r<e.length;r++){if((n=e[r])<o&&++a>qH)throw JH(QH);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;nz(t,ez(sz(p+v%_))),h=$H(v/_),f+=36}nz(t,ez(sz(h))),s=cz(a,l,u==c),a=0,u++}}a++,o++}return rz(t,"")},dz=Ar,lz=n,hz=D,fz=b,pz=w,vz=zH,_z=li,mz=iy,gz=Mi,yz=Pc,Sz=Zi,Ez=hf,bz=R,kz=Ye,Tz=Yt,Iz=vn,Rz=tr,Az=$,wz=gn,Cz=Hn,Oz=V,Dz=fh,xz=ah,Nz=kf,Pz=iR,Mz=lt("iterator"),Lz="URLSearchParams",Uz="URLSearchParamsIterator",Vz=Sz.set,Fz=Sz.getterFor(Lz),Bz=Sz.getterFor(Uz),jz=Object.getOwnPropertyDescriptor,Gz=function(e){if(!pz)return lz[e];var t=jz(lz,e);return t&&t.value},Hz=Gz("fetch"),zz=Gz("Request"),Kz=Gz("Headers"),Xz=zz&&zz.prototype,qz=Kz&&Kz.prototype,Wz=lz.RegExp,Yz=lz.TypeError,Qz=lz.decodeURIComponent,Jz=lz.encodeURIComponent,Zz=fz("".charAt),$z=fz([].join),eK=fz([].push),tK=fz("".replace),rK=fz([].shift),nK=fz([].splice),iK=fz("".split),oK=fz("".slice),aK=/\+/g,sK=Array(4),cK=function(e){return sK[e-1]||(sK[e-1]=Wz("((?:%[\\da-f]{2}){"+e+"})","gi"))},uK=function(e){try{return Qz(e)}catch(nW){return e}},dK=function(e){var t=tK(e,aK," "),r=4;try{return Qz(t)}catch(nW){for(;r;)t=tK(t,cK(r--),uK);return t}},lK=/[!'()~]|%20/g,hK={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},fK=function(e){return hK[e]},pK=function(e){return tK(Jz(e),lK,fK)},vK=yz((function(e,t){Vz(this,{type:Uz,iterator:Dz(Fz(e).entries),kind:t})}),"Iterator",(function(){var e=Bz(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),_K=function(e){this.entries=[],this.url=null,void 0!==e&&(Az(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===Zz(e,0)?oK(e,1):e:wz(e)))};_K.prototype={type:Lz,bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t,r,n,i,o,a,s,c=xz(e);if(c)for(r=(t=Dz(e,c)).next;!(n=hz(r,t)).done;){if(o=(i=Dz(Rz(n.value))).next,(a=hz(o,i)).done||(s=hz(o,i)).done||!hz(o,i).done)throw Yz("Expected sequence with length 2");eK(this.entries,{key:wz(a.value),value:wz(s.value)})}else for(var u in e)kz(e,u)&&eK(this.entries,{key:u,value:wz(e[u])})},parseQuery:function(e){if(e)for(var t,r,n=iK(e,"&"),i=0;i<n.length;)(t=n[i++]).length&&(r=iK(t,"="),eK(this.entries,{key:dK(rK(r)),value:dK($z(r,"="))}))},serialize:function(){for(var e,t=this.entries,r=[],n=0;n<t.length;)e=t[n++],eK(r,pK(e.key)+"="+pK(e.value));return $z(r,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var mK=function(){Ez(this,gK);var e=arguments.length>0?arguments[0]:void 0;Vz(this,new _K(e))},gK=mK.prototype;if(mz(gK,{append:function(e,t){Nz(arguments.length,2);var r=Fz(this);eK(r.entries,{key:wz(e),value:wz(t)}),r.updateURL()},delete:function(e){Nz(arguments.length,1);for(var t=Fz(this),r=t.entries,n=wz(e),i=0;i<r.length;)r[i].key===n?nK(r,i,1):i++;t.updateURL()},get:function(e){Nz(arguments.length,1);for(var t=Fz(this).entries,r=wz(e),n=0;n<t.length;n++)if(t[n].key===r)return t[n].value;return null},getAll:function(e){Nz(arguments.length,1);for(var t=Fz(this).entries,r=wz(e),n=[],i=0;i<t.length;i++)t[i].key===r&&eK(n,t[i].value);return n},has:function(e){Nz(arguments.length,1);for(var t=Fz(this).entries,r=wz(e),n=0;n<t.length;)if(t[n++].key===r)return!0;return!1},set:function(e,t){Nz(arguments.length,1);for(var r,n=Fz(this),i=n.entries,o=!1,a=wz(e),s=wz(t),c=0;c<i.length;c++)(r=i[c]).key===a&&(o?nK(i,c--,1):(o=!0,r.value=s));o||eK(i,{key:a,value:s}),n.updateURL()},sort:function(){var e=Fz(this);Pz(e.entries,(function(e,t){return e.key>t.key?1:-1})),e.updateURL()},forEach:function(e){for(var t,r=Fz(this).entries,n=Tz(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 vK(this,"keys")},values:function(){return new vK(this,"values")},entries:function(){return new vK(this,"entries")}},{enumerable:!0}),_z(gK,Mz,gK.entries,{name:"entries"}),_z(gK,"toString",(function(){return Fz(this).serialize()}),{enumerable:!0}),gz(mK,Lz),dz({global:!0,constructor:!0,forced:!vz},{URLSearchParams:mK}),!vz&&bz(Kz)){var yK=fz(qz.has),SK=fz(qz.set),EK=function(e){if(Az(e)){var t,r=e.body;if(Iz(r)===Lz)return t=e.headers?new Kz(e.headers):new Kz,yK(t,"content-type")||SK(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),Cz(e,{body:Oz(0,wz(r)),headers:Oz(0,t)})}return e};if(bz(Hz)&&dz({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(e){return Hz(e,arguments.length>1?EK(arguments[1]):{})}}),bz(zz)){var bK=function(e){return Ez(this,Xz),new zz(e,arguments.length>1?EK(arguments[1]):{})};Xz.constructor=bK,bK.prototype=Xz,dz({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:bK})}}var kK,TK=Ar,IK=w,RK=zH,AK=n,wK=Yt,CK=b,OK=li,DK=function(e,t,r){return KH.f(e,t,r)},xK=hf,NK=Ye,PK=PE,MK=jk,LK=ni,UK=bl.codeAt,VK=function(e){var t,r,n=[],i=oz(iz(az(e),YH,"."),".");for(t=0;t<i.length;t++)r=i[t],nz(n,ZH(WH,r)?"xn--"+uz(r):r);return rz(n,".")},FK=gn,BK=Mi,jK=kf,GK={URLSearchParams:mK,getState:Fz},HK=Zi,zK=HK.set,KK=HK.getterFor("URL"),XK=GK.URLSearchParams,qK=GK.getState,WK=AK.URL,YK=AK.TypeError,QK=AK.parseInt,JK=Math.floor,ZK=Math.pow,$K=CK("".charAt),eX=CK(/./.exec),tX=CK([].join),rX=CK(1..toString),nX=CK([].pop),iX=CK([].push),oX=CK("".replace),aX=CK([].shift),sX=CK("".split),cX=CK("".slice),uX=CK("".toLowerCase),dX=CK([].unshift),lX="Invalid scheme",hX="Invalid host",fX="Invalid port",pX=/[a-z]/i,vX=/[\d+-.a-z]/i,_X=/\d/,mX=/^0x/i,gX=/^[0-7]+$/,yX=/^\d+$/,SX=/^[\da-f]+$/i,EX=/[\0\t\n\r #%/:<>?@[\\\]^|]/,bX=/[\0\t\n\r #/:<>?@[\\\]^|]/,kX=/^[\u0000-\u0020]+|[\u0000-\u0020]+$/g,TX=/[\t\n\r]/g,IX=function(e){var t,r,n,i;if("number"==typeof e){for(t=[],r=0;r<4;r++)dX(t,e%256),e=JK(e/256);return tX(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+=rX(e[r],16),r<7&&(t+=":")));return"["+t+"]"}return e},RX={},AX=PK({},RX,{" ":1,'"':1,"<":1,">":1,"`":1}),wX=PK({},AX,{"#":1,"?":1,"{":1,"}":1}),CX=PK({},wX,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),OX=function(e,t){var r=UK(e,0);return r>32&&r<127&&!NK(t,e)?e:encodeURIComponent(e)},DX={ftp:21,file:null,http:80,https:443,ws:80,wss:443},xX=function(e,t){var r;return 2==e.length&&eX(pX,$K(e,0))&&(":"==(r=$K(e,1))||!t&&"|"==r)},NX=function(e){var t;return e.length>1&&xX(cX(e,0,2))&&(2==e.length||"/"===(t=$K(e,2))||"\\"===t||"?"===t||"#"===t)},PX=function(e){return"."===e||"%2e"===uX(e)},MX={},LX={},UX={},VX={},FX={},BX={},jX={},GX={},HX={},zX={},KX={},XX={},qX={},WX={},YX={},QX={},JX={},ZX={},$X={},eq={},tq={},rq=function(e,t,r){var n,i,o,a=FK(e);if(t){if(i=this.parse(a))throw YK(i);this.searchParams=null}else{if(void 0!==r&&(n=new rq(r,!0)),i=this.parse(a,null,n))throw YK(i);(o=qK(new XK)).bindURL(this),this.searchParams=o}};rq.prototype={type:"URL",parse:function(e,t,r){var n,i,o,a,s,c=this,u=t||MX,d=0,l="",h=!1,f=!1,p=!1;for(e=FK(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=oX(e,kX,"")),e=oX(e,TX,""),n=MK(e);d<=n.length;){switch(i=n[d],u){case MX:if(!i||!eX(pX,i)){if(t)return lX;u=UX;continue}l+=uX(i),u=LX;break;case LX:if(i&&(eX(vX,i)||"+"==i||"-"==i||"."==i))l+=uX(i);else{if(":"!=i){if(t)return lX;l="",u=UX,d=0;continue}if(t&&(c.isSpecial()!=NK(DX,l)||"file"==l&&(c.includesCredentials()||null!==c.port)||"file"==c.scheme&&!c.host))return;if(c.scheme=l,t)return void(c.isSpecial()&&DX[c.scheme]==c.port&&(c.port=null));l="","file"==c.scheme?u=WX:c.isSpecial()&&r&&r.scheme==c.scheme?u=VX:c.isSpecial()?u=GX:"/"==n[d+1]?(u=FX,d++):(c.cannotBeABaseURL=!0,iX(c.path,""),u=$X)}break;case UX:if(!r||r.cannotBeABaseURL&&"#"!=i)return lX;if(r.cannotBeABaseURL&&"#"==i){c.scheme=r.scheme,c.path=LK(r.path),c.query=r.query,c.fragment="",c.cannotBeABaseURL=!0,u=tq;break}u="file"==r.scheme?WX:BX;continue;case VX:if("/"!=i||"/"!=n[d+1]){u=BX;continue}u=HX,d++;break;case FX:if("/"==i){u=zX;break}u=ZX;continue;case BX:if(c.scheme=r.scheme,i==kK)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=LK(r.path),c.query=r.query;else if("/"==i||"\\"==i&&c.isSpecial())u=jX;else if("?"==i)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=LK(r.path),c.query="",u=eq;else{if("#"!=i){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=LK(r.path),c.path.length--,u=ZX;continue}c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=LK(r.path),c.query=r.query,c.fragment="",u=tq}break;case jX:if(!c.isSpecial()||"/"!=i&&"\\"!=i){if("/"!=i){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,u=ZX;continue}u=zX}else u=HX;break;case GX:if(u=HX,"/"!=i||"/"!=$K(l,d+1))continue;d++;break;case HX:if("/"!=i&&"\\"!=i){u=zX;continue}break;case zX:if("@"==i){h&&(l="%40"+l),h=!0,o=MK(l);for(var v=0;v<o.length;v++){var _=o[v];if(":"!=_||p){var m=OX(_,CX);p?c.password+=m:c.username+=m}else p=!0}l=""}else if(i==kK||"/"==i||"?"==i||"#"==i||"\\"==i&&c.isSpecial()){if(h&&""==l)return"Invalid authority";d-=MK(l).length+1,l="",u=KX}else l+=i;break;case KX:case XX:if(t&&"file"==c.scheme){u=QX;continue}if(":"!=i||f){if(i==kK||"/"==i||"?"==i||"#"==i||"\\"==i&&c.isSpecial()){if(c.isSpecial()&&""==l)return hX;if(t&&""==l&&(c.includesCredentials()||null!==c.port))return;if(a=c.parseHost(l))return a;if(l="",u=JX,t)return;continue}"["==i?f=!0:"]"==i&&(f=!1),l+=i}else{if(""==l)return hX;if(a=c.parseHost(l))return a;if(l="",u=qX,t==XX)return}break;case qX:if(!eX(_X,i)){if(i==kK||"/"==i||"?"==i||"#"==i||"\\"==i&&c.isSpecial()||t){if(""!=l){var g=QK(l,10);if(g>65535)return fX;c.port=c.isSpecial()&&g===DX[c.scheme]?null:g,l=""}if(t)return;u=JX;continue}return fX}l+=i;break;case WX:if(c.scheme="file","/"==i||"\\"==i)u=YX;else{if(!r||"file"!=r.scheme){u=ZX;continue}if(i==kK)c.host=r.host,c.path=LK(r.path),c.query=r.query;else if("?"==i)c.host=r.host,c.path=LK(r.path),c.query="",u=eq;else{if("#"!=i){NX(tX(LK(n,d),""))||(c.host=r.host,c.path=LK(r.path),c.shortenPath()),u=ZX;continue}c.host=r.host,c.path=LK(r.path),c.query=r.query,c.fragment="",u=tq}}break;case YX:if("/"==i||"\\"==i){u=QX;break}r&&"file"==r.scheme&&!NX(tX(LK(n,d),""))&&(xX(r.path[0],!0)?iX(c.path,r.path[0]):c.host=r.host),u=ZX;continue;case QX:if(i==kK||"/"==i||"\\"==i||"?"==i||"#"==i){if(!t&&xX(l))u=ZX;else if(""==l){if(c.host="",t)return;u=JX}else{if(a=c.parseHost(l))return a;if("localhost"==c.host&&(c.host=""),t)return;l="",u=JX}continue}l+=i;break;case JX:if(c.isSpecial()){if(u=ZX,"/"!=i&&"\\"!=i)continue}else if(t||"?"!=i)if(t||"#"!=i){if(i!=kK&&(u=ZX,"/"!=i))continue}else c.fragment="",u=tq;else c.query="",u=eq;break;case ZX:if(i==kK||"/"==i||"\\"==i&&c.isSpecial()||!t&&("?"==i||"#"==i)){if(".."===(s=uX(s=l))||"%2e."===s||".%2e"===s||"%2e%2e"===s?(c.shortenPath(),"/"==i||"\\"==i&&c.isSpecial()||iX(c.path,"")):PX(l)?"/"==i||"\\"==i&&c.isSpecial()||iX(c.path,""):("file"==c.scheme&&!c.path.length&&xX(l)&&(c.host&&(c.host=""),l=$K(l,0)+":"),iX(c.path,l)),l="","file"==c.scheme&&(i==kK||"?"==i||"#"==i))for(;c.path.length>1&&""===c.path[0];)aX(c.path);"?"==i?(c.query="",u=eq):"#"==i&&(c.fragment="",u=tq)}else l+=OX(i,wX);break;case $X:"?"==i?(c.query="",u=eq):"#"==i?(c.fragment="",u=tq):i!=kK&&(c.path[0]+=OX(i,RX));break;case eq:t||"#"!=i?i!=kK&&("'"==i&&c.isSpecial()?c.query+="%27":c.query+="#"==i?"%23":OX(i,RX)):(c.fragment="",u=tq);break;case tq:i!=kK&&(c.fragment+=OX(i,AX))}d++}},parseHost:function(e){var t,r,n;if("["==$K(e,0)){if("]"!=$K(e,e.length-1))return hX;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 $K(e,l)};if(":"==h()){if(":"!=$K(e,1))return;l+=2,d=++u}for(;h();){if(8==u)return;if(":"!=h()){for(t=r=0;r<4&&eX(SX,h());)t=16*t+QK(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(!eX(_X,h()))return;for(;eX(_X,h());){if(o=QK(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}(cX(e,1,-1)),!t)return hX;this.host=t}else if(this.isSpecial()){if(e=VK(e),eX(EX,e))return hX;if(t=function(e){var t,r,n,i,o,a,s,c=sX(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"==$K(i,0)&&(o=eX(mX,i)?16:8,i=cX(i,8==o?1:2)),""===i)a=0;else{if(!eX(10==o?yX:8==o?gX:SX,i))return e;a=QK(i,o)}iX(r,a)}for(n=0;n<t;n++)if(a=r[n],n==t-1){if(a>=ZK(256,5-t))return null}else if(a>255)return null;for(s=nX(r),n=0;n<r.length;n++)s+=r[n]*ZK(256,3-n);return s}(e),null===t)return hX;this.host=t}else{if(eX(bX,e))return hX;for(t="",r=MK(e),n=0;n<r.length;n++)t+=OX(r[n],RX);this.host=t}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||"file"==this.scheme},includesCredentials:function(){return""!=this.username||""!=this.password},isSpecial:function(){return NK(DX,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;!t||"file"==this.scheme&&1==t&&xX(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+=IX(i),null!==o&&(u+=":"+o)):"file"==t&&(u+="//"),u+=e.cannotBeABaseURL?a[0]:a.length?"/"+tX(a,"/"):"",null!==s&&(u+="?"+s),null!==c&&(u+="#"+c),u},setHref:function(e){var t=this.parse(e);if(t)throw YK(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if("blob"==e)try{return new nq(e.path[0]).origin}catch(nW){return"null"}return"file"!=e&&this.isSpecial()?e+"://"+IX(this.host)+(null!==t?":"+t:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse(FK(e)+":",MX)},getUsername:function(){return this.username},setUsername:function(e){var t=MK(FK(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var r=0;r<t.length;r++)this.username+=OX(t[r],CX)}},getPassword:function(){return this.password},setPassword:function(e){var t=MK(FK(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var r=0;r<t.length;r++)this.password+=OX(t[r],CX)}},getHost:function(){var e=this.host,t=this.port;return null===e?"":null===t?IX(e):IX(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,KX)},getHostname:function(){var e=this.host;return null===e?"":IX(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,XX)},getPort:function(){var e=this.port;return null===e?"":FK(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""==(e=FK(e))?this.port=null:this.parse(e,qX))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+tX(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,JX))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){""==(e=FK(e))?this.query=null:("?"==$K(e,0)&&(e=cX(e,1)),this.query="",this.parse(e,eq)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){""!=(e=FK(e))?("#"==$K(e,0)&&(e=cX(e,1)),this.fragment="",this.parse(e,tq)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var nq=function(e){var t=xK(this,iq),r=jK(arguments.length,1)>1?arguments[1]:void 0,n=zK(t,new rq(e,!1,r));IK||(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())},iq=nq.prototype,oq=function(e,t){return{get:function(){return KK(this)[e]()},set:t&&function(e){return KK(this)[t](e)},configurable:!0,enumerable:!0}};if(IK&&(DK(iq,"href",oq("serialize","setHref")),DK(iq,"origin",oq("getOrigin")),DK(iq,"protocol",oq("getProtocol","setProtocol")),DK(iq,"username",oq("getUsername","setUsername")),DK(iq,"password",oq("getPassword","setPassword")),DK(iq,"host",oq("getHost","setHost")),DK(iq,"hostname",oq("getHostname","setHostname")),DK(iq,"port",oq("getPort","setPort")),DK(iq,"pathname",oq("getPathname","setPathname")),DK(iq,"search",oq("getSearch","setSearch")),DK(iq,"searchParams",oq("getSearchParams")),DK(iq,"hash",oq("getHash","setHash"))),OK(iq,"toJSON",(function(){return KK(this).serialize()}),{enumerable:!0}),OK(iq,"toString",(function(){return KK(this).serialize()}),{enumerable:!0}),WK){var aq=WK.createObjectURL,sq=WK.revokeObjectURL;aq&&OK(nq,"createObjectURL",wK(aq,WK)),sq&&OK(nq,"revokeObjectURL",wK(sq,WK))}BK(nq,"URL"),TK({global:!0,constructor:!0,forced:!RK,sham:!IK},{URL:nq});var cq=ee.URL,uq=function(){var e=Sm(gm().mark((function e(t,r){var n;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new Audio(cq.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)}}(),dq=id,lq=tc,hq=function(e,t,r,n){for(var i,o=n>1?void 0:n?lq(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&&dq(t,r,o),o},fq=function(){function e(t){Kd(this,e),od(this,"_sharedAudioContext",new AudioContext),od(this,"_audioDestination",this._sharedAudioContext.createMediaStreamDestination()),od(this,"_localGainNode",this._sharedAudioContext.createGain()),od(this,"_bufferGainNode",this._sharedAudioContext.createGain()),od(this,"_audioBufferSource",void 0),od(this,"_localSource",void 0),od(this,"_context",void 0),od(this,"_failedAudioList",[]),od(this,"_startingIds",new aE),od(this,"_revokeURLs",new jM),od(this,"mixingMap",new aE),od(this,"resourcesCache",new aE),od(this,"volumeConfig",new aE),od(this,"cachedBuffer",[]),od(this,"id","AudioMixingManager"),this._context=t,this._localGainNode.gain.value=1}var t,r,n;return zd(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=Sm(gm().mark((function e(t,r,n){var i,o,a,s,c,u,d,l,h,f,p,v,_,m=this;return gm().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,Bw(o=n.type,"mixingType",jH(Fd)),a=this._context.getLocalAudioTrack()){e.next=10;break}return e.abrupt("return");case 10:if((s=a.getTrack("preprocessing"))&&this.mixMediaStream(new MediaStream([s])),null!=(c=this.mixingMap.get(t))&&c.audioNode){c.audioNode.pause(),this._context.emitMessage({mixId:t,state:Bd.AUDIO_MIXING_STATE_STOPPED,error:sA.AUDIO_MIXING_ERROR_OK});try{c.gainNode.disconnect(this._audioDestination),c.audioSource.disconnect(c.gainNode)}catch(g){}}if(!(d=this.resourcesCache.get(t))||d.filePath!==r){e.next=19;break}u=d.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 m._context.emitMessage({mixId:t,state:Bd.AUDIO_MIXING_STATE_FAILED,error:sA.AUDIO_MIXING_ERROR_START_FAILED}),new cA(aA.LOAD_RESOURCES_FAILED,e.statusText)}));case 21:return l=e.sent,JE(r).call(r,"mp3")?h={type:"audio/mpeg"}:JE(r).call(r,"aac")&&(h={type:"audio/aac"}),e.next=25,uq(l,h);case 25:if(e.sent){e.next=29;break}throw this._context.emitMessage({mixId:t,state:Bd.AUDIO_MIXING_STATE_FAILED,error:sA.AUDIO_MIXING_ERROR_START_FAILED}),new cA(aA.LOAD_RESOURCES_FAILED,"invalid audio resource");case 29:(u=new Audio).crossOrigin="anonymous",u.src=cq.createObjectURL(new Blob([l],h));case 32:return i<=0?u.loop=!0:i>0&&(f=i,u.onended=function(){--f>0?u.play():(m.mixingMap.delete(t),m._context.emitMessage({mixId:t,state:Bd.AUDIO_MIXING_STATE_FINISHED,error:sA.AUDIO_MIXING_ERROR_OK}))}),e.prev=33,e.next=36,u.play();case 36:e.next=43;break;case 38:e.prev=38,e.t0=e.catch(33),console.error(e.t0),this._failedAudioList.push(u),this._context.onAutoPlayFailed({userId:this.id,kind:"audio",streamIndex:md.STREAM_INDEX_MAIN,mediaType:gd.AUDIO});case 43:if(this._startingIds.delete(t),p=this._sharedAudioContext.createMediaElementSource(u),v=this._sharedAudioContext.createGain(),_=this.volumeConfig.get(t),v.gain.value=_?_/100:1,p.connect(v).connect(this._audioDestination),this.mixingMap.set(t,{audioSource:p,audioNode:u,gainNode:v,type:"file"}),o===Fd.PUBLISH)try{v.disconnect(this._sharedAudioContext.destination)}catch(g){}else v.connect(this._sharedAudioContext.destination);this._context.updateLocalAudioTrack(this._audioDestination.stream.getAudioTracks()[0],n.type),this._context.emitMessage({mixId:t,state:Bd.AUDIO_MIXING_STATE_PLAYING,error:sA.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:Bd.AUDIO_MIXING_STATE_STOPPED,error:sA.AUDIO_MIXING_ERROR_OK}))}},{key:"pauseAudioMixing",value:function(e){var t=this.mixingMap.get(e);t&&(this._context.emitMessage({mixId:e,state:Bd.AUDIO_MIXING_STATE_PAUSED,error:sA.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:Bd.AUDIO_MIXING_STATE_PLAYING,error:sA.AUDIO_MIXING_ERROR_OK}),t.audioNode.play())}},{key:"preloadAudioMixing",value:(r=Sm(gm().mark((function e(t,r){var n,i,o=this;return gm().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 cA(aA.LOAD_RESOURCES_FAILED,e.statusText)})).catch((function(e){if(o._context.emitMessage({mixId:t,state:Bd.AUDIO_MIXING_STATE_FAILED,error:sA.AUDIO_MIXING_ERROR_PRELOAD_FAILED}),e instanceof cA)throw e;throw new cA(aA.LOAD_RESOURCES_FAILED,"Load resources failed",e)}));case 3:return n=e.sent,JE(r).call(r,"mp3")?i={type:"audio/mpeg"}:JE(r).call(r,"aac")&&(i={type:"audio/aac"}),e.next=7,uq(n,i);case 7:if(e.sent){e.next=11;break}throw this._context.emitMessage({mixId:t,state:Bd.AUDIO_MIXING_STATE_FAILED,error:sA.AUDIO_MIXING_ERROR_PRELOAD_FAILED}),new cA(aA.LOAD_RESOURCES_FAILED,"Load resources failed");case 11:return this._context.emitMessage({mixId:t,state:Bd.AUDIO_MIXING_STATE_PRELOADED,error:sA.AUDIO_MIXING_ERROR_OK}),this.resourcesCache.set(t,{getAudioNode:function(){var e=cq.createObjectURL(new Blob([n],i));return o._revokeURLs.add(e),new Audio(e)},filePath:r,duration:0}),e.next=15,new H_((function(e){var r=cq.createObjectURL(new Blob([n],i)),a=new Audio(r);a.addEventListener("durationchange",(function(){var n=o.resourcesCache.get(t);n&&(n.duration=a.duration,o.resourcesCache.set(t,n)),cq.revokeObjectURL(r),e(null)}))}));case 15: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.resourcesCache.get(e);return t||r?t?1e3*t.audioNode.duration:r?1e3*r.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){Bw(e,"type",jH(Fd));var t=this._context.getLocalAudioTrack();if(t){var r=t.getTrack("preprocessing");if(r&&this.mixMediaStream(new MediaStream([r])),e===Fd.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:Bd.AUDIO_MIXING_STATE_PCM_ENABLED,error:sA.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:Bd.AUDIO_MIXING_STATE_PCM_DISABLED,error:sA.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=Sm(gm().mark((function e(){var t,r,n,i;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=[],r=qT(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:md.STREAM_INDEX_MAIN,mediaType:gd.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 aE,this._revokeURLs.forEach((function(e){cq.revokeObjectURL(e)}))}}]),e}();hq([rN("default","id","filePath","options")],fq.prototype,"startAudioMixing",1),hq([rN("default","id")],fq.prototype,"stopAudioMixing",1),hq([rN("default","id")],fq.prototype,"pauseAudioMixing",1),hq([rN("default","id")],fq.prototype,"resumeAudioMixing",1),hq([rN("default","id")],fq.prototype,"preloadAudioMixing",1),hq([rN("default","id")],fq.prototype,"unloadAudioMixing",1),hq([rN("default","id")],fq.prototype,"getAudioMixingVolume",1),hq([rN("default","id","volume")],fq.prototype,"setAudioMixingVolume",1),hq([rN("default","id")],fq.prototype,"getAudioMixingDuration",1),hq([rN("default","id")],fq.prototype,"getAudioMixingCurrentPosition",1),hq([rN("default","id","position")],fq.prototype,"setAudioMixingPosition",1),hq([rN("default","type")],fq.prototype,"enableAudioMixingBuffer",1),hq([rN()],fq.prototype,"disableAudioMixingBuffer",1),hq([rN("default","buffer")],fq.prototype,"pushAudioMixingBuffer",1);var pq=function(e){return e.NORMAL_USER="normalUser",e.SILENT_USER="silentUser",e}(pq||{}),vq=new bC("RTMClient",1),_q=function(e){AI(u,e);var t,r,n,i,o,a,s,c=zI(u);function u(e,t){var r;return Kd(this,u),od(YT(r=c.call(this)),"_dataChannelSignal",null),od(YT(r),"_handler",null),od(YT(r),"_dataChannelSignalState",JV.DISCONNECTED),od(YT(r),"_loginSessionId",null),od(YT(r),"_userId",null),od(YT(r),"_token",null),od(YT(r),"_isReconnecting",!1),od(YT(r),"_reconnectTimer",null),od(YT(r),"_loginResolveCallback",null),od(YT(r),"_loginRejectCallback",null),od(YT(r),"_iceConfigNode",null),od(YT(r),"_wait_login_token",!1),od(YT(r),"_serverParamsCache",void 0),r.id=e,r._appId=t,r}return zd(u,[{key:"login",value:function(e,t){var r=this;return new H_((function(n,i){if(vq.print("login","invoke login, token: %o, userId: %o",e,t),r._loginSessionId)throw new cA(aA.ALREADY_LOGIN,"Already logined");if(r._loginResolveCallback)throw new cA(aA.LOGIN_FAILED,"Is logging in, please try again later.");r._userId=t,r._token=e,Zx.setStats({rtc_app_id:r._appId,rtm_user_id:t}),r._loginResolveCallback=n,r._loginRejectCallback=i,r._dataChannelSignal?r._login():(vq.print("login","init dataChannelSingling"),r._dataChannelSignalState=JV.CONNECTING,r._createDataChannelSignaling(t).then((function(e){r._dataChannelSignal=e,r._login()})).catch((function(){r._onDisconnect()})))}))}},{key:"logout",value:(s=Sm(gm().mark((function e(){var t;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._loginSessionId&&this._userId){e.next=2;break}throw new cA(aA.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:tP.C2RTM}).catch((function(){}));case 4:this._closeDataChannelSignaling(),this._clearState();case 6:case"end":return e.stop()}}),e,this)}))),function(){return s.apply(this,arguments)})},{key:"updateLoginToken",value:(a=Sm(gm().mark((function e(t){var r=this;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._token=t,e.abrupt("return",new H_((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 a.apply(this,arguments)})},{key:"getPeerOnlineStatus",value:(o=Sm(gm().mark((function e(t){var r;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._loginSessionId&&this._userId){e.next=2;break}throw new cA(aA.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:tP.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 o.apply(this,arguments)})},{key:"sendUserMessageOutsideRoom",value:(i=Sm(gm().mark((function e(t,r){return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._loginSessionId&&this._userId){e.next=2;break}throw new cA(aA.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=Sm(gm().mark((function e(t,r){return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,Fw(t,"signature"),Fw(r,"url"),this._loginSessionId&&this._userId){e.next=5;break}throw new cA(aA.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:tP.C2RTM}).catch((function(e){throw new cA(aA.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=Sm(gm().mark((function e(t){return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._loginSessionId&&this._userId){e.next=2;break}throw new cA(aA.NOT_LOGIN,"login first");case 2:return this._checkDataChannelSignal(),e.abrupt("return",this._dataChannelSignal.sendP2PMessage({from:this._userId,app:this._appId,to:"",room:"",type:NN.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(),II(kI(u.prototype),"removeAllListeners",this).call(this),delete this._serverParamsCache}},{key:"_login",value:function(){var e=this;if(this._userId){var t=nw();this._checkDataChannelSignal(),this._dataChannelSignal.sendSignaling("login",{Token:sw.token2auth(this._appId,null,this._userId,this._token),timestamp:Date.now(),loginSessionId:t,params:{deviceType:"web",userAgent:window.navigator.userAgent,sdkVersion:mN.VERSION,deviceId:hN.getDeviceId(),appId:this._appId,userId:this._userId}},{functionType:tP.C2RTM}).then((function(){"function"==typeof e._loginResolveCallback&&e._loginResolveCallback(),e._loginSessionId=t,HN(e.id,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=aA.INVALID_PARAMS,n="Invalid userId"):(r=aA.INVALID_TOKEN,n="Invalid token",e._wait_login_token=!0,e._loginRejectCallback||e.emit("onRTMTokenError")):(r=aA.LOGIN_FAILED,n="login failed"),"function"==typeof e._loginRejectCallback&&e._loginRejectCallback(new cA(r,a||n))})).finally((function(){e._loginResolveCallback=null,e._loginRejectCallback=null}))}}},{key:"_createDataChannelSignaling",value:(t=Sm(gm().mark((function e(t){var r,n,i,o,a,s,c,u=this;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=new oP,i=this._iceConfigNode){e.next=16;break}return e.prev=3,e.next=6,null==n?void 0:n.getAccessNode(this._appId,"",t,hN.getDeviceId(),"");case 6:if(o=e.sent,i=o[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),iN("rtm.login.getNodeFailed","",0,!0),new cA(aA.ICE_SERVER_WRONG,"get ICE config failed");case 16:return iN("rtm.login.getNodeSuccess",i,0,!0),vq.print("_createDataChannelSignaling()","get node success",i),this._handler=UV(Yx),null===(r=this._handler)||void 0===r||r.once("disconnect",(function(){vq.print("_createDataChannelSignaling()","recv BasicHandler event: disconnect"),u._onDisconnect()})),e.prev=20,e.next=23,null===(s=this._handler)||void 0===s?void 0:s.connect(i);case 23:a=e.sent,vq.print("_createDataChannelSignaling()","establish peerConnection success"),this._dataChannelSignalState=JV.CONNECTED,e.next=33;break;case 28:throw e.prev=28,e.t1=e.catch(20),this._iceConfigNode=null,this._dataChannelSignalState=JV.DISCONNECTED,new cA(aA.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed",e.t1);case 33:return c=new rP(this.id,a),vq.print("_createDataChannelSignaling()","send ping"),c.sendPingSignaling(),c.once("close",(function(){vq.print("_createDataChannelSignaling()","recv DataChannelSignaling event: close"),u._onDisconnect()})),c.on(AN.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM,(function(e){u.emit("onUserMessageReceivedOutsideRoom",{userId:e.from,message:e.msg})})),c.on(AN.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM,(function(e){u.emit("onUserBinaryMessageReceivedOutsideRoom",{userId:e.from,message:e.msg})})),c.on(AN.USER_DISCONNECTION,(function(){u.emit("onUserDisconnection"),u._clearState()})),c.on(AN.NODE_CHANGE,(function(e){iN("rtm.nodeChange",hk(e),0,!0),Array.isArray(e.nodes)&&e.nodes.length&&(u._iceConfigNode=e.nodes[0]),u._loginResolveCallback&&u._loginRejectCallback?u._login():u._reconnect()})),e.abrupt("return",c);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!==JV.CONNECTED)throw new cA(aA.NOT_CONNECTED_YET,"datachannel not connect")}},{key:"_onDisconnect",value:function(){this._dataChannelSignalState=JV.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&&(vq.print("_reconnect()","start reconnect..."),this._isReconnecting=!0,this._createDataChannelSignaling(this._userId).then((function(t){vq.print("_reconnect()","reconnect success!"),e._dataChannelSignal=t,e._login(),e._reconnectTimer=null})).catch((function(t){vq.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,HN(this.id,""),null!==this._reconnectTimer&&(self.clearTimeout(this._reconnectTimer),this._reconnectTimer=null)}}]),u}(iC.exports.EventEmitter),mq=function(e){AI(o,e);var t,r,n,i=zI(o);function o(e,t,r){var n,a=r.businessId;return Kd(this,o),od(YT(n=i.call(this)),"_mediaServerClient",void 0),od(YT(n),"_appId",void 0),od(YT(n),"_reconnectTimer",void 0),od(YT(n),"remoteStreams",void 0),od(YT(n),"_businessId",void 0),n.id=e,n._appId=t,n.remoteStreams=new aE,n._businessId=a,n}return zd(o,[{key:"connect",value:(n=Sm(gm().mark((function e(){return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._mediaServerClient=new $V({id:this.id,avSync:!0}),this._businessId&&(this._mediaServerClient.businessId=this._businessId),this._bindEvents(),e.next=5,this._mediaServerClient.connect(this._appId);case 5:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"startPlayPublicStream",value:(r=Sm(gm().mark((function e(t){var r,n=this;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.remoteStreams.get(t)){e.next=2;break}throw new cA(aA.REPEAT_PLAY,"repeat play public media stream");case 2:return(r=new IV(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=Dw(e),i=0;i<t.seiCount;i++)n.emit(jV.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 aE,this._mediaServerClient&&this._mediaServerClient.destroy()}},{key:"_handleReconnected",value:(t=Sm(gm().mark((function e(){var t,r,n,i=this;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:clearTimeout(this._reconnectTimer),t=qT(this.remoteStreams);try{for(n=function(){var e=WT(r.value,1)[0];i.remoteStreams.delete(e),i.startPlayPublicStream(e).then((function(){var t=i.remoteStreams.get(e);i.safeEmit(jV.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(CN.ABNORMAL_DISCONNECTION,this._reconnect.bind(this)),null===(t=this._mediaServerClient)||void 0===t||t.on("onRemoteStreamStats",(function(e){r.emit("onRemoteStreamStats",e)}))}}]),o}(IC),gq=new bC("AudioDeviceManager",1),yq=function(e){AI(c,e);var t,r,n,i,o,a,s=zI(c);function c(e){var t;return Kd(this,c),od(YT(t=s.call(this)),"_audioLevelFetcher",void 0),od(YT(t),"_playbackDeviceTestTimer",void 0),od(YT(t),"_audioElement",void 0),od(YT(t),"_audioTrack",void 0),od(YT(t),"_mediaRecorder",void 0),od(YT(t),"_recoderTimer",void 0),od(YT(t),"_isAudioPlaybackDeviceTesting",!1),od(YT(t),"_isAudioDeviceRecordTesting",!1),od(YT(t),"_audioCaptureAndRecoderResolve",void 0),od(YT(t),"_onAutoplayFailed",void 0),od(YT(t),"_audioPlaybackDeviceId",void 0),t._extensionManager=e,t}return zd(c,[{key:"startAudioPlaybackDeviceTest",value:(a=Sm(gm().mark((function e(t,r){return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._isAudioPlaybackDeviceTesting&&!this._isAudioDeviceRecordTesting){e.next=2;break}throw new cA(aA.REPEAT_DEVICE_TEST,"device test cannot be called repeatedly at the same time.");case 2:return this._isAudioPlaybackDeviceTesting=!0,gq.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),gq.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 a.apply(this,arguments)})},{key:"stopAudioPlaybackDeviceTest",value:function(){this._isAudioPlaybackDeviceTesting&&(gq.print("stopAudioPlaybackDeviceTest()","Invoke"),this._isAudioPlaybackDeviceTesting=!1,this._stopEmitAudioPlaybackDeviceTestVolume(),this._destroyAudioElement())}},{key:"startAudioDeviceRecordTest",value:(o=Sm(gm().mark((function e(t,r){var n=this;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(window.MediaRecorder){e.next=2;break}throw new cA(aA.NOT_SUPPORTED,"Your browser does not support MediaRecorder.");case 2:if(!this._isAudioDeviceRecordTesting){e.next=4;break}throw new cA(aA.REPEAT_DEVICE_TEST,"device test cannot be called repeatedly at the same time.");case 4:return this._isAudioDeviceRecordTesting=!0,gq.print("startAudioDeviceRecordTest()","Invoke"),this._recoderTimer=window.setTimeout((function(){gq.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 o.apply(this,arguments)})},{key:"stopAudioDeviceRecordAndPlayTest",value:function(){gq.print("stopAudioDeviceRecordAndPlayTest()","Invoke"),void 0!==this._recoderTimer&&(clearTimeout(this._recoderTimer),delete this._recoderTimer),this._stopAudioCaptureAndRecoder()}},{key:"stopAudioDevicePlayTest",value:function(){this._isAudioDeviceRecordTesting&&(gq.print("stopAudioDevicePlayTest()","Invoke"),this._isAudioDeviceRecordTesting=!1,this.stopAudioDeviceRecordAndPlayTest(),this._stopEmitAudioPlaybackDeviceTestVolume(),this._destroyAudioElement()),delete this._onAutoplayFailed}},{key:"getRecordTrack",value:function(){return this._audioTrack}},{key:"setSinkId",value:(i=Sm(gm().mark((function e(t){var r;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(gq.print("setSinkId()","Invoke"),void 0!==HTMLAudioElement.prototype.setSinkId){e.next=3;break}throw new cA(aA.NOT_SUPPORTED,"setSinkId not supported by current browser");case 3:return e.next=5,_U.getDeviceById(t);case 5:if(r=e.sent){e.next=8;break}throw new cA(aA.INVALID_DEVICE_ID,"audio playback device id ".concat(t," is invalid"));case 8:return this._audioPlaybackDeviceId=t,this._setAudioCtxSinkId(),e.abrupt("return",r);case 11:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"getSinkId",value:function(){return this._audioPlaybackDeviceId}},{key:"destroy",value:function(){gq.print("destroy()","Invoke"),II(kI(c.prototype),"removeAllListeners",this).call(this),this.stopAudioPlaybackDeviceTest(),this.stopAudioDevicePlayTest()}},{key:"_playAudioFile",value:(n=Sm(gm().mark((function e(t,r){var n,i=this;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return gq.print("_playAudioFile()",Im(n="Invoke url=".concat(t,"; loop=")).call(n,r.loop)),e.abrupt("return",new H_((function(e,n){var o=cG("audio",{attributes:{src:t,crossOrigin:"anonymous"}});i._audioElement=o,o.loop=r.loop,i._audioLevelFetcher=new gU(o),o.onplaying=function(){o.onplaying=null,gq.print("_playAudioFile()","onplaying"),e()},o.onerror=function(){var e=Sm(gm().mark((function e(t){var r,i;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:gq.print("_playAudioFile()","onerror",t),i=t.message||(null==o||null===(r=o.error)||void 0===r?void 0:r.message),n(new cA(aA.LOAD_RESOURCES_FAILED,"Failed to play recorded audio"+(i?", reason: ".concat(i):".")));case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),i._setAudioCtxSinkId().then((function(){var e,t;return null===(e=o.play())||void 0===e||null===(t=e.catch)||void 0===t?void 0:t.call(e,(function(e){var t;gq.print("_playAudioFile()","autoplay error",e);var r=Im(t="Failed to play recorded audio, ".concat(e.name,": ")).call(t,e.message);"NotAllowedError"===e.name&&i._onAutoplayFailed?i._onAutoplayFailed((function(){var e;return H_.all([null===(e=i._audioLevelFetcher)||void 0===e?void 0:e.resume(),o.play()])})):n(new cA(aA.LOAD_RESOURCES_FAILED,r))}))}))})));case 2:case"end":return e.stop()}}),e)}))),function(e,t){return n.apply(this,arguments)})},{key:"_destroyAudioElement",value:function(){this._audioElement&&(gq.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&&(gq.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&&(gq.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:(r=Sm(gm().mark((function e(t){var r,n=this;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,XU({},this._extensionManager);case 2:return this._audioTrack=e.sent,i=this._audioTrack.getTrack("preprocessing"),r=TU.get(i),gq.print("startAudioDeviceRecordTest()","create microphone track success!"),e.abrupt("return",new H_((function(e,i){var o,a;"function"==typeof MediaRecorder.isTypeSupported&&(o=yb(a=["audio/webm","audio/mp4"]).call(a,(function(e){return MediaRecorder.isTypeSupported(e)})),gq.print("startAudioDeviceRecordTest()","use mimeType: ".concat(o))),n._mediaRecorder=new MediaRecorder(r,o?{mimeType:o}:void 0);var s=n._mediaRecorder.mimeType;n._mediaRecorder.ondataavailable=function(){var r=Sm(gm().mark((function r(o){var a,c;return gm().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!n._isAudioDeviceRecordTesting){r.next=16;break}return gq.print("startAudioDeviceRecordTest()","get recorded file(mimeType: ".concat(s,").")),c=new Blob([o.data],{type:s}),r.prev=3,r.next=6,n._playAudioFile(cq.createObjectURL(c),{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===(a=n._audioElement)||void 0===a||a.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 cA(aA.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 r.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}},{key:"_setAudioCtxSinkId",value:(t=Sm(gm().mark((function e(){var t,r,n,i;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=this._audioPlaybackDeviceId){"default"===t&&(t="");try{null===(r=yU.getAudioContextInstance())||void 0===r||null===(n=r.setSinkId)||void 0===n||n.call(r,t),gq.print("setSinkId","ctx.sinkId=".concat(t))}catch(o){gq.print("setSinkId",Im(i="failed, ".concat(o.name," - ")).call(i,o.message))}}case 2:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}]),c}(iC.exports.EventEmitter),Sq=function(){function e(t){Kd(this,e),od(this,"_roomId",void 0),od(this,"_constraints",{}),od(this,"_profile",void 0),this._appId=t}return zd(e,[{key:"setRoomId",value:function(e){this._roomId=e}},{key:"setAudioProfile",value:function(e){this._profile=e}},{key:"getOpusConfigStr",value:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=hN.getEngineWebConfig(this._appId,this._roomId||""),n=r.audio_encode,i=this.getConstraints(),o=i.sampleRate,a=i.channelCount,s="number"==typeof o?o:null==o?void 0:o.exact,c="number"==typeof a?a:null==a?void 0:a.exact,u={};t.split(";").forEach((function(e){var t=WT(e.split("="),2),r=t[0],n=t[1];r&&n&&(u[r]=n)}));var d=(null==n?void 0:n.bitrate)||this._getConfigByAudioProfile().bitrate;d&&(u.maxaveragebitrate=d);var l=(null==n?void 0:n.enc_sample_rate)||s;l&&(u["sprop-maxcapturerate"]=l);var h=(null==n?void 0:n.playback_rate)||s;return h&&(u.maxplaybackrate=h),(c&&c>1||null!=n&&n.stereo)&&(u["sprop-stereo"]=1,u.stereo=1),null!=n&&n.dtx&&(u.usedtx=1),ck(e=an(u)).call(e,(function(e){var t;return Im(t="".concat(e,"=")).call(t,u[e])})).join(";")}},{key:"updateConstraints",value:function(e){this._constraints=sd(sd({},this._constraints),e)}},{key:"getConstraints",value:function(){var e=sd({},this._constraints),t=hN.getEngineWebConfig(this._appId,this._roomId||"").audio_capture;Nw(null==t?void 0:t.sample_rate)||(e.sampleRate=t.sample_rate),Nw(null==t?void 0:t.channel)||(e.channelCount=t.channel),Nw(null==t?void 0:t.agc)||(e.autoGainControl=t.agc),Nw(null==t?void 0:t.ans)||(e.noiseSuppression=t.ans),Nw(null==t?void 0:t.aec)||(e.echoCancellation=t.aec);var r=this._getConfigByAudioProfile(),n=r.sampleRate,i=r.channel;return Nw(e.sampleRate)&&!Nw(n)&&(e.sampleRate=n),Nw(e.channelCount)&&!Nw(i)&&(e.channelCount=i),e}},{key:"_getConfigByAudioProfile",value:function(){var e={};switch(this._profile){case Dd.fluent:e.sampleRate=16e3,e.bitrate=24e3;break;case Dd.standard:e.sampleRate=48e3,e.bitrate=48e3;break;case Dd.hd:e.sampleRate=48e3,e.bitrate=128e3,e.channel=2;break;case Dd.standardStereo:e.sampleRate=48e3,e.bitrate=8e4,e.channel=2;break;case Dd.hdMono:e.sampleRate=48e3,e.bitrate=128e3}return e}}]),e}(),Eq=new bC("VideoSnapshot",1),bq=function(e){var t=null==e?void 0:e.domElement;if(t&&!t.paused&&4===t.readyState)return t},kq=function(){var e=Sm(gm().mark((function e(t,r,n){var i,o,a,s,c,u,d,l;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=document.createElement("canvas"),o=i.getContext("2d")){e.next=4;break}throw new Error("canvas.getContext error");case 4:if(a=function(e,t,n){return t=t||e.width,n=n||e.height,i.width=t,i.height=n,r?o.setTransform(-1,0,0,1,t,0):o.setTransform(1,0,0,1,0,0),o.drawImage(e,0,0,t,n),o.getImageData(0,0,t,n)},s=Date.now(),!(c=bq(n))){e.next=16;break}return Eq.print("takeSnapshot","VideoPlayer already set."),e.next=11,a(c,c.videoWidth,c.videoHeight);case 11:return u=e.sent,Eq.print("takeSnapshot","success, cost ".concat(Date.now()-s,"ms")),e.abrupt("return",u);case 16:if(!window.ImageCapture){e.next=29;break}if("live"!==(d=new window.ImageCapture(t)).track.readyState||!d.track.enabled||d.track.muted){e.next=29;break}return Eq.print("takeSnapshot","use ImageCapture"),e.t0=a,e.next=23,d.grabFrame();case 23:return e.t1=e.sent,e.next=26,(0,e.t0)(e.t1);case 26:return l=e.sent,Eq.print("takeSnapshot","success, cost ".concat(Date.now()-s,"ms")),e.abrupt("return",l);case 29:return Eq.print("takeSnapshot","use temp video"),e.abrupt("return",new H_((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=a(i,i.videoWidth,i.videoHeight);Eq.print("takeSnapshot","success, cost ".concat(Date.now()-s,"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)}}(),Tq=function(){return{url:"",video:{codec:Pd.H264,width:640,height:360,fps:15,gop:2,kBitRate:Iq(640,360,15)},audio:{codec:"AAC",kBitRate:64,sampleRate:48e3,channels:2,AACProfile:Nd.LC},layout:{regions:[],appData:"",backgroundColor:"#000000"}}};function Iq(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 Rq(e){if("string"!=typeof e||!/^rtmps?:\/\//.test(e))throw new cA(aA.INVALID_PARAMS,"Invalid rtmp address")}function Aq(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(null==e||!e.length)throw new cA(aA.INVALID_PARAMS,"regions should not be empty.");var t,r=qT(e);try{for(r.s();!(t=r.n()).done;){var n=t.value;if("string"!=typeof n.userId)throw new cA(aA.INVALID_PARAMS,"region.userId(".concat(n.userId,") should be a string."));if("boolean"!=typeof n.isScreenStream)throw new cA(aA.INVALID_PARAMS,"region.isScreenStream(".concat(n.isScreenStream,") should be a boolean."))}}catch(i){r.e(i)}finally{r.f()}}function wq(e,t){var r,n,i,o=function(e,r){var n=EE(e).call(e,(function(e,t){return null==e?void 0:e[t]}),t),i=EE(e).call(e,(function(e,t){return null==e?void 0:e[t]}),Tq());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){var t;return!!yb(t=[32e3,44100,48e3]).call(t,(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){var t;return Wm(t=[1,2]).call(t,e)})),profile:o(["audio","AACProfile"],(function(e){var t;return Wm(t=[Nd.LC,Nd.HEv1,Nd.HEv2]).call(t,e)}))},video:{codec:o(["video","codec"],(function(e){var t;return Wm(t=["H264","H265"]).call(t,e)})),fps:u,gop:o(["video","gop"],(function(e){return e>=1&&e<=5})),bitRate:1e3*(d>=16&&d<=1e4?d:Iq(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:ck(i).call(i,(function(e){var t,r;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&&Wm(t=[1,2,3]).call(t,e.renderMode)?e.renderMode:1,contentControl:e.contentControl&&Wm(r=[0,1,2]).call(r,e.contentControl)?e.contentControl:0,screen:!!e.isScreenStream}})))||[],app_data:o(["layout","appData"],(function(e){return"string"==typeof e}))}}}}var Cq,Oq,Dq={getDefaultValue:Tq,checkStartParams:function(e){var t;Rq(e.url),Aq(null===(t=e.layout)||void 0===t?void 0:t.regions)},checckUpdateParams:function(e){var t;e.url&&Rq(e.url),Aq(null===(t=e.layout)||void 0===t?void 0:t.regions)},getStartParams:function(e){return wq("started",e)},getUpdateParams:function(e){return wq("layoutChanged",e)}},xq=new pU,Nq=function(e,t,r){var n;if(requestAnimationFrame){var i=xq.get(e);null!==(n=i)&&void 0!==n&&n[t]?Pq(e,t):i||(i={},xq.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))}()}},Pq=function(e,t){var r=xq.get(e);t&&r[t]?cancelAnimationFrame(r[t]):an(r).length&&an(r).forEach((function(e){cancelAnimationFrame(r[e])}))},Mq=id,Lq=tc,Uq=function(e,t,r,n){for(var i,o=n>1?void 0:n?Lq(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&&Mq(t,r,o),o},Vq=new bC("Engine",0),Fq=(Oq=function(e){AI(ve,e);var t,r,n,i,o,a,s,c,u,d,l,h,f,p,v,_,m,g,y,S,E,b,k,T,I,R,A,w,C,O,D,x,N,P,M,L,U,V,F,B,j,G,H,z,K,X,q,W,Y,Q,J,Z,$,ee,te,re,ne,ie,oe,ae,se,ce,ue,de,le,he,fe,pe=zI(ve);function ve(e,t){var r;return Kd(this,ve),od(YT(r=pe.call(this)),"id",(ve.GUID++).toString()),od(YT(r),"_room",void 0),od(YT(r),"_publicStreamManager",void 0),od(YT(r),"_appId",void 0),od(YT(r),"_businessId",void 0),od(YT(r),"_visibility",!0),od(YT(r),"_localVideoTrack",void 0),od(YT(r),"_localAudioTrack",void 0),od(YT(r),"_localImgVideoTrack",void 0),od(YT(r),"_localImgScreenTrack",void 0),od(YT(r),"_localScreenVideoTrack",void 0),od(YT(r),"_localScreenAudioTrack",void 0),od(YT(r),"_tempMixingAudioTrack",void 0),od(YT(r),"_videoPlayer",void 0),od(YT(r),"_screenPlayer",void 0),od(YT(r),"_remoteVideoPlayer",new aE),od(YT(r),"_remoteScreenPlayer",new aE),od(YT(r),"_remoteAudioPlayer",new aE),od(YT(r),"_remoteScreenAudioPlayer",new aE),od(YT(r),"_publicStreamAudioPlayer",new aE),od(YT(r),"_publicStreamVideoPlayer",new aE),od(YT(r),"_publicStreamIds",new aE),od(YT(r),"_roomConfig",void 0),od(YT(r),"_videoStreamConstraints",EN),od(YT(r),"_audioStreamConstraints",{}),od(YT(r),"_enableSimulcast",!1),od(YT(r),"_videoStreamEncodeConfig",[EN]),od(YT(r),"_screenStreamEncodeConfig",[bN]),od(YT(r),"_dummyMainImage",void 0),od(YT(r),"_dummyScreenImage",void 0),od(YT(r),"_trackSourceType",void 0),od(YT(r),"_liveTranscodeConfig",void 0),od(YT(r),"_useCloudProxy",void 0),od(YT(r),"_startCloudProxyTimestamp",void 0),od(YT(r),"_localVideoDeviceId",void 0),od(YT(r),"_localAudioDeviceId",void 0),od(YT(r),"_pauseAllSubscribeState",{audio:void 0,video:void 0,resumeStreamIds:{}}),od(YT(r),"_audioVolumeIndicationTimer",void 0),od(YT(r),"_dummyMainTimer",void 0),od(YT(r),"_dummyScreenTimer",void 0),od(YT(r),"_audioPropertiesReportTimer",null),od(YT(r),"_mirrorType",Ed.MIRROR_TYPE_RENDER),od(YT(r),"_audioMixingManager",void 0),od(YT(r),"_pubLock",void 0),od(YT(r),"_rtmClient",void 0),od(YT(r),"_messageStatisticsObserver",void 0),od(YT(r),"_tempRoomInfo",void 0),od(YT(r),"_originIceConfigRequestUrls",void 0),od(YT(r),"_originConfigServerUrls",void 0),od(YT(r),"_originLogServerUrl",void 0),od(YT(r),"_extensionManager",new EU),od(YT(r),"_audioDeviceManager",new yq(r._extensionManager)),od(YT(r),"_audioProfileManager",void 0),od(YT(r),"_requestManager",new aP),od(YT(r),"_remoteVideoConfig",new aE),od(YT(r),"_userPriorityMap",new aE),od(YT(r),"_subscribeFallbackOption",void 0),od(YT(r),"_cameraCapturing",!1),od(YT(r),"_interruptCameraCapture",!1),od(YT(r),"_micCapturing",!1),od(YT(r),"_interruptMicCapture",!1),od(YT(r),"_avSync",!0),od(YT(r),"_config",void 0),od(YT(r),"_needClosePreTrack",!1),od(YT(r),"_updateMixAudioTrack",function(){var e=Sm(gm().mark((function e(t){var n,i,o=arguments;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=o.length>1&&void 0!==o[1]?o[1]:Fd.PLAYOUT_AND_PUBLISH,Vq.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)}}()),od(YT(r),"_onAudioMixingMessage",(function(e){r.safeEmit(Gd.onAudioMixingStateChanged,e)})),od(YT(r),"_onAudioMixingAutoplayFailed",(function(e){r.safeEmit(Gd.onAutoplayFailed,e)})),r._appId=e,r._pubLock=new BV("pubLock"),r._addDeviceEventHandler(),r._audioMixingManager=new fq({getLocalAudioTrack:function(){return r._localAudioTrack},updateLocalAudioTrack:r._updateMixAudioTrack,emitMessage:r._onAudioMixingMessage,onAutoPlayFailed:r._onAudioMixingAutoplayFailed}),r._audioProfileManager=new Sq(e),window.__rtc_engine__=YT(r),window["__rtc_engine__".concat(Math.floor(100*Math.random()+1))]=YT(r),r._trackSourceType={video:cd.VIDEO_SOURCE_TYPE_INTERNAL,screenVideo:cd.VIDEO_SOURCE_TYPE_INTERNAL,audio:ud.AUDIO_SOURCE_TYPE_INTERNAL,screenAudio:ud.AUDIO_SOURCE_TYPE_INTERNAL},r._config=t,r._rtmClient=new _q(r.id,e),r._handleRTMClient(r._rtmClient),r._useCloudProxy=!1,r._handleAudioDeviceManager(),r._messageStatisticsObserver=new _G,r._extensionManager.setMinotor(Wx),BN(r.id),r._requestManager.getConfig(e).then((function(e){e.rts_report&&FN(e.rts_report)})),r}return zd(ve,[{key:"appId",get:function(){return this._appId},set:function(e){this._appId=e}},{key:"updateToken",value:(fe=Sm(gm().mark((function e(t){var r,n,i,o,a;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Vq.print("updateToken()","token: %s",t),Fw(t,"token"),!this.waitForNewToken||!this._tempRoomInfo){e.next=8;break}return n=this._tempRoomInfo,i=n.config,o=n.userInfo,a=n.roomId,delete this._tempRoomInfo,e.next=7,this.joinRoom(t,a,o,i);case 7:return e.abrupt("return",e.sent);case 8:if(this._room){e.next=10;break}throw new cA(aA.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:(he=Sm(gm().mark((function e(t){var r,n,i=this;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Vq.print("setVideoCaptureDevice()","deviceId: %s",t),Fw(t,"deviceId"),this._localVideoDeviceId=t,this._localVideoTrack){e.next=5;break}return e.abrupt("return");case 5:return r=FH({},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),Vq.print("setVideoCaptureDevice()","start createCameraVideoTrack..."),e.next=11,zU(r,this._extensionManager).catch((function(e){if(i._localVideoTrack&&!i._localVideoTrack.dummy)return Vq.print("setVideoCaptureDevice()","createCameraVideoTrack failed, stop pre VideoTrack."),i._removeLocalTrackEvents(i._localVideoTrack),i._localVideoTrack.close(),delete i._localVideoTrack,zU(r,i._extensionManager).then((function(e){return i._needClosePreTrack=!0,e})).catch(Sm(gm().mark((function t(){var r;return gm().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return Vq.print("setVideoCaptureDevice()","createCameraVideoTrack failed, rollback."),t.next=3,zU(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,Vq.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 he.apply(this,arguments)})},{key:"setAudioCaptureDevice",value:(le=Sm(gm().mark((function e(t){var r;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Vq.print("setAudioCaptureDevice()","deviceId: %s",t),Fw(t,"deviceId"),this._localAudioDeviceId=t,this._localAudioTrack){e.next=5;break}return e.abrupt("return");case 5:return this._audioProfileManager.updateConstraints({deviceId:{exact:t}}),this._localAudioTrack.close(),this._removeLocalTrackEvents(this._localAudioTrack),e.next=10,XU(this._audioProfileManager.getConstraints(),this._extensionManager);case 10:if(r=e.sent,this._initLocalTrackEvents(r),this._localAudioTrack=r,this._room){e.next=15;break}return e.abrupt("return");case 15:if(!this._room.hasPublished){e.next=18;break}return e.next=18,this._updatePublish();case 18:case"end":return e.stop()}}),e,this)}))),function(e){return le.apply(this,arguments)})},{key:"_addDeviceEventHandler",value:function(){_U.on(Gd.onVideoDeviceStateChanged,this._onVideoDeviceStateChange.bind(this)),_U.on(Gd.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,g,y,S,E,b,k,T,I,R,A,w,C,O,D=this;null===(e=this._room)||void 0===e||e.on(AN.ON_ADD_STREAM,this._onAddStream.bind(this)),null===(t=this._room)||void 0===t||t.on(AN.ON_REMOVE_STREAM,this._onRemoveStream.bind(this)),null===(r=this._room)||void 0===r||r.on(AN.USER_CONNECTION,this._onUserConnection.bind(this)),null===(n=this._room)||void 0===n||n.on(jV.ON_USER_LEAVE,this._onUserLeave.bind(this)),null===(i=this._room)||void 0===i||i.on(jV.ON_ROOM_ERROR,this._onRoomError.bind(this)),null===(o=this._room)||void 0===o||o.on(jV.ON_NETWORK_QUALITY,this._onNetworkQuality.bind(this)),null===(a=this._room)||void 0===a||a.on(AN.ON_CUSTOM_MESSAGE,this._onCustomMessage.bind(this)),null===(s=this._room)||void 0===s||s.on(AN.USER_MESSAGE_RECEIVED,this._onUserMessageReceived.bind(this)),null===(c=this._room)||void 0===c||c.on(AN.USER_BINARY_MESSAGE_RECEIVED,this._onUserBinaryMessageReceived.bind(this)),null===(u=this._room)||void 0===u||u.on(AN.ON_USER_TOKEN_WILL_EXPIRE,this._onUserTokenWillExpire.bind(this)),null===(d=this._room)||void 0===d||d.on(AN.POST_PROCESSING_MESSAGE,(function(e){"2.0"===e.protocol?D._onStreamMixingEvent({error:e.error,event:e.eventType,message:e.message}):"publicStreamCallback"===e.type?D._onPushPublicStreamResult(e):"transcodeStatusCallback"===e.type&&D._onLiveTranscodingResult(e)})),null===(l=this._room)||void 0===l||l.on(CN.ON_CONNECTION_STATE_CHANGE,this._onConnectionStateChange.bind(this)),null===(h=this._room)||void 0===h||h.on(jV.RESUBSCRIBE,this._onResubscribe.bind(this)),null===(f=this._room)||void 0===f||f.on(jV.SUBSCRIBE_PUSH_TRACK,this._onSubscribePushTrack.bind(this)),null===(p=this._room)||void 0===p||p.on(jV.REMOVE_PUSH_TRACK,this._onRemovePushTrack.bind(this)),null===(v=this._room)||void 0===v||v.on(jV.ON_PUBLISH_RESULT,(function(e){var t;null!==(t=D._room)&&void 0!==t&&t._roomConfig.isAutoPublish&&D.safeEmit(Gd.onAutoPublishResult,e)})),null===(_=this._room)||void 0===_||_.on(jV.ON_REMOTE_STREAM_STATS,(function(e){D.safeEmit(Gd.onRemoteStreamStats,e)})),null===(m=this._room)||void 0===m||m.on(jV.ON_LOCAL_STREAM_STATS,(function(e){D.safeEmit(Gd.onLocalStreamStats,e)})),null===(g=this._room)||void 0===g||g.on(jV.ON_SUBTITLE_STATE_CHANGED,(function(e){D.safeEmit(Gd.onSubtitleStateChanged,e)})),null===(y=this._room)||void 0===y||y.on(jV.ON_SUBTITLE_MESSAGE_RECEIVED,(function(e){D.safeEmit(Gd.onSubtitleMessageReceived,e)})),null===(S=this._room)||void 0===S||S.on(jV.ON_USER_PUBLISH_STATE_CHANGE,this._onUserPublishStateChange.bind(this)),null===(E=this._room)||void 0===E||E.on(jV.ON_USER_START_AUDIO_CAPTURE,(function(e,t){var r=e.userId;D._updateAudioPlayerState(t),D.safeEmit(Gd.onUserStartAudioCapture,{userId:r})})),null===(b=this._room)||void 0===b||b.on(jV.ON_USER_STOP_AUDIO_CAPTURE,(function(e){var t=e.userId;D.safeEmit(Gd.onUserStopAudioCapture,{userId:t})})),null===(k=this._room)||void 0===k||k.on(jV.ON_USER_START_VIDEO_CAPTURE,(function(e){var t=e.userId;D.safeEmit(Gd.onUserStartVideoCapture,{userId:t})})),null===(T=this._room)||void 0===T||T.on(jV.ON_USER_STOP_VIDEO_CAPTURE,(function(e){var t=e.userId;D.safeEmit(Gd.onUserStopVideoCapture,{userId:t})})),null===(I=this._room)||void 0===I||I.on(jV.ON_SEI_MESSAGED_RECEIVED,(function(e){D.safeEmit(Gd.onSEIMessageReceived,e)})),null===(R=this._room)||void 0===R||R.on(jV.ON_REMOTE_VIDEO_SIZE_CHANGED,(function(e,t){D.safeEmit(Gd.onRemoteVideoSizeChanged,e,t)})),null===(A=this._room)||void 0===A||A.on(jV.ON_SIMULCAST_SUBSCRIBE_FALLBACK,(function(e){return D.safeEmit(Gd.onSimulcastSubscribeFallback,e)})),null===(w=this._room)||void 0===w||w.on(jV.RECONNECT_FAILED,(function(){D.safeEmit(Gd.onError,{errorCode:aA.RECONNECT_FAILED})})),null===(C=this._room)||void 0===C||C.on(jV.ON_VIDEO_STREAM_BANNED,(function(e){D.safeEmit(Gd.onVideoStreamBanned,{uid:e.uid,banned:e.banned})})),null===(O=this._room)||void 0===O||O.on(jV.ON_AUDIO_STREAM_BANNED,(function(e){D.safeEmit(Gd.onAudioStreamBanned,{uid:e.uid,banned:e.banned})}))}},{key:"safeEmit",value:function(e){for(var t,r,n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];return eC(e)&&nN(e,Tw(i)),(t=II(kI(ve.prototype),"safeEmit",this)).call.apply(t,Im(r=[this,e]).call(r,i))}},{key:"_removeHandlerEventHandler",value:function(){var e;null===(e=this._room)||void 0===e||e.removeAllListeners()}},{key:"joinRoom",value:(de=Sm(gm().mark((function e(t,r,n,i){var o,a,s,c,u,d;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Vq.print("joinRoom()","token: %o roomId: %o, userInfo: %o, roomConfig: %o",t,r,n,i),Xw(t)||Fw(t,"token"),qw(r),Qw(n),Jw(i=FH({isAutoPublish:!0,isAutoSubscribeAudio:!0,isAutoSubscribeVideo:!0,roomProfileType:Od.communication},i)),!this._room||this._room.connectionState===JV.DISCONNECTED){e.next=10;break}throw new cA(aA.REPEAT_JOIN,"Already joined");case 10:return this._room=new aG(i,{id:this.id,audioProfileManager:this._audioProfileManager,streamRTT:{},subscribeFallbackOption:this._subscribeFallbackOption,userPriority:this._userPriorityMap,avSync:this._avSync}),this._addHandlerEventHandler(),o=this._liveTranscodeConfig&&Dq.getStartParams(this._liveTranscodeConfig),a=sd(sd({},n),{},{businessId:this._businessId,role:this._visibility?pq.NORMAL_USER:pq.SILENT_USER}),e.prev=14,this._useCloudProxy&&(this._startCloudProxyTimestamp=Date.now()),eG(a),e.next=19,this._room.join(this._appId,r,t,a,o,this._useCloudProxy,null===(s=this._config)||void 0===s?void 0:s.expectedIDC);case 19:return u=e.sent,this._roomConfig=i,this._audioProfileManager.setRoomId(r),this._tempRoomInfo&&delete this._tempRoomInfo,null!==(c=i)&&void 0!==c&&c.isAutoPublish&&(this._visibility?this._updatePublish({invokeByJoinRoom:!0,mediaType:gd.AUDIO_AND_VIDEO}):this.safeEmit(Gd.onAutoPublishResult,{isScreen:!1,state:pd.PUBLISH_FAIL})),GN(this.id,this._room.roomInfo),e.abrupt("return",u);case 28:throw e.prev=28,e.t0=e.catch(14),e.t0.code===aA.INVALID_TOKEN&&(this._tempRoomInfo={config:i,roomId:r,userInfo:a}),null===(d=this._room)||void 0===d||d.destroy(),e.t0;case 33:case"end":return e.stop()}}),e,this,[[14,28]])}))),function(e,t,r,n){return de.apply(this,arguments)})},{key:"leaveRoom",value:(ue=Sm(gm().mark((function e(){var t,r,n,i=arguments;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=i.length>0&&void 0!==i[0]&&i[0],Vq.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._audioProfileManager.setRoomId(),this._liveTranscodeConfig&&this.stopLiveTranscoding(),this._room=void 0,this._remoteAudioPlayer.forEach((function(e){return e.destroy()})),this._remoteAudioPlayer=new aE,this._remoteScreenAudioPlayer.forEach((function(e){return e.destroy()})),this._remoteScreenAudioPlayer=new aE,this._remoteScreenPlayer.forEach((function(e){return e.destroy()})),this._remoteScreenPlayer=new aE,this._remoteVideoPlayer.forEach((function(e){return e.destroy()})),this._remoteVideoPlayer=new aE,this._roomConfig=void 0,this._publicStreamIds=new aE,GN(this.id);case 23:case"end":return e.stop()}}),e,this)}))),function(){return ue.apply(this,arguments)})},{key:"destroy",value:function(){var e,t,r;Vq.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._videoStreamEncodeConfig=[EN],this._screenStreamEncodeConfig=[bN],this._pauseAllSubscribeState={audio:void 0,video:void 0,resumeStreamIds:{}},this._messageStatisticsObserver.destroy(),jN(this.id),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 aE,this._remoteScreenAudioPlayer.forEach((function(e){return e.destroy()})),this._remoteScreenAudioPlayer=new aE,this._remoteScreenPlayer.forEach((function(e){return e.destroy()})),this._remoteScreenPlayer=new aE,this._remoteVideoPlayer.forEach((function(e){return e.destroy()})),this._remoteVideoPlayer=new aE,this._publicStreamAudioPlayer.forEach((function(e){return e.destroy()})),this._publicStreamAudioPlayer=new aE,this._publicStreamVideoPlayer.forEach((function(e){return e.destroy()})),this._publicStreamVideoPlayer=new aE,this._roomConfig=void 0,this._audioMixingManager.destroy(),this._rtmClient.destroy(),null===(r=this._publicStreamManager)||void 0===r||r.destroy(),this._publicStreamIds=new aE,this._audioDeviceManager.destroy(),this._remoteVideoConfig=new aE,this._userPriorityMap.clear(),this._extensionManager.destroy(),this._cameraCapturing=!1,this._micCapturing=!1,this._interruptCameraCapture=!1,this._interruptMicCapture=!1,this._avSync=!0}},{key:"publishStream",value:(ce=Sm(gm().mark((function e(t){return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Vq.print("publishStream()","mediaType: %o",t),this._checkMediaType(t),this._assertNotInRoom(),!Cw(t)||this._localVideoTrack||!this._localImgVideoTrack){e.next=7;break}return e.next=6,BU(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 ce.apply(this,arguments)})},{key:"unpublishStream",value:(se=Sm(gm().mark((function e(t,r){var n;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Vq.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:HV.UNPUB});case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return se.apply(this,arguments)})},{key:"publishScreen",value:(ae=Sm(gm().mark((function e(t){return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Vq.print("publishScreen()","mediaType: %o",t),this._checkMediaType(t),this._assertNotInRoom(),e.prev=3,!Cw(t)||this._localScreenVideoTrack||!this._localImgScreenTrack){e.next=8;break}return e.next=7,GU(this._localImgScreenTrack,this._extensionManager);case 7:this._localScreenVideoTrack=e.sent;case 8:return e.next=10,this._updateScreenPublish({mediaType:t,pubState:HV.PUB});case 10:e.next=19;break;case 12:if(e.prev=12,e.t0=e.catch(3),!(e.t0 instanceof cA)){e.next=18;break}throw e.t0;case 18:throw new cA(aA.UNEXPECTED_ERROR,"unexpected error",e.t0);case 19:case"end":return e.stop()}}),e,this,[[3,12]])}))),function(e){return ae.apply(this,arguments)})},{key:"unpublishScreen",value:(oe=Sm(gm().mark((function e(t){return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Vq.print("unpublishScreen()","mediaType: %o",t),this._checkMediaType(t),this._assertNotInRoom(),e.next=5,this._updateScreenPublish({mediaType:t,pubState:HV.UNPUB});case 5:case"end":return e.stop()}}),e,this)}))),function(e){return oe.apply(this,arguments)})},{key:"subscribeStream",value:(ie=Sm(gm().mark((function e(t,r){return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Vq.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 ie.apply(this,arguments)})},{key:"_subscribe",value:(ne=Sm(gm().mark((function e(t,r,n){var i,o,a,s,c,u,d,l,h,f,p,v,_,m,g,y;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._checkMediaType(n),this._assertNotInRoom(),n!==gd.AUDIO||null===(i=this._room)||void 0===i||!i.multiChatMode){e.next=5;break}return Vq.print("subscribeStream()","due to multiChatMode return"),e.abrupt("return");case 5:if(u=this._room.remoteStreams.get(r),d=null==u?void 0:yb(u).call(u,(function(e){return e.isScreen===t}))){e.next=9;break}throw new cA(aA.STREAM_NOT_EXIST,"stream not exist");case 9:return l=this._pauseAllSubscribeState.audio,h=this._pauseAllSubscribeState.video,this._pauseAllSubscribeState.audio&&(n-=n&gd.AUDIO),this._pauseAllSubscribeState.video&&(n-=n&gd.VIDEO),Vq.print("subscribeStream()","due to pauseAll mediaType: %o",n),f=d.hasSubscribed,p=this._remoteVideoConfig.get(r)||(null===(o=this._roomConfig)||void 0===o?void 0:o.remoteVideoConfig),d.originalMediaType=n,e.next=19,this._room.subscribe(d,n,p);case 19:ww(n)&&this._updateAudioPlayerState(d),Cw(n)&&this._updateVideoPlayerState(d),v=0,_=0,l!==this._pauseAllSubscribeState.audio&&(this._pauseAllSubscribeState.audio?v|=gd.AUDIO:_|=gd.AUDIO),h!==this._pauseAllSubscribeState.video&&(this._pauseAllSubscribeState.video?v|=gd.VIDEO:_|=gd.VIDEO),v&&this.pauseAllSubscribedStream(v),_&&this.resumeAllSubscribedStream(_),this._pauseAllSubscribeState.resumeStreamIds[d.streamId]=d.streamId,!t&&(null!==(a=this._roomConfig)&&void 0!==a&&a.isAutoSubscribeAudio||null!==(s=this._roomConfig)&&void 0!==s&&s.isAutoSubscribeVideo)&&(d.audioTrack||d.videoTrack)&&(m={userId:r,isScreen:!1,state:fd.SUBSCRIBE_SUCC},this.safeEmit(Gd.onAutoSubscribeResult,m)),null!==(c=this._room)&&void 0!==c&&c.multiChatMode||f||!ww(n)||!d.hasAudio||null===(g=d.observer)||void 0===g||g.setSubscribeAudio(!0),!f&&Cw(n)&&d.hasVideo&&(null===(y=d.observer)||void 0===y||y.setSubscribeVideo(!0));case 31:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return ne.apply(this,arguments)})},{key:"unsubscribeStream",value:(re=Sm(gm().mark((function e(t,r){return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:Vq.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 re.apply(this,arguments)})},{key:"subscribeScreen",value:(te=Sm(gm().mark((function e(t,r){return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Vq.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 te.apply(this,arguments)})},{key:"unsubscribeScreen",value:(ee=Sm(gm().mark((function e(t,r){return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:Vq.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 ee.apply(this,arguments)})},{key:"_unsubscribe",value:function(e,t,r,n){var i,o=this;if(this._checkMediaType(r),this._assertNotInRoom(),r!==gd.AUDIO||null===(i=this._room)||void 0===i||!i.multiChatMode){var a=this._room.remoteStreams.get(t),s=null==a?void 0:yb(a).call(a,(function(t){return t.isScreen===e}));if(null==s||!s.hasSubscribed)throw new cA(aA.STREAM_NOT_EXIST,"stream not exist");return this._room.unsubscribe(s,r).then((function(){n||delete o._pauseAllSubscribeState.resumeStreamIds[s.streamId]}))}Vq.print("subscribeStream()","due to multiChatMode return")}},{key:"setRemoteVideoConfig",value:($=Sm(gm().mark((function e(t,r){var n;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Vq.print("setRemoteVideoConfig() userId: %o, remoteVideoConfig: %o",t,r),Ww(t),tC(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 $.apply(this,arguments)})},{key:"startVideoCapture",value:(Z=Sm(gm().mark((function e(t){var r,n,i,o,a,s,c,u,d,l=this;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Vq.print("startVideoCapture()","deviceId: %s",t),Xw(t)||Fw(t,"deviceId"),t=t||this._localVideoDeviceId,this._localVideoDeviceId=t,this._trackSourceType.video!==cd.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=6;break}throw new cA(aA.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as internal first");case 6:if(!(this._cameraCapturing||this._localVideoTrack&&!this._localVideoTrack.dummy)){e.next=8;break}throw new cA(aA.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),o={},e.prev=11,this._cameraCapturing=!0,e.next=15,zU(i,this._extensionManager);case 15:if(s=e.sent,!this._interruptCameraCapture){e.next=21;break}throw this._interruptCameraCapture=!1,this._removeLocalTrackEvents(s),s.close(),new cA(aA.INTERRUPT,"interrupt by stopVideoCapture");case 21:if(this._initLocalTrackEvents(s),this._localVideoTrack=s,null===(a=this._videoPlayer)||void 0===a||a.playVideo(s),(c=null==s?void 0:s.getTrack())&&(o=c.getSettings(),u={width:o.width,height:o.height},this._localVideoTrack.resolution=u,setTimeout((function(){return l.safeEmit(Gd.onLocalVideoSizeChanged,{streamIndex:md.STREAM_INDEX_MAIN,info:u})}))),this._room){e.next=28;break}return e.abrupt("return",o);case 28:return e.prev=28,this._cameraCapturing=!1,e.finish(28);case 31:return d=this._room._roomConfig.isAutoPublish,(this._room.hasPublished||d)&&(this._visibility?this._updatePublish():this.safeEmit(Gd.onAutoPublishResult,{isScreen:!1,state:pd.PUBLISH_FAIL})),null===(r=this._room.localStream)||void 0===r||null===(n=r.observer)||void 0===n||n.setEnableVideo(!0),e.abrupt("return",o);case 35:case"end":return e.stop()}}),e,this,[[11,,28,31]])}))),function(e){return Z.apply(this,arguments)})},{key:"stopVideoCapture",value:(J=Sm(gm().mark((function e(){var t,r,n,i,o,a;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Vq.print("stopVideoCapture()"),!this._cameraCapturing){e.next=5;break}return this._interruptCameraCapture=!0,Vq.print("stopVideoCapture()","capturing"),e.abrupt("return");case 5:if(this._trackSourceType.video!==cd.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=7;break}throw new cA(aA.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===(a=this._localVideoTrack)||void 0===a||a.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===(o=i.observer)||void 0===o||o.setEnableVideo(!1);case 15:case"end":return e.stop()}}),e,this)}))),function(){return J.apply(this,arguments)})},{key:"startAudioCapture",value:(Q=Sm(gm().mark((function e(t){var r,n,i,o;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Vq.print("startAudioCapture()","deviceId: $o",t),Xw(t)||Fw(t,"deviceId"),t=t||this._localAudioDeviceId,this._localAudioDeviceId=t,this._trackSourceType.audio!==ud.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=6;break}throw new cA(aA.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");case 6:if(!this._micCapturing&&!this._localAudioTrack){e.next=8;break}throw new cA(aA.REPEAT_CAPTURE,"Has already capture");case 8:return t&&this._audioProfileManager.updateConstraints({deviceId:{exact:t}}),e.prev=9,this._micCapturing=!0,e.next=13,XU(this._audioProfileManager.getConstraints(),this._extensionManager);case 13:if(i=e.sent,!this._interruptMicCapture){e.next=19;break}throw this._interruptMicCapture=!1,this._removeLocalTrackEvents(i),i.close(),new cA(aA.INTERRUPT,"interrupt by stopAudioCapture");case 19:if(this._initLocalTrackEvents(i),this._localAudioTrack=i,this._tempMixingAudioTrack&&(this._localAudioTrack.mixType=this._tempMixingAudioTrack.type,this._localAudioTrack.mixedAudioTrack=this._tempMixingAudioTrack.track,delete this._tempMixingAudioTrack),this._room){e.next=24;break}return e.abrupt("return");case 24:return e.prev=24,this._micCapturing=!1,e.finish(24);case 27:o=this._room._roomConfig.isAutoPublish,(this._room.hasPublished||o)&&(this._visibility?this._updatePublish():this.safeEmit(Gd.onAutoPublishResult,{isScreen:!1,state:pd.PUBLISH_FAIL})),null===(r=this._room.localStream)||void 0===r||null===(n=r.observer)||void 0===n||n.setEnableAudio(!0);case 30:case"end":return e.stop()}}),e,this,[[9,,24,27]])}))),function(e){return Q.apply(this,arguments)})},{key:"stopAudioCapture",value:(Y=Sm(gm().mark((function e(){var t,r;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Vq.print("stopAudioCapture()"),!this._micCapturing){e.next=5;break}return this._interruptMicCapture=!0,Vq.print("stopAudioCapture()","capturing"),e.abrupt("return");case 5:if(this._trackSourceType.audio!==ud.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=7;break}throw new cA(aA.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 Y.apply(this,arguments)})},{key:"getAudioMixingManager",value:function(){return Vq.print("getAudioMixingManager()"),this._audioMixingManager}},{key:"startScreenCapture",value:(W=Sm(gm().mark((function e(){var t,r,n,i,o,a,s,c,u,d,l,h,f,p=this,v=arguments;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=v.length>0&&void 0!==v[0]?v[0]:{},Vq.print("startScreenCapture()","config: %o",o),a=o.enableAudio,s=void 0!==a&&a,this._trackSourceType.screenVideo!==cd.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=5;break}throw new cA(aA.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as internal first");case 5:if(this._trackSourceType.screenAudio!==ud.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=7;break}throw new cA(aA.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");case 7:return e.next=9,WU(s,this._extensionManager,this._screenStreamEncodeConfig[0]);case 9:if(c=e.sent,u=WT(c,2),d=u[0],l=u[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=d,null!==(r=this._screenStreamEncodeConfig[0])&&void 0!==r&&r.contentHint&&d.setContentHint(null===(h=this._screenStreamEncodeConfig[0])||void 0===h?void 0:h.contentHint),(f=null==d?void 0:d.getTrack())&&setTimeout((function(){var e=f.getSettings(),t={width:e.width,height:e.height};d.resolution=t,p.safeEmit(Gd.onLocalVideoSizeChanged,{streamIndex:md.STREAM_INDEX_SCREEN,info:{width:e.width,height:e.height}})}),500),l&&(this._localScreenAudioTrack=l,this._initLocalTrackEvents(l)),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 W.apply(this,arguments)})},{key:"stopScreenCapture",value:(q=Sm(gm().mark((function e(){var t,r,n;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Vq.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 q.apply(this,arguments)})},{key:"setLocalVideoPlayer",value:function(e,t){if(Vq.print("setLocalVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",e,t),Bw(e,"streamIndex",[md.STREAM_INDEX_MAIN,md.STREAM_INDEX_SCREEN]),t&&t.renderDom){var r,n,i=sd(sd({userId:this._getUserId()},t),{},{isLocal:!0});if(Zw(i),e===md.STREAM_INDEX_MAIN&&!this._videoPlayer)return this._videoPlayer=new fG(i),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)!==xd.PLAY_MANUALLY&&this._videoPlayer.playVideo(this._localVideoTrack),this._videoPlayer.domElement;if(e===md.STREAM_INDEX_SCREEN&&!this._screenPlayer)return this._screenPlayer=new fG(sd(sd({},i),{},{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)!==xd.PLAY_MANUALLY&&this._screenPlayer.playVideo(this._localScreenVideoTrack),this._screenPlayer.domElement}else{var o,a;e===md.STREAM_INDEX_MAIN?(null===(o=this._videoPlayer)||void 0===o||o.destroy(),delete this._videoPlayer):(null===(a=this._screenPlayer)||void 0===a||a.destroy(),delete this._screenPlayer)}}},{key:"startLiveTranscoding",value:(X=Sm(gm().mark((function e(t){var r,n,i;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Vq.print("startLiveTranscoding()","transcode: %o",t),Dq.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 cA(aA.INVALID_PARAMS,"The roomId+userId must be within 126 bytes");case 6:if(e.prev=6,this.safeEmit(Gd.onStreamMixingEvent,{event:GV.START,error:0,message:""}),!this._room||this._room.connectionState!==JV.CONNECTED){e.next=11;break}return e.next=11,null===(i=this._room)||void 0===i?void 0:i.liveControlMessage(Dq.getStartParams(this._liveTranscodeConfig));case 11:e.next=20;break;case 13:if(e.prev=13,e.t0=e.catch(6),!(e.t0 instanceof cA)){e.next=19;break}throw e.t0;case 19:throw new cA(aA.UNEXPECTED_ERROR,"unexpected error",e.t0);case 20:case"end":return e.stop()}}),e,this,[[6,13]])}))),function(e){return X.apply(this,arguments)})},{key:"updateLiveTranscoding",value:(K=Sm(gm().mark((function e(t){var r,n,i,o;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Vq.print("updateLiveTranscoding()","transcode: %o",t),this._liveTranscodeConfig){e.next=3;break}return e.abrupt("return");case 3:return delete(i=FH({},t)).audio,null===(r=i.video)||void 0===r||delete r.codec,null===(n=i.video)||void 0===n||delete n.gop,Dq.checckUpdateParams(i),this._liveTranscodeConfig=FH(this._liveTranscodeConfig,i),e.prev=9,this.safeEmit(Gd.onStreamMixingEvent,{event:GV.UPDATE,error:0,message:""}),e.next=13,null===(o=this._room)||void 0===o?void 0:o.liveControlMessage(Dq.getUpdateParams(this._liveTranscodeConfig));case 13:e.next=22;break;case 15:if(e.prev=15,e.t0=e.catch(9),!(e.t0 instanceof cA)){e.next=21;break}throw e.t0;case 21:throw new cA(aA.UNEXPECTED_ERROR,"unexpected error",e.t0);case 22:case"end":return e.stop()}}),e,this,[[9,15]])}))),function(e){return K.apply(this,arguments)})},{key:"stopLiveTranscoding",value:(z=Sm(gm().mark((function e(){var t;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Vq.print("stopLiveTranscoding()"),this._liveTranscodeConfig){e.next=3;break}return e.abrupt("return");case 3:return delete this._liveTranscodeConfig,e.prev=4,this.safeEmit(Gd.onStreamMixingEvent,{event:GV.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 cA)){e.next=16;break}throw e.t0;case 16:throw new cA(aA.UNEXPECTED_ERROR,"unexpected error",e.t0);case 17:case"end":return e.stop()}}),e,this,[[4,10]])}))),function(){return z.apply(this,arguments)})},{key:"startSubtitle",value:(H=Sm(gm().mark((function e(t){var r;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Vq.print("startSubtitle()","config: %o",t),this._assertNotInRoom(),e.next=4,null===(r=this._room)||void 0===r?void 0:r.startSubtitle(t);case 4:case"end":return e.stop()}}),e,this)}))),function(e){return H.apply(this,arguments)})},{key:"stopSubtitle",value:function(){var e;Vq.print("stopSubtitle()","invoke"),null===(e=this._room)||void 0===e||e.stopSubtitle()}},{key:"setBusinessId",value:function(e){return Vq.print("setBusinessId()","businessId: %s",e),!function(e){return"string"!=typeof e}(e)&&!this._room&&(Jx.setStats({rtc_business_id:e}),Hj.setStats({rtc_business_id:e}),this._businessId=e,!0)}},{key:"setUserVisibility",value:(G=Sm(gm().mark((function e(t){var r,n;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Vq.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?pq.NORMAL_USER:pq.SILENT_USER});case 15:this._visibility=t,t&&null!==(r=this._roomConfig)&&void 0!==r&&r.isAutoPublish&&this._updatePublish({mediaType:gd.AUDIO_AND_VIDEO});case 17:case"end":return e.stop()}}),e,this)}))),function(e){return G.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]:md.STREAM_INDEX_MAIN,i=n===md.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(Gd.onFirstPublicStreamAudioFrameDecoded,{publicStreamId:o}):(t.safeEmit(Gd.onAudioFirstFrameDecoded,{userId:o,isScreen:i}),t.safeEmit(Gd.onRemoteAudioFirstFrame,{userId:o,isScreen:i})),Wx.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(Gd.onFirstPublicStreamVideoFrameRendered,c),t.safeEmit(Gd.onFirstPublicStreamVideoFrameDecoded,c)):e.isLocal||(t.safeEmit(Gd.onVideoFirstFrameRendered,c),t.safeEmit(Gd.onVideoFirstFrameDecoded,c),t.safeEmit(Gd.onRemoteVideoFirstFrame,c)),Wx.firstRemoteVideoRender("",n.userId||"",{isScreen:i})}break;case"autoplay-error":return r&&(n.publicStreamId=n.userId),Wx.rtcInvokeStatus(e instanceof fG?"video":"audio",0,"autoplay-error",n.userId||"",0),void t.safeEmit(Gd.onAutoplayFailed,{userId:n.userId,kind:e instanceof fG?"video":"audio",mediaType:e instanceof fG?gd.VIDEO:gd.AUDIO,streamIndex:e.isScreen?md.STREAM_INDEX_SCREEN:md.STREAM_INDEX_MAIN})}t.safeEmit(Gd.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(Gd.onTrackEnded,{kind:e.getTrack().kind,isScreen:r})})),e.on("resolution-change",(function(e){t._extensionManager.getPluginsByType(SU.PRE_PROCESSING).forEach((function(t){var r;null==t||null===(r=t.applyConstraints)||void 0===r||r.call(t,e)})),t.safeEmit(Gd.onLocalVideoSizeChanged,{streamIndex:r?md.STREAM_INDEX_SCREEN:md.STREAM_INDEX_MAIN,info:e})}))}},{key:"_removeLocalTrackEvents",value:function(e){e.removeAllListeners("track-ended"),e.removeAllListeners("resolution-change")}},{key:"setRemoteVideoPlayer",value:function(e,t){Vq.print("setRemoteVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",e,t),Bw(e,"streamIndex",[md.STREAM_INDEX_MAIN,md.STREAM_INDEX_SCREEN]),Zw(t);var r,n,i,o=t.userId;if(e===md.STREAM_INDEX_MAIN){var a,s,c;if(null===(a=this._remoteVideoPlayer.get(o))||void 0===a||a.destroy(),!t.renderDom)return;var u=new fG(t);this._initPlayerEvents(u,!1,e),this._remoteVideoPlayer.set(o,u);var d=null===(s=this._room)||void 0===s||null===(c=s.remoteStreams.get(o))||void 0===c?void 0:yb(c).call(c,(function(e){return!e.isScreen}));return d&&this._updateVideoPlayerState(d),u.domElement}if(null===(r=this._remoteScreenPlayer.get(o))||void 0===r||r.destroy(),t.renderDom){var l=new fG(sd(sd({},t),{},{isScreen:!0}));this._remoteScreenPlayer.set(o,l),this._initPlayerEvents(l,!1,e);var h=null===(n=this._room)||void 0===n||null===(i=n.remoteStreams.get(o))||void 0===i?void 0:yb(i).call(i,(function(e){return e.isScreen}));return h&&this._updateVideoPlayerState(h),l.domElement}}},{key:"setLocalVideoMirrorType",value:function(e){Vq.print("setLocalVideoMirrorType()","mirrorType: %o",e),Bw(e,"mirrorType",[Ed.MIRROR_TYPE_NONE,Ed.MIRROR_TYPE_RENDER]),this._mirrorType=e,this._videoPlayer&&this._videoPlayer.mirror(!!e)}},{key:"setAudioPlaybackDevice",value:(j=Sm(gm().mark((function e(t){var r;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Vq.print("setAudioPlaybackDevice()","deviceId: %s",t),Fw(t,"deviceId"),e.next=4,this._audioDeviceManager.setSinkId(t);case 4:r=e.sent,this._remoteAudioPlayer.forEach((function(e){e.setPlaybackDevice(t)})),this._remoteScreenAudioPlayer.forEach((function(e){e.setPlaybackDevice(t)})),this.safeEmit(Gd.onAudioPlaybackDeviceChanged,r),Wx.rtcAudioDevice(Mx.PLAYOUT_DEVICE_SWITCH,t,0);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return j.apply(this,arguments)})},{key:"play",value:(B=Sm(gm().mark((function e(t){var r,n,i,o,a,s,c,u,d,l,h,f,p,v,_,m,g=arguments;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=g.length>1&&void 0!==g[1]?g[1]:gd.AUDIO_AND_VIDEO,a=g.length>2?g[2]:void 0,Vq.print("play()","userId: %s, mediaType: %s, streamIndex: %s",t,o,a),s=!t||t===this._getUserId()||"local_user"===t,c=void 0===a||a===md.STREAM_INDEX_MAIN,u=void 0===a||a===md.STREAM_INDEX_SCREEN,d=o!==gd.VIDEO,l=o!==gd.AUDIO,h=[],s&&l&&(c&&this._localVideoTrack&&(null===(f=this._videoPlayer)||void 0===f||f.mirror(!!this._mirrorType),h.push(null===(p=this._videoPlayer)||void 0===p?void 0:p.playVideo(this._localVideoTrack))),u&&this._localScreenVideoTrack&&h.push(null===(v=this._screenPlayer)||void 0===v?void 0:v.playVideo(this._localScreenVideoTrack))),t===(null===(r=this._audioMixingManager)||void 0===r?void 0:r.id)&&h.push(this._audioMixingManager.resumeLocalPlay()),_=null===(n=this._room)||void 0===n?void 0:n.remoteStreams,l&&c&&h.push(vG(this._remoteVideoPlayer,t,!1,_)),l&&u&&h.push(vG(this._remoteScreenPlayer,t,!0,_)),d&&c&&h.push(vG(this._remoteAudioPlayer,t,!1,_)),l&&u&&h.push(vG(this._remoteScreenAudioPlayer,t,!0,_)),m=null===(i=this._publicStreamManager)||void 0===i?void 0:i.remoteStreams,d&&h.push(vG(this._publicStreamVideoPlayer,t,!1,m)),l&&h.push(vG(this._publicStreamAudioPlayer,t,!1,m)),e.abrupt("return",H_.all(h).then((function(){})));case 20:case"end":return e.stop()}}),e,this)}))),function(e){return B.apply(this,arguments)})},{key:"pauseAllSubscribedStream",value:(F=Sm(gm().mark((function e(t){var r,n,i,o,a,s=this;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Vq.print("pauseAllSubscribedStream()","mediaType: %o",t),this._checkMediaType(t),ww(t)&&(s._pauseAllSubscribeState.audio=!0),Cw(t)&&(s._pauseAllSubscribeState.video=!0),this._room){e.next=6;break}return e.abrupt("return",H_.resolve());case 6:n=[],i=qT(ZI(r=this._room.remoteStreams).call(r));try{for(i.s();!(o=i.n()).done;)a=o.value,Array.isArray(a)&&a.forEach((function(e){if(e.hasSubscribed){s._pauseAllSubscribeState.resumeStreamIds[e.streamId]=e.streamId;var r=s._unsubscribe(e.isScreen,e.userId,t,!0);r&&n.push(r)}}))}catch(c){i.e(c)}finally{i.f()}return e.abrupt("return",H_.all(n).then((function(){})));case 10:case"end":return e.stop()}}),e,this)}))),function(e){return F.apply(this,arguments)})},{key:"resumeAllSubscribedStream",value:(V=Sm(gm().mark((function e(t){var r,n,i,o,a,s=this;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Vq.print("resumeAllSubscribedStream()","mediaType: %o",t),this._checkMediaType(t),ww(t)&&(s._pauseAllSubscribeState.audio=!1),Cw(t)&&(s._pauseAllSubscribeState.video=!1),this._room){e.next=6;break}return e.abrupt("return",H_.resolve());case 6:n=[],i=qT(ZI(r=this._room.remoteStreams).call(r));try{for(i.s();!(o=i.n()).done;)a=o.value,Array.isArray(a)&&a.forEach((function(e){if(s._pauseAllSubscribeState.resumeStreamIds[e.streamId]){delete s._pauseAllSubscribeState.resumeStreamIds[e.streamId];var r=s._subscribe(e.isScreen,e.userId,t);r&&n.push(r)}}))}catch(c){i.e(c)}finally{i.f()}return e.abrupt("return",H_.all(n).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 V.apply(this,arguments)})},{key:"sendUserMessage",value:(U=Sm(gm().mark((function e(t,r){var n,i,o,a=this;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Ww(t),$w(r),this._assertNotInRoom(),o=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 a._messageStatisticsObserver.countP2PMessage(!0,t,!1,o,e),e.id})).catch((function(e){throw a._messageStatisticsObserver.countP2PMessage(!1,t,!1,o,e),e})));case 5:case"end":return e.stop()}}),e,this)}))),function(e,t){return U.apply(this,arguments)})},{key:"sendUserBinaryMessage",value:(L=Sm(gm().mark((function e(t,r){var n,i,o,a=this;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Ww(t),Hw(r,"message"),$w(r),this._assertNotInRoom(),o=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 a._messageStatisticsObserver.countP2PMessage(!0,t,!0,o,e),e.id})).catch((function(e){throw a._messageStatisticsObserver.countP2PMessage(!1,t,!0,o,e),e})));case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return L.apply(this,arguments)})},{key:"sendRoomMessage",value:(M=Sm(gm().mark((function e(t){var r,n,i,o=this;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return $w(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 o._messageStatisticsObserver.countRoomMessage(!0,null===(t=o._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 o._messageStatisticsObserver.countRoomMessage(!1,null===(t=o._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 M.apply(this,arguments)})},{key:"sendRoomBinaryMessage",value:(P=Sm(gm().mark((function e(t){var r,n,i,o=this;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return $w(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 o._messageStatisticsObserver.countRoomMessage(!0,null===(t=o._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 o._messageStatisticsObserver.countRoomMessage(!1,null===(t=o._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 P.apply(this,arguments)})},{key:"setAudioCaptureConfig",value:(N=Sm(gm().mark((function e(){var t,r=arguments;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=r.length>0&&void 0!==r[0]?r[0]:{},Vq.print("setAudioCaptureConfig()","config: %o",t),delete t.deviceId,zw(t),this._shouldUpdateAudioConf("setAudioCaptureConfig")&&this._audioProfileManager.updateConstraints(t);case 5:case"end":return e.stop()}}),e,this)}))),function(){return N.apply(this,arguments)})},{key:"setVideoCaptureConfig",value:(x=Sm(gm().mark((function e(){var t,r=arguments;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=r.length>0&&void 0!==r[0]?r[0]:{},Vq.print("setVideoCaptureConfig()","config: %o",t),e.abrupt("return",this._setVideoCaptureConfig(t));case 3:case"end":return e.stop()}}),e,this)}))),function(){return x.apply(this,arguments)})},{key:"_setVideoCaptureConfig",value:(D=Sm(gm().mark((function e(){var t,r,n,i=arguments;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(delete(r=i.length>0&&void 0!==i[0]?i[0]:{}).deviceId,zw(r),n=sd(sd({},r),{},{deviceId:this._videoStreamConstraints.deviceId}),!this._localVideoTrack){e.next=7;break}return e.next=7,this._localVideoTrack.updateVideoCaptureConfig(n);case 7:return this._videoStreamConstraints=n,e.abrupt("return",(null===(t=this._localVideoTrack)||void 0===t?void 0:t.getTrack().getSettings())||{});case 9:case"end":return e.stop()}}),e,this)}))),function(){return D.apply(this,arguments)})},{key:"enableSimulcastMode",value:function(e){var t;return Vq.print("enableSimulcastMode()","enabled: %o",e),this._enableSimulcast=e,null!==(t=this._room)&&void 0!==t&&t.hasPublished&&Mw("You must call this API before publishing the video streams"),!0}},{key:"setVideoEncoderConfig",value:(O=Sm(gm().mark((function e(t){var r,n,i;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(Vq.print("setVideoEncoderConfig()"," descriptions: %o",t),Array.isArray(t)||(t=[t]),nC(t=Gs(t).call(t,(function(e){return!!e}))),t.length>3&&(Mw("setVideoEncoderConfig: You can set parameters for up to 3 streams"),t=mm(t).call(t,0,3)),n=1;n<t.length;n++)i=Lw(t[0].width)/Lw(t[n].width)||1,Math.floor(i)!==i&&Mw("setVideoEncoderConfig: The resolution setting needs to be an integer multiple");MR(t).call(t,(function(e,t){return t.maxKbps-e.maxKbps})),this._setVideoCaptureConfig(sd({},t[0])),this._videoStreamEncodeConfig=t,this._updateDummyCaptureImage(md.STREAM_INDEX_MAIN),null!==(r=this._room)&&void 0!==r&&r.hasPublished&&this._updatePublish();case 11:case"end":return e.stop()}}),e,this)}))),function(e){return O.apply(this,arguments)})},{key:"setScreenEncoderConfig",value:(C=Sm(gm().mark((function e(t){var r;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:Vq.print("setScreenEncoderConfig()","description: %o",t),this._screenStreamEncodeConfig=[t],this._localScreenVideoTrack&&(this._localScreenVideoTrack.updateVideoCaptureConfig(t),t.contentHint&&this._localScreenVideoTrack.setContentHint(t.contentHint)),this._updateDummyCaptureImage(md.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 C.apply(this,arguments)})},{key:"sendSEIMessage",value:function(e,t,r){if(Vq.print("sendSEIMessage()","streamIdex: %o, message: %o, repeatCount: %o",e,t,r),!$M())throw new cA(aA.NOT_SUPPORTED,"Browser does not support sending SEI");Bw(e,"streamIndex",[md.STREAM_INDEX_MAIN,md.STREAM_INDEX_SCREEN]),Vw(r,"repeatCount",0,30);var n="string"==typeof t?new Uint8Array(sw.str2ab(t)):t;if(t.length){var i;if(e===md.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)Vq.print("sei size must not bigger than 4KB");else{var l=nw();i.seiList.push({content:n,uuid:l,repeatCount:r}),setTimeout((function(){var e;if(i){var t,r=zR(e=i.seiList).call(e,(function(e){return e.uuid===l}));if(r)rk(t=i.seiList).call(t,r,1)}}),2e3)}}else Vq.print("sei message must not be empty")}},{key:"setAudioVolumeIndicationInterval",value:function(e){var t=this;Vq.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=yb(e).call(e,(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(Gd.onAudioVolumeIndication,{speakers:r})}),e)}},{key:"_sendActiveSpeaker",value:function(e,t){if(this._room&&this._room.remoteUsers.size>=1){var r,n=e[0],i=EE(t).call(t,(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(Gd.onActiveSpeaker,{userId:o.userId,extraInfo:o.extraInfo})}}}},{key:"enableAudioPropertiesReport",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Vq.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:md.STREAM_INDEX_MAIN,audioPropertiesInfo:{linearVolume:i,nonlinearVolume:Aw(i)}})}if(e._localScreenAudioTrack){var o=e._localScreenAudioTrack.getAudioLevel();t.push({streamIndex:md.STREAM_INDEX_SCREEN,audioPropertiesInfo:{linearVolume:o,nonlinearVolume:Aw(o)}})}if(e.safeEmit(Gd.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:md.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:Aw(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?md.STREAM_INDEX_SCREEN:md.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:Aw(o)}})}}))}));e.safeEmit(Gd.onRemoteAudioPropertiesReport,s),e._sendActiveSpeaker(t,Gs(s).call(s,(function(e){return e.streamKey.streamIndex!==md.STREAM_INDEX_SCREEN})))}}}),o))}},{key:"setVideoSourceType",value:(w=Sm(gm().mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h,f,p,v,_,m,g,y,S,E,b,k,T;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Vq.print("setVideoSourceType()","index: %o, videoSourceType: %o",t,r),Bw(t,"streamIndex",[md.STREAM_INDEX_MAIN,md.STREAM_INDEX_SCREEN]),Bw(r,"VideoSourceType",[cd.VIDEO_SOURCE_TYPE_EXTERNAL,cd.VIDEO_SOURCE_TYPE_INTERNAL]),n=t===md.STREAM_INDEX_MAIN?"video":"screenVideo",this._trackSourceType[n]===r){e.next=26;break}if(this._trackSourceType[n]=r,Vq.print("setVideoSourceType",Im(i="set ".concat(n," source type to ")).call(i,r)),!this._localVideoTrack||t!==md.STREAM_INDEX_MAIN){e.next=17;break}if(c=!1,r===cd.VIDEO_SOURCE_TYPE_EXTERNAL&&(c=!0,this._removeLocalTrackEvents(this._localVideoTrack),this._localVideoTrack.close()),null===(o=this._videoPlayer)||void 0===o||o.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!==md.STREAM_INDEX_SCREEN){e.next=26;break}if(g=!1,r===cd.VIDEO_SOURCE_TYPE_EXTERNAL&&(g=!0,this._removeLocalTrackEvents(this._localScreenVideoTrack),this._localScreenVideoTrack.close()),null===(_=this._screenPlayer)||void 0===_||_.stop(),this._localScreenVideoTrack=void 0,g?null===(y=this._room)||void 0===y||null===(S=y.localScreenStream)||void 0===S||null===(E=S.observer)||void 0===E||E.setEnableVideo(!1):null===(b=this._room)||void 0===b||null===(k=b.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 w.apply(this,arguments)})},{key:"setExternalVideoTrack",value:(A=Sm(gm().mark((function e(t,r){var n,i,o,a,s,c,u,d,l;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Vq.print("setExternalVideoTrack()","index: %o, track: %o",t,r),Bw(t,"streamIndex",[md.STREAM_INDEX_MAIN,md.STREAM_INDEX_SCREEN]),jw(r),t!==md.STREAM_INDEX_MAIN){e.next=15;break}if(this._trackSourceType.video===cd.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=6;break}throw new cA(aA.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as external first");case 6:return e.next=8,JU(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),a=null===(i=this._room)||void 0===i?void 0:i._roomConfig.isAutoPublish,!(null!==(o=this._room)&&void 0!==o&&o.hasPublished||a)){e.next=15;break}return e.next=15,this._updatePublish();case 15:if(t!==md.STREAM_INDEX_SCREEN){e.next=27;break}if(this._trackSourceType.screenVideo===cd.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=18;break}throw new cA(aA.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as external first");case 18:return e.next=20,tV(r,this._extensionManager);case 20:if(this._localScreenVideoTrack=e.sent,this._initLocalTrackEvents(this._localScreenVideoTrack,!0),null===(s=this._screenPlayer)||void 0===s||s.playVideo(this._localScreenVideoTrack),null===(c=this._room)||void 0===c||null===(u=c.localScreenStream)||void 0===u||null===(d=u.observer)||void 0===d||d.setPushVideo(!0),null===(l=this._room)||void 0===l||!l.hasScreenPublished){e.next=27;break}return e.next=27,this._updateScreenPublish();case 27:case"end":return e.stop()}}),e,this)}))),function(e,t){return A.apply(this,arguments)})},{key:"setAudioSourceType",value:(R=Sm(gm().mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h,f,p,v,_,m,g,y,S,E,b;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Vq.print("setAudioSourceType()","index: %o, audioSourceType: %o",t,r),Bw(t,"streamIndex",[md.STREAM_INDEX_MAIN,md.STREAM_INDEX_SCREEN]),Bw(r,"audioSourceType",[ud.AUDIO_SOURCE_TYPE_EXTERNAL,ud.AUDIO_SOURCE_TYPE_INTERNAL]),n=t===md.STREAM_INDEX_MAIN?"audio":"screenAudio",this._trackSourceType[n]===r){e.next=24;break}if(this._trackSourceType[n]=r,Vq.print("setVideoSourceType",Im(i="set ".concat(n," source type to ")).call(i,r)),!this._localAudioTrack||t!==md.STREAM_INDEX_MAIN){e.next=16;break}if(s=!1,this._trackSourceType.audio===ud.AUDIO_SOURCE_TYPE_EXTERNAL&&(s=!0,this._removeLocalTrackEvents(this._localAudioTrack),this._localAudioTrack.close()),this._localAudioTrack=void 0,c=null===(o=this._room)||void 0===o?void 0:o._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!==md.STREAM_INDEX_SCREEN){e.next=24;break}if(_=!1,this._trackSourceType.audio===ud.AUDIO_SOURCE_TYPE_EXTERNAL&&(_=!0,this._removeLocalTrackEvents(this._localScreenAudioTrack),this._localScreenAudioTrack.close()),this._localScreenAudioTrack=void 0,_?null===(m=this._room)||void 0===m||null===(g=m.localScreenStream)||void 0===g||null===(y=g.observer)||void 0===y||y.setEnableAudio(!1):null===(S=this._room)||void 0===S||null===(E=S.localScreenStream)||void 0===E||null===(b=E.observer)||void 0===b||b.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 R.apply(this,arguments)})},{key:"setExternalAudioTrack",value:(I=Sm(gm().mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Vq.print("setExternalAudioTrack()","index: %o, track: %o",t,r),Bw(t,"streamIndex",[md.STREAM_INDEX_MAIN,md.STREAM_INDEX_SCREEN]),jw(r),t!==md.STREAM_INDEX_MAIN){e.next=15;break}if(this._trackSourceType.audio===ud.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=6;break}throw new cA(aA.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as external first");case 6:return e.next=8,$U(r,this._extensionManager);case 8:if(this._localAudioTrack=e.sent,this._initLocalTrackEvents(this._localAudioTrack),c=null===(n=this._room)||void 0===n?void 0:n._roomConfig.isAutoPublish,null===(i=this._room)||void 0===i||null===(o=i.localStream)||void 0===o||null===(a=o.observer)||void 0===a||a.setPushAudio(!0),!(null!==(s=this._room)&&void 0!==s&&s.hasPublished||c)){e.next=15;break}return e.next=15,this._updatePublish();case 15:if(t!==md.STREAM_INDEX_SCREEN){e.next=26;break}if(this._trackSourceType.screenAudio===ud.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=18;break}throw new cA(aA.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as external first");case 18:return e.next=20,nV(r,this._extensionManager);case 20:if(this._localScreenAudioTrack=e.sent,this._initLocalTrackEvents(this._localScreenAudioTrack),null===(u=this._room)||void 0===u||null===(d=u.localScreenStream)||void 0===d||null===(l=d.observer)||void 0===l||l.setPushAudio(!0),null===(h=this._room)||void 0===h||!h.hasScreenPublished){e.next=26;break}return e.next=26,this._updateScreenPublish();case 26:case"end":return e.stop()}}),e,this)}))),function(e,t){return I.apply(this,arguments)})},{key:"login",value:(T=Sm(gm().mark((function e(t,r){return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Vq.print("login()","token: %o, userInfo: %o",t,r),Xw(t)||Fw(t,"token"),Ww(r),e.abrupt("return",this._rtmClient.login(t,r));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return T.apply(this,arguments)})},{key:"logout",value:(k=Sm(gm().mark((function e(){return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Vq.print("logout()"),e.abrupt("return",this._rtmClient.logout());case 2:case"end":return e.stop()}}),e,this)}))),function(){return k.apply(this,arguments)})},{key:"updateLoginToken",value:(b=Sm(gm().mark((function e(t){return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Vq.print("updateLoginToken()","token: %o",t),Xw(t)||Fw(t,"token"),e.abrupt("return",this._rtmClient.updateLoginToken(t));case 3:case"end":return e.stop()}}),e,this)}))),function(e){return b.apply(this,arguments)})},{key:"getPeerOnlineStatus",value:(E=Sm(gm().mark((function e(t){return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Vq.print("getPeerOnlineStatus()","userId: %o",t),Ww(t),e.abrupt("return",this._rtmClient.getPeerOnlineStatus(t));case 3:case"end":return e.stop()}}),e,this)}))),function(e){return E.apply(this,arguments)})},{key:"sendUserMessageOutsideRoom",value:(S=Sm(gm().mark((function e(t,r){var n,i=this;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Ww(t),$w(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 S.apply(this,arguments)})},{key:"sendUserBinaryMessageOutsideRoom",value:(y=Sm(gm().mark((function e(t,r){var n,i=this;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Ww(t),Hw(r,"message"),$w(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 y.apply(this,arguments)})},{key:"setServerParams",value:(g=Sm(gm().mark((function e(t,r){return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Vq.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 g.apply(this,arguments)})},{key:"sendServerMessage",value:(m=Sm(gm().mark((function e(t){var r,n=this;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Fw(t,"message"),$w(t),r=Date.now(),e.abrupt("return",this._rtmClient.sendServerMessage(t).then((function(e){n._messageStatisticsObserver.countServerMessage(!0,!1,r,e)})).catch((function(e){throw n._messageStatisticsObserver.countServerMessage(!1,!1,r,e),e})));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return m.apply(this,arguments)})},{key:"sendServerBinaryMessage",value:(_=Sm(gm().mark((function e(t){var r,n=this;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Hw(t,"message"),$w(t),r=Date.now(),e.abrupt("return",this._rtmClient.sendServerMessage(t).then((function(e){n._messageStatisticsObserver.countServerMessage(!0,!0,r,e)})).catch((function(e){throw n._messageStatisticsObserver.countServerMessage(!1,!0,r,e),e})));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return _.apply(this,arguments)})},{key:"startCloudProxy",value:function(e){if(this._room)throw new cA(aA.START_CLOUD_PROXY_AFTER_JOIN,"[startCloudProxy] should be invoke before join room ");Vq.print("startCloudProxy()",e),Fw(e.logProxy,"logProxy"),Fw(e.accessProxy,"accessProxy"),Fw(e.configProxy,"configProxy"),this._originIceConfigRequestUrls=yN("ICE_CONFIG_REQUEST_URLS"),this._originLogServerUrl=yN("LOG_SERVER_URL"),this._originConfigServerUrls=yN("CONFIG_REQUEST_DOMAINS"),gN("ICE_CONFIG_REQUEST_URLS",e.accessProxy),gN("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)),gN("CONFIG_REQUEST_DOMAINS",[e.configProxy]),this._useCloudProxy=!0}},{key:"stopCloudProxy",value:function(){if(this._room)throw new cA(aA.STOP_CLOUD_PROXY_BEFORE_LEAVE,"[stopCloudProxy] should be invoke after leave room ");Vq.print("stopCloudProxy()"),gN("ICE_CONFIG_REQUEST_URLS",[]),gN("LOG_SERVER_URL",this._originLogServerUrl),gN("CONFIG_REQUEST_DOMAINS",this._originConfigServerUrls),this._useCloudProxy=!1,this._startCloudProxyTimestamp=void 0}},{key:"startPushPublicStream",value:(v=Sm(gm().mark((function e(t,r){var n,i,o,a=this;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Vq.print("startPushPublicStream()","publicStreamId: %o, publicStreamParam: %o",t,r),Yw(t),this._assertNotInRoom(),!this._publicStreamIds.get(t)){e.next=5;break}throw new cA(aA.REPEAT_PUSH,"repeat push public media stream");case 5:return o=SN(t,"started",r),e.abrupt("return",null===(n=this._room)||void 0===n||null===(i=n.publicStreamControlMessage(o))||void 0===i?void 0:i.then((function(){a._publicStreamIds.set(t,t)})));case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return v.apply(this,arguments)})},{key:"updatePublicStreamParam",value:(p=Sm(gm().mark((function e(t,r){var n,i;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Vq.print("startPushPublicStream()","publicStreamId: %o, publicStreamParam: %o",t,r),Yw(t),this._assertNotInRoom(),i=SN(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 p.apply(this,arguments)})},{key:"stopPushPublicStream",value:(f=Sm(gm().mark((function e(t){var r,n=this;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Vq.print("startPushPublicStream()","publicStreamId: %o",t),Yw(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 f.apply(this,arguments)})},{key:"startPlayPublicStream",value:(h=Sm(gm().mark((function e(t){var r,n,i,o,a,s,c=this;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Yw(t),this._publicStreamManager){e.next=8;break}return this._publicStreamManager=new mq(this.id,this._appId,{businessId:this._businessId}),this._publicStreamManager.on(jV.RESUBSCRIBE,(function(e){var t=e.stream;if(t){var r,n=c._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=c._publicStreamVideoPlayer.get(t.streamId);o&&t.videoTrack&&o.playVideo(null===(i=e.stream)||void 0===i?void 0:i.videoTrack)}})),null===(r=this._publicStreamManager)||void 0===r||r.on("onRemoteStreamStats",(function(e){e.publicStreamId=e.userId,delete e.userId,delete e.isScreen,c.safeEmit(Gd.onPublicStreamStats,e)})),null===(n=this._publicStreamManager)||void 0===n||n.on(jV.ON_SEI_MESSAGED_RECEIVED,(function(e){c.safeEmit(Gd.onPublicStreamSEIMessageReceived,e)})),e.next=8,this._publicStreamManager.connect();case 8:return e.next=10,this._publicStreamManager.startPlayPublicStream(t);case 10:i=e.sent,(o=this._publicStreamVideoPlayer.get(t))&&null!=i&&i.videoTrack&&o.playVideo(i.videoTrack,i),!(a=this._publicStreamAudioPlayer.get(t))&&null!=i&&i.audioTrack&&(a=new pG(t,{muted:(null===(s=this._config)||void 0===s?void 0:s.autoPlayPolicy)===xd.VIDEO_ONLY,isScreen:!1}),this._initPlayerEvents(a,!0),a.playAudio(i.audioTrack),this._publicStreamAudioPlayer.set(t,a));case 15:case"end":return e.stop()}}),e,this)}))),function(e){return h.apply(this,arguments)})},{key:"stopPlayPublicStream",value:(l=Sm(gm().mark((function e(t){var r;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._publicStreamManager){e.next=2;break}return e.abrupt("return");case 2:this._publicStreamManager.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 l.apply(this,arguments)})},{key:"setAudioProfile",value:(d=Sm(gm().mark((function e(t){return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:Vq.print("setAudioProfile()","profile: %o",t),this._shouldUpdateAudioConf("setAudioProfile")&&this._audioProfileManager.setAudioProfile(t);case 2:case"end":return e.stop()}}),e,this)}))),function(e){return d.apply(this,arguments)})},{key:"setPublicStreamVideoPlayer",value:function(e,t){var r,n,i,o;Vq.print("setPublicStreamVideoPlayer()","publicStreamId: %o, videoPlayerOption: %o",e,t);var a=this._publicStreamVideoPlayer.get(e);if(null===(r=a)||void 0===r||r.destroy(),null!=t&&t.renderDom){a=new fG(sd(sd({},t),{},{userId:e})),this._initPlayerEvents(a,!0),this._publicStreamVideoPlayer.set(e,a);var s=null===(n=this._publicStreamManager)||void 0===n||null===(i=n.remoteStreams)||void 0===i?void 0:i.get(e);null!=s&&s.videoTrack&&(null===(o=this._config)||void 0===o?void 0:o.autoPlayPolicy)!==xd.PLAY_MANUALLY&&a.playVideo(s.videoTrack,s)}else this._publicStreamVideoPlayer.delete(e)}},{key:"setDummyCaptureImagePath",value:(u=Sm(gm().mark((function e(t,r){var n=this;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new H_((function(e,i){Fw(r,"filePath");var o=new Image;o.crossOrigin="anonymous",o.src=r,o.onload=function(){t===md.STREAM_INDEX_MAIN?n._dummyMainImage=o:n._dummyScreenImage=o;try{n._updateDummyCaptureImage(t),e()}catch(r){i(new cA(aA.UNEXPECTED_ERROR,r.message))}},o.onerror=function(){i(new cA(aA.UNEXPECTED_ERROR,"Load image error"))}})));case 1:case"end":return e.stop()}}),e)}))),function(e,t){return u.apply(this,arguments)})},{key:"_updateDummyCaptureImage",value:function(e){var t,r;if(e===md.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"),s=Lw(r.width),c=Lw(r.height);if(!a)throw new cA(aA.UNEXPECTED_ERROR,"Not support canvas");!s||!c||t.width<=s&&t.height<=c?(n=t.width,i=t.height):(n=Math.min(s,t.width*c/t.height),i=Math.min(c,t.height*s/t.width)),o.width=n,o.height=i,a.drawImage(t,0,0,t.width,t.height,0,0,n,i);var u=window.setInterval((function(){t&&a.drawImage(t,0,0,t.width,t.height,0,0,n,i)}),200);e===md.STREAM_INDEX_MAIN?(clearInterval(this._dummyMainTimer),this._dummyMainTimer=u):(clearInterval(this._dummyScreenTimer),this._dummyScreenTimer=u);var d,l,h,f,p=o.captureStream(5).getVideoTracks()[0];if(e===md.STREAM_INDEX_MAIN){if(this._localImgVideoTrack=p,null!==(d=this._localVideoTrack)&&void 0!==d&&d.dummy)null===(l=this._localVideoTrack)||void 0===l||l.setTrack(this._localImgVideoTrack,this._extensionManager)}else if(this._localImgScreenTrack=p,null!==(h=this._localScreenVideoTrack)&&void 0!==h&&h.dummy)null===(f=this._localScreenVideoTrack)||void 0===f||f.setTrack(this._localImgScreenTrack,this._extensionManager)}}},{key:"registerExtension",value:(c=Sm(gm().mark((function e(t){return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.monitor=Wx,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 c.apply(this,arguments)})},{key:"defaultTranscoding",value:function(){return JSON.parse(hk(Dq.getDefaultValue()))}},{key:"_updatePublish",value:(s=Sm(gm().mark((function e(){var t,r,n,i=arguments;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=i.length>0&&void 0!==i[0]?i[0]:{},Vq.print("_updatePublish()","config: %o",t),r={mediaType:void 0,invokeByJoinRoom:!1,pubState:HV.PUB},t=sd(sd({},r),t),this._visibility){e.next=6;break}throw new cA(aA.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===JV.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 cA)){e.next=23;break}throw e.t0;case 23:throw new cA(aA.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 s.apply(this,arguments)})},{key:"startAudioPlaybackDeviceTest",value:(a=Sm(gm().mark((function e(t,r){return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Vq.print("startAudioPlaybackDeviceTest()","filePath: %o, indicationInterval: %o",t,r),Fw(t,"filePath"),Vw(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 a.apply(this,arguments)})},{key:"stopAudioPlaybackDeviceTest",value:function(){Vq.print("stopAudioPlaybackDeviceTest()"),this._audioDeviceManager.stopAudioPlaybackDeviceTest()}},{key:"startAudioDeviceRecordTest",value:(o=Sm(gm().mark((function e(t,r){return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Vq.print("startAudioDeviceRecordTest()","indicationInterval: %o",t),Vw(t,"indicationInterval"),e.next=4,this._audioDeviceManager.startAudioDeviceRecordTest(t,r);case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return o.apply(this,arguments)})},{key:"stopAudioDeviceRecordAndPlayTest",value:function(){Vq.print("stopAudioDeviceRecordAndPlayTest()"),this._audioDeviceManager.stopAudioDeviceRecordAndPlayTest()}},{key:"stopAudioDevicePlayTest",value:function(){Vq.print("stopAudioDevicePlayTest()"),this._audioDeviceManager.stopAudioDevicePlayTest()}},{key:"setRemoteUserPriority",value:function(e,t){var r;Vq.print("setRemoteUserPriority()","userId: %o, priority: %o",e,t);try{Ww(e),Bw(t,"priority",[Ad.HIGH,Ad.MEDIUM,Ad.LOW])}catch(n){return console.warn(n),!1}return this._userPriorityMap.set(e,t),null===(r=this._room)||void 0===r||r.updateRemoteUserPriority(e),!0}},{key:"takeLocalSnapshot",value:(i=Sm(gm().mark((function e(t){var r,n;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Vq.print("takeLocalSnapshot()","streamIndex: %o",t),Bw(t,"streamIndex",[md.STREAM_INDEX_MAIN,md.STREAM_INDEX_SCREEN]),r=t===md.STREAM_INDEX_MAIN?this.localVideoTrack:this.localScreenVideoTrack){e.next=5;break}throw new cA(aA.INVOKED_BEFORE_CAPTURE,"capture first");case 5:return n=t===md.STREAM_INDEX_MAIN?this._videoPlayer:this._screenPlayer,e.abrupt("return",kq(r.getTrack("preprocessing"),(null==n?void 0:n.mirrorType)===Ed.MIRROR_TYPE_RENDER,n));case 7:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"takeRemoteSnapshot",value:(n=Sm(gm().mark((function e(t,r){var n,i,o,a,s,c;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Vq.print("takeRemoteSnapshot()","id: %o, streamIndex: %o",t,r),Fw(t,"id"),Bw(r,"streamIndex",[md.STREAM_INDEX_MAIN,md.STREAM_INDEX_SCREEN]),c=(null===(n=this._room)||void 0===n||null===(i=n.remoteStreams.get(t))||void 0===i||null===(o=yb(i).call(i,(function(e){return e.isScreen===(r===md.STREAM_INDEX_SCREEN)})))||void 0===o?void 0:o.videoTrack)||(null===(a=this._publicStreamManager)||void 0===a||null===(s=a.remoteStreams.get(t))||void 0===s?void 0:s.videoTrack)){e.next=6;break}throw new cA(aA.STREAM_NOT_EXIST,"stream not exist");case 6:return e.abrupt("return",kq(c.getTrack(),!1,r===md.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){Vq.print("setSubscribeFallbackOption()","option: %o",e);try{Bw(e,"option",[Rd.DISABLE,Rd.VIDEO_STREAM_LOW,Rd.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===md.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 oV&&r.mixedAudioTrack?r.mixedAudioTrack:r.getTrack("preprocessing");if(o){var a=n();return Nq(o,"enabled",this._reportMsTrackEvent.bind(this,"enabled",(null==a?void 0:a.streamId)||"","getLocalStreamTrack",t)),Nq(o,"readyState",(function(e){"ended"===e&&(Pq(o,"enabled"),Pq(o,"readyState")),i._reportMsTrackEvent("readyState",(null==a?void 0:a.streamId)||"","getLocalStreamTrack",t,e)})),o.addEventListener("ended",(function(){Pq(o,"enabled"),Pq(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===md.STREAM_INDEX_MAIN)s=yb(a).call(a,(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=yb(a).call(a,(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 Nq(h,"enabled",this._reportMsTrackEvent.bind(this,"enabled",f,"getRemoteStreamTrack",r)),Nq(h,"readyState",(function(e){"ended"===e&&(Pq(h,"enabled"),Pq(h,"readyState")),o._reportMsTrackEvent("readyState",f,"getRemoteStreamTrack",r,e)})),h.addEventListener("ended",(function(){Pq(h,"enabled"),Pq(h,"readyState")})),h}}}}},{key:"getPublicStreamTrack",value:function(e,t){var r=this;if(this._publicStreamManager&&this._publicStreamManager.remoteStreams){var n=this._publicStreamManager.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 Nq(o,"enabled",this._reportMsTrackEvent.bind(this,"enabled",a,"getPublicStreamTrack",t)),Nq(o,"readyState",(function(e){"ended"===e&&(Pq(o,"enabled"),Pq(o,"readyState")),r._reportMsTrackEvent("readyState",a,"getPublicStreamTrack",t,e)})),o.addEventListener("ended",(function(){Pq(o,"enabled"),Pq(o,"readyState")})),o}}}}}},{key:"setRemoteStreamRenderSync",value:function(e){return!this._room&&(this._avSync=!!e,!0)}},{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"}Wx.rtcInvokeStatus(o,0,r,t||"",0,{direction:"getLocalStreamTrack"===r?"up":"down"})}},{key:"_updateScreenPublish",value:(r=Sm(gm().mark((function e(){var t,r,n,i=arguments;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=i.length>0&&void 0!==i[0]?i[0]:{},Vq.print("_updateScreenPublish()"),r={mediaType:void 0,pubState:HV.PUB},t=sd(sd({},r),t),e.next=6,this._pubLock.lock();case 6:if(n=e.sent,this._room&&this._room.connectionState===JV.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 cA)){e.next=21;break}throw e.t0;case 21:throw new cA(aA.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){Vq.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;if(!o){var s;o=new pG(r,{muted:(null===(s=this._config)||void 0===s?void 0:s.autoPlayPolicy)===xd.VIDEO_ONLY,isScreen:n}),this._initPlayerEvents(o,!1,n?md.STREAM_INDEX_SCREEN:md.STREAM_INDEX_MAIN),i.set(r,o);var c=this._audioDeviceManager.getSinkId();c&&o.setPlaybackDevice(c)}(null===(a=this._config)||void 0===a?void 0:a.autoPlayPolicy)!==xd.PLAY_MANUALLY&&o.playAudio(e.audioTrack),dw&&mw&&(t=this._remoteAudioPlayer,Cq&&clearTimeout(Cq),Cq=setTimeout((function(){var e,r=qT(t);try{for(r.s();!(e=r.n()).done;){var n=WT(e.value,2),i=n[0],o=n[1];null!=i&&oA(i).call(i,"mux")&&o.pause()}}catch(l){r.e(l)}finally{r.f()}var a,s=qT(t);try{for(s.s();!(a=s.n()).done;){var c=WT(a.value,2),u=c[0],d=c[1];null!=u&&oA(u).call(u,"mux")&&d.manuallyPlay()}}catch(l){s.e(l)}finally{s.f()}}),2e3))}else{var u;null===(u=o)||void 0===u||u.stop()}}},{key:"_updateVideoPlayerState",value:function(e){var t;Vq.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)!==xd.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=aV.NONE;if(i&&(s|=gd.AUDIO),a&&(s|=gd.VIDEO),s){var c;if(null!=t&&t.isScreen)this.safeEmit(Gd.onUserPublishScreen,{userId:t.userId,mediaType:s});else this.safeEmit(Gd.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(Gd.onUserStartAudioCapture,{userId:t.userId}),o&&this.safeEmit(Gd.onUserStartVideoCapture,{userId:t.userId}))}}},{key:"_handleAutoSubscribe",value:function(e,t){var r,n,i=aV.NONE;if(null!==(r=this._roomConfig)&&void 0!==r&&r.isAutoSubscribeAudio&&(i|=gd.AUDIO),null!==(n=this._roomConfig)&&void 0!==n&&n.isAutoSubscribeVideo&&(i|=gd.VIDEO),i){var o,a;if(t&&ww(i))null===(o=e.observer)||void 0===o||o.setAutoSubscribeAudio(!0);if(t&&Cw(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=Hq[e.reason])&&void 0!==t?t:yd.STREAM_REMOVE_REASON_OTHER,o=n.isScreen?Gd.onUserUnpublishScreen:Gd.onUserUnpublishStream,a=aV.NONE;n.attributes.audiostream&&(a|=gd.AUDIO),n.attributes.videostream&&(a|=gd.VIDEO),a!==aV.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(Gd.onUserJoined,e)}},{key:"_onUserLeave",value:function(e){this.safeEmit(Gd.onUserLeave,e)}},{key:"_onRoomError",value:function(e){var t;this.safeEmit(Gd.onError,e),null===(t=this._room)||void 0===t||t.destroy(),this._room=void 0}},{key:"_onNetworkQuality",value:function(){for(var e,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];this.safeEmit.apply(this,Im(e=[Gd.onNetworkQuality]).call(e,r))}},{key:"_onConnectionStateChange",value:function(e){if(void 0!==this._startCloudProxyTimestamp&&this._useCloudProxy&&e.state===Sd.CONNECTION_STATE_CONNECTED&&this.safeEmit(Gd.onCloudProxyConnected,{interval:Date.now()-this._startCloudProxyTimestamp}),this.safeEmit(Gd.onConnectionStateChanged,e),e.state===Sd.CONNECTION_STATE_RECONNECTING){var t,r=qT(this._remoteAudioPlayer);try{for(r.s();!(t=r.n()).done;){var n=WT(t.value,2),i=n[0],o=n[1];null!=i&&oA(i).call(i,"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(Gd.onVideoDeviceStateChanged,e)}},{key:"_onAudioDeviceStateChange",value:function(e){this.safeEmit(Gd.onAudioDeviceStateChanged,e)}},{key:"_onUserPublishStateChange",value:function(e){var t,r=e.userId,n=e.isScreen,i=e.mediaType,o=e.pubState,a=e.remoteStream,s={userId:r,mediaType:i};n?o===HV.PUB?this.safeEmit(Gd.onUserPublishScreen,s):this.safeEmit(Gd.onUserUnpublishScreen,sd(sd({},s),{},{reason:yd.STREAM_REMOVE_REASON_UNPUBLISH})):o===HV.PUB?(s.videoStreamDescriptions=null==a||null===(t=a.attributes)||void 0===t?void 0:t.videoDescriptions,this.safeEmit(Gd.onUserPublishStream,s),this._handleAutoSubscribe(a,!0)):this.safeEmit(Gd.onUserUnpublishStream,sd(sd({},s),{},{reason:yd.STREAM_REMOVE_REASON_UNPUBLISH}))}},{key:"_onCustomMessage",value:function(e){var t=e.message;e.binary?this.safeEmit(Gd.onRoomBinaryMessageReceived,{userId:e.clientId,message:t}):this.safeEmit(Gd.onRoomMessageReceived,{userId:e.clientId,message:t})}},{key:"_onUserMessageReceived",value:function(e){this._messageStatisticsObserver.recvP2PMessage(e.userId),this.safeEmit(Gd.onUserMessageReceived,e)}},{key:"_onUserBinaryMessageReceived",value:function(e){this._messageStatisticsObserver.recvP2PMessage(e.userId),this.safeEmit(Gd.onUserBinaryMessageReceived,e)}},{key:"_onLiveTranscodingResult",value:function(e){this.safeEmit(Gd.onLiveTranscodingResult,e)}},{key:"_onStreamMixingEvent",value:function(e){this.safeEmit(Gd.onStreamMixingEvent,e)}},{key:"_onUserTokenWillExpire",value:function(){this.safeEmit(Gd.onTokenWillExpire)}},{key:"_onPushPublicStreamResult",value:function(e){this.safeEmit(Gd.onPushPublicStreamResult,e)}},{key:"_handleRTMClient",value:function(e){var t=this;e.on("onUserMessageReceivedOutsideRoom",(function(e){t._messageStatisticsObserver.recvP2POutRoomMessage(e.userId),t.safeEmit(Gd.onUserMessageReceivedOutsideRoom,e)})),e.on("onUserBinaryMessageReceivedOutsideRoom",(function(e){t._messageStatisticsObserver.recvP2POutRoomMessage(e.userId),t.safeEmit(Gd.onUserBinaryMessageReceivedOutsideRoom,e)})),e.on("onUserDisconnection",(function(){t.safeEmit(Gd.onError,{errorCode:aA.RTM_DUPLICATE_LOGIN})})),e.on("onRTMTokenError",(function(){t.safeEmit(Gd.onError,{errorCode:aA.RTM_TOKEN_ERROR})})),e.on("onServerParamsSetResult",(function(e){t.safeEmit(Gd.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(Gd.onAudioPlaybackDeviceTestVolume,t)}))}},{key:"_assertNotInRoom",value:function(){if(!this._room||this._room.connectionState!==JV.CONNECTED)throw new cA(aA.NOT_CONNECTED_YET,"server not connected")}},{key:"_checkMediaType",value:function(e){Bw(e,"mediaType",[gd.AUDIO,gd.VIDEO,gd.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=Sm(gm().mark((function e(t){var r,n;return gm().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)})},{key:"_shouldUpdateAudioConf",value:function(e){var t,r=(null===(t=this._room)||void 0===t?void 0:t.hasPublished)||this._localAudioTrack&&this._localAudioTrack.sourceType===bU.INTERNAL;if(r){var n="engine.".concat(e," should be called before publishing or capturing.");console.warn("[RTC WebSDK]: "+n),iN(e,n)}return!r}}]),ve}(IC),od(Oq,"GUID",1),Oq),Bq=Fq;Uq([rN()],Bq.prototype,"updateToken",1),Uq([rN()],Bq.prototype,"setVideoCaptureDevice",1),Uq([rN()],Bq.prototype,"setAudioCaptureDevice",1),Uq([rN()],Bq.prototype,"joinRoom",1),Uq([rN()],Bq.prototype,"leaveRoom",1),Uq([rN()],Bq.prototype,"destroy",1),Uq([rN()],Bq.prototype,"publishStream",1),Uq([rN()],Bq.prototype,"unpublishStream",1),Uq([rN()],Bq.prototype,"publishScreen",1),Uq([rN()],Bq.prototype,"unpublishScreen",1),Uq([rN()],Bq.prototype,"subscribeStream",1),Uq([rN()],Bq.prototype,"unsubscribeStream",1),Uq([rN()],Bq.prototype,"subscribeScreen",1),Uq([rN()],Bq.prototype,"unsubscribeScreen",1),Uq([rN()],Bq.prototype,"setRemoteVideoConfig",1),Uq([rN()],Bq.prototype,"startVideoCapture",1),Uq([rN()],Bq.prototype,"stopVideoCapture",1),Uq([rN()],Bq.prototype,"startAudioCapture",1),Uq([rN()],Bq.prototype,"stopAudioCapture",1),Uq([rN()],Bq.prototype,"getAudioMixingManager",1),Uq([rN()],Bq.prototype,"startScreenCapture",1),Uq([rN()],Bq.prototype,"stopScreenCapture",1),Uq([rN()],Bq.prototype,"setLocalVideoPlayer",1),Uq([rN()],Bq.prototype,"startLiveTranscoding",1),Uq([rN()],Bq.prototype,"updateLiveTranscoding",1),Uq([rN()],Bq.prototype,"stopLiveTranscoding",1),Uq([rN()],Bq.prototype,"startSubtitle",1),Uq([rN()],Bq.prototype,"stopSubtitle",1),Uq([rN()],Bq.prototype,"setBusinessId",1),Uq([rN()],Bq.prototype,"setUserVisibility",1),Uq([rN()],Bq.prototype,"setRemoteVideoPlayer",1),Uq([rN()],Bq.prototype,"setLocalVideoMirrorType",1),Uq([rN()],Bq.prototype,"setAudioPlaybackDevice",1),Uq([rN()],Bq.prototype,"play",1),Uq([rN()],Bq.prototype,"pauseAllSubscribedStream",1),Uq([rN()],Bq.prototype,"resumeAllSubscribedStream",1),Uq([rN()],Bq.prototype,"sendUserMessage",1),Uq([rN()],Bq.prototype,"sendUserBinaryMessage",1),Uq([rN()],Bq.prototype,"sendRoomMessage",1),Uq([rN()],Bq.prototype,"sendRoomBinaryMessage",1),Uq([rN()],Bq.prototype,"setAudioCaptureConfig",1),Uq([Pw("4.51"),rN()],Bq.prototype,"setVideoCaptureConfig",1),Uq([rN()],Bq.prototype,"enableSimulcastMode",1),Uq([rN()],Bq.prototype,"setVideoEncoderConfig",1),Uq([rN()],Bq.prototype,"setScreenEncoderConfig",1),Uq([rN()],Bq.prototype,"sendSEIMessage",1),Uq([Pw("4.42"),rN()],Bq.prototype,"setAudioVolumeIndicationInterval",1),Uq([rN()],Bq.prototype,"enableAudioPropertiesReport",1),Uq([rN()],Bq.prototype,"setVideoSourceType",1),Uq([rN()],Bq.prototype,"setExternalVideoTrack",1),Uq([rN()],Bq.prototype,"setAudioSourceType",1),Uq([rN()],Bq.prototype,"setExternalAudioTrack",1),Uq([rN("rtm")],Bq.prototype,"login",1),Uq([rN("rtm")],Bq.prototype,"logout",1),Uq([rN("rtm")],Bq.prototype,"updateLoginToken",1),Uq([rN("rtm")],Bq.prototype,"getPeerOnlineStatus",1),Uq([rN("rtm")],Bq.prototype,"sendUserMessageOutsideRoom",1),Uq([rN("rtm")],Bq.prototype,"sendUserBinaryMessageOutsideRoom",1),Uq([rN("rtm")],Bq.prototype,"setServerParams",1),Uq([rN("rtm")],Bq.prototype,"sendServerMessage",1),Uq([rN("rtm")],Bq.prototype,"sendServerBinaryMessage",1),Uq([rN()],Bq.prototype,"startCloudProxy",1),Uq([rN()],Bq.prototype,"stopCloudProxy",1),Uq([rN()],Bq.prototype,"startPushPublicStream",1),Uq([rN()],Bq.prototype,"updatePublicStreamParam",1),Uq([rN()],Bq.prototype,"stopPushPublicStream",1),Uq([rN("outsideRoom","streamId")],Bq.prototype,"startPlayPublicStream",1),Uq([rN("outsideRoom","streamId")],Bq.prototype,"stopPlayPublicStream",1),Uq([rN()],Bq.prototype,"setAudioProfile",1),Uq([rN("outsideRoom")],Bq.prototype,"setPublicStreamVideoPlayer",1),Uq([rN()],Bq.prototype,"setDummyCaptureImagePath",1),Uq([rN()],Bq.prototype,"registerExtension",1),Uq([rN()],Bq.prototype,"startAudioPlaybackDeviceTest",1),Uq([rN()],Bq.prototype,"stopAudioPlaybackDeviceTest",1),Uq([rN()],Bq.prototype,"startAudioDeviceRecordTest",1),Uq([rN()],Bq.prototype,"stopAudioDeviceRecordAndPlayTest",1),Uq([rN()],Bq.prototype,"stopAudioDevicePlayTest",1),Uq([rN()],Bq.prototype,"setRemoteUserPriority",1),Uq([rN()],Bq.prototype,"takeLocalSnapshot",1),Uq([rN()],Bq.prototype,"takeRemoteSnapshot",1),Uq([rN()],Bq.prototype,"setSubscribeFallbackOption",1),Uq([rN()],Bq.prototype,"getLocalStreamTrack",1),Uq([rN()],Bq.prototype,"getRemoteStreamTrack",1),Uq([rN()],Bq.prototype,"getPublicStreamTrack",1),Uq([rN()],Bq.prototype,"setRemoteStreamRenderSync",1);var jq,Gq,Hq={"client unpublished":yd.STREAM_REMOVE_REASON_UNPUBLISH,"publish failed":yd.STREAM_REMOVE_REASON_PUBLISH_FAILED,"stream removed":yd.STREAM_REMOVE_REASON_KEEP_LIVE_FAILED,"client disconnected":yd.STREAM_REMOVE_REASON_CLIENT_DISCONNECTED,"client republish":yd.STREAM_REMOVE_REASON_REPUBLISH},zq=new bC("VERTC",0);gC.storeKey=Im(jq="".concat(Date.now(),"-")).call(jq,hN.getDeviceId()),[Jx,Zx,$x].forEach((function(e){var t;return e.setStats({rtc_sdk_version:mN.VERSION,product_line:hx.RTC,report_version:fx.W_5,os:px.WEB,device_id:hN.getDeviceId(),log_cache_key:gC.storeKey,user_agent:aw()?"":null===(t=navigator)||void 0===t?void 0:t.userAgent})})),Hj.setStats({rtc_sdk_version:mN.VERSION,log_cache_key:gC.storeKey});var Kq=function(e,t){return zq.print("createEngine","Invoke VERTC.createEngine"),Fw(e,"appId"),[Jx,Zx,$x].forEach((function(r){return r.setStats({rtc_app_id:e,auto_play_policy:null==t?void 0:t.autoPlayPolicy})})),Hj.setStats({rtc_app_id:e}),Wx.sdkInitEngine(Date.now(),Bx.BEGIN),new Bq(e,t)},Xq=function(e){if(zq.print("destroyEngine","Invoke VERTC.destroyEngine"),!(e instanceof Bq))throw new cA(aA.INVALID_ENGINE,"Invalid engine object");e.destroy(),Wx.sdkInitEngine(Date.now(),Bx.END)},qq=function(){var e=Sm(gm().mark((function e(){return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",_U.enumerateDevices());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Wq=function(){var e=Sm(gm().mark((function e(){var t,r,n,i,o,a,s=arguments;return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=s.length>0&&void 0!==s[0]?s[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,_U.getPermissions({video:!0,force:!0});case 7:o=e.sent,i.video=o.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,_U.getPermissions({audio:!0,force:!0});case 17:a=e.sent,i.audio=a.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)}}(),Yq=function(){var e=Sm(gm().mark((function e(){return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",_U.enumerateAudioCaptureDevices());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Qq=function(){var e=Sm(gm().mark((function e(){return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",_U.enumerateVideoCaptureDevices());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Jq=function(){var e=Sm(gm().mark((function e(){return gm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",_U.enumerateAudioPlaybackDevices());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Zq=function(){return mN.VERSION},$q=function(){return Wx.rtcSdkApiCall("isSupported",0,""),QM()},eW=function(){return Wx.rtcSdkApiCall("getSupportedCodecs",0,""),ZM()},tW=function(e){var t=e.logLevel,r=e.LogfileSize;t&&(gC.logLevel=t),r&&(gC.LogfileSize=r)},rW=function(e){gC.download(e)};return!aw()&&Wm(Gq=location.search).call(Gq,"_rtc_autotest_"),sd(sd(sd(sd({},new(zd((function e(){Kd(this,e),od(this,"getSdkVersion",Zq),od(this,"createEngine",Kq),od(this,"destroyEngine",Xq),od(this,"enumerateDevices",qq),od(this,"enableDevices",Wq),od(this,"enumerateAudioCaptureDevices",Yq),od(this,"enumerateVideoCaptureDevices",Qq),od(this,"enumerateAudioPlaybackDevices",Jq),od(this,"getParameter",yN),od(this,"setParameter",gN),od(this,"isSupported",$q),od(this,"getSupportedCodecs",eW),od(this,"events",Gd),od(this,"ErrorCode",aA),od(this,"platform","BytePlus"),od(this,"_monitor",Wx),od(this,"_rtmMonitor",Yx),od(this,"downloadLog",rW),od(this,"setLogConfig",tW)})))),Ud),jd),{},{events:Gd})}));
|