@byteplus/rtc 4.49.7 → 4.49.9

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/index.min.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * Copyright (c) 2020 The BytePlusRTC project authors. All Rights Reserved.
3
3
  * @brief BytePlusRTC Advance API
4
- * version: 4.49.7
4
+ * version: 4.49.9
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.7",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.7",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,s;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r={},n=t.publicIPs,i=t.certFingerprint,a=t.iceParams,s=t.iceConfig,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,s),r.setup="active",r.iceOptions="renomination",e.abrupt("return",r);case 12:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function jG(e,t){if(!Array.isArray(e))return[];var r=0,n=2130706431,o=[];return e.forEach((function(e){var a={component:1,ip:e.ip,type:"host",generation:e.generation};e.udpPorts&&!t.tcpOnly&&e.udpPorts.forEach((function(e){o.push(i(i({},a),{},{foundation:r++,transport:"udp",port:e,priority:n}))})),e.tcpPorts&&e.tcpPorts.forEach((function(e){o.push(i(i({},a),{},{foundation:r++,transport:"tcp",port:e,tcptype:"passive",priority:2130705431}))}))})),o}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,_,m;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(),(v=r.getPluginByName(VH.PRE_PROCESSING,"RTCAIAnsExtension"))&&(v.isOpen()?(t.autoGainControl=!0,t.noiseSuppression=!1):t.noiseSuppression=!0),e.next=15,PH.getUserMedia({audio:t});case 15:a=e.sent,PB.rtcVideoCaptureEvent({event_type:OB.START_CAPTURE_RESULT,media_device_id:s,reason:xB.SUCCESS,elapse:fP()-p}),e.next=23;break;case 19:throw e.prev=19,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 23:return _=a.getAudioTracks()[0],jH.set(_,a),m=new YH(_,hP()),e.next=28,m.generatePreProcessingTrack(r);case 28:return e.abrupt("return",m);case 29:case"end":return e.stop()}}),e,null,[[8,19]])})))).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:"_addListenExtensionEvent",value:function(e){var t=this;e.on("re-capture-audio",(function(){t.stopAudioCapture().then((function(){t.startAudioCapture()}))})),e.on("re-capture-video",(function(){t.stopVideoCapture().then((function(){t.startVideoCapture()}))}))}},{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),this._addListenExtensionEvent(t);case 7: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"}))}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(v0){}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(v0){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(v0){i=!0,n=v0}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(v0){sh(n,"throw",v0)}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(v0){}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(v0){}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(v0){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(v0){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(v0){}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(v0){return v0 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(v0){return v0 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(v0){}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(v0){throw am?cm():sm=void 0,v0}}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(v0){return{error:!0,value:v0}}},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(v0){d&&!i&&d.exit(),u(v0)}},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(v0){Jy(r,v0,e)}})):(e.value=t,e.state=1,zy(e,!1))}catch(v0){Jy({done:!1},v0,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(v0){Jy(t,v0)}}).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(v0){}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(v0){}},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(v0){if(v0.name==iS&&25==v0.code)return v0.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(v0){}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(v0){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(v0){}if(PA[e]&&!r)return;try{return EA(PA,e,r?t:jA&&PA[e]||t)}catch(v0){}}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(v0){return 8===v0}}();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(v0){FN(e,"throw",v0)}},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(v0){}},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(v0){}}},{key:"_setCachedSize",value:function(){try{localStorage.setItem(HL,"".concat(this.cachedSize))}catch(v0){}}},{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(v0){}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(v0){return QL.print("safaEmit","safeEmit() | event listener threw an error [event:%s]:%o",e,v0),console.error(v0),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(v0){return v0 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(_0){XV=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(_0){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(v0){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(v0){}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.9",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:"",AUDIO_STALL:!0,VIDEO_STALL:!0};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.9",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(v0){r(v0)}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,s;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r={},n=t.publicIPs,i=t.certFingerprint,a=t.iceParams,s=t.iceConfig,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,s),r.setup="active",r.iceOptions="renomination",e.abrupt("return",r);case 12:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function jG(e,t){if(!Array.isArray(e))return[];var r=0,n=2130706431,o=[];return e.forEach((function(e){var a={component:1,ip:e.ip,type:"host",generation:e.generation};e.udpPorts&&!t.tcpOnly&&e.udpPorts.forEach((function(e){o.push(i(i({},a),{},{foundation:r++,transport:"udp",port:e,priority:n}))})),e.tcpPorts&&e.tcpPorts.forEach((function(e){o.push(i(i({},a),{},{foundation:r++,transport:"tcp",port:e,tcptype:"passive",priority:2130705431}))}))})),o}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(v0){}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(v0){}}}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(v0){}}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,_,m;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(),(v=r.getPluginByName(VH.PRE_PROCESSING,"RTCAIAnsExtension"))&&(v.isOpen()?(t.autoGainControl=!0,t.noiseSuppression=!1):t.noiseSuppression=!0),e.next=15,PH.getUserMedia({audio:t});case 15:a=e.sent,PB.rtcVideoCaptureEvent({event_type:OB.START_CAPTURE_RESULT,media_device_id:s,reason:xB.SUCCESS,elapse:fP()-p}),e.next=23;break;case 19:throw e.prev=19,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 23:return _=a.getAudioTracks()[0],jH.set(_,a),m=new YH(_,hP()),e.next=28,m.generatePreProcessingTrack(r);case 28:return e.abrupt("return",m);case 29:case"end":return e.stop()}}),e,null,[[8,19]])})))).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(nj.AUDIO_STALL&&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(v0){}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(v0){}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(v0){}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()}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&&this._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),"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(),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&&nj.VIDEO_STALL){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(!nj.VIDEO_STALL)return;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(v0){}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)}},{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(v0){return e}},OQ=function(e){var t=EQ(e,AQ," "),r=4;try{return _Q(t)}catch(v0){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(v0){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$=Object.defineProperty,Q$=Object.getOwnPropertyDescriptor,Z$=function(e,t,r,n){for(var i,o=n>1?void 0:n?Q$(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&&J$(t,r,o),o},$$=new YL("Engine",0),e0=function(e){f(Ge,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,je=g(Ge);function Ge(e,t){var r;return u(this,Ge),h(m(r=je.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,$$.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(Ge,[{key:"appId",get:function(){return this._appId},set:function(e){this._appId=e}},{key:"updateToken",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($$.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 Be.apply(this,arguments)})},{key:"setVideoCaptureDevice",value:(Fe=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($$.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),$$.print("setVideoCaptureDevice()","start createCameraVideoTrack..."),e.next=11,sz(r,this._extensionManager).catch((function(e){if(i._localVideoTrack&&!i._localVideoTrack.dummy)return $$.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 $$.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,$$.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 Fe.apply(this,arguments)})},{key:"setAudioCaptureDevice",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($$.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 Ve.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(Ge.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:(Ue=c(o().mark((function e(t,r,n){var a,s,c,u,d,l,h,f=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=f.length>3&&void 0!==f[3]?f[3]:{},$$.print("joinRoom()","token: %o roomId: %o, userInfo: %o, roomConfig: %o",t,r,n,a),JP(t)||HP(t,"token"),QP(r),eM(n),tM(a=aJ({isAutoPublish:!0,isAutoSubscribeAudio:!0,isAutoSubscribeVideo:!0,roomProfileType:Y.communication},a)),!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(),s=this._liveTranscodeConfig&&Y$.getStartParams(this._liveTranscodeConfig),c=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,c,s,this._useCloudProxy,null===(u=this._config)||void 0===u?void 0:u.expectedIDC);case 19:return l=e.sent,this._roomConfig=a,this._tempRoomInfo&&delete this._tempRoomInfo,null!==(d=a)&&void 0!==d&&d.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:c}),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){return Ue.apply(this,arguments)})},{key:"leaveRoom",value:(Le=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],$$.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 Le.apply(this,arguments)})},{key:"destroy",value:function(){var e,t,r;$$.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:(Me=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if($$.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 Me.apply(this,arguments)})},{key:"unpublishStream",value:(Pe=c(o().mark((function e(t,r){var n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if($$.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 Pe.apply(this,arguments)})},{key:"publishScreen",value:(Ne=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if($$.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 Ne.apply(this,arguments)})},{key:"unpublishScreen",value:(De=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return $$.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 De.apply(this,arguments)})},{key:"subscribeStream",value:(xe=c(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return $$.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 xe.apply(this,arguments)})},{key:"_subscribe",value:(Oe=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 $$.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),$$.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 Oe.apply(this,arguments)})},{key:"unsubscribeStream",value:(Ce=c(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:$$.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 Ce.apply(this,arguments)})},{key:"subscribeScreen",value:(we=c(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return $$.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 we.apply(this,arguments)})},{key:"unsubscribeScreen",value:(Re=c(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:$$.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 Re.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]}))}$$.print("subscribeStream()","due to multiChatMode return")}},{key:"setRemoteVideoConfig",value:(Ae=c(o().mark((function e(t,r){var n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return $$.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 Ae.apply(this,arguments)})},{key:"startVideoCapture",value:(Ie=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($$.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 Ie.apply(this,arguments)})},{key:"stopVideoCapture",value:(Te=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($$.print("stopVideoCapture()"),!this._cameraCapturing){e.next=5;break}return this._interruptCameraCapture=!0,$$.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 Te.apply(this,arguments)})},{key:"startAudioCapture",value:(ke=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($$.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 ke.apply(this,arguments)})},{key:"stopAudioCapture",value:(be=c(o().mark((function e(){var t,r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if($$.print("stopAudioCapture()"),!this._micCapturing){e.next=5;break}return this._interruptMicCapture=!0,$$.print("stopAudioCapture()","capturing"),e.abrupt("return");case 5:if(this._trackSourceType.audio!==w.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=7;break}throw new hN(dN.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");case 7:if(this._localAudioTrack&&(this._removeLocalTrackEvents(this._localAudioTrack),this._localAudioTrack.close()),this._localAudioTrack=void 0,this._audioMixingManager.stopAll(),this._room){e.next=12;break}return e.abrupt("return");case 12:if(!this._room.hasPublished){e.next=15;break}return e.next=15,this._updatePublish();case 15:null===(t=this._room.localStream)||void 0===t||null===(r=t.observer)||void 0===r||r.setEnableAudio(!1);case 16:case"end":return e.stop()}}),e,this)}))),function(){return be.apply(this,arguments)})},{key:"getAudioMixingManager",value:function(){return $$.print("getAudioMixingManager()"),this._audioMixingManager}},{key:"startScreenCapture",value:(Ee=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]:{},$$.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 Ee.apply(this,arguments)})},{key:"stopScreenCapture",value:(Se=c(o().mark((function e(){var t,r,n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if($$.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 Se.apply(this,arguments)})},{key:"setLocalVideoPlayer",value:function(e,t){if($$.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:(ge=c(o().mark((function e(t){var r,n,i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if($$.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 ge.apply(this,arguments)})},{key:"updateLiveTranscoding",value:(ye=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($$.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 ye.apply(this,arguments)})},{key:"stopLiveTranscoding",value:(me=c(o().mark((function e(){var t;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if($$.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 me.apply(this,arguments)})},{key:"setBusinessId",value:function(e){return $$.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:(_e=c(o().mark((function e(t){var r,n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if($$.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 _e.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){$$.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){$$.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:(ve=c(o().mark((function e(t){var r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if($$.print("setAudioPlaybackDevice()","deviceId: %s",t),HP(t,"deviceId"),void 0!==HTMLAudioElement.prototype.setSinkId){e.next=5;break}return $$.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 ve.apply(this,arguments)})},{key:"play",value:(pe=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,$$.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 pe.apply(this,arguments)})},{key:"pauseAllSubscribedStream",value:(fe=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($$.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 fe.apply(this,arguments)})},{key:"resumeAllSubscribedStream",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($$.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 he.apply(this,arguments)})},{key:"sendUserMessage",value:(le=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 le.apply(this,arguments)})},{key:"sendUserBinaryMessage",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),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 de.apply(this,arguments)})},{key:"sendRoomMessage",value:(ue=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 ue.apply(this,arguments)})},{key:"sendRoomBinaryMessage",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,!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 ce.apply(this,arguments)})},{key:"setAudioCaptureConfig",value:(se=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]:{},$$.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 se.apply(this,arguments)})},{key:"setVideoCaptureConfig",value:(ae=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]:{},$$.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 ae.apply(this,arguments)})},{key:"enableSimulcastMode",value:function(e){return $$.print("enableSimulcastMode()","enabled: %o",e),this._enableSimulcast=e,!0}},{key:"setVideoEncoderConfig",value:(ie=c(o().mark((function e(t){var r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:$$.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 ie.apply(this,arguments)})},{key:"setScreenEncoderConfig",value:(ne=c(o().mark((function e(t){var r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:$$.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 ne.apply(this,arguments)})},{key:"sendSEIMessage",value:function(e,t,r){if($$.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)$$.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 $$.print("sei message must not be empty")}},{key:"setAudioVolumeIndicationInterval",value:function(e){var t=this;$$.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]:{};$$.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:(te=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($$.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,$$.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 te.apply(this,arguments)})},{key:"setExternalVideoTrack",value:(ee=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($$.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 ee.apply(this,arguments)})},{key:"setAudioSourceType",value:($=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($$.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,$$.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 $.apply(this,arguments)})},{key:"setExternalAudioTrack",value:(Z=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($$.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 Z.apply(this,arguments)})},{key:"login",value:(J=c(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return $$.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 J.apply(this,arguments)})},{key:"logout",value:(W=c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return $$.print("logout()"),e.abrupt("return",this._rtmClient.logout());case 2:case"end":return e.stop()}}),e,this)}))),function(){return W.apply(this,arguments)})},{key:"updateLoginToken",value:(q=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return $$.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 q.apply(this,arguments)})},{key:"getPeerOnlineStatus",value:(z=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return $$.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 z.apply(this,arguments)})},{key:"sendUserMessageOutsideRoom",value:(H=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 H.apply(this,arguments)})},{key:"sendUserBinaryMessageOutsideRoom",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),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 G.apply(this,arguments)})},{key:"setServerParams",value:(j=c(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return $$.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 j.apply(this,arguments)})},{key:"sendServerMessage",value:(M=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 M.apply(this,arguments)})},{key:"sendServerBinaryMessage",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 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 P.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 ");$$.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 ");$$.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:(x=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($$.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 x.apply(this,arguments)})},{key:"updatePublicStreamParam",value:(O=c(o().mark((function e(t,r){var n,i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return $$.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 O.apply(this,arguments)})},{key:"stopPushPublicStream",value:(C=c(o().mark((function e(t){var r,n=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return $$.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 C.apply(this,arguments)})},{key:"startPlayPublicStream",value:(I=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 I.apply(this,arguments)})},{key:"stopPlayPublicStream",value:(T=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 T.apply(this,arguments)})},{key:"setAudioProfile",value:(k=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 k.apply(this,arguments)})},{key:"setPublicStreamVideoPlayer",value:function(e,t){var r,n,o,a;$$.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:(S=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 S.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:"_addListenExtensionEvent",value:function(e){var t=this;e.on("re-capture-audio",(function(){t._localAudioTrack&&t.stopAudioCapture().then((function(){t.startAudioCapture()}))})),e.on("re-capture-video",(function(){t._localVideoTrack&&!t._localVideoTrack.dummy&&t.stopVideoCapture().then((function(){t.startVideoCapture()}))}))}},{key:"registerExtension",value:(y=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),this._addListenExtensionEvent(t);case 7:case"end":return e.stop()}}),e,this)}))),function(e){return y.apply(this,arguments)})},{key:"defaultTranscoding",value:function(){return JSON.parse(JSON.stringify(Y$.getDefaultValue()))}},{key:"_updatePublish",value:(_=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]:{},$$.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 _.apply(this,arguments)})},{key:"startAudioPlaybackDeviceTest",value:(v=c(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return $$.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 v.apply(this,arguments)})},{key:"stopAudioPlaybackDeviceTest",value:function(){$$.print("stopAudioPlaybackDeviceTest()"),this._audioDeviceManager.stopAudioPlaybackDeviceTest()}},{key:"startAudioDeviceRecordTest",value:(d=c(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return $$.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 d.apply(this,arguments)})},{key:"stopAudioDeviceRecordAndPlayTest",value:function(){$$.print("stopAudioDeviceRecordAndPlayTest()"),this._audioDeviceManager.stopAudioDeviceRecordAndPlayTest()}},{key:"stopAudioDevicePlayTest",value:function(){$$.print("stopAudioDevicePlayTest()"),this._audioDeviceManager.stopAudioDevicePlayTest()}},{key:"setRemoteUserPriority",value:function(e,t){var r;$$.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:(s=c(o().mark((function e(t){var r,n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if($$.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 s.apply(this,arguments)})},{key:"takeRemoteSnapshot",value:(a=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($$.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 a.apply(this,arguments)})},{key:"setSubscribeFallbackOption",value:function(e){$$.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,o=this;if(e===L.STREAM_INDEX_MAIN?(n="video"===t?this.localVideoTrack:this.localAudioTrack,i=function(){var e;return null===(e=o._room)||void 0===e?void 0:e.localStream}):(n="video"===t?this.localScreenVideoTrack:this.localScreenAudioTrack,i=function(){var e;return null===(e=o._room)||void 0===e?void 0:e.localScreenStream}),n){var a=n instanceof bz&&n.mixedAudioTrack?n.mixedAudioTrack:n.getTrack("preprocessing");if(a){var s=i();return this._reportMsTrackEvent(a,(null==s||null===(r=s.stream)||void 0===r?void 0:r.id)||"local"),a}}}},{key:"getRemoteStreamTrack",value:function(e,t,r){var n,i,o=(null===(n=this._room)||void 0===n?void 0:n.remoteStreams.get(e))||[];if(o&&o.length){var a,s,c,u,d;if(t===L.STREAM_INDEX_MAIN)a=o.find((function(e){return!e.isScreen})),i="video"===r?null===(s=a)||void 0===s?void 0:s.videoTrack:null===(c=a)||void 0===c?void 0:c.audioTrack;else a=o.find((function(e){return e.isScreen})),i="video"===r?null===(u=a)||void 0===u?void 0:u.videoTrack:null===(d=a)||void 0===d?void 0:d.audioTrack;if(i){var l=i.getTrack();if(l&&a){var h=a.streamId;return this._reportMsTrackEvent(l,h),l}}}}},{key:"getPublicStreamTrack",value:function(e,t){if(this._outsideRoom&&this._outsideRoom.remoteStreams){var r=this._outsideRoom.remoteStreams.get(e);if(r){var n="video"===t?r.videoTrack:r.audioTrack;if(n){var i=n.getTrack();if(i){var o=r.streamId;return this._reportMsTrackEvent(i,o),i}}}}}},{key:"setRemoteStreamRenderSync",value:function(e){return!this._room&&(this._avSync=!!e,!0)}},{key:"_reportMsTrackEvent",value:function(e,t){if(!e.hookStop){e.hookStop=!0;var r=e.stop;e.stop=function(){PB.rtcInvokeStatus(t,0,"stop",t||"",0),r.call(e)}}}},{key:"_updateScreenPublish",value:(n=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]:{},$$.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 n.apply(this,arguments)})},{key:"_updateAudioPlayerState",value:function(e){$$.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;$$.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:(r=c(o().mark((function e(t){var r,n,i,a,s,c,u,d;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.stream,n=null==r?void 0:r.attributes,i=n.localaudio,a=n.audiostream,s=n.localvideo,c=n.videostream,u=kz.NONE,a&&(u|=U.AUDIO),c&&(u|=U.VIDEO),!u){e.next=11;break}return e.next=8,new Promise((function(e){return setTimeout(e)}));case 8:null!=r&&r.isScreen?this.safeEmit(oe.onUserPublishScreen,{userId:r.userId,mediaType:u}):(this.safeEmit(oe.onUserPublishStream,{userId:r.userId,mediaType:u,videoStreamDescriptions:null==r||null===(d=r.attributes)||void 0===d?void 0:d.videoDescriptions}),this._handleAutoSubscribe(r,!0)),this.safeEmit("onAddStream",{userId:r.userId,mediaType:u,isScreen:!(null==r||!r.isScreen)}),null!=r&&r.isScreen||(i&&this.safeEmit(oe.onUserStartAudioCapture,{userId:r.userId}),s&&this.safeEmit(oe.onUserStartVideoCapture,{userId:r.userId}));case 11:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{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=t0[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){var t=this;setTimeout((function(){return t.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)})}]),Ge}(ZL);Z$([GB()],e0.prototype,"updateToken",1),Z$([GB()],e0.prototype,"setVideoCaptureDevice",1),Z$([GB()],e0.prototype,"setAudioCaptureDevice",1),Z$([GB()],e0.prototype,"joinRoom",1),Z$([GB()],e0.prototype,"leaveRoom",1),Z$([GB()],e0.prototype,"destroy",1),Z$([GB()],e0.prototype,"publishStream",1),Z$([GB()],e0.prototype,"unpublishStream",1),Z$([GB()],e0.prototype,"publishScreen",1),Z$([GB()],e0.prototype,"unpublishScreen",1),Z$([GB()],e0.prototype,"subscribeStream",1),Z$([GB()],e0.prototype,"unsubscribeStream",1),Z$([GB()],e0.prototype,"subscribeScreen",1),Z$([GB()],e0.prototype,"unsubscribeScreen",1),Z$([GB()],e0.prototype,"setRemoteVideoConfig",1),Z$([GB()],e0.prototype,"startVideoCapture",1),Z$([GB()],e0.prototype,"stopVideoCapture",1),Z$([GB()],e0.prototype,"startAudioCapture",1),Z$([GB()],e0.prototype,"stopAudioCapture",1),Z$([GB()],e0.prototype,"getAudioMixingManager",1),Z$([GB()],e0.prototype,"startScreenCapture",1),Z$([GB()],e0.prototype,"stopScreenCapture",1),Z$([GB()],e0.prototype,"setLocalVideoPlayer",1),Z$([GB()],e0.prototype,"startLiveTranscoding",1),Z$([GB()],e0.prototype,"updateLiveTranscoding",1),Z$([GB()],e0.prototype,"stopLiveTranscoding",1),Z$([GB()],e0.prototype,"setBusinessId",1),Z$([GB()],e0.prototype,"setUserVisibility",1),Z$([GB()],e0.prototype,"setRemoteVideoPlayer",1),Z$([GB()],e0.prototype,"setLocalVideoMirrorType",1),Z$([GB()],e0.prototype,"setAudioPlaybackDevice",1),Z$([GB()],e0.prototype,"play",1),Z$([GB()],e0.prototype,"pauseAllSubscribedStream",1),Z$([GB()],e0.prototype,"resumeAllSubscribedStream",1),Z$([GB()],e0.prototype,"sendUserMessage",1),Z$([GB()],e0.prototype,"sendUserBinaryMessage",1),Z$([GB()],e0.prototype,"sendRoomMessage",1),Z$([GB()],e0.prototype,"sendRoomBinaryMessage",1),Z$([GB()],e0.prototype,"setAudioCaptureConfig",1),Z$([GB()],e0.prototype,"setVideoCaptureConfig",1),Z$([GB()],e0.prototype,"enableSimulcastMode",1),Z$([GB()],e0.prototype,"setVideoEncoderConfig",1),Z$([GB()],e0.prototype,"setScreenEncoderConfig",1),Z$([GB()],e0.prototype,"sendSEIMessage",1),Z$([GB()],e0.prototype,"setAudioVolumeIndicationInterval",1),Z$([GB()],e0.prototype,"enableAudioPropertiesReport",1),Z$([GB()],e0.prototype,"setVideoSourceType",1),Z$([GB()],e0.prototype,"setExternalVideoTrack",1),Z$([GB()],e0.prototype,"setAudioSourceType",1),Z$([GB()],e0.prototype,"setExternalAudioTrack",1),Z$([GB("rtm")],e0.prototype,"login",1),Z$([GB("rtm")],e0.prototype,"logout",1),Z$([GB("rtm")],e0.prototype,"updateLoginToken",1),Z$([GB("rtm")],e0.prototype,"getPeerOnlineStatus",1),Z$([GB("rtm")],e0.prototype,"sendUserMessageOutsideRoom",1),Z$([GB("rtm")],e0.prototype,"sendUserBinaryMessageOutsideRoom",1),Z$([GB("rtm")],e0.prototype,"setServerParams",1),Z$([GB("rtm")],e0.prototype,"sendServerMessage",1),Z$([GB("rtm")],e0.prototype,"sendServerBinaryMessage",1),Z$([GB()],e0.prototype,"startCloudProxy",1),Z$([GB()],e0.prototype,"stopCloudProxy",1),Z$([GB()],e0.prototype,"startPushPublicStream",1),Z$([GB()],e0.prototype,"updatePublicStreamParam",1),Z$([GB()],e0.prototype,"stopPushPublicStream",1),Z$([GB("outsideRoom","streamId")],e0.prototype,"startPlayPublicStream",1),Z$([GB("outsideRoom","streamId")],e0.prototype,"stopPlayPublicStream",1),Z$([GB()],e0.prototype,"setAudioProfile",1),Z$([GB("outsideRoom")],e0.prototype,"setPublicStreamVideoPlayer",1),Z$([GB()],e0.prototype,"setDummyCaptureImagePath",1),Z$([GB()],e0.prototype,"registerExtension",1),Z$([GB()],e0.prototype,"startAudioPlaybackDeviceTest",1),Z$([GB()],e0.prototype,"stopAudioPlaybackDeviceTest",1),Z$([GB()],e0.prototype,"startAudioDeviceRecordTest",1),Z$([GB()],e0.prototype,"stopAudioDeviceRecordAndPlayTest",1),Z$([GB()],e0.prototype,"stopAudioDevicePlayTest",1),Z$([GB()],e0.prototype,"setRemoteUserPriority",1),Z$([GB()],e0.prototype,"takeLocalSnapshot",1),Z$([GB()],e0.prototype,"takeRemoteSnapshot",1),Z$([GB()],e0.prototype,"setSubscribeFallbackOption",1),Z$([GB()],e0.prototype,"getLocalStreamTrack",1),Z$([GB()],e0.prototype,"getRemoteStreamTrack",1),Z$([GB()],e0.prototype,"getPublicStreamTrack",1),Z$([GB()],e0.prototype,"setRemoteStreamRenderSync",1);var t0={"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},r0=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 n0=function(e,t){return r0.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 e0(e,t)},i0=function(e){if(r0.print("destroyEngine","Invoke VERTC.destroyEngine"),!(e instanceof e0))throw new hN(dN.INVALID_ENGINE,"Invalid engine object");e.destroy(),PB.sdkInitEngine(Date.now(),AB.END)},o0=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)}}(),a0=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)}}(),s0=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)}}(),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.enumerateVideoCaptureDevices());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),u0=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)}}(),d0=function(){return nj.VERSION},l0=function(){return PB.rtcSdkApiCall("isSupported",0,""),Hj()},h0=function(){return PB.rtcSdkApiCall("getSupportedCodecs",0,""),Kj()},f0=function(e){var t=e.logLevel,r=e.LogfileSize;t&&(KL.logLevel=t),r&&(KL.LogfileSize=r)},p0=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",d0),h(this,"createEngine",n0),h(this,"destroyEngine",i0),h(this,"enumerateDevices",o0),h(this,"enableDevices",a0),h(this,"enumerateAudioCaptureDevices",s0),h(this,"enumerateVideoCaptureDevices",c0),h(this,"enumerateAudioPlaybackDevices",u0),h(this,"getParameter",oj),h(this,"setParameter",ij),h(this,"isSupported",l0),h(this,"getSupportedCodecs",h0),h(this,"events",oe),h(this,"ErrorCode",dN),h(this,"platform","".concat({}.PRODUCT_PLATFORM)),h(this,"_monitor",PB),h(this,"downloadLog",p0),h(this,"setLogConfig",f0)})))),ee),ie),{},{events:oe})}));