@byteplus/rtc 4.47.16 → 4.47.17
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.esm.min.js +2 -2
- package/index.min.js +2 -2
- package/package.json +1 -1
package/index.min.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Copyright (c) 2020 The BytePlusRTC project authors. All Rights Reserved.
|
|
3
3
|
* @brief BytePlusRTC Advance API
|
|
4
|
-
* version: 4.47.
|
|
4
|
+
* version: 4.47.17
|
|
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",u=i.toStringTag||"@@toStringTag";function c(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(C){c=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 R(i||[]);return n(a,"_invoke",{value:E(e,r,s)}),a}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(C){return{type:"throw",arg:C}}}e.wrap=d;var h={};function f(){}function p(){}function v(){}var _={};c(_,a,(function(){return this}));var m=Object.getPrototypeOf,y=m&&m(m(A([])));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){c(e,t,(function(e){return this._invoke(t,e)}))}))}function b(e,t){function i(n,o,a,s){var u=l(e[n],e,o);if("throw"!==u.type){var c=u.arg,d=c.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){c.value=e,a(c)}),(function(e){return i("throw",e,a,s)}))}s(u.arg)}var o;n(this,"_invoke",{value:function(e,r){function n(){return new t((function(t,n){i(e,r,t,n)}))}return o=o?o.then(n,n):n()}})}function E(e,t,r){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return{value:void 0,done:!0}}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var s=k(a,r);if(s){if(s===h)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=l(e,t,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===h)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}function k(e,t){var r=t.method,n=e.iterator[r];if(void 0===n)return t.delegate=null,"throw"===r&&e.iterator.return&&(t.method="return",t.arg=void 0,k(e,t),"throw"===t.method)||"return"!==r&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+r+"' method")),h;var i=l(n,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,h;var o=i.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,h):o:(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 R(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(T,this),this.reset(!0)}function A(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=c(v,u,"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,c(e,u,"GeneratorFunction")),e.prototype=Object.create(g),e},e.awrap=function(e){return{__await:e}},S(b.prototype),c(b.prototype,s,(function(){return this})),e.AsyncIterator=b,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var a=new b(d(t,r,n,i),o);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},S(g),c(g,u,"Generator"),c(g,a,(function(){return this})),c(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=A,R.prototype={constructor:R,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(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"),u=r.call(o,"finallyLoc");if(s&&u){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(!u)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:A(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),u=s.value}catch(c){return void r(c)}s.done?t(u):Promise.resolve(u).then(n,i)}function u(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,u,"next",e)}function u(e){s(o,n,i,a,u,"throw",e)}a(void 0)}))}}function c(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,A(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=A(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function f(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&v(e,t)}function p(e){return(p=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function v(e,t){return(v=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function _(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function m(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function y(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return m(e)}function g(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=p(e);if(t){var i=p(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return y(this,r)}}function S(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=p(e)););return e}function b(){return b="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=S(e,t);if(n){var i=Object.getOwnPropertyDescriptor(n,t);return i.get?i.get.call(arguments.length<3?e:r):i.value}},b.apply(this,arguments)}function E(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,s=[],u=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);u=!0);}catch(d){c=!0,i=d}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(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 R(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}}}}function A(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}var w=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}(w||{}),C=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}(C||{}),O=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}(O||{}),x=function(e){return e[e.CHANNEL_PROFILE_COMMUNICATION=0]="CHANNEL_PROFILE_COMMUNICATION",e[e.CHANNEL_PROFILE_LIVE_BROADCASTING=1]="CHANNEL_PROFILE_LIVE_BROADCASTING",e}(x||{}),N=function(e){return e[e.AUTO_SUBSCRIBE_MODE=0]="AUTO_SUBSCRIBE_MODE",e[e.MANUAL_SUBSCRIBE_MODE=1]="MANUAL_SUBSCRIBE_MODE",e}(N||{}),D=function(e){return e[e.SUBSCRIBE_SUCC=0]="SUBSCRIBE_SUCC",e[e.SUBSCRIBE_FAIL=1]="SUBSCRIBE_FAIL",e}(D||{}),P=function(e){return e[e.PUBLISH_SUCC=0]="PUBLISH_SUCC",e[e.PUBLISH_FAIL=1]="PUBLISH_FAIL",e}(P||{}),M=function(e){return e[e.MIRROR_MODE_OFF=0]="MIRROR_MODE_OFF",e[e.MIRROR_MODE_ON=1]="MIRROR_MODE_ON",e}(M||{}),L=function(e){return e[e.RENDER_MODE_HIDDEN=0]="RENDER_MODE_HIDDEN",e[e.RENDER_MODE_FIT=1]="RENDER_MODE_FIT",e}(L||{}),U=function(e){return e[e.STREAM_INDEX_MAIN=0]="STREAM_INDEX_MAIN",e[e.STREAM_INDEX_SCREEN=1]="STREAM_INDEX_SCREEN",e}(U||{}),V=function(e){return e[e.AUDIO=1]="AUDIO",e[e.VIDEO=2]="VIDEO",e[e.AUDIO_AND_VIDEO=3]="AUDIO_AND_VIDEO",e}(V||{}),F=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}(F||{}),B=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}(B||{}),j=function(e){return e[e.MIRROR_TYPE_NONE=0]="MIRROR_TYPE_NONE",e[e.MIRROR_TYPE_RENDER=1]="MIRROR_TYPE_RENDER",e}(j||{}),G=function(e){return e[e.domestic=0]="domestic",e[e.overseas=1]="overseas",e}(G||{}),H=function(e){return e[e.OFFLINE=0]="OFFLINE",e[e.ONLINE=1]="ONLINE",e[e.UNREACHABLE=2]="UNREACHABLE",e}(H||{}),z=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}(z||{}),q=function(e){return e[e.PREV_FRAME=0]="PREV_FRAME",e[e.OTHER_FRAME=1]="OTHER_FRAME",e}(q||{}),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||{}),W=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}(W||{}),Y=function(e){return e[e.Unknown=-1]="Unknown",e[e.SubscribeFallbackByBandwidth=0]="SubscribeFallbackByBandwidth",e[e.SubscribeRecoverByBandwidth=2]="SubscribeRecoverByBandwidth",e}(Y||{}),J=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}(J||{}),Q=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}(Q||{}),Z=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}(Z||{}),$=Object.freeze(Object.defineProperty({__proto__:null,VideoSourceType:w,AudioSourceType:C,UserOfflineReason:O,ChannelProfile:x,SubscribeMode:N,SubscribeState:D,PublishState:P,MirrorMode:M,VideoRenderMode:L,StreamIndex:U,MediaType:V,StreamRemoveReason:F,ConnectionState:B,MirrorType:j,LogChannel:G,USER_ONLINE_STATUS:H,PublicStreamType:z,PublicInterpolationMode:q,SubscribeFallbackOption:K,RemoteUserPriority:X,NetworkQuality:W,FallbackOrRecoverReason:Y,RoomProfileType:J,AudioProfileType:Q,RTCAutoPlayPolicy:Z},Symbol.toStringTag,{value:"Module"})),ee=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}(ee||{}),te=function(e){return e[e.PLAYOUT=0]="PLAYOUT",e[e.PUBLISH=1]="PUBLISH",e[e.PLAYOUT_AND_PUBLISH=2]="PLAYOUT_AND_PUBLISH",e}(te||{}),re=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}(re||{}),ne=Object.freeze(Object.defineProperty({__proto__:null,AudioMixingDualMonoMode:ee,AudioMixingType:te,AudioMixingState:re},Symbol.toStringTag,{value:"Module"})),ie=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}(ie||{}),oe="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},ae=function(e){return e&&e.Math==Math&&e},se=ae("object"==typeof globalThis&&globalThis)||ae("object"==typeof window&&window)||ae("object"==typeof self&&self)||ae("object"==typeof oe&&oe)||function(){return this}()||Function("return this")(),ue={exports:{}},ce=se,de=Object.defineProperty,le=function(e,t){try{de(ce,e,{value:t,configurable:!0,writable:!0})}catch(r){ce[e]=t}return t},he=le,fe="__core-js_shared__",pe=se[fe]||he(fe,{}),ve=pe;(ue.exports=function(e,t){return ve[e]||(ve[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 _e,me,ye=function(e){try{return!!e()}catch(t){return!0}},ge=!ye((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),Se=ge,be=Function.prototype,Ee=be.call,ke=Se&&be.bind.bind(Ee,Ee),Te=Se?ke:function(e){return function(){return Ee.apply(e,arguments)}},Ie=function(e){return null==e},Re=Ie,Ae=TypeError,we=function(e){if(Re(e))throw Ae("Can't call method on "+e);return e},Ce=we,Oe=Object,xe=function(e){return Oe(Ce(e))},Ne=xe,De=Te({}.hasOwnProperty),Pe=Object.hasOwn||function(e,t){return De(Ne(e),t)},Me=Te,Le=0,Ue=Math.random(),Ve=Me(1..toString),Fe=function(e){return"Symbol("+(void 0===e?"":e)+")_"+Ve(++Le+Ue,36)},Be="object"==typeof document&&document.all,je={all:Be,IS_HTMLDDA:void 0===Be&&void 0!==Be},Ge=je.all,He=je.IS_HTMLDDA?function(e){return"function"==typeof e||e===Ge}:function(e){return"function"==typeof e},ze=se,qe=He,Ke=function(e){return qe(e)?e:void 0},Xe=function(e,t){return arguments.length<2?Ke(ze[e]):ze[e]&&ze[e][t]},We=Xe("navigator","userAgent")||"",Ye=se,Je=We,Qe=Ye.process,Ze=Ye.Deno,$e=Qe&&Qe.versions||Ze&&Ze.version,et=$e&&$e.v8;et&&(me=(_e=et.split("."))[0]>0&&_e[0]<4?1:+(_e[0]+_e[1])),!me&&Je&&(!(_e=Je.match(/Edge\/(\d+)/))||_e[1]>=74)&&(_e=Je.match(/Chrome\/(\d+)/))&&(me=+_e[1]);var tt=me,rt=tt,nt=ye,it=!!Object.getOwnPropertySymbols&&!nt((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&rt&&rt<41})),ot=it&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,at=se,st=ue.exports,ut=Pe,ct=Fe,dt=it,lt=ot,ht=st("wks"),ft=at.Symbol,pt=ft&&ft.for,vt=lt?ft:ft&&ft.withoutSetter||ct,_t=function(e){if(!ut(ht,e)||!dt&&"string"!=typeof ht[e]){var t="Symbol."+e;dt&&ut(ft,e)?ht[e]=ft[e]:ht[e]=lt&&pt?pt(t):vt(t)}return ht[e]},mt={};mt[_t("toStringTag")]="z";var yt="[object z]"===String(mt),gt={},St=!ye((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),bt=He,Et=je.all,kt=je.IS_HTMLDDA?function(e){return"object"==typeof e?null!==e:bt(e)||e===Et}:function(e){return"object"==typeof e?null!==e:bt(e)},Tt=kt,It=se.document,Rt=Tt(It)&&Tt(It.createElement),At=function(e){return Rt?It.createElement(e):{}},wt=At,Ct=!St&&!ye((function(){return 7!=Object.defineProperty(wt("div"),"a",{get:function(){return 7}}).a})),Ot=St&&ye((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),xt=kt,Nt=String,Dt=TypeError,Pt=function(e){if(xt(e))return e;throw Dt(Nt(e)+" is not an object")},Mt=ge,Lt=Function.prototype.call,Ut=Mt?Lt.bind(Lt):function(){return Lt.apply(Lt,arguments)},Vt=Te({}.isPrototypeOf),Ft=Xe,Bt=He,jt=Vt,Gt=Object,Ht=ot?function(e){return"symbol"==typeof e}:function(e){var t=Ft("Symbol");return Bt(t)&&jt(t.prototype,Gt(e))},zt=String,qt=function(e){try{return zt(e)}catch(t){return"Object"}},Kt=He,Xt=qt,Wt=TypeError,Yt=function(e){if(Kt(e))return e;throw Wt(Xt(e)+" is not a function")},Jt=Yt,Qt=Ie,Zt=function(e,t){var r=e[t];return Qt(r)?void 0:Jt(r)},$t=Ut,er=He,tr=kt,rr=TypeError,nr=Ut,ir=kt,or=Ht,ar=Zt,sr=function(e,t){var r,n;if("string"===t&&er(r=e.toString)&&!tr(n=$t(r,e)))return n;if(er(r=e.valueOf)&&!tr(n=$t(r,e)))return n;if("string"!==t&&er(r=e.toString)&&!tr(n=$t(r,e)))return n;throw rr("Can't convert object to primitive value")},ur=TypeError,cr=_t("toPrimitive"),dr=function(e,t){if(!ir(e)||or(e))return e;var r,n=ar(e,cr);if(n){if(void 0===t&&(t="default"),r=nr(n,e,t),!ir(r)||or(r))return r;throw ur("Can't convert object to primitive value")}return void 0===t&&(t="number"),sr(e,t)},lr=dr,hr=Ht,fr=function(e){var t=lr(e,"string");return hr(t)?t:t+""},pr=St,vr=Ct,_r=Ot,mr=Pt,yr=fr,gr=TypeError,Sr=Object.defineProperty,br=Object.getOwnPropertyDescriptor,Er="enumerable",kr="configurable",Tr="writable";gt.f=pr?_r?function(e,t,r){if(mr(e),t=yr(t),mr(r),"function"==typeof e&&"prototype"===t&&"value"in r&&Tr in r&&!r.writable){var n=br(e,t);n&&n.writable&&(e[t]=r.value,r={configurable:kr in r?r.configurable:n.configurable,enumerable:Er in r?r.enumerable:n.enumerable,writable:!1})}return Sr(e,t,r)}:Sr:function(e,t,r){if(mr(e),t=yr(t),mr(r),vr)try{return Sr(e,t,r)}catch(n){}if("get"in r||"set"in r)throw gr("Accessors not supported");return"value"in r&&(e[t]=r.value),e};var Ir={exports:{}},Rr=St,Ar=Pe,wr=Function.prototype,Cr=Rr&&Object.getOwnPropertyDescriptor,Or=Ar(wr,"name"),xr={EXISTS:Or,PROPER:Or&&"something"===function(){}.name,CONFIGURABLE:Or&&(!Rr||Rr&&Cr(wr,"name").configurable)},Nr=He,Dr=pe,Pr=Te(Function.toString);Nr(Dr.inspectSource)||(Dr.inspectSource=function(e){return Pr(e)});var Mr,Lr,Ur,Vr=Dr.inspectSource,Fr=He,Br=se.WeakMap,jr=Fr(Br)&&/native code/.test(String(Br)),Gr=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},Hr=gt,zr=Gr,qr=St?function(e,t,r){return Hr.f(e,t,zr(1,r))}:function(e,t,r){return e[t]=r,e},Kr=ue.exports,Xr=Fe,Wr=Kr("keys"),Yr=function(e){return Wr[e]||(Wr[e]=Xr(e))},Jr={},Qr=jr,Zr=se,$r=kt,en=qr,tn=Pe,rn=pe,nn=Yr,on=Jr,an="Object already initialized",sn=Zr.TypeError,un=Zr.WeakMap;if(Qr||rn.state){var cn=rn.state||(rn.state=new un);cn.get=cn.get,cn.has=cn.has,cn.set=cn.set,Mr=function(e,t){if(cn.has(e))throw sn(an);return t.facade=e,cn.set(e,t),t},Lr=function(e){return cn.get(e)||{}},Ur=function(e){return cn.has(e)}}else{var dn=nn("state");on[dn]=!0,Mr=function(e,t){if(tn(e,dn))throw sn(an);return t.facade=e,en(e,dn,t),t},Lr=function(e){return tn(e,dn)?e[dn]:{}},Ur=function(e){return tn(e,dn)}}var ln={set:Mr,get:Lr,has:Ur,enforce:function(e){return Ur(e)?Lr(e):Mr(e,{})},getterFor:function(e){return function(t){var r;if(!$r(t)||(r=Lr(t)).type!==e)throw sn("Incompatible receiver, "+e+" required");return r}}},hn=ye,fn=He,pn=Pe,vn=St,_n=xr.CONFIGURABLE,mn=Vr,yn=ln.enforce,gn=ln.get,Sn=Object.defineProperty,bn=vn&&!hn((function(){return 8!==Sn((function(){}),"length",{value:8}).length})),En=String(String).split("String"),kn=Ir.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),(!pn(e,"name")||_n&&e.name!==t)&&(vn?Sn(e,"name",{value:t,configurable:!0}):e.name=t),bn&&r&&pn(r,"arity")&&e.length!==r.arity&&Sn(e,"length",{value:r.arity});try{r&&pn(r,"constructor")&&r.constructor?vn&&Sn(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(i){}var n=yn(e);return pn(n,"source")||(n.source=En.join("string"==typeof t?t:"")),e};Function.prototype.toString=kn((function(){return fn(this)&&gn(this).source||mn(this)}),"toString");var Tn=He,In=gt,Rn=Ir.exports,An=le,wn=function(e,t,r,n){n||(n={});var i=n.enumerable,o=void 0!==n.name?n.name:t;if(Tn(r)&&Rn(r,o,n),n.global)i?e[t]=r:An(t,r);else{try{n.unsafe?e[t]&&(i=!0):delete e[t]}catch(a){}i?e[t]=r:In.f(e,t,{value:r,enumerable:!1,configurable:!n.nonConfigurable,writable:!n.nonWritable})}return e},Cn=Te,On=Cn({}.toString),xn=Cn("".slice),Nn=function(e){return xn(On(e),8,-1)},Dn=yt,Pn=He,Mn=Nn,Ln=_t("toStringTag"),Un=Object,Vn="Arguments"==Mn(function(){return arguments}()),Fn=Dn?Mn: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=Un(e),Ln))?r:Vn?Mn(t):"Object"==(n=Mn(t))&&Pn(t.callee)?"Arguments":n},Bn=Fn,jn=yt?{}.toString:function(){return"[object "+Bn(this)+"]"};yt||wn(Object.prototype,"toString",jn,{unsafe:!0});var Gn={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},Hn=At("span").classList,zn=Hn&&Hn.constructor&&Hn.constructor.prototype,qn=zn===Object.prototype?void 0:zn,Kn=Nn,Xn=Te,Wn=function(e){if("Function"===Kn(e))return Xn(e)},Yn=Yt,Jn=ge,Qn=Wn(Wn.bind),Zn=function(e,t){return Yn(e),void 0===t?e:Jn?Qn(e,t):function(){return e.apply(t,arguments)}},$n=ye,ei=Nn,ti=Object,ri=Te("".split),ni=$n((function(){return!ti("z").propertyIsEnumerable(0)}))?function(e){return"String"==ei(e)?ri(e,""):ti(e)}:ti,ii=Math.ceil,oi=Math.floor,ai=Math.trunc||function(e){var t=+e;return(t>0?oi:ii)(t)},si=function(e){var t=+e;return t!=t||0===t?0:ai(t)},ui=si,ci=Math.min,di=function(e){return e>0?ci(ui(e),9007199254740991):0},li=di,hi=function(e){return li(e.length)},fi=Nn,pi=Array.isArray||function(e){return"Array"==fi(e)},vi=Te,_i=ye,mi=He,yi=Fn,gi=Vr,Si=function(){},bi=[],Ei=Xe("Reflect","construct"),ki=/^\s*(?:class|function)\b/,Ti=vi(ki.exec),Ii=!ki.exec(Si),Ri=function(e){if(!mi(e))return!1;try{return Ei(Si,bi,e),!0}catch(t){return!1}},Ai=function(e){if(!mi(e))return!1;switch(yi(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Ii||!!Ti(ki,gi(e))}catch(t){return!0}};Ai.sham=!0;var wi=!Ei||_i((function(){var e;return Ri(Ri.call)||!Ri(Object)||!Ri((function(){e=!0}))||e}))?Ai:Ri,Ci=pi,Oi=wi,xi=kt,Ni=_t("species"),Di=Array,Pi=function(e){var t;return Ci(e)&&(t=e.constructor,(Oi(t)&&(t===Di||Ci(t.prototype))||xi(t)&&null===(t=t[Ni]))&&(t=void 0)),void 0===t?Di:t},Mi=function(e,t){return new(Pi(e))(0===t?0:t)},Li=Zn,Ui=ni,Vi=xe,Fi=hi,Bi=Mi,ji=Te([].push),Gi=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(u,c,d,l){for(var h,f,p=Vi(u),v=Ui(p),_=Li(c,d),m=Fi(v),y=0,g=l||Bi,S=t?g(u,m):r||a?g(u,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:ji(S,h)}else switch(e){case 4:return!1;case 7:ji(S,h)}return o?-1:n||i?i:S}},Hi={forEach:Gi(0),map:Gi(1),filter:Gi(2),some:Gi(3),every:Gi(4),find:Gi(5),findIndex:Gi(6),filterReject:Gi(7)},zi=ye,qi=function(e,t){var r=[][e];return!!r&&zi((function(){r.call(null,t||function(){return 1},1)}))},Ki=Hi.forEach,Xi=qi("forEach")?[].forEach:function(e){return Ki(this,e,arguments.length>1?arguments[1]:void 0)},Wi=se,Yi=Gn,Ji=qn,Qi=Xi,Zi=qr,$i=function(e){if(e&&e.forEach!==Qi)try{Zi(e,"forEach",Qi)}catch(t){e.forEach=Qi}};for(var eo in Yi)Yi[eo]&&$i(Wi[eo]&&Wi[eo].prototype);$i(Ji);var to={},ro={},no={}.propertyIsEnumerable,io=Object.getOwnPropertyDescriptor,oo=io&&!no.call({1:2},1);ro.f=oo?function(e){var t=io(this,e);return!!t&&t.enumerable}:no;var ao=ni,so=we,uo=function(e){return ao(so(e))},co=St,lo=Ut,ho=ro,fo=Gr,po=uo,vo=fr,_o=Pe,mo=Ct,yo=Object.getOwnPropertyDescriptor;to.f=co?yo:function(e,t){if(e=po(e),t=vo(t),mo)try{return yo(e,t)}catch(r){}if(_o(e,t))return fo(!lo(ho.f,e,t),e[t])};var go={},So=si,bo=Math.max,Eo=Math.min,ko=function(e,t){var r=So(e);return r<0?bo(r+t,0):Eo(r,t)},To=uo,Io=ko,Ro=hi,Ao=function(e){return function(t,r,n){var i,o=To(t),a=Ro(o),s=Io(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}},wo={includes:Ao(!0),indexOf:Ao(!1)},Co=Pe,Oo=uo,xo=wo.indexOf,No=Jr,Do=Te([].push),Po=function(e,t){var r,n=Oo(e),i=0,o=[];for(r in n)!Co(No,r)&&Co(n,r)&&Do(o,r);for(;t.length>i;)Co(n,r=t[i++])&&(~xo(o,r)||Do(o,r));return o},Mo=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Lo=Po,Uo=Mo.concat("length","prototype");go.f=Object.getOwnPropertyNames||function(e){return Lo(e,Uo)};var Vo={};Vo.f=Object.getOwnPropertySymbols;var Fo=Xe,Bo=go,jo=Vo,Go=Pt,Ho=Te([].concat),zo=Fo("Reflect","ownKeys")||function(e){var t=Bo.f(Go(e)),r=jo.f;return r?Ho(t,r(e)):t},qo=Pe,Ko=zo,Xo=to,Wo=gt,Yo=function(e,t,r){for(var n=Ko(t),i=Wo.f,o=Xo.f,a=0;a<n.length;a++){var s=n[a];qo(e,s)||r&&qo(r,s)||i(e,s,o(t,s))}},Jo=ye,Qo=He,Zo=/#|\.prototype\./,$o=function(e,t){var r=ta[ea(e)];return r==na||r!=ra&&(Qo(t)?Jo(t):!!t)},ea=$o.normalize=function(e){return String(e).replace(Zo,".").toLowerCase()},ta=$o.data={},ra=$o.NATIVE="N",na=$o.POLYFILL="P",ia=$o,oa=se,aa=to.f,sa=qr,ua=wn,ca=le,da=Yo,la=ia,ha=function(e,t){var r,n,i,o,a,s=e.target,u=e.global,c=e.stat;if(r=u?oa:c?oa[s]||ca(s,{}):(oa[s]||{}).prototype)for(n in t){if(o=t[n],i=e.dontCallGetSet?(a=aa(r,n))&&a.value:r[n],!la(u?n:s+(c?".":"#")+n,e.forced)&&void 0!==i){if(typeof o==typeof i)continue;da(o,i)}(e.sham||i&&i.sham)&&sa(o,"sham",!0),ua(r,n,o,e)}},fa={},pa=Po,va=Mo,_a=Object.keys||function(e){return pa(e,va)},ma=St,ya=Ot,ga=gt,Sa=Pt,ba=uo,Ea=_a;fa.f=ma&&!ya?Object.defineProperties:function(e,t){Sa(e);for(var r,n=ba(t),i=Ea(t),o=i.length,a=0;o>a;)ga.f(e,r=i[a++],n[r]);return e};var ka,Ta=Xe("document","documentElement"),Ia=Pt,Ra=fa,Aa=Mo,wa=Jr,Ca=Ta,Oa=At,xa=Yr("IE_PROTO"),Na=function(){},Da=function(e){return"<script>"+e+"</"+"script>"},Pa=function(e){e.write(Da("")),e.close();var t=e.parentWindow.Object;return e=null,t},Ma=function(){try{ka=new ActiveXObject("htmlfile")}catch(n){}var e,t;Ma="undefined"!=typeof document?document.domain&&ka?Pa(ka):((t=Oa("iframe")).style.display="none",Ca.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(Da("document.F=Object")),e.close(),e.F):Pa(ka);for(var r=Aa.length;r--;)delete Ma.prototype[Aa[r]];return Ma()};wa[xa]=!0;var La=Object.create||function(e,t){var r;return null!==e?(Na.prototype=Ia(e),r=new Na,Na.prototype=null,r[xa]=e):r=Ma(),void 0===t?r:Ra.f(r,t)},Ua=_t,Va=La,Fa=gt.f,Ba=Ua("unscopables"),ja=Array.prototype;null==ja[Ba]&&Fa(ja,Ba,{configurable:!0,value:Va(null)});var Ga=function(e){ja[Ba][e]=!0},Ha=wo.includes,za=Ga;ha({target:"Array",proto:!0,forced:ye((function(){return!Array(1).includes()}))},{includes:function(e){return Ha(this,e,arguments.length>1?arguments[1]:void 0)}}),za("includes");var qa=kt,Ka=Nn,Xa=_t("match"),Wa=function(e){var t;return qa(e)&&(void 0!==(t=e[Xa])?!!t:"RegExp"==Ka(e))},Ya=Wa,Ja=TypeError,Qa=function(e){if(Ya(e))throw Ja("The method doesn't accept regular expressions");return e},Za=Fn,$a=String,es=function(e){if("Symbol"===Za(e))throw TypeError("Cannot convert a Symbol value to a string");return $a(e)},ts=_t("match"),rs=function(e){var t=/./;try{"/./"[e](t)}catch(r){try{return t[ts]=!1,"/./"[e](t)}catch(n){}}return!1},ns=ha,is=Qa,os=we,as=es,ss=rs,us=Te("".indexOf);ns({target:"String",proto:!0,forced:!ss("includes")},{includes:function(e){return!!~us(as(os(this)),as(is(e)),arguments.length>1?arguments[1]:void 0)}});var cs,ds,ls=Pt,hs=function(){var e=ls(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=ye,ps=se.RegExp,vs=fs((function(){var e=ps("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),_s=vs||fs((function(){return!ps("a","y").sticky})),ms=vs||fs((function(){var e=ps("^r","gy");return e.lastIndex=2,null!=e.exec("str")})),ys={BROKEN_CARET:ms,MISSED_STICKY:_s,UNSUPPORTED_Y:vs},gs=ye,Ss=se.RegExp,bs=gs((function(){var e=Ss(".","s");return!(e.dotAll&&e.exec("\n")&&"s"===e.flags)})),Es=ye,ks=se.RegExp,Ts=Es((function(){var e=ks("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")})),Is=Ut,Rs=Te,As=es,ws=hs,Cs=ys,Os=ue.exports,xs=La,Ns=ln.get,Ds=bs,Ps=Ts,Ms=Os("native-string-replace",String.prototype.replace),Ls=RegExp.prototype.exec,Us=Ls,Vs=Rs("".charAt),Fs=Rs("".indexOf),Bs=Rs("".replace),js=Rs("".slice),Gs=(ds=/b*/g,Is(Ls,cs=/a/,"a"),Is(Ls,ds,"a"),0!==cs.lastIndex||0!==ds.lastIndex),Hs=Cs.BROKEN_CARET,zs=void 0!==/()??/.exec("")[1];(Gs||zs||Hs||Ds||Ps)&&(Us=function(e){var t,r,n,i,o,a,s,u=this,c=Ns(u),d=As(e),l=c.raw;if(l)return l.lastIndex=u.lastIndex,t=Is(Us,l,d),u.lastIndex=l.lastIndex,t;var h=c.groups,f=Hs&&u.sticky,p=Is(ws,u),v=u.source,_=0,m=d;if(f&&(p=Bs(p,"y",""),-1===Fs(p,"g")&&(p+="g"),m=js(d,u.lastIndex),u.lastIndex>0&&(!u.multiline||u.multiline&&"\n"!==Vs(d,u.lastIndex-1))&&(v="(?: "+v+")",m=" "+m,_++),r=new RegExp("^(?:"+v+")",p)),zs&&(r=new RegExp("^"+v+"$(?!\\s)",p)),Gs&&(n=u.lastIndex),i=Is(Ls,f?r:u,m),f?i?(i.input=js(i.input,_),i[0]=js(i[0],_),i.index=u.lastIndex,u.lastIndex+=i[0].length):u.lastIndex=0:Gs&&i&&(u.lastIndex=u.global?i.index+i[0].length:n),zs&&i&&i.length>1&&Is(Ms,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=xs(null),o=0;o<h.length;o++)a[(s=h[o])[0]]=i[s[1]];return i});var qs=Us;ha({target:"RegExp",proto:!0,forced:/./.exec!==qs},{exec:qs});var Ks=Wn,Xs=wn,Ws=qs,Ys=ye,Js=_t,Qs=qr,Zs=Js("species"),$s=RegExp.prototype,eu=function(e,t,r,n){var i=Js(e),o=!Ys((function(){var t={};return t[i]=function(){return 7},7!=""[e](t)})),a=o&&!Ys((function(){var t=!1,r=/a/;return"split"===e&&((r={}).constructor={},r.constructor[Zs]=function(){return r},r.flags="",r[i]=/./[i]),r.exec=function(){return t=!0,null},r[i](""),!t}));if(!o||!a||r){var s=Ks(/./[i]),u=t(i,""[e],(function(e,t,r,n,i){var a=Ks(e),u=t.exec;return u===Ws||u===$s.exec?o&&!i?{done:!0,value:s(t,r,n)}:{done:!0,value:a(r,t,n)}:{done:!1}}));Xs(String.prototype,e,u[0]),Xs($s,i,u[1])}n&&Qs($s[i],"sham",!0)},tu=Object.is||function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t},ru=Ut,nu=Pt,iu=He,ou=Nn,au=qs,su=TypeError,uu=function(e,t){var r=e.exec;if(iu(r)){var n=ru(r,e,t);return null!==n&&nu(n),n}if("RegExp"===ou(e))return ru(au,e,t);throw su("RegExp#exec called on incompatible receiver")},cu=Ut,du=Pt,lu=Ie,hu=we,fu=tu,pu=es,vu=Zt,_u=uu;eu("search",(function(e,t,r){return[function(t){var r=hu(this),n=lu(t)?void 0:vu(t,e);return n?cu(n,t,r):new RegExp(t)[e](pu(r))},function(e){var n=du(this),i=pu(e),o=r(t,n,i);if(o.done)return o.value;var a=n.lastIndex;fu(a,0)||(n.lastIndex=0);var s=_u(n,i);return fu(n.lastIndex,a)||(n.lastIndex=a),null===s?-1:s.index}]}));var mu=Te,yu=si,gu=es,Su=we,bu=mu("".charAt),Eu=mu("".charCodeAt),ku=mu("".slice),Tu=function(e){return function(t,r){var n,i,o=gu(Su(t)),a=yu(r),s=o.length;return a<0||a>=s?e?"":void 0:(n=Eu(o,a))<55296||n>56319||a+1===s||(i=Eu(o,a+1))<56320||i>57343?e?bu(o,a):n:e?ku(o,a,a+2):i-56320+(n-55296<<10)+65536}},Iu={codeAt:Tu(!1),charAt:Tu(!0)},Ru=Iu.charAt,Au=function(e,t,r){return t+(r?Ru(e,t).length:1)},wu=Ut,Cu=Pt,Ou=Ie,xu=di,Nu=es,Du=we,Pu=Zt,Mu=Au,Lu=uu;eu("match",(function(e,t,r){return[function(t){var r=Du(this),n=Ou(t)?void 0:Pu(t,e);return n?wu(n,t,r):new RegExp(t)[e](Nu(r))},function(e){var n=Cu(this),i=Nu(e),o=r(t,n,i);if(o.done)return o.value;if(!n.global)return Lu(n,i);var a=n.unicode;n.lastIndex=0;for(var s,u=[],c=0;null!==(s=Lu(n,i));){var d=Nu(s[0]);u[c]=d,""===d&&(n.lastIndex=Mu(i,xu(n.lastIndex),a)),c++}return 0===c?null:u}]}));var Uu="\t\n\v\f\r \u2028\u2029\ufeff",Vu=we,Fu=es,Bu=Te("".replace),ju="[\t\n\v\f\r \u2028\u2029\ufeff]",Gu=RegExp("^"+ju+ju+"*"),Hu=RegExp(ju+ju+"*$"),zu=function(e){return function(t){var r=Fu(Vu(t));return 1&e&&(r=Bu(r,Gu,"")),2&e&&(r=Bu(r,Hu,"")),r}},qu={start:zu(1),end:zu(2),trim:zu(3)},Ku=se,Xu=ye,Wu=Te,Yu=es,Ju=qu.trim,Qu=Uu,Zu=Ku.parseInt,$u=Ku.Symbol,ec=$u&&$u.iterator,tc=/^[+-]?0x/i,rc=Wu(tc.exec),nc=8!==Zu(Qu+"08")||22!==Zu(Qu+"0x16")||ec&&!Xu((function(){Zu(Object(ec))}))?function(e,t){var r=Ju(Yu(e));return Zu(r,t>>>0||(rc(tc,r)?16:10))}:Zu;ha({global:!0,forced:parseInt!=nc},{parseInt:nc});var ic,oc,ac,sc={},uc=!ye((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),cc=Pe,dc=He,lc=xe,hc=uc,fc=Yr("IE_PROTO"),pc=Object,vc=pc.prototype,_c=hc?pc.getPrototypeOf:function(e){var t=lc(e);if(cc(t,fc))return t[fc];var r=t.constructor;return dc(r)&&t instanceof r?r.prototype:t instanceof pc?vc:null},mc=ye,yc=He,gc=kt,Sc=_c,bc=wn,Ec=_t("iterator"),kc=!1;[].keys&&("next"in(ac=[].keys())?(oc=Sc(Sc(ac)))!==Object.prototype&&(ic=oc):kc=!0),(!gc(ic)||mc((function(){var e={};return ic[Ec].call(e)!==e})))&&(ic={}),yc(ic[Ec])||bc(ic,Ec,(function(){return this}));var Tc={IteratorPrototype:ic,BUGGY_SAFARI_ITERATORS:kc},Ic=gt.f,Rc=Pe,Ac=_t("toStringTag"),wc=function(e,t,r){e&&!r&&(e=e.prototype),e&&!Rc(e,Ac)&&Ic(e,Ac,{configurable:!0,value:t})},Cc=Tc.IteratorPrototype,Oc=La,xc=Gr,Nc=wc,Dc=sc,Pc=function(){return this},Mc=function(e,t,r,n){var i=t+" Iterator";return e.prototype=Oc(Cc,{next:xc(+!n,r)}),Nc(e,i,!1),Dc[i]=Pc,e},Lc=He,Uc=String,Vc=TypeError,Fc=Te,Bc=Pt,jc=function(e){if("object"==typeof e||Lc(e))return e;throw Vc("Can't set "+Uc(e)+" as a prototype")},Gc=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=Fc(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(r,[]),t=r instanceof Array}catch(n){}return function(r,n){return Bc(r),jc(n),t?e(r,n):r.__proto__=n,r}}():void 0),Hc=ha,zc=Ut,qc=He,Kc=Mc,Xc=_c,Wc=Gc,Yc=wc,Jc=qr,Qc=wn,Zc=sc,$c=xr.PROPER,ed=xr.CONFIGURABLE,td=Tc.IteratorPrototype,rd=Tc.BUGGY_SAFARI_ITERATORS,nd=_t("iterator"),id="keys",od="values",ad="entries",sd=function(){return this},ud=function(e,t,r,n,i,o,a){Kc(r,t,n);var s,u,c,d=function(e){if(e===i&&v)return v;if(!rd&&e in f)return f[e];switch(e){case id:case od:case ad:return function(){return new r(this,e)}}return function(){return new r(this)}},l=t+" Iterator",h=!1,f=e.prototype,p=f[nd]||f["@@iterator"]||i&&f[i],v=!rd&&p||d(i),_="Array"==t&&f.entries||p;if(_&&(s=Xc(_.call(new e)))!==Object.prototype&&s.next&&(Xc(s)!==td&&(Wc?Wc(s,td):qc(s[nd])||Qc(s,nd,sd)),Yc(s,l,!0)),$c&&i==od&&p&&p.name!==od&&(ed?Jc(f,"name",od):(h=!0,v=function(){return zc(p,this)})),i)if(u={values:d(od),keys:o?v:d(id),entries:d(ad)},a)for(c in u)(rd||h||!(c in f))&&Qc(f,c,u[c]);else Hc({target:t,proto:!0,forced:rd||h},u);return f[nd]!==v&&Qc(f,nd,v,{name:i}),Zc[t]=v,u},cd=function(e,t){return{value:e,done:t}},dd=uo,ld=Ga,hd=sc,fd=ln,pd=gt.f,vd=ud,_d=cd,md=St,yd="Array Iterator",gd=fd.set,Sd=fd.getterFor(yd),bd=vd(Array,"Array",(function(e,t){gd(this,{type:yd,target:dd(e),index:0,kind:t})}),(function(){var e=Sd(this),t=e.target,r=e.kind,n=e.index++;return!t||n>=t.length?(e.target=void 0,_d(void 0,!0)):_d("keys"==r?n:"values"==r?t[n]:[n,t[n]],!1)}),"values"),Ed=hd.Arguments=hd.Array;if(ld("keys"),ld("values"),ld("entries"),md&&"values"!==Ed.name)try{pd(Ed,"name",{value:"values"})}catch(Z$){}var kd={exports:{}},Td={},Id=fr,Rd=gt,Ad=Gr,wd=function(e,t,r){var n=Id(t);n in e?Rd.f(e,n,Ad(0,r)):e[n]=r},Cd=ko,Od=hi,xd=wd,Nd=Array,Dd=Math.max,Pd=function(e,t,r){for(var n=Od(e),i=Cd(t,n),o=Cd(void 0===r?n:r,n),a=Nd(Dd(o-i,0)),s=0;i<o;i++,s++)xd(a,s,e[i]);return a.length=s,a},Md=Nn,Ld=uo,Ud=go.f,Vd=Pd,Fd="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];Td.f=function(e){return Fd&&"Window"==Md(e)?function(e){try{return Ud(e)}catch(Z$){return Vd(Fd)}}(e):Ud(Ld(e))};var Bd=ye((function(){if("function"==typeof ArrayBuffer){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}})),jd=ye,Gd=kt,Hd=Nn,zd=Bd,qd=Object.isExtensible,Kd=jd((function(){qd(1)}))||zd?function(e){return!!Gd(e)&&((!zd||"ArrayBuffer"!=Hd(e))&&(!qd||qd(e)))}:qd,Xd=!ye((function(){return Object.isExtensible(Object.preventExtensions({}))})),Wd=ha,Yd=Te,Jd=Jr,Qd=kt,Zd=Pe,$d=gt.f,el=go,tl=Td,rl=Kd,nl=Xd,il=!1,ol=Fe("meta"),al=0,sl=function(e){$d(e,ol,{value:{objectID:"O"+al++,weakData:{}}})},ul=kd.exports={enable:function(){ul.enable=function(){},il=!0;var e=el.f,t=Yd([].splice),r={};r[ol]=1,e(r).length&&(el.f=function(r){for(var n=e(r),i=0,o=n.length;i<o;i++)if(n[i]===ol){t(n,i,1);break}return n},Wd({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:tl.f}))},fastKey:function(e,t){if(!Qd(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!Zd(e,ol)){if(!rl(e))return"F";if(!t)return"E";sl(e)}return e[ol].objectID},getWeakData:function(e,t){if(!Zd(e,ol)){if(!rl(e))return!0;if(!t)return!1;sl(e)}return e[ol].weakData},onFreeze:function(e){return nl&&il&&rl(e)&&!Zd(e,ol)&&sl(e),e}};Jd[ol]=!0;var cl=sc,dl=_t("iterator"),ll=Array.prototype,hl=function(e){return void 0!==e&&(cl.Array===e||ll[dl]===e)},fl=Fn,pl=Zt,vl=Ie,_l=sc,ml=_t("iterator"),yl=function(e){if(!vl(e))return pl(e,ml)||pl(e,"@@iterator")||_l[fl(e)]},gl=Ut,Sl=Yt,bl=Pt,El=qt,kl=yl,Tl=TypeError,Il=function(e,t){var r=arguments.length<2?kl(e):t;if(Sl(r))return bl(gl(r,e));throw Tl(El(e)+" is not iterable")},Rl=Ut,Al=Pt,wl=Zt,Cl=function(e,t,r){var n,i;Al(e);try{if(!(n=wl(e,"return"))){if("throw"===t)throw r;return r}n=Rl(n,e)}catch(Z$){i=!0,n=Z$}if("throw"===t)throw r;if(i)throw n;return Al(n),r},Ol=Zn,xl=Ut,Nl=Pt,Dl=qt,Pl=hl,Ml=hi,Ll=Vt,Ul=Il,Vl=yl,Fl=Cl,Bl=TypeError,jl=function(e,t){this.stopped=e,this.result=t},Gl=jl.prototype,Hl=function(e,t,r){var n,i,o,a,s,u,c,d=r&&r.that,l=!(!r||!r.AS_ENTRIES),h=!(!r||!r.IS_RECORD),f=!(!r||!r.IS_ITERATOR),p=!(!r||!r.INTERRUPTED),v=Ol(t,d),_=function(e){return n&&Fl(n,"normal",e),new jl(!0,e)},m=function(e){return l?(Nl(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=Vl(e)))throw Bl(Dl(e)+" is not iterable");if(Pl(i)){for(o=0,a=Ml(e);a>o;o++)if((s=m(e[o]))&&Ll(Gl,s))return s;return new jl(!1)}n=Ul(e,i)}for(u=h?e.next:n.next;!(c=xl(u,n)).done;){try{s=m(c.value)}catch(Z$){Fl(n,"throw",Z$)}if("object"==typeof s&&s&&Ll(Gl,s))return s}return new jl(!1)},zl=Vt,ql=TypeError,Kl=function(e,t){if(zl(t,e))return e;throw ql("Incorrect invocation")},Xl=_t("iterator"),Wl=!1;try{var Yl=0,Jl={next:function(){return{done:!!Yl++}},return:function(){Wl=!0}};Jl[Xl]=function(){return this},Array.from(Jl,(function(){throw 2}))}catch(Z$){}var Ql=function(e,t){if(!t&&!Wl)return!1;var r=!1;try{var n={};n[Xl]=function(){return{next:function(){return{done:r=!0}}}},e(n)}catch(Z$){}return r},Zl=He,$l=kt,eh=Gc,th=function(e,t,r){var n,i;return eh&&Zl(n=t.constructor)&&n!==r&&$l(i=n.prototype)&&i!==r.prototype&&eh(e,i),e},rh=ha,nh=se,ih=Te,oh=ia,ah=wn,sh=kd.exports,uh=Hl,ch=Kl,dh=He,lh=Ie,hh=kt,fh=ye,ph=Ql,vh=wc,_h=th,mh=function(e,t,r){var n=-1!==e.indexOf("Map"),i=-1!==e.indexOf("Weak"),o=n?"set":"add",a=nh[e],s=a&&a.prototype,u=a,c={},d=function(e){var t=ih(s[e]);ah(s,e,"add"==e?function(e){return t(this,0===e?0:e),this}:"delete"==e?function(e){return!(i&&!hh(e))&&t(this,0===e?0:e)}:"get"==e?function(e){return i&&!hh(e)?void 0:t(this,0===e?0:e)}:"has"==e?function(e){return!(i&&!hh(e))&&t(this,0===e?0:e)}:function(e,r){return t(this,0===e?0:e,r),this})};if(oh(e,!dh(a)||!(i||s.forEach&&!fh((function(){(new a).entries().next()})))))u=r.getConstructor(t,e,n,o),sh.enable();else if(oh(e,!0)){var l=new u,h=l[o](i?{}:-0,1)!=l,f=fh((function(){l.has(1)})),p=ph((function(e){new a(e)})),v=!i&&fh((function(){for(var e=new a,t=5;t--;)e[o](t,t);return!e.has(-0)}));p||((u=t((function(e,t){ch(e,s);var r=_h(new a,e,u);return lh(t)||uh(t,r[o],{that:r,AS_ENTRIES:n}),r}))).prototype=s,s.constructor=u),(f||v)&&(d("delete"),d("has"),n&&d("get")),(v||h)&&d(o),i&&s.clear&&delete s.clear}return c[e]=u,rh({global:!0,constructor:!0,forced:u!=a},c),vh(u,e),i||r.setStrong(u,e,n),u},yh=wn,gh=function(e,t,r){for(var n in t)yh(e,n,t[n],r);return e},Sh=Xe,bh=gt,Eh=St,kh=_t("species"),Th=function(e){var t=Sh(e),r=bh.f;Eh&&t&&!t[kh]&&r(t,kh,{configurable:!0,get:function(){return this}})},Ih=gt.f,Rh=La,Ah=gh,wh=Zn,Ch=Kl,Oh=Ie,xh=Hl,Nh=ud,Dh=cd,Ph=Th,Mh=St,Lh=kd.exports.fastKey,Uh=ln.set,Vh=ln.getterFor,Fh={getConstructor:function(e,t,r,n){var i=e((function(e,i){Ch(e,o),Uh(e,{type:t,index:Rh(null),first:void 0,last:void 0,size:0}),Mh||(e.size=0),Oh(i)||xh(i,e[n],{that:e,AS_ENTRIES:r})})),o=i.prototype,a=Vh(t),s=function(e,t,r){var n,i,o=a(e),s=u(e,t);return s?s.value=r:(o.last=s={index:i=Lh(t,!0),key:t,value:r,previous:n=o.last,next:void 0,removed:!1},o.first||(o.first=s),n&&(n.next=s),Mh?o.size++:e.size++,"F"!==i&&(o.index[i]=s)),e},u=function(e,t){var r,n=a(e),i=Lh(t);if("F"!==i)return n.index[i];for(r=n.first;r;r=r.next)if(r.key==t)return r};return Ah(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,Mh?e.size=0:this.size=0},delete:function(e){var t=this,r=a(t),n=u(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),Mh?r.size--:t.size--}return!!n},forEach:function(e){for(var t,r=a(this),n=wh(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!!u(this,e)}}),Ah(o,r?{get:function(e){var t=u(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)}}),Mh&&Ih(o,"size",{get:function(){return a(this).size}}),i},setStrong:function(e,t,r){var n=t+" Iterator",i=Vh(t),o=Vh(n);Nh(e,t,(function(e,t){Uh(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)?Dh("keys"==t?r.key:"values"==t?r.value:[r.key,r.value],!1):(e.target=void 0,Dh(void 0,!0))}),r?"entries":"values",!r,!0),Ph(t)}};mh("Map",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),Fh);var Bh=Iu.charAt,jh=es,Gh=ln,Hh=ud,zh=cd,qh="String Iterator",Kh=Gh.set,Xh=Gh.getterFor(qh);Hh(String,"String",(function(e){Kh(this,{type:qh,string:jh(e),index:0})}),(function(){var e,t=Xh(this),r=t.string,n=t.index;return n>=r.length?zh(void 0,!0):(e=Bh(r,n),t.index+=e.length,zh(e,!1))}));var Wh=se,Yh=Gn,Jh=qn,Qh=bd,Zh=qr,$h=_t,ef=$h("iterator"),tf=$h("toStringTag"),rf=Qh.values,nf=function(e,t){if(e){if(e[ef]!==rf)try{Zh(e,ef,rf)}catch(Z$){e[ef]=rf}if(e[tf]||Zh(e,tf,t),Yh[t])for(var r in Qh)if(e[r]!==Qh[r])try{Zh(e,r,Qh[r])}catch(Z$){e[r]=Qh[r]}}};for(var of in Yh)nf(Wh[of]&&Wh[of].prototype,of);nf(Jh,"DOMTokenList");var af=xe,sf=_a;ha({target:"Object",stat:!0,forced:ye((function(){sf(1)}))},{keys:function(e){return sf(af(e))}});var uf=ha,cf=St,df=gt.f;uf({target:"Object",stat:!0,forced:Object.defineProperty!==df,sham:!cf},{defineProperty:df});var lf=ge,hf=Function.prototype,ff=hf.apply,pf=hf.call,vf="object"==typeof Reflect&&Reflect.apply||(lf?pf.bind(ff):function(){return pf.apply(ff,arguments)}),_f=gt.f,mf=function(e,t,r){r in e||_f(e,r,{configurable:!0,get:function(){return t[r]},set:function(e){t[r]=e}})},yf=es,gf=function(e,t){return void 0===e?arguments.length<2?"":t:yf(e)},Sf=kt,bf=qr,Ef=Error,kf=Te("".replace),Tf=String(Ef("zxcasd").stack),If=/\n\s*at [^:]*:[^\n]*/,Rf=If.test(Tf),Af=function(e,t){if(Rf&&"string"==typeof e&&!Ef.prepareStackTrace)for(;t--;)e=kf(e,If,"");return e},wf=Gr,Cf=!ye((function(){var e=Error("a");return!("stack"in e)||(Object.defineProperty(e,"stack",wf(1,7)),7!==e.stack)})),Of=Xe,xf=Pe,Nf=qr,Df=Vt,Pf=Gc,Mf=Yo,Lf=mf,Uf=th,Vf=gf,Ff=function(e,t){Sf(t)&&"cause"in t&&bf(e,"cause",t.cause)},Bf=Af,jf=Cf,Gf=St,Hf=ha,zf=vf,qf=function(e,t,r,n){var i="stackTraceLimit",o=n?2:1,a=e.split("."),s=a[a.length-1],u=Of.apply(null,a);if(u){var c=u.prototype;if(xf(c,"cause")&&delete c.cause,!r)return u;var d=Of("Error"),l=t((function(e,t){var r=Vf(n?t:e,void 0),i=n?new u(e):new u;return void 0!==r&&Nf(i,"message",r),jf&&Nf(i,"stack",Bf(i.stack,2)),this&&Df(c,this)&&Uf(i,this,l),arguments.length>o&&Ff(i,arguments[o]),i}));l.prototype=c,"Error"!==s?Pf?Pf(l,d):Mf(l,d,{name:!0}):Gf&&i in u&&(Lf(l,u,i),Lf(l,u,"prepareStackTrace")),Mf(l,u);try{c.name!==s&&Nf(c,"name",s),c.constructor=l}catch(Z$){}return l}},Kf="WebAssembly",Xf=se.WebAssembly,Wf=7!==Error("e",{cause:7}).cause,Yf=function(e,t){var r={};r[e]=qf(e,t,Wf),Hf({global:!0,constructor:!0,arity:1,forced:Wf},r)},Jf=function(e,t){if(Xf&&Xf[e]){var r={};r[e]=qf("WebAssembly."+e,t,Wf),Hf({target:Kf,stat:!0,constructor:!0,arity:1,forced:Wf},r)}};Yf("Error",(function(e){return function(t){return zf(e,this,arguments)}})),Yf("EvalError",(function(e){return function(t){return zf(e,this,arguments)}})),Yf("RangeError",(function(e){return function(t){return zf(e,this,arguments)}})),Yf("ReferenceError",(function(e){return function(t){return zf(e,this,arguments)}})),Yf("SyntaxError",(function(e){return function(t){return zf(e,this,arguments)}})),Yf("TypeError",(function(e){return function(t){return zf(e,this,arguments)}})),Yf("URIError",(function(e){return function(t){return zf(e,this,arguments)}})),Jf("CompileError",(function(e){return function(t){return zf(e,this,arguments)}})),Jf("LinkError",(function(e){return function(t){return zf(e,this,arguments)}})),Jf("RuntimeError",(function(e){return function(t){return zf(e,this,arguments)}}));var Qf=Yt,Zf=xe,$f=ni,ep=hi,tp=TypeError,rp=function(e){return function(t,r,n,i){Qf(r);var o=Zf(t),a=$f(o),s=ep(o),u=e?s-1:0,c=e?-1:1;if(n<2)for(;;){if(u in a){i=a[u],u+=c;break}if(u+=c,e?u<0:s<=u)throw tp("Reduce of empty array with no initial value")}for(;e?u>=0:s>u;u+=c)u in a&&(i=r(i,a[u],u,o));return i}},np={left:rp(!1),right:rp(!0)},ip="process"==Nn(se.process),op=np.left,ap=tt,sp=ip;ha({target:"Array",proto:!0,forced:!qi("reduce")||!sp&&ap>79&&ap<83},{reduce:function(e){var t=arguments.length;return op(this,e,t,t>1?arguments[1]:void 0)}});var up=St,cp=Te,dp=Ut,lp=ye,hp=_a,fp=Vo,pp=ro,vp=xe,_p=ni,mp=Object.assign,yp=Object.defineProperty,gp=cp([].concat),Sp=!mp||lp((function(){if(up&&1!==mp({b:1},mp(yp({},"a",{enumerable:!0,get:function(){yp(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!=mp({},e)[r]||hp(mp({},t)).join("")!=n}))?function(e,t){for(var r=vp(e),n=arguments.length,i=1,o=fp.f,a=pp.f;n>i;)for(var s,u=_p(arguments[i++]),c=o?gp(hp(u),o(u)):hp(u),d=c.length,l=0;d>l;)s=c[l++],up&&!dp(a,u,s)||(r[s]=u[s]);return r}:mp,bp=Sp;ha({target:"Object",stat:!0,arity:2,forced:Object.assign!==bp},{assign:bp});var Ep,kp=ha,Tp=Wn,Ip=to.f,Rp=di,Ap=es,wp=Qa,Cp=we,Op=rs,xp=Tp("".endsWith),Np=Tp("".slice),Dp=Math.min,Pp=Op("endsWith");kp({target:"String",proto:!0,forced:!!(Pp||(Ep=Ip(String.prototype,"endsWith"),!Ep||Ep.writable))&&!Pp},{endsWith:function(e){var t=Ap(Cp(this));wp(e);var r=arguments.length>1?arguments[1]:void 0,n=t.length,i=void 0===r?n:Dp(Rp(r),n),o=Ap(e);return xp?xp(t,o,i):Np(t,i-o.length,i)===o}});var Mp=St,Lp=pi,Up=TypeError,Vp=Object.getOwnPropertyDescriptor,Fp=Mp&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(Z$){return Z$ instanceof TypeError}}()?function(e,t){if(Lp(e)&&!Vp(e,"length").writable)throw Up("Cannot set read only .length");return e.length=t}:function(e,t){return e.length=t},Bp=TypeError,jp=function(e){if(e>9007199254740991)throw Bp("Maximum allowed index exceeded");return e},Gp=ha,Hp=xe,zp=hi,qp=Fp,Kp=jp,Xp=ye((function(){return 4294967297!==[].push.call({length:4294967296},1)})),Wp=!function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(Z$){return Z$ instanceof TypeError}}();Gp({target:"Array",proto:!0,arity:1,forced:Xp||Wp},{push:function(e){var t=Hp(this),r=zp(t),n=arguments.length;Kp(r+n);for(var i=0;i<n;i++)t[r]=arguments[i],r++;return qp(t,r),r}});var Yp=!0,Jp=!0;function Qp(e,t,r){var n=e.match(t);return n&&n.length>=r&&parseInt(n[r],10)}function Zp(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 $p(e){return"boolean"!=typeof e?new Error("Argument type: "+a(e)+". Please use a boolean."):(Yp=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function ev(e){return"boolean"!=typeof e?new Error("Argument type: "+a(e)+". Please use a boolean."):(Jp=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function tv(){if("object"===("undefined"==typeof window?"undefined":a(window))){if(Yp)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function rv(e,t){Jp&&console.warn(e+" is deprecated, please use "+t+" instead.")}function nv(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=Qp(r.userAgent,/Firefox\/(\d+)\./,1);else if(r.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection)t.browser="chrome",t.version=Qp(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=Qp(r.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return t}function iv(e){return"[object Object]"===Object.prototype.toString.call(e)}function ov(e){return iv(e)?Object.keys(e).reduce((function(t,r){var n=iv(e[r]),i=n?ov(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 sv(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 uv=ha,cv=Hi.find,dv=Ga,lv="find",hv=!0;lv in[]&&Array(1).find((function(){hv=!1})),uv({target:"Array",proto:!0,forced:hv},{find:function(e){return cv(this,e,arguments.length>1?arguments[1]:void 0)}}),dv(lv);var fv=ye,pv=tt,vv=_t("species"),_v=function(e){return pv>=51||!fv((function(){var t=[];return(t.constructor={})[vv]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},mv=Te([].slice),yv=ha,gv=pi,Sv=wi,bv=kt,Ev=ko,kv=hi,Tv=uo,Iv=wd,Rv=_t,Av=mv,wv=_v("slice"),Cv=Rv("species"),Ov=Array,xv=Math.max;yv({target:"Array",proto:!0,forced:!wv},{slice:function(e,t){var r,n,i,o=Tv(this),a=kv(o),s=Ev(e,a),u=Ev(void 0===t?a:t,a);if(gv(o)&&(r=o.constructor,(Sv(r)&&(r===Ov||gv(r.prototype))||bv(r)&&null===(r=r[Cv]))&&(r=void 0),r===Ov||void 0===r))return Av(o,s,u);for(n=new(void 0===r?Ov:r)(xv(u-s,0)),i=0;s<u;s++,i++)s in o&&Iv(n,i,o[s]);return n.length=i,n}});var Nv=ha,Dv=wo.indexOf,Pv=qi,Mv=Wn([].indexOf),Lv=!!Mv&&1/Mv([1],1,-0)<0,Uv=Pv("indexOf");Nv({target:"Array",proto:!0,forced:Lv||!Uv},{indexOf:function(e){var t=arguments.length>1?arguments[1]:void 0;return Lv?Mv(this,e,t)||0:Dv(this,e,t)}});var Vv=qt,Fv=TypeError,Bv=function(e,t){if(!delete e[t])throw Fv("Cannot delete property "+Vv(t)+" of "+Vv(e))},jv=ha,Gv=xe,Hv=ko,zv=si,qv=hi,Kv=Fp,Xv=jp,Wv=Mi,Yv=wd,Jv=Bv,Qv=_v("splice"),Zv=Math.max,$v=Math.min;jv({target:"Array",proto:!0,forced:!Qv},{splice:function(e,t){var r,n,i,o,a,s,u=Gv(this),c=qv(u),d=Hv(e,c),l=arguments.length;for(0===l?r=n=0:1===l?(r=0,n=c-d):(r=l-2,n=$v(Zv(zv(t),0),c-d)),Xv(c+r-n),i=Wv(u,n),o=0;o<n;o++)(a=d+o)in u&&Yv(i,o,u[a]);if(i.length=n,r<n){for(o=d;o<c-n;o++)s=o+r,(a=o+n)in u?u[s]=u[a]:Jv(u,s);for(o=c;o>c-n+r;o--)Jv(u,o-1)}else if(r>n)for(o=c-n;o>d;o--)s=o+r-1,(a=o+n-1)in u?u[s]=u[a]:Jv(u,s);for(o=0;o<r;o++)u[o+d]=arguments[o+2];return Kv(u,c-n+r),i}});var e_=Hi.map;ha({target:"Array",proto:!0,forced:!_v("map")},{map:function(e){return e_(this,e,arguments.length>1?arguments[1]:void 0)}});var t_,r_,n_,i_,o_=wi,a_=qt,s_=TypeError,u_=function(e){if(o_(e))return e;throw s_(a_(e)+" is not a constructor")},c_=Pt,d_=u_,l_=Ie,h_=_t("species"),f_=function(e,t){var r,n=c_(e).constructor;return void 0===n||l_(r=c_(n)[h_])?t:d_(r)},p_=TypeError,v_=function(e,t){if(e<t)throw p_("Not enough arguments");return e},__=/(?:ipad|iphone|ipod).*applewebkit/i.test(We),m_=se,y_=vf,g_=Zn,S_=He,b_=Pe,E_=ye,k_=Ta,T_=mv,I_=At,R_=v_,A_=__,w_=ip,C_=m_.setImmediate,O_=m_.clearImmediate,x_=m_.process,N_=m_.Dispatch,D_=m_.Function,P_=m_.MessageChannel,M_=m_.String,L_=0,U_={},V_="onreadystatechange";try{t_=m_.location}catch(Z$){}var F_=function(e){if(b_(U_,e)){var t=U_[e];delete U_[e],t()}},B_=function(e){return function(){F_(e)}},j_=function(e){F_(e.data)},G_=function(e){m_.postMessage(M_(e),t_.protocol+"//"+t_.host)};C_&&O_||(C_=function(e){R_(arguments.length,1);var t=S_(e)?e:D_(e),r=T_(arguments,1);return U_[++L_]=function(){y_(t,void 0,r)},r_(L_),L_},O_=function(e){delete U_[e]},w_?r_=function(e){x_.nextTick(B_(e))}:N_&&N_.now?r_=function(e){N_.now(B_(e))}:P_&&!A_?(i_=(n_=new P_).port2,n_.port1.onmessage=j_,r_=g_(i_.postMessage,i_)):m_.addEventListener&&S_(m_.postMessage)&&!m_.importScripts&&t_&&"file:"!==t_.protocol&&!E_(G_)?(r_=G_,m_.addEventListener("message",j_,!1)):r_=V_ in I_("script")?function(e){k_.appendChild(I_("script")).onreadystatechange=function(){k_.removeChild(this),F_(e)}}:function(e){setTimeout(B_(e),0)});var H_,z_,q_,K_,X_,W_,Y_,J_,Q_={set:C_,clear:O_},Z_=se,$_=/ipad|iphone|ipod/i.test(We)&&void 0!==Z_.Pebble,em=/web0s(?!.*chrome)/i.test(We),tm=se,rm=Zn,nm=to.f,im=Q_.set,om=__,am=$_,sm=em,um=ip,cm=tm.MutationObserver||tm.WebKitMutationObserver,dm=tm.document,lm=tm.process,hm=tm.Promise,fm=nm(tm,"queueMicrotask"),pm=fm&&fm.value;pm||(H_=function(){var e,t;for(um&&(e=lm.domain)&&e.exit();z_;){t=z_.fn,z_=z_.next;try{t()}catch(Z$){throw z_?K_():q_=void 0,Z$}}q_=void 0,e&&e.enter()},om||um||sm||!cm||!dm?!am&&hm&&hm.resolve?((Y_=hm.resolve(void 0)).constructor=hm,J_=rm(Y_.then,Y_),K_=function(){J_(H_)}):um?K_=function(){lm.nextTick(H_)}:(im=rm(im,tm),K_=function(){im(H_)}):(X_=!0,W_=dm.createTextNode(""),new cm(H_).observe(W_,{characterData:!0}),K_=function(){W_.data=X_=!X_}));var vm=pm||function(e){var t={fn:e,next:void 0};q_&&(q_.next=t),z_||(z_=t,K_()),q_=t},_m=se,mm=function(e){try{return{error:!1,value:e()}}catch(Z$){return{error:!0,value:Z$}}},ym=function(){this.head=null,this.tail=null};ym.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 gm=ym,Sm=se.Promise,bm="object"==typeof Deno&&Deno&&"object"==typeof Deno.version,Em=!bm&&!ip&&"object"==typeof window&&"object"==typeof document,km=se,Tm=Sm,Im=He,Rm=ia,Am=Vr,wm=_t,Cm=Em,Om=bm,xm=tt;Tm&&Tm.prototype;var Nm=wm("species"),Dm=!1,Pm=Im(km.PromiseRejectionEvent),Mm={CONSTRUCTOR:Rm("Promise",(function(){var e=Am(Tm),t=e!==String(Tm);if(!t&&66===xm)return!0;if(!xm||xm<51||!/native code/.test(e)){var r=new Tm((function(e){e(1)})),n=function(e){e((function(){}),(function(){}))};if((r.constructor={})[Nm]=n,!(Dm=r.then((function(){}))instanceof n))return!0}return!t&&(Cm||Om)&&!Pm})),REJECTION_EVENT:Pm,SUBCLASSING:Dm},Lm={},Um=Yt,Vm=TypeError,Fm=function(e){var t,r;this.promise=new e((function(e,n){if(void 0!==t||void 0!==r)throw Vm("Bad Promise constructor");t=e,r=n})),this.resolve=Um(t),this.reject=Um(r)};Lm.f=function(e){return new Fm(e)};var Bm,jm,Gm,Hm=ha,zm=ip,qm=se,Km=Ut,Xm=wn,Wm=Gc,Ym=wc,Jm=Th,Qm=Yt,Zm=He,$m=kt,ey=Kl,ty=f_,ry=Q_.set,ny=vm,iy=function(e,t){var r=_m.console;r&&r.error&&(1==arguments.length?r.error(e):r.error(e,t))},oy=mm,ay=gm,sy=ln,uy=Sm,cy=Lm,dy="Promise",ly=Mm.CONSTRUCTOR,hy=Mm.REJECTION_EVENT,fy=Mm.SUBCLASSING,py=sy.getterFor(dy),vy=sy.set,_y=uy&&uy.prototype,my=uy,yy=_y,gy=qm.TypeError,Sy=qm.document,by=qm.process,Ey=cy.f,ky=Ey,Ty=!!(Sy&&Sy.createEvent&&qm.dispatchEvent),Iy="unhandledrejection",Ry=function(e){var t;return!(!$m(e)||!Zm(t=e.then))&&t},Ay=function(e,t){var r,n,i,o=t.value,a=1==t.state,s=a?e.ok:e.fail,u=e.resolve,c=e.reject,d=e.domain;try{s?(a||(2===t.rejection&&Ny(t),t.rejection=1),!0===s?r=o:(d&&d.enter(),r=s(o),d&&(d.exit(),i=!0)),r===e.promise?c(gy("Promise-chain cycle")):(n=Ry(r))?Km(n,r,u,c):u(r)):c(o)}catch(Z$){d&&!i&&d.exit(),c(Z$)}},wy=function(e,t){e.notified||(e.notified=!0,ny((function(){for(var r,n=e.reactions;r=n.get();)Ay(r,e);e.notified=!1,t&&!e.rejection&&Oy(e)})))},Cy=function(e,t,r){var n,i;Ty?((n=Sy.createEvent("Event")).promise=t,n.reason=r,n.initEvent(e,!1,!0),qm.dispatchEvent(n)):n={promise:t,reason:r},!hy&&(i=qm["on"+e])?i(n):e===Iy&&iy("Unhandled promise rejection",r)},Oy=function(e){Km(ry,qm,(function(){var t,r=e.facade,n=e.value;if(xy(e)&&(t=oy((function(){zm?by.emit("unhandledRejection",n,r):Cy(Iy,r,n)})),e.rejection=zm||xy(e)?2:1,t.error))throw t.value}))},xy=function(e){return 1!==e.rejection&&!e.parent},Ny=function(e){Km(ry,qm,(function(){var t=e.facade;zm?by.emit("rejectionHandled",t):Cy("rejectionhandled",t,e.value)}))},Dy=function(e,t,r){return function(n){e(t,n,r)}},Py=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=2,wy(e,!0))},My=function(e,t,r){if(!e.done){e.done=!0,r&&(e=r);try{if(e.facade===t)throw gy("Promise can't be resolved itself");var n=Ry(t);n?ny((function(){var r={done:!1};try{Km(n,t,Dy(My,r,e),Dy(Py,r,e))}catch(Z$){Py(r,Z$,e)}})):(e.value=t,e.state=1,wy(e,!1))}catch(Z$){Py({done:!1},Z$,e)}}};if(ly&&(yy=(my=function(e){ey(this,yy),Qm(e),Km(Bm,this);var t=py(this);try{e(Dy(My,t),Dy(Py,t))}catch(Z$){Py(t,Z$)}}).prototype,(Bm=function(e){vy(this,{type:dy,done:!1,notified:!1,parent:!1,reactions:new ay,rejection:!1,state:0,value:void 0})}).prototype=Xm(yy,"then",(function(e,t){var r=py(this),n=Ey(ty(this,my));return r.parent=!0,n.ok=!Zm(e)||e,n.fail=Zm(t)&&t,n.domain=zm?by.domain:void 0,0==r.state?r.reactions.add(n):ny((function(){Ay(n,r)})),n.promise})),jm=function(){var e=new Bm,t=py(e);this.promise=e,this.resolve=Dy(My,t),this.reject=Dy(Py,t)},cy.f=Ey=function(e){return e===my||undefined===e?new jm(e):ky(e)},Zm(uy)&&_y!==Object.prototype)){Gm=_y.then,fy||Xm(_y,"then",(function(e,t){var r=this;return new my((function(e,t){Km(Gm,r,e,t)})).then(e,t)}),{unsafe:!0});try{delete _y.constructor}catch(Z$){}Wm&&Wm(_y,yy)}Hm({global:!0,constructor:!0,wrap:!0,forced:ly},{Promise:my}),Ym(my,dy,!1),Jm(dy);var Ly=Sm,Uy=Mm.CONSTRUCTOR||!Ql((function(e){Ly.all(e).then(void 0,(function(){}))})),Vy=Ut,Fy=Yt,By=Lm,jy=mm,Gy=Hl;ha({target:"Promise",stat:!0,forced:Uy},{all:function(e){var t=this,r=By.f(t),n=r.resolve,i=r.reject,o=jy((function(){var r=Fy(t.resolve),o=[],a=0,s=1;Gy(e,(function(e){var u=a++,c=!1;s++,Vy(r,t,e).then((function(e){c||(c=!0,o[u]=e,--s||n(o))}),i)})),--s||n(o)}));return o.error&&i(o.value),r.promise}});var Hy=ha,zy=Mm.CONSTRUCTOR,qy=Sm,Ky=Xe,Xy=He,Wy=wn,Yy=qy&&qy.prototype;if(Hy({target:"Promise",proto:!0,forced:zy,real:!0},{catch:function(e){return this.then(void 0,e)}}),Xy(qy)){var Jy=Ky("Promise").prototype.catch;Yy.catch!==Jy&&Wy(Yy,"catch",Jy,{unsafe:!0})}var Qy=Ut,Zy=Yt,$y=Lm,eg=mm,tg=Hl;ha({target:"Promise",stat:!0,forced:Uy},{race:function(e){var t=this,r=$y.f(t),n=r.reject,i=eg((function(){var i=Zy(t.resolve);tg(e,(function(e){Qy(i,t,e).then(r.resolve,n)}))}));return i.error&&n(i.value),r.promise}});var rg=Ut,ng=Lm;ha({target:"Promise",stat:!0,forced:Mm.CONSTRUCTOR},{reject:function(e){var t=ng.f(this);return rg(t.reject,void 0,e),t.promise}});var ig=Pt,og=kt,ag=Lm,sg=function(e,t){if(ig(e),og(t)&&t.constructor===e)return t;var r=ag.f(e);return(0,r.resolve)(t),r.promise},ug=ha,cg=Mm.CONSTRUCTOR,dg=sg;Xe("Promise"),ug({target:"Promise",stat:!0,forced:cg},{resolve:function(e){return dg(this,e)}});var lg=ip,hg=Ir.exports,fg=gt,pg=function(e,t,r){return r.get&&hg(r.get,t,{getter:!0}),r.set&&hg(r.set,t,{setter:!0}),fg.f(e,t,r)},vg=St,_g=ye,mg=Pt,yg=La,gg=gf,Sg=Error.prototype.toString,bg=_g((function(){if(vg){var e=yg(Object.defineProperty({},"name",{get:function(){return this===e}}));if("true"!==Sg.call(e))return!0}return"2: 1"!==Sg.call({message:1,name:2})||"Error"!==Sg.call({})}))?function(){var e=mg(this),t=gg(e.name,"Error"),r=gg(e.message);return t?r?t+": "+r:t:r}:Sg,Eg={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}},kg=ha,Tg=function(e){try{if(lg)return Function('return require("'+e+'")')()}catch(Z$){}},Ig=Xe,Rg=ye,Ag=La,wg=Gr,Cg=gt.f,Og=wn,xg=pg,Ng=Pe,Dg=Kl,Pg=Pt,Mg=bg,Lg=gf,Ug=Eg,Vg=Af,Fg=ln,Bg=St,jg="DOMException",Gg="DATA_CLONE_ERR",Hg=Ig("Error"),zg=Ig(jg)||function(){try{(new(Ig("MessageChannel")||Tg("worker_threads").MessageChannel)).port1.postMessage(new WeakMap)}catch(Z$){if(Z$.name==Gg&&25==Z$.code)return Z$.constructor}}(),qg=zg&&zg.prototype,Kg=Hg.prototype,Xg=Fg.set,Wg=Fg.getterFor(jg),Yg="stack"in Hg(jg),Jg=function(e){return Ng(Ug,e)&&Ug[e].m?Ug[e].c:0},Qg=function(){Dg(this,Zg);var e=arguments.length,t=Lg(e<1?void 0:arguments[0]),r=Lg(e<2?void 0:arguments[1],"Error"),n=Jg(r);if(Xg(this,{type:jg,name:r,message:t,code:n}),Bg||(this.name=r,this.message=t,this.code=n),Yg){var i=Hg(t);i.name=jg,Cg(this,"stack",wg(1,Vg(i.stack,1)))}},Zg=Qg.prototype=Ag(Kg),$g=function(e){return{enumerable:!0,configurable:!0,get:e}},eS=function(e){return $g((function(){return Wg(this)[e]}))};Bg&&(xg(Zg,"code",eS("code")),xg(Zg,"message",eS("message")),xg(Zg,"name",eS("name"))),Cg(Zg,"constructor",wg(1,Qg));var tS=Rg((function(){return!(new zg instanceof Hg)})),rS=tS||Rg((function(){return Kg.toString!==Mg||"2: 1"!==String(new zg(1,2))})),nS=tS||Rg((function(){return 25!==new zg(1,"DataCloneError").code}));tS||25!==zg.DATA_CLONE_ERR||qg.DATA_CLONE_ERR;kg({global:!0,constructor:!0,forced:tS},{DOMException:tS?Qg:zg});var iS=Ig(jg),oS=iS.prototype;for(var aS in rS&&zg===iS&&Og(oS,"toString",Mg),nS&&Bg&&zg===iS&&xg(oS,"code",$g((function(){return Jg(Pg(this).name)}))),Ug)if(Ng(Ug,aS)){var sS=Ug[aS],uS=sS.s,cS=wg(6,sS.c);Ng(iS,uS)||Cg(iS,uS,cS),Ng(oS,uS)||Cg(oS,uS,cS)}var dS=ha,lS=se,hS=Xe,fS=Gr,pS=gt.f,vS=Pe,_S=Kl,mS=th,yS=gf,gS=Eg,SS=Af,bS=St,ES="DOMException",kS=hS("Error"),TS=hS(ES),IS=function(){_S(this,RS);var e=arguments.length,t=yS(e<1?void 0:arguments[0]),r=yS(e<2?void 0:arguments[1],"Error"),n=new TS(t,r),i=kS(t);return i.name=ES,pS(n,"stack",fS(1,SS(i.stack,1))),mS(n,this,IS),n},RS=IS.prototype=TS.prototype,AS="stack"in kS(ES),wS="stack"in new TS(1,2),CS=TS&&bS&&Object.getOwnPropertyDescriptor(lS,ES),OS=!(!CS||CS.writable&&CS.configurable),xS=AS&&!OS&&!wS;dS({global:!0,constructor:!0,forced:xS},{DOMException:xS?IS:TS});var NS=hS(ES),DS=NS.prototype;if(DS.constructor!==NS)for(var PS in pS(DS,"constructor",fS(1,NS)),gS)if(vS(gS,PS)){var MS=gS[PS],LS=MS.s;vS(NS,LS)||pS(NS,LS,fS(6,MS.c))}var US="DOMException";wc(Xe(US),US);var VS=Hi.filter;ha({target:"Array",proto:!0,forced:!_v("filter")},{filter:function(e){return VS(this,e,arguments.length>1?arguments[1]:void 0)}});var FS=ha,BS=ye,jS=pi,GS=kt,HS=xe,zS=hi,qS=jp,KS=wd,XS=Mi,WS=_v,YS=tt,JS=_t("isConcatSpreadable"),QS=YS>=51||!BS((function(){var e=[];return e[JS]=!1,e.concat()[0]!==e})),ZS=WS("concat"),$S=function(e){if(!GS(e))return!1;var t=e[JS];return void 0!==t?!!t:jS(e)};FS({target:"Array",proto:!0,arity:1,forced:!QS||!ZS},{concat:function(e){var t,r,n,i,o,a=HS(this),s=XS(a,0),u=0;for(t=-1,n=arguments.length;t<n;t++)if($S(o=-1===t?a:arguments[t]))for(i=zS(o),qS(u+i),r=0;r<i;r++,u++)r in o&&KS(s,u,o[r]);else qS(u+1),KS(s,u++,o);return s.length=u,s}});var eb=Te,tb=xe,rb=Math.floor,nb=eb("".charAt),ib=eb("".replace),ob=eb("".slice),ab=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,sb=/\$([$&'`]|\d{1,2})/g,ub=vf,cb=Ut,db=Te,lb=eu,hb=ye,fb=Pt,pb=He,vb=Ie,_b=si,mb=di,yb=es,gb=we,Sb=Au,bb=Zt,Eb=function(e,t,r,n,i,o){var a=r+e.length,s=n.length,u=sb;return void 0!==i&&(i=tb(i),u=ab),ib(o,u,(function(o,u){var c;switch(nb(u,0)){case"$":return"$";case"&":return e;case"`":return ob(t,0,r);case"'":return ob(t,a);case"<":c=i[ob(u,1,-1)];break;default:var d=+u;if(0===d)return o;if(d>s){var l=rb(d/10);return 0===l?o:l<=s?void 0===n[l-1]?nb(u,1):n[l-1]+nb(u,1):o}c=n[d-1]}return void 0===c?"":c}))},kb=uu,Tb=_t("replace"),Ib=Math.max,Rb=Math.min,Ab=db([].concat),wb=db([].push),Cb=db("".indexOf),Ob=db("".slice),xb="$0"==="a".replace(/./,"$0"),Nb=!!/./[Tb]&&""===/./[Tb]("a","$0"),Db=!hb((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")}));lb("replace",(function(e,t,r){var n=Nb?"$":"$0";return[function(e,r){var n=gb(this),i=vb(e)?void 0:bb(e,Tb);return i?cb(i,e,n,r):cb(t,yb(n),e,r)},function(e,i){var o=fb(this),a=yb(e);if("string"==typeof i&&-1===Cb(i,n)&&-1===Cb(i,"$<")){var s=r(t,o,a,i);if(s.done)return s.value}var u=pb(i);u||(i=yb(i));var c=o.global;if(c){var d=o.unicode;o.lastIndex=0}for(var l=[];;){var h=kb(o,a);if(null===h)break;if(wb(l,h),!c)break;""===yb(h[0])&&(o.lastIndex=Sb(a,mb(o.lastIndex),d))}for(var f,p="",v=0,_=0;_<l.length;_++){for(var m=yb((h=l[_])[0]),y=Ib(Rb(_b(h.index),a.length),0),g=[],S=1;S<h.length;S++)wb(g,void 0===(f=h[S])?f:String(f));var b=h.groups;if(u){var E=Ab([m],g,y,a);void 0!==b&&wb(E,b);var k=yb(ub(i,void 0,E))}else k=Eb(m,a,y,g,b,i);y>=v&&(p+=Ob(a,v,y)+k,v=y+m.length)}return p+Ob(a,v)}]}),!Db||!xb||Nb);var Pb=Ut,Mb=Pe,Lb=Vt,Ub=hs,Vb=RegExp.prototype,Fb=function(e){var t=e.flags;return void 0!==t||"flags"in Vb||Mb(e,"flags")||!Lb(Vb,e)?t:Pb(Ub,e)},Bb=St,jb=se,Gb=Te,Hb=ia,zb=th,qb=qr,Kb=go.f,Xb=Vt,Wb=Wa,Yb=es,Jb=Fb,Qb=ys,Zb=mf,$b=wn,eE=ye,tE=Pe,rE=ln.enforce,nE=Th,iE=bs,oE=Ts,aE=_t("match"),sE=jb.RegExp,uE=sE.prototype,cE=jb.SyntaxError,dE=Gb(uE.exec),lE=Gb("".charAt),hE=Gb("".replace),fE=Gb("".indexOf),pE=Gb("".slice),vE=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,_E=/a/g,mE=/a/g,yE=new sE(_E)!==_E,gE=Qb.MISSED_STICKY,SE=Qb.UNSUPPORTED_Y,bE=Bb&&(!yE||gE||iE||oE||eE((function(){return mE[aE]=!1,sE(_E)!=_E||sE(mE)==mE||"/a/i"!=sE(_E,"i")})));if(Hb("RegExp",bE)){for(var EE=function(e,t){var r,n,i,o,a,s,u=Xb(uE,this),c=Wb(e),d=void 0===t,l=[],h=e;if(!u&&c&&d&&e.constructor===EE)return e;if((c||Xb(uE,e))&&(e=e.source,d&&(t=Jb(h))),e=void 0===e?"":Yb(e),t=void 0===t?"":Yb(t),h=e,iE&&"dotAll"in _E&&(n=!!t&&fE(t,"s")>-1)&&(t=hE(t,/s/g,"")),r=t,gE&&"sticky"in _E&&(i=!!t&&fE(t,"y")>-1)&&SE&&(t=hE(t,/y/g,"")),oE&&(o=function(e){for(var t,r=e.length,n=0,i="",o=[],a={},s=!1,u=!1,c=0,d="";n<=r;n++){if("\\"===(t=lE(e,n)))t+=lE(e,++n);else if("]"===t)s=!1;else if(!s)switch(!0){case"["===t:s=!0;break;case"("===t:dE(vE,pE(e,n+1))&&(n+=2,u=!0),i+=t,c++;continue;case">"===t&&u:if(""===d||tE(a,d))throw new cE("Invalid capture group name");a[d]=!0,o[o.length]=[d,c],u=!1,d="";continue}u?d+=t:i+=t}return[i,o]}(e),e=o[0],l=o[1]),a=zb(sE(e,t),u?this:uE,EE),(n||i||l.length)&&(s=rE(a),n&&(s.dotAll=!0,s.raw=EE(function(e){for(var t,r=e.length,n=0,i="",o=!1;n<=r;n++)"\\"!==(t=lE(e,n))?o||"."!==t?("["===t?o=!0:"]"===t&&(o=!1),i+=t):i+="[\\s\\S]":i+=t+lE(e,++n);return i}(e),r)),i&&(s.sticky=!0),l.length&&(s.groups=l)),e!==h)try{qb(a,"source",""===h?"(?:)":h)}catch(Z$){}return a},kE=Kb(sE),TE=0;kE.length>TE;)Zb(EE,sE,kE[TE++]);uE.constructor=EE,EE.prototype=uE,$b(jb,"RegExp",EE,{constructor:!0})}nE("RegExp");var IE=St,RE=bs,AE=Nn,wE=pg,CE=ln.get,OE=RegExp.prototype,xE=TypeError;IE&&RE&&wE(OE,"dotAll",{configurable:!0,get:function(){if(this!==OE){if("RegExp"===AE(this))return!!CE(this).dotAll;throw xE("Incompatible receiver, RegExp required")}}});var NE=St,DE=ys.MISSED_STICKY,PE=Nn,ME=pg,LE=ln.get,UE=RegExp.prototype,VE=TypeError;NE&&DE&&ME(UE,"sticky",{configurable:!0,get:function(){if(this!==UE){if("RegExp"===PE(this))return!!LE(this).sticky;throw VE("Incompatible receiver, RegExp required")}}});var FE=xr.PROPER,BE=wn,jE=Pt,GE=es,HE=ye,zE=Fb,qE="toString",KE=RegExp.prototype.toString,XE=HE((function(){return"/a/b"!=KE.call({source:"a",flags:"b"})})),WE=FE&&KE.name!=qE;(XE||WE)&&BE(RegExp.prototype,qE,(function(){var e=jE(this);return"/"+GE(e.source)+"/"+GE(zE(e))}),{unsafe:!0});var YE=ha,JE=ye,QE=uo,ZE=to.f,$E=St,ek=JE((function(){ZE(1)}));YE({target:"Object",stat:!0,forced:!$E||ek,sham:!$E},{getOwnPropertyDescriptor:function(e,t){return ZE(QE(e),t)}});var tk=ha,rk=Xe,nk=vf,ik=Ut,ok=Te,ak=ye,sk=pi,uk=He,ck=kt,dk=Ht,lk=mv,hk=it,fk=rk("JSON","stringify"),pk=ok(/./.exec),vk=ok("".charAt),_k=ok("".charCodeAt),mk=ok("".replace),yk=ok(1..toString),gk=/[\uD800-\uDFFF]/g,Sk=/^[\uD800-\uDBFF]$/,bk=/^[\uDC00-\uDFFF]$/,Ek=!hk||ak((function(){var e=rk("Symbol")();return"[null]"!=fk([e])||"{}"!=fk({a:e})||"{}"!=fk(Object(e))})),kk=ak((function(){return'"\\udf06\\ud834"'!==fk("\udf06\ud834")||'"\\udead"'!==fk("\udead")})),Tk=function(e,t){var r=lk(arguments),n=t;if((ck(t)||void 0!==e)&&!dk(e))return sk(t)||(t=function(e,t){if(uk(n)&&(t=ik(n,this,e,t)),!dk(t))return t}),r[1]=t,nk(fk,null,r)},Ik=function(e,t,r){var n=vk(r,t-1),i=vk(r,t+1);return pk(Sk,e)&&!pk(bk,i)||pk(bk,e)&&!pk(Sk,n)?"\\u"+yk(_k(e,0),16):e};fk&&tk({target:"JSON",stat:!0,arity:3,forced:Ek||kk},{stringify:function(e,t,r){var n=lk(arguments),i=nk(Ek?Tk:fk,null,n);return kk&&"string"==typeof i?mk(i,gk,Ik):i}});var Rk=tv;function Ak(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 u,c=t.version<66;if(s&&("user"===s.exact||"environment"===s.exact||"user"===s.ideal||"environment"===s.ideal)&&(!r.mediaDevices.getSupportedConstraints||!r.mediaDevices.getSupportedConstraints().facingMode||c))if(delete e.video.facingMode,"environment"===s.exact||"environment"===s.ideal?u=["back","rear"]:"user"!==s.exact&&"user"!==s.ideal||(u=["front"]),u)return r.mediaDevices.enumerateDevices().then((function(t){var r=(t=t.filter((function(e){return"videoinput"===e.kind}))).find((function(e){return u.some((function(t){return e.label.toLowerCase().includes(t)}))}));return!r&&t.length&&u.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 wk(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function Ck(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 Zp(e,"track",(function(e){return e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e}))}function Ok(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 xk(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 u=function(e){i(s(a(e)))};return t.apply(this,[u,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 sv(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}),Zp(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 sv(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 Dk(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 Pk(e,t){if(e.RTCPeerConnection){if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return Dk(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]=u(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 u(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 Mk(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 Lk(e,t){Zp(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 Uk,Vk,Fk=Object.freeze(Object.defineProperty({__proto__:null,shimMediaStream:wk,shimOnTrack:Ck,shimGetSendersWithDtmf:Ok,shimGetStats:xk,shimSenderReceiverGetStats:Nk,shimAddTrackRemoveTrackWithNative:Dk,shimAddTrackRemoveTrack:Pk,shimPeerConnection:Mk,fixNegotiationNeeded:Lk,shimGetUserMedia:Ak,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"})),Bk=ha,jk=Ut,Gk=He,Hk=Pt,zk=es,qk=(Uk=!1,(Vk=/[ac]/).exec=function(){return Uk=!0,/./.exec.apply(this,arguments)},!0===Vk.test("abc")&&Uk),Kk=/./.test;Bk({target:"RegExp",proto:!0,forced:!qk},{test:function(e){var t=Hk(this),r=zk(e),n=t.exec;if(!Gk(n))return jk(Kk,t,r);var i=jk(n,t,r);return null!==i&&(Hk(i),!0)}});var Xk=se,Wk=ye,Yk=es,Jk=qu.trim,Qk=Te("".charAt),Zk=Xk.parseFloat,$k=Xk.Symbol,eT=$k&&$k.iterator,tT=1/Zk("\t\n\v\f\r \u2028\u2029\ufeff-0")!=-1/0||eT&&!Wk((function(){Zk(Object(eT))}))?function(e){var t=Jk(Yk(e)),r=Zk(t);return 0===r&&"-"==Qk(t,0)?-0:r}:Zk;ha({global:!0,forced:parseFloat!=tT},{parseFloat:tT});var rT=ha,nT=Sm,iT=ye,oT=Xe,aT=He,sT=f_,uT=sg,cT=wn,dT=nT&&nT.prototype;if(rT({target:"Promise",proto:!0,real:!0,forced:!!nT&&iT((function(){dT.finally.call({then:function(){}},(function(){}))}))},{finally:function(e){var t=sT(this,oT("Promise")),r=aT(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)}}),aT(nT)){var lT=oT("Promise").prototype.finally;dT.finally!==lT&&cT(dT,"finally",lT,{unsafe:!0})}function hT(e,t){var r=e&&e.navigator,n=e&&e.MediaStreamTrack;if(r.getUserMedia=function(e,t,n){rv("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 u=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")),u.apply(this,[e])}}}}function fT(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 pT(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 vT(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 _T(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}),Zp(e,"track",(function(e){return e.receiver._pc=e.srcElement,e})),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}}function mT(e){e.RTCPeerConnection&&!("removeStream"in e.RTCPeerConnection.prototype)&&(e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;rv("removeStream","removeTrack"),this.getSenders().forEach((function(r){r.track&&e.getTracks().includes(r.track)&&t.removeTrack(r)}))})}function yT(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function gT(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 ST(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 ET(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 kT=Object.freeze(Object.defineProperty({__proto__:null,shimOnTrack:fT,shimPeerConnection:pT,shimSenderGetStats:vT,shimReceiverGetStats:_T,shimRemoveStream:mT,shimRTCDataChannel:yT,shimAddTransceiver:gT,shimGetParameters:ST,shimCreateOffer:bT,shimCreateAnswer:ET,shimGetUserMedia:hT,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 TT(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 IT(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 u=function(e,t,r){var n=i.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n};t.setLocalDescription=u,u=function(e,t,r){var n=o.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n},t.setRemoteDescription=u,u=function(e,t,r){var n=s.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n},t.addIceCandidate=u}}function AT(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(wT(e))}}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,r,n){t.mediaDevices.getUserMedia(e).then(r,n)}.bind(t))}function wT(e){return e&&void 0!==e.video?Object.assign({},e,{video:ov(e.video)}):e}function CT(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")?(rv("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 OT(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 xT(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 DT=Object.freeze(Object.defineProperty({__proto__:null,shimLocalStreamsAPI:TT,shimRemoteStreamsAPI:IT,shimCallbacksAPI:RT,shimGetUserMedia:AT,shimConstraints:wT,shimRTCIceServerUrls:CT,shimTrackEventTransceiver:OT,shimCreateOfferLegacy:xT,shimAudioContext:NT},Symbol.toStringTag,{value:"Module"})),PT=Ut;ha({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return PT(URL.prototype.toString,this)}});var MT=Te(1..valueOf),LT=St,UT=se,VT=Te,FT=ia,BT=wn,jT=Pe,GT=th,HT=Vt,zT=Ht,qT=dr,KT=ye,XT=go.f,WT=to.f,YT=gt.f,JT=MT,QT=qu.trim,ZT="Number",$T=UT.Number,eI=$T.prototype,tI=UT.TypeError,rI=VT("".slice),nI=VT("".charCodeAt),iI=function(e){var t=qT(e,"number");return"bigint"==typeof t?t:oI(t)},oI=function(e){var t,r,n,i,o,a,s,u,c=qT(e,"number");if(zT(c))throw tI("Cannot convert a Symbol value to a number");if("string"==typeof c&&c.length>2)if(c=QT(c),43===(t=nI(c,0))||45===t){if(88===(r=nI(c,2))||120===r)return NaN}else if(48===t){switch(nI(c,1)){case 66:case 98:n=2,i=49;break;case 79:case 111:n=8,i=55;break;default:return+c}for(a=(o=rI(c,2)).length,s=0;s<a;s++)if((u=nI(o,s))<48||u>i)return NaN;return parseInt(o,n)}return+c};if(FT(ZT,!$T(" 0o1")||!$T("0b1")||$T("+0x1"))){for(var aI,sI=function(e){var t=arguments.length<1?0:$T(iI(e)),r=this;return HT(eI,r)&&KT((function(){JT(r)}))?GT(Object(t),r,sI):t},uI=LT?XT($T):"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(","),cI=0;uI.length>cI;cI++)jT($T,aI=uI[cI])&&!jT(sI,aI)&&YT(sI,aI,WT($T,aI));sI.prototype=eI,eI.constructor=sI,BT(UT,ZT,sI,{constructor:!0})}var dI=xr.PROPER,lI=ye,hI=Uu,fI=qu.trim;ha({target:"String",proto:!0,forced:function(e){return lI((function(){return!!hI[e]()||"
"!=="
"[e]()||dI&&hI[e].name!==e}))}("trim")},{trim:function(){return fI(this)}});var pI,vI,_I={exports:{}};pI=_I,(vI={generateIdentifier:function(){return Math.random().toString(36).substr(2,10)}}).localCName=vI.generateIdentifier(),vI.splitLines=function(e){return e.trim().split("\n").map((function(e){return e.trim()}))},vI.splitSections=function(e){return e.split("\nm=").map((function(e,t){return(t>0?"m="+e:e).trim()+"\r\n"}))},vI.getDescription=function(e){var t=vI.splitSections(e);return t&&t[0]},vI.getMediaSections=function(e){var t=vI.splitSections(e);return t.shift(),t},vI.matchPrefix=function(e,t){return vI.splitLines(e).filter((function(e){return 0===e.indexOf(t)}))},vI.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},vI.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(" ")},vI.parseIceOptions=function(e){return e.substr(14).split(" ")},vI.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},vI.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"},vI.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]}},vI.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+"\r\n"},vI.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},vI.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},vI.parseRtcpFb=function(e){var t=e.substr(e.indexOf(" ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},vI.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},vI.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},vI.parseSsrcGroup=function(e){var t=e.substr(13).split(" ");return{semantics:t.shift(),ssrcs:t.map((function(e){return parseInt(e,10)}))}},vI.getMid=function(e){var t=vI.matchPrefix(e,"a=mid:")[0];if(t)return t.substr(6)},vI.parseFingerprint=function(e){var t=e.substr(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1].toUpperCase()}},vI.getDtlsParameters=function(e,t){return{role:"auto",fingerprints:vI.matchPrefix(e+t,"a=fingerprint:").map(vI.parseFingerprint)}},vI.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},vI.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)}},vI.writeCryptoLine=function(e){return"a=crypto:"+e.tag+" "+e.cryptoSuite+" "+("object"===a(e.keyParams)?vI.writeCryptoKeyParams(e.keyParams):e.keyParams)+(e.sessionParams?" "+e.sessionParams.join(" "):"")+"\r\n"},vI.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}},vI.writeCryptoKeyParams=function(e){return e.keyMethod+":"+e.keySalt+(e.lifeTime?"|"+e.lifeTime:"")+(e.mkiValue&&e.mkiLength?"|"+e.mkiValue+":"+e.mkiLength:"")},vI.getCryptoParameters=function(e,t){return vI.matchPrefix(e+t,"a=crypto:").map(vI.parseCryptoLine)},vI.getIceParameters=function(e,t){var r=vI.matchPrefix(e+t,"a=ice-ufrag:")[0],n=vI.matchPrefix(e+t,"a=ice-pwd:")[0];return r&&n?{usernameFragment:r.substr(12),password:n.substr(10)}:null},vI.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},vI.parseRtpParameters=function(e){for(var t={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},r=vI.splitLines(e)[0].split(" "),n=3;n<r.length;n++){var i=r[n],o=vI.matchPrefix(e,"a=rtpmap:"+i+" ")[0];if(o){var a=vI.parseRtpMap(o),s=vI.matchPrefix(e,"a=fmtp:"+i+" ");switch(a.parameters=s.length?vI.parseFmtp(s[0]):{},a.rtcpFeedback=vI.matchPrefix(e,"a=rtcp-fb:"+i+" ").map(vI.parseRtcpFb),t.codecs.push(a),a.name.toUpperCase()){case"RED":case"ULPFEC":t.fecMechanisms.push(a.name.toUpperCase())}}}return vI.matchPrefix(e,"a=extmap:").forEach((function(e){t.headerExtensions.push(vI.parseExtmap(e))})),t},vI.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+=vI.writeRtpMap(e),r+=vI.writeFmtp(e),r+=vI.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+=vI.writeExtmap(e)})),r},vI.parseRtpEncodingParameters=function(e){var t,r=[],n=vI.parseRtpParameters(e),i=-1!==n.fecMechanisms.indexOf("RED"),o=-1!==n.fecMechanisms.indexOf("ULPFEC"),a=vI.matchPrefix(e,"a=ssrc:").map((function(e){return vI.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute})),s=a.length>0&&a[0].ssrc,u=vI.matchPrefix(e,"a=ssrc-group:FID").map((function(e){return e.substr(17).split(" ").map((function(e){return parseInt(e,10)}))}));u.length>0&&u[0].length>1&&u[0][0]===s&&(t=u[0][1]),n.codecs.forEach((function(e){if("RTX"===e.name.toUpperCase()&&e.parameters.apt){var n={ssrc:s,codecPayloadType:parseInt(e.parameters.apt,10)};s&&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 c=vI.matchPrefix(e,"b=");return c.length&&(c=0===c[0].indexOf("b=TIAS:")?parseInt(c[0].substr(7),10):0===c[0].indexOf("b=AS:")?1e3*parseInt(c[0].substr(5),10)*.95-16e3:void 0,r.forEach((function(e){e.maxBitrate=c}))),r},vI.parseRtcpParameters=function(e){var t={},r=vI.matchPrefix(e,"a=ssrc:").map((function(e){return vI.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute}))[0];r&&(t.cname=r.value,t.ssrc=r.ssrc);var n=vI.matchPrefix(e,"a=rtcp-rsize");t.reducedSize=n.length>0,t.compound=0===n.length;var i=vI.matchPrefix(e,"a=rtcp-mux");return t.mux=i.length>0,t},vI.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},vI.parseMsid=function(e){var t,r=vI.matchPrefix(e,"a=msid:");if(1===r.length)return{stream:(t=r[0].substr(7).split(" "))[0],track:t[1]};var n=vI.matchPrefix(e,"a=ssrc:").map((function(e){return vI.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},vI.parseSctpDescription=function(e){var t,r=vI.parseMLine(e),n=vI.matchPrefix(e,"a=max-message-size:");n.length>0&&(t=parseInt(n[0].substr(19),10)),isNaN(t)&&(t=65536);var i=vI.matchPrefix(e,"a=sctp-port:");if(i.length>0)return{port:parseInt(i[0].substr(12),10),protocol:r.fmt,maxMessageSize:t};var o=vI.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}}},vI.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("")},vI.generateSessionId=function(){return Math.random().toString().substr(2,21)},vI.writeSessionBoilerplate=function(e,t,r){var n=void 0!==t?t:2;return"v=0\r\no="+(r||"thisisadapterortc")+" "+(e||vI.generateSessionId())+" "+n+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},vI.getDirection=function(e,t){for(var r=vI.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?vI.getDirection(t):"sendrecv"},vI.getKind=function(e){return vI.splitLines(e)[0].split(" ")[0].substr(2)},vI.isRejected=function(e){return"0"===e.split(" ",2)[1]},vI.parseMLine=function(e){var t=vI.splitLines(e)[0].substr(2).split(" ");return{kind:t[0],port:parseInt(t[1],10),protocol:t[2],fmt:t.slice(3).join(" ")}},vI.parseOLine=function(e){var t=vI.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]}},vI.isValidSDP=function(e){if("string"!=typeof e||0===e.length)return!1;for(var t=vI.splitLines(e),r=0;r<t.length;r++)if(t[r].length<2||"="!==t[r].charAt(1))return!1;return!0},pI.exports=vI;var mI=_I.exports,yI=e({__proto__:null,default:mI},[_I.exports]);function gI(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=mI.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,Zp(e,"icecandidate",(function(t){return t.candidate&&Object.defineProperty(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t}))}}function SI(e){!e.RTCIceCandidate||e.RTCIceCandidate&&"relayProtocol"in e.RTCIceCandidate.prototype||Zp(e,"icecandidate",(function(e){if(e.candidate){var t=mI.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=mI.splitSections(e.sdp);return t.shift(),t.some((function(e){var t=mI.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=mI.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 u,c=n(arguments[0]),d=i(c),l=o(arguments[0],c);u=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 u}}),this._sctp=h}return a.apply(this,arguments)}}}function EI(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},Zp(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 kI(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 TI(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 II(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 AI=Object.freeze(Object.defineProperty({__proto__:null,shimRTCIceCandidate:gI,shimRTCIceCandidateRelayProtocol:SI,shimMaxMessageSize:bI,shimSendThrowTypeError:EI,shimConnectionState:kI,removeExtmapAllowMixed:TI,shimAddIceCandidateNullOrEmpty:II,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=tv,i=nv(t),o={browserDetails:i,commonShim:AI,extractVersion:Qp,disableLog:$p,disableWarnings:ev,sdp:yI};switch(i.browser){case"chrome":if(!Fk||!Mk||!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=Fk,II(t,i),RI(t),Ak(t,i),wk(t),Mk(t,i),Ck(t),Pk(t,i),Ok(t),xk(t),Nk(t),Lk(t,i),gI(t),SI(t),kI(t),bI(t,i),EI(t),TI(t,i);break;case"firefox":if(!kT||!pT||!r.shimFirefox)return n("Firefox shim is not included in this adapter release."),o;n("adapter.js shimming firefox."),o.browserShim=kT,II(t,i),RI(t),hT(t,i),pT(t,i),fT(t),mT(t),vT(t),_T(t),yT(t),gT(t),ST(t),bT(t),ET(t),gI(t),kI(t),bI(t,i),EI(t);break;case"safari":if(!DT||!r.shimSafari)return n("Safari shim is not included in this adapter release."),o;n("adapter.js shimming safari."),o.browserShim=DT,II(t,i),RI(t),CT(t),xT(t),RT(t),TT(t),IT(t),OT(t),AT(t),NT(t),gI(t),SI(t),bI(t,i),EI(t),TI(t,i);break;default:n("Unsupported browser!")}}({window:"undefined"==typeof window?void 0:window});var wI=Pd,CI=Math.floor,OI=function(e,t){var r=e.length,n=CI(r/2);return r<8?xI(e,t):NI(e,OI(wI(e,0,n),t),OI(wI(e,n),t),t)},xI=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},DI=OI,PI=We.match(/firefox\/(\d+)/i),MI=!!PI&&+PI[1],LI=/MSIE|Trident/.test(We),UI=We.match(/AppleWebKit\/(\d+)\./),VI=!!UI&&+UI[1],FI=ha,BI=Te,jI=Yt,GI=xe,HI=hi,zI=Bv,qI=es,KI=ye,XI=DI,WI=qi,YI=MI,JI=LI,QI=tt,ZI=VI,$I=[],eR=BI($I.sort),tR=BI($I.push),rR=KI((function(){$I.sort(void 0)})),nR=KI((function(){$I.sort(null)})),iR=WI("sort"),oR=!KI((function(){if(QI)return QI<70;if(!(YI&&YI>3)){if(JI)return!0;if(ZI)return ZI<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++)$I.push({k:t+n,v:r})}for($I.sort((function(e,t){return t.v-e.v})),n=0;n<$I.length;n++)t=$I[n].k.charAt(0),i.charAt(i.length-1)!==t&&(i+=t);return"DGBEFHACIJK"!==i}}));FI({target:"Array",proto:!0,forced:rR||!nR||!iR||!oR},{sort:function(e){void 0!==e&&jI(e);var t=GI(this);if(oR)return void 0===e?eR(t):eR(t,e);var r,n,i=[],o=HI(t);for(n=0;n<o;n++)n in t&&tR(i,t[n]);for(XI(i,function(e){return function(t,r){return void 0===r?-1:void 0===t?1:void 0!==e?+e(t,r)||0:qI(t)>qI(r)?1:-1}}(e)),r=HI(i),n=0;n<r;)t[n]=i[n++];for(;n<o;)zI(t,n++);return t}});var aR,sR,uR,cR={exports:{}},dR="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView,lR=dR,hR=St,fR=se,pR=He,vR=kt,_R=Pe,mR=Fn,yR=qt,gR=qr,SR=wn,bR=gt.f,ER=Vt,kR=_c,TR=Gc,IR=_t,RR=Fe,AR=ln.enforce,wR=ln.get,CR=fR.Int8Array,OR=CR&&CR.prototype,xR=fR.Uint8ClampedArray,NR=xR&&xR.prototype,DR=CR&&kR(CR),PR=OR&&kR(OR),MR=Object.prototype,LR=fR.TypeError,UR=IR("toStringTag"),VR=RR("TYPED_ARRAY_TAG"),FR="TypedArrayConstructor",BR=lR&&!!TR&&"Opera"!==mR(fR.opera),jR=!1,GR={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},HR={BigInt64Array:8,BigUint64Array:8},zR=function(e){var t=kR(e);if(vR(t)){var r=wR(t);return r&&_R(r,FR)?r.TypedArrayConstructor:zR(t)}},qR=function(e){if(!vR(e))return!1;var t=mR(e);return _R(GR,t)||_R(HR,t)};for(aR in GR)(uR=(sR=fR[aR])&&sR.prototype)?AR(uR).TypedArrayConstructor=sR:BR=!1;for(aR in HR)(uR=(sR=fR[aR])&&sR.prototype)&&(AR(uR).TypedArrayConstructor=sR);if((!BR||!pR(DR)||DR===Function.prototype)&&(DR=function(){throw LR("Incorrect invocation")},BR))for(aR in GR)fR[aR]&&TR(fR[aR],DR);if((!BR||!PR||PR===MR)&&(PR=DR.prototype,BR))for(aR in GR)fR[aR]&&TR(fR[aR].prototype,PR);if(BR&&kR(NR)!==PR&&TR(NR,PR),hR&&!_R(PR,UR))for(aR in jR=!0,bR(PR,UR,{get:function(){return vR(this)?this[VR]:void 0}}),GR)fR[aR]&&gR(fR[aR],VR,aR);var KR={NATIVE_ARRAY_BUFFER_VIEWS:BR,TYPED_ARRAY_TAG:jR&&VR,aTypedArray:function(e){if(qR(e))return e;throw LR("Target is not a typed array")},aTypedArrayConstructor:function(e){if(pR(e)&&(!TR||ER(DR,e)))return e;throw LR(yR(e)+" is not a typed array constructor")},exportTypedArrayMethod:function(e,t,r,n){if(hR){if(r)for(var i in GR){var o=fR[i];if(o&&_R(o.prototype,e))try{delete o.prototype[e]}catch(Z$){try{o.prototype[e]=t}catch(a){}}}PR[e]&&!r||SR(PR,e,r?t:BR&&OR[e]||t,n)}},exportTypedArrayStaticMethod:function(e,t,r){var n,i;if(hR){if(TR){if(r)for(n in GR)if((i=fR[n])&&_R(i,e))try{delete i[e]}catch(Z$){}if(DR[e]&&!r)return;try{return SR(DR,e,r?t:BR&&DR[e]||t)}catch(Z$){}}for(n in GR)!(i=fR[n])||i[e]&&!r||SR(i,e,t)}},getTypedArrayConstructor:zR,isView:function(e){if(!vR(e))return!1;var t=mR(e);return"DataView"===t||_R(GR,t)||_R(HR,t)},isTypedArray:qR,TypedArray:DR,TypedArrayPrototype:PR},XR=se,WR=ye,YR=Ql,JR=KR.NATIVE_ARRAY_BUFFER_VIEWS,QR=XR.ArrayBuffer,ZR=XR.Int8Array,$R=!JR||!WR((function(){ZR(1)}))||!WR((function(){new ZR(-1)}))||!YR((function(e){new ZR,new ZR(null),new ZR(1.5),new ZR(e)}),!0)||WR((function(){return 1!==new ZR(new QR(2),1,void 0).length})),eA=si,tA=di,rA=RangeError,nA=function(e){if(void 0===e)return 0;var t=eA(e),r=tA(t);if(t!==r)throw rA("Wrong length or index");return r},iA=Array,oA=Math.abs,aA=Math.pow,sA=Math.floor,uA=Math.log,cA=Math.LN2,dA=xe,lA=ko,hA=hi,fA=function(e){for(var t=dA(this),r=hA(t),n=arguments.length,i=lA(n>1?arguments[1]:void 0,r),o=n>2?arguments[2]:void 0,a=void 0===o?r:lA(o,r);a>i;)t[i++]=e;return t},pA=se,vA=Te,_A=St,mA=dR,yA=xr,gA=qr,SA=gh,bA=ye,EA=Kl,kA=si,TA=di,IA=nA,RA={pack:function(e,t,r){var n,i,o,a=iA(r),s=8*r-t-1,u=(1<<s)-1,c=u>>1,d=23===t?aA(2,-24)-aA(2,-77):0,l=e<0||0===e&&1/e<0?1:0,h=0;for((e=oA(e))!=e||e===1/0?(i=e!=e?1:0,n=u):(n=sA(uA(e)/cA),e*(o=aA(2,-n))<1&&(n--,o*=2),(e+=n+c>=1?d/o:d*aA(2,1-c))*o>=2&&(n++,o/=2),n+c>=u?(i=0,n=u):n+c>=1?(i=(e*o-1)*aA(2,t),n+=c):(i=e*aA(2,c-1)*aA(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,u=n-1,c=e[u--],d=127&c;for(c>>=7;s>0;)d=256*d+e[u--],s-=8;for(r=d&(1<<-s)-1,d>>=-s,s+=t;s>0;)r=256*r+e[u--],s-=8;if(0===d)d=1-a;else{if(d===o)return r?NaN:c?-1/0:1/0;r+=aA(2,t),d-=a}return(c?-1:1)*r*aA(2,d-t)}},AA=_c,wA=Gc,CA=go.f,OA=gt.f,xA=fA,NA=Pd,DA=wc,PA=yA.PROPER,MA=yA.CONFIGURABLE,LA=ln.get,UA=ln.set,VA="ArrayBuffer",FA="DataView",BA="Wrong index",jA=pA.ArrayBuffer,GA=jA,HA=GA&&GA.prototype,zA=pA.DataView,qA=zA&&zA.prototype,KA=Object.prototype,XA=pA.Array,WA=pA.RangeError,YA=vA(xA),JA=vA([].reverse),QA=RA.pack,ZA=RA.unpack,$A=function(e){return[255&e]},ew=function(e){return[255&e,e>>8&255]},tw=function(e){return[255&e,e>>8&255,e>>16&255,e>>24&255]},rw=function(e){return e[3]<<24|e[2]<<16|e[1]<<8|e[0]},nw=function(e){return QA(e,23,4)},iw=function(e){return QA(e,52,8)},ow=function(e,t){OA(e.prototype,t,{get:function(){return LA(this)[t]}})},aw=function(e,t,r,n){var i=IA(r),o=LA(e);if(i+t>o.byteLength)throw WA(BA);var a=LA(o.buffer).bytes,s=i+o.byteOffset,u=NA(a,s,s+t);return n?u:JA(u)},sw=function(e,t,r,n,i,o){var a=IA(r),s=LA(e);if(a+t>s.byteLength)throw WA(BA);for(var u=LA(s.buffer).bytes,c=a+s.byteOffset,d=n(+i),l=0;l<t;l++)u[c+l]=d[o?l:t-l-1]};if(mA){var uw=PA&&jA.name!==VA;if(bA((function(){jA(1)}))&&bA((function(){new jA(-1)}))&&!bA((function(){return new jA,new jA(1.5),new jA(NaN),1!=jA.length||uw&&!MA})))uw&&MA&&gA(jA,"name",VA);else{(GA=function(e){return EA(this,HA),new jA(IA(e))}).prototype=HA;for(var cw,dw=CA(jA),lw=0;dw.length>lw;)(cw=dw[lw++])in GA||gA(GA,cw,jA[cw]);HA.constructor=GA}wA&&AA(qA)!==KA&&wA(qA,KA);var hw=new zA(new GA(2)),fw=vA(qA.setInt8);hw.setInt8(0,2147483648),hw.setInt8(1,2147483649),!hw.getInt8(0)&&hw.getInt8(1)||SA(qA,{setInt8:function(e,t){fw(this,e,t<<24>>24)},setUint8:function(e,t){fw(this,e,t<<24>>24)}},{unsafe:!0})}else HA=(GA=function(e){EA(this,HA);var t=IA(e);UA(this,{bytes:YA(XA(t),0),byteLength:t}),_A||(this.byteLength=t)}).prototype,qA=(zA=function(e,t,r){EA(this,qA),EA(e,HA);var n=LA(e).byteLength,i=kA(t);if(i<0||i>n)throw WA("Wrong offset");if(i+(r=void 0===r?n-i:TA(r))>n)throw WA("Wrong length");UA(this,{buffer:e,byteLength:r,byteOffset:i}),_A||(this.buffer=e,this.byteLength=r,this.byteOffset=i)}).prototype,_A&&(ow(GA,"byteLength"),ow(zA,"buffer"),ow(zA,"byteLength"),ow(zA,"byteOffset")),SA(qA,{getInt8:function(e){return aw(this,1,e)[0]<<24>>24},getUint8:function(e){return aw(this,1,e)[0]},getInt16:function(e){var t=aw(this,2,e,arguments.length>1?arguments[1]:void 0);return(t[1]<<8|t[0])<<16>>16},getUint16:function(e){var t=aw(this,2,e,arguments.length>1?arguments[1]:void 0);return t[1]<<8|t[0]},getInt32:function(e){return rw(aw(this,4,e,arguments.length>1?arguments[1]:void 0))},getUint32:function(e){return rw(aw(this,4,e,arguments.length>1?arguments[1]:void 0))>>>0},getFloat32:function(e){return ZA(aw(this,4,e,arguments.length>1?arguments[1]:void 0),23)},getFloat64:function(e){return ZA(aw(this,8,e,arguments.length>1?arguments[1]:void 0),52)},setInt8:function(e,t){sw(this,1,e,$A,t)},setUint8:function(e,t){sw(this,1,e,$A,t)},setInt16:function(e,t){sw(this,2,e,ew,t,arguments.length>2?arguments[2]:void 0)},setUint16:function(e,t){sw(this,2,e,ew,t,arguments.length>2?arguments[2]:void 0)},setInt32:function(e,t){sw(this,4,e,tw,t,arguments.length>2?arguments[2]:void 0)},setUint32:function(e,t){sw(this,4,e,tw,t,arguments.length>2?arguments[2]:void 0)},setFloat32:function(e,t){sw(this,4,e,nw,t,arguments.length>2?arguments[2]:void 0)},setFloat64:function(e,t){sw(this,8,e,iw,t,arguments.length>2?arguments[2]:void 0)}});DA(GA,VA),DA(zA,FA);var pw={ArrayBuffer:GA,DataView:zA},vw=kt,_w=Math.floor,mw=Number.isInteger||function(e){return!vw(e)&&isFinite(e)&&_w(e)===e},yw=si,gw=RangeError,Sw=function(e){var t=yw(e);if(t<0)throw gw("The argument can't be less than 0");return t},bw=RangeError,Ew=function(e,t){var r=Sw(e);if(r%t)throw bw("Wrong offset");return r},kw=Fn,Tw=Te("".slice),Iw=function(e){return"Big"===Tw(kw(e),0,3)},Rw=dr,Aw=TypeError,ww=function(e){var t=Rw(e,"number");if("number"==typeof t)throw Aw("Can't convert number to bigint");return BigInt(t)},Cw=Zn,Ow=Ut,xw=u_,Nw=xe,Dw=hi,Pw=Il,Mw=yl,Lw=hl,Uw=Iw,Vw=KR.aTypedArrayConstructor,Fw=ww,Bw=ha,jw=se,Gw=Ut,Hw=St,zw=$R,qw=KR,Kw=pw,Xw=Kl,Ww=Gr,Yw=qr,Jw=mw,Qw=di,Zw=nA,$w=Ew,eC=fr,tC=Pe,rC=Fn,nC=kt,iC=Ht,oC=La,aC=Vt,sC=Gc,uC=go.f,cC=function(e){var t,r,n,i,o,a,s,u,c=xw(this),d=Nw(e),l=arguments.length,h=l>1?arguments[1]:void 0,f=void 0!==h,p=Mw(d);if(p&&!Lw(p))for(u=(s=Pw(d,p)).next,d=[];!(a=Ow(u,s)).done;)d.push(a.value);for(f&&l>2&&(h=Cw(h,arguments[2])),r=Dw(d),n=new(Vw(c))(r),i=Uw(n),t=0;r>t;t++)o=f?h(d[t],t):d[t],n[t]=i?Fw(o):+o;return n},dC=Hi.forEach,lC=Th,hC=gt,fC=to,pC=th,vC=ln.get,_C=ln.set,mC=ln.enforce,yC=hC.f,gC=fC.f,SC=Math.round,bC=jw.RangeError,EC=Kw.ArrayBuffer,kC=EC.prototype,TC=Kw.DataView,IC=qw.NATIVE_ARRAY_BUFFER_VIEWS,RC=qw.TYPED_ARRAY_TAG,AC=qw.TypedArray,wC=qw.TypedArrayPrototype,CC=qw.aTypedArrayConstructor,OC=qw.isTypedArray,xC="BYTES_PER_ELEMENT",NC="Wrong length",DC=function(e,t){CC(e);for(var r=0,n=t.length,i=new e(n);n>r;)i[r]=t[r++];return i},PC=function(e,t){yC(e,t,{get:function(){return vC(this)[t]}})},MC=function(e){var t;return aC(kC,e)||"ArrayBuffer"==(t=rC(e))||"SharedArrayBuffer"==t},LC=function(e,t){return OC(e)&&!iC(t)&&t in e&&Jw(+t)&&t>=0},UC=function(e,t){return t=eC(t),LC(e,t)?Ww(2,e[t]):gC(e,t)},VC=function(e,t,r){return t=eC(t),!(LC(e,t)&&nC(r)&&tC(r,"value"))||tC(r,"get")||tC(r,"set")||r.configurable||tC(r,"writable")&&!r.writable||tC(r,"enumerable")&&!r.enumerable?yC(e,t,r):(e[t]=r.value,e)};Hw?(IC||(fC.f=UC,hC.f=VC,PC(wC,"buffer"),PC(wC,"byteOffset"),PC(wC,"byteLength"),PC(wC,"length")),Bw({target:"Object",stat:!0,forced:!IC},{getOwnPropertyDescriptor:UC,defineProperty:VC}),cR.exports=function(e,t,r){var n=e.match(/\d+$/)[0]/8,i=e+(r?"Clamped":"")+"Array",o="get"+e,a="set"+e,s=jw[i],u=s,c=u&&u.prototype,d={},l=function(e,t){yC(e,t,{get:function(){return function(e,t){var r=vC(e);return r.view[o](t*n+r.byteOffset,!0)}(this,t)},set:function(e){return function(e,t,i){var o=vC(e);r&&(i=(i=SC(i))<0?0:i>255?255:255&i),o.view[a](t*n+o.byteOffset,i,!0)}(this,t,e)},enumerable:!0})};IC?zw&&(u=t((function(e,t,r,i){return Xw(e,c),pC(nC(t)?MC(t)?void 0!==i?new s(t,$w(r,n),i):void 0!==r?new s(t,$w(r,n)):new s(t):OC(t)?DC(u,t):Gw(cC,u,t):new s(Zw(t)),e,u)})),sC&&sC(u,AC),dC(uC(s),(function(e){e in u||Yw(u,e,s[e])})),u.prototype=c):(u=t((function(e,t,r,i){Xw(e,c);var o,a,s,d=0,h=0;if(nC(t)){if(!MC(t))return OC(t)?DC(u,t):Gw(cC,u,t);o=t,h=$w(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=Qw(i)*n)+h>f)throw bC(NC);s=a/n}else s=Zw(t),o=new EC(a=s*n);for(_C(e,{buffer:o,byteOffset:h,byteLength:a,length:s,view:new TC(o)});d<s;)l(e,d++)})),sC&&sC(u,AC),c=u.prototype=oC(wC)),c.constructor!==u&&Yw(c,"constructor",u),mC(c).TypedArrayConstructor=u,RC&&Yw(c,RC,i);var h=u!=s;d[i]=u,Bw({global:!0,constructor:!0,forced:h,sham:!IC},d),xC in u||Yw(u,xC,n),xC in c||Yw(c,xC,n),lC(i)}):cR.exports=function(){},(0,cR.exports)("Uint8",(function(e){return function(t,r,n){return e(this,t,r,n)}}));var FC=hi,BC=si,jC=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("at",(function(e){var t=jC(this),r=FC(t),n=BC(e),i=n>=0?n:r+n;return i<0||i>=r?void 0:t[i]}));var GC=xe,HC=ko,zC=hi,qC=Bv,KC=Math.min,XC=[].copyWithin||function(e,t){var r=GC(this),n=zC(r),i=HC(e,n),o=HC(t,n),a=arguments.length>2?arguments[2]:void 0,s=KC((void 0===a?n:HC(a,n))-o,n-i),u=1;for(o<i&&i<o+s&&(u=-1,o+=s-1,i+=s-1);s-- >0;)o in r?r[i]=r[o]:qC(r,i),i+=u,o+=u;return r},WC=KR,YC=Te(XC),JC=WC.aTypedArray;(0,WC.exportTypedArrayMethod)("copyWithin",(function(e,t){return YC(JC(this),e,t,arguments.length>2?arguments[2]:void 0)}));var QC=Hi.every,ZC=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("every",(function(e){return QC(ZC(this),e,arguments.length>1?arguments[1]:void 0)}));var $C=fA,eO=ww,tO=Fn,rO=Ut,nO=ye,iO=KR.aTypedArray,oO=KR.exportTypedArrayMethod,aO=Te("".slice),sO=nO((function(){var e=0;return new Int8Array(2).fill({valueOf:function(){return e++}}),1!==e}));oO("fill",(function(e){var t=arguments.length;iO(this);var r="Big"===aO(tO(this),0,3)?eO(e):+e;return rO($C,this,r,t>1?arguments[1]:void 0,t>2?arguments[2]:void 0)}),sO);var uO=hi,cO=function(e,t){for(var r=0,n=uO(t),i=new e(n);n>r;)i[r]=t[r++];return i},dO=f_,lO=KR.aTypedArrayConstructor,hO=KR.getTypedArrayConstructor,fO=function(e){return lO(dO(e,hO(e)))},pO=cO,vO=fO,_O=Hi.filter,mO=function(e,t){return pO(vO(e),t)},yO=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("filter",(function(e){var t=_O(yO(this),e,arguments.length>1?arguments[1]:void 0);return mO(this,t)}));var gO=Hi.find,SO=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("find",(function(e){return gO(SO(this),e,arguments.length>1?arguments[1]:void 0)}));var bO=Hi.findIndex,EO=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("findIndex",(function(e){return bO(EO(this),e,arguments.length>1?arguments[1]:void 0)}));var kO=Zn,TO=ni,IO=xe,RO=hi,AO=function(e){var t=1==e;return function(r,n,i){for(var o,a=IO(r),s=TO(a),u=kO(n,i),c=RO(s);c-- >0;)if(u(o=s[c],c,a))switch(e){case 0:return o;case 1:return c}return t?-1:void 0}},wO={findLast:AO(0),findLastIndex:AO(1)},CO=wO.findLast,OO=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("findLast",(function(e){return CO(OO(this),e,arguments.length>1?arguments[1]:void 0)}));var xO=wO.findLastIndex,NO=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("findLastIndex",(function(e){return xO(NO(this),e,arguments.length>1?arguments[1]:void 0)}));var DO=Hi.forEach,PO=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("forEach",(function(e){DO(PO(this),e,arguments.length>1?arguments[1]:void 0)}));var MO=wo.includes,LO=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("includes",(function(e){return MO(LO(this),e,arguments.length>1?arguments[1]:void 0)}));var UO=wo.indexOf,VO=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("indexOf",(function(e){return UO(VO(this),e,arguments.length>1?arguments[1]:void 0)}));var FO=se,BO=ye,jO=Te,GO=KR,HO=bd,zO=_t("iterator"),qO=FO.Uint8Array,KO=jO(HO.values),XO=jO(HO.keys),WO=jO(HO.entries),YO=GO.aTypedArray,JO=GO.exportTypedArrayMethod,QO=qO&&qO.prototype,ZO=!BO((function(){QO[zO].call([1])})),$O=!!QO&&QO.values&&QO[zO]===QO.values&&"values"===QO.values.name,ex=function(){return KO(YO(this))};JO("entries",(function(){return WO(YO(this))}),ZO),JO("keys",(function(){return XO(YO(this))}),ZO),JO("values",ex,ZO||!$O,{name:"values"}),JO(zO,ex,ZO||!$O,{name:"values"});var tx=KR.aTypedArray,rx=KR.exportTypedArrayMethod,nx=Te([].join);rx("join",(function(e){return nx(tx(this),e)}));var ix=vf,ox=uo,ax=si,sx=hi,ux=qi,cx=Math.min,dx=[].lastIndexOf,lx=!!dx&&1/[1].lastIndexOf(1,-0)<0,hx=ux("lastIndexOf"),fx=lx||!hx?function(e){if(lx)return ix(dx,this,arguments)||0;var t=ox(this),r=sx(t),n=r-1;for(arguments.length>1&&(n=cx(n,ax(arguments[1]))),n<0&&(n=r+n);n>=0;n--)if(n in t&&t[n]===e)return n||0;return-1}:dx,px=vf,vx=fx,_x=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("lastIndexOf",(function(e){var t=arguments.length;return px(vx,_x(this),t>1?[e,arguments[1]]:[e])}));var mx=Hi.map,yx=fO,gx=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("map",(function(e){return mx(gx(this),e,arguments.length>1?arguments[1]:void 0,(function(e,t){return new(yx(e))(t)}))}));var Sx=np.left,bx=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("reduce",(function(e){var t=arguments.length;return Sx(bx(this),e,t,t>1?arguments[1]:void 0)}));var Ex=np.right,kx=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("reduceRight",(function(e){var t=arguments.length;return Ex(kx(this),e,t,t>1?arguments[1]:void 0)}));var Tx=KR.aTypedArray,Ix=KR.exportTypedArrayMethod,Rx=Math.floor;Ix("reverse",(function(){for(var e,t=this,r=Tx(t).length,n=Rx(r/2),i=0;i<n;)e=t[i],t[i++]=t[--r],t[r]=e;return t}));var Ax=se,wx=Ut,Cx=KR,Ox=hi,xx=Ew,Nx=xe,Dx=ye,Px=Ax.RangeError,Mx=Ax.Int8Array,Lx=Mx&&Mx.prototype,Ux=Lx&&Lx.set,Vx=Cx.aTypedArray,Fx=Cx.exportTypedArrayMethod,Bx=!Dx((function(){var e=new Uint8ClampedArray(2);return wx(Ux,e,{length:1,0:3},1),3!==e[1]})),jx=Bx&&Cx.NATIVE_ARRAY_BUFFER_VIEWS&&Dx((function(){var e=new Mx(2);return e.set(1),e.set("2",1),0!==e[0]||2!==e[1]}));Fx("set",(function(e){Vx(this);var t=xx(arguments.length>1?arguments[1]:void 0,1),r=Nx(e);if(Bx)return wx(Ux,this,r,t);var n=this.length,i=Ox(r),o=0;if(i+t>n)throw Px("Wrong length");for(;o<i;)this[t+o]=r[o++]}),!Bx||jx);var Gx=fO,Hx=mv,zx=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("slice",(function(e,t){for(var r=Hx(zx(this),e,t),n=Gx(this),i=0,o=r.length,a=new n(o);o>i;)a[i]=r[i++];return a}),ye((function(){new Int8Array(1).slice()})));var qx=Hi.some,Kx=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("some",(function(e){return qx(Kx(this),e,arguments.length>1?arguments[1]:void 0)}));var Xx=Wn,Wx=ye,Yx=Yt,Jx=DI,Qx=MI,Zx=LI,$x=tt,eN=VI,tN=KR.aTypedArray,rN=KR.exportTypedArrayMethod,nN=se.Uint16Array,iN=nN&&Xx(nN.prototype.sort),oN=!(!iN||Wx((function(){iN(new nN(2),null)}))&&Wx((function(){iN(new nN(2),{})}))),aN=!!iN&&!Wx((function(){if($x)return $x<74;if(Qx)return Qx<67;if(Zx)return!0;if(eN)return eN<602;var e,t,r=new nN(516),n=Array(516);for(e=0;e<516;e++)t=e%4,r[e]=515-e,n[e]=e-2*t+3;for(iN(r,(function(e,t){return(e/4|0)-(t/4|0)})),e=0;e<516;e++)if(r[e]!==n[e])return!0}));rN("sort",(function(e){return void 0!==e&&Yx(e),aN?iN(this,e):Jx(tN(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))}),!aN||oN);var sN=vf,uN=KR,cN=ye,dN=mv,lN=se.Int8Array,hN=uN.aTypedArray,fN=uN.exportTypedArrayMethod,pN=[].toLocaleString,vN=!!lN&&cN((function(){pN.call(new lN(1))}));fN("toLocaleString",(function(){return sN(pN,vN?dN(hN(this)):hN(this),dN(arguments))}),cN((function(){return[1,2].toLocaleString()!=new lN([1,2]).toLocaleString()}))||!cN((function(){lN.prototype.toLocaleString.call([1,2])})));var _N=KR.exportTypedArrayMethod,mN=ye,yN=Te,gN=se.Uint8Array,SN=gN&&gN.prototype||{},bN=[].toString,EN=yN([].join);mN((function(){bN.call({})}))&&(bN=function(){return EN(this)});var kN=SN.toString!=bN;_N("toString",bN,kN);var TN=hi,IN=function(e,t){for(var r=TN(e),n=new t(r),i=0;i<r;i++)n[i]=e[r-i-1];return n},RN=KR.aTypedArray,AN=KR.getTypedArrayConstructor;(0,KR.exportTypedArrayMethod)("toReversed",(function(){return IN(RN(this),AN(this))}));var wN=Yt,CN=cO,ON=KR.aTypedArray,xN=KR.getTypedArrayConstructor,NN=KR.exportTypedArrayMethod,DN=Te(KR.TypedArrayPrototype.sort);NN("toSorted",(function(e){void 0!==e&&wN(e);var t=ON(this),r=CN(xN(t),t);return DN(r,e)}));var PN=hi,MN=si,LN=RangeError,UN=function(e,t,r,n){var i=PN(e),o=MN(r),a=o<0?i+o:o;if(a>=i||a<0)throw LN("Incorrect index");for(var s=new t(i),u=0;u<i;u++)s[u]=u===a?n:e[u];return s},VN=Iw,FN=si,BN=ww,jN=KR.aTypedArray,GN=KR.getTypedArrayConstructor,HN=KR.exportTypedArrayMethod,zN=!!function(){try{new Int8Array(1).with(2,{valueOf:function(){throw 8}})}catch(Z$){return 8===Z$}}();HN("with",{with:function(e,t){var r=jN(this),n=FN(e),i=VN(r)?BN(t):+t;return UN(r,GN(r),n,i)}}.with,!zN);var qN=ha,KN=Hi.findIndex,XN=Ga,WN="findIndex",YN=!0;WN in[]&&Array(1).findIndex((function(){YN=!1})),qN({target:"Array",proto:!0,forced:YN},{findIndex:function(e){return KN(this,e,arguments.length>1?arguments[1]:void 0)}}),XN(WN);var JN=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}(JN||{}),QN=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}(QN||{}),ZN=l((function e(t,r,n){c(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})),$N=St,eD=Te,tD=_a,rD=uo,nD=eD(ro.f),iD=eD([].push),oD=function(e){return function(t){for(var r,n=rD(t),i=tD(n),o=i.length,a=0,s=[];o>a;)r=i[a++],$N&&!nD(n,r)||iD(s,e?[r,n[r]]:n[r]);return s}},aD={entries:oD(!0),values:oD(!1)}.entries;ha({target:"Object",stat:!0},{entries:function(e){return aD(e)}});var sD=si,uD=es,cD=we,dD=RangeError,lD=Te,hD=di,fD=es,pD=function(e){var t=uD(cD(this)),r="",n=sD(e);if(n<0||n==1/0)throw dD("Wrong number of repetitions");for(;n>0;(n>>>=1)&&(t+=t))1&n&&(r+=t);return r},vD=we,_D=lD(pD),mD=lD("".slice),yD=Math.ceil,gD=function(e){return function(t,r,n){var i,o,a=fD(vD(t)),s=hD(r),u=a.length,c=void 0===n?" ":fD(n);return s<=u||""==c?a:((o=_D(c,yD((i=s-u)/c.length))).length>i&&(o=mD(o,0,i)),e?a+o:o+a)}},SD={start:gD(!1),end:gD(!0)},bD=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(We),ED=SD.end;ha({target:"String",proto:!0,forced:bD},{padEnd:function(e){return ED(this,e,arguments.length>1?arguments[1]:void 0)}});var kD=nc;ha({target:"Number",stat:!0,forced:Number.parseInt!=kD},{parseInt:kD});var TD=Pt,ID=Cl,RD=Zn,AD=Ut,wD=xe,CD=function(e,t,r,n){try{return n?t(TD(r)[0],r[1]):t(r)}catch(Z$){ID(e,"throw",Z$)}},OD=hl,xD=wi,ND=hi,DD=wd,PD=Il,MD=yl,LD=Array,UD=function(e){var t=wD(e),r=xD(this),n=arguments.length,i=n>1?arguments[1]:void 0,o=void 0!==i;o&&(i=RD(i,n>2?arguments[2]:void 0));var a,s,u,c,d,l,h=MD(t),f=0;if(!h||this===LD&&OD(h))for(a=ND(t),s=r?new this(a):LD(a);a>f;f++)l=o?i(t[f],f):t[f],DD(s,f,l);else for(d=(c=PD(t,h)).next,s=r?new this:[];!(u=AD(d,c)).done;f++)l=o?CD(c,i,[u.value,f],!0):u.value,DD(s,f,l);return s.length=f,s},VD=UD;ha({target:"Array",stat:!0,forced:!Ql((function(e){Array.from(e)}))},{from:VD});var FD=Math.log,BD=Math.LOG10E;ha({target:"Math",stat:!0},{log10:Math.log10||function(e){return FD(e)*BD}});var jD,GD=ha,HD=Wn,zD=to.f,qD=di,KD=es,XD=Qa,WD=we,YD=rs,JD=HD("".startsWith),QD=HD("".slice),ZD=Math.min,$D=YD("startsWith"),eP=!$D&&!!function(){var e=zD(String.prototype,"startsWith");return e&&!e.writable}();GD({target:"String",proto:!0,forced:!eP&&!$D},{startsWith:function(e){var t=KD(WD(this));XD(e);var r=qD(ZD(arguments.length>1?arguments[1]:void 0,t.length)),n=KD(e);return JD?JD(t,n,r):QD(t,r,r+n.length)===n}});var tP=new Uint8Array(16);function rP(){if(!jD&&!(jD="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 jD(tP)}var nP=/^(?:[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 iP(e){return"string"==typeof e&&nP.test(e)}for(var oP=[],aP=0;aP<256;++aP)oP.push((aP+256).toString(16).substr(1));function sP(e,t,r){var n=(e=e||{}).random||(e.rng||rP)();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=(oP[e[t+0]]+oP[e[t+1]]+oP[e[t+2]]+oP[e[t+3]]+"-"+oP[e[t+4]]+oP[e[t+5]]+"-"+oP[e[t+6]]+oP[e[t+7]]+"-"+oP[e[t+8]]+oP[e[t+9]]+"-"+oP[e[t+10]]+oP[e[t+11]]+oP[e[t+12]]+oP[e[t+13]]+oP[e[t+14]]+oP[e[t+15]]).toLowerCase();if(!iP(r))throw TypeError("Stringified UUID is invalid");return r}(n)}var uP=new TextDecoder,cP=new TextEncoder,dP=function(){return sP()},lP=function(){return Date.now()};function hP(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 u=new e(t),c=0,d=0,l=n;d<l.length;d++){var h=l[d];u.set(h,c),c+=h.length}return u}var fP=function(){return"undefined"==typeof window},pP=function(){function e(){c(this,e)}var t,r;return l(e,null,[{key:"token2auth",value:function(t,r,n,i){return i?"Bearer ".concat(i):"Basic ".concat(e.createUnsafeToken(t,r,n))}},{key:"createUnsafeToken",value:function(e,t,r){return window.btoa([e,t,r].filter((function(e){return null!==e})).join(":"))}},{key:"merge",value:function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=0,i=Object.entries(t);n<i.length;n++){var o=E(i[n],2),s=o[0],u=o[1];null!==u&&"object"===a(u)?e.merge(t[s],r[s]):void 0!==r[s]&&(t[s]=r[s])}}},{key:"ab2str",value:function(e){return uP.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 cP.encode(e).buffer}},{key:"ab2b64str",value:(r=u(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=u(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 vP(e){return new Promise((function(t){window.setTimeout(t,e)}))}function _P(){var e="none";return fP()||(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 mP=function(){if("chrome-stable"===_P()){var e=window.navigator.userAgent.match(/Chrome\/([\d.]+)/);if(e&&e.length>1)if(Number(e[1].split(".")[0])<114)return!0}return!1}(),yP="mozilla"===_P(),gP="safari"===_P(),SP=!fP()&&navigator.userAgent.toLowerCase().includes("mobile");function bP(){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 EP=function(){return Math.floor(65535*Math.random())};function kP(e){return"string"==typeof e&&e.indexOf("__web__rtc__rtt__")>-1}function TP(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 u={};for(var c in t)u[c]=e(t[c]);return u}return t}))}var IP=function(){var e=u(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],(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=8,r.createOffer();case 8:return n=e.sent,r.close(),e.abrupt("return",n.sdp);case 11:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),RP=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 AP(e){return+Math.max(-127,10*Math.log10(Math.pow(e/255,2))).toFixed(2)}function wP(e){return(e&V.AUDIO)===V.AUDIO}function CP(e){return(e&V.VIDEO)===V.VIDEO}function OP(e){var t={};return Object.keys(e).forEach((function(r){"object"===a(e[r])?t[r]=OP(e[r]):r.startsWith("_")||(t[r]=e[r])})),t}function xP(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 NP(e,t){if("boolean"!=typeof e)throw new ZN(JN.INVALID_PARAMS,"Invalid ".concat(t,": The value should be boolean type."))}function DP(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 ZN(JN.INVALID_PARAMS,"Invalid ".concat(t,": the value range is [").concat(r,", ").concat(n,"]. integer only"));throw i}}function PP(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 ZN(JN.INVALID_PARAMS,"".concat(t," cannot be empty"));if(!BP(e,r,n))throw new ZN(JN.INVALID_PARAMS,"Invalid ".concat(t,": The value should be string type. Length of the string: [").concat(r,",").concat(n,"]"))}function MP(e,t,r){if(!r.includes(e))throw new ZN(JN.INVALID_PARAMS,"Invalid ".concat(t,": The value can only be set as ").concat(JSON.stringify(r)))}function LP(e){if(!(e instanceof MediaStreamTrack))throw new ZN(JN.INVALID_PARAMS,"Invalid track, The value should be MediaStreamTrack type.")}function UP(e,t){if(jP(e))throw new ZN(JN.INVALID_PARAMS,"Invalid ".concat(t,", should not be empty"))}function VP(e,t){if(!(e instanceof ArrayBuffer))throw new ZN(JN.INVALID_PARAMS,"Invalid ".concat(t,", should be ArrayBuffer"))}function FP(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 BP(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 GP(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new ZN(JN.INVALID_PARAMS,"The RoomId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function HP(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new ZN(JN.INVALID_PARAMS,"The userId 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 ZN(JN.INVALID_PARAMS,"The publicStreamId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function qP(e){UP(e,"userInfo"),HP(e.userId),jP(e.extraInfo)||PP(e.extraInfo,"userInfo.extraInfo",1,200)}function KP(e){UP(e,"roomConfig"),NP(e.isAutoPublish,"roomConfig.isAutoPublish"),NP(e.isAutoSubscribeAudio,"roomConfig.isAutoSubscribeAudio"),NP(e.isAutoSubscribeVideo,"roomConfig.isAutoSubscribeVideo")}function XP(e){UP(e,"videoPlayerOption")}function WP(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 ZN(JN.INVALID_PARAMS,"The message cannot be empty");if((null===(t=e instanceof ArrayBuffer?e:pP.str2ab(JSON.stringify(e)))||void 0===t?void 0:t.byteLength)>1e3*r)throw new ZN(JN.INVALID_PARAMS,"The message length must be less than ".concat(r,"K"))}function YP(e){return![ie.onRemoteStreamStats,ie.onLocalStreamStats,ie.onAudioVolumeIndication,ie.onLocalAudioPropertiesReport,ie.onRemoteAudioPropertiesReport].includes(e)}function JP(e){if("number"!=typeof(null==e?void 0:e.width)||"number"!=typeof(null==e?void 0:e.height))throw new ZN(JN.INVALID_PARAMS,"remoteVideoConfig must contain width, height, frameRate")}var QP={},ZP=_t;QP.f=ZP;var $P=se,eM=Pe,tM=QP,rM=gt.f,nM=function(e){var t=$P.Symbol||($P.Symbol={});eM(t,e)||rM(t,e,{value:tM.f(e)})},iM=Ut,oM=Xe,aM=_t,sM=wn,uM=ha,cM=se,dM=Ut,lM=Te,hM=St,fM=it,pM=ye,vM=Pe,_M=Vt,mM=Pt,yM=uo,gM=fr,SM=es,bM=Gr,EM=La,kM=_a,TM=go,IM=Td,RM=Vo,AM=to,wM=gt,CM=fa,OM=ro,xM=wn,NM=ue.exports,DM=Jr,PM=Fe,MM=_t,LM=QP,UM=nM,VM=function(){var e=oM("Symbol"),t=e&&e.prototype,r=t&&t.valueOf,n=aM("toPrimitive");t&&!t[n]&&sM(t,n,(function(e){return iM(r,this)}),{arity:1})},FM=wc,BM=ln,jM=Hi.forEach,GM=Yr("hidden"),HM="Symbol",zM=BM.set,qM=BM.getterFor(HM),KM=Object.prototype,XM=cM.Symbol,WM=XM&&XM.prototype,YM=cM.TypeError,JM=cM.QObject,QM=AM.f,ZM=wM.f,$M=IM.f,eL=OM.f,tL=lM([].push),rL=NM("symbols"),nL=NM("op-symbols"),iL=NM("wks"),oL=!JM||!JM.prototype||!JM.prototype.findChild,aL=hM&&pM((function(){return 7!=EM(ZM({},"a",{get:function(){return ZM(this,"a",{value:7}).a}})).a}))?function(e,t,r){var n=QM(KM,t);n&&delete KM[t],ZM(e,t,r),n&&e!==KM&&ZM(KM,t,n)}:ZM,sL=function(e,t){var r=rL[e]=EM(WM);return zM(r,{type:HM,tag:e,description:t}),hM||(r.description=t),r},uL=function(e,t,r){e===KM&&uL(nL,t,r),mM(e);var n=gM(t);return mM(r),vM(rL,n)?(r.enumerable?(vM(e,GM)&&e[GM][n]&&(e[GM][n]=!1),r=EM(r,{enumerable:bM(0,!1)})):(vM(e,GM)||ZM(e,GM,bM(1,{})),e[GM][n]=!0),aL(e,n,r)):ZM(e,n,r)},cL=function(e,t){mM(e);var r=yM(t),n=kM(r).concat(fL(r));return jM(n,(function(t){hM&&!dM(dL,r,t)||uL(e,t,r[t])})),e},dL=function(e){var t=gM(e),r=dM(eL,this,t);return!(this===KM&&vM(rL,t)&&!vM(nL,t))&&(!(r||!vM(this,t)||!vM(rL,t)||vM(this,GM)&&this[GM][t])||r)},lL=function(e,t){var r=yM(e),n=gM(t);if(r!==KM||!vM(rL,n)||vM(nL,n)){var i=QM(r,n);return!i||!vM(rL,n)||vM(r,GM)&&r[GM][n]||(i.enumerable=!0),i}},hL=function(e){var t=$M(yM(e)),r=[];return jM(t,(function(e){vM(rL,e)||vM(DM,e)||tL(r,e)})),r},fL=function(e){var t=e===KM,r=$M(t?nL:yM(e)),n=[];return jM(r,(function(e){!vM(rL,e)||t&&!vM(KM,e)||tL(n,rL[e])})),n};fM||(XM=function(){if(_M(WM,this))throw YM("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?SM(arguments[0]):void 0,t=PM(e),r=function(e){this===KM&&dM(r,nL,e),vM(this,GM)&&vM(this[GM],t)&&(this[GM][t]=!1),aL(this,t,bM(1,e))};return hM&&oL&&aL(KM,t,{configurable:!0,set:r}),sL(t,e)},xM(WM=XM.prototype,"toString",(function(){return qM(this).tag})),xM(XM,"withoutSetter",(function(e){return sL(PM(e),e)})),OM.f=dL,wM.f=uL,CM.f=cL,AM.f=lL,TM.f=IM.f=hL,RM.f=fL,LM.f=function(e){return sL(MM(e),e)},hM&&(ZM(WM,"description",{configurable:!0,get:function(){return qM(this).description}}),xM(KM,"propertyIsEnumerable",dL,{unsafe:!0}))),uM({global:!0,constructor:!0,wrap:!0,forced:!fM,sham:!fM},{Symbol:XM}),jM(kM(iL),(function(e){UM(e)})),uM({target:HM,stat:!0,forced:!fM},{useSetter:function(){oL=!0},useSimple:function(){oL=!1}}),uM({target:"Object",stat:!0,forced:!fM,sham:!hM},{create:function(e,t){return void 0===t?EM(e):cL(EM(e),t)},defineProperty:uL,defineProperties:cL,getOwnPropertyDescriptor:lL}),uM({target:"Object",stat:!0,forced:!fM},{getOwnPropertyNames:hL}),VM(),FM(XM,HM),DM[GM]=!0;var pL=it&&!!Symbol.for&&!!Symbol.keyFor,vL=ha,_L=Xe,mL=Pe,yL=es,gL=ue.exports,SL=pL,bL=gL("string-to-symbol-registry"),EL=gL("symbol-to-string-registry");vL({target:"Symbol",stat:!0,forced:!SL},{for:function(e){var t=yL(e);if(mL(bL,t))return bL[t];var r=_L("Symbol")(t);return bL[t]=r,EL[r]=t,r}});var kL=ha,TL=Pe,IL=Ht,RL=qt,AL=pL,wL=(0,ue.exports)("symbol-to-string-registry");kL({target:"Symbol",stat:!0,forced:!AL},{keyFor:function(e){if(!IL(e))throw TypeError(RL(e)+" is not a symbol");if(TL(wL,e))return wL[e]}});var CL=Vo,OL=xe;ha({target:"Object",stat:!0,forced:!it||ye((function(){CL.f(1)}))},{getOwnPropertySymbols:function(e){var t=CL.f;return t?t(OL(e)):[]}});var xL={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),u=r?r+t:t;return e._events[u]?e._events[u].fn?e._events[u]=[e._events[u],s]:e._events[u].push(s):(e._events[u]=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 u,c,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(c=1,u=new Array(l-1);c<l;c++)u[c-1]=arguments[c];d.fn.apply(d.context,u)}else{var h,f=d.length;for(c=0;c<f;c++)switch(d[c].once&&this.removeListener(e,d[c].fn,void 0,!0),l){case 1:d[c].fn.call(d[c].context);break;case 2:d[c].fn.call(d[c].context,t);break;case 3:d[c].fn.call(d[c].context,t,n);break;case 4:d[c].fn.call(d[c].context,t,n,i);break;default:if(!u)for(h=1,u=new Array(l-1);h<l;h++)u[h-1]=arguments[h];d[c].fn.apply(d[c].context,u)}}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 u=0,c=[],d=s.length;u<d;u++)(s[u].fn!==t||i&&!s[u].once||n&&s[u].context!==n)&&c.push(s[u]);c.length?this._events[o]=1===c.length?c[0]:c: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}(xL);var NL=xL.exports,DL="[VERTC]",PL=["#0050b3","#0050b3","#0050b3","#0050b3","#0050b3"],ML=!fP()&&window.location.search.includes("_rtc_debug_"),LL=function(){function e(t,r,n){c(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){var t;if(ML){for(var r="",n=0;n<this._indent;n++)r+=" ";for(var i=arguments.length,o=new Array(i>1?i-1:0),a=1;a<i;a++)o[a-1]=arguments[a];(t=console).log.apply(t,["%c".concat(DL).concat(r,"[").concat(this._module,".").concat(e,"] ").concat(o.shift()),"color:".concat(PL[this._indent],";")].concat(o))}}}]),e}(),UL=new LL("VERTC",0),VL=function(e){f(n,e);var t,r=g(n);function n(){return c(this,n),r.apply(this,arguments)}return l(n,[{key:"safeEmit",value:function(e){var t=this.listenerCount(e);try{for(var r,i=arguments.length,o=new Array(i>1?i-1:0),a=1;a<i;a++)o[a-1]=arguments[a];return(r=b(p(n.prototype),"emit",this)).call.apply(r,[this,e].concat(o))}catch(Z$){return UL.print("safaEmit","safeEmit() | event listener threw an error [event:%s]:%o",e,Z$),Boolean(t)}}},{key:"safeEmitAsPromise",value:(t=u(o().mark((function e(t){var r,n,i,a=this,s=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(r=s.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=s[i];return e.abrupt("return",new Promise((function(e,r){try{a.emit.apply(a,[t].concat(n,[e,r]))}catch(Z$){UL.print("safeEmitAsPromise","safeEmitAsPromise() | event listener threw an error [event:%s]:%o",t,Z$),r(Z$)}})));case 2:case"end":return e.stop()}}),e)}))),function(e){return t.apply(this,arguments)})}]),n}(xL.exports.EventEmitter),FL=Pe,BL=function(e){return void 0!==e&&(FL(e,"value")||FL(e,"writable"))},jL=Ut,GL=kt,HL=Pt,zL=BL,qL=to,KL=_c;ha({target:"Reflect",stat:!0},{get:function e(t,r){var n,i,o=arguments.length<3?t:arguments[2];return HL(t)===o?t[r]:(n=qL.f(t,r))?zL(n)?n.value:void 0===n.get?void 0:jL(n.get,o):GL(i=KL(t))?e(i,r,o):void 0}});var XL=se,WL=wc;ha({global:!0},{Reflect:{}}),WL(XL.Reflect,"Reflect",!0);var YL=Ut,JL=Pt,QL=kt,ZL=BL,$L=gt,eU=to,tU=_c,rU=Gr;ha({target:"Reflect",stat:!0,forced:ye((function(){var e=function(){},t=$L.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],u=eU.f(JL(t),r);if(!u){if(QL(o=tU(t)))return e(o,r,n,s);u=rU(0)}if(ZL(u)){if(!1===u.writable||!QL(s))return!1;if(i=eU.f(s,r)){if(i.get||i.set||!1===i.writable)return!1;i.value=n,$L.f(s,r,i)}else $L.f(s,r,rU(0,n))}else{if(void 0===(a=u.set))return!1;YL(a,s,n)}return!0}});var nU=ha,iU=xe,oU=hi,aU=Fp,sU=Bv,uU=jp,cU=1!==[].unshift(0),dU=!function(){try{Object.defineProperty([],"length",{writable:!1}).unshift()}catch(Z$){return Z$ instanceof TypeError}}();nU({target:"Array",proto:!0,arity:1,forced:cU||dU},{unshift:function(e){var t=iU(this),r=oU(t),n=arguments.length;if(n){uU(r+n);for(var i=r;i--;){var o=i+n;i in t?t[o]=t[i]:sU(t,o)}for(var a=0;a<n;a++)t[a]=arguments[a]}return aU(t,r+n)}}),(0,cR.exports)("Uint16",(function(e){return function(t,r,n){return e(this,t,r,n)}})),(0,cR.exports)("Int32",(function(e){return function(t,r,n){return e(this,t,r,n)}}));var lU={};!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)}(lU);var hU={},fU={},pU={},vU=lU;function _U(e){for(var t=e.length;--t>=0;)e[t]=0}var mU=256,yU=286,gU=30,SU=15,bU=[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],EU=[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],kU=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],TU=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],IU=new Array(576);_U(IU);var RU=new Array(60);_U(RU);var AU=new Array(512);_U(AU);var wU=new Array(256);_U(wU);var CU=new Array(29);_U(CU);var OU,xU,NU,DU=new Array(gU);function PU(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 MU(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function LU(e){return e<256?AU[e]:AU[256+(e>>>7)]}function UU(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function VU(e,t,r){e.bi_valid>16-r?(e.bi_buf|=t<<e.bi_valid&65535,UU(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 FU(e,t,r){VU(e,r[2*t],r[2*t+1])}function BU(e,t){var r=0;do{r|=1&e,e>>>=1,r<<=1}while(--t>0);return r>>>1}function jU(e,t,r){var n,i,o=new Array(16),a=0;for(n=1;n<=SU;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]=BU(o[s]++,s))}}function GU(e){var t;for(t=0;t<yU;t++)e.dyn_ltree[2*t]=0;for(t=0;t<gU;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 HU(e){e.bi_valid>8?UU(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 zU(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 qU(e,t,r){for(var n=e.heap[r],i=r<<1;i<=e.heap_len&&(i<e.heap_len&&zU(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!zU(t,n,e.heap[i],e.depth));)e.heap[r]=e.heap[i],r=i,i<<=1;e.heap[r]=n}function KU(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?FU(e,i,t):(FU(e,(o=wU[i])+mU+1,t),0!==(a=bU[o])&&VU(e,i-=CU[o],a),FU(e,o=LU(--n),r),0!==(a=EU[o])&&VU(e,n-=DU[o],a))}while(s<e.last_lit);FU(e,256,t)}function XU(e,t){var r,n,i,o=t.dyn_tree,a=t.stat_desc.static_tree,s=t.stat_desc.has_stree,u=t.stat_desc.elems,c=-1;for(e.heap_len=0,e.heap_max=573,r=0;r<u;r++)0!==o[2*r]?(e.heap[++e.heap_len]=c=r,e.depth[r]=0):o[2*r+1]=0;for(;e.heap_len<2;)o[2*(i=e.heap[++e.heap_len]=c<2?++c:0)]=1,e.depth[i]=0,e.opt_len--,s&&(e.static_len-=a[2*i+1]);for(t.max_code=c,r=e.heap_len>>1;r>=1;r--)qU(e,o,r);i=u;do{r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],qU(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++,qU(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,u=t.dyn_tree,c=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<=SU;o++)e.bl_count[o]=0;for(u[2*e.heap[e.heap_max]+1]=0,r=e.heap_max+1;r<573;r++)(o=u[2*u[2*(n=e.heap[r])+1]+1]+1)>p&&(o=p,v++),u[2*n+1]=o,n>c||(e.bl_count[o]++,a=0,n>=f&&(a=h[n-f]),s=u[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])>c||(u[2*i+1]!==o&&(e.opt_len+=(o-u[2*i+1])*u[2*i],u[2*i+1]=o),n--)}}(e,t),jU(o,c,e.bl_count)}function WU(e,t,r){var n,i,o=-1,a=t[1],s=0,u=7,c=4;for(0===a&&(u=138,c=3),t[2*(r+1)+1]=65535,n=0;n<=r;n++)i=a,a=t[2*(n+1)+1],++s<u&&i===a||(s<c?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?(u=138,c=3):i===a?(u=6,c=3):(u=7,c=4))}function YU(e,t,r){var n,i,o=-1,a=t[1],s=0,u=7,c=4;for(0===a&&(u=138,c=3),n=0;n<=r;n++)if(i=a,a=t[2*(n+1)+1],!(++s<u&&i===a)){if(s<c)do{FU(e,i,e.bl_tree)}while(0!=--s);else 0!==i?(i!==o&&(FU(e,i,e.bl_tree),s--),FU(e,16,e.bl_tree),VU(e,s-3,2)):s<=10?(FU(e,17,e.bl_tree),VU(e,s-3,3)):(FU(e,18,e.bl_tree),VU(e,s-11,7));s=0,o=i,0===a?(u=138,c=3):i===a?(u=6,c=3):(u=7,c=4)}}_U(DU);var JU=!1;function QU(e,t,r,n){VU(e,0+(n?1:0),3),function(e,t,r,n){HU(e),n&&(UU(e,r),UU(e,~r)),vU.arraySet(e.pending_buf,e.window,t,r,e.pending),e.pending+=r}(e,t,r,!0)}pU._tr_init=function(e){JU||(!function(){var e,t,r,n,i,o=new Array(16);for(r=0,n=0;n<28;n++)for(CU[n]=r,e=0;e<1<<bU[n];e++)wU[r++]=n;for(wU[r-1]=n,i=0,n=0;n<16;n++)for(DU[n]=i,e=0;e<1<<EU[n];e++)AU[i++]=n;for(i>>=7;n<gU;n++)for(DU[n]=i<<7,e=0;e<1<<EU[n]-7;e++)AU[256+i++]=n;for(t=0;t<=SU;t++)o[t]=0;for(e=0;e<=143;)IU[2*e+1]=8,e++,o[8]++;for(;e<=255;)IU[2*e+1]=9,e++,o[9]++;for(;e<=279;)IU[2*e+1]=7,e++,o[7]++;for(;e<=287;)IU[2*e+1]=8,e++,o[8]++;for(jU(IU,287,o),e=0;e<gU;e++)RU[2*e+1]=5,RU[2*e]=BU(e,5);OU=new PU(IU,bU,257,yU,SU),xU=new PU(RU,EU,0,gU,SU),NU=new PU(new Array(0),kU,0,19,7)}(),JU=!0),e.l_desc=new MU(e.dyn_ltree,OU),e.d_desc=new MU(e.dyn_dtree,xU),e.bl_desc=new MU(e.bl_tree,NU),e.bi_buf=0,e.bi_valid=0,GU(e)},pU._tr_stored_block=QU,pU._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<mU;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0}(e)),XU(e,e.l_desc),XU(e,e.d_desc),a=function(e){var t;for(WU(e,e.dyn_ltree,e.l_desc.max_code),WU(e,e.dyn_dtree,e.d_desc.max_code),XU(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*TU[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?QU(e,t,r,n):4===e.strategy||o===i?(VU(e,2+(n?1:0),3),KU(e,IU,RU)):(VU(e,4+(n?1:0),3),function(e,t,r,n){var i;for(VU(e,t-257,5),VU(e,r-1,5),VU(e,n-4,4),i=0;i<n;i++)VU(e,e.bl_tree[2*TU[i]+1],3);YU(e,e.dyn_ltree,t-1),YU(e,e.dyn_dtree,r-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),KU(e,e.dyn_ltree,e.dyn_dtree)),GU(e),n&&HU(e)},pU._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*(wU[r]+mU+1)]++,e.dyn_dtree[2*LU(t)]++),e.last_lit===e.lit_bufsize-1},pU._tr_align=function(e){VU(e,2,3),FU(e,256,IU),function(e){16===e.bi_valid?(UU(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 ZU=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 $U=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 eV,tV=function(e,t,r,n){var i=$U,o=n+r;e^=-1;for(var a=n;a<o;a++)e=e>>>8^i[255&(e^t[a])];return-1^e},rV={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"},nV=lU,iV=pU,oV=ZU,aV=tV,sV=rV,uV=-2,cV=258,dV=262,lV=103,hV=113,fV=666;function pV(e,t){return e.msg=sV[t],t}function vV(e){return(e<<1)-(e>4?9:0)}function _V(e){for(var t=e.length;--t>=0;)e[t]=0}function mV(e){var t=e.state,r=t.pending;r>e.avail_out&&(r=e.avail_out),0!==r&&(nV.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 yV(e,t){iV._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,mV(e.strm)}function gV(e,t){e.pending_buf[e.pending++]=t}function SV(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function bV(e,t){var r,n,i=e.max_chain_length,o=e.strstart,a=e.prev_length,s=e.nice_match,u=e.strstart>e.w_size-dV?e.strstart-(e.w_size-dV):0,c=e.window,d=e.w_mask,l=e.prev,h=e.strstart+cV,f=c[o+a-1],p=c[o+a];e.prev_length>=e.good_match&&(i>>=2),s>e.lookahead&&(s=e.lookahead);do{if(c[(r=t)+a]===p&&c[r+a-1]===f&&c[r]===c[o]&&c[++r]===c[o+1]){o+=2,r++;do{}while(c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&o<h);if(n=cV-(h-o),o=h-cV,n>a){if(e.match_start=t,a=n,n>=s)break;f=c[o+a-1],p=c[o+a]}}}while((t=l[t&d])>u&&0!=--i);return a<=e.lookahead?a:e.lookahead}function EV(e){var t,r,n,i,o,a,s,u,c,d,l=e.w_size;do{if(i=e.window_size-e.lookahead-e.strstart,e.strstart>=l+(l-dV)){nV.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,u=e.strstart+e.lookahead,c=i,d=void 0,(d=a.avail_in)>c&&(d=c),r=0===d?0:(a.avail_in-=d,nV.arraySet(s,a.input,a.next_in,d,u),1===a.state.wrap?a.adler=oV(a.adler,s,d,u):2===a.state.wrap&&(a.adler=aV(a.adler,s,d,u)),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<dV&&0!==e.strm.avail_in)}function kV(e,t){for(var r,n;;){if(e.lookahead<dV){if(EV(e),e.lookahead<dV&&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-dV&&(e.match_length=bV(e,r)),e.match_length>=3)if(n=iV._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=iV._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(n&&(yV(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,4===t?(yV(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(yV(e,!1),0===e.strm.avail_out)?1:2}function TV(e,t){for(var r,n,i;;){if(e.lookahead<dV){if(EV(e),e.lookahead<dV&&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-dV&&(e.match_length=bV(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=iV._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&&(yV(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if((n=iV._tr_tally(e,0,e.window[e.strstart-1]))&&yV(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=iV._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,4===t?(yV(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(yV(e,!1),0===e.strm.avail_out)?1:2}function IV(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 RV(){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 nV.Buf16(1146),this.dyn_dtree=new nV.Buf16(122),this.bl_tree=new nV.Buf16(78),_V(this.dyn_ltree),_V(this.dyn_dtree),_V(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new nV.Buf16(16),this.heap=new nV.Buf16(573),_V(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new nV.Buf16(573),_V(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 AV(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:hV,e.adler=2===t.wrap?0:1,t.last_flush=0,iV._tr_init(t),0):pV(e,uV)}function wV(e){var t,r=AV(e);return 0===r&&((t=e.state).window_size=2*t.w_size,_V(t.head),t.max_lazy_match=eV[t.level].max_lazy,t.good_match=eV[t.level].good_length,t.nice_match=eV[t.level].nice_length,t.max_chain_length=eV[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 CV(e,t,r,n,i,o){if(!e)return uV;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 pV(e,uV);8===n&&(n=9);var s=new RV;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 nV.Buf8(2*s.w_size),s.head=new nV.Buf16(s.hash_size),s.prev=new nV.Buf16(s.w_size),s.lit_bufsize=1<<i+6,s.pending_buf_size=4*s.lit_bufsize,s.pending_buf=new nV.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,wV(e)}eV=[new IV(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(EV(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,yV(e,!1),0===e.strm.avail_out))return 1;if(e.strstart-e.block_start>=e.w_size-dV&&(yV(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(yV(e,!0),0===e.strm.avail_out?3:4):(e.strstart>e.block_start&&(yV(e,!1),e.strm.avail_out),1)})),new IV(4,4,8,4,kV),new IV(4,5,16,8,kV),new IV(4,6,32,32,kV),new IV(4,4,16,16,TV),new IV(8,16,32,32,TV),new IV(8,16,128,128,TV),new IV(8,32,128,256,TV),new IV(32,128,258,1024,TV),new IV(32,258,258,4096,TV)],fU.deflateInit=function(e,t){return CV(e,t,8,15,8,0)},fU.deflateInit2=CV,fU.deflateReset=wV,fU.deflateResetKeep=AV,fU.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?uV:(e.state.gzhead=t,0):uV},fU.deflate=function(e,t){var r,n,i,o;if(!e||!e.state||t>5||t<0)return e?pV(e,uV):uV;if(n=e.state,!e.output||!e.input&&0!==e.avail_in||n.status===fV&&4!==t)return pV(e,0===e.avail_out?-5:uV);if(n.strm=e,r=n.last_flush,n.last_flush=t,42===n.status)if(2===n.wrap)e.adler=0,gV(n,31),gV(n,139),gV(n,8),n.gzhead?(gV(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)),gV(n,255&n.gzhead.time),gV(n,n.gzhead.time>>8&255),gV(n,n.gzhead.time>>16&255),gV(n,n.gzhead.time>>24&255),gV(n,9===n.level?2:n.strategy>=2||n.level<2?4:0),gV(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(gV(n,255&n.gzhead.extra.length),gV(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=aV(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(gV(n,0),gV(n,0),gV(n,0),gV(n,0),gV(n,0),gV(n,9===n.level?2:n.strategy>=2||n.level<2?4:0),gV(n,3),n.status=hV);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=hV,SV(n,a),0!==n.strstart&&(SV(n,e.adler>>>16),SV(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=aV(e.adler,n.pending_buf,n.pending-i,i)),mV(e),i=n.pending,n.pending!==n.pending_buf_size));)gV(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(e.adler=aV(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=aV(e.adler,n.pending_buf,n.pending-i,i)),mV(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,gV(n,o)}while(0!==o);n.gzhead.hcrc&&n.pending>i&&(e.adler=aV(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=aV(e.adler,n.pending_buf,n.pending-i,i)),mV(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,gV(n,o)}while(0!==o);n.gzhead.hcrc&&n.pending>i&&(e.adler=aV(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.status=lV)}else n.status=lV;if(n.status===lV&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&mV(e),n.pending+2<=n.pending_buf_size&&(gV(n,255&e.adler),gV(n,e.adler>>8&255),e.adler=0,n.status=hV)):n.status=hV),0!==n.pending){if(mV(e),0===e.avail_out)return n.last_flush=-1,0}else if(0===e.avail_in&&vV(t)<=vV(r)&&4!==t)return pV(e,-5);if(n.status===fV&&0!==e.avail_in)return pV(e,-5);if(0!==e.avail_in||0!==n.lookahead||0!==t&&n.status!==fV){var s=2===n.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(EV(e),0===e.lookahead)){if(0===t)return 1;break}if(e.match_length=0,r=iV._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(yV(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(yV(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(yV(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<=cV){if(EV(e),e.lookahead<=cV&&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+cV;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=cV-(o-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(r=iV._tr_tally(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=iV._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(yV(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(yV(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(yV(e,!1),0===e.strm.avail_out)?1:2}(n,t):eV[n.level].func(n,t);if(3!==s&&4!==s||(n.status=fV),1===s||3===s)return 0===e.avail_out&&(n.last_flush=-1),0;if(2===s&&(1===t?iV._tr_align(n):5!==t&&(iV._tr_stored_block(n,0,0,!1),3===t&&(_V(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),mV(e),0===e.avail_out))return n.last_flush=-1,0}return 4!==t?0:n.wrap<=0?1:(2===n.wrap?(gV(n,255&e.adler),gV(n,e.adler>>8&255),gV(n,e.adler>>16&255),gV(n,e.adler>>24&255),gV(n,255&e.total_in),gV(n,e.total_in>>8&255),gV(n,e.total_in>>16&255),gV(n,e.total_in>>24&255)):(SV(n,e.adler>>>16),SV(n,65535&e.adler)),mV(e),n.wrap>0&&(n.wrap=-n.wrap),0!==n.pending?0:1)},fU.deflateEnd=function(e){var t;return e&&e.state?42!==(t=e.state.status)&&69!==t&&73!==t&&91!==t&&t!==lV&&t!==hV&&t!==fV?pV(e,uV):(e.state=null,t===hV?pV(e,-3):0):uV},fU.deflateSetDictionary=function(e,t){var r,n,i,o,a,s,u,c,d=t.length;if(!e||!e.state)return uV;if(2===(o=(r=e.state).wrap)||1===o&&42!==r.status||r.lookahead)return uV;for(1===o&&(e.adler=oV(e.adler,t,d,0)),r.wrap=0,d>=r.w_size&&(0===o&&(_V(r.head),r.strstart=0,r.block_start=0,r.insert=0),c=new nV.Buf8(r.w_size),nV.arraySet(c,t,d-r.w_size,r.w_size,0),t=c,d=r.w_size),a=e.avail_in,s=e.next_in,u=e.input,e.avail_in=d,e.next_in=0,e.input=t,EV(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,EV(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=u,e.avail_in=a,r.wrap=o,0},fU.deflateInfo="pako deflate (from Nodeca project)";var OV={},xV=lU,NV=!0,DV=!0;try{String.fromCharCode.apply(null,[0])}catch($$){NV=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch($$){DV=!1}for(var PV=new xV.Buf8(256),MV=0;MV<256;MV++)PV[MV]=MV>=252?6:MV>=248?5:MV>=240?4:MV>=224?3:MV>=192?2:1;function LV(e,t){if(t<65534&&(e.subarray&&DV||!e.subarray&&NV))return String.fromCharCode.apply(null,xV.shrinkBuf(e,t));for(var r="",n=0;n<t;n++)r+=String.fromCharCode(e[n]);return r}PV[254]=PV[254]=1,OV.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 xV.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},OV.buf2binstring=function(e){return LV(e,e.length)},OV.binstring2buf=function(e){for(var t=new xV.Buf8(e.length),r=0,n=t.length;r<n;r++)t[r]=e.charCodeAt(r);return t},OV.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=PV[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 LV(s,n)},OV.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+PV[e[r]]>t?r:t};var UV=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},VV=fU,FV=lU,BV=OV,jV=rV,GV=UV,HV=Object.prototype.toString;function zV(e){if(!(this instanceof zV))return new zV(e);this.options=FV.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 GV,this.strm.avail_out=0;var r=VV.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(0!==r)throw new Error(jV[r]);if(t.header&&VV.deflateSetHeader(this.strm,t.header),t.dictionary){var n;if(n="string"==typeof t.dictionary?BV.string2buf(t.dictionary):"[object ArrayBuffer]"===HV.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,0!==(r=VV.deflateSetDictionary(this.strm,n)))throw new Error(jV[r]);this._dict_set=!0}}function qV(e,t){var r=new zV(t);if(r.push(e,!0),r.err)throw r.msg||jV[r.err];return r.result}zV.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=BV.string2buf(e):"[object ArrayBuffer]"===HV.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 FV.Buf8(o),i.next_out=0,i.avail_out=o),1!==(r=VV.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(BV.buf2binstring(FV.shrinkBuf(i.output,i.next_out))):this.onData(FV.shrinkBuf(i.output,i.next_out)))}while((i.avail_in>0||0===i.avail_out)&&1!==r);return 4===n?(r=VV.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,0===r):2!==n||(this.onEnd(0),i.avail_out=0,!0)},zV.prototype.onData=function(e){this.chunks.push(e)},zV.prototype.onEnd=function(e){0===e&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=FV.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},hU.Deflate=zV,hU.deflate=qV,hU.deflateRaw=function(e,t){return(t=t||{}).raw=!0,qV(e,t)},hU.gzip=function(e,t){return(t=t||{}).gzip=!0,qV(e,t)};var KV={},XV=St,WV=pg,YV=hs,JV=ye,QV=se.RegExp,ZV=QV.prototype;XV&&JV((function(){var e=!0;try{QV(".","d")}catch(Z$){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(ZV,"flags").get.call(t)!==n||r!==n}))&&WV(ZV,"flags",{configurable:!0,get:YV});var $V={},eF=lU,tF=15,rF=[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],nF=[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],iF=[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],oF=[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],aF=lU,sF=ZU,uF=tV,cF=function(e,t){var r,n,i,o,a,s,u,c,d,l,h,f,p,v,_,m,y,g,S,b,E,k,T,I,R;r=e.state,n=e.next_in,I=e.input,i=n+(e.avail_in-5),o=e.next_out,R=e.output,a=o-(t-e.avail_out),s=o+(e.avail_out-257),u=r.dmax,c=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))R[o++]=65535&g;else{if(!(16&S)){if(0==(64&S)){g=v[(65535&g)+(f&(1<<S)-1)];continue t}if(32&S){r.mode=12;break e}e.msg="invalid literal/length code",r.mode=30;break e}b=65535&g,(S&=15)&&(p<S&&(f+=I[n++]<<p,p+=8),b+=f&(1<<S)-1,f>>>=S,p-=S),p<15&&(f+=I[n++]<<p,p+=8,f+=I[n++]<<p,p+=8),g=_[f&y];r:for(;;){if(f>>>=S=g>>>24,p-=S,!(16&(S=g>>>16&255))){if(0==(64&S)){g=_[(65535&g)+(f&(1<<S)-1)];continue r}e.msg="invalid distance code",r.mode=30;break e}if(E=65535&g,p<(S&=15)&&(f+=I[n++]<<p,(p+=8)<S&&(f+=I[n++]<<p,p+=8)),(E+=f&(1<<S)-1)>u){e.msg="invalid distance too far back",r.mode=30;break e}if(f>>>=S,p-=S,E>(S=o-a)){if((S=E-S)>d&&r.sane){e.msg="invalid distance too far back",r.mode=30;break e}if(k=0,T=h,0===l){if(k+=c-S,S<b){b-=S;do{R[o++]=h[k++]}while(--S);k=o-E,T=R}}else if(l<S){if(k+=c+l-S,(S-=l)<b){b-=S;do{R[o++]=h[k++]}while(--S);if(k=0,l<b){b-=S=l;do{R[o++]=h[k++]}while(--S);k=o-E,T=R}}}else if(k+=l-S,S<b){b-=S;do{R[o++]=h[k++]}while(--S);k=o-E,T=R}for(;b>2;)R[o++]=T[k++],R[o++]=T[k++],R[o++]=T[k++],b-=3;b&&(R[o++]=T[k++],b>1&&(R[o++]=T[k++]))}else{k=o-E;do{R[o++]=R[k++],R[o++]=R[k++],R[o++]=R[k++],b-=3}while(b>2);b&&(R[o++]=R[k++],b>1&&(R[o++]=R[k++]))}break}}break}}while(n<i&&o<s);n-=b=p>>3,f&=(1<<(p-=b<<3))-1,e.next_in=n,e.next_out=o,e.avail_in=n<i?i-n+5:5-(n-i),e.avail_out=o<s?s-o+257:257-(o-s),r.hold=f,r.bits=p},dF=function(e,t,r,n,i,o,a,s){var u,c,d,l,h,f,p,v,_,m=s.bits,y=0,g=0,S=0,b=0,E=0,k=0,T=0,I=0,R=0,A=0,w=null,C=0,O=new eF.Buf16(16),x=new eF.Buf16(16),N=null,D=0;for(y=0;y<=tF;y++)O[y]=0;for(g=0;g<n;g++)O[t[r+g]]++;for(E=m,b=tF;b>=1&&0===O[b];b--);if(E>b&&(E=b),0===b)return i[o++]=20971520,i[o++]=20971520,s.bits=1,0;for(S=1;S<b&&0===O[S];S++);for(E<S&&(E=S),I=1,y=1;y<=tF;y++)if(I<<=1,(I-=O[y])<0)return-1;if(I>0&&(0===e||1!==b))return-1;for(x[1]=0,y=1;y<tF;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=N=a,f=19):1===e?(w=rF,C-=257,N=nF,D-=257,f=256):(w=iF,N=oF,f=-1),A=0,g=0,y=S,h=o,k=E,T=0,d=-1,l=(R=1<<E)-1,1===e&&R>852||2===e&&R>592)return 1;for(;;){p=y-T,a[g]<f?(v=0,_=a[g]):a[g]>f?(v=N[D+a[g]],_=w[C+a[g]]):(v=96,_=0),u=1<<y-T,S=c=1<<k;do{i[h+(A>>T)+(c-=u)]=p<<24|v<<16|_|0}while(0!==c);for(u=1<<y-1;A&u;)u>>=1;if(0!==u?(A&=u-1,A+=u):A=0,g++,0==--O[y]){if(y===b)break;y=t[r+a[g]]}if(y>E&&(A&l)!==d){for(0===T&&(T=E),h+=S,I=1<<(k=y-T);k+T<b&&!((I-=O[k+T])<=0);)k++,I<<=1;if(R+=1<<k,1===e&&R>852||2===e&&R>592)return 1;i[d=A&l]=E<<24|k<<16|h-o|0}}return 0!==A&&(i[h+A]=y-T<<24|64<<16|0),s.bits=E,0},lF=-2,hF=12,fF=30;function pF(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function vF(){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 aF.Buf16(320),this.work=new aF.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function _F(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 aF.Buf32(852),t.distcode=t.distdyn=new aF.Buf32(592),t.sane=1,t.back=-1,0):lF}function mF(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,_F(e)):lF}function yF(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)?lF:(null!==n.window&&n.wbits!==t&&(n.window=null),n.wrap=r,n.wbits=t,mF(e))):lF}function gF(e,t){var r,n;return e?(n=new vF,e.state=n,n.window=null,0!==(r=yF(e,t))&&(e.state=null),r):lF}var SF,bF,EF=!0;function kF(e){if(EF){var t;for(SF=new aF.Buf32(512),bF=new aF.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(dF(1,e.lens,0,288,SF,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;dF(2,e.lens,0,32,bF,0,e.work,{bits:5}),EF=!1}e.lencode=SF,e.lenbits=9,e.distcode=bF,e.distbits=5}function TF(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 aF.Buf8(o.wsize)),n>=o.wsize?(aF.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),aF.arraySet(o.window,t,r-n,i,o.wnext),(n-=i)?(aF.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}$V.inflateReset=mF,$V.inflateReset2=yF,$V.inflateResetKeep=_F,$V.inflateInit=function(e){return gF(e,15)},$V.inflateInit2=gF,$V.inflate=function(e,t){var r,n,i,o,a,s,u,c,d,l,h,f,p,v,_,m,y,g,S,b,E,k,T,I,R=0,A=new aF.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 lF;(r=e.state).mode===hF&&(r.mode=13),a=e.next_out,i=e.output,u=e.avail_out,o=e.next_in,n=e.input,s=e.avail_in,c=r.hold,d=r.bits,l=s,h=u,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--,c+=n[o++]<<d,d+=8}if(2&r.wrap&&35615===c){r.check=0,A[0]=255&c,A[1]=c>>>8&255,r.check=uF(r.check,A,2,0),c=0,d=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&c)<<8)+(c>>8))%31){e.msg="incorrect header check",r.mode=fF;break}if(8!=(15&c)){e.msg="unknown compression method",r.mode=fF;break}if(d-=4,E=8+(15&(c>>>=4)),0===r.wbits)r.wbits=E;else if(E>r.wbits){e.msg="invalid window size",r.mode=fF;break}r.dmax=1<<E,e.adler=r.check=1,r.mode=512&c?10:hF,c=0,d=0;break;case 2:for(;d<16;){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}if(r.flags=c,8!=(255&r.flags)){e.msg="unknown compression method",r.mode=fF;break}if(57344&r.flags){e.msg="unknown header flags set",r.mode=fF;break}r.head&&(r.head.text=c>>8&1),512&r.flags&&(A[0]=255&c,A[1]=c>>>8&255,r.check=uF(r.check,A,2,0)),c=0,d=0,r.mode=3;case 3:for(;d<32;){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}r.head&&(r.head.time=c),512&r.flags&&(A[0]=255&c,A[1]=c>>>8&255,A[2]=c>>>16&255,A[3]=c>>>24&255,r.check=uF(r.check,A,4,0)),c=0,d=0,r.mode=4;case 4:for(;d<16;){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}r.head&&(r.head.xflags=255&c,r.head.os=c>>8),512&r.flags&&(A[0]=255&c,A[1]=c>>>8&255,r.check=uF(r.check,A,2,0)),c=0,d=0,r.mode=5;case 5:if(1024&r.flags){for(;d<16;){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}r.length=c,r.head&&(r.head.extra_len=c),512&r.flags&&(A[0]=255&c,A[1]=c>>>8&255,r.check=uF(r.check,A,2,0)),c=0,d=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&((f=r.length)>s&&(f=s),f&&(r.head&&(E=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),aF.arraySet(r.head.extra,n,o,f,E)),512&r.flags&&(r.check=uF(r.check,n,f,o)),s-=f,o+=f,r.length-=f),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===s)break e;f=0;do{E=n[o+f++],r.head&&E&&r.length<65536&&(r.head.name+=String.fromCharCode(E))}while(E&&f<s);if(512&r.flags&&(r.check=uF(r.check,n,f,o)),s-=f,o+=f,E)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=8;case 8:if(4096&r.flags){if(0===s)break e;f=0;do{E=n[o+f++],r.head&&E&&r.length<65536&&(r.head.comment+=String.fromCharCode(E))}while(E&&f<s);if(512&r.flags&&(r.check=uF(r.check,n,f,o)),s-=f,o+=f,E)break e}else r.head&&(r.head.comment=null);r.mode=9;case 9:if(512&r.flags){for(;d<16;){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}if(c!==(65535&r.check)){e.msg="header crc mismatch",r.mode=fF;break}c=0,d=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=hF;break;case 10:for(;d<32;){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}e.adler=r.check=pF(c),c=0,d=0,r.mode=11;case 11:if(0===r.havedict)return e.next_out=a,e.avail_out=u,e.next_in=o,e.avail_in=s,r.hold=c,r.bits=d,2;e.adler=r.check=1,r.mode=hF;case hF:if(5===t||6===t)break e;case 13:if(r.last){c>>>=7&d,d-=7&d,r.mode=27;break}for(;d<3;){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}switch(r.last=1&c,d-=1,3&(c>>>=1)){case 0:r.mode=14;break;case 1:if(kF(r),r.mode=20,6===t){c>>>=2,d-=2;break e}break;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=fF}c>>>=2,d-=2;break;case 14:for(c>>>=7&d,d-=7&d;d<32;){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}if((65535&c)!=(c>>>16^65535)){e.msg="invalid stored block lengths",r.mode=fF;break}if(r.length=65535&c,c=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>u&&(f=u),0===f)break e;aF.arraySet(i,n,o,f,a),s-=f,o+=f,u-=f,a+=f,r.length-=f;break}r.mode=hF;break;case 17:for(;d<14;){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}if(r.nlen=257+(31&c),c>>>=5,d-=5,r.ndist=1+(31&c),c>>>=5,d-=5,r.ncode=4+(15&c),c>>>=4,d-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=fF;break}r.have=0,r.mode=18;case 18:for(;r.have<r.ncode;){for(;d<3;){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}r.lens[w[r.have++]]=7&c,c>>>=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=dF(0,r.lens,0,19,r.lencode,0,r.work,T),r.lenbits=T.bits,k){e.msg="invalid code lengths set",r.mode=fF;break}r.have=0,r.mode=19;case 19:for(;r.have<r.nlen+r.ndist;){for(;m=(R=r.lencode[c&(1<<r.lenbits)-1])>>>16&255,y=65535&R,!((_=R>>>24)<=d);){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}if(y<16)c>>>=_,d-=_,r.lens[r.have++]=y;else{if(16===y){for(I=_+2;d<I;){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}if(c>>>=_,d-=_,0===r.have){e.msg="invalid bit length repeat",r.mode=fF;break}E=r.lens[r.have-1],f=3+(3&c),c>>>=2,d-=2}else if(17===y){for(I=_+3;d<I;){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}d-=_,E=0,f=3+(7&(c>>>=_)),c>>>=3,d-=3}else{for(I=_+7;d<I;){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}d-=_,E=0,f=11+(127&(c>>>=_)),c>>>=7,d-=7}if(r.have+f>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=fF;break}for(;f--;)r.lens[r.have++]=E}}if(r.mode===fF)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=fF;break}if(r.lenbits=9,T={bits:r.lenbits},k=dF(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=fF;break}if(r.distbits=6,r.distcode=r.distdyn,T={bits:r.distbits},k=dF(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=fF;break}if(r.mode=20,6===t)break e;case 20:r.mode=21;case 21:if(s>=6&&u>=258){e.next_out=a,e.avail_out=u,e.next_in=o,e.avail_in=s,r.hold=c,r.bits=d,cF(e,h),a=e.next_out,i=e.output,u=e.avail_out,o=e.next_in,n=e.input,s=e.avail_in,c=r.hold,d=r.bits,r.mode===hF&&(r.back=-1);break}for(r.back=0;m=(R=r.lencode[c&(1<<r.lenbits)-1])>>>16&255,y=65535&R,!((_=R>>>24)<=d);){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}if(m&&0==(240&m)){for(g=_,S=m,b=y;m=(R=r.lencode[b+((c&(1<<g+S)-1)>>g)])>>>16&255,y=65535&R,!(g+(_=R>>>24)<=d);){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}c>>>=g,d-=g,r.back+=g}if(c>>>=_,d-=_,r.back+=_,r.length=y,0===m){r.mode=26;break}if(32&m){r.back=-1,r.mode=hF;break}if(64&m){e.msg="invalid literal/length code",r.mode=fF;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--,c+=n[o++]<<d,d+=8}r.length+=c&(1<<r.extra)-1,c>>>=r.extra,d-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;m=(R=r.distcode[c&(1<<r.distbits)-1])>>>16&255,y=65535&R,!((_=R>>>24)<=d);){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}if(0==(240&m)){for(g=_,S=m,b=y;m=(R=r.distcode[b+((c&(1<<g+S)-1)>>g)])>>>16&255,y=65535&R,!(g+(_=R>>>24)<=d);){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}c>>>=g,d-=g,r.back+=g}if(c>>>=_,d-=_,r.back+=_,64&m){e.msg="invalid distance code",r.mode=fF;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--,c+=n[o++]<<d,d+=8}r.offset+=c&(1<<r.extra)-1,c>>>=r.extra,d-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=fF;break}r.mode=25;case 25:if(0===u)break e;if(f=h-u,r.offset>f){if((f=r.offset-f)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=fF;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>u&&(f=u),u-=f,r.length-=f;do{i[a++]=v[p++]}while(--f);0===r.length&&(r.mode=21);break;case 26:if(0===u)break e;i[a++]=r.length,u--,r.mode=21;break;case 27:if(r.wrap){for(;d<32;){if(0===s)break e;s--,c|=n[o++]<<d,d+=8}if(h-=u,e.total_out+=h,r.total+=h,h&&(e.adler=r.check=r.flags?uF(r.check,i,h,a-h):sF(r.check,i,h,a-h)),h=u,(r.flags?c:pF(c))!==r.check){e.msg="incorrect data check",r.mode=fF;break}c=0,d=0}r.mode=28;case 28:if(r.wrap&&r.flags){for(;d<32;){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}if(c!==(4294967295&r.total)){e.msg="incorrect length check",r.mode=fF;break}c=0,d=0}r.mode=29;case 29:k=1;break e;case fF:k=-3;break e;case 31:return-4;default:return lF}return e.next_out=a,e.avail_out=u,e.next_in=o,e.avail_in=s,r.hold=c,r.bits=d,(r.wsize||h!==e.avail_out&&r.mode<fF&&(r.mode<27||4!==t))&&TF(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?uF(r.check,i,h,e.next_out-h):sF(r.check,i,h,e.next_out-h)),e.data_type=r.bits+(r.last?64:0)+(r.mode===hF?128:0)+(20===r.mode||15===r.mode?256:0),(0===l&&0===h||4===t)&&0===k&&(k=-5),k},$V.inflateEnd=function(e){if(!e||!e.state)return lF;var t=e.state;return t.window&&(t.window=null),e.state=null,0},$V.inflateGetHeader=function(e,t){var r;return e&&e.state?0==(2&(r=e.state).wrap)?lF:(r.head=t,t.done=!1,0):lF},$V.inflateSetDictionary=function(e,t){var r,n=t.length;return e&&e.state?0!==(r=e.state).wrap&&11!==r.mode?lF:11===r.mode&&sF(1,t,n,0)!==r.check?-3:TF(e,t,n,n)?(r.mode=31,-4):(r.havedict=1,0):lF},$V.inflateInfo="pako inflate (from Nodeca project)";var IF={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 RF=$V,AF=lU,wF=OV,CF=IF,OF=rV,xF=UV,NF=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},DF=Object.prototype.toString;function PF(e){if(!(this instanceof PF))return new PF(e);this.options=AF.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 xF,this.strm.avail_out=0;var r=RF.inflateInit2(this.strm,t.windowBits);if(r!==CF.Z_OK)throw new Error(OF[r]);if(this.header=new NF,RF.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=wF.string2buf(t.dictionary):"[object ArrayBuffer]"===DF.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(r=RF.inflateSetDictionary(this.strm,t.dictionary))!==CF.Z_OK))throw new Error(OF[r])}function MF(e,t){var r=new PF(t);if(r.push(e,!0),r.err)throw r.msg||OF[r.err];return r.result}PF.prototype.push=function(e,t){var r,n,i,o,a,s=this.strm,u=this.options.chunkSize,c=this.options.dictionary,d=!1;if(this.ended)return!1;n=t===~~t?t:!0===t?CF.Z_FINISH:CF.Z_NO_FLUSH,"string"==typeof e?s.input=wF.binstring2buf(e):"[object ArrayBuffer]"===DF.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 AF.Buf8(u),s.next_out=0,s.avail_out=u),(r=RF.inflate(s,CF.Z_NO_FLUSH))===CF.Z_NEED_DICT&&c&&(r=RF.inflateSetDictionary(this.strm,c)),r===CF.Z_BUF_ERROR&&!0===d&&(r=CF.Z_OK,d=!1),r!==CF.Z_STREAM_END&&r!==CF.Z_OK)return this.onEnd(r),this.ended=!0,!1;s.next_out&&(0!==s.avail_out&&r!==CF.Z_STREAM_END&&(0!==s.avail_in||n!==CF.Z_FINISH&&n!==CF.Z_SYNC_FLUSH)||("string"===this.options.to?(i=wF.utf8border(s.output,s.next_out),o=s.next_out-i,a=wF.buf2string(s.output,i),s.next_out=o,s.avail_out=u-o,o&&AF.arraySet(s.output,s.output,i,o,0),this.onData(a)):this.onData(AF.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!==CF.Z_STREAM_END);return r===CF.Z_STREAM_END&&(n=CF.Z_FINISH),n===CF.Z_FINISH?(r=RF.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===CF.Z_OK):n!==CF.Z_SYNC_FLUSH||(this.onEnd(CF.Z_OK),s.avail_out=0,!0)},PF.prototype.onData=function(e){this.chunks.push(e)},PF.prototype.onEnd=function(e){e===CF.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=AF.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},KV.Inflate=PF,KV.inflate=MF,KV.inflateRaw=function(e,t){return(t=t||{}).raw=!0,MF(e,t)},KV.ungzip=MF;var LF={};(0,lU.assign)(LF,hU,KV,IF);var UF=LF,VF="BytePlusRTC",FF=function(){return window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB},BF=function(){function e(t){c(this,e),h(this,"storeName",void 0),h(this,"pendingList",[]),this.storeName=t,!fP()&&FF()&&this._checkAndCreateStore(t)}var t,r;return l(e,[{key:"_checkAndCreateStore",value:function(t,r){var n=this;e.db&&e.db.close();var i=r?FF().open(VF,r):FF().open(VF);i.onupgradeneeded=function(){i.result.createObjectStore(t)},i.onerror=function(e){console.error("IndexedDBInterface error",i.error)},i.onsuccess=function(){var r=i.result;e.db=r;try{e.db.transaction(n.storeName,"readonly"),n.pendingList.forEach(function(){var e=u(o().mark((function e(t){var r,i,a,s;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.txMode,i=t.resolve,a=t.reject,e.prev=1,e.next=4,n._getStore(r);case 4:s=e.sent,i(s),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(1),a();case 11:case"end":return e.stop()}}),e,null,[[1,8]])})));return function(t){return e.apply(this,arguments)}}())}catch(a){n._checkAndCreateStore(t,r.version+1)}}}},{key:"_getStore",value:function(t){var r=this;return new Promise((function(n,i){e.db?n(e.db.transaction(r.storeName,t).objectStore(r.storeName)):r.pendingList.push({txMode:t,resolve:n,reject:i})}))}},{key:"put",value:(r=u(o().mark((function e(t,r){var n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._getStore("readwrite");case 2:return n=e.sent,e.abrupt("return",new Promise((function(e,i){var o=n.put(t,r);o.onsuccess=function(){e()},o.onerror=function(e){i(e)}})));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"get",value:(t=u(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._getStore("readonly");case 2:return r=e.sent,e.abrupt("return",new Promise((function(e,n){var i=r.get(t);i.onsuccess=function(){e(i.result)},i.onerror=function(e){n(e)}})));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})}]),e}();h(BF,"db",void 0),h(BF,"state","init");var jF=function(e){return e.RTC="rtc",e}(jF||{}),GF=function(e){return e.W_5="5",e}(GF||{}),HF=function(e){return e.IOS="ios",e.ANDROID="android",e.WEB="web",e.WINDOWS="windows",e.MAC="mac",e.LINUX="linux",e}(HF||{}),zF=function(e){return e.REQUEST="request",e.RESPONSE="response",e}(zF||{}),qF=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}(qF||{}),KF=function(e){return e.WEBSOCKET="websocket",e.NETWORKCHANGED="networkChanged",e.PEERCONNECTION="peerconnection",e}(KF||{}),XF=function(e){return e.WEBSOCKET_RECONNECTED="websocket reconnected",e.PEERCONNECTION_RECONNECTED="peerconnection reconnected",e}(XF||{}),WF=function(e){return e.WEBSOCKET="websocket",e.NETWORKCHANGED="networkChanged",e.PEERCONNECTION="peerconnection",e}(WF||{}),YF=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}(YF||{}),JF=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}(JF||{}),QF=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}(QF||{}),ZF=function(e){return e.UP="up",e.DOWN="down",e.DIRECT="direct",e}(ZF||{}),$F=function(e){return e.UP="up",e.DOWN="down",e.PRE="pre",e}($F||{}),eB=function(e){return e.UP="up",e.DOWN="down",e.PRE="pre",e}(eB||{}),tB=function(e){return e.W_0="0",e.W_1="1",e}(tB||{}),rB=function(e){return e.UP="up",e.DOWN="down",e}(rB||{}),nB=function(e){return e.ANSWER="answer",e.INCRANSWER="incranswer",e}(nB||{}),iB=function(e){return e.UP="up",e.DOWN="down",e}(iB||{}),oB=function(e){return e.SUCCESS="success",e.FAIL="fail",e}(oB||{}),aB=function(e){return e.W_0="0",e.W_1="1",e}(aB||{}),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.JOIN_ROOM_ACK_FAILED="join room ack failed",e.UNKNOWN="unknown",e}(sB||{}),uB=function(e){return e.SUCCESS="success",e.FAIL="fail",e.IGNORE="ignore",e}(uB||{}),cB=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}(cB||{}),dB=function(e){return e.PLAYOUT_DEVICE_SWITCH="playout_device_switch",e.RECORD_DEVICE_SWITCH="record_device_switch",e.UNKNOWN="unknown",e}(dB||{}),lB=function(e){return e.BEGIN_SEND="begin_send",e.SENT_END="sent_end",e.BEGIN_RECV="begin_recv",e.RECV_END="recv_end",e}(lB||{}),hB=function(e){return e.AUDIO="audio",e.VIDEO="video",e.SCREEN_VIDEO="screen_video",e.SCREEN_AUDIO="screen_audio",e}(hB||{}),fB=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}(fB||{}),pB=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}(pB||{}),vB=function(e){return e.BEGIN="begin",e.END="end",e}(vB||{}),_B=function(e){return e.BEGIN="begin",e.END="end",e}(_B||{}),mB=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}(mB||{}),yB=function(e){return e.P2P="p2p",e.P2P_OUTSIDE_ROOM="p2p_outside_room",e.P2SERVER="p2server",e}(yB||{}),gB=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}(gB||{}),SB=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}(SB||{}),bB=function(){function e(t){c(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,"_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),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:"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"}}]),e}(),EB="ReportErrorBuffer",kB=function(){function e(){c(this,e),h(this,"_buffer",new BF(EB))}var t,r;return l(e,[{key:"set",value:(r=u(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._buffer.put(t,EB);case 2:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"get",value:(t=u(o().mark((function e(){var t;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=[],e.prev=1,e.next=4,this._buffer.get(EB);case 4:t=e.sent,e.next=9;break;case 7:e.prev=7,e.t0=e.catch(1);case 9:return e.abrupt("return",t);case 10:case"end":return e.stop()}}),e,this,[[1,7]])}))),function(){return t.apply(this,arguments)})}]),e}(),TB=function(e){f(n,e);var t,r=g(n);function n(){var e;return c(this,n),h(m(e=r.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),"errSendBuffer",void 0),h(m(e),"commonStats",void 0),h(m(e),"_retryCount",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 bB(m(e)),fP()||window.addEventListener("beforeunload",(function(){clearTimeout(e.errSendTimer),clearTimeout(e.sucSendTimer),e.send(null,!0)})),e}return l(n,[{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:"enableErrorBuffer",value:function(){this.errSendBuffer=new kB,this.loadErrorBuffer()}},{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:i(i({},this.report_common),{},{http_retry_count:this._retryCount}),from:"web",os:"web",version:"1"},o=new XMLHttpRequest;o.timeout=1e4,o.onreadystatechange=function(){if(4===o.readyState){var i,a,s,u;if(e||(r.posting=!1),200===o.status||304===o.status)try{i=JSON.parse(o.responseText)}catch(Z$){a=Z$}if(i&&0===i.StatusCode){if(!e&&!t)null===(s=r.errSendBuffer)||void 0===s||s.set([]),r.sucSend()}else if(setTimeout((function(){var e;r.rtcError("reportor error, res:".concat(null===(e=i)||void 0===e?void 0:e.toString()," err:").concat(a),o.status,a)}),0),e)r.send(e);else r.unshift(n.data),null===(u=r.errSendBuffer)||void 0===u||u.set(k(r.dataBuffer)),t?r.send():r.errSend()}};var a=WB.LOG_SERVER_URL;if(o.open("POST",a,!0),e||(this.posting=!0),!fP()&&location.search.includes("_rtc_autotest_"))this.safeEmit("report_event",n),0!==this.dataBuffer.length?this.sucSend():this.posting=!1;else if(!fP()&&location.search.includes("_rtc_debug_"))o.send(JSON.stringify(n));else{var s=UF.gzip(JSON.stringify(n));o.setRequestHeader("Content-Encoding","gzip"),o.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"),o.send(s)}}}},{key:"sucSend",value:function(){this.errSendDelay=100,this._retryCount=0,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,this._retryCount++}},{key:"loadErrorBuffer",value:(t=u(o().mark((function e(){var t,r,n=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,null===(r=this.errSendBuffer)||void 0===r?void 0:r.get();case 2:if(e.t1=t=e.sent,e.t0=null!==e.t1,!e.t0){e.next=6;break}e.t0=void 0!==t;case 6:if(!e.t0){e.next=10;break}e.t2=t,e.next=11;break;case 10:e.t2=[];case 11:e.t2.forEach((function(e){n.push(e)}));case 13:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{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,u=t.rtc_sdk_version,c=t.rtc_timestamp,d=t.rtc_sdk_git_commit,l=t.report_id,h=t.rtc_sid,f=t.engine_session_id,p=t.rtc_business_id,v=t.project_key,_=t.network_type,m=t.app_version,y=t.aid,g=t.device_model,S=t.device_brand,b=t.common_extra_info,E=t.had_selected_p2p,k=t.rtc_env_type,T=t.user_agent,I=t.auto_play_policy,R=t.platform,A=t.product;Object.assign(e,{event_key:r,device_id:n,rtc_app_id:i,product_line:o,report_version:a,os:s,rtc_sdk_version:u,rtc_timestamp:c,rtc_sdk_git_commit:d,report_id:l,rtc_sid:h,engine_session_id:f,rtc_business_id:p,project_key:v,network_type:_,app_version:m,aid:y,device_model:g,device_brand:S,common_extra_info:b,had_selected_p2p:E,rtc_env_type:k,user_agent:T,auto_play_policy:I,platform:R,product:A}),this.commonStats.room_id&&(this.modify_ids.room_id=this.commonStats.room_id),this.commonStats.user_id&&(this.modify_ids.user_id=this.commonStats.user_id),this.commonStats.rtc_session_id&&(this.modify_ids.rtc_session_id=this.commonStats.rtc_session_id),this.commonStats.connection_id&&(this.modify_ids.connection_id=this.commonStats.connection_id)}},{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 u=arguments.length>7&&void 0!==arguments[7]?arguments[7]:{},c=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(u)});this.push(c)}},{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]:{},u=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(u)}},{key:"rtcPreIceState",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=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),{},{connection_id:r,common_extra_info:JSON.stringify(n)});this.push(o)}},{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){var a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},s=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,direction:o},this.modify_ids),{},{common_extra_info:JSON.stringify(a)});this.push(s)}},{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,u){var c=arguments.length>8&&void 0!==arguments[8]?arguments[8]:{},d=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),{},{connection_id:u,common_extra_info:JSON.stringify(c)});this.push(d)}},{key:"rtcRecvAnswer",value:function(e,t,r,n,o,a,s){var u=arguments.length>7&&void 0!==arguments[7]?arguments[7]:{},c=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(u)});this.push(c)}},{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=arguments.length>6&&void 0!==arguments[6]?arguments[6]:"",u=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),{},{connection_id:s,common_extra_info:JSON.stringify(a),direction:a.direction});this.push(u)}},{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,u,c,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:u,media_device_id:c,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)}}]),n}(VL),IB=new TB,RB=new TB,AB=new TB,wB=IB.commonStats,CB=RB.commonStats,OB=AB.commonStats,xB={default:IB,rtm:RB,outsideRoom:AB};function NB(){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&&wB.setStats({room_id:i[1]}),xB[e].rtcSdkApiCall(n,0,JSON.stringify(TP(i)),s);var u=o.apply(this,i);return"function"==typeof(null==u?void 0:u.then)?u.then((function(t){return xB[e].rtcSdkCallback(n,0,JSON.stringify(TP([t||{}]))),t})).catch((function(t){throw xB[e].rtcSdkCallback(n,t.code,JSON.stringify(t.message)),t})):(xB[e].rtcSdkCallback(n,0,JSON.stringify(TP([u||{}]))),u)}}}}function DB(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=e===ie.onUserMessageReceivedOutsideRoom||e===ie.onUserBinaryMessageReceivedOutsideRoom;(n?RB:IB).rtcSdkCallback(e,r,JSON.stringify(t))}function PB(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};(n?RB:IB).rtcInvokeStatus(JSON.stringify(t),r,e,"",0,o,i)}var MB="BytePlus",LB="RTC_DEVICE_ID",UB="RTC_ACCESS_NODE",VB="RTC_ACCESS_URLS",FB="RTC_H264_BLACK_LIST",BB="engine_BAC",jB=function(){function e(){c(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}(),GB=function(e){f(r,e);var t=g(r);function r(){return c(this,r),t.apply(this,arguments)}return l(r,[{key:"getDeviceId",value:function(){if(fP())return"";var e=this.get(LB);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[wB,CB,OB].forEach((function(t){return t.setStats({device_id:e})})),this.set(LB,e),e}},{key:"getAccessNode",value:function(e){return this.get("".concat(UB,"_").concat(e,"-").concat(MB))}},{key:"setAccessNode",value:function(e,t,r){return this.set("".concat(UB,"_").concat(e,"-").concat(MB),t,1e3*r)}},{key:"clearAccessNode",value:function(e){this.delete("".concat(UB,"_").concat(e,"-").concat(MB))}},{key:"getAccessUrls",value:function(){return this.get("".concat(VB,"-").concat(MB))}},{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(VB,"-").concat(MB),t)}},{key:"clearAccessUrls",value:function(){this.delete("".concat(VB,"-").concat(MB))}},{key:"getH264BlackList",value:function(){return this.get(FB)}},{key:"setH264BlackList",value:function(e){return this.set(FB,e)}},{key:"getAudioProfile",value:function(){return this.get(BB)}},{key:"setAudioProfile",value:function(e){return this.set(BB,e)}}]),r}(jB),HB=new GB,zB="rtc-access.rtcplus.com,rtc-access-sg.rtcplus.com,rtc-access-va.rtcplus.com,rtc-access-fr.rtcplus.com".split(",");function qB(){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 KB="https://web-log-report.rtcplus.com/video/v1/webrtc_log/",XB="rtc.rtcplus.com".split(","),WB={VERSION:"4.47.16",ICE_CONFIG_REQUEST_URLS_INTERNAL:zB.map(qB),ICE_CONFIG_REQUEST_URLS:[],EXPECTED_ADDR:"",LOG_SERVER_URL:KB,CONFIG_REQUEST_DOMAINS:XB,DEVICE_ID:"",OVERSEA:!1,PLATFORM:"",PRODUCT:"",STATS_SCALLBACK_SUPPORT:!0,ENABLE_REPORT_ERROR_BUFFER:!1};function YB(e,t){if(IB.rtcSdkApiCall("setParameter",0,"key: ".concat(e,", value: ").concat(t)),"VERSION"!==e)return"ICE_CONFIG_REQUEST_URLS"===e?("string"==typeof t&&(t=[t]),void(WB.ICE_CONFIG_REQUEST_URLS=t.map(qB))):void("PLATFORM"!==e||"string"!=typeof t?"PRODUCT"!==e||"string"!=typeof t?"LOG_SERVER_URL"!==e||t!==G.overseas?"LOG_SERVER_URL"!==e||t!==G.domestic?"LOG_SERVER_URL"!==e||"string"!=typeof t?"OVERSEA"!==e?"STATS_SCALLBACK_SUPPORT"!==e?("DEVICE_ID"===e&&HB.setDeviceId(t),"ENABLE_REPORT_ERROR_BUFFER"!==e?WB[e]=t:t&&IB.enableErrorBuffer()):WB.STATS_SCALLBACK_SUPPORT=t:WB.OVERSEA=t:WB.LOG_SERVER_URL=t:WB.LOG_SERVER_URL=KB:WB.LOG_SERVER_URL="https://web-log-report.rtcplus.com/video/v1/webrtc_log/":wB.setStats({product:t}):wB.setStats({platform:t}))}function JB(e){return"DEVICE_ID"===e?HB.getDeviceId():WB[e]}function QB(e,t){var r,n,i,o,a,s,u,c,d,l,h,f,p,v,_,m,y;return{type:"transcode",action:e,transcodeMeta:{transcode:{url:t.url},control:{protocol:"2.0"},audio:{codec:(null===(r=t.audio)||void 0===r?void 0:r.codec)||ej.audio.codec,bitRate:1e3*((null===(n=t.audio)||void 0===n?void 0:n.kBitRate)||ej.audio.kBitRate),sampleRate:1e3*((null===(i=t.audio)||void 0===i?void 0:i.sampleRate)||ej.audio.sampleRate),channels:(null===(o=t.audio)||void 0===o?void 0:o.channels)||ej.audio.channels,profile:(null===(a=t.audio)||void 0===a?void 0:a.AACProfile)||ej.audio.AACProfile},video:{codec:(null===(s=t.video)||void 0===s?void 0:s.codec)||ej.video.codec,fps:(null===(u=t.video)||void 0===u?void 0:u.fps)||ej.video.fps,gop:(null===(c=t.video)||void 0===c?void 0:c.gop)||ej.video.gop,lowLatency:null!==(d=null===(l=t.video)||void 0===l?void 0:l.lowLatency)&&void 0!==d?d:ej.video.lowLatency,bitRate:1e3*((null===(h=t.video)||void 0===h?void 0:h.kBitRate)||ej.video.kBitRate),width:(null===(f=t.video)||void 0===f?void 0:f.width)||ej.video.width,height:(null===(p=t.video)||void 0===p?void 0:p.height)||ej.video.height},layout:{canvas:{bgnd:(null===(v=t.layout)||void 0===v?void 0:v.backgroundColor)||ej.layout.backgroundColor},regions:(null===(_=t.layout)||void 0===_||null===(m=_.regions)||void 0===m?void 0:m.map((function(e){return{alpha:Math.min(Math.max(+e.alpha,0),1),uid:e.userId,zorder:e.zorder,x:Math.min(Math.max(+e.x,0),1),y:Math.min(Math.max(+e.y,0),1),w:Math.min(Math.max(+e.w,0),1),h:Math.min(Math.max(+e.h,0),1),renderMode:e.renderMode||1,contentControl:e.contentControl||0,screen:e.isScreenStream,local_user:e.isLocalUser}})))||[],app_data:(null===(y=t.layout)||void 0===y?void 0:y.appData)||ej.layout.appData}}}}function ZB(e,t,r){var n,i,o,a,s,u,c,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)||q.PREV_FRAME,canvas:{bgColor:(null===(u=r.layout)||void 0===u?void 0:u.backgroundColor)||"#000000",bgImage:(null===(c=r.layout)||void 0===c?void 0:c.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,x:Math.min(Math.max(+e.x,0),1),y:Math.min(Math.max(+e.y,0),1),w:Math.min(Math.max(+e.w,0),1),h:Math.min(Math.max(+e.h,0),1),zorder:e.zorder,renderMode:void 0===e.renderMode?1:e.renderMode,streamType:e.isScreenStream?1:0,mediaType:e.mediaType||0,sourceCrop:e.sourceCrop}})))||[]}}}}var $B,ej={url:"",video:{codec:"H264",width:640,height:360,fps:30,gop:60,kBitRate:600,lowLatency:!0},audio:{codec:"AAC",kBitRate:64,sampleRate:48,channels:2,AACProfile:"LC"},layout:{regions:[],appData:"",backgroundColor:"#000000"}},tj={width:640,height:360,frameRate:30,maxKbps:600},rj={width:1920,height:1080,frameRate:15,maxKbps:3e3},nj=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}(nj||{}),ij=function(e){return e.PushLimitWarn="PushLimitWarn",e}(ij||{}),oj=function(e){return e.ON_ADD_STREAM="onAddStream",e.ON_REMOVE_STREAM="onRemoveStream",e.USER_DISCONNECTION="userDisconnection",e.USER_CONNECTION="userConnection",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_STREAM_FAILED="streamFailed",e}(oj||{}),aj=function(e){return e.RSCP="RSCP",e.RTT="RTT",e}(aj||{}),sj=function(e){return e.ON_CONNECTION_STATE_CHANGE="onConnectionStateChange",e.ABNORMAL_DISCONNECTION="normalConnection",e}(sj||{}),uj=function(e){return e.userLeave="userLeave",e.connectionLost="connectionLost",e.userDuplicateLogin="userDuplicateLogin",e.kickedByAdmin="kickedByAdmin",e.roleChanged="roleChanged",e.onUserTokenDidExpire="onUserTokenDidExpire",e}(uj||{}),cj=function(e){return e[e.roomDismissByAdmin=2]="roomDismissByAdmin",e}(cj||{}),dj=function(e){return e[e.SEND=0]="SEND",e[e.FEEDBACK=1]="FEEDBACK",e}(dj||{}),lj=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}(lj||{}),hj=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}(hj||{}),fj=(h($B={},0,[0,"success"]),h($B,1,[JN.USER_MESSAGE_TIMEOUT,"timeout, failed to send."]),h($B,2,[JN.USER_MESSAGE_BROKEN,"dataChannel broken, failed to send."]),h($B,3,[JN.USER_MESSAGE_NO_RECEIVER,"cannot find the receiver."]),h($B,4,[JN.USER_MESSAGE_NO_RELAYPATH,"cannot find relay path."]),h($B,17,[JN.USER_MESSAGE_SEND_TO_SERVER_ERROR,"failed to send to business server."]),h($B,18,[JN.USER_MESSAGE_SERVER_RESPONSE_ERROR,"business server response error."]),h($B,100,[JN.USER_MESSAGE_NOT_JOIN,"not join room"]),h($B,101,[JN.USER_MESSAGE_INIT,"not init."]),h($B,102,[JN.USER_MESSAGE_NO_CONNECTION,"no connection."]),h($B,105,[JN.USER_MESSAGE_NOT_LOGIN,"not login."]),h($B,106,[JN.USER_MESSAGE_SERVER_PARAMS_NOTSET,"server param is not set."]),h($B,1e3,[JN.USER_MESSAGE_UNKNOWN,"unknown."]),$B),pj=["msg"],vj=new LL("DataChannelSignaling",3),_j=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}(_j||{}),mj=6e4,yj=function(e){f(a,e);var t,r,n=g(a);function a(e){var t;return c(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 IB.rtcSignaling(0,JSON.stringify(t),"call-".concat(e),"Send",ZF.UP),new Promise((function(i,o){var a=n._genHeader(r);a.id=bP();var s=a.id.join("-"),u=setTimeout((function(){n._singlingCache.delete(s),o(new ZN(JN.TIME_OUT,"".concat(e," message time out")))}),mj);n._singlingCache.set(s,{signalingType:e,success:function(e){clearTimeout(u),i(e)},error:function(e){clearTimeout(u),o(e)}}),vj.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=u(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,pj),s=n instanceof ArrayBuffer,e.t0=this,e.t1=i,e.t2=i({ver:1,id:this._p2pMessageId++,time:Date.now(),dir:dj.SEND,type:lj.P2P,err:hj.SUCCESS},a),e.t3={},e.t4=s,!s){e.next=13;break}return e.next=10,pP.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 kP(e.msg)?this._rttIds[e.id]=e.id:e.dir===dj.SEND&&vj.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:bP()}));if(e.dir===dj.SEND){var s=setTimeout((function(){t._p2pCache.delete(e.id),o(new ZN(JN.TIME_OUT,"P2P message timeout"))}),mj);t._p2pCache.set(e.id,{success:function(e,t){clearTimeout(s),n(t)},error:function(e){clearTimeout(s);var t=E(fj[e.err]||[JN.USER_MESSAGE_UNKNOWN,"err: ".concat(e.err,", msg: ").concat(e.msg)],2),r=t[0],n=t[1];o({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 ZN(JN.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=pP.str2ab(JSON.stringify([e,r])),a=hP(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}))});vj.print("Signal",">>>>>> [".concat(t,"-res][").concat(e,"]")),this._sendMessage("".concat(t,"-res"),n,r)}},{key:"_handleMessage",value:(t=u(o().mark((function e(t){var r,n,a,s,u,c,d,l,h,f,p,v,_,m,y,g,S,b,k,T,I,R,A,w,C,O,x,N,D,P,M,L;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:c=this._dispartData(t),d=c.data,(l=c.header).zip&&((h=new UF.Inflate).push(d,!0),d=h.result),f=pP.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&&IB.rtcSignalingMsgError(-1,e.t0.message,QF.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],vj.print("Signal","<<<<<< ".concat(_),p,v),this._feedbackSignaling(v,_,_===oj.ON_CUSTOM_MESSAGE?i(i({},p),{},{message:""}):""),!p.binary||"string"!=typeof p.message){e.next=31;break}return e.next=30,pP.b64str2ab(p.message);case 30:p.message=e.sent;case 31:this.emit(_,i({},p)),IB.rtcSignaling(0,f,"on-".concat(_),"Recv",ZF.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)===dj.FEEDBACK||kP(null===(s=p)||void 0===s?void 0:s.msg)?delete this._rttIds[m]:vj.print("Signal","<<<<<< p2p response",p),e.t2=p.dir,e.next=e.t2===dj.SEND?40:e.t2===dj.FEEDBACK?78:81;break;case 40:if(kP(null===(u=p)||void 0===u?void 0:u.msg)){e.next=76;break}if(g=(y=p).binary,S=y.msg,b=y.room,k=y.to,T=y.from,I=""===b?g?oj.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM:oj.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM:g?oj.USER_BINARY_MESSAGE_RECEIVED:oj.USER_MESSAGE_RECEIVED,k){e.next=60;break}if(e.t3=this,e.t4=oj.ON_CUSTOM_MESSAGE,e.t5=T,e.t6=g,!g){e.next=54;break}return e.next=51,pP.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,pP.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:dj.FEEDBACK,msg:""})),e.abrupt("break",82);case 78:return(R=this._p2pCache.get(p.id))&&(this._p2pCache.delete(p.id),p.err===hj.SUCCESS?R.success(p.id,p):R.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===(A=l.id)||void 0===A?void 0:A.join("-"))||"",this._handleAckMessage(w,p[0]||{},f),e.next=100;break;case 88:if(C=E(p,2),O=C[0],x=C[1],N=void 0===x?{}:x,"RXMediaMsg"!==O){e.next=100;break}D=N.type,P=N.data,IB.rtcSignaling(0,f,"on-".concat(D),"Recv",ZF.DOWN),e.t19=D,e.next="RSCP"===e.t19?95:"RTT"===e.t19?97:99;break;case 95:try{M=JSON.parse(P),Array.isArray(M)&&this.emit(D,M)}catch(o){}return e.abrupt("break",100);case 97:try{(L=JSON.parse(P)).length&&this.emit(D,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){vj.print("_handleHandler","dataChannel close",t),e.emit("close",t)},r=function(t){vj.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),vj.print("Signal","<<<<<< [".concat(n.signalingType,"-ack]"),t)),IB.rtcSignaling(0,r,null==n?void 0:n.signalingType,"Ack",ZF.DOWN)}}]),a}(xL.exports.EventEmitter),gj=function(){function e(){c(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,u=e.stringify,c=void 0===u||u;return new Promise((function(e,i){t.isSending=!0;var a=new XMLHttpRequest;a.open(r,n,!0);for(var u=0,d=Object.entries(s);u<d.length;u++){var l=E(d[u],2),h=l[0],f=l[1];a.setRequestHeader(h,f)}a.onreadystatechange=function(){4===a.readyState&&(t.isSending=!1,200===a.status?e(JSON.parse(a.responseText)):i({message:a.statusText,code:a.status}))},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),c&&(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}(),Sj=new LL("ICE Request",3),bj=function(){function e(){c(this,e),h(this,"_request",void 0),this._request=new gj}var t,r,n;return l(e,[{key:"getAccessNode",value:(n=u(o().mark((function e(t,r,n,i,a,s,u,c){var d;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(d=HB.getAccessNode(t))){e.next=9;break}if(this.getAccessNodeFromServer(t,r,n,i,a,s,u,c),PB("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,u,c));case 10:case"end":return e.stop()}}),e,this)}))),function(e,t,r,i,o,a,s,u){return n.apply(this,arguments)})},{key:"getAccessNodeFromServer",value:(r=u(o().mark((function e(t,r,n,i,a,s,u,c){var d,l,h,f,p=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return h=HB.getAccessUrls(),f=!0,PB("es.R.req.cache.urls",h),(null===(d=h)||void 0===d?void 0:d.length)>0||(h=WB.ICE_CONFIG_REQUEST_URLS,f=!1,PB("es.R.req.external.urls",h)),(null===(l=h)||void 0===l?void 0:l.length)>0||(h=WB.ICE_CONFIG_REQUEST_URLS_INTERNAL,f=!1,PB("es.R.req.internal.urls",h)),e.abrupt("return",this.getICEConfigFromServer(h,t,r,n,i,a,s,u,c).then((function(e){var r=e.nodes;return!u&&HB.setAccessNode(t,r,e.ttl||11200),e.dispatchDomains&&!u&&HB.setAccessUrls(e.dispatchDomains),r})).catch((function(e){if(f)return PB("es.R.req.fallback",""),HB.clearAccessUrls(),p.getAccessNodeFromServer(t,r,n,i,a,s,u);throw e})));case 6:case"end":return e.stop()}}),e,this)}))),function(e,t,n,i,o,a,s,u){return r.apply(this,arguments)})},{key:"getICEConfigFromServer",value:(t=u(o().mark((function e(t,r,n,i,a,s,c,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:dP(),os:"web",sdkVersion:WB.VERSION,isOversea:WB.OVERSEA,expectedAddr:JB("EXPECTED_ADDR"),productPlatform:"BytePlus",enableCloudProxy:d,expectedIDC:l},s&&c&&(h.feedbackInfo=[{feedbackIP:null===(f=c.publicIPs[0])||void 0===f?void 0:f.ip,feedbackReason:{type:"NODE_CHANGED",reason:s}}],delete h.expectedAddr),p=Date.now(),IB.rtcGetAccess(0,JSON.stringify(h),0,YF.REQUEST,t.join(","),h.connectSessionID),v=t.map(function(){var e=u(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 ZN(JN.ICE_SERVER_WRONG,"get ICE config failed",e.t0);case 9:if(200===n.code){e.next=11;break}throw new ZN(JN.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 ZN(JN.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",RP(v).then((function(e){var r=e.result;e.firstNode;var n=e.index;return IB.rtcGetAccess(200,JSON.stringify(r),Date.now()-p,YF.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 IB.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,YF.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,u,c){return t.apply(this,arguments)})},{key:"abort",value:function(){this._request.isSending&&(Sj.print("abort","HTTP Request of [getICEConfigFromServer] abort"),this._request.abort())}}]),e}(),Ej=function(){function e(){c(this,e),h(this,"_request",void 0),this._request=new gj}return l(e,[{key:"getH264BlackList",value:function(){var e=this,t={keys:["web_h264_black_list"],labelSelector:"",sdkVersion:"4.47.16",deviceType:"web"};this._request.timeout=800;var r=WB.CONFIG_REQUEST_DOMAINS.map((function(e){return"https://".concat(e,"/decision/v1/multi")}));IB.rtcGetConfig(0,JSON.stringify(t),0,r.join(","),zF.REQUEST,"",!1);var n=r.map(function(){var r=u(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 ZN(JN.ICE_SERVER_WRONG,"get config failed");case 9:if(Array.isArray(null===(a=s)||void 0===a?void 0:a.web_h264_black_list)){r.next=11;break}throw new ZN(JN.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){RP(n).then((function(t){var n=t.result,i=t.index;HB.setH264BlackList(n.web_h264_black_list),IB.rtcGetConfig(200,JSON.stringify(n),0,r[i],zF.RESPONSE,"",!1),e(n.web_h264_black_list)})).catch((function(t){IB.rtcGetConfig(500,t.message,0,"",zF.RESPONSE,"",!1),e(HB.getH264BlackList()||[])}))}))}},{key:"getAudioProfile",value:function(){var e=this,t={keys:["engine_BAC"],labelSelector:"",sdkVersion:"4.47.16",deviceType:"web"},r=WB.CONFIG_REQUEST_DOMAINS.map((function(e){return"https://".concat(e,"/decision/v1/multi")}));IB.rtcGetConfig(0,JSON.stringify(t),0,r.join(","),zF.REQUEST,"",!1);var n=r.map(function(){var r=u(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 ZN(JN.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 ZN(JN.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){RP(n).then((function(t){var n=t.result,i=t.index;HB.setAudioProfile(n.engine_BAC),IB.rtcGetConfig(200,JSON.stringify(n),0,r[i],zF.RESPONSE,"",!1),e(n.engine_BAC)})).catch((function(t){IB.rtcGetConfig(500,t.message,0,"",zF.RESPONSE,"",!1),e(HB.getAudioProfile()||[])}))}))}}]),e}();function kj(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 Tj=[{sub_index:0,video_index:0,framerate:30,height:1080,maxkbps:3e3,width:1920},{sub_index:1,video_index:0,framerate:30,height:720,maxkbps:1200,width:1280},{sub_index:2,video_index:0,framerate:30,height:630,maxkbps:1100,width:1120},{sub_index:3,video_index:0,framerate:30,height:540,maxkbps:1e3,width:960},{sub_index:4,video_index:1,framerate:30,height:450,maxkbps:800,width:800},{sub_index:5,video_index:1,framerate:30,height:360,maxkbps:600,width:640},{sub_index:6,video_index:1,framerate:30,height:270,maxkbps:400,width:480},{sub_index:7,video_index:2,framerate:15,height:180,maxkbps:300,width:320},{sub_index:8,video_index:2,framerate:15,height:144,maxkbps:200,width:256},{sub_index:9,video_index:3,framerate:15,height:90,maxkbps:100,width:160}],Ij=[{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 Rj={width:160,height:90,frameRate:15,maxkbps:100},Aj={width:480,height:270,frameRate:15,maxkbps:400};var wj,Cj,Oj="chrome-stable"===_P(),xj=function(){function e(t){c(this,e),h(this,"peer",void 0),h(this,"stats",void 0),this.peer=t,this.stats=[]}var t,r;return l(e,[{key:"handleCodec",value:function(e){return e}},{key:"handleInboundRtp",value:function(e){return e}},{key:"handleOutboundRtp",value:function(e){var t=e.ssrc;return t&&(e.rtxSsrc=t),e}},{key:"handleRemoteInboundRtp",value:function(e){return e}},{key:"handleRemoteOutboundRtp",value:function(e){return e}},{key:"handleMediaSource",value:function(e){return e}},{key:"handleCsrc",value:function(e){return e}},{key:"handlePeerConnection",value:function(e){return e}},{key:"handleDataChannel",value:function(e){return e}},{key:"handleStream",value:function(e){return e}},{key:"handleTrack",value:function(e){return e}},{key:"handleTransceiver",value:function(e){return e}},{key:"handleSender",value:function(e){return e}},{key:"handleReceiver",value:function(e){return e}},{key:"handleTransport",value:function(e){return e}},{key:"handleSctpTransport",value:function(e){return e}},{key:"handleCandidatePair",value:function(e){return e}},{key:"handleLocalCandidate",value:function(e){return e}},{key:"handleRemoteCandidate",value:function(e){return e}},{key:"handleCertificate",value:function(e){return e}},{key:"handleIceServer",value:function(e){return e}},{key:"processStats",value:function(e){var t=this;e.forEach((function(e){var r;switch(e.type){case"candidate-pair":r=t.handleCandidatePair;break;case"certificate":r=t.handleCertificate;break;case"remote-candidate":r=t.handleRemoteCandidate;break;case"remote-inbound-rtp":case"inbound-rtp":r=t.handleInboundRtp;break;case"remote-outbound-rtp":case"outbound-rtp":r=t.handleOutboundRtp;break;case"sctp-transport":r=t.handleSctpTransport;break;case"sender":r=t.handleSender;break;case"stream":r=t.handleStream;break;case"track":r=t.handleTrack;break;case"transceiver":r=t.handleTransceiver;break;case"transport":r=t.handleTransport;break;case"codec":r=t.handleCodec;break;case"csrc":r=t.handleCsrc;break;case"data-channel":r=t.handleDataChannel;break;case"ice-server":r=t.handleIceServer;break;case"media-source":r=t.handleMediaSource;break;case"peer-connection":r=t.handlePeerConnection;break;case"receiver":r=t.handleReceiver;break;case"local-candidate":r=t.handleLocalCandidate;break;default:r=function(e){return e}}r=r.bind(t),t.stats.push(r(e))}))}},{key:"getExtraStats",value:(r=u(o().mark((function e(t){var r=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e,n){if(!Oj||void 0!==window.InstallTrigger)return e(r.stats);try{r.peer.getStats((function(n){n.result().forEach((function(e){if(!Nj.includes(e.type)){var n={};e.names().forEach((function(t){n[t]=e.stat(t)})),n.id=e.id,n.type=e.type,n.timestamp=e.timestamp,"ssrc"===n.type&&null!=t&&t.id?t.id===n.googTrackId&&r.stats.push(n):r.stats.push(n)}})),e(r.stats)}))}catch(Z$){n(Z$)}})));case 1:case"end":return e.stop()}}),e)}))),function(e){return r.apply(this,arguments)})},{key:"getStats",value:(t=u(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,this.peer.getStats(t);case 3:if(n=e.sent,this.processStats(n),e.prev=5,i=JB("STATS_SCALLBACK_SUPPORT"),r||!mP||!i){e.next=10;break}return e.next=10,this.getExtraStats(t);case 10:e.next=14;break;case 12:e.prev=12,e.t0=e.catch(5);case 14:e.next=18;break;case 16:e.prev=16,e.t1=e.catch(0);case 18:return e.abrupt("return",this.stats);case 19:case"end":return e.stop()}}),e,this,[[0,16],[5,12]])}))),function(e,r){return t.apply(this,arguments)})}]),e}(),Nj=["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"],Dj=function(){var e=u(o().mark((function e(t,r,n){var i,a;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=[],t instanceof RTCPeerConnection){e.next=3;break}return e.abrupt("return",i);case 3:return a=new xj(t),e.next=6,a.getStats(r,n);case 6:return i=e.sent,e.abrupt("return",i);case 8:case"end":return e.stop()}}),e)})));return function(t,r,n){return e.apply(this,arguments)}}(),Pj=function(){var e=u(o().mark((function e(){var t;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,!fP()&&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,Mj();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)}}(),Mj=function(){var e=u(o().mark((function e(){var t,r,n,i,a,s,u,c,d,l;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!wj){e.next=2;break}return e.abrupt("return",wj);case 2:return t=[],e.prev=3,e.next=6,IP();case 6:if(r=e.sent){e.next=9;break}return e.abrupt("return",t);case 9:if(!(null!=r&&r.includes("level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f")||null!=r&&r.includes("profile-level-id=42e01f;level-asymmetry-allowed=1;packetization-mode=1")||null!=r&&r.includes("packetization-mode=1;profile-level-id=42e01f;level-asymmetry-allowed=1"))){e.next=20;break}return n=navigator.userAgent.toLowerCase(),i=!1,a=["heytapbrowser","mqqbrowser","miuibrowser"],s=new Ej,e.next=16,s.getH264BlackList();case 16:for(u=e.sent,a.push.apply(a,k(u)),c=0,d=a;c<d.length;c++)l=d[c],n.includes(l)&&(i=!0);!i&&t.push("H264");case 20:return null!=r&&r.includes("VP8")&&t.push("vp8"),wj=t,e.abrupt("return",t);case 25:return e.prev=25,e.t0=e.catch(3),e.abrupt("return",t);case 28:case"end":return e.stop()}}),e,null,[[3,25]])})));return function(){return e.apply(this,arguments)}}(),Lj=function(){var e=u(o().mark((function e(){var t;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Mj();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)}}(),Uj=function(){return"undefined"!=typeof TransformStream&&"undefined"!=typeof RTCRtpSender&&"undefined"!=typeof RTCRtpReceiver&&void 0!==RTCRtpSender.prototype.createEncodedStreams&&void 0!==RTCRtpReceiver.prototype.createEncodedStreams},Vj=new LL("BasicHandler",3),Fj={iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan",encodedInsertableStreams:!!Uj()||void 0};function Bj(e){if(void 0===Cj){var t=navigator.userAgent.toLowerCase();Cj=t.includes("chrome")&&t.includes("mobile")}return Cj?Math.ceil(e):e}var jj=function(e){f(d,e);var t,r,n,a,s=g(d);function d(e,t){var r;return c(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),"connection_id",""),h(m(r),"ms_addr",""),r.monitor=e,r._peerConnection=new RTCPeerConnection(Fj),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;Vj.print("constructor","pc.ontrack ".concat(e.track.kind," ").concat(e.track.id," ").concat(null===(t=e.streams)||void 0===t||null===(n=t[0])||void 0===n?void 0:n.id)),r.emit("ontrack",e)},r._peerConnection.onconnectionstatechange=function(e){Vj.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,JF["".concat(t.toUpperCase())],r.connection_id,{ms_addr:r.ms_addr})},r}return l(d,[{key:"disconnect",value:function(){this._peerConnection.close(),this._dataChannel.close(),this._peerConnection.ontrack=null}},{key:"destroy",value:function(){Vj.print("destroy"),this.disconnect(),this._context=void 0}},{key:"_simulcast",value:function(e,t,r,n,o){var a=[],s=function(e){for(var t=0,r=e.width*e.height,n=0;n<Ij.length;n++)if(r>=Ij[n].totalPixels){t=n;break}if(0===t)return Ij[t].maxLayers;var i=Ij[t-1].totalPixels;return(i-r)/(i-Ij[t].totalPixels)<.1?Ij[t-1].maxLayers:Ij[t].maxLayers}(t);Vj.print("simulcast() ","maxLayers: %o",s),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/Rj.width,i=e.width/Aj.width):(n=e.height/Rj.height,i=e.height/Aj.height),r.push({maxkbps:Rj.maxkbps,scaleResolutionDownBy:n,frameRate:Rj.frameRate,width:Math.floor(e.width/n),height:Math.floor(e.height/n)}),t<=2||n>2&&r.unshift({maxkbps:Aj.maxkbps,scaleResolutionDownBy:i,frameRate:Aj.frameRate,width:Math.floor(e.width/i),height:Math.floor(e.height/i)}),r}(r,s),Vj.print("simulcast() ","simulcastLayers: %o",a)):(a=e.videoEncodeConfig.slice(1).slice(1-s).map((function(e){return i({frameRate:e.frameRate||15,maxkbps:e.maxKbps||600},kj(r,e))})),Vj.print("simulcast() ","simulcastLayers2: %o",a)),a.forEach((function(e,t){var r,i={maxBitrate:1e3*e.maxkbps,scaleResolutionDownBy:Bj(e.scaleResolutionDownBy),rid:"".concat(t+1),maxFramerate:e.frameRate};null===(r=n.sendEncodings)||void 0===r||r.unshift(i),o.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,u={direction:"sendonly",streams:[t]},c={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],_=kj(f,v);e.prevScaleResolutionDownBy=_.scaleResolutionDownBy,e.videoInputConfig=f;var m,y,g={maxBitrate:1e3*v.maxKbps,scaleResolutionDownBy:Bj(_.scaleResolutionDownBy),rid:"0",maxFramerate:v.frameRate||15};if(c.sendEncodings=[g],d.push({width:_.width,height:_.height,framerate:v.frameRate,maxkbps:v.maxKbps,rid:"0"}),o)this._simulcast(e,_,f,c,d),null!==(m=this._context)&&void 0!==m&&null!==(y=m.serverConfig)&&void 0!==y&&y.simulcastOnDemand&&(l=function(e){if(!e.length)return[];var t=e.shift(),r=t.width/t.height,n=0,o=0,a=i(i({},t),{},{video_index:o,sub_index:n++});delete a.rid;for(var s=[a],u=0,c=0;c<Tj.length;c++)if(Tj[c].height<t.height){u=c;break}for(var d=e.shift(),l=u;l<Tj.length;l++){var h,f=Tj[l];if(d&&f.height<=(null===(h=d)||void 0===h?void 0:h.height)){var p,v=f.height===(null===(p=d)||void 0===p?void 0:p.height),_=i(i({},d),{},{video_index:++o,sub_index:n++});if(delete _.rid,s.push(_),d=e.shift(),v)continue}s.push(i(i({},f),{},{width:Math.floor(f.height*r),video_index:o,sub_index:n++}))}return s}([].concat(d))),Vj.print("subVideoDesc","desc: %o ",l)}Vj.print("publish videoTransceiverInit videoDescriptions","",c,d);var S=null==n?void 0:n.getTrack("preprocessing");(null==n?void 0:n.mixType)!==te.PLAYOUT&&null!=n&&n.mixedAudioTrack&&(S=null==n?void 0:n.mixedAudioTrack),S=a&&S?S:"audio";var b=null==r?void 0:r.getTrack("preprocessing");return{semantics:"unified-plan",videoDescriptions:d,subVideoDescriptions:l,transceiverInit:{aTrack:S,vTrack:b=s&&b?b:"video",audioTransceiverInit:u,videoTransceiverInit:c}}}},{key:"updateScaleResolutionDownBy",value:(a=u(o().mark((function e(t){var r,n,i,a,s,u,c,d,l,h;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Vj.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 Vj.print("updateScaleResolutionDownBy()","no pub"),e.abrupt("return");case 6:s=null==i?void 0:i.getSettings(),u={width:Math.floor(s.width),height:Math.floor(s.height),frameRate:Math.floor(s.frameRate)},(c=kj(u,t.videoEncodeConfig[0])).scaleResolutionDownBy===t.prevScaleResolutionDownBy&&Vj.print("updateScaleResolutionDownBy()","no change %o",t.prevScaleResolutionDownBy),(d=null===(n=a.sender)||void 0===n?void 0:n.getParameters())&&(h=c.scaleResolutionDownBy/t.prevScaleResolutionDownBy,d.encodings=null==d||null===(l=d.encodings)||void 0===l?void 0:l.map((function(e){var r,n;Math.max(e.scaleResolutionDownBy=(e.scaleResolutionDownBy||1)*h,1);var i=+e.rid||0;e.maxFramerate=(null===(r=t.videoEncodeConfig[i])||void 0===r?void 0:r.frameRate)||e.maxFramerate;var o=null===(n=t.videoEncodeConfig[i])||void 0===n?void 0:n.maxKbps;return"number"==typeof o&&(e.maxBitrate=1e3*o),e})),t.prevScaleResolutionDownBy=c.scaleResolutionDownBy,t.videoInputConfig=u,null==a||a.sender.setParameters(d));case 12:case"end":return e.stop()}}),e)}))),function(e){return a.apply(this,arguments)})},{key:"getStats",value:function(e,t){return Dj(this._peerConnection,e,t)}},{key:"setLocalDescription",value:(n=u(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=lP(),e.prev=1,e.next=4,this._peerConnection.setLocalDescription(new RTCSessionDescription({type:"offer",sdp:t}));case 4:this.monitor.rtcSetDescription(0,t,tB.W_1,"local"===(null==r?void 0:r.streamUserId)?rB.UP:rB.DOWN,(null==r?void 0:r.streamId)||"",(null==r?void 0:r.streamUserId)||"",lP()-n,this.connection_id,{type:"offer",ms_addr:this.ms_addr}),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,{ms_addr:s.ms_addr},s.connection_id)},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,{ms_addr:s.ms_addr},s.connection_id)}))),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,tB.W_1,"local"===(null==r?void 0:r.streamUserId)?rB.UP:rB.DOWN,"","",lP()-n,this.connection_id,{type:"offer",ms_addr:this.ms_addr});case 12:case"end":return e.stop()}}),e,this,[[1,8]])}))),function(e,t){return n.apply(this,arguments)})},{key:"setRemoteDescription",value:(r=u(o().mark((function e(t,r){var n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=lP(),e.prev=1,e.next=4,this._peerConnection.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:t}));case 4:this.monitor.rtcSetDescription(0,t,tB.W_0,"local"===(null==r?void 0:r.streamUserId)?rB.UP:rB.DOWN,(null==r?void 0:r.streamId)||"",(null==r?void 0:r.streamUserId)||"",lP()-n,this.connection_id,{type:"answer",ms_addr:this.ms_addr}),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,tB.W_1,"local"===(null==r?void 0:r.streamUserId)?rB.UP:rB.DOWN,(null==r?void 0:r.streamId)||"",(null==r?void 0:r.streamUserId)||"",lP()-n,this.connection_id,{type:"answer",ms_addr:this.ms_addr});case 11:case"end":return e.stop()}}),e,this,[[1,7]])}))),function(e,t){return r.apply(this,arguments)})},{key:"setCurrentDescription",value:(t=u(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:"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(";"))}}))}}]),d}(xL.exports.EventEmitter),Gj={},Hj=vf,zj=Ut,qj=Te,Kj=eu,Xj=Pt,Wj=Ie,Yj=Wa,Jj=we,Qj=f_,Zj=Au,$j=di,eG=es,tG=Zt,rG=Pd,nG=uu,iG=qs,oG=ye,aG=ys.UNSUPPORTED_Y,sG=4294967295,uG=Math.min,cG=[].push,dG=qj(/./.exec),lG=qj(cG),hG=qj("".slice),fG=!oG((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]}));Kj("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=eG(Jj(this)),i=void 0===r?sG:r>>>0;if(0===i)return[];if(void 0===e)return[n];if(!Yj(e))return zj(t,n,e,i);for(var o,a,s,u=[],c=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.unicode?"u":"")+(e.sticky?"y":""),d=0,l=new RegExp(e.source,c+"g");(o=zj(iG,l,n))&&!((a=l.lastIndex)>d&&(lG(u,hG(n,d,o.index)),o.length>1&&o.index<n.length&&Hj(cG,u,rG(o,1)),s=o[0].length,d=a,u.length>=i));)l.lastIndex===o.index&&l.lastIndex++;return d===n.length?!s&&dG(l,"")||lG(u,""):lG(u,hG(n,d)),u.length>i?rG(u,0,i):u}:"0".split(void 0,0).length?function(e,r){return void 0===e&&0===r?[]:zj(t,this,e,r)}:t,[function(t,r){var i=Jj(this),o=Wj(t)?void 0:tG(t,e);return o?zj(o,t,i,r):zj(n,eG(i),t,r)},function(e,i){var o=Xj(this),a=eG(e),s=r(n,o,a,i,n!==t);if(s.done)return s.value;var u=Qj(o,RegExp),c=o.unicode,d=(o.ignoreCase?"i":"")+(o.multiline?"m":"")+(o.unicode?"u":"")+(aG?"g":"y"),l=new u(aG?"^(?:"+o.source+")":o,d),h=void 0===i?sG:i>>>0;if(0===h)return[];if(0===a.length)return null===nG(l,a)?[a]:[];for(var f=0,p=0,v=[];p<a.length;){l.lastIndex=aG?0:p;var _,m=nG(l,aG?hG(a,p):a);if(null===m||(_=uG($j(l.lastIndex+(aG?p:0)),a.length))===f)p=Zj(a,p,c);else{if(lG(v,hG(a,f,p)),v.length===h)return v;for(var y=1;y<=m.length-1;y++)if(lG(v,m[y]),v.length===h)return v;p=f=_}}return lG(v,hG(a,f)),v}]}),!fG,aG);var pG={},vG={exports:{}},_G=vG.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(_G).forEach((function(e){_G[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=vG.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 u=n[t][s];if(u.reg.test(i))return r(u,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}}))}))}}(pG);var mG=vG.exports,yG=/%[sdv%]/g,gG=function(e){var t=1,r=arguments,n=r.length;return e.replace(yG,(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""}}))},SG=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 gG.apply(null,n)},bG=["v","o","s","i","u","e","p","c","b","t","r","z","a"],EG=["i","c","b","a"],kG=pG,TG=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||bG,n=t.innerOrder||EG,i=[];return r.forEach((function(t){mG[t].forEach((function(r){r.name in e&&null!=e[r.name]?i.push(SG(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){i.push(SG(t,r,e))}))}))})),e.media.forEach((function(e){i.push(SG("m",mG.m[0],e)),n.forEach((function(t){mG[t].forEach((function(r){r.name in e&&null!=e[r.name]?i.push(SG(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){i.push(SG(t,r,e))}))}))}))})),i.join("\r\n")+"\r\n"};Gj.write=TG,Gj.parse=kG.parse,Gj.parseParams=kG.parseParams,Gj.parseFmtpConfig=kG.parseFmtpConfig,Gj.parsePayloads=kG.parsePayloads,Gj.parseRemoteCandidates=kG.parseRemoteCandidates,Gj.parseImageAttributes=kG.parseImageAttributes,Gj.parseSimulcastStreamList=kG.parseSimulcastStreamList;var IG=Math.pow(2,32),RG=function(){return Math.floor(Math.random()*IG+1e3)},AG=function(e,t,r){return r||(r=RG()),[{id:r,attribute:"cname",value:"kp34Za0H+aVf862l"},{id:r,attribute:"msid",value:"".concat(e.id," ").concat(e.id,"-").concat(t)},{id:r,attribute:"mslabel",value:"".concat(e.id)},{id:r,attribute:"label",value:"".concat(e.id,"-").concat(t)}]},wG=function(e,t){var r=RG(),n=RG();return{ssrcs:[r,n].reduce((function(r,n){return r.concat(AG(e,t,n))}),[]),ssrcGroups:[{semantics:"FID",ssrcs:"".concat(r," ").concat(n)}]}};function CG(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 OG=function(e,t,r){var n=i(i({},e),{},{invalid:[{value:"realx-exts:rscp"}],media:[t,r]});return delete n.groups,delete n.msidSemantic,Gj.write(n)};function xG(e){return NG.apply(this,arguments)}function NG(){return(NG=u(o().mark((function e(t){var r,n,i,a;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r={},n=t.publicIPs,i=t.certFingerprint,a=t.iceParams,r.fingerprint={type:"sha-256",hash:i},r.icePwd=a.serverIcePwd,e.next=6,PG(a.serverIceUfrag);case 6:return r.iceUfrag=e.sent,r.candidates=DG(n),r.setup="active",r.iceOptions="renomination",e.abrupt("return",r);case 11:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function DG(e){if(!Array.isArray(e))return[];var t=0,r=2130706431,n=[];return e.forEach((function(e){var o={component:1,ip:e.ip,type:"host",generation:e.generation};e.udpPorts&&e.udpPorts.forEach((function(e){n.push(i(i({},o),{},{foundation:t++,transport:"udp",port:e,priority:r}))})),e.tcpPorts&&e.tcpPorts.forEach((function(e){n.push(i(i({},o),{},{foundation:t++,transport:"tcp",port:e,tcptype:"passive",priority:2130705431}))}))})),n}var PG=function(){var e=u(o().mark((function e(t){var r,n,i,a,s,u,c;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,pP.b64str2ab(t);case 5:return e.t1=e.sent,i=new e.t0(e.t1),a=new Uint8Array(4),crypto.getRandomValues(a),(s=new Uint8Array(2))[0]=0,s[1]=1,u=hP(Uint8Array,n,i,a,s),e.next=15,pP.ab2b64str(u.buffer);case 15:return c=e.sent,e.abrupt("return",c);case 17:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),MG=function(e,t){var r=0;if(Array.isArray(e.fmtp)&&Array.isArray(e.rtp)){var n,i=R(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(c){i.e(c)}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 u=[];e.rtp.forEach((function(e){return u.push(e.payload)})),e.payloads=u.join(" ")}},LG=Te,UG=gh,VG=kd.exports.getWeakData,FG=Kl,BG=Pt,jG=Ie,GG=kt,HG=Hl,zG=Pe,qG=ln.set,KG=ln.getterFor,XG=Hi.find,WG=Hi.findIndex,YG=LG([].splice),JG=0,QG=function(e){return e.frozen||(e.frozen=new ZG)},ZG=function(){this.entries=[]},$G=function(e,t){return XG(e.entries,(function(e){return e[0]===t}))};ZG.prototype={get:function(e){var t=$G(this,e);if(t)return t[1]},has:function(e){return!!$G(this,e)},set:function(e,t){var r=$G(this,e);r?r[1]=t:this.entries.push([e,t])},delete:function(e){var t=WG(this.entries,(function(t){return t[0]===e}));return~t&&YG(this.entries,t,1),!!~t}};var eH,tH={getConstructor:function(e,t,r,n){var i=e((function(e,i){FG(e,o),qG(e,{type:t,id:JG++,frozen:void 0}),jG(i)||HG(i,e[n],{that:e,AS_ENTRIES:r})})),o=i.prototype,a=KG(t),s=function(e,t,r){var n=a(e),i=VG(BG(t),!0);return!0===i?QG(n).set(t,r):i[n.id]=r,e};return UG(o,{delete:function(e){var t=a(this);if(!GG(e))return!1;var r=VG(e);return!0===r?QG(t).delete(e):r&&zG(r,t.id)&&delete r[t.id]},has:function(e){var t=a(this);if(!GG(e))return!1;var r=VG(e);return!0===r?QG(t).has(e):r&&zG(r,t.id)}}),UG(o,r?{get:function(e){var t=a(this);if(GG(e)){var r=VG(e);return!0===r?QG(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}},rH=se,nH=Te,iH=gh,oH=kd.exports,aH=mh,sH=tH,uH=kt,cH=Kd,dH=ln.enforce,lH=jr,hH=!rH.ActiveXObject&&"ActiveXObject"in rH,fH=function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}},pH=aH("WeakMap",fH,sH);if(lH&&hH){eH=sH.getConstructor(fH,"WeakMap",!0),oH.enable();var vH=pH.prototype,_H=nH(vH.delete),mH=nH(vH.has),yH=nH(vH.get),gH=nH(vH.set);iH(vH,{delete:function(e){if(uH(e)&&!cH(e)){var t=dH(this);return t.frozen||(t.frozen=new eH),_H(this,e)||t.frozen.delete(e)}return _H(this,e)},has:function(e){if(uH(e)&&!cH(e)){var t=dH(this);return t.frozen||(t.frozen=new eH),mH(this,e)||t.frozen.has(e)}return mH(this,e)},get:function(e){if(uH(e)&&!cH(e)){var t=dH(this);return t.frozen||(t.frozen=new eH),mH(this,e)?yH(this,e):t.frozen.get(e)}return yH(this,e)},set:function(e,t){if(uH(e)&&!cH(e)){var r=dH(this);r.frozen||(r.frozen=new eH),mH(this,e)?gH(this,e,t):r.frozen.set(e,t)}else gH(this,e,t);return this}})}var SH=function(e){f(T,e);var t,r,n,i,a,s,d,p,v,_,y,S,b,E=g(T);function T(){var e;return c(this,T),h(m(e=E.call(this)),"inited",!1),h(m(e),"deviceMap",{audioinput:new Map,audiooutput:new Map,videoinput:new Map}),e._handleDeviceChange=e._handleDeviceChange.bind(m(e)),!fP()&&e.refreshDevices(),e}return l(T,[{key:"refreshDevices",value:(b=u(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=7;break}return e.next=6,navigator.mediaDevices.getUserMedia({audio:!0});case 6:t=e.sent;case 7:return e.next=9,navigator.mediaDevices.enumerateDevices();case 9: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 14:case"end":return e.stop()}}),e,this)}))),function(){return b.apply(this,arguments)})},{key:"initListener",value:(S=u(o().mark((function e(){var t,r=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:"function"==typeof(null===(t=navigator.mediaDevices)||void 0===t?void 0:t.addEventListener)&&navigator.mediaDevices.addEventListener("devicechange",(function(){r._handleDeviceChange(),setTimeout((function(){r._handleDeviceChange()}),300)}));case 1:case"end":return e.stop()}}),e)}))),function(){return S.apply(this,arguments)})},{key:"_handleDeviceChange",value:(y=u(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=e.sent,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(ie.onVideoDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"active"}):e.kind.includes("audio")&&i.emit(ie.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(ie.onVideoDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"inactive"}):e.kind.includes("audio")&&i.emit(ie.onAudioDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"inactive"}))}));case 12:case"end":return e.stop()}}),e,this)}))),function(){return y.apply(this,arguments)})},{key:"getVideoPermission",value:(_=u(o().mark((function e(){var t;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this._getVideoPermission(),e.next=3,this.refreshDevices();case 3:return e.abrupt("return",t);case 4:case"end":return e.stop()}}),e,this)}))),function(){return _.apply(this,arguments)})},{key:"_getVideoPermission",value:(v=u(o().mark((function e(){var t,r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._getNavigatorPermission("camera");case 2:if(!e.sent){e.next=4;break}return e.abrupt("return",!0);case 4:if(r=!1,null===(t=navigator.mediaDevices)||void 0===t||!t.getUserMedia){e.next=8;break}return e.next=8,navigator.mediaDevices.getUserMedia({audio:!1,video:!0}).then((function(e){e&&(e.getTracks().forEach((function(e){return e.stop()})),r=!0)})).catch((function(){}));case 8:return e.abrupt("return",r);case 9:case"end":return e.stop()}}),e,this)}))),function(){return v.apply(this,arguments)})},{key:"getAudioPermission",value:(p=u(o().mark((function e(){var t;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this._getAudioPermission(),e.next=3,this.refreshDevices();case 3:return e.abrupt("return",t);case 4:case"end":return e.stop()}}),e,this)}))),function(){return p.apply(this,arguments)})},{key:"_getAudioPermission",value:(d=u(o().mark((function e(){var t,r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._getNavigatorPermission("microphone");case 2:if(!e.sent){e.next=4;break}return e.abrupt("return",!0);case 4:if(r=!1,null===(t=navigator.mediaDevices)||void 0===t||!t.getUserMedia){e.next=8;break}return e.next=8,navigator.mediaDevices.getUserMedia({audio:!0,video:!1}).then((function(e){e&&(e.getTracks().forEach((function(e){return e.stop()})),r=!0)})).catch((function(){}));case 8:return e.abrupt("return",r);case 9:case"end":return e.stop()}}),e,this)}))),function(){return d.apply(this,arguments)})},{key:"enumerateDevices",value:(s=u(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._getVideoPermission();case 2:return e.next=4,this._getAudioPermission();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 s.apply(this,arguments)})},{key:"enumerateAudioCaptureDevices",value:(a=u(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._getAudioPermission();case 2:return e.abrupt("return",Array.from(this.deviceMap.audioinput.values()));case 3:case"end":return e.stop()}}),e,this)}))),function(){return a.apply(this,arguments)})},{key:"enumerateVideoCaptureDevices",value:(i=u(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._getVideoPermission();case 2:return e.abrupt("return",Array.from(this.deviceMap.videoinput.values()));case 3:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"enumerateAudioPlaybackDevices",value:(n=u(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._getAudioPermission();case 2:return e.abrupt("return",Array.from(this.deviceMap.audiooutput.values()));case 3:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"getDeviceById",value:(r=u(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 r.apply(this,arguments)})},{key:"_getNavigatorPermission",value:(t=u(o().mark((function e(t){var r,n,i,a;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=!1,null===(r=navigator.permissions)||void 0===r||!r.query){e.next=12;break}return e.prev=2,e.next=5,navigator.permissions.query({name:t});case 5:i=e.sent,a=i.state,n="granted"===a,e.next=12;break;case 10:e.prev=10,e.t0=e.catch(2);case 12:return e.abrupt("return",n);case 13:case"end":return e.stop()}}),e,null,[[2,10]])}))),function(e){return t.apply(this,arguments)})}]),T}(VL),bH=new SH,EH=function(){function e(){c(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}(),kH=function(){function e(t){c(this,e),h(this,"_ctx",void 0),h(this,"_analyserNode",void 0),h(this,"_audioSource",void 0);var r=TH.getAudioContextInstance();if(t instanceof MediaStreamTrack){var n=new MediaStream;n.addTrack(t),this._audioSource=r.createMediaStreamSource(n)}else t instanceof AudioNode?this._audioSource=t:(this._audioSource=r.createMediaElementSource(t),this._audioSource.connect(r.destination));var i=r.createAnalyser();this._audioSource.connect(i),this._analyserNode=i,this._ctx=r}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:"destroy",value:function(){this._audioSource.disconnect(),this._analyserNode.disconnect()}}]),e}(),TH=new EH,IH=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}(IH||{}),RH=function(){function e(){c(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=u(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=R(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}(),AH=new LL("VERTC",0),wH=new WeakMap,CH=function(e){f(r,e);var t=g(r);function r(e,n){var i;return c(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}(VL),OH=function(e){f(n,e);var t,r=g(n);function n(e,t,i){var o;return c(this,n),h(m(o=r.call(this,t,i)),"_mediaTrack",void 0),h(m(o),"_preProcessingTrack",void 0),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=u(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;return this._mediaTrack.onended=null,this._mediaTrack.onmute=null,this._mediaTrack.onunmute=null,null===(e=this._preProcessingTrack)||void 0===e||e.stop(),null===(t=this._mediaTrack)||void 0===t?void 0:t.stop()}},{key:"_initListeners",value:function(){var e=this;this._mediaTrack instanceof MediaStreamTrack&&this._mediaTrack.addEventListener("ended",(function(){IB.rtcError("track-ended mediaType: ".concat(e._mediaTrack.kind),-1001),e.emit("track-ended",e)}))}}]),n}(CH),xH=function(e){f(r,e);var t=g(r);function r(e,n,i){var o;return c(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}(CH),NH=function(e){f(n,e);var t,r=g(n);function n(e,t){var i;return c(this,n),h(m(i=r.call(this,e,t,"video")),"resolution",void 0),h(m(i),"videoCaptureConfig",void 0),h(m(i),"dummy",!1),i.resolution={width:0,height:0},i}return l(n,[{key:"updateVideoCaptureConfig",value:(t=u(o().mark((function e(){var t;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.videoCaptureConfig&&this.getTrack()){e.next=2;break}return e.abrupt("return");case 2:return AH.print("updateVideoEncoderConfig","update localVideoTrack: ",this.videoCaptureConfig),delete i({},this.videoCaptureConfig).contentHint,e.next=7,this.getTrack().applyConstraints(this.videoCaptureConfig);case 7:((t=this.getTrack().getSettings()).width&&t.width!==this.resolution.width||t.height&&t.height!==this.resolution.height)&&(this.resolution={width:t.width,height:t.height},this.emit("resolution-change",this.resolution));case 9:case"end":return e.stop()}}),e,this)}))),function(){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}(OH),DH=function(e){f(n,e);var t,r=g(n);function n(e,t){var i;return c(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",te.PLAYOUT_AND_PUBLISH),i}return l(n,[{key:"getAudioLevel",value:function(){return this._audioLevelFetcher||(this._audioLevelFetcher=new kH(this.getTrack("preprocessing"))),this._audioLevelFetcher.getAudioLevel()}},{key:"updateAudioCaptureConfig",value:(t=u(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 AH.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}(OH),PH=function(e){f(r,e);var t=g(r);function r(e,n){return c(this,r),t.call(this,e,n,"video")}return l(r)}(xH),MH=function(e){f(r,e);var t=g(r);function r(e,n){var i;return c(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 kH(this.getTrack())),this._audioLevelFetcher.getAudioLevel()}}]),r}(xH),LH=function(e){f(r,e);var t=g(r);function r(){var e;c(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",U.STREAM_INDEX_MAIN),e}return l(r)}(DH),UH=function(e){f(r,e);var t=g(r);function r(){var e;c(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",U.STREAM_INDEX_MAIN),e}return l(r)}(NH),VH=function(e){f(r,e);var t=g(r);function r(){var e;c(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",U.STREAM_INDEX_MAIN),h(m(e),"sourceType",0),e}return l(r)}(NH),FH=function(e){f(r,e);var t=g(r);function r(){var e;c(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",U.STREAM_INDEX_MAIN),h(m(e),"sourceType",0),e}return l(r)}(DH),BH=function(e){f(r,e);var t=g(r);function r(){var e;c(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",U.STREAM_INDEX_SCREEN),e}return l(r)}(NH),jH=function(e){f(r,e);var t=g(r);function r(){var e;c(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",U.STREAM_INDEX_SCREEN),e}return l(r)}(DH),GH=function(e){f(r,e);var t=g(r);function r(){var e;c(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",U.STREAM_INDEX_SCREEN),h(m(e),"sourceType",0),e}return l(r)}(NH),HH=function(e){f(r,e);var t=g(r);function r(){var e;c(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",U.STREAM_INDEX_SCREEN),h(m(e),"sourceType",0),e}return l(r)}(DH);function zH(e,t){return qH.apply(this,arguments)}function qH(){return(qH=u(o().mark((function e(t,r){var n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=new UH(t,dP())).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 KH(e,t){return XH.apply(this,arguments)}function XH(){return(XH=u(o().mark((function e(t,r){var n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=new BH(t,dP())).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 WH(e,t){return YH.apply(this,arguments)}function YH(){return(YH=u(o().mark((function e(t,r){var n,i,a,s,u,c;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,AH.print("createCameraVideoTrack","constraints:",t),IB.rtcVideoCaptureEvent({event_type:gB.START,media_device_id:a}),s=lP(),e.next=7,navigator.mediaDevices.getUserMedia({video:t});case 7:i=e.sent,IB.rtcVideoCaptureEvent({event_type:gB.START_CAPTURE_RESULT,media_device_id:a,reason:SB.SUCCESS,elapse:lP()-s}),bH.refreshDevices(),e.next=16;break;case 12:throw e.prev=12,e.t0=e.catch(1),IB.rtcVideoCaptureEvent({event_type:gB.RUNNING_FAILED,media_device_id:a,error_code:e.t0.code,reason:e.t0.name+e.t0.message}),new ZN(JN.GET_VIDEO_TRACK_FAILED,"throw error from getUserMedia",e.t0);case 16:return u=i.getVideoTracks()[0],wH.set(u,i),(c=new UH(u,dP())).videoCaptureConfig=t,e.next=22,c.generatePreProcessingTrack(r);case 22:return e.abrupt("return",c);case 23:case"end":return e.stop()}}),e,null,[[1,12]])})))).apply(this,arguments)}function JH(e,t,r){return QH.apply(this,arguments)}function QH(){return(QH=u(o().mark((function e(t,r,n){var i,a,s,u,c,d,l,h,f,p,v,_;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return AH.print("createCameraVideoTrack","constraints:",t),s=(null==t||null===(i=t.deviceId)||void 0===i?void 0:i.exact)||"default",u=(null==n?void 0:n.config)||{},c=u.sampleRate,d=u.channel,l=u.agc,h=u.ans,f=u.aec,void 0===t.sampleRate&&(t.sampleRate=c),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,IB.rtcVideoCaptureEvent({event_type:gB.START,media_device_id:s}),p=lP(),r.getPluginByName(IH.PRE_PROCESSING,"RTCAIAnsExtension")&&(t.autoGainControl=!0,t.noiseSuppression=!1),e.next=14,navigator.mediaDevices.getUserMedia({audio:t});case 14:a=e.sent,IB.rtcVideoCaptureEvent({event_type:gB.START_CAPTURE_RESULT,media_device_id:s,reason:SB.SUCCESS,elapse:lP()-p}),bH.refreshDevices(),e.next=23;break;case 19:throw e.prev=19,e.t0=e.catch(8),IB.rtcVideoCaptureEvent({event_type:gB.RUNNING_FAILED,media_device_id:s,error_code:e.t0.code,reason:e.t0.name+e.t0.message}),new ZN(JN.GET_AUDIO_TRACK_FAILED,"throw error from getUserMedia",e.t0);case 23:return v=a.getAudioTracks()[0],wH.set(v,a),_=new LH(v,dP()),e.next=28,_.generatePreProcessingTrack(r);case 28:return e.abrupt("return",_);case 29:case"end":return e.stop()}}),e,null,[[8,19]])})))).apply(this,arguments)}function ZH(){return $H.apply(this,arguments)}function $H(){return $H=u(o().mark((function e(){var t,r,n,i,a,s,u,c,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,AH.print("createScreenTracks","withAudio: %o, constraints: %o",t,n),e.prev=4,IB.rtcVideoCaptureEvent({event_type:gB.START,media_device_id:"screen"}),a=lP(),e.next=9,navigator.mediaDevices.getDisplayMedia({video:!(n&&!gP)||n,audio:!!t&&{channelCount:2,noiseSuppression:!1,echoCancellation:!1,autoGainControl:!1}});case 9:i=e.sent,IB.rtcVideoCaptureEvent({event_type:gB.START_CAPTURE_RESULT,media_device_id:"screen",reason:SB.SUCCESS,elapse:lP()-a}),e.next=17;break;case 13:throw e.prev=13,e.t0=e.catch(4),IB.rtcVideoCaptureEvent({event_type:gB.RUNNING_FAILED,media_device_id:"screen",error_code:e.t0.code,reason:e.t0.name+e.t0.message}),new ZN(JN.GET_SCREEN_TRACK_FAILED,"throw error from getDisplayMedia",e.t0);case 17:return s=i.getVideoTracks()[0],u=new BH(s,dP()),e.next=21,u.generatePreProcessingTrack(r);case 21:if(!(c=i.getAudioTracks()[0])){e.next=27;break}return d=new jH(c,dP()),e.next=26,d.generatePreProcessingTrack(r);case 26:return e.abrupt("return",[u,d]);case 27:return e.abrupt("return",[u,void 0]);case 28:case"end":return e.stop()}}),e,null,[[4,13]])}))),$H.apply(this,arguments)}function ez(e,t){return tz.apply(this,arguments)}function tz(){return(tz=u(o().mark((function e(t,r){var n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new VH(t,dP()),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 rz(e,t){return nz.apply(this,arguments)}function nz(){return(nz=u(o().mark((function e(t,r){var n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new FH(t,dP()),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 iz(e,t){return oz.apply(this,arguments)}function oz(){return(oz=u(o().mark((function e(t,r){var n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new GH(t,dP()),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 az(e,t){return sz.apply(this,arguments)}function sz(){return(sz=u(o().mark((function e(t,r){var n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new HH(t,dP()),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 uz=DH,cz=function(e){return e[e.NONE=0]="NONE",e}(cz||{}),dz=function(){function e(){c(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}(),lz=function(){function e(t){c(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}(),hz=function(e){return e[e.internal=0]="internal",e[e.external=1]="external",e[e.bypass=2]="bypass",e}(hz||{}),fz=new Uint8Array([109,167,53,190,103,90,72,1,170,89,63,164,194,199,19,85]),pz=new Uint8Array([109,167,53,190,103,90,72,1,170,89,63,164,194,199,19,84]),vz=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 _z(e){for(var t=[];e>=255;)e-=255,t.push(255);return t.push(e),new Uint8Array(t)}function mz(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 yz=function(){function e(){c(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?fz:pz,a=_z(e.byteLength+o.byteLength),s=vz(e);return new Uint8Array([].concat(k(r),k(n),k(i),k(a),k(o),k(s),[128]))}},{key:"decodeSeiBody",value:function(e){var t=function(e){for(var t=[],r=0;r<e.length;r++)e[r]<=3&&0===e[r-1]&&0===e[r-2]||t.push(e[r]);return new Uint8Array(t)}(e=e.slice(0,e.length-1));if(!(t.byteLength<2)){var r=0;if(5===t[1]||100===t[1]){var n=E(mz(t,r+=2),2),i=n[0],o=2,a=(r=n[1])+i;return t.byteLength>=pz.byteLength&&i>=pz.byteLength&&t.slice(r,r+pz.byteLength).toString()===pz.toString()?(r+=pz.byteLength,o=1):t.byteLength>=pz.byteLength&&i>=pz.byteLength&&t.slice(r,r+fz.byteLength).toString()===fz.toString()&&(r+=fz.byteLength,o=0),{type:o,payload:t.slice(r,a)}}}}},{key:"parseInternalSEI",value:function(e){var t=new Map,r=0;if(0===e.type){for(;e.payload.byteLength-r>=2;){var n=E(mz(e.payload,r),2),i=n[0];r=n[1];var o=E(mz(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=R(e);try{for(n.s();!(t=n.n()).done;){var i=E(t.value,2),o=i[0],a=i[1],s=_z(o),u=_z(a.byteLength);r.push(s,u,a)}}catch(l){n.e(l)}finally{n.f()}var c=r.reduce((function(e,t){return e+t.byteLength}),0),d=new Uint8Array(c);return r.reduce((function(e,t){return d.set(t,e),e+t.byteLength}),0),d}}]),e}(),gz=function(){function e(t){c(this,e),h(this,"_stream",void 0),h(this,"_timer",void 0),h(this,"player",void 0),h(this,"client",void 0),h(this,"handler",void 0),h(this,"monitor",void 0),this._stream=t}return l(e,[{key:"setVar",value:function(e,t,r){this.client=e,this.handler=t,this.monitor=r}},{key:"delStatsEvtInterval",value:function(){clearTimeout(this._timer),this._timer=void 0}},{key:"filterIllegal",value:function(e){var t={};return Object.keys(e).forEach((function(r){null===e[r]||void 0===e[r]||Number.isNaN(e[r])||(t[r]=e[r])})),t}},{key:"destroy",value:function(){this.delStatsEvtInterval()}}]),e}(),Sz=function(e){f(i,e);var t,r,n=g(i);function i(e){var t;return c(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(sj.ABNORMAL_DISCONNECTION,(function(){s.destroy()}));var c={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,c,null===(a=d.audioTrack)||void 0===a?void 0:a.getAudioLevel()),this.getVideoStats(h,c),this.delStatsEvtInterval();var f=function(){var e=u(o().mark((function e(){var t,r,n,i,a,u,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,c,null===(n=d.audioTrack)||void 0===n?void 0:n.getAudioLevel());case 4:return u=e.sent,e.next=7,s.getVideoStats(a,c);case 7:return l=e.sent,e.abrupt("return",{audioStats:u,videoStats:l,isScreen:d.isScreen});case 9:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),p=function(){var e=u(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=setTimeout(p,2e3);case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();this._timer=setTimeout(p,2e3)}}},{key:"unpublish",value:function(){this.delStatsEvtInterval()}},{key:"getAudioStats",value:(r=u(o().mark((function e(t,r,n){var i,a,s,u,c,d,l,h,f,p;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i={},a={timestamp:Date.now()},s=this._stream,u=s.streamId,c=s.audioMid,d=s.isScreen,l=s.pubAttributes,h={media_type:"audio",is_screen:!!d,direction:"up",stream_id:u,vid:c,connection_status:navigator.onLine,capture_state:l.localaudio?"capture_state_on":"capture_state_off"},t&&this.handler){e.next=6;break}return e.abrupt("return",i);case 6:return e.next=8,this.handler.getStats(t);case 8:if((f=e.sent).length){e.next=11;break}return e.abrupt("return",i);case 11:if(f.forEach((function(e){var t=e.type,r=e.packetsSent,n=e.packetsLost,o=e.bytesSent,s=e.clockRate,u=e.roundTripTime,c=e.channels,d=e.audioLevel;e.googRtt;var l=e.mimeType,f=e.availableIncomingBitrate,p=e.availableOutgoingBitrate,v=e.bytesReceived,_=e.nominated,m=e.id,y=e.currentRoundTripTime,g=e.state,S=e.writable,b=e.requestsReceived,E=e.responsesReceived,k=e.requestsSent,T=e.consentRequestsSent,I=e.responsesSent,R=e.jitter,A=e.candidateType,w=e.ip,C=e.address,O=e.networkType,x=e.port,N=e.protocol,D=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,h.bytes=o,h.packetsSent=r,h.nackCount=D,h.ssrc=U,h.retransmitted_bytes_sent=P,h.retransmitted_packets_sent=M,a.retransmittedBytesSent=P,a.retransmittedPacketsSent=M):"remote-inbound-rtp"===t?(a.packetsLost=n,h.packetsLost=n,h.net_jitter=1e3*R,i.rtt=1e3*u,h.rtt=i.rtt,i._fractionLost=j||0):"codec"===t?(i.recordSampleRate=s,i.numChannels=c,h.codecName=l):"media-source"===t&&void 0!==d?(h.audio_level=d?-10*Math.log10(Math.pow(d,2)):d,h.volume=255*d,h.total_audio_energy=V,h.totalInputDuration=F):"ssrc"===t&&"audio"===B?h.send_level=L:"candidate-pair"===t?(h.ice_available_incoming_bitrate=f,h.ice_available_outgoing_bitrate=p,h.ice_bytes_received=v,h.ice_bytes_sent=o,h.ice_nominated=+_,h.ice_pair_id=m,h.ice_pair_rtt=y,h.ice_pair_state=g,h.ice_pair_writable=S,h.recv_ping_requests=b,h.recv_ping_responses=E,h.sent_ping_requests_before_first_response=k,h.sent_ping_requests_total=k+(T||0),h.sent_ping_responses=I):"local-candidate"===t?(h.local_candidate_type=A,h.local_ip=w||C,h.local_network_type=O,h.local_port=x,h.protocol=N):"remote-candidate"===t&&(h.remote_candidate_type=A,h.remote_ip=w||C,h.remote_port=x);var G=JB("STATS_SCALLBACK_SUPPORT");mP&&G||"media-source"===t&&(h.send_level=d)})),void 0===h.volume&&void 0!==n&&(h.volume=n,h.audio_level=n?-10*Math.log10(Math.pow(n/255,2)):n),(p=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-p.packetsLost)/(a.packetsSent-p.packetsSent),i.audioLossRate=Number.isNaN(i.audioLossRate)?0:i.audioLossRate,h.fraction_lost=i.audioLossRate),i.statsInterval=a.timestamp-p.timestamp,h.stats_interval=i.statsInterval,i.sendKBitrate=(a.bytesSent-p.bytesSent||0)/i.statsInterval*8,h.mediaBitratebps=Math.round(1e3*i.sendKBitrate),h.bandwidth=Math.round(h.mediaBitratebps/1024),void 0!==a.retransmittedBytesSent&&(h.retransmitBitratebps=(a.retransmittedBytesSent-p.retransmittedBytesSent||0)/i.statsInterval),r.audio=a,this.monitor.rtcMediaStatistics(h,{}),i._retransmittedRate=(a.retransmittedPacketsSent-p.retransmittedPacketsSent)/(a.packetsSent-p.packetsSent),i._fractionLost=Math.max(i._fractionLost,i.audioLossRate),e.abrupt("return",this.filterIllegal(i));case 29:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return r.apply(this,arguments)})},{key:"getVideoStats",value:(t=u(o().mark((function e(t,r){var n,i,a,s,u,c,d,l,h,f,p,v,_,m;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n={},i={timestamp:Date.now(),simulcast:{}},a=this._stream,s=a.streamId,u=a.videoMid,c=a.isScreen,d=a.pubAttributes,l=a.enableSimulcast,h={media_type:"video",is_screen:!!c,direction:"up",stream_id:s,vid:u,connection_status:navigator.onLine,capture_state:d.localvideo?"capture_state_on":"capture_state_off"},t&&this.handler){e.next=6;break}return e.abrupt("return",n);case 6:return n.isScreen=c,e.next=9,this.handler.getStats(t);case 9:if((f=e.sent).length){e.next=12;break}return e.abrupt("return",n);case 12:if(p=0,f.forEach((function(e){var o=e.type,a=e.framesEncoded,s=e.packetsLost,u=e.bytesSent,c=e.framesSent,d=e.retransmittedBytesSent,f=e.totalPacketSendDelay,v=e.totalEncodeTime,_=e.firCount,m=e.qualityLimitationReason,y=e.targetBitrate,g=e.roundTripTime,S=e.mimeType,b=e.frameWidth,E=e.frameHeight,k=e.packetsSent,T=e.googActualEncBitrate,I=e.googAvailableReceiveBandwidth,R=e.googAvailableSendBandwidth,A=e.googAvgEncodeMs,w=e.googBucketDelay,C=e.googEncodeUsagePercent,O=e.googFrameRateInput,x=e.availableIncomingBitrate,N=e.availableOutgoingBitrate,D=e.bytesReceived,P=e.nominated,M=e.id,L=e.currentRoundTripTime,U=e.state,V=e.writable,F=e.candidateType,B=e.ip,j=e.address,G=e.networkType,H=e.port,z=e.nackCount,q=e.pliCount,K=e.protocol,X=e.qpSum,W=e.requestsReceived,Y=e.responsesReceived,J=e.googRetransmitBitrate,Q=e.requestsSent,Z=e.consentRequestsSent,$=e.responsesSent,ee=e.ssrc,te=e.googTargetEncBitrate,re=e.googTransmitBitrate,ne=e.retransmittedPacketsSent,ie=e.encoderImplementation,oe=e.jitter,ae=e.rid,se=e.fractionLost,ue=e.googAdaptationChanges,ce=e.googBandwidthLimitedResolution,de=e.googCpuLimitedResolution,le=e.googFirsReceived,he=e.googFrameRateSent;"outbound-rtp"===o?(l&&(ae?i.simulcast[ae]=e:i.simulcast[p]=e,p++),i.framesEncoded=a,i.bytesSent=u,i.framesSent=c,h.bytes=u,i.packetsSent=k,i.retransmittedBytesSent=d,h.packetsSent=k,h.nackCount=z,h.pli_count=q,h.qp_sum=X,h.ssrc=ee,h.retransmitted_packets_sent=ne,i.retransmittedPacketsSent=ne,h.encoder_implementation=ie,void 0!==b&&(n.encodedFrameWidth=b,n.encodedFrameHeight=E,h.frame_size_height=E,h.frame_size_width=b)):"track"===o?(n.encodedFrameWidth=b,n.encodedFrameHeight=E,h.frame_size_height=E,h.frame_size_width=b):"remote-inbound-rtp"===o?(i.packetsLost=s,n.rtt=1e3*g,h.rtt=n.rtt,h.jitter=oe,h.packetsLost=s,n._fractionLost=se||0):"codec"===o?(n.codecType=S,h.codecName=S):"candidate-pair"===o?(h.ice_available_incoming_bitrate=x,h.ice_available_outgoing_bitrate=N,h.ice_bytes_received=D,h.ice_bytes_sent=u,h.ice_nominated=+P,h.ice_pair_id=M,h.ice_pair_rtt=L,h.ice_pair_state=U,h.ice_pair_writable=V,h.recv_ping_requests=W,h.recv_ping_responses=Y,h.sent_ping_requests_before_first_response=Q,h.sent_ping_requests_total=Q+Z,h.sent_ping_responses=$):"local-candidate"===o?(h.local_candidate_type=F,h.local_ip=B||j,h.local_network_type=G,h.local_port=H,h.protocol=K):"remote-candidate"===o?(h.remote_candidate_type=F,h.remote_ip=B||j,h.remote_port=H):"VideoBwe"===o?(h.encBitratebps=T,h.available_receive_bandwidth=I,h.available_send_bandwidth=R,h.bucket_delay=w,h.retransmitBitratebps=J,h.targetEncBitratebps=te,h.transmit_bitrate=re,n._sendBandWidth=+R):"ssrc"===o&&(h.avg_encode_ms=A,h.encodeUsage=C,h.frame_rate_input=O,h.orignal_input_Framerate=+O,h.ddaptationChanges=ue,h.qualityLimitationReason=ce,h.qualityLimitationDurations=de,h.firsReceived=le,h.frameRateSent=he);var fe=JB("STATS_SCALLBACK_SUPPORT");if(!mP||!fe){var pe=r.video,ve=i.timestamp-pe.timestamp;if("outbound-rtp"===o){var _e=u-pe.bytesSent,me=d-pe.retransmittedBytesSent;h.encBitratebps=Math.round(8e3*(_e-me)/ve),h.bucket_delay=f/k,h.retransmitBitratebps=Math.round(8e3*me/ve),h.targetEncBitratebps=y,h.transmit_bitrate=Math.round(1e3*(u-pe.bytesSent)*8/ve),h.avg_encode_ms=1e3*v/a,h.firsReceived=_+q,h.qualityLimitationReason="bandwidth"===m,h.qualityLimitationDurations="cpu"===m}else"candidate-pair"===o&&(h.available_send_bandwidth=N,n._sendBandWidth=N);if(t){var ye=null==t?void 0:t.getSettings().frameRate;h.orignal_input_Framerate=ye,h.frameRateSent=t.getSettings().frameRate}}})),(v=r.video).timestamp){e.next=18;break}return r.video=i,e.abrupt("return",this.filterIllegal(n));case 18:return n.statsInterval=i.timestamp-v.timestamp,h.stats_interval=n.statsInterval,_=Object.keys(i.simulcast),l?(h.sim_enc_width=[],h.sim_enc_height=[],h.sim_enc_bps=[],h.sim_enc_framerate=[],h.sim_rids=[],h.sim_enc_bandwidth=[],h.sim_sent_framerate=[],h.sim_fraction_lost=[],h.sim_keyencoded=[],h.active_sim_streams=[],h.sim_retransmittedRate=[],m=!1,_.sort((function(e,t){return+e-+t})).forEach((function(e){var t=i.simulcast[e],r=t.frameWidth,o=t.frameHeight,a=t.bytesSent,s=t.framesEncoded,u=t.framesSent,c=t.packetsLost,d=t.packetsSent,l=t.qualityLimitationReason,f=t.qualityLimitationDurations,p=t.qualityLimitationResolutionChanges,_=t.retransmittedPacketsSent,y=t.pliCount;void 0!==l&&(h.sim_qualityLimitationReason||(h.sim_qualityLimitationReason=[],h.sim_qualityLimitationDurations=[],h.sim_qualityLimitationResolutionChanges=[]),h.sim_qualityLimitationReason.push(l),h.sim_qualityLimitationDurations.push(f),h.sim_qualityLimitationResolutionChanges.push(p));var g=v.simulcast[e];if(h.sim_enc_width.push(r||0),h.sim_enc_height.push(o||0),g){var S=(a-g.bytesSent||0)/n.statsInterval;h.sim_enc_bps.push(Math.round(8e3*S)),h.sim_enc_bandwidth.push(Math.round(8e3*S/1024));var b=1e3*(s-g.framesEncoded)/n.statsInterval;h.sim_enc_framerate.push(Math.round(b)),h.sim_rids.push(e);var E=void 0!==u?u-g.framesSent:s-g.framesEncoded,k=1e3*E/n.statsInterval;h.sim_sent_framerate.push(Math.round(k));var T=(c-g.packetsLost)/(d-g.packetsSent);n._retransmittedRate=(_-g.retransmittedPacketsSent)/(d-g.packetsSent),T=Number.isNaN(T)?0:T,h.sim_fraction_lost.push(T),h.sim_keyencoded.push(y-g.pliCount>0),h.active_sim_streams.push(S>=0),h.sim_retransmittedRate.push(n._retransmittedRate),r>0&&!m&&(n.sentKBitrate=8*S,n.encoderOutputFrameRate=b,n.encodedFrameCount=E,n.sentFrameRate=k,n.videoLossRate=T,m=!0)}})),this.monitor.rtcMediaStatistics(h,{})):(n.encodedFrameCount=void 0!==i.framesSent?i.framesSent-v.framesSent:i.framesEncoded-v.framesEncoded,n.sentKBitrate=(i.bytesSent-v.bytesSent||0)/n.statsInterval*8,h.bitrate=Math.round(1e3*n.sentKBitrate),h.bandwidth=Math.round(h.bitrate/1024),n.encoderOutputFrameRate=1e3*(i.framesEncoded-v.framesEncoded)/n.statsInterval,h.frame_rate_encoded=Math.round(n.encoderOutputFrameRate),n.sentFrameRate=1e3*n.encodedFrameCount/n.statsInterval,h.frame_rate_sent=Math.round(n.sentFrameRate),n.videoLossRate=(i.packetsLost-v.packetsLost)/(i.packetsSent-v.packetsSent),n.videoLossRate=Number.isNaN(n.videoLossRate)?0:n.videoLossRate,h.fraction_lost=n.videoLossRate,n._retransmittedRate=(i.retransmittedPacketsSent-v.retransmittedPacketsSent)/(i.packetsSent-v.packetsSent),this.monitor.rtcMediaStatistics(h,{})),r.video=i,n._fractionLost=Math.max(n._fractionLost,n.videoLossRate),e.abrupt("return",this.filterIllegal(n));case 25:case"end":return e.stop()}}),e,this)}))),function(e,r){return t.apply(this,arguments)})}]),i}(gz),bz=function(e){f(a,e);var t,r,n,i=g(a);function a(e){var t;return c(this,a),h(m(t=i.call(this,e)),"_audioStallCount",void 0),h(m(t),"_setAudioStallCount",void 0),h(m(t),"_audioStallTimer",void 0),h(m(t),"_audioStallInterval",void 0),h(m(t),"_audioStallRatio",void 0),h(m(t),"_videoInWaiting",void 0),h(m(t),"_context",void 0),t._videoInWaiting=!1,t}return l(a,[{key:"setRemoteStreamStatsEvtInterval",value:(n=u(o().mark((function e(t,r,n,i){var s,c,d,l,h,f,p,v,_,m,y,g,S,b,E=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._timer){e.next=2;break}return e.abrupt("return");case 2:return this.setVar(t,r,n),this._context=i,t.once(sj.ABNORMAL_DISCONNECTION,(function(){E.destroy()})),this._audioStallInterval=a.audioStallInterval||100,this._audioStallRatio=a.audioStallRatio||.6,d={audio:{},video:{}},l=this._stream,h=null===(s=l.audioTrack)||void 0===s?void 0:s.getTrack(),f=null===(c=l.videoTrack)||void 0===c?void 0:c.getTrack(),this.getRemoteVideoStats(f,d),e.next=14,this.getRemoteAudioStats(h,d);case 14:this.delStatsEvtInterval(),p=0,v=0,m=[],y=0,g=lP(),this._setAudioStallCount=function(){if(E._audioStallInterval>0&&void 0!==d.audio.concealedSamples){var e=d.audio.concealedSamples,t=d.audio.totalSamplesReceived;g=lP();var r={isStall:!1,counted:!1,diff:0},n=.5*E._audioStallInterval;E._audioStallCount=u(o().mark((function i(){var a,s,u,c,d,h,f,_,S,b,k,T,I,R,A;return o().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(s=l.hasAudio,u=l.subAudio,s&&u){i.next=7;break}return r.isStall=!1,r.counted=!1,m.push({reason:"hasAudio: ".concat(s,", subAudio: ").concat(u)}),g=lP(),i.abrupt("return",{stall_count:p,stall_duration:v,stall_list:m,stats_count:y});case 7:return c=null===(a=l.audioTrack)||void 0===a?void 0:a.getTrack(),d=Date.now(),i.next=11,E.handler.getStats(c,!0);case 11:if(h=i.sent,f=Date.now(),_=lP(),!((S=_-g)<n)){i.next=18;break}return m.push({diff:S,start:g,end:_,get_stats_cost:f-d,get_stats_start:d,get_stats_end:f,reason:"diff(".concat(S,") < minInterval(").concat(n,")")}),i.abrupt("return",{stall_count:p,stall_duration:v,stall_list:m,stats_count:y});case 18:if(b=h.length,k=h.find((function(e){return"inbound-rtp"===e.type}))){i.next=23;break}return m.push({diff:S,start:g,end:_,get_stats_cost:f-d,get_stats_start:d,get_stats_end:f,reason:b?"no inbound-rtp":"no report"}),i.abrupt("return",{stall_count:p,stall_duration:v,stall_list:m,stats_count:y});case 23:return T=k.concealedSamples,I=k.totalSamplesReceived,A=I-t,(R=T-e)>=0&&A>=0&&R>=E._audioStallRatio*A?(m.push({concealed:R,received:A,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:R,received:A,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=u(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!E._audioStallCount&&E._setAudioStallCount&&E._setAudioStallCount(),!E._audioStallCount){e.next=5;break}return e.next=4,E._audioStallCount();case 4:E._audioStallTimer=setTimeout(_,E._audioStallInterval);case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),clearTimeout(E._audioStallTimer),E._audioStallTimer=setTimeout(_,E._audioStallInterval)}},this._setAudioStallCount(),S=function(){var e=u(o().mark((function e(){var t,r,n,i,a,s;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=null===(t=l.audioTrack)||void 0===t?void 0:t.getTrack(),i=null===(r=l.videoTrack)||void 0===r?void 0:r.getTrack(),e.next=4,E.getRemoteAudioStats(n,d);case 4:return a=e.sent,p=0,v=0,m=[],y=0,e.next=11,E.getRemoteVideoStats(i,d);case 11:return s=e.sent,e.abrupt("return",{audioStats:a,videoStats:s,isScreen:l.isScreen,userId:l.userId});case 13:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),b=function(){var e=u(o().mark((function e(){var t,r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,S();case 2:r=e.sent,null===(t=E.client)||void 0===t||t.emit("onRemoteStreamStats",r),_&&(g=lP(),clearTimeout(E._audioStallTimer),E._audioStallTimer=setTimeout(_,E._audioStallInterval)),E._timer=setTimeout(b,2e3);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),this._timer=setTimeout(b,2e3);case 25:case"end":return e.stop()}}),e,this)}))),function(e,t,r,i){return n.apply(this,arguments)})},{key:"delStatsEvtInterval",value:function(){b(p(a.prototype),"delStatsEvtInterval",this).call(this),clearTimeout(this._audioStallTimer),this._audioStallCount=void 0,this._setAudioStallCount=void 0}},{key:"unsubscribe",value:function(){this.delStatsEvtInterval(),this._videoInWaiting=!1}},{key:"getRemoteAudioStats",value:(r=u(o().mark((function e(t,r){var n,i,a,s,u,c,d,l,h,f,p,v,_,m,y,g,S,b,E=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n={},i={},a=this._stream,s=a.streamId,u=a.userId,c=a.isScreen,d=a.audioMid,l=a.subMediaType,h=a._attributes,f={media_type:"audio",is_screen:!!c,direction:"down",stream_id:s,stream_user_id:u,vid:d,connection_status:navigator.onLine,mute_state:wP(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((p=e.sent).length){e.next=11;break}return e.abrupt("return",n);case 11:if(p.forEach((function(e){var t=e.type,r=e.packetsLost,o=e.packetsReceived,a=e.bytesReceived,u=e.jitterBufferDelay,c=e.jitterBufferEmittedCount,d=e.clockRate,l=e.channels,h=e.totalSamplesReceived,p=e.concealedSamples,v=e.silentConcealedSamples,_=e.concealmentEvents,m=e.totalRoundTripTime,y=e.packetsDiscarded,g=e.state,S=e.currentRoundTripTime,b=e.audioLevel,k=e.totalAudioEnergy,T=e.totalSamplesDuration,I=e.mimeType,R=e.googDecodingNormal,A=e.availableIncomingBitrate,w=e.availableOutgoingBitrate,C=e.bytesSent,O=e.nominated,x=e.id,N=e.writable,D=e.jitter,P=e.candidateType,M=e.ip,L=e.address,U=e.networkType,V=e.port,F=e.protocol,B=e.audioOutputLevel,j=e.requestsReceived,G=e.responsesReceived,H=e.requestsSent,z=e.consentRequestsSent,q=e.responsesSent,K=e.ssrc;e.kind;var X=e.nackCount,W=e.lastPacketReceivedTimestamp,Y=e.concealmentevents,J=e.fecPacketsReceived;if("inbound-rtp"===t)i.packetsLost=r,i.packetsReceived=o,f.packetsReceived=o,f.packetsDiscarded=y,f.nackCount=X,f.lastPacketReceivedTimestamp=W,f.concealmentevents=Y,i.bytesReceived=a,void 0!==u&&(n.jitterBufferDelay=u/c*1e3,f.average_jitter_buffer_delay_ms=n.jitterBufferDelay),void 0!==h&&(i.totalSamplesReceived=h,n.concealedSamples=p,i.concealedSamples=p,i.silentConcealedSamples=v,f.concealedSamples=p,n.concealmentEvents=_,f.totalSamplesReceived=h),void 0!==J&&(f.fec_packets_received=J,i.fecPacketsReceived=J),f.jitter=1e3*D,f.ssrc=K,void 0!==b&&(f.audio_level=b?-10*Math.log10(Math.pow(b,2)):b),void 0!==b&&(f.volume=255*b),void 0!==k&&(f.total_audio_energy=k),void 0!==T&&(f.totalAudioDuration=T);else if("codec"===t)n.recordSampleRate=d,l&&(n.numChannels=l),f.codecName=I;else if("candidate-pair"===t){var Q,Z,$;f.ice_available_incoming_bitrate=A,f.ice_available_outgoing_bitrate=w,f.ice_bytes_received=a,f.ice_bytes_sent=C,f.ice_nominated=+O,f.ice_pair_id=x,f.ice_pair_rtt=S,f.rtt=1e3*S,f.rtt&&null!==(Q=E._context)&&void 0!==Q&&null!==(Z=Q.streamRTT)&&void 0!==Z&&null!==($=Z[s])&&void 0!==$&&$.audio&&(f.total_rtt_ms=f.rtt+E._context.streamRTT[s].audio),f.ice_pair_state=g,f.ice_pair_writable=N,f.recv_ping_requests=j,f.recv_ping_responses=G,f.sent_ping_requests_before_first_response=H,f.sent_ping_requests_total=H+(z||0),f.sent_ping_responses=q,"succeeded"===g&&(n.rtt=1e3*S,n.total_rtt=1e3*m)}else"track"===t&&void 0!==b?(f.audio_level=b?-10*Math.log10(Math.pow(b,2)):b,f.volume=255*b,f.total_audio_energy=k,f.totalAudioDuration=T):"ssrc"===t?(f.decodingNormal=R,f.recvAudioLevel=B):"local-candidate"===t?(f.local_candidate_type=P,f.local_ip=M||L,f.local_network_type=U,f.local_port=V,f.protocol=F):"remote-candidate"===t&&(f.remote_candidate_type=P,f.remote_ip=M||L,f.remote_port=V)})),(v=r.audio).timestamp){e.next=17;break}return i.timestamp=Date.now(),r.audio=i,e.abrupt("return",this.filterIllegal(n));case 17:if(_={},void 0!==i.concealedSamples&&(f.interval_concealed_samples=i.concealedSamples-v.concealedSamples,f.interval_samples_received=i.totalSamplesReceived-v.totalSamplesReceived,f.interval_silent_concealed_samples=i.silentConcealedSamples-v.silentConcealedSamples),!(this._audioStallInterval>0&&void 0!==v.concealedSamples)){e.next=35;break}if(!this._audioStallCount&&this._setAudioStallCount&&this._setAudioStallCount(),clearTimeout(this._audioStallTimer),!this._audioStallCount){e.next=35;break}return e.next=25,this._audioStallCount();case 25:m=e.sent,y=m.stall_count,g=m.stall_duration,S=m.stall_list,b=m.stats_count,_.stall_list=S,_.stats_count=b,f.concealedSamples===f.interval_concealed_samples&&f.totalSamplesReceived===f.interval_samples_received?(f.stall_count=0,f.stall_duration=0):(f.stall_count=y,f.stall_duration=g),n.stallCount=f.stall_count,n.stallDuration=f.stall_duration;case 35:return i.timestamp=Date.now(),n.audioLossRate=(i.packetsLost-v.packetsLost)/(i.packetsReceived-v.packetsReceived+(i.packetsLost-v.packetsLost)),n.audioLossRate=Number.isNaN(n.audioLossRate)?0:n.audioLossRate,f.packetsLost=Math.round(i.packetsLost-v.packetsLost),f.fraction_lost=n.audioLossRate,n.statsInterval=i.timestamp-v.timestamp,f.stats_interval=n.statsInterval,n.receivedKBitrate=(i.bytesReceived-v.bytesReceived||0)/n.statsInterval*8,f.bandwidth=Math.round(1e3*n.receivedKBitrate/1024),void 0!==i.concealedSamples&&(n.receivedSampleRate=1e3*f.interval_samples_received/n.statsInterval),void 0!==i.fecPacketsReceived&&(f.fecBitratebps=(i.fecPacketsReceived-v.fecPacketsReceived||0)/n.statsInterval),r.audio=i,this.monitor.rtcMediaStatistics(f,{},_),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=u(o().mark((function e(t,r){var n,i,a,s,u,c,d,l,h,f,p,v=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n={},i={timestamp:Date.now()},a=this._stream,s=a.streamId,u=a.userId,c=a.isScreen,d=a.subMediaType,l=a._attributes,h={media_type:"video",is_screen:!!c,direction:"down",stream_id:s,stream_user_id:u,vid:this._stream.videoMid,connection_status:navigator.onLine,mute_state:CP(d)?"mute_state_off":"mute_state_on",remote_user_capture_state:l.localvideo?"capture_state_on":"capture_state_off",remote_user_mute_state:l.localvideo&&l.videostream?"mute_state_off":"mute_state_on"},t&&this.handler){e.next=6;break}return e.abrupt("return",n);case 6:return n.isScreen=c,e.next=9,this.handler.getStats(t);case 9:if((f=e.sent).length){e.next=12;break}return e.abrupt("return",n);case 12:if(f.forEach((function(e){var t=e.type,r=e.frameHeight,o=e.frameWidth,a=e.packetsLost,u=e.packetsReceived,c=e.bytesReceived,d=e.framesDecoded,l=e.jitterBufferDelay,f=e.jitterBufferEmittedCount,p=e.mimeType,_=e.firCount,m=e.availableIncomingBitrate,y=e.availableOutgoingBitrate,g=e.bytesSent,S=e.nominated,b=e.id,E=e.currentRoundTripTime,k=e.state,T=e.writable,I=e.candidateType,R=e.ip,A=e.address,w=e.networkType,C=e.port,O=e.nackCount,x=e.pliCount,N=e.protocol,D=e.requestsReceived,P=e.responsesReceived,M=e.requestsSent,L=e.consentRequestsSent,U=e.responsesSent,V=e.ssrc,F=e.jitter,B=e.framesReceived,j=e.keyFramesDecoded,G=e.decoderImplementation,H=e.lastPacketReceivedTimestamp;if("inbound-rtp"===t)i.packetsLost=a,h.packetsLost=a,i.packetsReceived=u,h.packetsReceived=u,i.bytesReceived=c,h.bytes=c,i.framesDecoded=d,void 0!==l&&(i.jitterBufferDelay=l/f*1e3,h.average_jitter_buffer_delay_ms=i.jitterBufferDelay),h.fir_count=_,h.nackCount=O,i.nackCount=O,h.pli_count=x,h.ssrc=V,h.jitter=F,h.framesReceived=B,i.framesReceived=B,h.framesDecoded=d,h.key_frames_decoded=j,h.decoder_name=G,h.last_packet_received_timestamp=H,void 0!==o&&(n.width=o,h.frame_size_width=o,n.height=r,h.frame_size_height=r);else if("track"===t&&void 0!==o)n.width=o,h.frame_size_width=o,n.height=r,h.frame_size_height=r,void 0!==B&&(h.framesReceived=B,i.framesReceived=B);else if("codec"===t)h.codecName=p;else if("candidate-pair"===t){var z,q,K;h.ice_available_incoming_bitrate=m,h.ice_available_outgoing_bitrate=y,h.ice_bytes_received=c,h.ice_bytes_sent=g,h.ice_nominated=+S,h.ice_pair_id=b,h.ice_pair_rtt=E,h.rtt=1e3*E,h.rtt&&null!==(z=v._context)&&void 0!==z&&null!==(q=z.streamRTT)&&void 0!==q&&null!==(K=q[s])&&void 0!==K&&K.video&&(h.total_rtt_ms=h.rtt+v._context.streamRTT[s].video),n.rtt=h.rtt,h.ice_pair_state=k,h.ice_pair_writable=T,h.recv_ping_requests=D,h.recv_ping_responses=P,h.sent_ping_requests_before_first_response=M,h.sent_ping_requests_total=M+(L||0),h.sent_ping_responses=U}else"local-candidate"===t?(h.local_candidate_type=I,h.local_ip=R||A,h.local_network_type=w,h.local_port=C,h.protocol=N):"remote-candidate"===t&&(h.remote_candidate_type=I,h.remote_ip=R||A,h.remote_port=C)})),(p=r.video).timestamp){e.next=17;break}return r.video=i,e.abrupt("return",this.filterIllegal(n));case 17:return n.videoLossRate=(i.packetsLost-p.packetsLost)/(i.packetsReceived-p.packetsReceived+(i.packetsLost-p.packetsLost)),n._retransmittedRate=(i.nackCount-p.nackCount)/(i.packetsReceived-p.packetsReceived+(i.packetsLost-p.packetsLost)),n.videoLossRate=Number.isNaN(n.videoLossRate)?0:n.videoLossRate,h.fraction_lost=n.videoLossRate,n.statsInterval=i.timestamp-p.timestamp,h.stats_interval=n.statsInterval,n.receivedKBitrate=(i.bytesReceived-p.bytesReceived||0)/n.statsInterval*8,h.bitrate=Math.round(1e3*n.receivedKBitrate),h.bandwidth=Math.round(h.bitrate/1024),n.decoderOutputFrameRate=1e3*(i.framesDecoded-p.framesDecoded)/n.statsInterval,n.receivedFrameRate=1e3*(i.framesReceived-p.framesReceived)/n.statsInterval,h.frame_rate_decoded=Math.round(n.decoderOutputFrameRate),h.frame_rate_received=h.frame_rate_decoded,r.video=i,this.processStall(this._stream,h,n,c),this.monitor.rtcMediaStatistics(h,{}),e.abrupt("return",this.filterIllegal(n));case 34:case"end":return e.stop()}}),e,this)}))),function(e,r){return t.apply(this,arguments)})},{key:"processStall",value:function(e,t,r,n){var i,o=0,a=0,s=0;if(e.recordedVideoFrames&&this.player&&null!==(i=this.player)&&void 0!==i&&i.played){e.recordedVideoFrames.forEach((function(e){e.isStall&&(o+=e.stallCount,a+=e.stallDuration),s=e.playTime})),e.recordedVideoFrames.length||(a=2e3,o=this._videoInWaiting?0:1,this._videoInWaiting=!0);var u=e.recordedVideoFrames.pop();u&&(u.isStall?this._videoInWaiting=!0:this._videoInWaiting=!1),e.recordedVideoFrames=[]}t.stall_count=o,n?(t.stuck_length=a,t.stall_duration=void 0):(t.stall_duration=a,t.stuck_length=void 0),t.play_time=s,r.stallCount=o,r.stallDuration=a}},{key:"destroy",value:function(){b(p(a.prototype),"destroy",this).call(this),this.delStatsEvtInterval(),this._videoInWaiting=!1}}],[{key:"audioStallConfig",set:function(e){a.audioStallInterval=((null==e?void 0:e.audio_stall_interval)||200)/2,a.audioStallRatio=null==e?void 0:e.audio_stall_ratio}}]),a}(gz);h(bz,"audioStallInterval",void 0),h(bz,"audioStallRatio",void 0);var Ez,kz,Tz,Iz=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}(Iz||{}),Rz=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}(Rz||{}),Az=function(e){return e[e.PUB=0]="PUB",e[e.UNPUB=1]="UNPUB",e}(Az||{}),wz=function(e){return e[e.SUB=0]="SUB",e[e.UNSUB=1]="UNSUB",e}(wz||{}),Cz=new LL("Stream",0),Oz=function(e){return e[e.INIT=0]="INIT",e[e.SUB_ING=1]="SUB_ING",e[e.SUB_ED=2]="SUB_ED",e}(Oz||{}),xz=function(){function e(){c(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",[tj]),h(this,"subVideoDescriptions",[]),h(this,"enableSimulcast",!1),h(this,"observer",void 0),h(this,"statsReport",void 0),h(this,"prevScaleResolutionDownBy",1),h(this,"pubAudio",!1),h(this,"pubVideo",!1),h(this,"pubAttributes",void 0),this.stream=new MediaStream,this.videoInputConfig={width:640,height:360,frameRate:30},this.pubAttributes={localaudio:!1,localvideo:!1,videostream:!1,audiostream:!1,extvideo:!1,extaudio:!1},this.statsReport=new Sz(this)}return l(e,[{key:"audioHasCapture",get:function(){return this.pubAttributes.localaudio}},{key:"audioHasPublish",get:function(){return this.pubAttributes.audiostream}},{key:"videoHasCapture",get:function(){return this.pubAttributes.localvideo}},{key:"videoHasPublish",get:function(){return this.pubAttributes.videostream}},{key:"hasPublished",get:function(){return this.videoTransceiver&&this.audioTransceiver}},{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(Uj()){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=yz.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 Cz.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 Cz.print("no sender found when trying to bind encodedTransform")}},{key:"clean",value:function(){var e;this.audioMid=void 0,this.videoMid=void 0,this.videoTransceiver=void 0,this.audioTransceiver=void 0,null===(e=this.observer)||void 0===e||e.reset(),this.statsReport.destroy(),this.prevScaleResolutionDownBy=1,this.subVideoDescriptions=[]}},{key:"switchTrackEnableState",value:function(e,t){var r,n;"audio"===e?n=this.audioTrack:"video"===e&&(n=this.videoTrack);var i=null===(r=n)||void 0===r?void 0:r.getTrack();return!(!i||(null==i?void 0:i.enabled)===t)&&(i.enabled=t,!0)}}]),e}(),Nz=function(e){f(r,e);var t=g(r);function r(e,n,i,o){var a,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:X.LOW;return c(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),"autosubAudioMid",void 0),h(m(a),"autosubVideoMid",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),"_workaround_1_",void 0),h(m(a),"paused",void 0),h(m(a),"originalMediaType",void 0),h(m(a),"originalStreamIndex",0),a.userPriority=s,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=cz.NONE,a.subLayer={spatialLayer:0,spatialSubLayer:-1},a.streamState=0,a.statsReport=new bz(m(a)),a}return l(r,[{key:"audioHasCapture",get:function(){return this._attributes.localaudio}},{key:"audioHasPublish",get:function(){return this._attributes.audiostream}},{key:"videoHasCapture",get:function(){return this._attributes.localvideo}},{key:"videoHasPublish",get:function(){return this._attributes.videostream}},{key:"sequenceId",get:function(){return this._sequenceId||-1},set:function(e){"number"==typeof e&&(this._sequenceId=e)}},{key:"hasSubscribed",get:function(){return 2===this.streamState}},{key:"attributes",get:function(){return this._attributes},set:function(e){this.hasVideo=e.localvideo&&e.videostream,this.hasAudio=e.localaudio&&e.audiostream,this._attributes=e}},{key:"initVideoEncodedTransform",value:function(){var e=this;if(this.videoTransceiver&&this.videoTransceiver.receiver){var t=this.videoTransceiver.receiver.createEncodedStreams(),r=t.readable,n=t.writable;r.pipeThrough(new TransformStream({transform:function(t,r){dz.getNalunits(new lz(t.data)).forEach((function(t){if(t.sei){var r=yz.decodeSeiBody(t.body);r&&r.type!==hz.internal&&e.safeEmit("onSEIMessage",r.payload)}})),r.enqueue(t)}})).pipeTo(n)}else Cz.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 Cz.print("no receiver found when trying to bind encodedTransform")}},{key:"ontrack",value:function(e){var t,r;if((null===(t=e.streams)||void 0===t||null===(r=t[0])||void 0===r?void 0:r.id)===this.streamId){var n,i=e.track;"video"===(null==i?void 0:i.kind)?this._setVideoTrack(i):"audio"===(null===(n=e.track)||void 0===n?void 0:n.kind)&&this._setAudioTrack(i),this._setStream(e.streams[0])}this.safeEmit("ontrack",e)}},{key:"clean",value:function(){var e;Cz.print("clean","exec stream.clean ".concat(this.streamId," ").concat(this.userId)),this.subAudio=!1,this.subVideo=!1,this.audioMid=void 0,this.videoMid=void 0,this.sequenceId=0,this.videoTrack=void 0,this.audioTrack=void 0,this.stream=void 0,this.videoTransceiver=void 0,this.audioTransceiver=void 0,this.recordedVideoFrames=void 0,this.paused=!1,this._workaround_1_=!1,null===(e=this.observer)||void 0===e||e.reset(),this.statsReport.destroy()}},{key:"resetHasSubscribed",value:function(){this.streamState=0}},{key:"setRemoteUserPriority",value:function(e){this.userPriority=e}},{key:"getStreamPriority",value:function(){var e=this.isScreen?20:this.hasAudio||this.hasVideo?this.attributes.videoDescriptions.length>1?10-this.subLayer.spatialLayer:9:0;return 1e4*this.userPriority+100*e}},{key:"getSubscribeFallbackParams",value:function(e){if(e!==K.DISABLE&&this.subVideo){if(this.attributes.videoDescriptions.length-1>this.subLayer.spatialLayer)return[this.originalMediaType,wz.SUB,this._getSubLayerBySpatialLayer(this.subLayer.spatialLayer+1)];if(e===K.AUDIO_ONLY)return[V.VIDEO,wz.UNSUB]}return null}},{key:"getSubscribeRecoverParams",value:function(){if(this.originalMediaType&&CP(this.originalMediaType)){if(!1===this.subVideo)return[this.originalMediaType,wz.SUB,this.subLayer];if("number"==typeof this.originalStreamIndex&&this.subLayer.spatialLayer>this.originalStreamIndex)return[this.originalMediaType,wz.SUB,this._getSubLayerBySpatialLayer(this.subLayer.spatialLayer-1)]}return null}},{key:"_setStream",value:function(e){var t=this;this.stream=e,e.onaddtrack=function(e){"video"===e.track.kind?t._setVideoTrack(e.track):"audio"===e.track.kind&&t._setAudioTrack(e.track)}}},{key:"_setAudioTrack",value:function(e){var t,r;(null===(t=this.audioTrack)||void 0===t||null===(r=t.getTrack())||void 0===r?void 0:r.id)!==(null==e?void 0:e.id)&&(this.audioTrack=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:dP();return new MH(e,t)}(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]:dP();return new PH(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,u=i.find((function(e){return e.width===a&&e.height===s}));return{spatialLayer:e,spatialSubLayer:(null==u?void 0:u.sub_index)||-1}}}]),r}(VL),Dz=new LL("queue",4),Pz=function(e){return e[e.ADD=0]="ADD",e[e.CLOSE=1]="CLOSE",e}(Pz||{}),Mz=function(e){return e.publish="publish",e.unpublish="unpublish",e.subscribe="subscribe",e.unsubscribe="unsubscribe",e.pushtrack="pushtrack",e.removetrack="removetrack",e}(Mz||{}),Lz=(h(Ez={},"publish","unpublish"),h(Ez,"subscribe","unsubscribe"),h(Ez,"pushtrack","removetrack"),Ez),Uz=(h(kz={},"publish",0),h(kz,"subscribe",0),h(kz,"pushtrack",0),h(kz,"unpublish",1),h(kz,"unsubscribe",1),h(kz,"removetrack",1),kz),Vz=function(e){f(r,e);var t=g(r);function r(){var e;return c(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!==Lz[t.action]||(r=t.streamId,Dz.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;for(var e=Uz[this._queue[0].action],t=1;t<this._queue.length;t++)if(Uz[this._queue[t].action]!==e)return{sdpStrategy:e,items:this._queue.splice(0,t)};return{sdpStrategy:e,items:this._queue.splice(0,this._queue.length)}}}]),r}(NL),Fz=new LL("ChromeHandler",3),Bz=Uj(),jz=function(e){f(T,e);var r,n,a,s,d,v,_,y,S,k=g(T);function T(e,t){var r;return c(this,T),h(m(r=k.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",0),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),"_msidIndexMap",{}),h(m(r),"_mlinesCache",{}),r._sdpQueue=new Vz,r._sdpQueue.on("start",(function(){r._queueBusy||"stable"!==r._peerConnection.signalingState||(Fz.print("dequeue start"),r.dequeue())})),r}return l(T,[{key:"connect",value:(S=u(o().mark((function e(t){var r,n,a,s,u,c,d,l,h=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Fz.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,xG(t);case 4:return this._answerIce=e.sent,this.connection_id=this._answerIce.iceUfrag||"",this.ms_addr=JSON.stringify((null==t||null===(a=t.publicIPs)||void 0===a?void 0:a.map((function(e){return{ip:e.ip,tcp:e.tcpPorts,udp:e.udpPorts}})))||[]),e.next=9,this._peerConnection.createOffer();case 9:return s=e.sent,u=Gj.parse(s.sdp),c=E(u.media,1),d=c[0],this._offerIce.fingerprint=u.fingerprint||d.fingerprint,delete u.media,this._offerSession=i({},u),this._answerSession=i({},u),this._answerSession.fingerprint&&(this._answerSession.fingerprint=this._answerIce.fingerprint),l=this._mid++,this._offerMlines=[i(i(i({},d),this._offerIce),{},{mid:"".concat(l)})],this._answerMlines=[i(i(i({},d),this._answerIce),{},{sctpmap:{sctpmapNumber:5e3,app:"webrtc-datachannel",maxMessageSize:262144},mid:"".concat(l)})],this.setDescription(),e.next=23,new Promise((function(e,t){h._dataChannel.onopen=function(){Fz.print("connect","dataChannel open"),PB("es.dc.open","",0,!1,h.connection_id,{ms_addr:h.ms_addr}),e("")},h._dataChannel.onerror=function(e){IB.rtcSignalingMsgError(e.error.sdpLineNumber,e.error.errorDetail,QF.INVALID_DATA),PB("es.dc.error","",0,!1,h.connection_id,{ms_addr:h.ms_addr}),t(e)},h._dataChannel.onclose=function(e){PB("es.dc.close","",0,!1,h.connection_id,{ms_addr:h.ms_addr}),t(e)},h._peerConnection.addEventListener("connectionstatechange",(function(e){"failed"!==h._peerConnection.iceConnectionState&&"closed"!==h._peerConnection.iceConnectionState&&"failed"!==h._peerConnection.connectionState||t(e)}))}));case 23:return Fz.print("connect","dataChannel establish success"),e.abrupt("return",this._dataChannel);case 25:case"end":return e.stop()}}),e,this)}))),function(e){return S.apply(this,arguments)})},{key:"disconnect",value:function(){this._peerConnection.close(),this._dataChannel.close(),this._peerConnection.ontrack=null}},{key:"destroy",value:function(){b(p(T.prototype),"destroy",this).call(this),this._mlinesCache={}}},{key:"publish",value:(y=u(o().mark((function e(t){var r,n,a,s,u,c,d,l,h,f,v,_,m,y,g,S,k,I,R,A,w,C,O,x,N,D,P;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return u=t.stream,c=t.enableSimulcast,d=b(p(T.prototype),"internalPublish",this).call(this,t),l=d.videoDescriptions,h=d.subVideoDescriptions,f=d.transceiverInit,v="".concat(this._mid++),_="".concat(this._mid++),m=i(i(i({},this._aSendonlyOfferTpl),this._offerIce),{},{mid:v,msid:"".concat(u.id," ").concat(u.id,"-audio"),ssrcs:AG(u,"audio")}),y=i(i(i({},this._vSendonlyOfferTpl),this._offerIce),{},{mid:_,msid:"".concat(u.id," ").concat(u.id,"-video")}),c?(Fz.print("subVideoDesc","desc: %o ",h),delete y.ssrcGroups,delete y.ssrcs,g=[],y.rids=l.map((function(e){var t=e.rid;return g.unshift(t),{id:t,direction:"send"}})),y.simulcast={dir1:"send",list1:g.join(";")}):(S=wG(u,"video"),k=S.ssrcs,I=S.ssrcGroups,y.ssrcs=k,y.ssrcGroups=I),gP&&SP&&Array.isArray(y.ext)&&(y.ext=y.ext.filter((function(e){var t;return!(null!=e&&null!==(t=e.uri)&&void 0!==t&&t.includes("video-orientation"))}))),null!==(r=this._context)&&void 0!==r&&null!==(n=r.serverConfig)&&void 0!==n&&n.audioRed&&Array.isArray(m.rtp)&&-1!==(R=m.rtp.findIndex((function(e){return"red"===e.codec})))&&(A=m.rtp.splice(R,1),w=E(A,1),C=w[0],m.rtp.unshift(C)),null!==(a=this._context)&&void 0!==a&&null!==(s=a.serverConfig)&&void 0!==s&&s.videoCodec&&MG(y,null===(O=this._context)||void 0===O||null===(x=O.serverConfig)||void 0===x?void 0:x.videoCodec),(N=null==m?void 0:m.rtp.find((function(e){return"opus"===e.codec})))&&m.fmtp&&(P=m.fmtp.find((function(e){return e.payload===N.payload})))&&null!==(D=this._context)&&void 0!==D&&D.audioProfileManager&&(P.config+=this._context.audioProfileManager.getOpusConfigStr()),this.addBitrateLimit(y,t.videoEncodeConfig[0].maxKbps),this._mlinesCache[t.stream.id]=[m,y],e.abrupt("return",{partialSdp:OG(this._offerSession,m,y),audioMid:v,videoMid:_,type:"incroffer",semantics:"unified-plan",videoDescriptions:l,subVideoDescriptions:h,transceiverInit:f});case 15:case"end":return e.stop()}}),e,this)}))),function(e){return y.apply(this,arguments)})},{key:"subscribe",value:(_=u(o().mark((function e(t,r){var n,a,s,u,c,d,l,h,f,p;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Fz.print("subscribe","mids: ",r),n="incroffer",a="unified-plan",this._aRecvonlyOfferTpl&&this._vRecvonlyOfferTpl){e.next=9;break}return e.next=6,this._genOfferSdp();case 6:return s=e.sent,e.next=9,this.createAVMlineOfferTpl(s);case 9:if(!this._mlinesCache[t.streamId]){e.next=14;break}return u=E(this._mlinesCache[t.streamId],2),c=u[0],d=u[1],c.mid=t.audioMid,d.mid=t.videoMid,e.abrupt("return",{partialSdp:OG(this._offerSession,c,d),audioMid:c.mid,videoMid:d.mid,type:n,semantics:a});case 14:return l="".concat(this._mid++),h="".concat(this._mid++),f=i(i(i({},this._aRecvonlyOfferTpl),this._offerIce),{},{mid:l}),p=i(i(i({},this._vRecvonlyOfferTpl),this._offerIce),{},{mid:h}),this._mlinesCache[t.streamId]=[f,p],e.abrupt("return",{partialSdp:OG(this._offerSession,f,p),audioMid:l,videoMid:h,type:n,semantics:a,transceiverInit:{aTrack:"audio",vTrack:"video",audioTransceiverInit:{direction:"recvonly"},videoTransceiverInit:{direction:"recvonly"}}});case 20:case"end":return e.stop()}}),e,this)}))),function(e,t){return _.apply(this,arguments)})},{key:"handleAck",value:(v=u(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Fz.print("handleAck()","item: %o",t),e.abrupt("return",this._sdpQueue.enqueue(t));case 2:case"end":return e.stop()}}),e,this)}))),function(e){return v.apply(this,arguments)})},{key:"dequeue",value:(d=u(o().mark((function e(){var r,n,a,s,u,c,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(),Fz.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=[],u=[],c=[],a!==Pz.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=17;break}return a=p.value,e.delegateYield(o().mark((function e(){var t,n,d,l,h,f,p,v,m,y,g,S,b,k,T,I,R,A,w,C,O;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=a.action,n=a.transceiverInit,d=a.signalingAck,l=a.stream,h=l instanceof Nz,a.onSuccess&&c.push(a.onSuccess),!(h&&(null==d?void 0:d.sequenceId)<l.sequenceId)){e.next=5;break}return e.abrupt("return","break");case 5:if(f={},p={},v=Gj.parse(d.sdp),Array.isArray(v.media)&&(m="",v.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(e){"audio"===(e=i(i({},e),r)).type?(f=e,Fz.print("audioMsid",e.msid),e.msid&&(m=e.msid.replace("audio","video"))):(p=e,Fz.print("videoMsid",m),m&&(p.msid=m,m=""))}))),y=l.streamId,t===Mz.publish&&(y=null===(g=l.stream)||void 0===g?void 0:g.id),_._mlinesCache[y]){e.next=13;break}return e.abrupt("return","break");case 13:if(S=E(_._mlinesCache[y],2),b=S[0],k=S[1],!n){e.next=31;break}l.audioTransceiver=_._peerConnection.addTransceiver(n.aTrack,n.audioTransceiverInit),l.videoTransceiver=_._peerConnection.addTransceiver(n.vTrack,n.videoTransceiverInit),(T=_._inactiveMlineIndex.shift())||(T=_._offerMlines.length),_._offerMlines[T]=i(i({},b),{},{mid:f.mid}),_._answerMlines[T]=f,(I=_._inactiveMlineIndex.shift())||(I=_._offerMlines.length),_._offerMlines[I]=i(i({},k),{},{mid:p.mid}),_._answerMlines[I]=p,_._msidIndexMap[l.streamId]=[T,I],Bz&&(l.initAudioEncodedTransform(),l.initVideoEncodedTransform()),s.push(l.streamId||""),u.push(h?l.userId:"local"),e.next=49;break;case 31:if(!h){e.next=49;break}if(R=_._msidIndexMap[l.streamId]||[],A=E(R,2),w=A[0],C=A[1],!w||!C){e.next=48;break}if((null===(O=_._offerMlines[w])||void 0===O?void 0:O.mid)===f.mid){e.next=44;break}return _._offerMlines[w]=CG(_._offerMlines[w]),_._offerMlines[C]=CG(_._offerMlines[C]),_._answerMlines[w]=CG(_._answerMlines[w]),_._answerMlines[C]=CG(_._answerMlines[C]),e.next=41,_.setDescription();case 41:_._offerMlines[w]=i(i({},_._aRecvonlyOfferTpl),{},{mid:f.mid}),_._offerMlines[C]=i(i({},_._vRecvonlyOfferTpl),{},{mid:p.mid}),Fz.print("enqueue","hack: %o",l.streamId);case 44:_._answerMlines[w]=f,_._answerMlines[C]=p,e.next=49;break;case 48:Fz.print("dequeue","pushtrack before subscribe: %o",l.userId);case 49:h&&(l.sequenceId=null==d?void 0:d.sequenceId);case 50:case"end":return e.stop()}}),e)}))(),"t0",11);case 11:if("break"!==e.t0){e.next=14;break}return e.abrupt("break",17);case 14:d=!1,e.next=6;break;case 17:e.next=23;break;case 19:e.prev=19,e.t1=e.catch(4),l=!0,h=e.t1;case 23:if(e.prev=23,e.prev=24,!d||null==f.return){e.next=28;break}return e.next=28,f.return();case 28:if(e.prev=28,!l){e.next=31;break}throw h;case 31:return e.finish(28);case 32:return e.finish(23);case 33:case"end":return e.stop()}}),e,null,[[4,19,23,33],[24,,28,32]])}))(),"t0",13);case 13:e.next=20;break;case 15:v={},n.forEach((function(e){var t,r,n=e.audioMid,i=e.videoMid,o=e.stream;v[n]=n,v[i]=i,delete _._msidIndexMap[null===(t=e.stream)||void 0===t?void 0:t.streamId],o instanceof xz?delete _._mlinesCache[null==o||null===(r=o.stream)||void 0===r?void 0:r.id]:delete _._mlinesCache[null==o?void 0:o.streamId]})),this._offerMlines=this._offerMlines.map((function(e,t){return v[e.mid]&&(e=CG(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=CG(e)),e}));case 20:return e.next=22,this.setDescription(s.length?{streamId:s.join(","),streamUserId:u.join(",")}:void 0);case 22:try{c.forEach((function(e){return e()}))}catch(Z$){}Fz.print("dequeue","loop"),e.next=29;break;case 26:e.prev=26,e.t1=e.catch(6),Fz.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 d.apply(this,arguments)})},{key:"setDescription",value:(s=u(o().mark((function e(t){var r,n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Fz.print("setDescription","_offerMlines: %o, _answerMlines: %o",this._offerMlines,this._answerMlines),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=lP(),t&&IB.rtcBeginCreateOffer("local"===t.streamUserId?$F.UP:$F.DOWN,t.streamId,t.streamUserId),e.next=10,this._peerConnection.createOffer();case 10:return t&&IB.rtcCreateOffer(0,"local"===t.streamUserId?eB.UP:eB.DOWN,t.streamId,t.streamUserId,lP()-n),e.next=13,this.setLocalDescription(Gj.write(this._offerSession),t);case 13:return e.next=15,this.setRemoteDescription(Gj.write(this._answerSession),t);case 15:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"getDefaultSdp",value:(a=u(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,this._genOfferSdp();case 2:return t=e.sent,this.createAVMlineOfferTpl(t),r=Gj.parse(t),n=[],r.media=r.media.filter((function(e){return"recvonly"===e.direction&&(n.push(e.mid+""),!0)})),r.groups=[{mids:n.join(" "),type:"BUNDLE"}],e.abrupt("return",{sdp:Gj.write(r),semantics:"unified-plan",type:"offer"});case 9:case"end":return e.stop()}}),e,this)}))),function(){return a.apply(this,arguments)})},{key:"rollback",value:(n=u(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 n.apply(this,arguments)})},{key:"createAVMlineOfferTpl",value:function(e){var t=this;Gj.parse(e).media.forEach((function(e){"audio"===e.type?"sendonly"===e.direction?t._aSendonlyOfferTpl=e:t._aRecvonlyOfferTpl=e:"video"===e.type&&("sendonly"===e.direction?t._vSendonlyOfferTpl=e:t._vRecvonlyOfferTpl=e)}))}},{key:"_genOfferSdp",value:(r=u(o().mark((function e(){var t,r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,IP(!0);case 3:if(t=e.sent){e.next=6;break}throw"pc.createOffer() return empty.";case 6:e.next=12;break;case 8:throw e.prev=8,e.t0=e.catch(0),r="Get offer Error. ".concat(e.t0.message|e.t0),new ZN(JN.NOT_SUPPORTED,r);case 12:return e.abrupt("return",t);case 13:case"end":return e.stop()}}),e,null,[[0,8]])}))),function(){return r.apply(this,arguments)})}]),T}(jj),Gz=new LL("FirefoxHandler",3),Hz=function(e){f(S,e);var t,r,n,a,s,d,v,_,y=g(S);function S(){var e;c(this,S);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return h(m(e=y.call.apply(y,[this].concat(r))),"name","firefox"),e}return l(S,[{key:"connect",value:(_=u(o().mark((function e(t){var r,n,a,s,u,c,d,l,h=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Gz.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,xG(t);case 4:return this._answerIce=e.sent,this.connection_id=this._answerIce.iceUfrag||"",this.ms_addr=JSON.stringify((null==t||null===(a=t.publicIPs)||void 0===a?void 0:a.map((function(e){return{ip:e.ip,tcp:e.tcpPorts,udp:e.udpPorts}})))||[]),this._peerConnection.addTransceiver("audio",{direction:"recvonly"}),this._peerConnection.addTransceiver("video",{direction:"recvonly"}),e.next=11,this._peerConnection.createOffer();case 11:return s=e.sent,u=Gj.parse(s.sdp),c=E(u.media,1),d=c[0],this._offerIce.fingerprint=u.fingerprint||d.fingerprint,u.media=u.media.map((function(e){return i(i({},e),h._offerIce)})),(l=i({},u)).fingerprint=this._answerIce.fingerprint,l.media=l.media.map((function(e){return delete(e=i(i({},e),h._answerIce)).bundleOnly,e.port=9,"application"===e.type?e.sctpmap={sctpmapNumber:5e3,app:"webrtc-datachannel",maxMessageSize:262144}:e.direction="sendonly",e})),e.next=21,this.setLocalDescription(Gj.write(u));case 21:return e.next=23,this.setRemoteDescription(Gj.write(l));case 23:return e.next=25,new Promise((function(e,t){h._dataChannel.onopen=function(){Gz.print("connect","dataChannel open"),PB("es.dc.open","",0,!1,h.connection_id,{ms_addr:h.ms_addr}),e("")},h._dataChannel.onerror=function(e){IB.rtcSignalingMsgError(e.error.sdpLineNumber,e.error.errorDetail,QF.INVALID_DATA),PB("es.dc.error","",0,!1,h.connection_id,{ms_addr:h.ms_addr}),t(e)},h._dataChannel.onclose=function(e){PB("es.dc.close","",0,!1,h.connection_id,{ms_addr:h.ms_addr}),t(e)},h._peerConnection.addEventListener("connectionstatechange",(function(e){"failed"!==h._peerConnection.iceConnectionState&&"closed"!==h._peerConnection.iceConnectionState&&"failed"!==h._peerConnection.connectionState||t(e)}))}));case 25:return Gz.print("connect","dataChannel establish success"),e.abrupt("return",this._dataChannel);case 27:case"end":return e.stop()}}),e,this)}))),function(e){return _.apply(this,arguments)})},{key:"publish",value:(v=u(o().mark((function e(t){var r,n,a,s,u,c,d,l,h,f,v,_,m,y=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=b(p(S.prototype),"internalPublish",this).call(this,t),s=a.videoDescriptions,u=a.subVideoDescriptions,c=a.transceiverInit,t.audioTransceiver=this._peerConnection.addTransceiver(c.aTrack,c.audioTransceiverInit),t.videoTransceiver=this._peerConnection.addTransceiver(c.vTrack,c.videoTransceiverInit),d=lP(),IB.rtcBeginCreateOffer($F.UP,"",""),e.next=7,this._peerConnection.createOffer();case 7:return l=e.sent,IB.rtcCreateOffer(0,eB.UP,"","",lP()-d),(h=Gj.parse(l.sdp)).media=null===(r=h.media)||void 0===r?void 0:r.map((function(e){return i(i({},e),y._offerIce)})),e.next=13,this.setLocalDescription(Gj.write(h));case 13:return f=t.audioTransceiver.mid,v=t.videoTransceiver.mid,_=null,m=null,h.media=null===(n=h.media)||void 0===n?void 0:n.map((function(e){if("".concat(e.mid)===f){var t,r=null===(t=_=e)||void 0===t?void 0:t.rtp.find((function(e){return"opus"===e.codec}));if(r&&_.fmtp){var n,i=_.fmtp.find((function(e){return e.payload===r.payload}));i&&null!==(n=y._context)&&void 0!==n&&n.audioProfileManager&&(i.config+=y._context.audioProfileManager.getOpusConfigStr())}}else if("".concat(e.mid)===v){var o,a,s,u;null!==(o=y._context)&&void 0!==o&&null!==(a=o.serverConfig)&&void 0!==a&&a.videoCodec&&MG(e,null===(s=y._context)||void 0===s||null===(u=s.serverConfig)||void 0===u?void 0:u.videoCodec),m=e}return e})),this.addBitrateLimit(m,t.videoEncodeConfig[0].maxKbps),e.next=21,this.setLocalDescription(Gj.write(h));case 21:return e.abrupt("return",{partialSdp:OG(h,_,m),audioMid:f,videoMid:v,type:"incroffer",semantics:"unified-plan",videoDescriptions:s,subVideoDescriptions:u,transceiverInit:c});case 22:case"end":return e.stop()}}),e,this)}))),function(e){return v.apply(this,arguments)})},{key:"subscribe",value:(d=u(o().mark((function e(t){var r,n,a,s,u,c,d,l,h,f,p,v,_,m,y=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Gz.print("subscribe()"),!t.audioMid||!t.videoMid){e.next=11;break}return u=Gj.parse(null===(a=this._peerConnection.localDescription)||void 0===a?void 0:a.sdp),c=null,d=null,u.media.forEach((function(e){"".concat(e.mid)===t.audioMid?(c=e,t.autosubAudioMid&&(c.mid=t.autosubAudioMid)):"".concat(e.mid)===t.videoMid&&(d=e,t.autosubVideoMid&&(d.mid=t.autosubVideoMid))})),e.next=8,this._peerConnection.createOffer();case 8:return e.next=10,this.setLocalDescription(null===(s=this._peerConnection.localDescription)||void 0===s?void 0:s.sdp,{streamId:t.streamId||"",streamUserId:t.userId});case 10:return e.abrupt("return",{partialSdp:OG(u,c,d),audioMid:t.audioMid,videoMid:t.videoMid,autosubAudioMid:t.autosubAudioMid,autosubVideoMid:t.autosubVideoMid,type:"incroffer",semantics:"unified-plan"});case 11:return t.audioTransceiver=this._peerConnection.addTransceiver("audio",{direction:"recvonly"}),t.videoTransceiver=this._peerConnection.addTransceiver("video",{direction:"recvonly"}),l=lP(),IB.rtcBeginCreateOffer($F.UP,t.streamId,t.userId),e.next=17,this._peerConnection.createOffer();case 17:return h=e.sent,IB.rtcCreateOffer(0,eB.UP,t.streamId,t.userId,lP()-l),(f=Gj.parse(h.sdp)).media=null===(r=f.media)||void 0===r?void 0:r.map((function(e){return i(i({},e),y._offerIce)})),e.next=23,this.setLocalDescription(Gj.write(f),{streamId:t.streamId||"",streamUserId:t.userId});case 23:return p=t.audioTransceiver.mid,v=t.videoTransceiver.mid,_=null,m=null,null===(n=f.media)||void 0===n||n.forEach((function(e){"".concat(e.mid)===p?_=e:"".concat(e.mid)===v&&(m=e)})),e.abrupt("return",{partialSdp:OG(f,_,m),audioMid:p,videoMid:v,type:"incroffer",semantics:"unified-plan"});case 29:case"end":return e.stop()}}),e,this)}))),function(e){return d.apply(this,arguments)})},{key:"handleAck",value:(s=u(o().mark((function e(t){var r,n,a,s,u,c,d,l,h,f=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=t.signalingAck,s=t.stream,(u=t.action)!==Mz.unpublish&&u!==Mz.unsubscribe&&u!==Mz.removetrack){e.next=5;break}return e.next=4,this.close(s);case 4:return e.abrupt("return",s.streamId||"");case 5:return c={},(d=Gj.parse(null===(r=this._peerConnection.remoteDescription)||void 0===r?void 0:r.sdp)).media.forEach((function(e){void 0!==e.mid&&(c[e.mid]=e)})),Gj.parse(null==a?void 0:a.sdp).media.forEach((function(e){"audio"===(e=i(i({},e),f._answerIce)).type&&(s.audioMid?(e.mid=s.audioMid,c[s.audioMid]=e):c[e.mid]=e),"video"===e.type&&(s.videoMid?(e.mid=s.videoMid,c[s.videoMid]=e):c[e.mid]=e)})),l=Gj.parse(null===(n=this._peerConnection.localDescription)||void 0===n?void 0:n.sdp),h=l.media.map((function(e){var t=c[e.mid];return"inactive"===e.direction?e:t})),d.groups=l.groups,d.media=h,this.setRemoteDescription(Gj.write(d)),e.abrupt("return","");case 16:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"getDefaultSdp",value:(a=u(o().mark((function e(){var t,r,n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=Gj.parse(null===(t=this._peerConnection.localDescription)||void 0===t?void 0:t.sdp),n=[],r.media=r.media.filter((function(e){return"recvonly"===e.direction&&(n.push(e.mid+""),!0)})),r.groups=[{mids:n.join(" "),type:"BUNDLE"}],e.abrupt("return",{sdp:Gj.write(r),semantics:"unified-plan",type:"offer"});case 5:case"end":return e.stop()}}),e,this)}))),function(){return a.apply(this,arguments)})},{key:"rollback",value:(n=u(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.close(r));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return n.apply(this,arguments)})},{key:"close",value:(r=u(o().mark((function e(t){var r,n,a,s,u,c,d=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Gz.print("close()"),!t.audioTransceiver||!t.videoTransceiver){e.next=19;break}return t.audioTransceiver.stop(),t.videoTransceiver.stop(),n=[],e.next=7,this._peerConnection.createOffer();case 7:return a=e.sent,(s=Gj.parse(null==a?void 0:a.sdp)).media=s.media.map((function(e){return"".concat(e.mid)!==t.audioMid&&"".concat(e.mid)!==t.videoMid||(e=CG(e)),"inactive"!==e.direction&&n.push(e.mid),i(i({},e),d._offerIce)})),u=Gj.parse(null===(r=this._peerConnection.remoteDescription)||void 0===r?void 0:r.sdp),c={},u.media.forEach((function(e){c[e.mid]=e})),u.media=s.media.map((function(e){return"inactive"===e.direction?e:c[e.mid]})),s.groups&&u.groups&&(s.groups[0].mids=n.join(" "),u.groups[0].mids=n.join(" ")),e.next=17,this.setLocalDescription(Gj.write(s));case 17:return e.next=19,this.setRemoteDescription(Gj.write(u));case 19:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"setCurrentDescription",value:(t=u(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)})}]),S}(jj),zz=function(e,t){return yP?new Hz(e,t):new jz(e,t)},qz=new LL("Locker",2),Kz=1,Xz=function(){function e(t){c(this,e),h(this,"lockingPromise",Promise.resolve()),h(this,"locks",0),h(this,"name",""),h(this,"lockId",void 0),this.lockId=Kz++,t&&(this.name=t),qz.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,qz.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,qz.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}(),Wz=(h(Tz={},J.communication,[0]),h(Tz,J.chat,[0]),h(Tz,J.chatRoom,[1,"IES_chatroom"]),h(Tz,J.coHost,[1,"IES_PK"]),h(Tz,J.meeting,[16]),h(Tz,J.classRoom,[0]),Tz),Yz=Object.defineProperty,Jz=Object.getOwnPropertyDescriptor,Qz=function(e,t,r,n){for(var i,o=n>1?void 0:n?Jz(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&&Yz(t,r,o),o},Zz=new LL("MediaServerClient",2),$z=6e4,eq=function(e){return e.DISCONNECTED="disconnected",e.DISCONNECTING="disconnecting",e.CONNECTED="connected",e.CONNECTING="connecting",e}(eq||{}),tq=function(e,t){Zz.print(e,"userId: %o, subAudio: %o, subVideo: %o, paused: %o, audioMid: %o, videoMid: %o, workaround_1_: %o, sequenceId: %o",t.userId,t.subAudio,t.subVideo,t.paused,t.audioMid,t.videoMid,t._workaround_1_,t.sequenceId)},rq=function(e){f(O,e);var t,r,n,a,s,d,p,v,_,y,S,b,k,T,I,R,A,w,C=g(O);function O(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:IB;return c(this,O),h(m(t=C.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",J.communication),h(m(t),"_context",void 0),h(m(t),"_subStreamQueue",{}),t.monitor=r,t._pubSubLock=new Xz("pubSubLock"),t._joinLeaveLock=new Xz("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(O,[{key:"_addHandlerEvents",value:function(){var e,t=this;null===(e=this._handler)||void 0===e||e.once("disconnect",(function(){Zz.print("emit ABNORMAL_DISCONNECTION ice"),t.safeEmit(sj.ABNORMAL_DISCONNECTION)}))}},{key:"_addSignalEventHandler",value:function(){var e,t=this;[oj.ON_ADD_STREAM,oj.ON_REMOVE_STREAM,oj.USER_CONNECTION,oj.USER_DISCONNECTION,oj.ON_UPDATE_STREAM_ATTRIBUTES,oj.ON_UPDATE_ROOM_ATTRIBUTES,oj.ON_PUSH_TRACK,oj.ON_REMOVE_TRACK,oj.NODE_CHANGE,oj.ON_CUSTOM_MESSAGE,oj.USER_MESSAGE_RECEIVED,oj.USER_BINARY_MESSAGE_RECEIVED,oj.POST_PROCESSING_MESSAGE,oj.ON_USER_TOKEN_WILL_EXPIRE,oj.STREAM_CONTROL_MESSAGE,oj.ON_SCENE_CONFIG,oj.ON_UPDATE_USER_ATTRIBUTES,aj.RSCP,aj.RTT,oj.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(){Zz.print("emit ABNORMAL_DISCONNECTION datachannel"),t.safeEmit(sj.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(sj.ON_CONNECTION_STATE_CHANGE,{prev:this._state,next:e}),this._state=e)}},{key:"connect",value:(w=u(o().mark((function e(t){var r,n,i,a,s,u,c,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],PB("es.join.nodeChange",i),e.next=20;break;case 11:return Promise.resolve().then((function(){return l.emit("onGetIceConfigHook")})),this._iceConfigRequestManager=new bj,e.next=15,null===(s=this._iceConfigRequestManager)||void 0===s?void 0:s.getAccessNode(t,r,n,HB.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 PB("es.join.getNodeFailed",""),new ZN(JN.ICE_SERVER_WRONG,"get ICE config failed");case 19:PB("es.join.getNodeSuccess",a);case 20:return this._addHandlerEvents(),Promise.resolve().then((function(){return l.emit("onEstablishConnectionHook")})),e.prev=22,c=!1,d=a.map((function(e){var t=zz(l.monitor,l._context);return t.connect(e).then((function(r){var n;l.emit("onConnectSuccessHook",null===(n=a)||void 0===n?void 0:n.length),c?t.destroy():(c=!0,u=r,l.safeEmit("prevIceNode",e),l._handler=t,wB.setStats({connection_id:t.connection_id}),l.supportConcurrent="chrome"===t.name,l._addHandlerEvents())})).catch((function(e){throw t.destroy(),e}))})),e.next=27,RP(d);case 27:Zz.print("join","establish peerConnection success"),e.next=34;break;case 30:throw e.prev=30,e.t0=e.catch(22),this.connectionState="disconnected",new ZN(JN.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed",e.t0);case 34:if(!u){e.next=40;break}this._dataChannelSignal=new yj(u),this._addSignalEventHandler(),this._dataChannelSignal.sendPingSignaling(),e.next=42;break;case 40:throw this.connectionState="disconnected",new ZN(JN.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed");case 42:case"end":return e.stop()}}),e,this,[[22,30]])}))),function(e){return w.apply(this,arguments)})},{key:"join",value:(A=u(o().mark((function e(t){var r,n,i,a,s,u,c,d,l,h,f,p,v,_,m,y,g,S,b,E,k,T,I=this,R=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=R.length>1&&void 0!==R[1]?R[1]:{},i=R.length>2&&void 0!==R[2]&&R[2],a=R.length>3?R[3]:void 0,Zz.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=pP.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,Mj();case 26:return e.t6=e.sent,e.t7=window.navigator.userAgent,e.t8=WB.VERSION,e.t9=HB.getDeviceId(),e.t10=this._appId,e.t11=this._roomId,e.t12=this._clientId,e.t13=this._businessId,e.t14=this._useCloudProxy,e.t15=Wz[this._roomProfile]?Wz[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},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,v=i?"reconnected":"joinRoom",e.next=44,this._dataChannelSignal.sendSignaling(v,s);case 44:return _=e.sent,Zz.print("join","send join message success"),this._authorization=s.Authorization,this.connectionState="connected",this._context&&(this._context.serverConfig={videoCodec:null===(m=_.config)||void 0===m||null===(y=m.engine_WEB)||void 0===y?void 0:y.video_codec,audioRed:!(null===(g=_.config)||void 0===g||null===(S=g.engine_WEB)||void 0===S||!S.pub_audio_red),muteReplaceUnsub:!(null===(b=_.config)||void 0===b||!b.mute_replace_unsub),simulcastOnDemand:!(!1===(null===(E=_.config)||void 0===E||null===(k=E.engine_VPM)||void 0===k||null===(T=k.ondemand)||void 0===T?void 0:T.enable))}),bz.audioStallConfig=null===(u=_.config)||void 0===u?void 0:u.engine_WEB,null===(c=this._context)||void 0===c||null===(d=c.audioProfileManager)||void 0===d||d.updateEngineBAC(null===(l=_.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=_.config)||void 0===p?void 0:p.engine_ANM),e.abrupt("return",_);case 55:if(e.prev=55,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=60;break}throw new ZN(JN.INVALID_TOKEN,(null===e.t18||void 0===e.t18?void 0:e.t18.message)||"Invalid token");case 60:if(200===(null===e.t18||void 0===e.t18?void 0:e.t18.code)){e.next=62;break}throw new ZN(JN.JOIN_ROOM_FAILED,(null===e.t18||void 0===e.t18?void 0:e.t18.message)||"Join room failed");case 62:case"end":return e.stop()}}),e,this,[[40,55]])}))),function(e){return A.apply(this,arguments)})},{key:"publish",value:(R=u(o().mark((function e(t){var r,n,a,s,u,c,d,l,h,f,p,v,_,m,y,g,S=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Zz.print("publish()","localStream: %o",t),r=t.videoTrack,n=t.audioTrack,a=lP(),s="",u="",e.prev=6,e.next=9,null===(c=this._handler)||void 0===c?void 0:c.publish(t);case 9:if(v=e.sent){e.next=12;break}throw new ZN(JN.ADD_TRANSCEIVER_FAILED,"add transceiver failed");case 12:return s=v.audioMid,u=v.videoMid,t.pubAttributes={localaudio:!!n,localvideo:!!r,videostream:t.pubVideo,audiostream:t.pubAudio,extvideo:!!(r instanceof VH),extaudio:!!(n instanceof FH)},_={attributes:i({videoDescriptions:v.videoDescriptions},t.pubAttributes),audio:!0,video:!0,screen:t.isScreen,audioMid:s,videoMid:u,sdpInfo:{msid:t.stream.id,type:v.type,sdp:v.partialSdp,semantics:v.semantics}},t.enableSimulcast&&null!==(d=this._context)&&void 0!==d&&null!==(l=d.serverConfig)&&void 0!==l&&l.simulcastOnDemand&&(_.attributes.subVideoDescriptions=v.subVideoDescriptions),e.next=19,null===(h=this._dataChannelSignal)||void 0===h?void 0:h.sendSignaling("publish",_);case 19:if(200===(null==(m=e.sent)?void 0:m.code)){e.next=22;break}throw new ZN(JN.PUBLISH_FAILED,(null==m?void 0:m.message)||"publish failed");case 22:return IB.rtcRecvAnswer(0,nB.INCRANSWER,(null==m||null===(f=m.relayMessage)||void 0===f?void 0:f.sequenceId)||0,null==m||null===(p=m.relayMessage)||void 0===p?void 0:p.sdp,iB.UP,"",""),y=new Promise((function(e,r){var n,i,o,a,c;null===(n=S._handler)||void 0===n||n.handleAck({action:Mz.publish,streamId:m.streamId,audioMid:s,videoMid:u,transceiverInit:v.transceiverInit,signalingAck:{audioMid:null==m||null===(i=m.relayMessage)||void 0===i?void 0:i.audioMid,videoMid:null==m||null===(o=m.relayMessage)||void 0===o?void 0:o.videoMid,sdp:null==m||null===(a=m.relayMessage)||void 0===a?void 0:a.sdp,sequenceId:null==m||null===(c=m.relayMessage)||void 0===c?void 0:c.sequenceId},stream:t,onSuccess:function(){Zz.print("publish()","publish success"),e(0)}})})),e.next=26,y;case 26:return t.streamId=m.streamId,t.videoMid=u,t.audioMid=s,t.subVideoDescriptions=v.subVideoDescriptions,this.monitor.rtcPublishStat(oB.SUCCESS,aB.W_0,a,sB.UNKNOWN),t.statsReport.setLocalStreamStatsEvtInterval(this,this._handler,this.monitor),e.abrupt("return");case 35:return e.prev=35,e.t0=e.catch(6),e.t0 instanceof Error&&this.monitor.rtcPublishStat(oB.FAIL,aB.W_0,a,e.t0.message),e.next=40,null===(g=this._handler)||void 0===g?void 0:g.rollback(t.stream.id,t);case 40:throw e.t0;case 41:case"end":return e.stop()}}),e,this,[[6,35]])}))),function(e){return R.apply(this,arguments)})},{key:"updatePubTrack",value:(I=u(o().mark((function e(t){var r,n,i,a,s,u,c,d,l,h,f,p,v,_,m,y,g,S,b,k,T,I,R,A,w,C,O,x,N,D,P;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(Zz.print("updatePubTrack()","localStream: %o",t),i=t.videoTrack,a=t.audioTrack,s=t.pubAudio,u=t.pubVideo,c=null==a?void 0:a.getTrack("preprocessing"),d=null==i?void 0:i.getTrack("preprocessing"),u&&d?null===(l=t.videoTransceiver)||void 0===l||l.sender.replaceTrack(d):null===(h=t.videoTransceiver)||void 0===h||h.sender.replaceTrack(null),null===(r=this._handler)||void 0===r||r.updateScaleResolutionDownBy(t),s&&c?(p=a.mixType,(v=a.mixedAudioTrack)&&p!==te.PLAYOUT&&!0===c.enabled&&(c=v),null===(f=t.audioTransceiver)||void 0===f||f.sender.replaceTrack(c)):null===(_=t.audioTransceiver)||void 0===_||_.sender.replaceTrack(null),m={localaudio:!!a,localvideo:!!i,videostream:u,audiostream:s,extvideo:!!(i instanceof VH),extaudio:!!(a instanceof FH)},y={},g=0,S=Object.entries(m);g<S.length;g++)b=E(S[g],2),k=b[0],(T=b[1])!==Reflect.get(t.pubAttributes,k)&&Reflect.set(y,k,T);if(Object.keys(y).length){e.next=12;break}return e.abrupt("return");case 12:return t.observer&&(I=t.observer,R=y.audiostream,A=y.videostream,w=y.localaudio,C=y.localvideo,O=y.extaudio,x=y.extvideo,void 0!==C?void 0!==x?I.setPushVideo(x):I.setEnableVideo(C):void 0!==A&&I.setUnmuteVideo(A),void 0!==w?void 0!==O?I.setPushAudio(O):I.setEnableAudio(w):void 0!==R&&I.setUnmuteAudio(R)),t.pubAttributes=m,N={roomId:this._roomId,streamId:t.streamId,attributes:y},e.next=17,null===(n=this._dataChannelSignal)||void 0===n?void 0:n.sendSignaling("updateStreamAttributes",N);case 17:if(200===(null==(D=e.sent)?void 0:D.code)){e.next=20;break}throw new ZN(JN.UPDATE_TRACK_FAILED,(null==D?void 0:D.message)||"update track failed");case 20:if(!yP){e.next=23;break}return e.next=23,null===(P=this._handler)||void 0===P?void 0:P.setCurrentDescription();case 23:case"end":return e.stop()}}),e,this)}))),function(e){return I.apply(this,arguments)})},{key:"updateToken",value:(T=u(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(Zz.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 ZN(JN.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 ZN(JN.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 T.apply(this,arguments)})},{key:"unpublish",value:(k=u(o().mark((function e(t){var r,n,i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Zz.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:Mz.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 k.apply(this,arguments)})},{key:"subscribe",value:(b=u(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=u(o().mark((function e(a,s){var u,c,d,l,f,p,v,_,m,y,g,S,b,E,k,T,I,R,A,w,C,O,x,N,D,P,M,L,U,V,F,B,j,G,H,z,q,K;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.streamState!==Oz.SUB_ED){e.next=2;break}return e.abrupt("return",i._updateSubTrack(t,r,wz.SUB,n).then(a,s));case 2:if(t.streamState!==Oz.SUB_ING){e.next=7;break}return i._subStreamQueue[t.streamId]||(i._subStreamQueue[t.streamId]=[]),Zz.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(Zz.print("subscribe()","mediaType: %o",r),tq("subscribe()",t),t.streamState=Oz.SUB_ING,u=!1,c=!1,wP(r)&&(c=!0),CP(r)&&(u=!0),u||!i._multiChatMode()){e.next=17;break}return t.streamState=Oz.INIT,i.emit("SUB_END",t.streamId),e.abrupt("return",a(null));case 17:if(d=lP(),l=t.audioMid,f=t.videoMid,v=t.paused,_=t.subVideo,e.prev=22,!l||!f){e.next=29;break}return e.next=26,null===(D=i._handler)||void 0===D?void 0:D.subscribe(t,{audioMid:l,videoMid:f});case 26:p=e.sent,e.next=36;break;case 29:return e.next=31,null===(P=i._handler)||void 0===P?void 0:P.subscribe(t);case 31:if(p=e.sent){e.next=34;break}throw new ZN(JN.ADD_TRANSCEIVER_FAILED,"add transceiver failed");case 34:l=p.audioMid,f=p.videoMid;case 36:return t.paused=!u,t.subVideo=u,M={spatialLayer:(null==n?void 0:n.spatialLayer)||0,temporalLayer:0,spatialSubLayer:(null==n?void 0:n.spatialSubLayer)||-1},L={audio:!i._multiChatMode(),video:!0,data:!0,screen:t.isScreen,browser:"chrome-stable",videoMid:(null===(m=p)||void 0===m?void 0:m.autosubVideoMid)||f,audioMid:(null===(y=p)||void 0===y?void 0:y.autosubAudioMid)||l,sdpInfo:{sdp:null===(g=p)||void 0===g?void 0:g.partialSdp,semantics:null===(S=p)||void 0===S?void 0:S.semantics,type:null===(b=p)||void 0===b?void 0:b.type},streamUserId:t.userId,streamId:t.streamId,config:{enableMediaType:{audio:!!i._multiChatMode()||c,video:u},qualityLayer:M},extra:{enableSendRTT:!0}},e.next=42,null===(E=i._dataChannelSignal)||void 0===E?void 0:E.sendSignaling("subscribe",L);case 42:if(200===(null==(U=e.sent)?void 0:U.code)){e.next=45;break}throw new ZN(JN.SUBSCRIBE_FAILED,(null==U?void 0:U.message)||"subscribe failed");case 45:return V=[],F=!i._multiChatMode(),B=!t.videoTrack,i._subResolves[t.streamId]||(i._subResolves[t.streamId]=[]),B&&V.push(new Promise((function(e,r){i._subResolves[t.streamId].push(e);var n=setTimeout((function(){return r(new ZN(JN.TIME_OUT,"wait video timeout for userId: ".concat(t.userId)))}),$z);t.on("ontrack",(function r(i){"video"===i.mediaType&&(Zz.print("remoteStream ".concat(t.userId," received video track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),F&&V.push(new Promise((function(e,r){i._subResolves[t.streamId].push(e);var n=setTimeout((function(){return r(new ZN(JN.TIME_OUT,"wait audio timeout for userId: ".concat(t.userId)))}),$z);t.on("ontrack",(function r(i){"audio"===i.mediaType&&(Zz.print("remoteStream ".concat(t.userId," received audio track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),j=function(e){t.ontrack(e)},null===(k=i._handler)||void 0===k||k.on("ontrack",j),i._ontrackCallbackMap.set(t,j),G=null==U?void 0:U.relayMessage,H=G.audioMid,z=G.videoMid,h(T={},l,H),h(T,f,z),q=T,Zz.print("sub midmap",t.userId,q),yP?(t.videoMid=f,t.audioMid=l):(t.videoMid=z,t.audioMid=H),t._workaround_1_=!1,t.subMediaType=r,t.streamState=Oz.SUB_ED,t.subLayer=M,IB.rtcRecvAnswer(0,nB.INCRANSWER,(null==U||null===(I=U.relayMessage)||void 0===I?void 0:I.sequenceId)||0,null==U||null===(R=U.relayMessage)||void 0===R?void 0:R.sdp,iB.DOWN,t.streamId,t.userId),e.next=65,null===(A=i._handler)||void 0===A?void 0:A.handleAck({action:Mz.subscribe,streamId:t.streamId,audioMid:l,videoMid:f,transceiverInit:null===(w=p)||void 0===w?void 0:w.transceiverInit,signalingAck:{audioMid:null==U||null===(C=U.relayMessage)||void 0===C?void 0:C.audioMid,videoMid:null==U||null===(O=U.relayMessage)||void 0===O?void 0:O.videoMid,sdp:null==U||null===(x=U.relayMessage)||void 0===x?void 0:x.sdp,sequenceId:null==U||null===(N=U.relayMessage)||void 0===N?void 0:N.sequenceId},stream:t});case 65:return e.next=67,Promise.all(V);case 67:i._multiChatMode()||(t.subAudio=c),i.monitor.rtcSubscribeStat(uB.SUCCESS,d,cB.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=84;break;case 74:return e.prev=74,e.t0=e.catch(22),e.t0 instanceof Error&&i.monitor.rtcSubscribeStat(uB.FAIL,d,e.t0.message,t.userId),t.paused=v,t.subVideo=_,t.streamState=Oz.INIT,e.next=82,null===(K=i._handler)||void 0===K?void 0:K.rollback(t.streamId,t);case 82:s(e.t0),i.emit("SUB_END",t.streamId);case 84:case"end":return e.stop()}}),e,null,[[22,74]])})));return function(t,r){return e.apply(this,arguments)}}()));case 1:case"end":return e.stop()}}),e)}))),function(e,t,r){return b.apply(this,arguments)})},{key:"_handleSubStreamQueue",value:function(e){var t,r=this;if(null!==(t=this._subStreamQueue[e])&&void 0!==t&&t.length){Zz.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 Zz.print("_subStreamQueue","streamId: %o, END",e)}},{key:"controlMessage",value:(S=u(o().mark((function e(t){var r,n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Zz.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 S.apply(this,arguments)})},{key:"updateUserAttributes",value:(y=u(o().mark((function e(t){var r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Zz.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 y.apply(this,arguments)})},{key:"updateSubTrack",value:(_=u(o().mark((function e(t,r,n,i){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._updateSubTrack(t,r,n,i||t.subLayer));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t,r,n){return _.apply(this,arguments)})},{key:"_updateSubTrack",value:(v=u(o().mark((function e(t,r,n,i){var a,s,u,c,d,l,h,f,p;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Zz.print("updateSubTrack()","mediaType: %o, subLayer: %o",r,i),tq("updateSubTrack()",t),u=0,u=n===wz.SUB?t.subMediaType|r:t.subMediaType-(t.subMediaType&r),Zz.print("updateSubTrack","prev: %o, direction: %o, mediaType: %o, newMediaType: %o",t.subMediaType,n,r,u),t.subMediaType===u&&Zz.print("updateSubTrack","mediaType no change"),c=!1,d=!1,wP(u)&&(d=!0),CP(u)&&(c=!0),l=i||t.subLayer,h={roomId:this._roomId,streamList:[t.streamId],config:{enableMediaType:{video:c,audio:!!this._multiChatMode()||d},qualityLayer:l}},e.next=13,null===(a=this._dataChannelSignal)||void 0===a?void 0:a.sendSignaling("updateSubscribe",h);case 13:if(200===(null==(f=e.sent)?void 0:f.code)){e.next=16;break}throw new ZN(JN.UPDATE_TRACK_FAILED,(null==f?void 0:f.message)||"update track failed");case 16:return t.paused=!c,this._multiChatMode()||(null===(p=t.observer)||void 0===p||p.setUnmuteAudio(d),t.subAudio=d),null===(s=t.observer)||void 0===s||s.setUnmuteVideo(c),t.subVideo=c,t.subMediaType=u,t.subLayer=l,e.abrupt("return",t);case 23:case"end":return e.stop()}}),e,this)}))),function(e,t,r,n){return v.apply(this,arguments)})},{key:"subscribe4pushTrack",value:(p=u(o().mark((function e(t,r){var n,i,a,s,u,c,d,l,f,p,v,_,m,y,g,S,b,E=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Zz.print("subscribe4pushTrack()","streamInfo: %o",r),tq("subscribe4pushTrack()",t),c=null==r?void 0:r.message,d=c.audioMid,l=c.videoMid,f=c.sequenceId,t.subAudio=!0,!(f<t.sequenceId)){e.next=7;break}return Zz.print("subscribe4pushTrack","sequenceId return",f,t.sequenceId),e.abrupt("return");case 7:if(p=t.audioMid,v=t.videoMid,null===(n=t.observer)||void 0===n||n.setPushTrack(!0),!p||!v){e.next=16;break}return e.next=13,null===(m=this._handler)||void 0===m?void 0:m.subscribe(t,{audioMid:p,videoMid:v});case 13:_=e.sent,e.next=23;break;case 16:return e.next=18,null===(y=this._handler)||void 0===y?void 0:y.subscribe(t);case 18:if(_=e.sent){e.next=21;break}throw new ZN(JN.ADD_TRANSCEIVER_FAILED,"add transceiver failed");case 21:p=_.audioMid,v=_.videoMid;case 23:return h(i={},p,d),h(i,v,l),g=i,Zz.print("onpushtrack midmap",t.userId,g),yP?(t.audioMid=p,t.videoMid=v):(t.audioMid=d,t.videoMid=l),t.autosubAudioMid=d,t.autosubVideoMid=l,t.sequenceId=f,this._subResolves[t.streamId]||(this._subResolves[t.streamId]=[]),S=[],t.audioTrack||S.push(new Promise((function(e,r){E._subResolves[t.streamId].push(e);var n=setTimeout((function(){return r(new ZN(JN.TIME_OUT,"wait audio timeout for userId: ".concat(t.userId)))}),$z);t.on("ontrack",(function r(i){"audio"===i.mediaType&&(Zz.print("remoteStream ".concat(t.userId," received audio track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),b=function(e){t.ontrack(e)},null===(a=this._handler)||void 0===a||a.on("ontrack",b),this._ontrackCallbackMap.set(t,b),e.next=37,null===(s=this._handler)||void 0===s?void 0:s.handleAck({action:Mz.pushtrack,streamId:t.streamId,audioMid:p,videoMid:v,stream:t,transceiverInit:null===(u=_)||void 0===u?void 0:u.transceiverInit,signalingAck:null==r?void 0:r.message});case 37:return e.next=39,Promise.all(S);case 39:this._context&&t.statsReport.setRemoteStreamStatsEvtInterval(this,this._handler,this.monitor,this._context);case 40:case"end":return e.stop()}}),e,this)}))),function(e,t){return p.apply(this,arguments)})},{key:"unsubscribe4removeTrack",value:(d=u(o().mark((function e(t,r){var n,i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(tq("unsubscribe4removeTrack()",t),Zz.print("unsubscribe4removeTrack()","sequenceId: ",r.sequenceId),!(r.sequenceId<t.sequenceId)){e.next=5;break}return Zz.print("unsubscribe4removeTrack()","sequenceId return"),e.abrupt("return");case 5:if(t.subAudio=!1,!t.subVideo&&!t.paused){e.next=10;break}return t.sequenceId=r.sequenceId,Zz.print("unsubscribe4removeTrack()","foo %o",t.userId),e.abrupt("return");case 10:return null===(n=t.observer)||void 0===n||n.setPushTrack(!1),e.next=13,null===(i=this._handler)||void 0===i?void 0:i.handleAck({action:Mz.removetrack,streamId:t.streamId,audioMid:t.audioMid,videoMid:t.videoMid,stream:t});case 13:this._subResolves[t.streamId]&&this._subResolves[t.streamId].forEach((function(e){return e(0)})),Zz.print("clean unsubscribe4removeTrack"),t.clean(),t.resetHasSubscribed(),t.statsReport.unsubscribe();case 18:case"end":return e.stop()}}),e,this)}))),function(e,t){return d.apply(this,arguments)})},{key:"unsubscribe",value:(s=u(o().mark((function e(t,r){var n,i,a,s,u,c,d,l,h=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=h.length>2&&void 0!==h[2]&&h[2],tq("unsubscribe()",t),s=t.subMediaType-(t.subMediaType&r),a||!this._subConfig.muteReplaceUnsub&&s===cz.NONE){e.next=5;break}return e.abrupt("return",this._updateSubTrack(t,r,wz.UNSUB));case 5:if(u={roomId:this._roomId,streamId:t.streamId,userId:t.userId},null===(n=this._dataChannelSignal)||void 0===n||n.sendSignaling("unsubscribe",u).catch((function(){})),t.streamState=Oz.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,t.paused=!1,t._workaround_1_||(t.subAudio=!1),null===(i=t.observer)||void 0===i||i.setSubscribeVideo(!1),t.subAudio){e.next=23;break}return null===(c=t.observer)||void 0===c||c.setSubscribeAudio(!1),e.next=17,null===(d=this._handler)||void 0===d?void 0:d.handleAck({action:Mz.unsubscribe,streamId:t.streamId,audioMid:t.audioMid,videoMid:t.videoMid,stream:t});case 17:l=e.sent,this._subResolves[l]&&this._subResolves[l].forEach((function(e){return e(0)})),Zz.print("unsubscribe","clean unsub ".concat(t.userId)),t.clean(),this.removeOnTrackListener(t),t.statsReport.unsubscribe();case 23: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=u(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(tq("handleRemoveStream()",t),t.subVideo=!1,r.message&&r.message!==nj.videoMuted?t._workaround_1_=!1:t._workaround_1_=!0,t.hasSubscribed){e.next=5;break}return e.abrupt("return");case 5:this.unsubscribe(t,V.AUDIO_AND_VIDEO,!0);case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return a.apply(this,arguments)})},{key:"leave",value:(n=u(o().mark((function e(){var t,r,n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Zz.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 ZN(JN.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=u(o().mark((function e(t){var r,n,i,a,s,u,c,d,l,h,f,p,v,_,m,y,g,S=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);case 2:if(s=e.sent){e.next=5;break}throw new ZN(JN.ADD_TRANSCEIVER_FAILED,"add transceiver failed");case 5:return u=lP(),c=s.audioMid,d=s.videoMid,e.t0=this._appId,e.t1=t.streamId,e.t2=c,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,Mj();case 15:return e.t5=e.sent,e.t6=window.navigator.userAgent,e.t7=WB.VERSION,e.t8=HB.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){S._subResolves[t.streamId].push(e);var n=setTimeout((function(){return r(new ZN(JN.TIME_OUT,"wait video timeout for streamId: ".concat(t.streamId)))}),$z);t.on("ontrack",(function r(i){"video"===i.mediaType&&(Zz.print("remoteStream ".concat(t.userId," received video track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),f.push(new Promise((function(e,r){S._subResolves[t.streamId].push(e);var n=setTimeout((function(){return r(new ZN(JN.TIME_OUT,"wait audio timeout for streamId: ".concat(t.streamId)))}),$z);t.on("ontrack",(function r(i){"audio"===i.mediaType&&(Zz.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.audioMid,m=v.videoMid,y=v.sequenceId,g=v.sdp,t.videoMid=m,t.audioMid=_,t.sequenceId=y,t._workaround_1_=!1,t.paused=!1,t.streamState=Oz.SUB_ED,t.subAudio=!0,t.subVideo=!0,e.next=46,null===(a=this._handler)||void 0===a?void 0:a.handleAck({action:Mz.subscribe,streamId:t.streamId,audioMid:c,videoMid:d,transceiverInit:null==s?void 0:s.transceiverInit,signalingAck:{audioMid:_,videoMid:m,sdp:g,sequenceId:y},stream:t});case 46:return e.next=48,Promise.all(f);case 48:this.monitor.rtcSubscribeStat(uB.SUCCESS,u,cB.UNKNOWN,t.userId),this._context&&t.statsReport.setRemoteStreamStatsEvtInterval(this,this._handler,this.monitor,this._context);case 50:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"unsubscribePublicStream",value:(t=u(o().mark((function e(t){var r,n,i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return tq("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=Oz.INIT,t.subVideo=!1,t.subAudio=!1,e.next=14,null===(r=this._handler)||void 0===r?void 0:r.handleAck({action:Mz.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;Zz.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}}]),O}(VL);function nq(e,t,r){var n=r.value;return r.value=u(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 ZN(JN.NOT_CONNECTED_YET,"error in ".concat(t,": try again after joined"));case 7:case"end":return e.stop()}}),e,this)}))),r}function iq(e,t,r){var n=r.value;return r.value=u(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}Qz([function(e,t,r){var n=r.value;return r.value=u(o().mark((function e(){var t,r,i,a,s=this,c=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(t=c.length,r=new Array(t),i=0;i<t;i++)r[i]=c[i];return a=!1,e.abrupt("return",new Promise(function(){var e=u(o().mark((function e(t,i){var u;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s.on("INTERRUPT",(function(){a=!0,i(new ZN(JN.OPERATION_CANCEL,"operation not finish when leave"))})),e.prev=1,e.next=4,n.apply(s,r);case 4:u=e.sent,t(u),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}],rq.prototype,"join",1),Qz([iq,nq],rq.prototype,"publish",1),Qz([iq,nq],rq.prototype,"updatePubTrack",1),Qz([iq,nq],rq.prototype,"unpublish",1),Qz([iq,nq],rq.prototype,"subscribe",1),Qz([nq],rq.prototype,"controlMessage",1),Qz([nq],rq.prototype,"updateUserAttributes",1),Qz([nq],rq.prototype,"updateSubTrack",1),Qz([iq,nq],rq.prototype,"subscribe4pushTrack",1),Qz([iq,nq],rq.prototype,"unsubscribe4removeTrack",1),Qz([iq,nq],rq.prototype,"unsubscribe",1),Qz([nq],rq.prototype,"handleRemoveStream",1),Qz([iq],rq.prototype,"subscribePublicStream",1),Qz([iq],rq.prototype,"unsubscribePublicStream",1);var oq=ha,aq=St,sq=se,uq=Te,cq=Pe,dq=He,lq=Vt,hq=es,fq=gt.f,pq=Yo,vq=sq.Symbol,_q=vq&&vq.prototype;if(aq&&dq(vq)&&(!("description"in _q)||void 0!==vq().description)){var mq={},yq=function(){var e=arguments.length<1||void 0===arguments[0]?void 0:hq(arguments[0]),t=lq(_q,this)?new vq(e):void 0===e?vq():vq(e);return""===e&&(mq[t]=!0),t};pq(yq,vq),yq.prototype=_q,_q.constructor=yq;var gq="Symbol(test)"==String(vq("test")),Sq=uq(_q.valueOf),bq=uq(_q.toString),Eq=/^Symbol\((.*)\)[^)]+$/,kq=uq("".replace),Tq=uq("".slice);fq(_q,"description",{configurable:!0,get:function(){var e=Sq(this);if(cq(mq,e))return"";var t=bq(e),r=gq?Tq(t,7,-1):kq(t,Eq,"$1");return""===r?void 0:r}}),oq({global:!0,constructor:!0,forced:!0},{Symbol:yq})}nM("iterator");var Iq=np.right,Rq=tt,Aq=ip;ha({target:"Array",proto:!0,forced:!qi("reduceRight")||!Aq&&Rq>79&&Rq<83},{reduceRight:function(e){return Iq(this,e,arguments.length,arguments.length>1?arguments[1]:void 0)}});var wq={};Object.defineProperty(wq,"__esModule",{value:!0});var Cq=function(){return(Cq=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 Oq(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 xq(e){return"object"==a(e)&&null!==e}function Nq(e){return"function"==typeof e}function Dq(){if("object"==("undefined"==typeof window?"undefined":a(window))&&xq(window))return window}function Pq(){if("object"==("undefined"==typeof document?"undefined":a(document))&&xq(document))return document}var Mq=function(e){if(e)return e.__SLARDAR_REGISTRY__||(e.__SLARDAR_REGISTRY__={Slardar:{plugins:[],errors:[],subject:{}}}),e.__SLARDAR_REGISTRY__.Slardar},Lq=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))}([],Oq(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=Mq(Dq());r&&(r.errors||(r.errors=[]),r.errors.push(e))}(o),[]}},Uq=function(e){return e.requestIdleCallback||function(t){return e.setTimeout(t,1)}},Vq=function(){return Date.now()};var Fq=function(e,t){return xq(e)?Cq(Cq({},t),e):!!e&&t};var Bq=["SCRIPT","STYLE","META","HEAD"],jq=["js_error","http","resource_error"],Gq=["performance","performance_longtask","performance_timing","custom"],Hq=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=Bq),!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)},zq=function(e,t,r,n){if(function(){if(Dq()&&"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(){Uq(r)((function(){r.html2canvas&&r.html2canvas(n.body,{scale:360/r.innerWidth}).then((function(t){e(t.toDataURL("image/jpeg",.1))}))}))}},qq=function(e,t,r,n,i){if(void 0===e&&(e=Dq()),void 0===t&&(t=Pq()),void 0===r&&(r=function(){if(Dq()&&Nq(window.PerformanceObserver))return window.PerformanceObserver}()),void 0===n&&(n=function(){if(Dq()&&Nq(window.MutationObserver))return window.MutationObserver}()),void 0===i&&(i=function(){if(Dq()&&xq(window.performance))return window.performance}()),t&&e)return function(o,a){var s,u,c,d,l,h,f=o.threshold,p=o.screenshot,v=o.rootSelector,_=o.autoDetect,m=o.ssUrl,y=Uq(e),g=Oq(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 Nq(r)&&r.call(e,t)||[]},function(){var t=(e||{}).clearResourceTimings;Nq(t)&&t.call(e)},function(t){var r=(e||{}).getEntriesByName;return Nq(r)&&r.call(e,t)||[]}]}(i),2)[1],S=0,b=!1,E=function(e){s&&a&&a({ev_type:"blank_screen",payload:{timestamp:s[0],score:s[1],screenshot:e,error:u}})},k=(d=function(){s&&!b&&(b=!0,I(),p?zq(E,m,e,t):E())},function(){l||(h=Vq(),l=e.setTimeout((function(){l=0,h<S||d()}),g()>1e4?2e3:8e3))});function T(){c&&clearTimeout(c),c=e.setTimeout((function(){y((function(){e.requestAnimationFrame((function(){var e=v?t.querySelector(v):t.body;e&&((e=Hq(e,0,0,f))<f?(s=[Vq(),e],k()):s=void 0)}))}))}),1e3)}!function(e){var t=Oq(function(e){var t=!1;return[function(r){t||(t=!0,e&&e(r))}]}(e),1)[0];["unload","beforeunload","pagehide"].forEach((function(e){addEventListener(e,t)}))}((function(){!b&&u&&E()}));var I=function(){clearTimeout(c),A&&A(),C&&C()},R=(o=Oq(function(e,t){var r=e&&new e(t);return[function(e,t){r&&e&&r.observe(e,t)},function(){return r&&r.disconnect()}]}(n,T),2),o[0]),A=o[1],w=(o=Oq(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 c&&1<r.length&&T()})),2),o[0]),C=o[1];return _&&function(e){var t=Dq(),r=Pq();t&&r&&("loading"!==r.readyState?e():t.addEventListener("DOMContentLoaded",(function(){setTimeout((function(){e()}),0)}),!1))}((function(){var e;R(null===(e=Pq())||void 0===e?void 0:e.body,{subtree:!0,childList:!0}),w("longtask","resource"),T()})),[I,function(e){b||function(e){return~Gq.indexOf(e.ev_type)}(e)||(S=Vq(),u&&S-u.timestamp>1e4&&(u=void 0),u=function(e,t){if(-1===jq.indexOf(t.ev_type))return e;if("http"===t.ev_type&&t.payload.response.status<400)return e;if(e&&jq.indexOf(e.type)<jq.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:Vq()}}(u,e))},T]}},Kq="blankScreen";function Xq(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],Fq(t,r)}(e,Kq,t)||Fq(r,t);a&&(a=Oq(Lq(qq,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 Wq={autoDetect:!0,threshold:1.5,screenshot:!0,ssUrl:"https://apm.volccdn.com/mars-web/apmplus/web/html2canvas.min.js"};var Yq=wq.blankScreenPlugin=function(e){return{name:Kq,setup:function(t){!function(e,t){Xq(e,Wq,t)}(t,e)}}},Jq=xe,Qq=_c,Zq=uc;ha({target:"Object",stat:!0,forced:ye((function(){Qq(1)})),sham:!Zq},{getPrototypeOf:function(e){return Qq(Jq(e))}});var $q=SD.start;ha({target:"String",proto:!0,forced:bD},{padStart:function(e){return $q(this,e,arguments.length>1?arguments[1]:void 0)}});var eK,tK={};Object.defineProperty(tK,"__esModule",{value:!0});var rK=function(){return(rK=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 nK(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 iK(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 oK=function(e){return JSON.stringify({ev_type:"batch",list:e})};var aK=["init","start","config","beforeDestroy","provide","beforeReport","report","beforeBuild","build","beforeSend","send","beforeConfig"],sK=function(){return{}};function uK(e){return"object"==a(e)&&null!==e}var cK=Object.prototype;function dK(e){return!!uK(e)&&("function"!=typeof Object.getPrototypeOf?"[object Object]"===cK.toString.call(e):(e=Object.getPrototypeOf(e))===cK||null===e)}function lK(e){return"[object Array]"===cK.toString.call(e)}function hK(e){return"function"==typeof e}function fK(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function pK(e,t){var r,n=rK({},e);for(r in t)fK(t,r)&&void 0!==t[r]&&(uK(t[r])&&dK(t[r])?n[r]=pK(uK(e[r])?e[r]:{},t[r]):lK(t[r])&&lK(e[r])?n[r]=vK(e[r],t[r]):n[r]=t[r]);return n}function vK(e,t){return e=lK(e)?e:[],t=lK(t)?t:[],Array.prototype.concat.call(e,t).map((function(e){return e instanceof RegExp?e:uK(e)&&dK(e)?pK({},e):lK(e)?vK([],e):e}))}function _K(e,t){if(!lK(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 mK=function(e,t){if(!lK(e))return e;var r=e.indexOf(t);return 0<=r?((t=e.slice()).splice(r,1),t):e},yK=function(e,t,r){return function(e,t,r){for(var n,i=(t=nK(t.split(".")))[0],o=t.slice(1);e&&0<o.length;)e=e[i],i=(n=nK(o))[0],o=n.slice(1);if(e)return r(e,i)}(e,t,(function(e,t){if(e&&t in e&&hK(e[t]))try{return e[t].apply(e,r)}catch(n){return}}))};function gK(e){try{return function(e){return"string"==typeof e}(e)?e:JSON.stringify(e)}catch(t){return"[FAILED_TO_STRINGIFY]:"+String(t)}}var SK=0,bK=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];console.error.apply(console,iK(["[SDK]",Date.now(),(""+SK++).padStart(8," ")],nK(e),!1))},EK=0,kK=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];console.warn.apply(console,iK(["[SDK]",Date.now(),(""+EK++).padStart(8," ")],nK(e),!1))},TK=function(e){return function(t){for(var r=t,n=0;n<e.length&&r;n++)try{r=e[n](r)}catch(i){bK(i)}return r}};function IK(){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 RK=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)}},AK=function(e){function t(e){n=mK(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 RK(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 wK=function(e){var t,r,n,i=(t={},r={},n={set:function(e,i){return t[e]=i,r[e]=gK(i),n},merge:function(e){return t=rK(rK({},t),e),Object.keys(e).forEach((function(t){r[t]=gK(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 rK({},r)}},n);e.provide("context",i),e.on("report",(function(e){return e.extra||(e.extra={}),e.extra.context=i.toString(),e}))},CK=function(e,t,r){function n(){for(var r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];if(u=r[0]){var a=u.split(".")[0];if(a in n)return yK(n,u,[].slice.call(r,1));var s=o[a]||[],u=null!==(u=null==t?void 0:t(e))&&void 0!==u?u:{};s.push(iK([u],nK(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 sK;var a=e[t],s=r.apply(void 0,iK([a],nK(i),!1)),u=s;return hK(u)&&n&&(u=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];try{return s.apply(this,e)}catch(r){return hK(a)&&a.apply(this,e)}}),e[t]=u,function(r){r||(u===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=nK(t))[0];var n=n.slice(1);null!=r&&r(e,t,n)})),o[t]=null)})),n};function OK(e,t){var r=t||{};e.provide("initSubject",(function(e){var t=(e=nK(e,2))[0];e=e[1];return r[t]||(r[t]=function(t,r){var n=AK();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 xK(){if("object"==("undefined"==typeof window?"undefined":a(window))&&uK(window))return window}function NK(){var e=function(){if(xK()&&"navigator"in window)return window.navigator}();if(e)return e.connection||e.mozConnection||e.webkitConnection}function DK(){var e=xK()&&xK()&&window.location;return null==e?void 0:e.href}var PK=function(e){var t={url:DK(),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 MK(e){return(null==e?void 0:e.effectiveType)||(null==e?void 0:e.type)||""}var LK=function(e,t,r){var n,i=t.url,o=t.data,a=void 0===(n=t.success)?sK:n,s=void 0===(n=t.fail)?sK:n,u=void 0===(n=t.getResponseText)?sK: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!=u&&u(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)},UK=function(){var e=function(){if("function"==typeof XMLHttpRequest&&hK(XMLHttpRequest))return XMLHttpRequest}();return e?{get:function(t){LK("GET",t,e)},post:function(t){LK("POST",t,e)}}:{get:sK,post:sK}};function VK(e){function t(e){n.post(r.getEndpoint(),oK([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 u(){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&&u.call(this),clearTimeout(s),s=setTimeout(u.bind(this),o)},flush:function(){clearTimeout(s),u.call(this)},getBatchData:function(){return a.length?oK(a):""},clear:function(){clearTimeout(s),a=[]}}}(e),n=function(){var e=xK();return e&&e.navigator.sendBeacon?{get:function(){},post:function(t,r){e.navigator.sendBeacon(t,r)}}:{get:sK,post:sK}}();return function(e){var t=nK(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 FK={build:function(e){return{ev_type:e.ev_type,payload:e.payload,common:rK(rK({},e.extra||{}),e.overrides||{})}}};function BK(e){var t,r=e.plugins||{};for(t in r)r[t]&&!uK(r[t])&&(r[t]={});return rK(rK({},e),{plugins:r})}function jK(e){return uK(e)&&"aid"in e}function GK(e){return rK({},e)}var HK="/settings/get/webpro",zK="/monitor_web/collect",qK=[zK,HK,"/monitor_browser/collect"],KK={sample_rate:1,include_users:[],sample_granularity:"session",rules:{}},XK=function(e,t){return void 0===t&&(t=zK),(e&&0<=e.indexOf("//")?"":"https://")+e+t},WK=function(e,t){return void 0===t&&(t=HK),(e&&0<=e.indexOf("//")?"":"https://")+e+t},YK=function(e){return e+"_"+Date.now()},JK=function(e){return"APMPLUS"+e},QK=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=JK(e))||{userId:IK(),deviceId:IK(),r:Math.random()}},ZK=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=JK(t),{userId:r,deviceId:n,r:e.r})},$K=function(e){var t,r,n,i=e,o={},a=sK,s=sK;return{getConfig:function(){return i},setConfig:function(e){return o=rK(rK({},o),e||{}),u(),t||(t=e,i.useLocalConfig?(n={},a()):r?c():function(e,t,r,n){e.get({withCredentials:!0,url:WK(t)+"?aid="+r,success:function(e){n(e.data||{})},fail:function(){n()}})}(i.transport,i.domain,i.aid,(function(e){r=e,c()}))),i},onChange:function(e){s=e},onReady:function(t){a=function(){e.userId!==i.userId&&(e.sample.r=Math.random(),u()),ZK(i),t()},n&&a()}};function u(){var t=rK(rK(rK({},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=pK(r,e[n++]);return r}(e.plugins,(null==n?void 0:n.plugins)||{},o.plugins||{}),t.sample=eX(eX(e.sample,null==n?void 0:n.sample),o.sample),i=t,s()}function c(){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),u(),a()}};function eX(e,t){if(!e||!t)return e||t;var r=rK(rK({},e),t);return r.include_users=iK(iK([],nK(e.include_users||[]),!1),nK(t.include_users||[]),!1),r.rules=iK(iK([],nK(Object.keys(e.rules||{})),!1),nK(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]=rK(rK({},e.rules[n]),t.rules[n]),r[n].conditional_sample_rules=iK(iK([],nK(e.rules[n].conditional_sample_rules||[]),!1),nK(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 tX=function(e){e.on("report",(function(e){return function(e){var t={url:DK(),timestamp:Date.now()};return rK(rK({},e),{extra:rK(rK({},t),e.extra||{})})}(e)}))},rX=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,rK(rK({},e),{extra:rK(rK({},r),e.extra||{})})}(t,e.config())}))},nX=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 uK(e)?Object.keys(e).reduce((function(t,r){return t+"&"+r+"="+e[r]}),"").replace("&","?"):""}(r))}))},iX=function(e){return e=QK(e.aid),{aid:0,pid:"",token:"",viewId:YK("_"),userId:e.userId,deviceId:e.deviceId,sessionId:IK(),domain:"apmplus.volces.com",plugins:{ajax:{ignoreUrls:qK},fetch:{ignoreUrls:qK},breadcrumb:{},pageview:{},jsError:{},resource:{},resourceError:{},performance:{},tti:{},fmp:{},blankScreen:!1},release:"",env:"production",sample:rK(rK({},KK),{r:e.r}),transport:UK()}};eK=tK.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,u=e.initConfigNormalizer,c=e.validateInitConfig,d={};aK.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)kK("already inited");else{if(!(e&&uK(e)&&c(e)))throw new Error("invalid InitConfig, init failed");var n=o(e);if(!n)throw new Error("defaultConfig missing");if(e=u(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&&uK(e)&&(m("beforeConfig",!1,e),null!=r&&r.setConfig(e))},config:function(e){if(l)return e&&uK(e)&&(m("beforeConfig",!1,e),null!=r&&r.setConfig(s(e))),null==r?void 0:r.getConfig()},provide:function(e,t){_K(v,e)?kK("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=TK(d.beforeReport)(e))||(e=TK(d.report)(e))&&(h?this.build(e):p.push(e)))},build:function(e){!h||(e=TK(d.beforeBuild)(e))&&(!(e=n.build(e))||(e=TK(d.build)(e))&&this.send(e))},send:function(e){!h||(e=TK(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]=mK(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,iK([],nK(r),!1))}catch(t){}})),t&&(d[e].length=0)}}({validateInitConfig:jK,initConfigNormalizer:BK,userConfigNormalizer:GK,createSender:void 0===t?function(e){return VK({size:20,endpoint:XK(e.domain),transport:e.transport})}:t,builder:void 0===e?FK:e,createDefaultConfig:void 0===r?iX:r,createConfigManager:$K});return wK(n),r=function(e){if(e)return e.__SLARDAR_REGISTRY__||(e.__SLARDAR_REGISTRY__={Slardar:{plugins:[],errors:[],subject:{}}}),e.__SLARDAR_REGISTRY__.Slardar}(xK()),OK(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),rX(n),tX(n),function(e){var t=NK(),r=MK(t);t&&(t.onchange=function(){r=MK(t)}),e.on("report",(function(e){return rK(rK({},e),{extra:rK(rK({},e.extra||{}),{network_type:r})})}))}(n),nX(n),r=CK(n,PK,(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=nK(r))[0],t=t.slice(1);n[e].apply(n,iK([],nK(t),!1))}))})),function(e){e.on("init",(function(){var t=[],r=e.config();r&&r.integrations&&r.integrations.forEach((function(r){_K(t,r.name)||(t.push(r.name),r.setup(e),r.tearDown&&e.on("beforeDestroy",r.tearDown))}))}))}(r),r},tK.getDefaultConfig=iX;var oX={};Object.defineProperty(oX,"__esModule",{value:!0});var aX=function(){return(aX=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 sX(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 uX(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 cX=function(){return{}};function dX(e){return"object"==a(e)&&null!==e}var lX=Object.prototype;function hX(e){return"function"==typeof e}function fX(e){return"string"==typeof e}function pX(e){return function(e){return"[object Array]"===lX.toString.call(e)}(e)&&e.length?function(e){for(var t=[],r=e.length,n=0;n<r;n++){var i=e[n];fX(i)?t.push(i.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")):i&&i.source&&t.push(i.source)}return new RegExp(t.join("|"),"i")}(e):null}function vX(e){try{return fX(e)?e:JSON.stringify(e)}catch(t){return"[FAILED_TO_STRINGIFY]:"+String(t)}}var _X=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 cX;var a=e[t],s=r.apply(void 0,uX([a],sX(i),!1)),u=s;return hX(u)&&n&&(u=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];try{return s.apply(this,e)}catch(r){return hX(a)&&a.apply(this,e)}}),e[t]=u,function(r){r||(u===e[t]?e[t]=a:s=a)}}};function mX(){if("object"==("undefined"==typeof window?"undefined":a(window))&&dX(window))return window}var yX=function(e){if(e)return e.__SLARDAR_REGISTRY__||(e.__SLARDAR_REGISTRY__={Slardar:{plugins:[],errors:[],subject:{}}}),e.__SLARDAR_REGISTRY__.Slardar},gX=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=yX(mX());r&&(r.errors||(r.errors=[]),r.errors.push(e))};function SX(e,t,r){return function(e,t){return dX(e)?aX(aX({},t),e):!!e&&t}(t=null===(e=e.config())||void 0===e?void 0:e.plugins[t],r)}var bX=["name","message","stack","filename","lineno","colno"],EX=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&&dX(e)?t.reduce((function(t,r){return t[r]=e[r],t}),{}):e}(e,bX):(function(e){return!!dX(e)&&("function"!=typeof Object.getPrototypeOf?"[object Object]"===lX.toString.call(e):(e=Object.getPrototypeOf(e))===lX||null===e)}(e)||function(e){return"undefined"!=typeof Event&&function(e,t){try{return e instanceof t}catch(r){return!1}}(e,Event)}(e)||fX(e))&&(t={message:vX(e)}),t},kX=function(e){return EX(e.error)},TX=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=EX(r);return aX(aX({},n),{name:null!==(t=n&&n.name)&&void 0!==t?t:"UnhandledRejection"})}}catch(i){}},IX=function(e){return(function(e){return"[object ErrorEvent]"===Object.prototype.toString.call(e)}(e)?kX:function(e){return"[object PromiseRejectionEvent]"===Object.prototype.toString.call(e)}(e)?TX:EX)(e)},RX=["EventTarget","Window","Node","ApplicationCache","ChannelMergerNode","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","MessagePort","Notification","SVGElementInstance","Screen","TextTrack","TextTrackCue","TextTrackList","WebSocket","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],AX=["setTimeout","setInterval","requestAnimationFrame","requestIdleCallback"],wX=["onload","onerror","onprogress","onreadystatechange"],CX="addEventListener",OX=function(e,t,r){function n(t,r){if(!hX(t))return t;var i={type:"capture-global",data:aX({},r)},o=t._w_||(t._w_=function(){try{return(t.handleEvent&&hX(t.handleEvent)?t.handleEvent:t).apply(this,[].map.call(arguments,(function(e){return n(e,r)})))}catch(a){var o=EX(a);throw o&&e({error:o,source:i}),a}});return o._hook_=!0,o}void 0===t&&(t=mX()),void 0===r&&(r=function(){if("function"==typeof XMLHttpRequest&&hX(XMLHttpRequest))return XMLHttpRequest}());var i=[];return t&&i.push.apply(i,uX([],sX(AX.filter((function(e){return t[e]})).map((function(e){return _X(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,uX([this,n(r,{function:e})],sX(i),!1))}}),!1)()}))),!1)),r&&r.prototype&&i.push(_X(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,uX([],sX(wX.filter((function(e){return t[e]&&!t[e]._hook_})).map((function(e){var r=_X(t,e,(function(t){return n(t,{function:e})}),!1)();return function(){r(),t[e]._hook_=void 0}}))),!1)),e.apply(this,r)}}),!1)()),RX.forEach((function(e){var r=t[e]&&t[e].prototype;r&&r.addEventListener&&(i.push(_X(r,CX,(function(t){return function(r,i,o){try{var a=i.handleEvent;hX(a)&&(i.handleEvent=n(a,{function:"handleEvent",target:e}))}catch(s){}return t&&t.call(this,r,n(i,{function:CX,target:e}),o)}}),!1)()),i.push(_X(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},xX=function(e,t){return e&&t&&e===t},NX=function(){var e;return function(t){try{if(function(e,t){return!!(e&&t&&xX(e.message,t.message)&&xX(e.stack,t.stack))}(t,e))return void(e=t)}catch(r){gX(r)}return e=t}},DX=function(e){if(e=void 0===e?mX():e)return function(t,r){var n,i,o=t.ignoreErrors,a=t.onerror,s=t.onunhandledrejection,u=t.dedupe,c=(t=t.captureGlobalAsync,pX(o)),d=[],l=NX(),h=function(e){var t=e.error,n=e.extra,i=e.react;e=e.source,t=u?l(t):t;r&&t&&(c&&c.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:kX(e),source:{type:"onerror"}})}),d.push((function(){return e.removeEventListener("error",n)}))),s&&(e.addEventListener("unhandledrejection",i=function(e){return h({error:TX(e),source:{type:"onunhandledrejection"}})}),d.push((function(){return e.removeEventListener("unhandledrejection",i)}))),t&&d.push.apply(d,uX([],sX(OX(h)),!1)),[function(e,t,r){return h({error:IX(e),extra:t,react:r,source:{type:"manual"}})},function(){d.forEach((function(e){return e()}))}]}},PX="jsError",MX={ignoreErrors:[],onerror:!0,onunhandledrejection:!0,captureGlobalAsync:!1,dedupe:!0};function LX(e){e.on("init",(function(){window.removeEventListener("error",e.pcErr,!0),window.removeEventListener("unhandledrejection",e.pcRej,!0);var t,r=SX(e,PX,MX);r&&(r=(t=sX(function(e,t,r,n){void 0===t&&(t={}),void 0===n&&(n=[]);try{var i=e.apply(void 0,uX([],sX(n),!1));return i&&i(t,r)||[]}catch(o){return gX(o),[]}}(DX,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 UX=oX.jsErrorPlugin=function(){return{name:PX,setup:function(e){LX(e)}}},VX={};Object.defineProperty(VX,"__esModule",{value:!0});var FX=function(){return(FX=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 BX(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 jX(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(){return{}};function HX(e){return"object"==a(e)&&null!==e}function zX(e){return"function"==typeof e}var qX=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 GX;var a=e[t],s=r.apply(void 0,jX([a],BX(i),!1)),u=s;return zX(u)&&n&&(u=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];try{return s.apply(this,e)}catch(r){return zX(a)&&a.apply(this,e)}}),e[t]=u,function(r){r||(u===e[t]?e[t]=a:s=a)}}};function KX(){if("object"==("undefined"==typeof window?"undefined":a(window))&&HX(window))return window}var XX=function(e){if(e)return e.__SLARDAR_REGISTRY__||(e.__SLARDAR_REGISTRY__={Slardar:{plugins:[],errors:[],subject:{}}}),e.__SLARDAR_REGISTRY__.Slardar},WX=function(e,t,r,n){void 0===t&&(t={}),void 0===n&&(n=[]);try{var i=e.apply(void 0,jX([],BX(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=XX(KX());r&&(r.errors||(r.errors=[]),r.errors.push(e))}(o),[]}};function YX(e){var t=function(){if("object"==("undefined"==typeof document?"undefined":a(document))&&HX(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 JX(e,t,r){return function(e,t){return HX(e)?FX(FX({},t),e):!!e&&t}(t=null===(e=e.config())||void 0===e?void 0:e.plugins[t],r)}var QX=["hash_0",function(e,t){var r,n=KX();n&&(n.addEventListener("hashchange",r=function(){return e(location.href)},!0),t((function(){return n.removeEventListener("hashchange",r,!0)})))}],ZX=["history_0",function(e,t){var r,n,i,o=KX()&&window.history;o&&(n=function(){return e(location.href)},(r=[]).push(qX(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()}}})(),qX(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()}))})))}],$X=function(e,t){if(void 0===e&&(e=KX()),void 0===t&&(t=KX()&&window.location),e&&t)return function(e,r){var n,i,o,a=e.sendInit,s=e.initPid,u=e.routeMode,c=e.extractPid,d=e.onPidUpdate,l=(e=e.createObserver,[]),h="manual"===u?function(){return""}:function(e){return function(t){var r;return"hash"===e?(null===(r=YX(t).hash)||void 0===r?void 0:r.replace(/^#/,""))||"/":YX(t).path}}(u),f=c||function(){},p=(s=BX(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"!==u&&(o=BX(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=BX(e(u),1)[0],l.push(e((function(e){return o(u,e)})))),a&&d(),[s,function(){l.forEach((function(e){return e()}))}]}},eW="pageview",tW={sendInit:!0,routeMode:"history"};var rW,nW=VX.pageviewPlugin=function(){return{name:eW,setup:function(e){var t;(t=e).on("init",(function(){var e,r=JX(t,eW,tW);r&&(r=BX(WX($X,FX(FX({},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?QX:ZX)}}),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))}))}}};fP()||window.__rtc_slardar__||((rW=eK())("init",{aid:432410,token:"d7271e1eac254529abcffc63e36b02c3",integrations:[nW(),UX(),Yq({screenshot:!1})]}),rW("start"),window.__rtc_slardar__=rW);var iW,oW=new(function(){function e(){c(this,e)}return l(e,[{key:"setStats",value:function(e){!fP()&&rW&&Object.keys(e).forEach((function(t){rW("context.set",t,e[t])}))}}]),e}()),aW=function(){function e(t,r){c(this,e),h(this,"_audioEventSessionId",EP()),h(this,"_videoEventSessionId",EP()),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:fB.LOGIN}),h(this,"_currentVideoRecv",{startTime:0,eventSessionId:0,type:fB.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=u(o().mark((function e(t,r){var n,i,a,s,u,c,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=fB.LOGIN,s=fB.UNMUTE,u=fB.SUBSCRIBE,c=fB.PUSH_TRACK,[a,s,u,c].indexOf(r)>=0&&(n=0,i=!1),t===hB.AUDIO?(i||this._audioEventSessionId++,this._currentAudioRecv={startTime:Date.now(),eventSessionId:this._audioEventSessionId,type:r},h={media_type:t,event_type:lB.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(hB.AUDIO,pB.TIMEOUT),m._firstAudioFrameInterval&&window.clearInterval(m._firstAudioFrameInterval)}),this._timeout),IB.rtcFirstFrame(h),this._watchForFirstAudioFrameRecv(),this._audioFirstFrameState=1,this._login=!0,this._unMuteAudio=!0,this._enableAudio=!0,this._remoteUnmuteAudio=!0):t===hB.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?hB.SCREEN_VIDEO:t,event_type:lB.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(hB.VIDEO,pB.TIMEOUT),m._firstVideoFrameInterval&&window.clearInterval(m._firstVideoFrameInterval)}),this._timeout),this._watchForFirstVideoFrameRecv(),IB.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===hB.AUDIO){var r,n,i;if(1!==this._audioFirstFrameState)return;var o={event_type:lB.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,IB.rtcFirstFrame(o),this._audioFirstFrameState=2}else if(e===hB.VIDEO){var a,s,u,c;if(1!==this._videoFirstFrameState)return;var d={event_type:lB.RECV_END,media_type:null!==(a=this._stream)&&void 0!==a&&a.isScreen?hB.SCREEN_VIDEO:e,start:null===(s=this._currentVideoRecv)||void 0===s?void 0:s.startTime,reason:t,result:!1,stream_user_id:null===(u=this._stream)||void 0===u?void 0:u.userId,event_session_id:this._videoEventSessionId,type:null===(c=this._currentVideoRecv)||void 0===c?void 0:c.type};this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),delete this._currentVideoRecv,IB.rtcFirstFrame(d),this._videoFirstFrameState=2}}},{key:"recvFrameFinish",value:(n=u(o().mark((function e(t){var r,n,i,a,s,u,c,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=fB.LOGIN,i=fB.UNMUTE,a=fB.SUBSCRIBE,s=fB.PUSH_TRACK,t!==hB.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:c=this._currentAudioRecv,d=c.type,l=c.startTime,[n,i,a,s].indexOf(d)>=0&&(r=0),h={event_type:lB.RECV_END,media_type:t,start:l,result:!0,stream_user_id:null===(u=this._stream)||void 0===u?void 0:u.userId,event_session_id:this._audioEventSessionId,type:d,transport_delay:r},delete this._currentAudioRecv,this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),IB.rtcFirstFrame(h),this._audioFirstFrameState=3,e.next=30;break;case 18:if(t!==hB.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:lB.RECV_END,media_type:null!==(f=this._stream)&&void 0!==f&&f.isScreen?hB.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),IB.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(hB.AUDIO,fB.LOGIN),e&&null!==(r=this._stream)&&void 0!==r&&r.hasVideo&&o.video&&this.beginRecvFrame(hB.VIDEO,fB.LOGIN),!e&&null!==(n=this._stream)&&void 0!==n&&n.hasAudio&&this.stopRecvFrame(hB.AUDIO,pB.LEAVE_ROOM),!e&&null!==(i=this._stream)&&void 0!==i&&i.hasVideo&&this.stopRecvFrame(hB.VIDEO,pB.LEAVE_ROOM))}},{key:"setUnmuteAudio",value:function(e){var t,r,n;this._unMuteAudio!==e&&(this._unMuteAudio=e,null!==(t=this._stream)&&void 0!==t&&t.audioHasCapture&&null!==(r=this._stream)&&void 0!==r&&r.audioHasPublish&&(this._unMuteAudio?this.beginRecvFrame(hB.AUDIO,fB.UNMUTE):null!==(n=this._stream)&&void 0!==n&&n.hasAudio&&this.stopRecvFrame(hB.AUDIO,pB.MUTE)))}},{key:"setRemoteUnmuteAudio",value:function(e){var t;this._remoteUnmuteAudio!==e&&(this._remoteUnmuteAudio=e,this._remoteUnmuteAudio?this.beginRecvFrame(hB.AUDIO,fB.REMOTE_UNMUTE):null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(hB.AUDIO,pB.REMOTE_MUTE))}},{key:"setEnableAudio",value:function(e){var t;this._enableAudio!==e&&(this._enableAudio=e,this._enableAudio?this.beginRecvFrame(hB.AUDIO,fB.ENABLE):null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(hB.AUDIO,pB.DISABLE))}},{key:"setUnmuteVideo",value:function(e){var t,r,n;this._unMuteVideo!==e&&(this._unMuteVideo=e,null!==(t=this._stream)&&void 0!==t&&t.videoHasCapture&&null!==(r=this._stream)&&void 0!==r&&r.videoHasPublish&&(this._unMuteVideo?this.beginRecvFrame(hB.VIDEO,fB.UNMUTE):null!==(n=this._stream)&&void 0!==n&&n.hasVideo&&this.stopRecvFrame(hB.VIDEO,pB.MUTE)))}},{key:"setRemoteUnmuteVideo",value:function(e){var t;this._remoteUnmuteVideo!==e&&(this._remoteUnmuteVideo=e,this._remoteUnmuteVideo?this.beginRecvFrame(hB.VIDEO,fB.REMOTE_UNMUTE):null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(hB.VIDEO,pB.REMOTE_MUTE))}},{key:"setEnableVideo",value:function(e){this._enableVideo!==e&&(this._enableVideo=e,this._enableVideo?this.beginRecvFrame(hB.VIDEO,fB.ENABLE):this.stopRecvFrame(hB.VIDEO,pB.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(hB.AUDIO,fB.PUSH),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.beginRecvFrame(hB.AUDIO,fB.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(hB.VIDEO,fB.PUSH),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasVideo&&this.beginRecvFrame(hB.VIDEO,fB.PUSH)}},{key:"setPublishVideo",value:function(e){var t;this._publishVideo!==e&&(this._publishVideo=e),this._publishVideo&&this.beginRecvFrame(hB.VIDEO,fB.PUBLISH),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasVideo&&this.stopRecvFrame(hB.VIDEO,pB.UNPUBLISH)}},{key:"setPublishAudio",value:function(e){var t;this._publishAudio!==e&&(this._publishAudio=e),this._publishAudio&&this.beginRecvFrame(hB.AUDIO,fB.PUBLISH),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(hB.AUDIO,pB.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(hB.AUDIO,fB.SUBSCRIBE));!e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(hB.AUDIO,pB.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(hB.VIDEO,fB.SUBSCRIBE));!e&&null!==(t=this._stream)&&void 0!==t&&t.hasVideo&&this.stopRecvFrame(hB.VIDEO,pB.UNSUBSCRIBE)}},{key:"setPushTrack",value:function(e){var t;this._pushTrack!==e&&(e&&!this._isScreen&&this.beginRecvFrame(hB.AUDIO,fB.PUSH_TRACK),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(hB.AUDIO,pB.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.setInterval(u(o().mark((function n(){var i,a,s,u,c,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,Dj(null===(u=e._handler)||void 0===u?void 0:u.pc,null===(c=e._stream)||void 0===c||null===(d=c.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(hB.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.setInterval(u(o().mark((function n(){var i,a,s,u,c,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,Dj(null===(u=e._handler)||void 0===u?void 0:u.pc,null===(c=e._stream)||void 0===c||null===(d=c.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(hB.AUDIO),window.clearInterval(e._firstAudioFrameInterval);case 12:case"end":return n.stop()}}),n)}))),200)}},{key:"getTransportDelay",value:(r=u(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(u(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=u(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,Dj(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:fB.LOGIN},this._currentVideoRecv={startTime:0,eventSessionId:0,type:fB.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}(),sW=function(){function e(t,r){c(this,e),h(this,"_audioEventSessionId",EP()),h(this,"_videoEventSessionId",EP()),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:fB.LOGIN}),h(this,"_currentVideoSend",{startTime:0,eventSessionId:0,type:fB.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===hB.AUDIO){var n;this._audioEventSessionId++,this._currentAudioSend={startTime:Date.now(),eventSessionId:this._audioEventSessionId,type:t};var i={media_type:e,event_type:lB.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(hB.AUDIO,pB.TIMEOUT),r._firstAudioFrameInterval&&window.clearInterval(r._firstAudioFrameInterval)}),this._timeout),IB.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===hB.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?hB.SCREEN_VIDEO:e,event_type:lB.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(hB.VIDEO,pB.TIMEOUT),r._firstVideoFrameInterval&&window.clearInterval(r._firstVideoFrameInterval)}),this._timeout),this._watchForFirstVideoFrameSend(),IB.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===hB.AUDIO){var r,n;if(1!==this._audioFirstFrameState)return;var i={event_type:lB.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,IB.rtcFirstFrame(i),this._audioFirstFrameState=2}else if(e===hB.VIDEO){var o,a,s;if(1!==this._videoFirstFrameState)return;var u={event_type:lB.SENT_END,media_type:null!==(o=this._stream)&&void 0!==o&&o.isScreen?hB.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,IB.rtcFirstFrame(u),this._videoFirstFrameState=2}}},{key:"sendFrameFinish",value:function(e){if(e===hB.AUDIO){if(1!==this._audioFirstFrameState)return;if(!this._currentAudioSend)return;var t=this._currentAudioSend,r=t.type,n=t.startTime,i={event_type:lB.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),IB.rtcFirstFrame(i),this._audioFirstFrameState=3}else if(e===hB.VIDEO){var o;if(1!==this._videoFirstFrameState)return;if(!this._currentVideoSend)return;var a=this._currentVideoSend,s=a.type,u=a.startTime,c={event_type:lB.SENT_END,media_type:null!==(o=this._stream)&&void 0!==o&&o.isScreen?hB.SCREEN_VIDEO:e,start:u,result:!0,event_session_id:this._videoEventSessionId,type:s};delete this._currentVideoSend,this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),IB.rtcFirstFrame(c),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(hB.VIDEO,fB.LOGIN),null!==(r=this._stream)&&void 0!==r&&r.audioTrack&&this.beginSendFrame(hB.AUDIO,fB.LOGIN);!e&&this._audioSending&&this.stopSendFrame(hB.AUDIO,pB.LEAVE_ROOM),!e&&this._videoSending&&this.stopSendFrame(hB.VIDEO,pB.LEAVE_ROOM)}}},{key:"setPublish",value:function(e){if(this._publish!==e){var t,r,n,i;if(this._publish=e,e)(null===(t=this._stream)||void 0===t?void 0:t.videoTrack)&&(null===(r=this._stream)||void 0===r?void 0:r.pubVideo)&&this.beginSendFrame(hB.VIDEO,fB.PUBLISH),(null===(n=this._stream)||void 0===n?void 0:n.audioTrack)&&(null===(i=this._stream)||void 0===i?void 0:i.pubAudio)&&this.beginSendFrame(hB.AUDIO,fB.PUBLISH);!e&&this._audioSending&&this.stopSendFrame(hB.AUDIO,pB.UNPUBLISH),!e&&this._videoSending&&this.stopSendFrame(hB.VIDEO,pB.UNPUBLISH)}}},{key:"setUnmuteAudio",value:function(e){var t;this._unMuteAudio!==e&&(this._unMuteAudio=e,null!==(t=this._stream)&&void 0!==t&&t.audioHasCapture&&(e&&this.beginSendFrame(hB.AUDIO,fB.UNMUTE),!e&&this._audioSending&&this.stopSendFrame(hB.AUDIO,pB.MUTE)))}},{key:"setEnableAudio",value:function(e){var t;this._enableAudio!==e&&null!==(t=this._stream)&&void 0!==t&&t.pubAudio&&(this._enableAudio=e,e&&this.beginSendFrame(hB.AUDIO,fB.ENABLE),!e&&this._audioSending&&this.stopSendFrame(hB.AUDIO,pB.DISABLE))}},{key:"setUnmuteVideo",value:function(e){var t;this._unMuteVideo!==e&&(this._unMuteVideo=e,null!==(t=this._stream)&&void 0!==t&&t.videoHasCapture&&(e&&this.beginSendFrame(hB.VIDEO,fB.UNMUTE),!e&&this._videoSending&&this.stopSendFrame(hB.VIDEO,pB.MUTE)))}},{key:"setEnableVideo",value:function(e){var t;this._enableVideo!==e&&null!==(t=this._stream)&&void 0!==t&&t.pubVideo&&(this._enableVideo=e,e&&this.beginSendFrame(hB.VIDEO,fB.ENABLE),!e&&this._videoSending&&this.stopSendFrame(hB.VIDEO,pB.DISABLE))}},{key:"setExternalAudioSource",value:function(e){this._audioExternal!==e&&(this._audioExternal=e,e&&(this._audioSending&&this.stopSendFrame(hB.AUDIO,pB.DISABLE),this._enableAudio=!1),e||(this._audioSending&&this.stopSendFrame(hB.AUDIO,pB.STOP_PUSH),this._pushAudio=!1))}},{key:"setPushAudio",value:function(e){this._pushAudio!==e&&(this._pushAudio=e,e&&this.beginSendFrame(hB.AUDIO,fB.PUSH),!e&&this._audioSending&&this.stopSendFrame(hB.AUDIO,pB.STOP_PUSH))}},{key:"setExternalVideoSource",value:function(e){this._videoExternal!==e&&(this._videoExternal=e,e&&(this._videoSending&&this.stopSendFrame(hB.VIDEO,pB.DISABLE),this._enableVideo=!1),e||(this._videoSending&&this.stopSendFrame(hB.VIDEO,pB.STOP_PUSH),this._pushVideo=!1))}},{key:"setPushVideo",value:function(e){this._pushVideo!==e&&(this._pushVideo=e,e&&this.beginSendFrame(hB.VIDEO,fB.PUSH),!e&&this._videoSending&&this.stopSendFrame(hB.VIDEO,pB.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(hB.AUDIO,pB.AUDIENCE),!e&&this._videoSending&&this.stopSendFrame(hB.VIDEO,pB.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=u(o().mark((function e(){var t,r,n,i,a,s,u,c;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,Dj(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 u=e.sent,c=u.find((function(e){return"outbound-rtp"===e.type})),e.abrupt("return",c);case 6:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"_getFirstAudioFrameStats",value:(t=u(o().mark((function e(){var t,r,n,i,a,s,u,c;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,Dj(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 u=e.sent,c=u.find((function(e){return"outbound-rtp"===e.type})),e.abrupt("return",c);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.setInterval(u(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(hB.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.setInterval(u(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(hB.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:fB.LOGIN},this._currentVideoSend={startTime:0,eventSessionId:0,type:fB.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}(),uW=(h(iW={},"audio",{delay:1200,stallRadio:.3}),h(iW,"video",{delay:1200,stallRadio:.6}),h(iW,"screen_audio",{delay:1600,stallRadio:.8}),h(iW,"screen_video",{delay:1600,stallRadio:.8}),iW),cW=function(){function e(){c(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",eq.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,u=this._getQosLevel(o,a||0,s||0),c=this._preUplinkStats.get(i)||[u];this._preUplinkStats.set(i,[].concat(k(c),[u]).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,u=e.videoStats,c=e.isScreen,d=e.userId;if(o)if(0===s.receivedKBitrate)r=W.VBAD;else{var l=s.rtt,h=s.audioLossRate,f=s.stallDuration,p=s.statsInterval,v=s.e2eDelay,_=f/p,m=c?"screen_audio":"audio",y=this._getQosLevel(l,h||0,u._retransmittedRate||0),g=this._getDownlinkQoE(m,_,v);r=this._getNetworkQuality(y,g)}if(a)if(0===u.receivedKBitrate||0===u.rtt)n=W.VBAD;else{var S=u.rtt,b=u.videoLossRate,E=u.stallDuration,T=u.statsInterval,I=u.e2eDelay,R=u._retransmittedRate,A=E/T,w=c?"screen_video":"video",C=this._getQosLevel(S,b||0,R||0),O=this._getDownlinkQoE(w,A,I);n=this._getNetworkQuality(C,O)}var x=r&&n?Math.ceil((r+n)/2):r||n;if(x){var N="".concat(d).concat(c?"_screen":""),D=this._preDownlinkStats.get(N)||[x];this._preDownlinkStats.set(N,[].concat(k(D),[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!==eq.CONNECTED)e=t=W.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")||W.UNKNOWN;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)||W.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=uW[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=W.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&&wP(t)&&r.localaudio&&r.audiostream,videoActive:n&&CP(t)&&r.localvideo&&r.videostream}}}]),e}(),dW=function(){function e(t){c(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,u=s[i]||{},c=u.width,d=void 0===c?0:c,l=u.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}(),lW=new LL("SubscribeFallbackManager",2),hW=1e4,fW=function(){function e(t){c(this,e),h(this,"_preDownlinkNetworkQuality",[]),h(this,"_isSubscribeFallbackOrRecover",!1),h(this,"_inSubscribeRecoverChecking",!1),h(this,"_subRecoverCheckTimer",void 0),h(this,"_forbidSubRecover",!1),h(this,"_forbidSubRecoverTimer",void 0),h(this,"_forbidSubRecoverDuration",hW),h(this,"onSubscribeFallback",void 0),this._room=t}var t;return l(e,[{key:"updateNetworkQuality",value:function(e,t){this._preDownlinkNetworkQuality.push(t),this._preDownlinkNetworkQuality=this._preDownlinkNetworkQuality.slice(-10),this._inSubscribeRecoverChecking&&this._preDownlinkNetworkQuality.find((function(e){return e===W.BAD||e===W.VBAD}))&&this._startForbidSubRecover(),this._preDownlinkNetworkQuality.slice(-3).reduce((function(e,t){return e+t}),0)>3*W.POOR&&this._subscribeFallbackOrRecover("fallback"),!this._forbidSubRecover&&10===this._preDownlinkNetworkQuality.length&&this._preDownlinkNetworkQuality.every((function(e){return e===W.EXCELLENT}))&&this._subscribeFallbackOrRecover("recover")}},{key:"destroy",value:function(){this._stopSubscribeRecoverCheck(),this._stopForbidSubRecover(),delete this.onSubscribeFallback}},{key:"_subscribeFallbackOrRecover",value:(t=u(o().mark((function e(t){var r,n,i,a,s,u,c,d,l,h,f=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._isSubscribeFallbackOrRecover&&this._room.connectionState===eq.CONNECTED){e.next=2;break}return e.abrupt("return");case 2:if(this._room.subscribeFallbackOption!==K.AUDIO_ONLY&&this._room.subscribeFallbackOption!==K.VIDEO_STREAM_LOW){e.next=24;break}if(r=new Map,this._room.remoteStreams.forEach((function(e){e.forEach((function(e){if(e.hasSubscribed){var n="fallback"===t?e.getSubscribeFallbackParams(f._room.subscribeFallbackOption):e.getSubscribeRecoverParams();if(n){var i=e.getStreamPriority(),o=r.get(i)||[];o.push({stream:e,fallbackOrRecoverOption:n}),r.set(i,o)}}}))})),!(r.size>0)){e.next=24;break}if(lW.print("_subscribeFallbackOrRecover()","start subscribe ".concat(t,".")),n=Array.from(r.keys()).sort((function(e,t){return e-t}))["fallback"===t?0:r.size-1],i=r.get(n)||[],a=E(i,1),!(s=a[0])){e.next=24;break}return u=s.stream,c=s.fallbackOrRecoverOption,this._isSubscribeFallbackOrRecover=!0,d=u.subLayer.spatialLayer,l=u.subVideo,lW.print("_subscribeFallbackOrRecover()","".concat(u.userId,"'s stream will be ").concat(t," to: MediaType=").concat(c[0]," subState=").concat(c[1]," subLayer=").concat(c[2])),e.prev=15,e.next=18,RP([(h=this._room).updateSubTrack.apply(h,[u].concat(k(c))).then((function(){"recover"===t?f._startSubscribeRecoverCheck():lW.print("_subscribeFallbackOrRecover()","fallback success."),"function"==typeof f.onSubscribeFallback&&f.onSubscribeFallback({userId:u.userId,isScreen:u.isScreen,beforeEnable:l,beforeVideoIndex:d,afterEnable:u.subVideo,afterVideoIndex:u.subLayer.spatialLayer,reason:"fallback"===t?Y.SubscribeFallbackByBandwidth:Y.SubscribeRecoverByBandwidth})})),vP(2e3)]);case 18:e.next=22;break;case 20:e.prev=20,e.t0=e.catch(15);case 22:this._preDownlinkNetworkQuality=[],this._isSubscribeFallbackOrRecover=!1;case 24:case"end":return e.stop()}}),e,this,[[15,20]])}))),function(e){return t.apply(this,arguments)})},{key:"_startSubscribeRecoverCheck",value:function(){var e=this;this._stopSubscribeRecoverCheck(),this._inSubscribeRecoverChecking=!0,this._subRecoverCheckTimer=window.setTimeout((function(){e._inSubscribeRecoverChecking=!1,e._forbidSubRecoverDuration=hW,delete e._subRecoverCheckTimer,lW.print("_subscribeFallbackOrRecover()","recover success.")}),2e4)}},{key:"_stopSubscribeRecoverCheck",value:function(){this._subRecoverCheckTimer&&(window.clearTimeout(this._subRecoverCheckTimer),delete this._subRecoverCheckTimer),this._inSubscribeRecoverChecking=!1}},{key:"_startForbidSubRecover",value:function(){var e=this;this._stopSubscribeRecoverCheck(),this._stopForbidSubRecover(),this._forbidSubRecoverDuration=Math.min(this._forbidSubRecoverDuration+2e4,12e4),lW.print("_subscribeFallbackOrRecover()","subscribe-recover failed, and subscribe-recover not allowed within ".concat(this._forbidSubRecoverDuration/1e3,"s")),this._forbidSubRecover=!0,this._forbidSubRecoverTimer=window.setTimeout((function(){e._forbidSubRecover=!1,delete e._forbidSubRecoverTimer}),this._forbidSubRecoverDuration)}},{key:"_stopForbidSubRecover",value:function(){this._forbidSubRecoverTimer&&(window.clearTimeout(this._forbidSubRecoverTimer),delete this._forbidSubRecoverTimer)}}]),e}(),pW=new LL("Room",1),vW=function(e){f(L,e);var t,r,n,a,s,d,p,v,_,y,S,b,k,T,I,A,w,C,x,N,D,M=g(L);function L(e,t){var r;return c(this,L),h(m(r=M.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),"_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),"_roomConfig",void 0),h(m(r),"_roomInfo",void 0),h(m(r),"_waitForNewToken",!1),h(m(r),"_userDuplicateLoginTimerMap",new Map),h(m(r),"_networkQualityManager",void 0),h(m(r),"userPriorityMap",void 0),h(m(r),"subscribeFallbackOption",void 0),h(m(r),"_videoSizeObserver",void 0),h(m(r),"_subFallbackManager",void 0),h(m(r),"_hasPublished",!1),r._roomConfig=e,r._mediaServerClient=new rq(t),r._reconnectRecord=new _W,r._addHandlerEventHandler(),r._isReconnecting=!1,r._networkQualityManager=new cW,r._networkQualityManager.reportor=r._reportNetworkQuality.bind(m(r)),r._videoSizeObserver=new dW(m(r)),r._videoSizeObserver.onchange=r._emitVideoSizeChange.bind(m(r)),r._subFallbackManager=new fW(m(r)),r._subFallbackManager.onSubscribeFallback=r._emitSubscribeFallback.bind(m(r)),r._context=t,r}return l(L,[{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,u,c,d,l,h,f,p,v,_,m,y,g,S,b,E,k,T,I,R=this;null===(e=this._mediaServerClient)||void 0===e||e.on(oj.ON_ADD_STREAM,this._onAddStream.bind(this)),null===(t=this._mediaServerClient)||void 0===t||t.on(oj.ON_REMOVE_STREAM,this._onRemoveStream.bind(this)),null===(r=this._mediaServerClient)||void 0===r||r.on(oj.USER_CONNECTION,this._onUserConnection.bind(this)),null===(n=this._mediaServerClient)||void 0===n||n.on(oj.USER_DISCONNECTION,this._onUserDisconnection.bind(this)),null===(i=this._mediaServerClient)||void 0===i||i.on(oj.ON_UPDATE_ROOM_ATTRIBUTES,this._onUpdateRoomAttributes.bind(this)),null===(o=this._mediaServerClient)||void 0===o||o.on(oj.ON_UPDATE_USER_ATTRIBUTES,this._onUpdateUserAttributes.bind(this)),null===(a=this._mediaServerClient)||void 0===a||a.on(oj.ON_UPDATE_STREAM_ATTRIBUTES,this._onUpdateStreamAttributes.bind(this)),null===(s=this._mediaServerClient)||void 0===s||s.on(oj.ON_PUSH_TRACK,this._onPushTrack.bind(this)),null===(u=this._mediaServerClient)||void 0===u||u.on(oj.ON_REMOVE_TRACK,this._onRemoveTrack.bind(this)),null===(c=this._mediaServerClient)||void 0===c||c.on(oj.NODE_CHANGE,this._nodeChange.bind(this)),null===(d=this._mediaServerClient)||void 0===d||d.on(oj.ON_CUSTOM_MESSAGE,this._onCustomMessage.bind(this)),null===(l=this._mediaServerClient)||void 0===l||l.on(oj.USER_MESSAGE_RECEIVED,this._onUserMessageReceived.bind(this)),null===(h=this._mediaServerClient)||void 0===h||h.on(oj.USER_BINARY_MESSAGE_RECEIVED,this._onUserBinaryMessageReceived.bind(this)),null===(f=this._mediaServerClient)||void 0===f||f.on(oj.POST_PROCESSING_MESSAGE,this._onPostProcessingMessage.bind(this)),null===(p=this._mediaServerClient)||void 0===p||p.on(oj.ON_USER_TOKEN_WILL_EXPIRE,this._onUserTokenWillExpire.bind(this)),null===(v=this._mediaServerClient)||void 0===v||v.on(oj.STREAM_CONTROL_MESSAGE,this._onStreamControlMessage.bind(this)),null===(_=this._mediaServerClient)||void 0===_||_.on(oj.ON_SCENE_CONFIG,this._onSceneConfig.bind(this)),null===(m=this._mediaServerClient)||void 0===m||m.on(oj.ON_STREAM_FAILED,this._onStreamFailed.bind(this)),null===(y=this._mediaServerClient)||void 0===y||y.on(aj.RSCP,this._onPublishOnDemand.bind(this)),null===(g=this._mediaServerClient)||void 0===g||g.on(aj.RTT,this._onRTT.bind(this)),null===(S=this._mediaServerClient)||void 0===S||S.on(sj.ON_CONNECTION_STATE_CHANGE,this._onConnectionStateChange.bind(this)),null===(b=this._mediaServerClient)||void 0===b||b.on(sj.ABNORMAL_DISCONNECTION,this._handleAbnormalDisconnection.bind(this)),null===(E=this._mediaServerClient)||void 0===E||E.on("onRemoteStreamStats",(function(e){R._networkQualityManager.updateDownlinkStats(e,R._findRemoteStreamByScreen(e.userId,e.isScreen)),R.emit(Iz.ON_REMOTE_STREAM_STATS,OP(e))})),null===(k=this._mediaServerClient)||void 0===k||k.on("onLocalStreamStats",(function(e){R._networkQualityManager.updateUplinkStats(e),R.emit(Iz.ON_LOCAL_STREAM_STATS,OP(e))})),null===(T=this._mediaServerClient)||void 0===T||T.on("prevIceNode",(function(e){R._getAccessFeedbackIceNode=e})),null===(I=this._mediaServerClient)||void 0===I||I.on("prevIceNode",(function(e){R._getAccessFeedbackIceNode=e}))}},{key:"_removeHandlerEventHandler",value:function(){var e;null===(e=this._mediaServerClient)||void 0===e||e.removeAllListeners()}},{key:"join",value:(D=u(o().mark((function e(t,r,n,i,a,s,u){var c=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return wB.setStats({rtc_app_id:t,room_id:r,user_id:i.userId}),oW.setStats({rtc_session_id:t,rtc_room_id:r}),pW.print("join()"),e.abrupt("return",new Promise((function(e,o){var d,l,h=lP();c._joinResolveCallback=function(t){var r;IB.joinRoom(_B.END,h,!0,"",{enable_cloud_proxy:null===(r=c._roomInfo)||void 0===r?void 0:r.useCloudProxy}),e(t)},c._joinRejectCallback=function(e){var t;IB.joinRoom(_B.END,h,!1,e.message,{enable_cloud_proxy:null===(t=c._roomInfo)||void 0===t?void 0:t.useCloudProxy}),o(e)},c._liveControlMessage=a,c._roomInfo={appId:t,roomId:r,token:n,userInfo:i,useCloudProxy:s,roomProfile:c._roomConfig.roomProfileType,expectedIDC:u},c.setSessionId(),IB.joinRoom(_B.BEGIN,h,!1,"",{enable_cloud_proxy:null===(d=c._roomInfo)||void 0===d?void 0:d.useCloudProxy,expectedIDC:null===(l=c._roomInfo)||void 0===l?void 0:l.expectedIDC}),c._join(c._joinResolveCallback,c._joinRejectCallback,!1)})));case 4:case"end":return e.stop()}}),e)}))),function(e,t,r,n,i,o,a){return D.apply(this,arguments)})},{key:"_join",value:(N=u(o().mark((function e(t,r){var n,i,a,s=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=s.length>2&&void 0!==s[2]&&s[2],i=lP(),pW.print("_join()"),e.prev=3,e.next=6,this._mediaServerClient.join(this._roomInfo,{node:this._getAccessNode,reason:this._getAccessFeedback,sessionId:this._sessionId,feedbackNode:this._getAccessFeedbackIceNode},n,this._liveControlMessage);case 6:a=e.sent,this._mediaServerClient.roomAttributes=a.roomAttributes,this._reconnectRecord.clear(),this._joinResolveCallback=void 0,this._joinRejectCallback=void 0,this._getAccessFeedback=void 0,this._getAccessNode=void 0,"function"==typeof t&&t({users:a.clients,streams:a.streams}),this._isReconnecting=!1,IB.rtcJoinRoom(0,"web","web",lP()-i),this._onJoinSucc(a,n),e.next=23;break;case 19:if(e.prev=19,e.t0=e.catch(3),e.t0.code===JN.OPERATION_CANCEL||"function"!=typeof r){e.next=23;break}return e.abrupt("return",r(e.t0));case 23:case"end":return e.stop()}}),e,this,[[3,19]])}))),function(e,t){return N.apply(this,arguments)})},{key:"publishScreen",value:(x=u(o().mark((function e(t,r,n,i,a){var s,u,c,d,l,h,f,p,v,_;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(pW.print("publishScreen()"),this._localScreenStream||(this._localScreenStream=new xz,this._localScreenStream.isScreen=!0,this._mediaServerClient.handler&&(this._localScreenStream.observer=new sW(this._localScreenStream,this._mediaServerClient.handler))),s=!1,u=!1,c=!1,d=!1,!this._localScreenStream.videoTrack&&r?(r instanceof VH&&(u=!0),s=!0):this._localScreenStream.videoTrack&&!r&&(s=!1),!this._localScreenStream.audioTrack&&n?(n instanceof FH&&(d=!0),c=!0):this._localScreenStream.audioTrack&&!n&&(c=!1),this._localScreenStream.videoTrack=r,this._localScreenStream.audioTrack=n,this._localScreenStream.videoEncodeConfig=t,i&&(wP(i)&&(this._localScreenStream.pubAudio=a===Az.PUB),CP(i)&&(this._localScreenStream.pubVideo=a===Az.PUB),pW.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 u?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(c):null===(_=this._localScreenStream.observer)||void 0===_||_.setEnableAudio(c),e.next=28,this.updatePubScreenTrack();case 28:case"end":return e.stop()}}),e,this)}))),function(e,t,r,n,i){return x.apply(this,arguments)})},{key:"updatePubScreenTrack",value:(C=u(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(pW.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 C.apply(this,arguments)})},{key:"unpublishScreen",value:(w=u(o().mark((function e(){var t;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(pW.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 w.apply(this,arguments)})},{key:"liveControlMessage",value:(A=u(o().mark((function e(t){var r,n=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return pW.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;case 6:case"end":return e.stop()}}),e,this)}))),function(e){return A.apply(this,arguments)})},{key:"publicStreamControlMessage",value:(I=u(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 I.apply(this,arguments)})},{key:"updateUserAttributes",value:(T=u(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return pW.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 T.apply(this,arguments)})},{key:"publish",value:(k=u(o().mark((function e(t,r,n,i,a,s){var u,c,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(u=S.length>6&&void 0!==S[6]&&S[6],pW.print("publish","Invoke publish"),c=!1,this._localStream||(this._localStream=new xz,this._mediaServerClient.handler&&(this._localStream.observer=new sW(this._localStream,this._mediaServerClient.handler)),c=!0),this._localStream.videoTrack=n,this._localStream.audioTrack=i,this._localStream.videoEncodeConfig=t,this._localStream.enableSimulcast=r,a&&(wP(a)&&(this._localStream.pubAudio=s===Az.PUB),CP(a)&&(this._localStream.pubVideo=s===Az.PUB),pW.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,u?null===(d=this._localStream.observer)||void 0===d||d.setLogin(!0):c&&(l=!!this._localStream.videoTrack,h=!!this._localStream.audioTrack,f=this._localStream.videoTrack instanceof VH,p=this._localStream.audioTrack instanceof FH,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(Iz.ON_PUBLISH_RESULT,{isScreen:!1,state:P.PUBLISH_SUCC}),e.next=24;break;case 20:throw e.prev=20,e.t0=e.catch(12),this.emit(Iz.ON_PUBLISH_RESULT,{isScreen:!1,state:P.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 k.apply(this,arguments)})},{key:"updatePubTrack",value:(b=u(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(pW.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 b.apply(this,arguments)})},{key:"unpublish",value:(S=u(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(pW.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 S.apply(this,arguments)})},{key:"subscribe",value:(y=u(o().mark((function e(t,r,n){var i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return pW.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 y.apply(this,arguments)})},{key:"updateSubTrack",value:(_=u(o().mark((function e(t,r,n,i){var a;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return pW.print("updateSubTrack","Invoke updateSubTrack"),e.abrupt("return",null===(a=this._mediaServerClient)||void 0===a?void 0:a.updateSubTrack(t,r,n,i));case 2:case"end":return e.stop()}}),e,this)}))),function(e,t,r,n){return _.apply(this,arguments)})},{key:"updateSubVideoConfig",value:(v=u(o().mark((function e(t,r){var n,i,a,s,u;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 u=this._getSubLayer(r,s),s.originalStreamIndex=u.spatialLayer,e.abrupt("return",null===(a=this._mediaServerClient)||void 0===a?void 0:a.updateSubTrack(s,s.subMediaType,wz.SUB,u));case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return v.apply(this,arguments)})},{key:"_getSubLayer",value:function(e,t){for(var r,n,i,o,a,s=null==t?void 0:t.attributes,u=s.videoDescriptions,c=s.subVideoDescriptions,d=Array.isArray(c)?c:u,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:(p=u(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return pW.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 p.apply(this,arguments)})},{key:"leave",value:(d=u(o().mark((function e(){var t,r,n,i,a,s,u=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=u.length>0&&void 0!==u[0]&&u[0],pW.print("leave","Invoke leave"),r=lP(),e.prev=3,this._mediaServerClient.connectionState!==eq.CONNECTED&&this._joinRejectCallback&&this._joinRejectCallback(new Error(mB.LEAVE_ROOM)),clearTimeout(this._reconnectTimer),n=R(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(),IB.rtcLeaveRoom(0,"",lP()-r),e.next=23;break;case 15:if(e.prev=15,e.t0=e.catch(3),!t){e.next=21;break}throw e.t0;case 21:this.destroy();case 22:e.t0 instanceof Error&&IB.rtcLeaveRoom(-1,e.t0.message,lP()-r);case 23:case"end":return e.stop()}}),e,this,[[3,15]])}))),function(){return d.apply(this,arguments)})},{key:"setRemoteUserPriority",value:function(e,t){var r,n;null===(r=this.remoteStreams.get(e))||void 0===r||r.forEach((function(e){return e.setRemoteUserPriority(t)})),null===(n=this.userPriorityMap)||void 0===n||n.set(e,t)}},{key:"destroy",value:function(){pW.print("destroy","Invoke destroy"),this._destroyAndInitMediaServerClient(),this._roomInfo=void 0,this._remoteUsers=new Map;var e,t,r,n=R(this._remoteStreams);try{for(n.s();!(e=n.n()).done;){var i=E(e.value,2)[1];Array.isArray(i)&&i.forEach((function(e){e&&e.clean()}))}}catch(o){n.e(o)}finally{n.f()}(this._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 _W,this._removeHandlerEventHandler(),clearTimeout(this._connectionLostTimer),this._userDuplicateLoginTimerMap.forEach((function(e){clearTimeout(e)})),this._userDuplicateLoginTimerMap.clear(),this._networkQualityManager.destroy(),this._videoSizeObserver.destroy(),this._subFallbackManager.destroy(),this._remoteStreamStreamIdUserIdMap={}}},{key:"updateToken",value:(s=u(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return pW.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 s.apply(this,arguments)})},{key:"pauseAllSubscribedStream",value:(a=u(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:r=[],n=R(this._remoteStreams.values());try{for(n.s();!(i=n.n()).done;)a=i.value,Array.isArray(a)&&a.forEach((function(e){if(e.hasSubscribed){var n=s.updateSubTrack(e,t,wz.UNSUB);n&&r.push(n)}}))}catch(o){n.e(o)}finally{n.f()}return e.abrupt("return",Promise.all(r));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"resumeAllSubscribedStream",value:(n=u(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:r=[],n=R(this._remoteStreams.values());try{for(n.s();!(i=n.n()).done;)a=i.value,Array.isArray(a)&&a.forEach((function(e){if(e.hasSubscribed&&e.hasSubscribed){var n=s.updateSubTrack(e,t,wz.SUB);n&&r.push(n)}}))}catch(o){n.e(o)}finally{n.f()}return e.abrupt("return",Promise.all(r));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"sendUserMessage",value:function(e,t){var r;return null===(r=this._mediaServerClient)||void 0===r?void 0:r.sendUserMessage(e,t)}},{key:"setSessionId",value:function(){this._sessionId=sP(),wB.setStats({rtc_session_id:this._sessionId}),oW.setStats({rtc_session_id:this._sessionId})}},{key:"sendRoomMessage",value:(r=u(o().mark((function e(t){var r,n,i,a,s=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=s.length>1&&void 0!==s[1]&&s[1],a={clientId:null===(r=this._roomInfo)||void 0===r?void 0:r.userInfo.userId,binary:i,message:""},!i){e.next=8;break}return e.next=5,pP.ab2b64str(t);case 5:a.message=e.sent,e.next=9;break;case 8:a.message=t;case 9:return e.abrupt("return",null===(n=this._mediaServerClient)||void 0===n?void 0:n.sendRoomMessage(a));case 10:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"_destroyAndInitMediaServerClient",value:function(){pW.print("_destroyAndInitMediaServerClient()"),this._mediaServerClient&&(this._mediaServerClient.destroy(),this._removeHandlerEventHandler()),this._mediaServerClient=new rq(this._context),this._addHandlerEventHandler()}},{key:"_onJoinSucc",value:function(e,t){var r,n=this;pW.print("JoinSuccess()"),this._serverConfig=e.config;var i=[],o=[],a=[],s=[],u=[];null===(r=e.clientsDetail)||void 0===r||r.forEach((function(t){if(t.attributes&&(t.attributes.serverMuteVideo&&n.safeEmit(Iz.ON_VIDEO_STREAM_BANNED,{uid:t.clientId,banned:1===t.attributes.serverMuteVideo}),t.attributes.serverMuteAudio&&n.safeEmit(Iz.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 c,d=R(this._remoteUsers.values());try{for(d.s();!(c=d.n()).done;){var l=c.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,u.push(e)):s.push(e)}));var h,f=R(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:nj.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,!0,!1)})),u.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=this._roomConfig,n=r.isAutoSubscribeAudio,i=r.isAutoSubscribeVideo,a=R(this._remoteStreams.values());try{for(a.s();!(t=a.n()).done;){var s=t.value;Array.isArray(s)&&s.forEach(function(){var t=u(o().mark((function t(r){var a,s;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(a=r.hasSubscribed,s=r.subMediaType,a||!n&&!i||(a=!0,n&&(s|=V.AUDIO),i&&(s|=V.VIDEO)),!a){t.next=18;break}return r.resetHasSubscribed(),t.prev=5,pW.print("start resubscribe ".concat(r.userId," with ").concat(s)),t.next=9,e._mediaServerClient.subscribe(r,s);case 9:pW.print("success resubscribe ".concat(r.userId," with ").concat(s)),e.safeEmit(Iz.RESUBSCRIBE,{stream:r}),t.next=18;break;case 13:t.prev=13,t.t0=t.catch(5),pW.print("failed resubscribe ".concat(r.userId," with ").concat(s,", error:").concat(t.t0)),r.clean(),null==r||r.resetHasSubscribed();case 18:case"end":return t.stop()}}),t,null,[[5,13]])})));return function(e){return t.apply(this,arguments)}}())}}catch(c){a.e(c)}finally{a.f()}}},{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=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(e.clientId!==(null===(t=this._roomInfo)||void 0===t?void 0:t.userInfo.userId)){var i=this._roomConfig,o=i.isAutoSubscribeAudio,a=i.isAutoSubscribeVideo,s=this._findRemoteStreamByScreen(e.clientId,e.screen);if(s&&s.streamId!==e.streamId){var u,c=null===(u=this._remoteStreams.get(e.clientId))||void 0===u?void 0:u.filter((function(e){return e.streamId!==s.streamId}));s.clean(),this._remoteStreams.set(e.clientId,c||[])}var d=this._findRemoteStream(e.clientId,e.streamId);if(this._remoteStreamStreamIdUserIdMap[e.streamId]=e.clientId,d)d.attributes=e.attributes;else{var l;d=new Nz(e.clientId,e.streamId,e.screen,e.attributes,null===(l=this.userPriorityMap)||void 0===l?void 0:l.get(e.clientId)),this._initStreamListeners(d);var h=this._remoteStreams.get(e.clientId);h?h.push(d):this._remoteStreams.set(e.clientId,[d])}if(this._mediaServerClient.handler&&(d.observer=new aW(d,this._mediaServerClient.handler)),!d.isScreen&&a){var f,p,v,_,m,y,g,S;if(n&&d.hasVideo)if(d.attributes.extvideo)null===(f=d.observer)||void 0===f||f.setExternalVideoSource(!0),null===(p=d.observer)||void 0===p||p.setPushVideo(!0);else null===(v=d.observer)||void 0===v||v.setExternalVideoSource(!1),null===(_=d.observer)||void 0===_||_.setPublishVideo(!0);if(n&&d.hasAudio&&o&&!this._mediaServerClient.roomAttributes.multiChatMode)if(d.attributes.extaudio)null===(m=d.observer)||void 0===m||m.setExternalAudioSource(!0),null===(y=d.observer)||void 0===y||y.setPushAudio(!0);else null===(g=d.observer)||void 0===g||g.setExternalAudioSource(!1),null===(S=d.observer)||void 0===S||S.setPublishAudio(!0);if(!0===r&&!1===n){var b,E=this._roomConfig,k=E.isAutoSubscribeAudio,T=E.isAutoSubscribeVideo;null===(b=d.observer)||void 0===b||b.setLogin(!0,{audio:!!k,video:!!T})}}return r&&this.safeEmit(oj.ON_ADD_STREAM,{stream:d}),d}}},{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(oj.USER_CONNECTION,{userInfo:n}),e.attributes&&(e.attributes.serverMuteVideo&&this.safeEmit(Iz.ON_VIDEO_STREAM_BANNED,{uid:e.clientId,banned:1===e.attributes.serverMuteVideo}),e.attributes.serverMuteAudio&&this.safeEmit(Iz.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===uj.kickedByAdmin?a=JN.KICKED_OUT:i===uj.onUserTokenDidExpire?a=JN.TOKEN_EXPIRED:i===uj.userDuplicateLogin&&(a=JN.DUPLICATE_LOGIN),o===cj.roomDismissByAdmin&&(a=JN.ROOM_DISMISS),a&&this.safeEmit(Iz.ON_ROOM_ERROR,{errorCode:a})}else{var s=O.DROPPED;i===uj.userLeave?s=O.QUIT:i===uj.kickedByAdmin?s=O.KICKED_BY_ADMIN:i===uj.roleChanged&&(s=O.SWITCH_TO_INVISIBLE);var u=function(){var e;r._remoteUsers.delete(n),null===(e=r._remoteStreams.get(n))||void 0===e||e.forEach((function(e){r._onRemoveStream({clientId:e.userId,streamId:e.streamId,message:"client disconnected"})})),r._remoteStreams.delete(n),r.safeEmit(Iz.ON_USER_LEAVE,{userInfo:{userId:n},reason:s})};if(i===uj.userDuplicateLogin){var c=this._userDuplicateLoginTimerMap.get(n);c&&self.clearTimeout(c);var d=self.setTimeout(u,5e3);this._userDuplicateLoginTimerMap.set(n,d)}else u()}}},{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(){if(null==i||!i._workaround_1_){var t=r._remoteStreams.get(e.clientId);if(!t)return;t=t.filter((function(t){return t.streamId!==e.streamId})),r._remoteStreams.set(e.clientId,t)}})).finally((function(){r.safeEmit(oj.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(Iz.ON_VIDEO_STREAM_BANNED,{uid:e.clientId,banned:1===e.attributes.serverMuteVideo}),e.attributes.serverMuteAudio&&this.safeEmit(Iz.ON_AUDIO_STREAM_BANNED,{uid:e.clientId,banned:1===e.attributes.serverMuteAudio}))}},{key:"_onUpdateRoomAttributes",value:function(e){e.roomAttributes&&(this._mediaServerClient.roomAttributes=i(i({},this._mediaServerClient.roomAttributes),e.roomAttributes))}},{key:"_onUpdateStreamAttributes",value:function(e){var t=this._roomConfig,r=t.isAutoSubscribeAudio,n=t.isAutoSubscribeVideo,o=e.clientId,a=e.streamId,s=e.attributes,u=this._findRemoteStream(o,a);if(u){var c,d,l=u.attributes,h=i(i({},l),s),f=!1,p=h.localaudio!==l.localaudio,v=!1,_=!1,m=h.localvideo!==l.localvideo,y=!1,g=cz.NONE,S=cz.NONE;if(h.audiostream!==l.audiostream&&(f=h.localaudio,v=!!h.audiostream,h.audiostream?g|=V.AUDIO:S|=V.AUDIO),h.videostream!==l.videostream&&(_=h.localvideo,y=!!h.videostream,h.videostream?g|=V.VIDEO:S|=V.VIDEO),g&&this.safeEmit(Iz.ON_USER_PUBLISH_STATE_CHANGE,{userId:o,mediaType:g,isScreen:u.isScreen,pubState:Az.PUB,remoteStream:u}),S&&this.safeEmit(Iz.ON_USER_PUBLISH_STATE_CHANGE,{userId:o,mediaType:S,isScreen:u.isScreen,pubState:Az.UNPUB,remoteStream:u}),u.attributes=h,h.localaudio!==l.localaudio)if(h.localaudio){var b,E,k,T;if(r)if(h.extaudio)null===(b=u.observer)||void 0===b||b.setExternalAudioSource(!0),null===(E=u.observer)||void 0===E||E.setPushAudio(!0);else null===(k=u.observer)||void 0===k||k.setExternalAudioSource(!1),null===(T=u.observer)||void 0===T||T.setEnableAudio(!0);this.safeEmit(Iz.ON_USER_START_AUDIO_CAPTURE,{userId:o},u)}else{var I,R,A,w;if(h.extaudio)null===(I=u.observer)||void 0===I||I.setExternalAudioSource(!0),null===(R=u.observer)||void 0===R||R.setPushAudio(!1);else null===(A=u.observer)||void 0===A||A.setExternalAudioSource(!1),null===(w=u.observer)||void 0===w||w.setEnableAudio(!1);!u.isScreen&&this.safeEmit(Iz.ON_USER_STOP_AUDIO_CAPTURE,{userId:o})}if(h.localvideo!==l.localvideo)if(h.localvideo){var C,O,x,N;if(n)if(h.extvideo)null===(C=u.observer)||void 0===C||C.setExternalVideoSource(!0),null===(O=u.observer)||void 0===O||O.setPushVideo(!0);else null===(x=u.observer)||void 0===x||x.setExternalVideoSource(!1),null===(N=u.observer)||void 0===N||N.setEnableVideo(!0);this.safeEmit(Iz.ON_USER_START_VIDEO_CAPTURE,{userId:o})}else{var D,P,M,L;if(h.extvideo)null===(D=u.observer)||void 0===D||D.setExternalVideoSource(!0),null===(P=u.observer)||void 0===P||P.setPushVideo(!1);else null===(M=u.observer)||void 0===M||M.setExternalVideoSource(!1),null===(L=u.observer)||void 0===L||L.setEnableVideo(!1);!u.isScreen&&this.safeEmit(Iz.ON_USER_STOP_VIDEO_CAPTURE,{userId:o})}if(f&&!p)null===(c=u.observer)||void 0===c||c.setRemoteUnmuteAudio(v);if(_&&!m)null===(d=u.observer)||void 0===d||d.setRemoteUnmuteVideo(y)}}},{key:"_onPushTrack",value:function(e){var t=this,r=e.clientId,n=e.streamId,i=this._findRemoteStream(r,n);i||(i=this._onAddStream(e,!1,!1)),this._mediaServerClient.subscribe4pushTrack(i,e).then((function(){return t.safeEmit(Iz.SUBSCRIBE_PUSH_TRACK,{stream:i})})).catch((function(e){pW.print("subscribe push track failed: ".concat(e))}))}},{key:"_onRemoveTrack",value:function(e){var t=this,r=e.clientId,n=e.streamId,i=e.message,o=this._findRemoteStream(r,n);o&&this._mediaServerClient.unsubscribe4removeTrack(o,i).then((function(){if(o._workaround_1_){var e,i=null===(e=t._remoteStreams.get(r))||void 0===e?void 0:e.filter((function(e){return e.streamId!==n}));t._remoteStreams.set(r,i||[])}t.safeEmit(Iz.REMOVE_PUSH_TRACK,{stream:o})})).catch((function(e){pW.print("remove push track failed: ".concat(e))}))}},{key:"_nodeChange",value:function(e){var t,r=e.nodes,n=e.reason;HB.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,IB.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=R(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()}IB.rtcReconnect(1002,qF.PEERCONNECTION_RECONNECTING,this._roomInfo.userInfo.userId,KF.PEERCONNECTION),this._join((function(){IB.rtcReconnected(XF.PEERCONNECTION_RECONNECTED,WF.PEERCONNECTION)}),(function(t){e._reconnectRecord.record(t),e._reconnectRecord.shouldReconnect?(pW.print("Reconnecting error, will reconnect after 3s",t),e._reconnectTimer=window.setTimeout(e._reconnect.bind(e),3e3)):(e.safeEmit(Iz.RECONNECT_FAILED),e.destroy())}),!0)}},{key:"_handleAbnormalDisconnection",value:function(){pW.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===eq.DISCONNECTED)t=B.CONNECTION_STATE_DISCONNECTED;else if(e.next===eq.CONNECTED)clearTimeout(this._connectionLostTimer),t=this._isReconnecting?B.CONNECTION_STATE_RECONNECTED:B.CONNECTION_STATE_CONNECTED;else{if(e.next!==eq.CONNECTING)return;t=this._isReconnecting?B.CONNECTION_STATE_RECONNECTING:B.CONNECTION_STATE_CONNECTING}e.prev===eq.CONNECTED&&e.next===eq.DISCONNECTED&&(this._connectionLostTimer=window.setTimeout((function(){r.safeEmit(sj.ON_CONNECTION_STATE_CHANGE,{state:B.CONNECTION_STATE_LOST})}),1e4)),this._networkQualityManager.setConnectionState(e.next),this.safeEmit(sj.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(Iz.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?U.STREAM_INDEX_SCREEN:U.STREAM_INDEX_MAIN}})}))}},{key:"_onCustomMessage",value:function(e){this.safeEmit(oj.ON_CUSTOM_MESSAGE,e)}},{key:"_onUserMessageReceived",value:function(e){this.safeEmit(oj.USER_MESSAGE_RECEIVED,{userId:e.from,message:e.msg})}},{key:"_onUserBinaryMessageReceived",value:function(e){this.safeEmit(oj.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=Rz.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=Rz.START_FAILED);break;case"TranscodeStateChanged":n=0!==t.error?Rz.START_FAILED:Rz.START_SUCCESS;break;case"TranscodeStopped":n=0!==t.error?Rz.STOP_FAILED:Rz.STOP_SUCCESS;break;case"TranscodeUpdated":n=0!==t.error?Rz.UPDATE_FAILED:Rz.UPDATE_SUCCESS}this.safeEmit(oj.POST_PROCESSING_MESSAGE,{code:r,protocol:t.protocol,error:t.error,eventType:n,message:i[r]})}this.safeEmit(oj.POST_PROCESSING_MESSAGE,{code:r,message:i[r],type:e.type})}}},{key:"_onUserTokenWillExpire",value:function(){this.safeEmit(oj.ON_USER_TOKEN_WILL_EXPIRE,null)}},{key:"_onSceneConfig",value:function(e){var t=e.multiSceneConfig,r=Wz[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)}}},{key:"_onStreamFailed",value:(t=u(o().mark((function e(t){var r,n,i,a,s,u,c,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(u=void 0,(null===(r=this.localStream)||void 0===r?void 0:r.streamId)===t.streamId?u=this.localStream:(null===(n=this.localScreenStream)||void 0===n?void 0:n.streamId)===t.streamId&&(u=this.localScreenStream),u){e.next=5;break}return e.abrupt("return");case 5:return null===(i=u)||void 0===i||i.clean(),e.next=8,null===(a=this._mediaServerClient)||void 0===a?void 0:a.unpublish(u).catch((function(){}));case 8:null===(s=this._mediaServerClient)||void 0===s||s.publish(u).catch((function(){})),e.next=20;break;case 11:if("subscribe"!==t.type){e.next=20;break}if(c=this._remoteStreamStreamIdUserIdMap[t.streamId],!(d=this._findRemoteStream(c,t.streamId))){e.next=20;break}return e.next=17,null===(l=this._mediaServerClient)||void 0===l?void 0:l.unsubscribe(d,V.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(Iz.RESUBSCRIBE,{stream:d});case 20:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"_onStreamControlMessage",value:function(e){var t,r;e.type===ij.PushLimitWarn&&(null!==(t=this._localStream)&&void 0!==t&&t.pubAudio||null!==(r=this._localStream)&&void 0!==r&&r.pubVideo||this.unpublish())}},{key:"_onPublishOnDemand",value:function(e){var t,r,n,i,o;if(!1!==(null===(t=this._serverConfig)||void 0===t||null===(r=t.engine_VPM)||void 0===r||null===(n=r.ondemand)||void 0===n?void 0:n.enable)&&null!==(i=this._localStream)&&void 0!==i&&i.enableSimulcast&&null!==(o=this._localStream)&&void 0!==o&&o.videoTransceiver){var a,s,u=null===(a=this._localStream)||void 0===a?void 0:a.stream.id,c=null===(s=this._localStream)||void 0===s?void 0:s.videoTransceiver.sender,d=c.getParameters();if(Array.isArray(d.encodings)&&Array.isArray(e)){var l,h,f,p,v={};pW.print("_onPublishOnDemand","usedDescriptions: %o",e),e.forEach((function(e){var t;if(null!=e&&null!==(t=e.StreamIds)&&void 0!==t&&t.includes(u)){var r=null==e?void 0:e.Metadata.SubvideoIndex;v[r]=r}}));var _={};null===(l=this._localStream)||void 0===l||null===(h=l.subVideoDescriptions)||void 0===h||h.forEach((function(e){void 0!==v[e.sub_index]&&(_[e.video_index]=e)}));var m=(null===(f=c.track)||void 0===f||null===(p=f.getSettings())||void 0===p?void 0:p.height)||720,y=[];d.encodings=d.encodings.map((function(e){return e.rid&&(_[e.rid]?(e.active=!0,e.scaleResolutionDownBy=Math.max(m/_[e.rid].height,1),y.push({type:1,rid:e.rid,downBy:e.scaleResolutionDownBy})):(y.push({type:0,rid:e.rid}),e.active=!1)),e})),IB.rtcInvokeStatus(JSON.stringify(y),0,"rscp",u,0)}c.setParameters(d)}}},{key:"_onRTT",value:function(e){var t=e.StreamIds,r=e.Metadata;if(t.length&&r){var n,i=t[0];null!==(n=this._context)&&void 0!==n&&n.streamRTT&&(this._context.streamRTT[i]={audio:r.audio_rtt,video:r.video_rtt})}}},{key:"_reportNetworkQuality",value:function(e,t){this._subFallbackManager.updateNetworkQuality(e,t),this.emit(Iz.ON_NETWORK_QUALITY,e,t)}},{key:"_emitVideoSizeChange",value:function(e,t,r,n){var i;this.emit(Iz.ON_REMOTE_VIDEO_SIZE_CHANGED,{roomId:null===(i=this.roomInfo)||void 0===i?void 0:i.roomId,userId:e,streamIndex:t?U.STREAM_INDEX_SCREEN:U.STREAM_INDEX_MAIN},{width:r,height:n})}},{key:"_emitSubscribeFallback",value:function(e){this.emit(Iz.ON_SIMULCAST_SUBSCRIBE_FALLBACK,e)}}]),L}(VL),_W=function(){function e(){c(this,e),h(this,"_all_201_count",void 0),h(this,"_has_4xx",void 0),this._all_201_count=0,this._has_4xx=!1}return l(e,[{key:"shouldReconnect",get:function(){return!(this._all_201_count>=3||this._has_4xx)}},{key:"record",value:function(e){var t=!1,r=!1;if(Array.isArray(e)){var n=0;e.map((function(e){var t,i,o;400<=(null===(t=e.error)||void 0===t?void 0:t.code)&&(null===(i=e.error)||void 0===i?void 0:i.code)<500&&(r=!0),201===(null===(o=e.error)||void 0===o?void 0:o.code)&&n++})),n===e.length&&(t=!0),t&&this._all_201_count++,r&&(this._has_4xx=!0)}}},{key:"clear",value:function(){this._all_201_count=0,this._has_4xx=!1}}]),e}(),mW=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=document.createElement(e);return t.id&&(r.id=t.id),t.classList&&t.classList.forEach((function(e){r.classList.add(e)})),t.style&&Object.assign(r.style,t.style),t.attributes&&Object.entries(t.attributes).forEach((function(e){var t=E(e,2),n=t[0],i=t[1];"muted"===n?r.muted=!0:r.setAttribute(n,i)})),r},yW=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.id&&(e.id=t.id),t.classList&&t.classList.forEach((function(t){e.classList.add(t)})),t.style&&Object.assign(e.style,t.style),t.attributes&&Object.entries(t.attributes).forEach((function(t){var r=E(t,2),n=r[0],i=r[1];e.setAttribute(n,i)})),e},gW=new LL("Player",0),SW=["play","playing","pause","ended","error","seeking","seeked","waiting","canplay","canplaythrough","durationchange","volumechange","loadedmetadata","loadeddata","loadstart","timeupdate"],bW={playsinline:"","webkit-playsinline":""},EW={playsinline:"","webkit-playsinline":"","x5-playsinline":"","x5-video-player-type":"h5","x-webkit-airplay":"allow",preload:"",muted:""},kW=new(function(){function e(){c(this,e),h(this,"videoCache",[]),h(this,"audioCache",[])}return l(e,[{key:"getOrCreate",value:function(e,t){var r="audio"===e?bW:EW;if("video"===e&&this.videoCache.length>0){var n=this.videoCache.pop();if(n)return yW(n,{style:t,attributes:r}),n}else if("audio"===e&&this.audioCache.length>0){var i=this.audioCache.pop();if(i)return yW(i,{style:t,attributes:r}),i}return mW(e,{style:t,attributes:r})}},{key:"recycle",value:function(e){for(;e.attributes.length>0;)e.removeAttribute(e.attributes[0].name);e instanceof HTMLVideoElement?this.videoCache.push(e):this.audioCache.push(e)}}]),e}()),TW=function(e){f(n,e);var t,r=g(n);function n(e){var t;c(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",j.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),"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};t.emit("playback_event",i)})),h(m(t),"_internalPlay",(function(){var e;if(null!==(e=t._videoDom)&&void 0!==e&&e.paused){var r=t._videoDom.play();null!=r&&r.then&&r.catch((function(e){var r,n;t._emitPlayFailed||(t._emitPlayFailed=!0,IB.rtcError("video autoplay failed, userId: ".concat(t.userId),-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}))}))}}));var i=e.renderDom,o=e.userId;t.renderMode=void 0!==e.renderMode?e.renderMode:L.RENDER_MODE_FIT;var a="string"==typeof i?document.getElementById(i):i;if(!a)throw new ZN(JN.CANT_FIND_DOM,"can't find dom");return 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=kW.getOrCreate("video",{width:"100%",height:"100%"}),this._videoDom.id="".concat(this.userId,"_").concat(dP()),this.renderMode===L.RENDER_MODE_FIT?this._videoDom.style.objectFit="contain":this._videoDom.style.objectFit="cover",this.mirror(this.mirrorType===j.MIRROR_TYPE_RENDER)),this._containerDom.appendChild(this._videoDom),this._initListeners()}},{key:"_initListeners",value:function(){var e=this;this._videoDom&&SW.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&&(SW.forEach((function(t){var r;null===(r=e._videoDom)||void 0===r||r.removeEventListener(t,e.emitVideoEvent)})),this._videoDom.addEventListener("canplay",this._internalPlay),this._videoDom.addEventListener("loadeddata",this._internalPlay))}},{key:"_recordFrame",value:function(e){var t=this;this.on("playback_event",(function(r){var n,i=e.isScreen?1.5:.5;if("timeupdate"===r.eventName){if(0===(null===(n=t._videoDom)||void 0===n?void 0:n.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>i;e.recordedVideoFrames.push({playTime:t._videoDom.currentTime,isStall:a,stallCount:a?1:0,stallDuration:o%2e3})}t.__cumulativeTime=t._videoDom.currentTime}}))}},{key:"playVideo",value:(t=u(o().mark((function e(t,r){var n,i,a,s,u=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=this._videoDom,gW.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=4;break}return e.abrupt("return");case 4:a||(this._initVideo(),a=this._videoDom),gW.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(a)&&this._containerDom.appendChild(a),a.addEventListener("canplay",this._internalPlay),a.addEventListener("loadeddata",this._internalPlay),setTimeout((function(){return u._internalPlay()})),r&&(this._recordFrame(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(gW.print("Invoke VideoPlayer.manuallyPlay"),this._emitPlayFailed=!1,!this._videoDom)throw new ZN(JN.INVALID_PARAMS,"Player not found");return this._videoDom.play()}},{key:"mirror",value:function(e){gW.print("mirror","".concat(this.userId," set mirror: ").concat(e)),this.mirrorType=e?j.MIRROR_TYPE_RENDER:j.MIRROR_TYPE_NONE,this._videoDom&&(this._videoDom.style.transform=e?"rotateY(180deg)":"")}},{key:"stop",value:function(){var e=this._containerDom;gW.print("stop","stop video track: ".concat(this.userId)),this._videoDom&&(this._videoDom.srcObject=null,null!=e&&e.contains(this._videoDom)&&e.removeChild(this._videoDom)),this.__cumulativeTime=void 0,this.played=!1}},{key:"destroy",value:function(){gW.print("destroy","video player: ".concat(this.userId)),this.stop(),b(p(n.prototype),"removeAllListeners",this).call(this),this._removeListeners(),this._videoDom&&(kW.recycle(this._videoDom),delete this._videoDom)}},{key:"domElement",get:function(){return this._videoDom}}]),n}(xL.exports.EventEmitter),IW=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},o=r.divId,a=r.muted;if(c(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),"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};t.emit("playback_event",i)})),h(m(t),"_internalPlay",(function(){var e,r;if(PB("_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)})).then((function(){PB("_internalPlay successfully",{userId:t.userId})}))}catch(i){t._autoPlayError(i)}})),o){var s=document.getElementById(o);if(!s)throw new ZN(JN.CANT_FIND_DOM,"can't find dom");t._containerDom=s}else t._containerDom=document.body;return t.userId=e,t.muted=a,t._initAudio(),t}return l(i,[{key:"_initAudio",value:function(){this._audioDom||(this._audioDom=kW.getOrCreate("audio",{display:"none"}),this._audioDom.volume=this.muted?0:1,this._audioDom.id="".concat(this.userId,"_").concat(dP()),this._containerDom.appendChild(this._audioDom)),this._initListeners()}},{key:"_initListeners",value:function(){var e=this;this._audioDom&&SW.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&&(SW.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=u(o().mark((function e(t){var r,n,i,a,s,u=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(gW.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 u._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,IB.rtcError("audio autoplay failed, userId: ".concat(this.userId,": ").concat(e.message),-1e3),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:"manuallyPlay",value:function(){var e;if(gW.print("Invoke AudioPlayer.manuallyPlay"),this._emitPlayFailed=!1,!this._audioDom)throw new ZN(JN.INVALID_PARAMS,"Player not found");this._audioDom.volume=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=u(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return gW.print("setPlaybackDevice","setPlaybackDevice: ".concat(t)),e.next=3,bH.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;gW.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)}},{key:"domElement",get:function(){return this._audioDom}},{key:"destroy",value:function(){gW.print("destroy","audio player: ".concat(this.userId)),this.stop(),b(p(i.prototype),"removeAllListeners",this).call(this),this._removeListeners(),this._audioDom&&(kW.recycle(this._audioDom),delete this._audioDom)}}]),i}(xL.exports.EventEmitter),RW=function(){function e(){c(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(){this._report(),this._reset()}},{key:"_report",value:function(){var e=this;IB.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_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){var r=this.userMessage["".concat(t,"-").concat(e)];r&&r.dc_send_fail++}},{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,yB.P2P,t)}},{key:"recvP2PMessage",value:function(e){this._recvUserMessage(e,yB.P2P)}},{key:"sendP2PFail",value:function(e){this._sendUserFail(e,yB.P2P)}},{key:"sendP2PAck",value:function(e,t,r,n){this._sendUserAck(e,yB.P2P,t,r,n)}},{key:"sendP2POutRoomMessage",value:function(e,t){this._sendUserMessage(e,yB.P2P_OUTSIDE_ROOM,t)}},{key:"recvP2POutRoomMessage",value:function(e){this._recvUserMessage(e,yB.P2P_OUTSIDE_ROOM)}},{key:"sendP2POutRoomFail",value:function(e){this._sendUserFail(e,yB.P2P_OUTSIDE_ROOM)}},{key:"sendP2POutRoomAck",value:function(e,t,r,n){this._sendUserAck(e,yB.P2P_OUTSIDE_ROOM,t,r,n)}},{key:"sendP2serverMessage",value:function(e){this._sendUserMessage("",yB.P2SERVER,e)}},{key:"sendP2serverFail",value:function(){this._sendUserFail("",yB.P2SERVER)}},{key:"sendP2serveAck",value:function(e){this._sendUserAck("",yB.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)}},{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)}},{key:"countServerMessage",value:function(e,t,r){this.sendP2serverMessage(t),e?this.sendP2serveAck(Date.now()-r):this.sendP2serverFail()}},{key:"destroy",value:function(){this._reset(),clearTimeout(this._timer)}}]),e}(),AW="object"==typeof global&&global&&global.Object===Object&&global,wW="object"==typeof self&&self&&self.Object===Object&&self,CW=AW||wW||Function("return this")(),OW=CW.Symbol,xW=Object.prototype,NW=xW.hasOwnProperty,DW=xW.toString,PW=OW?OW.toStringTag:void 0;var MW=Object.prototype.toString;var LW=OW?OW.toStringTag:void 0;function UW(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":LW&&LW in Object(e)?function(e){var t=NW.call(e,PW),r=e[PW];try{e[PW]=void 0;var n=!0}catch(o){}var i=DW.call(e);return n&&(t?e[PW]=r:delete e[PW]),i}(e):function(e){return MW.call(e)}(e)}function VW(e){return null!=e&&"object"==typeof e}var FW=Array.isArray;function BW(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function jW(e){return e}function GW(e){if(!BW(e))return!1;var t=UW(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}var HW,zW=CW["__core-js_shared__"],qW=(HW=/[^.]+$/.exec(zW&&zW.keys&&zW.keys.IE_PROTO||""))?"Symbol(src)_1."+HW:"";var KW=Function.prototype.toString;var XW=/^\[object .+?Constructor\]$/,WW=Function.prototype,YW=Object.prototype,JW=WW.toString,QW=YW.hasOwnProperty,ZW=RegExp("^"+JW.call(QW).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function $W(e){return!(!BW(e)||(t=e,qW&&qW in t))&&(GW(e)?ZW:XW).test(function(e){if(null!=e){try{return KW.call(e)}catch(t){}try{return e+""}catch(t){}}return""}(e));var t}function eY(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 tY=Date.now;var rY,nY,iY,oY=function(){try{var e=$W(t=function(e,t){return null==e?void 0:e[t]}(Object,"defineProperty"))?t:void 0;return e({},"",{}),e}catch(r){}var t}(),aY=oY,sY=aY?function(e,t){return aY(e,"toString",{configurable:!0,enumerable:!1,value:(r=t,function(){return r}),writable:!0});var r}:jW,uY=(rY=sY,nY=0,iY=0,function(){var e=tY(),t=16-(e-iY);if(iY=e,t>0){if(++nY>=800)return arguments[0]}else nY=0;return rY.apply(void 0,arguments)}),cY=uY,dY=/^(?:0|[1-9]\d*)$/;function lY(e,t){var r=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==r||"symbol"!=r&&dY.test(e))&&e>-1&&e%1==0&&e<t}function hY(e,t,r){"__proto__"==t&&aY?aY(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function fY(e,t){return e===t||e!=e&&t!=t}var pY=Object.prototype.hasOwnProperty;function vY(e,t,r){var n=e[t];pY.call(e,t)&&fY(n,r)&&(void 0!==r||t in e)||hY(e,t,r)}var _Y=Math.max;function mY(e,t){return cY(function(e,t,r){return t=_Y(void 0===t?e.length-1:t,0),function(){for(var n=arguments,i=-1,o=_Y(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),eY(e,this,s)}}(e,t,jW),e+"")}function yY(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function gY(e){return null!=e&&yY(e.length)&&!GW(e)}var SY=Object.prototype;function bY(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||SY)}function EY(e){return VW(e)&&"[object Arguments]"==UW(e)}var kY=Object.prototype,TY=kY.hasOwnProperty,IY=kY.propertyIsEnumerable,RY=EY(function(){return arguments}())?EY:function(e){return VW(e)&&TY.call(e,"callee")&&!IY.call(e,"callee")},AY=RY;var wY="object"==typeof exports&&exports&&!exports.nodeType&&exports,CY=wY&&"object"==typeof module&&module&&!module.nodeType&&module,OY=CY&&CY.exports===wY?CW.Buffer:void 0,xY=(OY?OY.isBuffer:void 0)||function(){return!1},NY={};NY["[object Float32Array]"]=NY["[object Float64Array]"]=NY["[object Int8Array]"]=NY["[object Int16Array]"]=NY["[object Int32Array]"]=NY["[object Uint8Array]"]=NY["[object Uint8ClampedArray]"]=NY["[object Uint16Array]"]=NY["[object Uint32Array]"]=!0,NY["[object Arguments]"]=NY["[object Array]"]=NY["[object ArrayBuffer]"]=NY["[object Boolean]"]=NY["[object DataView]"]=NY["[object Date]"]=NY["[object Error]"]=NY["[object Function]"]=NY["[object Map]"]=NY["[object Number]"]=NY["[object Object]"]=NY["[object RegExp]"]=NY["[object Set]"]=NY["[object String]"]=NY["[object WeakMap]"]=!1;var DY="object"==typeof exports&&exports&&!exports.nodeType&&exports,PY=DY&&"object"==typeof module&&module&&!module.nodeType&&module,MY=PY&&PY.exports===DY&&AW.process,LY=function(){try{var e=PY&&PY.require&&PY.require("util").types;return e||MY&&MY.binding&&MY.binding("util")}catch(t){}}(),UY=LY&&LY.isTypedArray,VY=UY?function(e){return function(t){return e(t)}}(UY):function(e){return VW(e)&&yY(e.length)&&!!NY[UW(e)]},FY=VY,BY=Object.prototype.hasOwnProperty;function jY(e,t){var r=FW(e),n=!r&&AY(e),i=!r&&!n&&xY(e),o=!r&&!n&&!i&&FY(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):[],u=s.length;for(var c in e)!t&&!BY.call(e,c)||a&&("length"==c||i&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||lY(c,u))||s.push(c);return s}var GY=function(e,t){return function(r){return e(t(r))}}(Object.keys,Object),HY=GY,zY=Object.prototype.hasOwnProperty;function qY(e){return gY(e)?jY(e):function(e){if(!bY(e))return HY(e);var t=[];for(var r in Object(e))zY.call(e,r)&&"constructor"!=r&&t.push(r);return t}(e)}var KY=Object.prototype.hasOwnProperty;function XY(e){if(!BW(e))return function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t}(e);var t=bY(e),r=[];for(var n in e)("constructor"!=n||!t&&KY.call(e,n))&&r.push(n);return r}var WY,YY=(WY=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],u=n?n(r[s],e[s],s,r,e):void 0;void 0===u&&(u=e[s]),i?hY(r,s,u):vY(r,s,u)}}(t,function(e){return gY(e)?jY(e,!0):XY(e)}(t),e)},mY((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=WY.length>3&&"function"==typeof i?(n--,i):void 0,o&&function(e,t,r){if(!BW(r))return!1;var n=typeof t;return!!("number"==n?gY(r)&&lY(t,r.length):"string"==n&&t in r)&&fY(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&&WY(e,a,r,i)}return e})));function JY(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 QY(e){return null==e?[]:JY(e,qY(e))}var ZY=ye,$Y=_t("iterator"),eJ=!ZY((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[$Y]||"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})),tJ=Te,rJ=2147483647,nJ=/[^\0-\u007E]/,iJ=/[.\u3002\uFF0E\uFF61]/g,oJ="Overflow: input needs wider integers to process",aJ=RangeError,sJ=tJ(iJ.exec),uJ=Math.floor,cJ=String.fromCharCode,dJ=tJ("".charCodeAt),lJ=tJ([].join),hJ=tJ([].push),fJ=tJ("".replace),pJ=tJ("".split),vJ=tJ("".toLowerCase),_J=function(e){return e+22+75*(e<26)},mJ=function(e,t,r){var n=0;for(e=r?uJ(e/700):e>>1,e+=uJ(e/t);e>455;)e=uJ(e/35),n+=36;return uJ(n+36*e/(e+38))},yJ=function(e){var t=[];e=function(e){for(var t=[],r=0,n=e.length;r<n;){var i=dJ(e,r++);if(i>=55296&&i<=56319&&r<n){var o=dJ(e,r++);56320==(64512&o)?hJ(t,((1023&i)<<10)+(1023&o)+65536):(hJ(t,i),r--)}else hJ(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&&hJ(t,cJ(n));var u=t.length,c=u;for(u&&hJ(t,"-");c<i;){var d=rJ;for(r=0;r<e.length;r++)(n=e[r])>=o&&n<d&&(d=n);var l=c+1;if(d-o>uJ((rJ-a)/l))throw aJ(oJ);for(a+=(d-o)*l,o=d,r=0;r<e.length;r++){if((n=e[r])<o&&++a>rJ)throw aJ(oJ);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;hJ(t,cJ(_J(p+v%_))),h=uJ(v/_),f+=36}hJ(t,cJ(_J(h))),s=mJ(a,l,c==u),a=0,c++}}a++,o++}return lJ(t,"")},gJ=ha,SJ=se,bJ=Ut,EJ=Te,kJ=St,TJ=eJ,IJ=wn,RJ=gh,AJ=wc,wJ=Mc,CJ=ln,OJ=Kl,xJ=He,NJ=Pe,DJ=Zn,PJ=Fn,MJ=Pt,LJ=kt,UJ=es,VJ=La,FJ=Gr,BJ=Il,jJ=yl,GJ=v_,HJ=DI,zJ=_t("iterator"),qJ="URLSearchParams",KJ="URLSearchParamsIterator",XJ=CJ.set,WJ=CJ.getterFor(qJ),YJ=CJ.getterFor(KJ),JJ=Object.getOwnPropertyDescriptor,QJ=function(e){if(!kJ)return SJ[e];var t=JJ(SJ,e);return t&&t.value},ZJ=QJ("fetch"),$J=QJ("Request"),eQ=QJ("Headers"),tQ=$J&&$J.prototype,rQ=eQ&&eQ.prototype,nQ=SJ.RegExp,iQ=SJ.TypeError,oQ=SJ.decodeURIComponent,aQ=SJ.encodeURIComponent,sQ=EJ("".charAt),uQ=EJ([].join),cQ=EJ([].push),dQ=EJ("".replace),lQ=EJ([].shift),hQ=EJ([].splice),fQ=EJ("".split),pQ=EJ("".slice),vQ=/\+/g,_Q=Array(4),mQ=function(e){return _Q[e-1]||(_Q[e-1]=nQ("((?:%[\\da-f]{2}){"+e+"})","gi"))},yQ=function(e){try{return oQ(e)}catch(Z$){return e}},gQ=function(e){var t=dQ(e,vQ," "),r=4;try{return oQ(t)}catch(Z$){for(;r;)t=dQ(t,mQ(r--),yQ);return t}},SQ=/[!'()~]|%20/g,bQ={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},EQ=function(e){return bQ[e]},kQ=function(e){return dQ(aQ(e),SQ,EQ)},TQ=wJ((function(e,t){XJ(this,{type:KJ,iterator:BJ(WJ(e).entries),kind:t})}),"Iterator",(function(){var e=YJ(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),IQ=function(e){this.entries=[],this.url=null,void 0!==e&&(LJ(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===sQ(e,0)?pQ(e,1):e:UJ(e)))};IQ.prototype={type:qJ,bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t,r,n,i,o,a,s,u=jJ(e);if(u)for(r=(t=BJ(e,u)).next;!(n=bJ(r,t)).done;){if(o=(i=BJ(MJ(n.value))).next,(a=bJ(o,i)).done||(s=bJ(o,i)).done||!bJ(o,i).done)throw iQ("Expected sequence with length 2");cQ(this.entries,{key:UJ(a.value),value:UJ(s.value)})}else for(var c in e)NJ(e,c)&&cQ(this.entries,{key:c,value:UJ(e[c])})},parseQuery:function(e){if(e)for(var t,r,n=fQ(e,"&"),i=0;i<n.length;)(t=n[i++]).length&&(r=fQ(t,"="),cQ(this.entries,{key:gQ(lQ(r)),value:gQ(uQ(r,"="))}))},serialize:function(){for(var e,t=this.entries,r=[],n=0;n<t.length;)e=t[n++],cQ(r,kQ(e.key)+"="+kQ(e.value));return uQ(r,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var RQ=function(){OJ(this,AQ);var e=arguments.length>0?arguments[0]:void 0;XJ(this,new IQ(e))},AQ=RQ.prototype;if(RJ(AQ,{append:function(e,t){GJ(arguments.length,2);var r=WJ(this);cQ(r.entries,{key:UJ(e),value:UJ(t)}),r.updateURL()},delete:function(e){GJ(arguments.length,1);for(var t=WJ(this),r=t.entries,n=UJ(e),i=0;i<r.length;)r[i].key===n?hQ(r,i,1):i++;t.updateURL()},get:function(e){GJ(arguments.length,1);for(var t=WJ(this).entries,r=UJ(e),n=0;n<t.length;n++)if(t[n].key===r)return t[n].value;return null},getAll:function(e){GJ(arguments.length,1);for(var t=WJ(this).entries,r=UJ(e),n=[],i=0;i<t.length;i++)t[i].key===r&&cQ(n,t[i].value);return n},has:function(e){GJ(arguments.length,1);for(var t=WJ(this).entries,r=UJ(e),n=0;n<t.length;)if(t[n++].key===r)return!0;return!1},set:function(e,t){GJ(arguments.length,1);for(var r,n=WJ(this),i=n.entries,o=!1,a=UJ(e),s=UJ(t),u=0;u<i.length;u++)(r=i[u]).key===a&&(o?hQ(i,u--,1):(o=!0,r.value=s));o||cQ(i,{key:a,value:s}),n.updateURL()},sort:function(){var e=WJ(this);HJ(e.entries,(function(e,t){return e.key>t.key?1:-1})),e.updateURL()},forEach:function(e){for(var t,r=WJ(this).entries,n=DJ(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 TQ(this,"keys")},values:function(){return new TQ(this,"values")},entries:function(){return new TQ(this,"entries")}},{enumerable:!0}),IJ(AQ,zJ,AQ.entries,{name:"entries"}),IJ(AQ,"toString",(function(){return WJ(this).serialize()}),{enumerable:!0}),AJ(RQ,qJ),gJ({global:!0,constructor:!0,forced:!TJ},{URLSearchParams:RQ}),!TJ&&xJ(eQ)){var wQ=EJ(rQ.has),CQ=EJ(rQ.set),OQ=function(e){if(LJ(e)){var t,r=e.body;if(PJ(r)===qJ)return t=e.headers?new eQ(e.headers):new eQ,wQ(t,"content-type")||CQ(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),VJ(e,{body:FJ(0,UJ(r)),headers:FJ(0,t)})}return e};if(xJ(ZJ)&&gJ({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(e){return ZJ(e,arguments.length>1?OQ(arguments[1]):{})}}),xJ($J)){var xQ=function(e){return OJ(this,tQ),new $J(e,arguments.length>1?OQ(arguments[1]):{})};tQ.constructor=xQ,xQ.prototype=tQ,gJ({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:xQ})}}var NQ,DQ=ha,PQ=St,MQ=eJ,LQ=se,UQ=Zn,VQ=Te,FQ=wn,BQ=pg,jQ=Kl,GQ=Pe,HQ=Sp,zQ=UD,qQ=Pd,KQ=Iu.codeAt,XQ=function(e){var t,r,n=[],i=pJ(fJ(vJ(e),iJ,"."),".");for(t=0;t<i.length;t++)r=i[t],hJ(n,sJ(nJ,r)?"xn--"+yJ(r):r);return lJ(n,".")},WQ=es,YQ=wc,JQ=v_,QQ={URLSearchParams:RQ,getState:WJ},ZQ=ln,$Q=ZQ.set,eZ=ZQ.getterFor("URL"),tZ=QQ.URLSearchParams,rZ=QQ.getState,nZ=LQ.URL,iZ=LQ.TypeError,oZ=LQ.parseInt,aZ=Math.floor,sZ=Math.pow,uZ=VQ("".charAt),cZ=VQ(/./.exec),dZ=VQ([].join),lZ=VQ(1..toString),hZ=VQ([].pop),fZ=VQ([].push),pZ=VQ("".replace),vZ=VQ([].shift),_Z=VQ("".split),mZ=VQ("".slice),yZ=VQ("".toLowerCase),gZ=VQ([].unshift),SZ="Invalid scheme",bZ="Invalid host",EZ="Invalid port",kZ=/[a-z]/i,TZ=/[\d+-.a-z]/i,IZ=/\d/,RZ=/^0x/i,AZ=/^[0-7]+$/,wZ=/^\d+$/,CZ=/^[\da-f]+$/i,OZ=/[\0\t\n\r #%/:<>?@[\\\]^|]/,xZ=/[\0\t\n\r #/:<>?@[\\\]^|]/,NZ=/^[\u0000-\u0020]+|[\u0000-\u0020]+$/g,DZ=/[\t\n\r]/g,PZ=function(e){var t,r,n,i;if("number"==typeof e){for(t=[],r=0;r<4;r++)gZ(t,e%256),e=aZ(e/256);return dZ(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+=lZ(e[r],16),r<7&&(t+=":")));return"["+t+"]"}return e},MZ={},LZ=HQ({},MZ,{" ":1,'"':1,"<":1,">":1,"`":1}),UZ=HQ({},LZ,{"#":1,"?":1,"{":1,"}":1}),VZ=HQ({},UZ,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),FZ=function(e,t){var r=KQ(e,0);return r>32&&r<127&&!GQ(t,e)?e:encodeURIComponent(e)},BZ={ftp:21,file:null,http:80,https:443,ws:80,wss:443},jZ=function(e,t){var r;return 2==e.length&&cZ(kZ,uZ(e,0))&&(":"==(r=uZ(e,1))||!t&&"|"==r)},GZ=function(e){var t;return e.length>1&&jZ(mZ(e,0,2))&&(2==e.length||"/"===(t=uZ(e,2))||"\\"===t||"?"===t||"#"===t)},HZ=function(e){return"."===e||"%2e"===yZ(e)},zZ={},qZ={},KZ={},XZ={},WZ={},YZ={},JZ={},QZ={},ZZ={},$Z={},e$={},t$={},r$={},n$={},i$={},o$={},a$={},s$={},u$={},c$={},d$={},l$=function(e,t,r){var n,i,o,a=WQ(e);if(t){if(i=this.parse(a))throw iZ(i);this.searchParams=null}else{if(void 0!==r&&(n=new l$(r,!0)),i=this.parse(a,null,n))throw iZ(i);(o=rZ(new tZ)).bindURL(this),this.searchParams=o}};l$.prototype={type:"URL",parse:function(e,t,r){var n,i,o,a,s,u=this,c=t||zZ,d=0,l="",h=!1,f=!1,p=!1;for(e=WQ(e),t||(u.scheme="",u.username="",u.password="",u.host=null,u.port=null,u.path=[],u.query=null,u.fragment=null,u.cannotBeABaseURL=!1,e=pZ(e,NZ,"")),e=pZ(e,DZ,""),n=zQ(e);d<=n.length;){switch(i=n[d],c){case zZ:if(!i||!cZ(kZ,i)){if(t)return SZ;c=KZ;continue}l+=yZ(i),c=qZ;break;case qZ:if(i&&(cZ(TZ,i)||"+"==i||"-"==i||"."==i))l+=yZ(i);else{if(":"!=i){if(t)return SZ;l="",c=KZ,d=0;continue}if(t&&(u.isSpecial()!=GQ(BZ,l)||"file"==l&&(u.includesCredentials()||null!==u.port)||"file"==u.scheme&&!u.host))return;if(u.scheme=l,t)return void(u.isSpecial()&&BZ[u.scheme]==u.port&&(u.port=null));l="","file"==u.scheme?c=n$:u.isSpecial()&&r&&r.scheme==u.scheme?c=XZ:u.isSpecial()?c=QZ:"/"==n[d+1]?(c=WZ,d++):(u.cannotBeABaseURL=!0,fZ(u.path,""),c=u$)}break;case KZ:if(!r||r.cannotBeABaseURL&&"#"!=i)return SZ;if(r.cannotBeABaseURL&&"#"==i){u.scheme=r.scheme,u.path=qQ(r.path),u.query=r.query,u.fragment="",u.cannotBeABaseURL=!0,c=d$;break}c="file"==r.scheme?n$:YZ;continue;case XZ:if("/"!=i||"/"!=n[d+1]){c=YZ;continue}c=ZZ,d++;break;case WZ:if("/"==i){c=$Z;break}c=s$;continue;case YZ:if(u.scheme=r.scheme,i==NQ)u.username=r.username,u.password=r.password,u.host=r.host,u.port=r.port,u.path=qQ(r.path),u.query=r.query;else if("/"==i||"\\"==i&&u.isSpecial())c=JZ;else if("?"==i)u.username=r.username,u.password=r.password,u.host=r.host,u.port=r.port,u.path=qQ(r.path),u.query="",c=c$;else{if("#"!=i){u.username=r.username,u.password=r.password,u.host=r.host,u.port=r.port,u.path=qQ(r.path),u.path.length--,c=s$;continue}u.username=r.username,u.password=r.password,u.host=r.host,u.port=r.port,u.path=qQ(r.path),u.query=r.query,u.fragment="",c=d$}break;case JZ:if(!u.isSpecial()||"/"!=i&&"\\"!=i){if("/"!=i){u.username=r.username,u.password=r.password,u.host=r.host,u.port=r.port,c=s$;continue}c=$Z}else c=ZZ;break;case QZ:if(c=ZZ,"/"!=i||"/"!=uZ(l,d+1))continue;d++;break;case ZZ:if("/"!=i&&"\\"!=i){c=$Z;continue}break;case $Z:if("@"==i){h&&(l="%40"+l),h=!0,o=zQ(l);for(var v=0;v<o.length;v++){var _=o[v];if(":"!=_||p){var m=FZ(_,VZ);p?u.password+=m:u.username+=m}else p=!0}l=""}else if(i==NQ||"/"==i||"?"==i||"#"==i||"\\"==i&&u.isSpecial()){if(h&&""==l)return"Invalid authority";d-=zQ(l).length+1,l="",c=e$}else l+=i;break;case e$:case t$:if(t&&"file"==u.scheme){c=o$;continue}if(":"!=i||f){if(i==NQ||"/"==i||"?"==i||"#"==i||"\\"==i&&u.isSpecial()){if(u.isSpecial()&&""==l)return bZ;if(t&&""==l&&(u.includesCredentials()||null!==u.port))return;if(a=u.parseHost(l))return a;if(l="",c=a$,t)return;continue}"["==i?f=!0:"]"==i&&(f=!1),l+=i}else{if(""==l)return bZ;if(a=u.parseHost(l))return a;if(l="",c=r$,t==t$)return}break;case r$:if(!cZ(IZ,i)){if(i==NQ||"/"==i||"?"==i||"#"==i||"\\"==i&&u.isSpecial()||t){if(""!=l){var y=oZ(l,10);if(y>65535)return EZ;u.port=u.isSpecial()&&y===BZ[u.scheme]?null:y,l=""}if(t)return;c=a$;continue}return EZ}l+=i;break;case n$:if(u.scheme="file","/"==i||"\\"==i)c=i$;else{if(!r||"file"!=r.scheme){c=s$;continue}if(i==NQ)u.host=r.host,u.path=qQ(r.path),u.query=r.query;else if("?"==i)u.host=r.host,u.path=qQ(r.path),u.query="",c=c$;else{if("#"!=i){GZ(dZ(qQ(n,d),""))||(u.host=r.host,u.path=qQ(r.path),u.shortenPath()),c=s$;continue}u.host=r.host,u.path=qQ(r.path),u.query=r.query,u.fragment="",c=d$}}break;case i$:if("/"==i||"\\"==i){c=o$;break}r&&"file"==r.scheme&&!GZ(dZ(qQ(n,d),""))&&(jZ(r.path[0],!0)?fZ(u.path,r.path[0]):u.host=r.host),c=s$;continue;case o$:if(i==NQ||"/"==i||"\\"==i||"?"==i||"#"==i){if(!t&&jZ(l))c=s$;else if(""==l){if(u.host="",t)return;c=a$}else{if(a=u.parseHost(l))return a;if("localhost"==u.host&&(u.host=""),t)return;l="",c=a$}continue}l+=i;break;case a$:if(u.isSpecial()){if(c=s$,"/"!=i&&"\\"!=i)continue}else if(t||"?"!=i)if(t||"#"!=i){if(i!=NQ&&(c=s$,"/"!=i))continue}else u.fragment="",c=d$;else u.query="",c=c$;break;case s$:if(i==NQ||"/"==i||"\\"==i&&u.isSpecial()||!t&&("?"==i||"#"==i)){if(".."===(s=yZ(s=l))||"%2e."===s||".%2e"===s||"%2e%2e"===s?(u.shortenPath(),"/"==i||"\\"==i&&u.isSpecial()||fZ(u.path,"")):HZ(l)?"/"==i||"\\"==i&&u.isSpecial()||fZ(u.path,""):("file"==u.scheme&&!u.path.length&&jZ(l)&&(u.host&&(u.host=""),l=uZ(l,0)+":"),fZ(u.path,l)),l="","file"==u.scheme&&(i==NQ||"?"==i||"#"==i))for(;u.path.length>1&&""===u.path[0];)vZ(u.path);"?"==i?(u.query="",c=c$):"#"==i&&(u.fragment="",c=d$)}else l+=FZ(i,UZ);break;case u$:"?"==i?(u.query="",c=c$):"#"==i?(u.fragment="",c=d$):i!=NQ&&(u.path[0]+=FZ(i,MZ));break;case c$:t||"#"!=i?i!=NQ&&("'"==i&&u.isSpecial()?u.query+="%27":u.query+="#"==i?"%23":FZ(i,MZ)):(u.fragment="",c=d$);break;case d$:i!=NQ&&(u.fragment+=FZ(i,LZ))}d++}},parseHost:function(e){var t,r,n;if("["==uZ(e,0)){if("]"!=uZ(e,e.length-1))return bZ;if(t=function(e){var t,r,n,i,o,a,s,u=[0,0,0,0,0,0,0,0],c=0,d=null,l=0,h=function(){return uZ(e,l)};if(":"==h()){if(":"!=uZ(e,1))return;l+=2,d=++c}for(;h();){if(8==c)return;if(":"!=h()){for(t=r=0;r<4&&cZ(CZ,h());)t=16*t+oZ(h(),16),l++,r++;if("."==h()){if(0==r)return;if(l-=r,c>6)return;for(n=0;h();){if(i=null,n>0){if(!("."==h()&&n<4))return;l++}if(!cZ(IZ,h()))return;for(;cZ(IZ,h());){if(o=oZ(h(),10),null===i)i=o;else{if(0==i)return;i=10*i+o}if(i>255)return;l++}u[c]=256*u[c]+i,2!=++n&&4!=n||c++}if(4!=n)return;break}if(":"==h()){if(l++,!h())return}else if(h())return;u[c++]=t}else{if(null!==d)return;l++,d=++c}}if(null!==d)for(a=c-d,c=7;0!=c&&a>0;)s=u[c],u[c--]=u[d+a-1],u[d+--a]=s;else if(8!=c)return;return u}(mZ(e,1,-1)),!t)return bZ;this.host=t}else if(this.isSpecial()){if(e=XQ(e),cZ(OZ,e))return bZ;if(t=function(e){var t,r,n,i,o,a,s,u=_Z(e,".");if(u.length&&""==u[u.length-1]&&u.length--,(t=u.length)>4)return e;for(r=[],n=0;n<t;n++){if(""==(i=u[n]))return e;if(o=10,i.length>1&&"0"==uZ(i,0)&&(o=cZ(RZ,i)?16:8,i=mZ(i,8==o?1:2)),""===i)a=0;else{if(!cZ(10==o?wZ:8==o?AZ:CZ,i))return e;a=oZ(i,o)}fZ(r,a)}for(n=0;n<t;n++)if(a=r[n],n==t-1){if(a>=sZ(256,5-t))return null}else if(a>255)return null;for(s=hZ(r),n=0;n<r.length;n++)s+=r[n]*sZ(256,3-n);return s}(e),null===t)return bZ;this.host=t}else{if(cZ(xZ,e))return bZ;for(t="",r=zQ(e),n=0;n<r.length;n++)t+=FZ(r[n],MZ);this.host=t}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||"file"==this.scheme},includesCredentials:function(){return""!=this.username||""!=this.password},isSpecial:function(){return GQ(BZ,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;!t||"file"==this.scheme&&1==t&&jZ(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,u=e.fragment,c=t+":";return null!==i?(c+="//",e.includesCredentials()&&(c+=r+(n?":"+n:"")+"@"),c+=PZ(i),null!==o&&(c+=":"+o)):"file"==t&&(c+="//"),c+=e.cannotBeABaseURL?a[0]:a.length?"/"+dZ(a,"/"):"",null!==s&&(c+="?"+s),null!==u&&(c+="#"+u),c},setHref:function(e){var t=this.parse(e);if(t)throw iZ(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if("blob"==e)try{return new h$(e.path[0]).origin}catch(Z$){return"null"}return"file"!=e&&this.isSpecial()?e+"://"+PZ(this.host)+(null!==t?":"+t:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse(WQ(e)+":",zZ)},getUsername:function(){return this.username},setUsername:function(e){var t=zQ(WQ(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var r=0;r<t.length;r++)this.username+=FZ(t[r],VZ)}},getPassword:function(){return this.password},setPassword:function(e){var t=zQ(WQ(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var r=0;r<t.length;r++)this.password+=FZ(t[r],VZ)}},getHost:function(){var e=this.host,t=this.port;return null===e?"":null===t?PZ(e):PZ(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,e$)},getHostname:function(){var e=this.host;return null===e?"":PZ(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,t$)},getPort:function(){var e=this.port;return null===e?"":WQ(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""==(e=WQ(e))?this.port=null:this.parse(e,r$))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+dZ(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,a$))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){""==(e=WQ(e))?this.query=null:("?"==uZ(e,0)&&(e=mZ(e,1)),this.query="",this.parse(e,c$)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){""!=(e=WQ(e))?("#"==uZ(e,0)&&(e=mZ(e,1)),this.fragment="",this.parse(e,d$)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var h$=function(e){var t=jQ(this,f$),r=JQ(arguments.length,1)>1?arguments[1]:void 0,n=$Q(t,new l$(e,!1,r));PQ||(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())},f$=h$.prototype,p$=function(e,t){return{get:function(){return eZ(this)[e]()},set:t&&function(e){return eZ(this)[t](e)},configurable:!0,enumerable:!0}};if(PQ&&(BQ(f$,"href",p$("serialize","setHref")),BQ(f$,"origin",p$("getOrigin")),BQ(f$,"protocol",p$("getProtocol","setProtocol")),BQ(f$,"username",p$("getUsername","setUsername")),BQ(f$,"password",p$("getPassword","setPassword")),BQ(f$,"host",p$("getHost","setHost")),BQ(f$,"hostname",p$("getHostname","setHostname")),BQ(f$,"port",p$("getPort","setPort")),BQ(f$,"pathname",p$("getPathname","setPathname")),BQ(f$,"search",p$("getSearch","setSearch")),BQ(f$,"searchParams",p$("getSearchParams")),BQ(f$,"hash",p$("getHash","setHash"))),FQ(f$,"toJSON",(function(){return eZ(this).serialize()}),{enumerable:!0}),FQ(f$,"toString",(function(){return eZ(this).serialize()}),{enumerable:!0}),nZ){var v$=nZ.createObjectURL,_$=nZ.revokeObjectURL;v$&&FQ(h$,"createObjectURL",UQ(v$,nZ)),_$&&FQ(h$,"revokeObjectURL",UQ(_$,nZ))}YQ(h$,"URL"),DQ({global:!0,constructor:!0,forced:!MQ,sham:!PQ},{URL:h$});var m$=function(){var e=u(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)}}(),y$=Object.defineProperty,g$=Object.getOwnPropertyDescriptor,S$=function(e,t,r,n){for(var i,o=n>1?void 0:n?g$(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&&y$(t,r,o),o},b$=function(){function e(t){c(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,"mixingMap",new Map),h(this,"resourcesCache",new Map),h(this,"volumeConfig",new Map),h(this,"cachedBuffer",[]),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=u(o().mark((function e(t,r,n){var i,a,s,u,c,d,l,h,f,p,v,_,m,y=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=n.playCount,MP(a=n.type,"mixingType",QY(te)),s=this._context.getLocalAudioTrack()){e.next=5;break}return e.abrupt("return");case 5:if((u=s.getTrack("preprocessing"))&&this.mixMediaStream(new MediaStream([u])),null!=(c=this.mixingMap.get(t))&&c.audioNode){c.audioNode.pause(),this._context.emitMessage({mixId:t,state:re.AUDIO_MIXING_STATE_STOPPED,error:QN.AUDIO_MIXING_ERROR_OK});try{c.gainNode.disconnect(this._audioDestination),c.audioSource.disconnect(c.gainNode)}catch(o){}}if(!(l=this.resourcesCache.get(t))||l.filePath!==r){e.next=14;break}d=l.getAudioNode(),e.next=27;break;case 14:return e.next=16,fetch(r,{mode:"cors",credentials:"include"}).then((function(e){if(e.ok)return e.arrayBuffer();throw y._context.emitMessage({mixId:t,state:re.AUDIO_MIXING_STATE_FAILED,error:QN.AUDIO_MIXING_ERROR_START_FAILED}),new ZN(JN.LOAD_RESOURCES_FAILED,e.statusText)}));case 16:return h=e.sent,r.endsWith("mp3")?f={type:"audio/mpeg"}:r.endsWith("aac")&&(f={type:"audio/aac"}),e.next=20,m$(h,f);case 20:if(e.sent){e.next=24;break}throw this._context.emitMessage({mixId:t,state:re.AUDIO_MIXING_STATE_FAILED,error:QN.AUDIO_MIXING_ERROR_START_FAILED}),new ZN(JN.LOAD_RESOURCES_FAILED,"invalid audio resource");case 24:(d=new Audio).crossOrigin="anonymous",d.src=URL.createObjectURL(new Blob([h],f));case 27: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:re.AUDIO_MIXING_STATE_FINISHED,error:QN.AUDIO_MIXING_ERROR_OK}))}),e.prev=28,e.next=31,d.play();case 31:e.next=38;break;case 33:e.prev=33,e.t0=e.catch(28),console.error(e.t0),this._failedAudioList.push(d),this._context.onAutoPlayFailed();case 38:if(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===te.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:re.AUDIO_MIXING_STATE_PLAYING,error:QN.AUDIO_MIXING_ERROR_OK});case 47:case"end":return e.stop()}}),e,this,[[28,33]])}))),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:re.AUDIO_MIXING_STATE_STOPPED,error:QN.AUDIO_MIXING_ERROR_OK}))}},{key:"pauseAudioMixing",value:function(e){var t=this.mixingMap.get(e);t&&(this._context.emitMessage({mixId:e,state:re.AUDIO_MIXING_STATE_PAUSED,error:QN.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:re.AUDIO_MIXING_STATE_PLAYING,error:QN.AUDIO_MIXING_ERROR_OK}),t.audioNode.play())}},{key:"preloadAudioMixing",value:(r=u(o().mark((function e(t,r){var n,i=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 i._context.emitMessage({mixId:t,state:re.AUDIO_MIXING_STATE_FAILED,error:QN.AUDIO_MIXING_ERROR_PRELOAD_FAILED}),new ZN(JN.LOAD_RESOURCES_FAILED,e.statusText)})).catch((function(e){throw i._context.emitMessage({mixId:t,state:re.AUDIO_MIXING_STATE_FAILED,error:QN.AUDIO_MIXING_ERROR_PRELOAD_FAILED}),new ZN(JN.LOAD_RESOURCES_FAILED,"Load resources failed",e)}));case 3:return n=e.sent,e.next=6,m$(n);case 6:if(e.sent){e.next=10;break}throw this._context.emitMessage({mixId:t,state:re.AUDIO_MIXING_STATE_FAILED,error:QN.AUDIO_MIXING_ERROR_PRELOAD_FAILED}),new ZN(JN.LOAD_RESOURCES_FAILED,"Load resources failed");case 10:this._context.emitMessage({mixId:t,state:re.AUDIO_MIXING_STATE_PRELOADED,error:QN.AUDIO_MIXING_ERROR_OK}),this.resourcesCache.set(t,{getAudioNode:function(){return new Audio(URL.createObjectURL(new Blob([n])))},filePath:r});case 12: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){MP(e,"type",QY(te));var t=this._context.getLocalAudioTrack();if(t){var r=t.getTrack("preprocessing");if(r&&this.mixMediaStream(new MediaStream([r])),e===te.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:re.AUDIO_MIXING_STATE_PCM_ENABLED,error:QN.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:re.AUDIO_MIXING_STATE_PCM_DISABLED,error:QN.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=u(o().mark((function e(){var t,r,n,i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=[],r=R(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(),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()}}]),e}();S$([NB("default","id","filePath","options")],b$.prototype,"startAudioMixing",1),S$([NB("default","id")],b$.prototype,"stopAudioMixing",1),S$([NB("default","id")],b$.prototype,"pauseAudioMixing",1),S$([NB("default","id")],b$.prototype,"resumeAudioMixing",1),S$([NB("default","id")],b$.prototype,"preloadAudioMixing",1),S$([NB("default","id")],b$.prototype,"unloadAudioMixing",1),S$([NB("default","id")],b$.prototype,"getAudioMixingVolume",1),S$([NB("default","id","volume")],b$.prototype,"setAudioMixingVolume",1),S$([NB("default","id")],b$.prototype,"getAudioMixingDuration",1),S$([NB("default","id")],b$.prototype,"getAudioMixingCurrentPosition",1),S$([NB("default","id","position")],b$.prototype,"setAudioMixingPosition",1),S$([NB("default","type")],b$.prototype,"enableAudioMixingBuffer",1),S$([NB()],b$.prototype,"disableAudioMixingBuffer",1),S$([NB("default","buffer")],b$.prototype,"pushAudioMixingBuffer",1);var E$=function(e){return e.NORMAL_USER="normalUser",e.SILENT_USER="silentUser",e}(E$||{}),k$=new LL("RTMClient",1),T$=function(e){f(_,e);var t,r,n,i,a,s,d,v=g(_);function _(e){var t;return c(this,_),h(m(t=v.call(this)),"_dataChannelSignal",null),h(m(t),"_handler",null),h(m(t),"_dataChannelSignalState",eq.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(k$.print("login","invoke login, token: %o, userId: %o",e,t),r._loginSessionId)throw new ZN(JN.ALREADY_LOGIN,"Already logined");if(r._loginResolveCallback)throw new ZN(JN.LOGIN_FAILED,"Is logging in, please try again later.");r._userId=t,r._token=e,CB.setStats({rtc_app_id:r._appId,user_id:t}),r._loginResolveCallback=n,r._loginRejectCallback=i,r._dataChannelSignal?r._login():(k$.print("login","init dataChannelSingling"),r._dataChannelSignalState=eq.CONNECTING,r._createDataChannelSignaling(t).then((function(e){r._dataChannelSignal=e,r._login()})).catch((function(){r._onDisconnect()})))}))}},{key:"logout",value:(d=u(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 ZN(JN.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:_j.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=u(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=u(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 ZN(JN.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:_j.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=u(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 ZN(JN.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=u(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,PP(t,"signature"),PP(r,"url"),this._loginSessionId&&this._userId){e.next=5;break}throw new ZN(JN.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:_j.C2RTM}).catch((function(e){throw new ZN(JN.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=u(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 ZN(JN.NOT_LOGIN,"login first");case 2:return this._checkDataChannelSignal(),e.abrupt("return",this._dataChannelSignal.sendP2PMessage({from:this._userId,app:this._appId,to:"",room:"",type:lj.BUSINESS_SERVER,msg:t}));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"destroy",value:function(){this._clearState(),this._closeDataChannelSignaling(),b(p(_.prototype),"removeAllListeners",this).call(this),delete this._serverParamsCache}},{key:"_login",value:function(){var e=this;if(this._userId){var t=dP();this._checkDataChannelSignal(),this._dataChannelSignal.sendSignaling("login",{Token:pP.token2auth(this._appId,null,this._userId,this._token),timestamp:Date.now(),loginSessionId:t,params:{deviceType:"web",userAgent:window.navigator.userAgent,sdkVersion:WB.VERSION,deviceId:HB.getDeviceId(),appId:this._appId,userId:this._userId}},{functionType:_j.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=JN.INVALID_PARAMS,n="Invalid userId"):(r=JN.INVALID_TOKEN,n="Invalid token",e._wait_login_token=!0,e._loginRejectCallback||e.emit("onRTMTokenError")):(r=JN.LOGIN_FAILED,n="login failed"),"function"==typeof e._loginRejectCallback&&e._loginRejectCallback(new ZN(r,a||n))})).finally((function(){e._loginResolveCallback=null,e._loginRejectCallback=null}))}}},{key:"_createDataChannelSignaling",value:(t=u(o().mark((function e(t){var r,n,i,a,s,u,c,d=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=new bj,i=this._iceConfigNode){e.next=16;break}return e.prev=3,e.next=6,null==n?void 0:n.getAccessNode(this._appId,"",t,HB.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),PB("rtm.login.getNodeFailed","",0,!0),new ZN(JN.ICE_SERVER_WRONG,"get ICE config failed");case 16:return PB("rtm.login.getNodeSuccess",i,0,!0),k$.print("_createDataChannelSignaling()","get node success",i),this._handler=zz(RB),null===(r=this._handler)||void 0===r||r.once("disconnect",(function(){k$.print("_createDataChannelSignaling()","recv BasicHandler event: disconnect"),d._onDisconnect()})),e.prev=20,e.next=23,null===(u=this._handler)||void 0===u?void 0:u.connect(i);case 23:s=e.sent,k$.print("_createDataChannelSignaling()","establish peerConnection success"),this._dataChannelSignalState=eq.CONNECTED,e.next=33;break;case 28:throw e.prev=28,e.t1=e.catch(20),this._iceConfigNode=null,this._dataChannelSignalState=eq.DISCONNECTED,new ZN(JN.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed",e.t1);case 33:return c=new yj(s),k$.print("_createDataChannelSignaling()","send ping"),c.sendPingSignaling(),c.once("close",(function(){k$.print("_createDataChannelSignaling()","recv DataChannelSignaling event: close"),d._onDisconnect()})),c.on(oj.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM,(function(e){d.emit("onUserMessageReceivedOutsideRoom",{userId:e.from,message:e.msg})})),c.on(oj.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM,(function(e){d.emit("onUserBinaryMessageReceivedOutsideRoom",{userId:e.from,message:e.msg})})),c.on(oj.USER_DISCONNECTION,(function(){d.emit("onUserDisconnection"),d._clearState()})),c.on(oj.NODE_CHANGE,(function(e){PB("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",c);case 42:case"end":return e.stop()}}),e,this,[[3,12],[20,28]])}))),function(e){return t.apply(this,arguments)})},{key:"_closeDataChannelSignaling",value:function(){var e,t;null===(e=this._dataChannelSignal)||void 0===e||e.destroy(),this._dataChannelSignal=null,null===(t=this._handler)||void 0===t||t.destroy(),this._handler=null}},{key:"_checkDataChannelSignal",value:function(){if(!this._dataChannelSignal||this._dataChannelSignalState!==eq.CONNECTED)throw new ZN(JN.NOT_CONNECTED_YET,"datachannel not connect")}},{key:"_onDisconnect",value:function(){this._dataChannelSignalState=eq.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&&(k$.print("_reconnect()","start reconnect..."),this._isReconnecting=!0,this._createDataChannelSignaling(this._userId).then((function(t){k$.print("_reconnect()","reconnect success!"),e._dataChannelSignal=t,e._login(),e._reconnectTimer=null})).catch((function(t){k$.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)}}]),_}(xL.exports.EventEmitter),I$=function(e){f(a,e);var t,r,n,i=g(a);function a(e){var t;return c(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=u(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._mediaServerClient=new rq({}),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=u(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 ZN(JN.REPEAT_PLAY,"repeat play public media stream");case 2:return(r=new Nz(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=xP(e),i=0;i<t.seiCount;i++)n.emit(Iz.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=u(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=R(this.remoteStreams);try{for(n=function(){var e=E(r.value,1)[0];i.remoteStreams.delete(e),i.startPlayPublicStream(e).then((function(){var t=i.remoteStreams.get(e);i.safeEmit(Iz.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(sj.ABNORMAL_DISCONNECTION,this._reconnect.bind(this)),null===(t=this._mediaServerClient)||void 0===t||t.on("onRemoteStreamStats",(function(e){r.emit("onRemoteStreamStats",e)}))}}]),a}(VL),R$=new LL("AudioDeviceManager",1),A$=function(e){f(a,e);var t,r,n,i=g(a);function a(e){var t;return c(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),t._extensionManager=e,t}return l(a,[{key:"startAudioPlaybackDeviceTest",value:(n=u(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 ZN(JN.REPEAT_DEVICE_TEST,"device test cannot be called repeatedly at the same time.");case 2:return this._isAudioPlaybackDeviceTesting=!0,R$.print("startAudioPlaybackDeviceTest()","Invoke"),e.prev=4,e.next=7,this._playAudioFile(t,{loop:!0});case 7:e.next=13;break;case 9:throw e.prev=9,e.t0=e.catch(4),this.stopAudioPlaybackDeviceTest(),e.t0;case 13:this._startEmitAudioPlaybackDeviceTestVolume(r);case 14:case"end":return e.stop()}}),e,this,[[4,9]])}))),function(e,t){return n.apply(this,arguments)})},{key:"stopAudioPlaybackDeviceTest",value:function(){this._isAudioPlaybackDeviceTesting&&(R$.print("stopAudioPlaybackDeviceTest()","Invoke"),this._isAudioPlaybackDeviceTesting=!1,this._stopEmitAudioPlaybackDeviceTestVolume(),this._destroyAudioElement())}},{key:"startAudioDeviceRecordTest",value:(r=u(o().mark((function e(t){var r=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._isAudioDeviceRecordTesting){e.next=2;break}throw new ZN(JN.REPEAT_DEVICE_TEST,"device test cannot be called repeatedly at the same time.");case 2:return this._isAudioDeviceRecordTesting=!0,R$.print("startAudioDeviceRecordTest()","Invoke"),this._recoderTimer=window.setTimeout((function(){R$.print("startAudioDeviceRecordTest()","".concat(3e4,'ms automatic call method "stopAudioDeviceRecordAndPlayTest"')),r._stopAudioCaptureAndRecoder()}),3e4),e.next=7,this._startAudioCaptureAndRecoder(t);case 7:delete this._audioCaptureAndRecoderResolve;case 8:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"stopAudioDeviceRecordAndPlayTest",value:function(){R$.print("stopAudioDeviceRecordAndPlayTest()","Invoke"),void 0!==this._recoderTimer&&(clearTimeout(this._recoderTimer),delete this._recoderTimer),this._stopAudioCaptureAndRecoder()}},{key:"stopAudioDevicePlayTest",value:function(){this._isAudioDeviceRecordTesting&&(R$.print("stopAudioDevicePlayTest()","Invoke"),this._isAudioDeviceRecordTesting=!1,this.stopAudioDeviceRecordAndPlayTest(),this._stopEmitAudioPlaybackDeviceTestVolume(),this._destroyAudioElement())}},{key:"getRecordTrack",value:function(){return this._audioTrack}},{key:"destroy",value:function(){R$.print("destroy()","Invoke"),b(p(a.prototype),"removeAllListeners",this).call(this),this.stopAudioPlaybackDeviceTest(),this.stopAudioDevicePlayTest()}},{key:"_playAudioFile",value:function(e,t){var r=this;return new Promise((function(n,i){r._audioElement=mW("audio",{attributes:{src:e,crossOrigin:"",autoplay:"true"}}),r._audioElement.loop=t.loop,R$.print("_playAudioFile()","url=".concat(e,";loop=").concat(t.loop)),r._audioElement.oncanplay=function(){R$.print("_playAudioFile()","oncanplay"),n()},r._audioElement.onerror=function(e){var t,n;i(new ZN(JN.LOAD_RESOURCES_FAILED,"audio error: ".concat(e.message||(null===(t=r._audioElement)||void 0===t||null===(n=t.error)||void 0===n?void 0:n.message))))}}))}},{key:"_destroyAudioElement",value:function(){this._audioElement&&(R$.print("_destroyAudioElement()","Invoke"),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&&(R$.print("_startEmitAudioPlaybackDeviceTestVolume()","start timer(".concat(e,"ms)")),this._audioLevelFetcher=new kH(this._audioElement),this._playbackDeviceTestTimer=self.setInterval((function(){t._audioLevelFetcher&&t.emit("onAudioPlaybackDeviceTestVolume",t._audioLevelFetcher.getAudioLevel())}),e))}},{key:"_stopEmitAudioPlaybackDeviceTestVolume",value:function(){var e;void 0!==this._playbackDeviceTestTimer&&(R$.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=u(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,JH({},this._extensionManager);case 2:return this._audioTrack=e.sent,i=this._audioTrack.getTrack("preprocessing"),r=wH.get(i),R$.print("startAudioDeviceRecordTest()","create microphone track success!"),e.abrupt("return",new Promise((function(e,i){n._mediaRecorder=new MediaRecorder(r),n._mediaRecorder.ondataavailable=function(){var r=u(o().mark((function r(a){var s,u;return o().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!n._isAudioDeviceRecordTesting){r.next=16;break}return R$.print("startAudioDeviceRecordTest()","get recorded file."),u=new Blob([a.data]),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===(s=n._audioElement)||void 0===s||s.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 ZN(JN.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}(xL.exports.EventEmitter),w$=function(){function e(){c(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=u(o().mark((function e(){var t;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=new Ej,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 Q.fluent:r=16e3,t=24e3;break;case Q.standard:r=48e3,t=48e3;break;case Q.hd:r=48e3,t=128e3,n=2;break;case Q.standardStereo:r=48e3,t=8e4,n=2;break;case Q.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 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.playChannel&&t.playChannel>1&&(e+="stereo=1;"),e.slice(0,-1)}},{key:"config",get:function(){var e,t,r,n,i,o,a,s,u,c,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===(u=s.record)||void 0===u?void 0:u.chn),aec:this.aec,agc:this.agc,ans:this.ans,encSampleRate:this.sampleRate||(null===(c=this.engineBAC.codec)||void 0===c?void 0:c.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}(),C$=new LL("VideoSnapshot",1),O$=function(e){var t=null==e?void 0:e.domElement;if(t&&!t.paused&&4===t.readyState)return t},x$=function(){var e=u(o().mark((function e(t,r,n){var i,a,s,u,c,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)},u=Date.now(),!(c=O$(n))){e.next=16;break}return C$.print("takeSnapshot","VideoPlayer already set."),e.next=11,s(c,c.videoWidth,c.videoHeight);case 11:return d=e.sent,C$.print("takeSnapshot","success, cost ".concat(Date.now()-u,"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 C$.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,C$.print("takeSnapshot","success, cost ".concat(Date.now()-u,"ms")),e.abrupt("return",h);case 29:return C$.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);C$.print("takeSnapshot","success, cost ".concat(Date.now()-u,"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)}}(),N$=new WeakMap,D$=function(e,t,r){var n;if(requestAnimationFrame){var i=N$.get(e);null!==(n=i)&&void 0!==n&&n[t]?P$(e,t):i||(i={},N$.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))}()}},P$=function(e,t){var r=N$.get(e);t&&r[t]?cancelAnimationFrame(r[t]):Object.keys(r).length&&Object.keys(r).forEach((function(e){cancelAnimationFrame(r[e])}))},M$=Object.defineProperty,L$=Object.getOwnPropertyDescriptor,U$=function(e,t,r,n){for(var i,o=n>1?void 0:n?L$(t,r):t,a=e.length-1;a>=0;a--)(i=e[a])&&(o=(n?i(t,r,o):i(o))||o);return n&&o&&M$(t,r,o),o},V$=new LL("Engine",0),F$=function(e){f(Fe,e);var t,r,n,a,s,d,v,_,y,S,k,T,I,R,A,O,x,N,M,L,G,H,z,q,W,Y,Q,$,ee,re,ne,oe,ae,se,ue,ce,de,le,he,fe,pe,ve,_e,me,ye,ge,Se,be,Ee,ke,Te,Ie,Re,Ae,we,Ce,Oe,xe,Ne,De,Pe,Me,Le,Ue,Ve=g(Fe);function Fe(e,t){var r;return c(this,Fe),h(m(r=Ve.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),"_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",{}),h(m(r),"_audioStreamConstraints",{}),h(m(r),"_enableSimulcast",!1),h(m(r),"_videoStreamEncodeConfig",[tj]),h(m(r),"_screenStreamEncodeConfig",[rj]),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:!1,video:!1}),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",j.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),"_tempRoomConfig",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 RH),h(m(r),"_audioDeviceManager",new A$(r._extensionManager)),h(m(r),"_audioProfileManager",new w$),h(m(r),"_remoteVideoConfig",new Map),h(m(r),"_userPriorityMap",new Map),h(m(r),"_subscribeFallbackOption",K.DISABLE),h(m(r),"_cameraCapturing",!1),h(m(r),"_interruptCameraCapture",!1),h(m(r),"_micCapturing",!1),h(m(r),"_interruptMicCapture",!1),h(m(r),"_config",void 0),h(m(r),"_updateMixAudioTrack",function(){var e=u(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]:te.PLAYOUT_AND_PUBLISH,V$.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(ie.onAudioMixingStateChanged,e)})),h(m(r),"_onAudioMixingAutoplayFailed",(function(){r.safeEmit(ie.onAutoplayFailed,{})})),r._appId=e,r._pubLock=new Xz("pubLock"),r._addDeviceEventHandler(),r._audioMixingManager=new b$({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:w.VIDEO_SOURCE_TYPE_INTERNAL,screenVideo:w.VIDEO_SOURCE_TYPE_INTERNAL,audio:C.AUDIO_SOURCE_TYPE_INTERNAL,screenAudio:C.AUDIO_SOURCE_TYPE_INTERNAL},r._config=t,r._rtmClient=new T$(e),r._handleRTMClient(r._rtmClient),r._useCloudProxy=!1,r._handleAudioDeviceManager(),r._messageStatisticsObserver=new RW,r._extensionManager.setMinotor(IB),r}return l(Fe,[{key:"appId",get:function(){return this._appId},set:function(e){this._appId=e}},{key:"updateToken",value:(Ue=u(o().mark((function e(t){var r,n,i,a,s,u,c;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(V$.print("updateToken()","token: %s",t),PP(t,"token"),!(this.waitForNewToken&&null!==(r=this._room)&&void 0!==r&&r._roomInfo&&this._tempRoomConfig)){e.next=9;break}return a=null===(i=this._room)||void 0===i?void 0:i._roomInfo,s=a.roomId,u=a.userInfo,c=this._tempRoomConfig,delete this._tempRoomConfig,e.next=8,this.joinRoom(t,s,u,c);case 8:return e.abrupt("return",e.sent);case 9:if(this._room){e.next=11;break}throw new ZN(JN.UPDATE_TOKEN_BEFORE_JOIN,"update token before join room");case 11:return e.next=13,null===(n=this._room)||void 0===n?void 0:n.updateToken(t);case 13:case"end":return e.stop()}}),e,this)}))),function(e){return Ue.apply(this,arguments)})},{key:"setVideoCaptureDevice",value:(Le=u(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(V$.print("setVideoCaptureDevice()","deviceId: %s",t),PP(t,"deviceId"),this._localVideoDeviceId=t,this._localVideoTrack){e.next=5;break}return e.abrupt("return");case 5:return a=this._videoStreamConstraints,"user"===t||"environment"===t||"left"===t||"right"===t?(delete a.deviceId,a.facingMode=t):a.deviceId={exact:t},this._videoStreamConstraints=a,e.next=10,WH(a,this._extensionManager);case 10:if(s=e.sent,this._initLocalTrackEvents(s),this._localVideoTrack.close(),this._localVideoTrack=s,null!==(r=this._videoPlayer)&&void 0!==r&&r.played&&(this._videoPlayer.stop(),this._videoPlayer.playVideo(s),this._videoPlayer.mirror(!!this._mirrorType)),this._room){e.next=17;break}return e.abrupt("return");case 17:if(null===(n=this._room)||void 0===n||null===(i=n.localStream)||void 0===i||!i.pubVideo){e.next=20;break}return e.next=20,this._updatePublish();case 20:case"end":return e.stop()}}),e,this)}))),function(e){return Le.apply(this,arguments)})},{key:"setAudioCaptureDevice",value:(Me=u(o().mark((function e(t){var r,n,i,a;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(V$.print("setAudioCaptureDevice()","deviceId: %s",t),PP(t,"deviceId"),this._localAudioDeviceId=t,this._localAudioTrack){e.next=5;break}return e.abrupt("return");case 5:return(i=this._audioStreamConstraints).deviceId={exact:t},this._audioStreamConstraints=i,this._localAudioTrack.close(),e.next=11,JH(i,this._extensionManager,this._audioProfileManager);case 11:if(a=e.sent,this._initLocalTrackEvents(a),this._localAudioTrack=a,this._room){e.next=16;break}return e.abrupt("return");case 16:if(null===(r=this._room)||void 0===r||null===(n=r.localStream)||void 0===n||!n.pubAudio){e.next=19;break}return e.next=19,this._updatePublish();case 19:case"end":return e.stop()}}),e,this)}))),function(e){return Me.apply(this,arguments)})},{key:"_addDeviceEventHandler",value:function(){bH.on(ie.onVideoDeviceStateChanged,this._onVideoDeviceStateChange.bind(this)),bH.on(ie.onAudioDeviceStateChanged,this._onAudioDeviceStateChange.bind(this))}},{key:"_addHandlerEventHandler",value:function(){var e,t,r,n,i,o,a,s,u,c,d,l,h,f,p,v,_,m,y,g,S,b,E,k,T,I,R,A,w,C=this;null===(e=this._room)||void 0===e||e.on(oj.ON_ADD_STREAM,this._onAddStream.bind(this)),null===(t=this._room)||void 0===t||t.on(oj.ON_REMOVE_STREAM,this._onRemoveStream.bind(this)),null===(r=this._room)||void 0===r||r.on(oj.USER_CONNECTION,this._onUserConnection.bind(this)),null===(n=this._room)||void 0===n||n.on(Iz.ON_USER_LEAVE,this._onUserLeave.bind(this)),null===(i=this._room)||void 0===i||i.on(Iz.ON_ROOM_ERROR,this._onRoomError.bind(this)),null===(o=this._room)||void 0===o||o.on(Iz.ON_NETWORK_QUALITY,this._onNetworkQuality.bind(this)),null===(a=this._room)||void 0===a||a.on(oj.ON_CUSTOM_MESSAGE,this._onCustomMessage.bind(this)),null===(s=this._room)||void 0===s||s.on(oj.USER_MESSAGE_RECEIVED,this._onUserMessageReceived.bind(this)),null===(u=this._room)||void 0===u||u.on(oj.USER_BINARY_MESSAGE_RECEIVED,this._onUserBinaryMessageReceived.bind(this)),null===(c=this._room)||void 0===c||c.on(oj.ON_USER_TOKEN_WILL_EXPIRE,this._onUserTokenWillExpire.bind(this)),null===(d=this._room)||void 0===d||d.on(oj.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(sj.ON_CONNECTION_STATE_CHANGE,this._onConnectionStateChange.bind(this)),null===(h=this._room)||void 0===h||h.on(Iz.RESUBSCRIBE,this._onResubscribe.bind(this)),null===(f=this._room)||void 0===f||f.on(Iz.SUBSCRIBE_PUSH_TRACK,this._onSubscribePushTrack.bind(this)),null===(p=this._room)||void 0===p||p.on(Iz.REMOVE_PUSH_TRACK,this._onRemovePushTrack.bind(this)),null===(v=this._room)||void 0===v||v.on(Iz.ON_PUBLISH_RESULT,(function(e){var t;null!==(t=C._room)&&void 0!==t&&t._roomConfig.isAutoPublish&&C.safeEmit(ie.onAutoPublishResult,e)})),null===(_=this._room)||void 0===_||_.on(Iz.ON_REMOTE_STREAM_STATS,(function(e){C.safeEmit(ie.onRemoteStreamStats,e)})),null===(m=this._room)||void 0===m||m.on(Iz.ON_LOCAL_STREAM_STATS,(function(e){C.safeEmit(ie.onLocalStreamStats,e)})),null===(y=this._room)||void 0===y||y.on(Iz.ON_USER_PUBLISH_STATE_CHANGE,this._onUserPublishStateChange.bind(this)),null===(g=this._room)||void 0===g||g.on(Iz.ON_USER_START_AUDIO_CAPTURE,(function(e,t){var r=e.userId;C._updateAudioPlayerState(t),C.safeEmit(ie.onUserStartAudioCapture,{userId:r})})),null===(S=this._room)||void 0===S||S.on(Iz.ON_USER_STOP_AUDIO_CAPTURE,(function(e){var t=e.userId;C.safeEmit(ie.onUserStopAudioCapture,{userId:t})})),null===(b=this._room)||void 0===b||b.on(Iz.ON_USER_START_VIDEO_CAPTURE,(function(e){var t=e.userId;C.safeEmit(ie.onUserStartVideoCapture,{userId:t})})),null===(E=this._room)||void 0===E||E.on(Iz.ON_USER_STOP_VIDEO_CAPTURE,(function(e){var t=e.userId;C.safeEmit(ie.onUserStopVideoCapture,{userId:t})})),null===(k=this._room)||void 0===k||k.on(Iz.ON_SEI_MESSAGED_RECEIVED,(function(e){C.safeEmit(ie.onSEIMessageReceived,e)})),null===(T=this._room)||void 0===T||T.on(Iz.ON_REMOTE_VIDEO_SIZE_CHANGED,(function(e,t){C.safeEmit(ie.onRemoteVideoSizeChanged,e,t)})),null===(I=this._room)||void 0===I||I.on(Iz.ON_SIMULCAST_SUBSCRIBE_FALLBACK,(function(e){return C.safeEmit(ie.onSimulcastSubscribeFallback,e)})),null===(R=this._room)||void 0===R||R.on(Iz.RECONNECT_FAILED,(function(){C.safeEmit(ie.onError,{errorCode:JN.RECONNECT_FAILED})})),null===(A=this._room)||void 0===A||A.on(Iz.ON_VIDEO_STREAM_BANNED,(function(e){C.safeEmit(ie.onVideoStreamBanned,{uid:e.uid,banned:e.banned})})),null===(w=this._room)||void 0===w||w.on(Iz.ON_AUDIO_STREAM_BANNED,(function(e){C.safeEmit(ie.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 YP(e)&&DB(e,TP(n)),(t=b(p(Fe.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:(Pe=u(o().mark((function e(t,r,n,a){var s,u,c,d;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(V$.print("joinRoom()","token: %o roomId: %o, userInfo: %o, roomConfig: %o",t,r,n,a),jP(t)||PP(t,"token"),GP(r),qP(n),s={isAutoPublish:!0,isAutoSubscribeAudio:!0,isAutoSubscribeVideo:!0,roomProfileType:J.communication},YY(s,a),KP(s),!this._room||this._room.connectionState===eq.DISCONNECTED){e.next=11;break}throw new ZN(JN.REPEAT_JOIN,"Already joined");case 11:return this._room=new vW(a,{audioProfileManager:this._audioProfileManager,streamRTT:{}}),this._room.userPriorityMap=this._userPriorityMap,this._room.subscribeFallbackOption=this._subscribeFallbackOption,this._addHandlerEventHandler(),u=this._liveTranscodeConfig&&QB("started",this._liveTranscodeConfig),e.prev=16,this._useCloudProxy&&(this._startCloudProxyTimestamp=Date.now()),e.next=20,this._room.join(this._appId,r,t,i(i({},n),{},{businessId:this._businessId,role:this._visibility?E$.NORMAL_USER:E$.SILENT_USER}),u,this._useCloudProxy,null===(c=this._config)||void 0===c?void 0:c.expectedIDC);case 20:return d=e.sent,this._roomConfig=a,this._tempRoomConfig&&delete this._tempRoomConfig,null!=a&&a.isAutoPublish&&(this._visibility?this._updatePublish({invokeByJoinRoom:!0,mediaType:V.AUDIO_AND_VIDEO}):this.safeEmit(ie.onAutoPublishResult,{isScreen:!1,state:P.PUBLISH_FAIL})),e.abrupt("return",d);case 27:throw e.prev=27,e.t0=e.catch(16),e.t0.code===JN.INVALID_TOKEN&&(this._tempRoomConfig=a),e.t0;case 31:case"end":return e.stop()}}),e,this,[[16,27]])}))),function(e,t,r,n){return Pe.apply(this,arguments)})},{key:"leaveRoom",value:(De=u(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],V$.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._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 19:case"end":return e.stop()}}),e,this)}))),function(){return De.apply(this,arguments)})},{key:"destroy",value:function(){var e,t,r;V$.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=[tj],this._screenStreamEncodeConfig=[rj],this._pauseAllSubscribeState={audio:!1,video:!1},this._messageStatisticsObserver.destroy(),clearInterval(this._audioVolumeIndicationTimer),clearInterval(this._dummyMainTimer),clearInterval(this._dummyScreenTimer),this._audioVolumeIndicationTimer=void 0,this._stopAudioPropertiesReport(),this._localAudioTrack&&(this._localAudioTrack.close(),this._localAudioTrack=void 0),this._localVideoTrack&&(this._localVideoTrack.close(),this._localVideoTrack=void 0),this._localScreenAudioTrack&&(this._localScreenAudioTrack.close(),this._localScreenAudioTrack=void 0),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._remoteScreenPlayer.forEach((function(e){return e.destroy()})),this._remoteScreenPlayer=new Map,this._remoteVideoPlayer.forEach((function(e){return e.destroy()})),this._remoteVideoPlayer=new Map,this._publicStreamAudioPlayer.forEach((function(e){return e.destroy()})),this._publicStreamAudioPlayer=new Map,this._publicStreamVideoPlayer.forEach((function(e){return e.destroy()})),this._publicStreamVideoPlayer=new Map,this._roomConfig=void 0,this._audioMixingManager.destroy(),this._rtmClient.destroy(),null===(r=this._outsideRoom)||void 0===r||r.destroy(),this._publicStreamIds=new Map,this._audioDeviceManager.destroy(),this._remoteVideoConfig=new Map,this._userPriorityMap.clear(),this._extensionManager.destroy(),this._cameraCapturing=!1,this._micCapturing=!1,this._interruptCameraCapture=!1,this._interruptMicCapture=!1}},{key:"publishStream",value:(Ne=u(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(V$.print("publishStream()","mediaType: %o",t),this._checkMediaType(t),this._assertNotInRoom(),!CP(t)||this._localVideoTrack||!this._localImgVideoTrack){e.next=7;break}return e.next=6,zH(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 Ne.apply(this,arguments)})},{key:"unpublishStream",value:(xe=u(o().mark((function e(t,r){var n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(V$.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:Az.UNPUB});case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return xe.apply(this,arguments)})},{key:"publishScreen",value:(Oe=u(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(V$.print("publishScreen()","mediaType: %o",t),this._checkMediaType(t),this._assertNotInRoom(),e.prev=3,!CP(t)||this._localScreenVideoTrack||!this._localImgScreenTrack){e.next=8;break}return e.next=7,KH(this._localImgScreenTrack,this._extensionManager);case 7:this._localScreenVideoTrack=e.sent;case 8:return e.next=10,this._updateScreenPublish({mediaType:t,pubState:Az.PUB});case 10:e.next=19;break;case 12:if(e.prev=12,e.t0=e.catch(3),!(e.t0 instanceof ZN)){e.next=18;break}throw e.t0;case 18:throw new ZN(JN.UNEXPECTED_ERROR,"unexpected error",e.t0);case 19:case"end":return e.stop()}}),e,this,[[3,12]])}))),function(e){return Oe.apply(this,arguments)})},{key:"unpublishScreen",value:(Ce=u(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return V$.print("unpublishScreen()","mediaType: %o",t),this._checkMediaType(t),this._assertNotInRoom(),e.next=5,this._updateScreenPublish({mediaType:t,pubState:Az.UNPUB});case 5:case"end":return e.stop()}}),e,this)}))),function(e){return Ce.apply(this,arguments)})},{key:"subscribeStream",value:(we=u(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return V$.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 we.apply(this,arguments)})},{key:"_subscribe",value:(Ae=u(o().mark((function e(t,r,n){var i,a,s,u,c,d,l,h,f,p;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._checkMediaType(n),this._assertNotInRoom(),u=this._room.remoteStreams.get(r),c=null==u?void 0:u.find((function(e){return e.isScreen===t}))){e.next=6;break}throw new ZN(JN.STREAM_NOT_EXIST,"stream not exist");case 6:return this._pauseAllSubscribeState.audio&&(n-=n&V.AUDIO),this._pauseAllSubscribeState.video&&(n-=n&V.VIDEO),V$.print("subscribeStream()","due to pauseAll mediaType: %o",n),d=c.hasSubscribed,l=this._remoteVideoConfig.get(r)||(null===(i=this._roomConfig)||void 0===i?void 0:i.remoteVideoConfig),c.originalMediaType=n,e.next=14,this._room.subscribe(c,n,l);case 14:wP(n)&&this._updateAudioPlayerState(c),CP(n)&&this._updateVideoPlayerState(c),!t&&(null!==(a=this._roomConfig)&&void 0!==a&&a.isAutoSubscribeAudio||null!==(s=this._roomConfig)&&void 0!==s&&s.isAutoSubscribeVideo)&&(c.audioTrack||c.videoTrack)&&(h={userId:r,isScreen:!1,state:D.SUBSCRIBE_SUCC},this.safeEmit(ie.onAutoSubscribeResult,h)),!d&&wP(n)&&c.hasAudio&&(null===(f=c.observer)||void 0===f||f.setSubscribeAudio(!0)),!d&&CP(n)&&c.hasVideo&&(null===(p=c.observer)||void 0===p||p.setSubscribeVideo(!0));case 19:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return Ae.apply(this,arguments)})},{key:"unsubscribeStream",value:(Re=u(o().mark((function e(t,r){var n,i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(V$.print("unsubscribeStream()","userId: %o, mediaType: %o",t,r),this._checkMediaType(r),this._assertNotInRoom(),n=this._room.remoteStreams.get(t),null!=(i=null==n?void 0:n.find((function(e){return!e.isScreen})))&&i.hasSubscribed){e.next=7;break}throw new ZN(JN.STREAM_NOT_EXIST,"stream not exist");case 7:this._room.unsubscribe(i,r);case 8:case"end":return e.stop()}}),e,this)}))),function(e,t){return Re.apply(this,arguments)})},{key:"subscribeScreen",value:(Ie=u(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return V$.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 Ie.apply(this,arguments)})},{key:"unsubscribeScreen",value:(Te=u(o().mark((function e(t,r){var n,i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(V$.print("unsubscribeScreen() userId: %o, mediaType: %o",t,r),this._checkMediaType(r),this._assertNotInRoom(),n=this._room.remoteStreams.get(t),null!=(i=null==n?void 0:n.find((function(e){return e.isScreen})))&&i.hasSubscribed){e.next=7;break}throw new ZN(JN.STREAM_NOT_EXIST,"stream not exist");case 7:this._room.unsubscribe(i,r);case 8:case"end":return e.stop()}}),e,this)}))),function(e,t){return Te.apply(this,arguments)})},{key:"setRemoteVideoConfig",value:(ke=u(o().mark((function e(t,r){var n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return V$.print("setRemoteVideoConfig() userId: %o, remoteVideoConfig: %o",t,r),HP(t),JP(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 ke.apply(this,arguments)})},{key:"startVideoCapture",value:(Ee=u(o().mark((function e(t){var r,n,i,a,s,u,c,d,l,h,f,p=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(V$.print("startVideoCapture()","deviceId: %s",t),jP(t)||PP(t,"deviceId"),t=t||this._localVideoDeviceId,this._localVideoDeviceId=t,!(this._cameraCapturing||this._localVideoTrack&&!this._localVideoTrack.dummy)){e.next=6;break}throw new ZN(JN.REPEAT_CAPTURE,"Has already capture");case 6:return s=this._videoStreamConstraints,t&&("user"===t||"environment"===t||"left"===t||"right"===t?s.facingMode=t:s.deviceId={exact:t},this._videoStreamConstraints=s),u={},e.prev=9,this._cameraCapturing=!0,e.next=13,WH(s,this._extensionManager);case 13:if(d=e.sent,!this._interruptCameraCapture){e.next=18;break}throw this._interruptCameraCapture=!1,d.close(),new ZN(JN.INTERRUPT,"interrupt by stopVideoCapture");case 18:this._initLocalTrackEvents(d),this._localVideoTrack=d,null===(c=this._videoPlayer)||void 0===c||c.playVideo(d),(l=null==d?void 0:d.getTrack())&&(u=l.getSettings(),h={width:u.width,height:u.height},this._localVideoTrack.resolution=h,setTimeout((function(){return p.safeEmit(ie.onLocalVideoSizeChanged,{streamIndex:U.STREAM_INDEX_MAIN,info:h})})));case 23:return e.prev=23,this._cameraCapturing=!1,e.finish(23);case 26:if(this._room){e.next=28;break}return e.abrupt("return",u);case 28:return f=this._room._roomConfig.isAutoPublish,(null!==(r=this._room)&&void 0!==r&&null!==(n=r.localStream)&&void 0!==n&&n.pubVideo||f)&&(this._visibility?this._updatePublish():this.safeEmit(ie.onAutoPublishResult,{isScreen:!1,state:P.PUBLISH_FAIL})),null===(i=this._room.localStream)||void 0===i||null===(a=i.observer)||void 0===a||a.setEnableVideo(!0),e.abrupt("return",u);case 32:case"end":return e.stop()}}),e,this,[[9,,23,26]])}))),function(e){return Ee.apply(this,arguments)})},{key:"stopVideoCapture",value:(be=u(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(V$.print("stopVideoCapture()"),!this._cameraCapturing){e.next=5;break}return this._interruptCameraCapture=!0,V$.print("stopVideoCapture()","capturing"),e.abrupt("return");case 5:if(this._trackSourceType.video!==w.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=7;break}throw new ZN(JN.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._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||null===(n=r.localStream)||void 0===n||!n.pubVideo){e.next=14;break}return e.next=14,this._updatePublish();case 14:null===(i=this._room.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 be.apply(this,arguments)})},{key:"startAudioCapture",value:(Se=u(o().mark((function e(t){var r,n,i,a,s,u,c;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(V$.print("startAudioCapture()","deviceId: $o",t),jP(t)||PP(t,"deviceId"),t=t||this._localAudioDeviceId,this._localAudioDeviceId=t,!this._micCapturing&&!this._localAudioTrack){e.next=6;break}throw new ZN(JN.REPEAT_CAPTURE,"Has already capture");case 6:return s=this._audioStreamConstraints,t&&(s.deviceId={exact:t},this._audioStreamConstraints=s),e.prev=8,this._micCapturing=!0,e.next=12,JH(s,this._extensionManager,this._audioProfileManager);case 12:if(u=e.sent,!this._interruptMicCapture){e.next=17;break}throw this._interruptMicCapture=!1,u.close(),new ZN(JN.INTERRUPT,"interrupt by stopAudioCapture");case 17:this._initLocalTrackEvents(u),this._localAudioTrack=u,this._tempMixingAudioTrack&&(this._localAudioTrack.mixType=this._tempMixingAudioTrack.type,this._localAudioTrack.mixedAudioTrack=this._tempMixingAudioTrack.track,delete this._tempMixingAudioTrack);case 20:return e.prev=20,this._micCapturing=!1,e.finish(20);case 23:if(this._room){e.next=25;break}return e.abrupt("return");case 25:c=this._room._roomConfig.isAutoPublish,(null!==(r=this._room)&&void 0!==r&&null!==(n=r.localStream)&&void 0!==n&&n.pubAudio||c)&&(this._visibility?this._updatePublish():this.safeEmit(ie.onAutoPublishResult,{isScreen:!1,state:P.PUBLISH_FAIL})),null===(i=this._room.localStream)||void 0===i||null===(a=i.observer)||void 0===a||a.setEnableAudio(!0);case 28:case"end":return e.stop()}}),e,this,[[8,,20,23]])}))),function(e){return Se.apply(this,arguments)})},{key:"stopAudioCapture",value:(ge=u(o().mark((function e(){var t,r,n,i,a;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(V$.print("stopAudioCapture()"),!this._micCapturing){e.next=5;break}return this._interruptMicCapture=!0,V$.print("stopAudioCapture()","capturing"),e.abrupt("return");case 5:if(null===(t=this._localAudioTrack)||void 0===t||t.close(),this._localAudioTrack=void 0,this._audioMixingManager.stopAll(),this._trackSourceType.audio!==C.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=10;break}throw new ZN(JN.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");case 10:if(this._room){e.next=12;break}return e.abrupt("return");case 12:if(null===(r=this._room)||void 0===r||null===(n=r.localStream)||void 0===n||!n.pubAudio){e.next=15;break}return e.next=15,this._updatePublish();case 15:null===(i=this._room.localStream)||void 0===i||null===(a=i.observer)||void 0===a||a.setEnableAudio(!1);case 16:case"end":return e.stop()}}),e,this)}))),function(){return ge.apply(this,arguments)})},{key:"getAudioMixingManager",value:function(){return V$.print("getAudioMixingManager()"),this._audioMixingManager}},{key:"startScreenCapture",value:(ye=u(o().mark((function e(){var t,r,n,i,a,s,u,c,d,l,h,f,p,v,_,m,y,g,S=this,b=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c=b.length>0&&void 0!==b[0]?b[0]:{},V$.print("startScreenCapture()","config: %o",c),d=c.enableAudio,l=void 0!==d&&d,this._trackSourceType.screenVideo!==w.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=5;break}throw new ZN(JN.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as internal first");case 5:if(this._trackSourceType.screenAudio!==C.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=7;break}throw new ZN(JN.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");case 7:return e.next=9,ZH(l,this._extensionManager,this._screenStreamEncodeConfig[0]);case 9:if(h=e.sent,f=E(h,2),p=f[0],v=f[1],this._localScreenVideoTrack&&!this._localScreenVideoTrack.dummy&&this._localScreenVideoTrack.close(),null===(t=this._localScreenAudioTrack)||void 0===t||t.close(),this._localScreenVideoTrack=p,null!==(r=this._screenStreamEncodeConfig[0])&&void 0!==r&&r.contentHint&&p.setContentHint(null===(_=this._screenStreamEncodeConfig[0])||void 0===_?void 0:_.contentHint),(m=null==p?void 0:p.getTrack())&&(y=m.getSettings(),g={width:y.width,height:y.height},p.resolution=g,setTimeout((function(){return S.safeEmit(ie.onLocalVideoSizeChanged,{streamIndex:U.STREAM_INDEX_SCREEN,info:{width:y.width,height:y.height}})}))),v&&(this._localScreenAudioTrack=v,this._initLocalTrackEvents(v)),null===(n=this._screenPlayer)||void 0===n||n.playVideo(this._localScreenVideoTrack),this._initLocalTrackEvents(this._localScreenVideoTrack,!0),!(null!==(i=this._room)&&void 0!==i&&null!==(a=i.localScreenStream)&&void 0!==a&&a.pubAudio||null!==(s=this._room)&&void 0!==s&&null!==(u=s.localScreenStream)&&void 0!==u&&u.pubVideo)){e.next=25;break}return e.next=25,this._updateScreenPublish();case 25:case"end":return e.stop()}}),e,this)}))),function(){return ye.apply(this,arguments)})},{key:"stopScreenCapture",value:(me=u(o().mark((function e(){var t,r,n,i,a,s,u;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(V$.print("stopScreenCapture()"),null===(t=this._screenPlayer)||void 0===t||t.stop(),this._localScreenVideoTrack&&(this._localScreenVideoTrack.dummy||(this._localScreenVideoTrack.close(),this._localImgScreenTrack&&(null===(u=this._localScreenVideoTrack)||void 0===u||u.setTrack(this._localImgScreenTrack,this._extensionManager),this._localScreenVideoTrack.dummy=!0))),null===(r=this._localScreenAudioTrack)||void 0===r||r.close(),this._localScreenAudioTrack=void 0,!(null!==(n=this._room)&&void 0!==n&&null!==(i=n.localScreenStream)&&void 0!==i&&i.pubAudio||null!==(a=this._room)&&void 0!==a&&null!==(s=a.localScreenStream)&&void 0!==s&&s.pubVideo)){e.next=8;break}return e.next=8,this._updateScreenPublish();case 8:case"end":return e.stop()}}),e,this)}))),function(){return me.apply(this,arguments)})},{key:"setLocalVideoPlayer",value:function(e,t){if(V$.print("setLocalVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",e,t),MP(e,"streamIndex",[U.STREAM_INDEX_MAIN,U.STREAM_INDEX_SCREEN]),t&&t.renderDom){var r,n,o=i(i({userId:this._getUserId()},t),{},{isLocal:!0});if(XP(o),e===U.STREAM_INDEX_MAIN&&!this._videoPlayer)return this._videoPlayer=new TW(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)!==Z.PLAY_MANUALLY&&this._videoPlayer.playVideo(this._localVideoTrack),this._videoPlayer.domElement;if(e===U.STREAM_INDEX_SCREEN&&!this._screenPlayer)return this._screenPlayer=new TW(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)!==Z.PLAY_MANUALLY&&this._screenPlayer.playVideo(this._localScreenVideoTrack),this._screenPlayer.domElement}else{var a,s;e===U.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:(_e=u(o().mark((function e(t){var r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return V$.print("startLiveTranscoding()","transcode: %o",t),PP(t.url,"liveTranscode.url"),this._liveTranscodeConfig=t,e.prev=3,this.safeEmit(ie.onStreamMixingEvent,{event:Rz.START,error:0,message:""}),e.next=7,null===(r=this._room)||void 0===r?void 0:r.liveControlMessage(QB("started",this._liveTranscodeConfig));case 7:e.next=16;break;case 9:if(e.prev=9,e.t0=e.catch(3),!(e.t0 instanceof ZN)){e.next=15;break}throw e.t0;case 15:throw new ZN(JN.UNEXPECTED_ERROR,"unexpected error",e.t0);case 16:case"end":return e.stop()}}),e,this,[[3,9]])}))),function(e){return _e.apply(this,arguments)})},{key:"updateLiveTranscoding",value:(ve=u(o().mark((function e(t){var r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(V$.print("updateLiveTranscoding()","transcode: %o",t),this._liveTranscodeConfig){e.next=3;break}return e.abrupt("return");case 3:return this._liveTranscodeConfig=YY(this._liveTranscodeConfig,t),e.prev=4,this.safeEmit(ie.onStreamMixingEvent,{event:Rz.UPDATE,error:0,message:""}),e.next=8,null===(r=this._room)||void 0===r?void 0:r.liveControlMessage(QB("layoutChanged",this._liveTranscodeConfig));case 8:e.next=17;break;case 10:if(e.prev=10,e.t0=e.catch(4),!(e.t0 instanceof ZN)){e.next=16;break}throw e.t0;case 16:throw new ZN(JN.UNEXPECTED_ERROR,"unexpected error",e.t0);case 17:case"end":return e.stop()}}),e,this,[[4,10]])}))),function(e){return ve.apply(this,arguments)})},{key:"stopLiveTranscoding",value:(pe=u(o().mark((function e(){var t;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(V$.print("stopLiveTranscoding()"),this._liveTranscodeConfig){e.next=3;break}return e.abrupt("return");case 3:return delete this._liveTranscodeConfig,e.prev=4,this.safeEmit(ie.onStreamMixingEvent,{event:Rz.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 ZN)){e.next=16;break}throw e.t0;case 16:throw new ZN(JN.UNEXPECTED_ERROR,"unexpected error",e.t0);case 17:case"end":return e.stop()}}),e,this,[[4,10]])}))),function(){return pe.apply(this,arguments)})},{key:"setBusinessId",value:function(e){return V$.print("setBusinessId()","businessId: %s",e),!function(e){return"string"!=typeof e}(e)&&!this._room&&(wB.setStats({rtc_business_id:e}),oW.setStats({rtc_business_id:e}),this._businessId=e,!0)}},{key:"setUserVisibility",value:(fe=u(o().mark((function e(t){var r,n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(V$.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._room.connectionState===eq.CONNECTED){e.next=9;break}throw new ZN(JN.NOT_CONNECTED_YET,"server not connected");case 9:if(this._room.localStream&&(null===(n=this._room.localStream.observer)||void 0===n||n.setPublisher(t)),e.t0=!t,!e.t0){e.next=14;break}return e.next=14,this._room.unpublish();case 14:return e.next=16,this._room.updateUserAttributes({role:t?E$.NORMAL_USER:E$.SILENT_USER});case 16:this._visibility=t,t&&null!==(r=this._roomConfig)&&void 0!==r&&r.isAutoPublish&&this._updatePublish({mediaType:V.AUDIO_AND_VIDEO});case 18:case"end":return e.stop()}}),e,this)}))),function(e){return fe.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]:U.STREAM_INDEX_MAIN,i=n===U.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(ie.onFirstPublicStreamAudioFrameDecoded,{publicStreamId:o}):(t.safeEmit(ie.onAudioFirstFrameDecoded,{userId:o,isScreen:i}),t.safeEmit(ie.onRemoteAudioFirstFrame,{userId:o,isScreen:i})),IB.firstRemoteAudioRender("",o||"",{isScreen:i})}else{var a,s,u={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?(u.publicStreamId=u.userId,delete u.userId,delete u.isScreen,t.safeEmit(ie.onFirstPublicStreamVideoFrameRendered,u),t.safeEmit(ie.onFirstPublicStreamVideoFrameDecoded,u)):e.isLocal||(t.safeEmit(ie.onVideoFirstFrameRendered,u),t.safeEmit(ie.onVideoFirstFrameDecoded,u),t.safeEmit(ie.onRemoteVideoFirstFrame,u)),IB.firstRemoteVideoRender("",n.userId||"",{isScreen:i})}break;case"autoplay-error":return r&&(n.publicStreamId=n.userId),void t.safeEmit(ie.onAutoplayFailed,{userId:n.userId||n.publicStreamId,kind:e instanceof TW?"video":"audio"})}t.safeEmit(ie.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(ie.onTrackEnded,{kind:e.getTrack().kind,isScreen:r})})),e.on("resolution-change",(function(e){t.safeEmit(ie.onLocalVideoSizeChanged,{streamIndex:r?U.STREAM_INDEX_SCREEN:U.STREAM_INDEX_MAIN,info:e})}))}},{key:"setRemoteVideoPlayer",value:function(e,t){V$.print("setRemoteVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",e,t),MP(e,"streamIndex",[U.STREAM_INDEX_MAIN,U.STREAM_INDEX_SCREEN]),XP(t);var r,n,o,a=t.userId;if(e===U.STREAM_INDEX_MAIN){var s,u,c;if(null===(s=this._remoteVideoPlayer.get(a))||void 0===s||s.destroy(),!t.renderDom)return;var d=new TW(t);this._initPlayerEvents(d,!1,e),this._remoteVideoPlayer.set(a,d);var l=null===(u=this._room)||void 0===u||null===(c=u.remoteStreams.get(a))||void 0===c?void 0:c.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 TW(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){V$.print("setLocalVideoMirrorType()","mirrorType: %o",e),MP(e,"mirrorType",[j.MIRROR_TYPE_NONE,j.MIRROR_TYPE_RENDER]),this._mirrorType=e,this._videoPlayer&&this._videoPlayer.mirror(!!e)}},{key:"setAudioPlaybackDevice",value:(he=u(o().mark((function e(t){var r,n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(V$.print("setAudioPlaybackDevice()","deviceId: %s",t),PP(t,"deviceId"),void 0!==HTMLAudioElement.prototype.setSinkId){e.next=5;break}return V$.print("setAudioPlaybackDevice failed","setSinkId not supported by current browser"),e.abrupt("return");case 5:return e.next=7,bH.enumerateAudioPlaybackDevices();case 7:if(r=e.sent,n=r.find((function(e){return e.deviceId===t}))){e.next=11;break}throw new ZN(JN.INVALID_DEVICE_ID,"audio playback device id ".concat(t," is invalid"));case 11:this._remoteAudioPlayer.forEach((function(e){e.setPlaybackDevice(t)})),this._audioPlaybackDeviceId=t,n&&this.safeEmit(ie.onAudioPlaybackDeviceChanged,n),IB.rtcAudioDevice(dB.PLAYOUT_DEVICE_SWITCH,t,0);case 15:case"end":return e.stop()}}),e,this)}))),function(e){return he.apply(this,arguments)})},{key:"play",value:(le=u(o().mark((function e(t){var r,n,i,a,s,u,c,d,l;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(V$.print("play()","userId | publicStreamId: %s",t),s=null===(r=this._room)||void 0===r||null===(n=r.remoteStreams.get(t||""))||void 0===n?void 0:n.find((function(e){return!e.isScreen})),i=this._remoteAudioPlayer.get(t||""),a=this._remoteVideoPlayer.get(t||""),i||(i=this._publicStreamAudioPlayer.get(t||"")),a||(a=this._publicStreamVideoPlayer.get(t||"")),!t&&this._videoPlayer&&(a=this._videoPlayer),a&&(a.played?a.manuallyPlay():null!=s&&s.videoTrack?a.playVideo(s.videoTrack,s):!t&&this._localVideoTrack&&(a.mirror(!!this._mirrorType),a.playVideo(this._localVideoTrack))),i&&(i.played?i.manuallyPlay():null!=s&&s.audioTrack&&(i.playAudio(s.audioTrack),(c=null==s||null===(u=s.audioTrack._audioLevelFetcher)||void 0===u?void 0:u._ctx)&&c.resume())),null!=s&&s.audioTrack&&(l=null==s||null===(d=s.audioTrack._audioLevelFetcher)||void 0===d?void 0:d._ctx)&&"suspended"===l.state&&l.resume(),t||!this._audioMixingManager){e.next=13;break}return e.next=13,this._audioMixingManager.resumeLocalPlay();case 13:case"end":return e.stop()}}),e,this)}))),function(e){return le.apply(this,arguments)})},{key:"pauseAllSubscribedStream",value:(de=u(o().mark((function e(t){var r,n=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(V$.print("pauseAllSubscribedStream()","mediaType: %o",t),this._checkMediaType(t),!this._pauseAllSubscribeState.audio||!this._pauseAllSubscribeState.video){e.next=4;break}return e.abrupt("return",Promise.resolve());case 4:if(r=function(){wP(t)&&(n._pauseAllSubscribeState.audio=!0),CP(t)&&(n._pauseAllSubscribeState.video=!0)},this._room){e.next=8;break}return r(),e.abrupt("return",Promise.resolve());case 8:return e.abrupt("return",this._room.pauseAllSubscribedStream(t).then((function(){r()})));case 9:case"end":return e.stop()}}),e,this)}))),function(e){return de.apply(this,arguments)})},{key:"resumeAllSubscribedStream",value:(ce=u(o().mark((function e(t){var r,n=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(V$.print("resumeAllSubscribedStream()","mediaType: %o",t),this._checkMediaType(t),this._pauseAllSubscribeState.audio||this._pauseAllSubscribeState.video){e.next=4;break}return e.abrupt("return",Promise.resolve());case 4:if(r=function(){wP(t)&&(n._pauseAllSubscribeState.audio=!1),CP(t)&&(n._pauseAllSubscribeState.video=!1)},this._room){e.next=8;break}return r(),e.abrupt("return",Promise.resolve());case 8:return e.abrupt("return",this._room.resumeAllSubscribedStream(t).then((function(){var e,t;r(),null===(e=n._room)||void 0===e||null===(t=e.remoteStreams)||void 0===t||t.forEach((function(e){Array.isArray(e)&&e.forEach((function(e){n._updateAudioPlayerState(e),n._updateVideoPlayerState(e)}))}))})));case 9:case"end":return e.stop()}}),e,this)}))),function(e){return ce.apply(this,arguments)})},{key:"sendUserMessage",value:(ue=u(o().mark((function e(t,r){var n,i,a=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(HP(t),WP(r),this._room&&this._room.connectionState===eq.CONNECTED){e.next=4;break}throw new ZN(JN.IM_BEFORE_JOIN,"join first");case 4:return i=Date.now(),e.abrupt("return",null===(n=this._room.sendUserMessage(t,r))||void 0===n?void 0:n.then((function(e){return a._messageStatisticsObserver.countP2PMessage(!0,t,!1,i,e),e.id})).catch((function(e){throw a._messageStatisticsObserver.countP2PMessage(!1,t,!1,i),e})));case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return ue.apply(this,arguments)})},{key:"sendUserBinaryMessage",value:(se=u(o().mark((function e(t,r){var n,i,a=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(HP(t),VP(r,"message"),WP(r),this._room&&this._room.connectionState===eq.CONNECTED){e.next=5;break}throw new ZN(JN.IM_BEFORE_JOIN,"join first");case 5:return i=Date.now(),e.abrupt("return",null===(n=this._room.sendUserMessage(t,r))||void 0===n?void 0:n.then((function(e){return a._messageStatisticsObserver.countP2PMessage(!0,t,!0,i,e),e.id})).catch((function(e){throw a._messageStatisticsObserver.countP2PMessage(!1,t,!0,i),e})));case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return se.apply(this,arguments)})},{key:"sendRoomMessage",value:(ae=u(o().mark((function e(t){var r,n=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(WP(t),this._room&&this._room.connectionState===eq.CONNECTED){e.next=3;break}throw new ZN(JN.IM_BEFORE_JOIN,"join first");case 3:return r=Date.now(),e.abrupt("return",this._room.sendRoomMessage(t).then((function(e){var t,i;return n._messageStatisticsObserver.countRoomMessage(!0,null===(t=n._room)||void 0===t||null===(i=t.roomInfo)||void 0===i?void 0:i.roomId,!1,r),e})).catch((function(e){var t,i;throw n._messageStatisticsObserver.countRoomMessage(!1,null===(t=n._room)||void 0===t||null===(i=t.roomInfo)||void 0===i?void 0:i.roomId,!1,r),e})));case 5:case"end":return e.stop()}}),e,this)}))),function(e){return ae.apply(this,arguments)})},{key:"sendRoomBinaryMessage",value:(oe=u(o().mark((function e(t){var r,n=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(WP(t),this._room&&this._room.connectionState===eq.CONNECTED){e.next=3;break}throw new ZN(JN.IM_BEFORE_JOIN,"join first");case 3:return r=Date.now(),e.abrupt("return",this._room.sendRoomMessage(t,!0).then((function(e){var t,i;return n._messageStatisticsObserver.countRoomMessage(!0,null===(t=n._room)||void 0===t||null===(i=t.roomInfo)||void 0===i?void 0:i.roomId,!0,r),e})).catch((function(e){var t,i;throw n._messageStatisticsObserver.countRoomMessage(!1,null===(t=n._room)||void 0===t||null===(i=t.roomInfo)||void 0===i?void 0:i.roomId,!0,r),e})));case 5:case"end":return e.stop()}}),e,this)}))),function(e){return oe.apply(this,arguments)})},{key:"setAudioCaptureConfig",value:(ne=u(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]:{},V$.print("setAudioCaptureConfig()","config: %o",t),delete t.deviceId,FP(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 ne.apply(this,arguments)})},{key:"setVideoCaptureConfig",value:(re=u(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]:{},V$.print("setVideoCaptureConfig()","config: %o",t),delete t.deviceId,FP(t),r=this._videoStreamConstraints.deviceId,this._videoStreamConstraints=t,r&&(this._videoStreamConstraints.deviceId=r),!this._localVideoTrack){e.next=12;break}return this._localVideoTrack.videoCaptureConfig=this._videoStreamConstraints,e.next=11,null===(n=this._localVideoTrack)||void 0===n?void 0:n.updateVideoCaptureConfig();case 11:this._updatePublish();case 12:case"end":return e.stop()}}),e,this)}))),function(){return re.apply(this,arguments)})},{key:"enableSimulcastMode",value:function(e){return V$.print("enableSimulcastMode()","enabled: %o",e),this._enableSimulcast=e,!0}},{key:"setVideoEncoderConfig",value:(ee=u(o().mark((function e(t){var r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:V$.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,null!==(r=this._room)&&void 0!==r&&r.hasPublished&&this._updatePublish();case 6:case"end":return e.stop()}}),e,this)}))),function(e){return ee.apply(this,arguments)})},{key:"setScreenEncoderConfig",value:($=u(o().mark((function e(t){var r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:V$.print("setScreenEncoderConfig()","description: %o",t),this._screenStreamEncodeConfig=[t],this._localScreenVideoTrack&&(this._localScreenVideoTrack.videoCaptureConfig=t,this._localScreenVideoTrack.updateVideoCaptureConfig(),t.contentHint&&this._localScreenVideoTrack.setContentHint(t.contentHint)),null!==(r=this._room)&&void 0!==r&&r.hasScreenPublished&&this._updateScreenPublish();case 4:case"end":return e.stop()}}),e,this)}))),function(e){return $.apply(this,arguments)})},{key:"sendSEIMessage",value:function(e,t,r){V$.print("sendSEIMessage()","streamIdex: %o, message: %o, repeatCount: %o",e,t,r),MP(e,"streamIndex",[U.STREAM_INDEX_MAIN,U.STREAM_INDEX_SCREEN]),DP(r,"repeatCount",0,30);var n="string"==typeof t?new Uint8Array(pP.str2ab(t)):t;if(t.length){var i;if(e===U.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 u,c,d;if(null===(u=this._room)||void 0===u||null===(c=u.localScreenStream)||void 0===c||!c.hasPublished)return;i=null===(d=this._room)||void 0===d?void 0:d.localScreenStream}if(n.byteLength>4096)V$.print("sei size must not bigger than 4KB");else{var l=dP();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 V$.print("sei message must not be empty")}},{key:"setAudioVolumeIndicationInterval",value:function(e){var t=this;V$.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(ie.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(ie.onActiveSpeaker,{userId:o.userId,extraInfo:o.extraInfo})}}}},{key:"enableAudioPropertiesReport",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};V$.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:U.STREAM_INDEX_MAIN,audioPropertiesInfo:{linearVolume:i,nonlinearVolume:AP(i)}})}if(e._localScreenAudioTrack){var o=e._localScreenAudioTrack.getAudioLevel();t.push({streamIndex:U.STREAM_INDEX_SCREEN,audioPropertiesInfo:{linearVolume:o,nonlinearVolume:AP(o)}})}if(e.safeEmit(ie.onLocalAudioPropertiesReport,t),e._room){var a=[];e._room.remoteStreams.forEach((function(t,r){t.forEach((function(t){if(t.audioTrack){var n,i,o=t.audioTrack.getAudioLevel();a.push({streamKey:{userId:r,streamIndex:t.isScreen?U.STREAM_INDEX_SCREEN:U.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:AP(o)}})}}))})),e._sendActiveSpeaker(t,a.filter((function(e){return e.streamKey.streamIndex!==U.STREAM_INDEX_SCREEN}))),e.safeEmit(ie.onRemoteAudioPropertiesReport,a)}}}),o))}},{key:"setVideoSourceType",value:(Q=u(o().mark((function e(t,r){var n,i,a,s,u,c,d,l,h,f,p,v,_,m,y,g,S,b,E,k,T,I,R;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(V$.print("setVideoSourceType()","index: %o, videoSourceType: %o",t,r),MP(t,"streamIndex",[U.STREAM_INDEX_MAIN,U.STREAM_INDEX_SCREEN]),MP(r,"VideoSourceType",[w.VIDEO_SOURCE_TYPE_EXTERNAL,w.VIDEO_SOURCE_TYPE_INTERNAL]),n=t===U.STREAM_INDEX_MAIN?"video":"screenVideo",this._trackSourceType[n]===r){e.next=26;break}if(this._trackSourceType[n]=r,V$.print("setVideoSourceType","set ".concat(n," source type to ").concat(r)),!this._localVideoTrack||t!==U.STREAM_INDEX_MAIN){e.next=17;break}if(c=!1,r===w.VIDEO_SOURCE_TYPE_EXTERNAL&&(c=!0,this._localVideoTrack.close()),null===(i=this._videoPlayer)||void 0===i||i.stop(),this._localVideoTrack=void 0,d=null===(a=this._room)||void 0===a?void 0:a._roomConfig.isAutoPublish,c?null===(l=this._room)||void 0===l||null===(h=l.localStream)||void 0===h||null===(f=h.observer)||void 0===f||f.setEnableVideo(!1):null===(p=this._room)||void 0===p||null===(v=p.localStream)||void 0===v||null===(_=v.observer)||void 0===_||_.setPushVideo(!1),!(null!==(s=this._room)&&void 0!==s&&null!==(u=s.localStream)&&void 0!==u&&u.pubVideo||d)){e.next=17;break}return e.next=17,this._updatePublish();case 17:if(!this._localScreenVideoTrack||t!==U.STREAM_INDEX_SCREEN){e.next=26;break}if(S=!1,r===w.VIDEO_SOURCE_TYPE_EXTERNAL&&(S=!0,this._localScreenVideoTrack.close()),null===(m=this._screenPlayer)||void 0===m||m.stop(),this._localScreenVideoTrack=void 0,S?null===(b=this._room)||void 0===b||null===(E=b.localScreenStream)||void 0===E||null===(k=E.observer)||void 0===k||k.setEnableVideo(!1):null===(T=this._room)||void 0===T||null===(I=T.localScreenStream)||void 0===I||null===(R=I.observer)||void 0===R||R.setPushVideo(!1),null===(y=this._room)||void 0===y||null===(g=y.localScreenStream)||void 0===g||!g.pubVideo){e.next=26;break}return e.next=26,this._updateScreenPublish();case 26:case"end":return e.stop()}}),e,this)}))),function(e,t){return Q.apply(this,arguments)})},{key:"setExternalVideoTrack",value:(Y=u(o().mark((function e(t,r){var n,i,a,s,u,c,d,l,h,f,p;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(V$.print("setExternalVideoTrack()","index: %o, track: %o",t,r),MP(t,"streamIndex",[U.STREAM_INDEX_MAIN,U.STREAM_INDEX_SCREEN]),LP(r),t!==U.STREAM_INDEX_MAIN){e.next=15;break}if(this._trackSourceType.video===w.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=6;break}throw new ZN(JN.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as external first");case 6:return e.next=8,ez(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),u=null===(i=this._room)||void 0===i?void 0:i._roomConfig.isAutoPublish,!(null!==(a=this._room)&&void 0!==a&&null!==(s=a.localStream)&&void 0!==s&&s.pubVideo||u)){e.next=15;break}return e.next=15,this._updatePublish();case 15:if(t!==U.STREAM_INDEX_SCREEN){e.next=27;break}if(this._trackSourceType.screenVideo===w.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=18;break}throw new ZN(JN.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as external first");case 18:return e.next=20,iz(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===(d=this._room)||void 0===d||null===(l=d.localScreenStream)||void 0===l||null===(h=l.observer)||void 0===h||h.setPushVideo(!0),null===(f=this._room)||void 0===f||null===(p=f.localScreenStream)||void 0===p||!p.pubVideo){e.next=27;break}return e.next=27,this._updateScreenPublish();case 27:case"end":return e.stop()}}),e,this)}))),function(e,t){return Y.apply(this,arguments)})},{key:"setAudioSourceType",value:(W=u(o().mark((function e(t,r){var n,i,a,s,u,c,d,l,h,f,p,v,_,m,y,g,S,b,E,k,T;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(V$.print("setAudioSourceType()","index: %o, audioSourceType: %o",t,r),MP(t,"streamIndex",[U.STREAM_INDEX_MAIN,U.STREAM_INDEX_SCREEN]),MP(r,"audioSourceType",[C.AUDIO_SOURCE_TYPE_EXTERNAL,C.AUDIO_SOURCE_TYPE_INTERNAL]),n=t===U.STREAM_INDEX_MAIN?"audio":"screenAudio",this._trackSourceType[n]===r){e.next=24;break}if(this._trackSourceType[n]=r,V$.print("setVideoSourceType","set ".concat(n," source type to ").concat(r)),!this._localAudioTrack||t!==U.STREAM_INDEX_MAIN){e.next=16;break}if(u=!1,this._trackSourceType.audio===C.AUDIO_SOURCE_TYPE_EXTERNAL&&(u=!0,this._localAudioTrack.close()),this._localAudioTrack=void 0,c=null===(i=this._room)||void 0===i?void 0:i._roomConfig.isAutoPublish,u?null===(d=this._room)||void 0===d||null===(l=d.localStream)||void 0===l||null===(h=l.observer)||void 0===h||h.setEnableAudio(!1):null===(f=this._room)||void 0===f||null===(p=f.localStream)||void 0===p||null===(v=p.observer)||void 0===v||v.setPushAudio(!1),!(null!==(a=this._room)&&void 0!==a&&null!==(s=a.localStream)&&void 0!==s&&s.pubAudio||c)){e.next=16;break}return e.next=16,this._updatePublish();case 16:if(!this._localScreenAudioTrack||t!==U.STREAM_INDEX_SCREEN){e.next=24;break}if(y=!1,this._trackSourceType.audio===C.AUDIO_SOURCE_TYPE_EXTERNAL&&(y=!0,this._localScreenAudioTrack.close()),this._localScreenAudioTrack=void 0,y?null===(g=this._room)||void 0===g||null===(S=g.localScreenStream)||void 0===S||null===(b=S.observer)||void 0===b||b.setEnableAudio(!1):null===(E=this._room)||void 0===E||null===(k=E.localScreenStream)||void 0===k||null===(T=k.observer)||void 0===T||T.setPushAudio(!1),null===(_=this._room)||void 0===_||null===(m=_.localScreenStream)||void 0===m||!m.pubAudio){e.next=24;break}return e.next=24,this._updateScreenPublish();case 24:case"end":return e.stop()}}),e,this)}))),function(e,t){return W.apply(this,arguments)})},{key:"setExternalAudioTrack",value:(q=u(o().mark((function e(t,r){var n,i,a,s,u,c,d,l,h,f,p,v;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(V$.print("setExternalAudioTrack()","index: %o, track: %o",t,r),MP(t,"streamIndex",[U.STREAM_INDEX_MAIN,U.STREAM_INDEX_SCREEN]),LP(r),t!==U.STREAM_INDEX_MAIN){e.next=15;break}if(this._trackSourceType.audio===C.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=6;break}throw new ZN(JN.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as external first");case 6:return e.next=8,rz(r,this._extensionManager);case 8:if(this._localAudioTrack=e.sent,this._initLocalTrackEvents(this._localAudioTrack),d=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!==(u=this._room)&&void 0!==u&&null!==(c=u.localStream)&&void 0!==c&&c.pubAudio||d)){e.next=15;break}return e.next=15,this._updatePublish();case 15:if(t!==U.STREAM_INDEX_SCREEN){e.next=26;break}if(this._trackSourceType.screenAudio===C.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=18;break}throw new ZN(JN.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as external first");case 18:return e.next=20,az(r,this._extensionManager);case 20:if(this._localScreenAudioTrack=e.sent,this._initLocalTrackEvents(this._localScreenAudioTrack),null===(l=this._room)||void 0===l||null===(h=l.localScreenStream)||void 0===h||null===(f=h.observer)||void 0===f||f.setPushAudio(!0),null===(p=this._room)||void 0===p||null===(v=p.localScreenStream)||void 0===v||!v.pubAudio){e.next=26;break}return e.next=26,this._updateScreenPublish();case 26:case"end":return e.stop()}}),e,this)}))),function(e,t){return q.apply(this,arguments)})},{key:"login",value:(z=u(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return V$.print("login()","token: %o, userInfo: %o",t,r),jP(t)||PP(t,"token"),HP(r),e.abrupt("return",this._rtmClient.login(t,r));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return z.apply(this,arguments)})},{key:"logout",value:(H=u(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return V$.print("logout()"),e.abrupt("return",this._rtmClient.logout());case 2:case"end":return e.stop()}}),e,this)}))),function(){return H.apply(this,arguments)})},{key:"updateLoginToken",value:(G=u(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return V$.print("updateLoginToken()","token: %o",t),jP(t)||PP(t,"token"),e.abrupt("return",this._rtmClient.updateLoginToken(t));case 3:case"end":return e.stop()}}),e,this)}))),function(e){return G.apply(this,arguments)})},{key:"getPeerOnlineStatus",value:(L=u(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return V$.print("getPeerOnlineStatus()","userId: %o",t),HP(t),e.abrupt("return",this._rtmClient.getPeerOnlineStatus(t));case 3:case"end":return e.stop()}}),e,this)}))),function(e){return L.apply(this,arguments)})},{key:"sendUserMessageOutsideRoom",value:(M=u(o().mark((function e(t,r){var n,i=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return HP(t),WP(r),n=Date.now(),e.prev=3,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})));case 7:throw e.prev=7,e.t0=e.catch(3),this._messageStatisticsObserver.countUserMessageOutsideRoom(!1,t,!1,n),e.t0;case 11:case"end":return e.stop()}}),e,this,[[3,7]])}))),function(e,t){return M.apply(this,arguments)})},{key:"sendUserBinaryMessageOutsideRoom",value:(N=u(o().mark((function e(t,r){var n,i=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return HP(t),VP(r,"message"),WP(r),n=Date.now(),e.prev=4,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})));case 8:throw e.prev=8,e.t0=e.catch(4),this._messageStatisticsObserver.countUserMessageOutsideRoom(!1,t,!0,n),e.t0;case 12:case"end":return e.stop()}}),e,this,[[4,8]])}))),function(e,t){return N.apply(this,arguments)})},{key:"setServerParams",value:(x=u(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return V$.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 x.apply(this,arguments)})},{key:"sendServerMessage",value:(O=u(o().mark((function e(t){var r,n=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return PP(t,"message"),WP(t),r=Date.now(),e.prev=3,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})));case 7:throw e.prev=7,e.t0=e.catch(3),this._messageStatisticsObserver.countServerMessage(!1,!1,r),e.t0;case 11:case"end":return e.stop()}}),e,this,[[3,7]])}))),function(e){return O.apply(this,arguments)})},{key:"sendServerBinaryMessage",value:(A=u(o().mark((function e(t){var r,n=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return VP(t,"message"),WP(t),r=Date.now(),e.prev=3,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})));case 7:throw e.prev=7,e.t0=e.catch(3),this._messageStatisticsObserver.countServerMessage(!1,!0,r),e.t0;case 11:case"end":return e.stop()}}),e,this,[[3,7]])}))),function(e){return A.apply(this,arguments)})},{key:"startCloudProxy",value:function(e){if(this._room)throw new ZN(JN.START_CLOUD_PROXY_AFTER_JOIN,"[startCloudProxy] should be invoke before join room ");V$.print("startCloudProxy()",e),PP(e.logProxy,"logProxy"),PP(e.accessProxy,"accessProxy"),PP(e.configProxy,"configProxy"),this._originIceConfigRequestUrls=JB("ICE_CONFIG_REQUEST_URLS"),this._originLogServerUrl=JB("LOG_SERVER_URL"),this._originConfigServerUrls=JB("CONFIG_REQUEST_DOMAINS"),YB("ICE_CONFIG_REQUEST_URLS",e.accessProxy),YB("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)),YB("CONFIG_REQUEST_DOMAINS",[e.configProxy]),HB.clearAccessNode(this._appId),HB.clearAccessUrls(),this._useCloudProxy=!0}},{key:"stopCloudProxy",value:function(){var e;if(this._room)throw new ZN(JN.STOP_CLOUD_PROXY_BEFORE_LEAVE,"[stopCloudProxy] should be invoke after leave room ");V$.print("stopCloudProxy()"),YB("ICE_CONFIG_REQUEST_URLS",null===(e=this._originIceConfigRequestUrls)||void 0===e?void 0:e.map((function(e){return e.replace("https://","").replace("/dispatch/v1/AccessInfo?Action=GetAccessInfo","")}))),YB("LOG_SERVER_URL",this._originLogServerUrl),YB("CONFIG_REQUEST_DOMAINS",this._originConfigServerUrls),this._useCloudProxy=!1,HB.clearAccessNode(this._appId),HB.clearAccessUrls(),this._startCloudProxyTimestamp=void 0}},{key:"startPushPublicStream",value:(R=u(o().mark((function e(t,r){var n,i=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(V$.print("startPushPublicStream()","publicStreamId: %o, publicStreamParam: %o",t,r),zP(t),this._room&&this._room.connectionState===eq.CONNECTED){e.next=4;break}throw new ZN(JN.START_PUBLIC_STREAM_BEFORE_JOIN,"join first");case 4:if(!this._publicStreamIds.get(t)){e.next=6;break}throw new ZN(JN.REPEAT_PUSH,"repeat push public media stream");case 6:return n=ZB(t,"started",r),e.abrupt("return",this._room.publicStreamControlMessage(n).then((function(){i._publicStreamIds.set(t,t)})));case 8:case"end":return e.stop()}}),e,this)}))),function(e,t){return R.apply(this,arguments)})},{key:"updatePublicStreamParam",value:(I=u(o().mark((function e(t,r){var n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(V$.print("startPushPublicStream()","publicStreamId: %o, publicStreamParam: %o",t,r),zP(t),this._room&&this._room.connectionState===eq.CONNECTED){e.next=4;break}throw new ZN(JN.START_PUBLIC_STREAM_BEFORE_JOIN,"join first");case 4:return n=ZB(t,"layoutChanged",r),e.abrupt("return",this._room.publicStreamControlMessage(n));case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return I.apply(this,arguments)})},{key:"stopPushPublicStream",value:(T=u(o().mark((function e(t){var r=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(V$.print("startPushPublicStream()","publicStreamId: %o",t),zP(t),this._room&&this._room.connectionState===eq.CONNECTED){e.next=4;break}throw new ZN(JN.START_PUBLIC_STREAM_BEFORE_JOIN,"join first");case 4:return e.abrupt("return",this._room.publicStreamControlMessage({type:"publicstream",action:"stopped",publicStreamID:t}).then((function(){r._publicStreamIds.delete(t)})));case 5:case"end":return e.stop()}}),e,this)}))),function(e){return T.apply(this,arguments)})},{key:"startPlayPublicStream",value:(k=u(o().mark((function e(t){var r,n,i,a,s,u,c=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(zP(t),this._outsideRoom){e.next=8;break}return this._outsideRoom=new I$(this._appId),this._outsideRoom.on(Iz.RESUBSCRIBE,(function(e){var t=e.stream;if(t){var r,n=c._publicStreamAudioPlayer.get(t.streamId);n&&t.audioTrack&&(n.stop(),n.playAudio(null===(r=e.stream)||void 0===r?void 0:r.audioTrack));var i,o=c._publicStreamVideoPlayer.get(t.streamId);o&&t.videoTrack&&o.playVideo(null===(i=e.stream)||void 0===i?void 0:i.videoTrack)}})),null===(r=this._outsideRoom)||void 0===r||r.on("onRemoteStreamStats",(function(e){e.publicStreamId=e.userId,delete e.userId,delete e.isScreen,c.safeEmit(ie.onPublicStreamStats,e)})),null===(n=this._outsideRoom)||void 0===n||n.on(Iz.ON_SEI_MESSAGED_RECEIVED,(function(e){c.safeEmit(ie.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 IW(t,{muted:(null===(u=this._config)||void 0===u?void 0:u.autoPlayPolicy)===Z.VIDEO_ONLY}),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 k.apply(this,arguments)})},{key:"stopPlayPublicStream",value:(S=u(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 S.apply(this,arguments)})},{key:"setAudioProfile",value:(y=u(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 y.apply(this,arguments)})},{key:"setPublicStreamVideoPlayer",value:function(e,t){var r,n,o,a;V$.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 TW(i(i({},t),{},{userId:e})),this._initPlayerEvents(s,!0),this._publicStreamVideoPlayer.set(e,s);var u=null===(n=this._outsideRoom)||void 0===n||null===(o=n.remoteStreams)||void 0===o?void 0:o.get(e);null!=u&&u.videoTrack&&(null===(a=this._config)||void 0===a?void 0:a.autoPlayPolicy)!==Z.PLAY_MANUALLY&&s.playVideo(u.videoTrack,u)}else this._publicStreamVideoPlayer.delete(e)}},{key:"setDummyCaptureImagePath",value:(_=u(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){PP(r,"filePath");var o=new Image;o.crossOrigin="anonymous",o.src=r,o.onload=function(){try{var r=document.createElement("canvas"),a=r.getContext("2d");if(!a)return i(new ZN(JN.UNEXPECTED_ERROR,"Not support canvas"));r.width=o.width,r.height=o.height,a.drawImage(o,0,0,o.width,o.height);var s=window.setInterval((function(){a.drawImage(o,0,0,o.width,o.height)}),200);t===U.STREAM_INDEX_MAIN?(clearInterval(n._dummyMainTimer),n._dummyMainTimer=s):(clearInterval(n._dummyScreenTimer),n._dummyScreenTimer=s);var u=r.captureStream(5).getVideoTracks()[0];t===U.STREAM_INDEX_MAIN?n._localImgVideoTrack=u:n._localImgScreenTrack=u,e()}catch(c){i(new ZN(JN.UNEXPECTED_ERROR,c.message))}},o.onerror=function(){i(new ZN(JN.UNEXPECTED_ERROR,"Load image error"))}})));case 1:case"end":return e.stop()}}),e)}))),function(e,t){return _.apply(this,arguments)})},{key:"registerExtension",value:(v=u(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.monitor=IB,t.isSupported()){e.next=3;break}throw new Error("This extension is not supported.");case 3:return e.next=5,t.init();case 5:this._extensionManager.register(t);case 6:case"end":return e.stop()}}),e,this)}))),function(e){return v.apply(this,arguments)})},{key:"defaultTranscoding",value:function(){return JSON.parse(JSON.stringify(ej))}},{key:"_updatePublish",value:(d=u(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]:{},V$.print("_updatePublish()","config: %o",t),r={mediaType:void 0,invokeByJoinRoom:!1,pubState:Az.PUB},t=i(i({},r),t),this._visibility){e.next=6;break}throw new ZN(JN.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===eq.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 ZN)){e.next=23;break}throw e.t0;case 23:throw new ZN(JN.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 d.apply(this,arguments)})},{key:"startAudioPlaybackDeviceTest",value:(s=u(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return V$.print("startAudioPlaybackDeviceTest()","filePath: %o, indicationInterval: %o",t,r),PP(t,"filePath"),DP(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 s.apply(this,arguments)})},{key:"stopAudioPlaybackDeviceTest",value:function(){V$.print("stopAudioPlaybackDeviceTest()"),this._audioDeviceManager.stopAudioPlaybackDeviceTest()}},{key:"startAudioDeviceRecordTest",value:(a=u(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return V$.print("startAudioDeviceRecordTest()","indicationInterval: %o",t),DP(t,"indicationInterval"),e.next=4,this._audioDeviceManager.startAudioDeviceRecordTest(t);case 4:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"stopAudioDeviceRecordAndPlayTest",value:function(){V$.print("stopAudioDeviceRecordAndPlayTest()"),this._audioDeviceManager.stopAudioDeviceRecordAndPlayTest()}},{key:"stopAudioDevicePlayTest",value:function(){V$.print("stopAudioDevicePlayTest()"),this._audioDeviceManager.stopAudioDevicePlayTest()}},{key:"setRemoteUserPriority",value:function(e,t){var r;V$.print("setRemoteUserPriority()","userId: %o, priority: %o",e,t);try{HP(e),MP(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.setRemoteUserPriority(e,t),!0}},{key:"takeLocalSnapshot",value:(n=u(o().mark((function e(t){var r,n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(V$.print("takeLocalSnapshot()","streamIndex: %o",t),MP(t,"streamIndex",[U.STREAM_INDEX_MAIN,U.STREAM_INDEX_SCREEN]),r=t===U.STREAM_INDEX_MAIN?this.localVideoTrack:this.localScreenVideoTrack){e.next=5;break}throw new ZN(JN.INVOKED_BEFORE_CAPTURE,"capture first");case 5:return n=t===U.STREAM_INDEX_MAIN?this._videoPlayer:this._screenPlayer,e.abrupt("return",x$(r.getTrack("preprocessing"),(null==n?void 0:n.mirrorType)===j.MIRROR_TYPE_RENDER,n));case 7:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"takeRemoteSnapshot",value:(r=u(o().mark((function e(t,r){var n,i,a,s,u,c;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(V$.print("takeRemoteSnapshot()","id: %o, streamIndex: %o",t,r),PP(t,"id"),MP(r,"streamIndex",[U.STREAM_INDEX_MAIN,U.STREAM_INDEX_SCREEN]),c=(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===U.STREAM_INDEX_SCREEN)})))||void 0===a?void 0:a.videoTrack)||(null===(s=this._outsideRoom)||void 0===s||null===(u=s.remoteStreams.get(t))||void 0===u?void 0:u.videoTrack)){e.next=6;break}throw new ZN(JN.STREAM_NOT_EXIST,"stream not exist");case 6:return e.abrupt("return",x$(c.getTrack(),!1,r===U.STREAM_INDEX_MAIN?this._remoteVideoPlayer.get(t):this._remoteScreenPlayer.get(t)));case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"setSubscribeFallbackOption",value:function(e){V$.print("setSubscribeFallbackOption()","option: %o",e);try{MP(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===U.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 uz&&r.mixedAudioTrack?r.mixedAudioTrack:r.getTrack("preprocessing");if(o){var a=n();return D$(o,"enabled",this._reportMsTrackEvent.bind(this,"enabled",(null==a?void 0:a.streamId)||"","getLocalStreamTrack",t)),D$(o,"readyState",(function(e){"ended"===e&&(P$(o,"enabled"),P$(o,"readyState")),i._reportMsTrackEvent("readyState",(null==a?void 0:a.streamId)||"","getLocalStreamTrack",t,e)})),o.addEventListener("ended",(function(){P$(o,"enabled"),P$(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,u,c,d,l;if(t===U.STREAM_INDEX_MAIN)s=a.find((function(e){return!e.isScreen})),i="video"===r?null===(u=s)||void 0===u?void 0:u.videoTrack:null===(c=s)||void 0===c?void 0:c.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 D$(h,"enabled",this._reportMsTrackEvent.bind(this,"enabled",f,"getRemoteStreamTrack",r)),D$(h,"readyState",(function(e){"ended"===e&&(P$(h,"enabled"),P$(h,"readyState")),o._reportMsTrackEvent("readyState",f,"getRemoteStreamTrack",r,e)})),h.addEventListener("ended",(function(){P$(h,"enabled"),P$(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 D$(o,"enabled",this._reportMsTrackEvent.bind(this,"enabled",a,"getPublicStreamTrack",t)),D$(o,"readyState",(function(e){"ended"===e&&(P$(o,"enabled"),P$(o,"readyState")),r._reportMsTrackEvent("readyState",a,"getPublicStreamTrack",t,e)})),o.addEventListener("ended",(function(){P$(o,"enabled"),P$(o,"readyState")})),o}}}}}},{key:"_reportMsTrackEvent",value:function(e,t,r,n,i){var o;switch(e){case"readyState":o="live"!==i?"".concat(n," stopped"):"unknown";break;case"enabled":o="".concat(n,!0===i?" unmuted":" muted");break;default:o="unknown"}IB.rtcInvokeStatus(o,0,r,t||"",0,{direction:"getLocalStreamTrack"===r?"up":"down"})}},{key:"_updateScreenPublish",value:(t=u(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]:{},V$.print("_updateScreenPublish()"),r={mediaType:void 0,pubState:Az.PUB},t=i(i({},r),t),e.next=6,this._pubLock.lock();case 6:if(n=e.sent,this._room&&this._room.connectionState===eq.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 ZN)){e.next=21;break}throw e.t0;case 21:throw new ZN(JN.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 t.apply(this,arguments)})},{key:"_updateAudioPlayerState",value:function(e){V$.print("_updateAudioPlayerState()");var t,r=e.userId,n=e.isScreen;if(t=n?this._remoteAudioPlayer.get("".concat(r,"_screen")):this._remoteAudioPlayer.get(r),e.audioTrack&&(e.attributes.audiostream&&e.subAudio||this.multiChatMode)){var i;if(!t){var o,a=n?"".concat(r,"_screen"):r;t=new IW(a,{muted:(null===(o=this._config)||void 0===o?void 0:o.autoPlayPolicy)===Z.VIDEO_ONLY}),this._initPlayerEvents(t,!1,n?U.STREAM_INDEX_SCREEN:U.STREAM_INDEX_MAIN),this._remoteAudioPlayer.set(a,t),this._audioPlaybackDeviceId&&t.setPlaybackDevice(this._audioPlaybackDeviceId)}(null===(i=this._config)||void 0===i?void 0:i.autoPlayPolicy)!==Z.PLAY_MANUALLY&&t.playAudio(e.audioTrack)}else{var s;null===(s=t)||void 0===s||s.stop()}}},{key:"_updateVideoPlayerState",value:function(e){var t;V$.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)!==Z.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=cz.NONE;if(i&&(s|=V.AUDIO),a&&(s|=V.VIDEO),s){var u;if(null!=t&&t.isScreen)this.safeEmit(ie.onUserPublishScreen,{userId:t.userId,mediaType:s});else this.safeEmit(ie.onUserPublishStream,{userId:t.userId,mediaType:s,videoStreamDescriptions:null==t||null===(u=t.attributes)||void 0===u?void 0:u.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(ie.onUserStartAudioCapture,{userId:t.userId}),o&&this.safeEmit(ie.onUserStartVideoCapture,{userId:t.userId}))}}},{key:"_handleAutoSubscribe",value:function(e,t){var r,n,i=cz.NONE;if(null!==(r=this._roomConfig)&&void 0!==r&&r.isAutoSubscribeAudio&&(i|=V.AUDIO),null!==(n=this._roomConfig)&&void 0!==n&&n.isAutoSubscribeVideo&&(i|=V.VIDEO),V$.print("_onAddStream","autoSubType: ".concat(i)),i){var o,a;if(t&&wP(i))null===(o=e.observer)||void 0===o||o.setAutoSubscribeAudio(!0);if(t&&CP(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=B$[e.reason])&&void 0!==t?t:F.STREAM_REMOVE_REASON_OTHER,o=n.isScreen?ie.onUserUnpublishScreen:ie.onUserUnpublishStream,a=cz.NONE;n.attributes.audiostream&&(a|=V.AUDIO),n.attributes.videostream&&(a|=V.VIDEO),null!=n&&n._workaround_1_&&(a=V.VIDEO),a!==cz.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){if(null==n||!n._workaround_1_){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(ie.onUserJoined,e)}},{key:"_onUserLeave",value:function(e){this.safeEmit(ie.onUserLeave,e)}},{key:"_onRoomError",value:function(e){var t;this.safeEmit(ie.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,[ie.onNetworkQuality].concat(t))}},{key:"_onConnectionStateChange",value:function(e){void 0!==this._startCloudProxyTimestamp&&this._useCloudProxy&&e.state===B.CONNECTION_STATE_CONNECTED&&this.safeEmit(ie.onCloudProxyConnected,{interval:Date.now()-this._startCloudProxyTimestamp}),this.safeEmit(ie.onConnectionStateChanged,e)}},{key:"_getRemotePlayer",value:function(e,t){return[this._remoteAudioPlayer.get(t?"".concat(e,"_screen"):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(ie.onVideoDeviceStateChanged,e)}},{key:"_onAudioDeviceStateChange",value:function(e){this.safeEmit(ie.onAudioDeviceStateChanged,e)}},{key:"_onUserPublishStateChange",value:function(e){var t,r=e.userId,n=e.isScreen,o=e.mediaType,a=e.pubState,s=e.remoteStream,u={userId:r,mediaType:o};n?a===Az.PUB?this.safeEmit(ie.onUserPublishScreen,u):this.safeEmit(ie.onUserUnpublishScreen,i(i({},u),{},{reason:F.STREAM_REMOVE_REASON_UNPUBLISH})):a===Az.PUB?(u.videoStreamDescriptions=null==s||null===(t=s.attributes)||void 0===t?void 0:t.videoDescriptions,this.safeEmit(ie.onUserPublishStream,u),this._handleAutoSubscribe(s,!0)):this.safeEmit(ie.onUserUnpublishStream,i(i({},u),{},{reason:F.STREAM_REMOVE_REASON_UNPUBLISH}))}},{key:"_onCustomMessage",value:function(e){var t=e.message;e.binary?this.safeEmit(ie.onRoomBinaryMessageReceived,{userId:e.clientId,message:t}):this.safeEmit(ie.onRoomMessageReceived,{userId:e.clientId,message:t})}},{key:"_onUserMessageReceived",value:function(e){this._messageStatisticsObserver.recvP2PMessage(e.userId),this.safeEmit(ie.onUserMessageReceived,e)}},{key:"_onUserBinaryMessageReceived",value:function(e){this._messageStatisticsObserver.recvP2PMessage(e.userId),this.safeEmit(ie.onUserBinaryMessageReceived,e)}},{key:"_onLiveTranscodingResult",value:function(e){this.safeEmit(ie.onLiveTranscodingResult,e)}},{key:"_onStreamMixingEvent",value:function(e){this.safeEmit(ie.onStreamMixingEvent,e)}},{key:"_onUserTokenWillExpire",value:function(){this.safeEmit(ie.onTokenWillExpire)}},{key:"_onPushPublicStreamResult",value:function(e){this.safeEmit(ie.onPushPublicStreamResult,e)}},{key:"_handleRTMClient",value:function(e){var t=this;e.on("onUserMessageReceivedOutsideRoom",(function(e){t._messageStatisticsObserver.recvP2POutRoomMessage(e.userId),t.safeEmit(ie.onUserMessageReceivedOutsideRoom,e)})),e.on("onUserBinaryMessageReceivedOutsideRoom",(function(e){t._messageStatisticsObserver.recvP2POutRoomMessage(e.userId),t.safeEmit(ie.onUserBinaryMessageReceivedOutsideRoom,e)})),e.on("onUserDisconnection",(function(){t.safeEmit(ie.onError,{errorCode:JN.RTM_DUPLICATE_LOGIN})})),e.on("onRTMTokenError",(function(){t.safeEmit(ie.onError,{errorCode:JN.RTM_TOKEN_ERROR})})),e.on("onServerParamsSetResult",(function(e){t.safeEmit(ie.onServerParamsSetResult,null==e?void 0:e.code)}))}},{key:"waitForNewToken",get:function(){return!!this._tempRoomConfig}},{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:"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(ie.onAudioPlaybackDeviceTestVolume,t)}))}},{key:"_assertNotInRoom",value:function(){if(!this._room||this._room.connectionState!==eq.CONNECTED)throw new ZN(JN.INVOKED_BEFORE_JOIN_ROOM,"join first")}},{key:"_checkMediaType",value:function(e){MP(e,"mediaType",[V.AUDIO,V.VIDEO,V.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"}}]),Fe}(VL);U$([NB()],F$.prototype,"updateToken",1),U$([NB()],F$.prototype,"setVideoCaptureDevice",1),U$([NB()],F$.prototype,"setAudioCaptureDevice",1),U$([NB()],F$.prototype,"joinRoom",1),U$([NB()],F$.prototype,"leaveRoom",1),U$([NB()],F$.prototype,"destroy",1),U$([NB()],F$.prototype,"publishStream",1),U$([NB()],F$.prototype,"unpublishStream",1),U$([NB()],F$.prototype,"publishScreen",1),U$([NB()],F$.prototype,"unpublishScreen",1),U$([NB()],F$.prototype,"subscribeStream",1),U$([NB()],F$.prototype,"unsubscribeStream",1),U$([NB()],F$.prototype,"subscribeScreen",1),U$([NB()],F$.prototype,"unsubscribeScreen",1),U$([NB()],F$.prototype,"setRemoteVideoConfig",1),U$([NB()],F$.prototype,"startVideoCapture",1),U$([NB()],F$.prototype,"stopVideoCapture",1),U$([NB()],F$.prototype,"startAudioCapture",1),U$([NB()],F$.prototype,"stopAudioCapture",1),U$([NB()],F$.prototype,"getAudioMixingManager",1),U$([NB()],F$.prototype,"startScreenCapture",1),U$([NB()],F$.prototype,"stopScreenCapture",1),U$([NB()],F$.prototype,"setLocalVideoPlayer",1),U$([NB()],F$.prototype,"startLiveTranscoding",1),U$([NB()],F$.prototype,"updateLiveTranscoding",1),U$([NB()],F$.prototype,"stopLiveTranscoding",1),U$([NB()],F$.prototype,"setBusinessId",1),U$([NB()],F$.prototype,"setUserVisibility",1),U$([NB()],F$.prototype,"setRemoteVideoPlayer",1),U$([NB()],F$.prototype,"setLocalVideoMirrorType",1),U$([NB()],F$.prototype,"setAudioPlaybackDevice",1),U$([NB()],F$.prototype,"play",1),U$([NB()],F$.prototype,"pauseAllSubscribedStream",1),U$([NB()],F$.prototype,"resumeAllSubscribedStream",1),U$([NB()],F$.prototype,"sendUserMessage",1),U$([NB()],F$.prototype,"sendUserBinaryMessage",1),U$([NB()],F$.prototype,"sendRoomMessage",1),U$([NB()],F$.prototype,"sendRoomBinaryMessage",1),U$([NB()],F$.prototype,"setAudioCaptureConfig",1),U$([NB()],F$.prototype,"setVideoCaptureConfig",1),U$([NB()],F$.prototype,"enableSimulcastMode",1),U$([NB()],F$.prototype,"setVideoEncoderConfig",1),U$([NB()],F$.prototype,"setScreenEncoderConfig",1),U$([NB()],F$.prototype,"sendSEIMessage",1),U$([NB()],F$.prototype,"setAudioVolumeIndicationInterval",1),U$([NB()],F$.prototype,"enableAudioPropertiesReport",1),U$([NB()],F$.prototype,"setVideoSourceType",1),U$([NB()],F$.prototype,"setExternalVideoTrack",1),U$([NB()],F$.prototype,"setAudioSourceType",1),U$([NB()],F$.prototype,"setExternalAudioTrack",1),U$([NB("rtm")],F$.prototype,"login",1),U$([NB("rtm")],F$.prototype,"logout",1),U$([NB("rtm")],F$.prototype,"updateLoginToken",1),U$([NB("rtm")],F$.prototype,"getPeerOnlineStatus",1),U$([NB("rtm")],F$.prototype,"sendUserMessageOutsideRoom",1),U$([NB("rtm")],F$.prototype,"sendUserBinaryMessageOutsideRoom",1),U$([NB("rtm")],F$.prototype,"setServerParams",1),U$([NB("rtm")],F$.prototype,"sendServerMessage",1),U$([NB("rtm")],F$.prototype,"sendServerBinaryMessage",1),U$([NB()],F$.prototype,"startCloudProxy",1),U$([NB()],F$.prototype,"stopCloudProxy",1),U$([NB()],F$.prototype,"startPushPublicStream",1),U$([NB()],F$.prototype,"updatePublicStreamParam",1),U$([NB()],F$.prototype,"stopPushPublicStream",1),U$([NB("outsideRoom","streamId")],F$.prototype,"startPlayPublicStream",1),U$([NB("outsideRoom","streamId")],F$.prototype,"stopPlayPublicStream",1),U$([NB()],F$.prototype,"setAudioProfile",1),U$([NB("outsideRoom")],F$.prototype,"setPublicStreamVideoPlayer",1),U$([NB()],F$.prototype,"setDummyCaptureImagePath",1),U$([NB()],F$.prototype,"registerExtension",1),U$([NB()],F$.prototype,"startAudioPlaybackDeviceTest",1),U$([NB()],F$.prototype,"stopAudioPlaybackDeviceTest",1),U$([NB()],F$.prototype,"startAudioDeviceRecordTest",1),U$([NB()],F$.prototype,"stopAudioDeviceRecordAndPlayTest",1),U$([NB()],F$.prototype,"stopAudioDevicePlayTest",1),U$([NB()],F$.prototype,"setRemoteUserPriority",1),U$([NB()],F$.prototype,"takeLocalSnapshot",1),U$([NB()],F$.prototype,"takeRemoteSnapshot",1),U$([NB()],F$.prototype,"setSubscribeFallbackOption",1),U$([NB()],F$.prototype,"getLocalStreamTrack",1),U$([NB()],F$.prototype,"getRemoteStreamTrack",1),U$([NB()],F$.prototype,"getPublicStreamTrack",1);var B$={"client unpublished":F.STREAM_REMOVE_REASON_UNPUBLISH,"publish failed":F.STREAM_REMOVE_REASON_PUBLISH_FAILED,"stream removed":F.STREAM_REMOVE_REASON_KEEP_LIVE_FAILED,"client disconnected":F.STREAM_REMOVE_REASON_CLIENT_DISCONNECTED,"client republish":F.STREAM_REMOVE_REASON_REPUBLISH},j$=new LL("VERTC",0);[wB,CB,OB].forEach((function(e){var t;return e.setStats({rtc_sdk_version:WB.VERSION,product_line:jF.RTC,report_version:GF.W_5,os:HF.WEB,device_id:HB.getDeviceId(),user_agent:fP()?"":null===(t=navigator)||void 0===t?void 0:t.userAgent})})),oW.setStats({rtc_sdk_version:WB.VERSION});var G$=function(e,t){return j$.print("createEngine","Invoke VERTC.createEngine"),PP(e,"appId"),[wB,CB,OB].forEach((function(r){return r.setStats({rtc_app_id:e,auto_play_policy:null==t?void 0:t.autoPlayPolicy})})),oW.setStats({rtc_app_id:e}),IB.sdkInitEngine(Date.now(),vB.BEGIN),new F$(e,t)},H$=function(e){if(j$.print("destroyEngine","Invoke VERTC.destroyEngine"),!(e instanceof F$))throw new ZN(JN.INVALID_ENGINE,"Invalid engine object");e.destroy(),IB.sdkInitEngine(Date.now(),vB.END)},z$=function(){var e=u(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",bH.enumerateDevices());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),q$=function(){var e=u(o().mark((function e(){var t,r,n,i,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]:{video:!0,audio:!0},r=t.video,n=t.audio,i={video:!1,audio:!1},!r){e.next=12;break}return e.prev=4,e.next=7,bH.getVideoPermission();case 7:i.video=e.sent,e.next=12;break;case 10:e.prev=10,e.t0=e.catch(4);case 12:if(!n){e.next=21;break}return e.prev=13,e.next=16,bH.getAudioPermission();case 16:i.audio=e.sent,e.next=21;break;case 19:e.prev=19,e.t1=e.catch(13);case 21:return e.abrupt("return",i);case 22:case"end":return e.stop()}}),e,null,[[4,10],[13,19]])})));return function(){return e.apply(this,arguments)}}(),K$=function(){var e=u(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",bH.enumerateAudioCaptureDevices());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),X$=function(){var e=u(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",bH.enumerateVideoCaptureDevices());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),W$=function(){var e=u(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",bH.enumerateAudioPlaybackDevices());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Y$=function(){return WB.VERSION},J$=function(){return IB.rtcSdkApiCall("isSupported",0,""),Pj()},Q$=function(){return IB.rtcSdkApiCall("getSupportedCodecs",0,""),Lj()};return!fP()&&location.search.includes("_rtc_autotest_"),i(i(i(i({},new(l((function e(){c(this,e),h(this,"getSdkVersion",Y$),h(this,"createEngine",G$),h(this,"destroyEngine",H$),h(this,"enumerateDevices",z$),h(this,"enableDevices",q$),h(this,"enumerateAudioCaptureDevices",K$),h(this,"enumerateVideoCaptureDevices",X$),h(this,"enumerateAudioPlaybackDevices",W$),h(this,"getParameter",JB),h(this,"setParameter",YB),h(this,"isSupported",J$),h(this,"getSupportedCodecs",Q$),h(this,"events",ie),h(this,"ErrorCode",JN),h(this,"platform","".concat({}.PRODUCT_PLATFORM)),h(this,"_monitor",IB)})))),$),ne),{},{events:ie})}));
|
|
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",u=i.toStringTag||"@@toStringTag";function c(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(C){c=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 R(i||[]);return n(a,"_invoke",{value:E(e,r,s)}),a}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(C){return{type:"throw",arg:C}}}e.wrap=d;var h={};function f(){}function p(){}function v(){}var _={};c(_,a,(function(){return this}));var m=Object.getPrototypeOf,y=m&&m(m(A([])));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){c(e,t,(function(e){return this._invoke(t,e)}))}))}function b(e,t){function i(n,o,a,s){var u=l(e[n],e,o);if("throw"!==u.type){var c=u.arg,d=c.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){c.value=e,a(c)}),(function(e){return i("throw",e,a,s)}))}s(u.arg)}var o;n(this,"_invoke",{value:function(e,r){function n(){return new t((function(t,n){i(e,r,t,n)}))}return o=o?o.then(n,n):n()}})}function E(e,t,r){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return{value:void 0,done:!0}}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var s=k(a,r);if(s){if(s===h)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=l(e,t,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===h)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}function k(e,t){var r=t.method,n=e.iterator[r];if(void 0===n)return t.delegate=null,"throw"===r&&e.iterator.return&&(t.method="return",t.arg=void 0,k(e,t),"throw"===t.method)||"return"!==r&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+r+"' method")),h;var i=l(n,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,h;var o=i.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,h):o:(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 R(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(T,this),this.reset(!0)}function A(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=c(v,u,"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,c(e,u,"GeneratorFunction")),e.prototype=Object.create(g),e},e.awrap=function(e){return{__await:e}},S(b.prototype),c(b.prototype,s,(function(){return this})),e.AsyncIterator=b,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var a=new b(d(t,r,n,i),o);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},S(g),c(g,u,"Generator"),c(g,a,(function(){return this})),c(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=A,R.prototype={constructor:R,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(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"),u=r.call(o,"finallyLoc");if(s&&u){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(!u)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:A(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),u=s.value}catch(c){return void r(c)}s.done?t(u):Promise.resolve(u).then(n,i)}function u(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,u,"next",e)}function u(e){s(o,n,i,a,u,"throw",e)}a(void 0)}))}}function c(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,A(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=A(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function f(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&v(e,t)}function p(e){return(p=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function v(e,t){return(v=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function _(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function m(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function y(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return m(e)}function g(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=p(e);if(t){var i=p(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return y(this,r)}}function S(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=p(e)););return e}function b(){return b="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=S(e,t);if(n){var i=Object.getOwnPropertyDescriptor(n,t);return i.get?i.get.call(arguments.length<3?e:r):i.value}},b.apply(this,arguments)}function E(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,s=[],u=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);u=!0);}catch(d){c=!0,i=d}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(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 R(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}}}}function A(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}var w=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}(w||{}),C=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}(C||{}),O=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}(O||{}),x=function(e){return e[e.CHANNEL_PROFILE_COMMUNICATION=0]="CHANNEL_PROFILE_COMMUNICATION",e[e.CHANNEL_PROFILE_LIVE_BROADCASTING=1]="CHANNEL_PROFILE_LIVE_BROADCASTING",e}(x||{}),N=function(e){return e[e.AUTO_SUBSCRIBE_MODE=0]="AUTO_SUBSCRIBE_MODE",e[e.MANUAL_SUBSCRIBE_MODE=1]="MANUAL_SUBSCRIBE_MODE",e}(N||{}),D=function(e){return e[e.SUBSCRIBE_SUCC=0]="SUBSCRIBE_SUCC",e[e.SUBSCRIBE_FAIL=1]="SUBSCRIBE_FAIL",e}(D||{}),P=function(e){return e[e.PUBLISH_SUCC=0]="PUBLISH_SUCC",e[e.PUBLISH_FAIL=1]="PUBLISH_FAIL",e}(P||{}),M=function(e){return e[e.MIRROR_MODE_OFF=0]="MIRROR_MODE_OFF",e[e.MIRROR_MODE_ON=1]="MIRROR_MODE_ON",e}(M||{}),L=function(e){return e[e.RENDER_MODE_HIDDEN=0]="RENDER_MODE_HIDDEN",e[e.RENDER_MODE_FIT=1]="RENDER_MODE_FIT",e}(L||{}),U=function(e){return e[e.STREAM_INDEX_MAIN=0]="STREAM_INDEX_MAIN",e[e.STREAM_INDEX_SCREEN=1]="STREAM_INDEX_SCREEN",e}(U||{}),V=function(e){return e[e.AUDIO=1]="AUDIO",e[e.VIDEO=2]="VIDEO",e[e.AUDIO_AND_VIDEO=3]="AUDIO_AND_VIDEO",e}(V||{}),F=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}(F||{}),B=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}(B||{}),j=function(e){return e[e.MIRROR_TYPE_NONE=0]="MIRROR_TYPE_NONE",e[e.MIRROR_TYPE_RENDER=1]="MIRROR_TYPE_RENDER",e}(j||{}),G=function(e){return e[e.domestic=0]="domestic",e[e.overseas=1]="overseas",e}(G||{}),H=function(e){return e[e.OFFLINE=0]="OFFLINE",e[e.ONLINE=1]="ONLINE",e[e.UNREACHABLE=2]="UNREACHABLE",e}(H||{}),z=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}(z||{}),q=function(e){return e[e.PREV_FRAME=0]="PREV_FRAME",e[e.OTHER_FRAME=1]="OTHER_FRAME",e}(q||{}),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||{}),W=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}(W||{}),Y=function(e){return e[e.Unknown=-1]="Unknown",e[e.SubscribeFallbackByBandwidth=0]="SubscribeFallbackByBandwidth",e[e.SubscribeRecoverByBandwidth=2]="SubscribeRecoverByBandwidth",e}(Y||{}),J=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}(J||{}),Q=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}(Q||{}),Z=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}(Z||{}),$=Object.freeze(Object.defineProperty({__proto__:null,VideoSourceType:w,AudioSourceType:C,UserOfflineReason:O,ChannelProfile:x,SubscribeMode:N,SubscribeState:D,PublishState:P,MirrorMode:M,VideoRenderMode:L,StreamIndex:U,MediaType:V,StreamRemoveReason:F,ConnectionState:B,MirrorType:j,LogChannel:G,USER_ONLINE_STATUS:H,PublicStreamType:z,PublicInterpolationMode:q,SubscribeFallbackOption:K,RemoteUserPriority:X,NetworkQuality:W,FallbackOrRecoverReason:Y,RoomProfileType:J,AudioProfileType:Q,RTCAutoPlayPolicy:Z},Symbol.toStringTag,{value:"Module"})),ee=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}(ee||{}),te=function(e){return e[e.PLAYOUT=0]="PLAYOUT",e[e.PUBLISH=1]="PUBLISH",e[e.PLAYOUT_AND_PUBLISH=2]="PLAYOUT_AND_PUBLISH",e}(te||{}),re=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}(re||{}),ne=Object.freeze(Object.defineProperty({__proto__:null,AudioMixingDualMonoMode:ee,AudioMixingType:te,AudioMixingState:re},Symbol.toStringTag,{value:"Module"})),ie=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}(ie||{}),oe="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},ae=function(e){return e&&e.Math==Math&&e},se=ae("object"==typeof globalThis&&globalThis)||ae("object"==typeof window&&window)||ae("object"==typeof self&&self)||ae("object"==typeof oe&&oe)||function(){return this}()||Function("return this")(),ue={exports:{}},ce=se,de=Object.defineProperty,le=function(e,t){try{de(ce,e,{value:t,configurable:!0,writable:!0})}catch(r){ce[e]=t}return t},he=le,fe="__core-js_shared__",pe=se[fe]||he(fe,{}),ve=pe;(ue.exports=function(e,t){return ve[e]||(ve[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 _e,me,ye=function(e){try{return!!e()}catch(t){return!0}},ge=!ye((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),Se=ge,be=Function.prototype,Ee=be.call,ke=Se&&be.bind.bind(Ee,Ee),Te=Se?ke:function(e){return function(){return Ee.apply(e,arguments)}},Ie=function(e){return null==e},Re=Ie,Ae=TypeError,we=function(e){if(Re(e))throw Ae("Can't call method on "+e);return e},Ce=we,Oe=Object,xe=function(e){return Oe(Ce(e))},Ne=xe,De=Te({}.hasOwnProperty),Pe=Object.hasOwn||function(e,t){return De(Ne(e),t)},Me=Te,Le=0,Ue=Math.random(),Ve=Me(1..toString),Fe=function(e){return"Symbol("+(void 0===e?"":e)+")_"+Ve(++Le+Ue,36)},Be="object"==typeof document&&document.all,je={all:Be,IS_HTMLDDA:void 0===Be&&void 0!==Be},Ge=je.all,He=je.IS_HTMLDDA?function(e){return"function"==typeof e||e===Ge}:function(e){return"function"==typeof e},ze=se,qe=He,Ke=function(e){return qe(e)?e:void 0},Xe=function(e,t){return arguments.length<2?Ke(ze[e]):ze[e]&&ze[e][t]},We=Xe("navigator","userAgent")||"",Ye=se,Je=We,Qe=Ye.process,Ze=Ye.Deno,$e=Qe&&Qe.versions||Ze&&Ze.version,et=$e&&$e.v8;et&&(me=(_e=et.split("."))[0]>0&&_e[0]<4?1:+(_e[0]+_e[1])),!me&&Je&&(!(_e=Je.match(/Edge\/(\d+)/))||_e[1]>=74)&&(_e=Je.match(/Chrome\/(\d+)/))&&(me=+_e[1]);var tt=me,rt=tt,nt=ye,it=!!Object.getOwnPropertySymbols&&!nt((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&rt&&rt<41})),ot=it&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,at=se,st=ue.exports,ut=Pe,ct=Fe,dt=it,lt=ot,ht=st("wks"),ft=at.Symbol,pt=ft&&ft.for,vt=lt?ft:ft&&ft.withoutSetter||ct,_t=function(e){if(!ut(ht,e)||!dt&&"string"!=typeof ht[e]){var t="Symbol."+e;dt&&ut(ft,e)?ht[e]=ft[e]:ht[e]=lt&&pt?pt(t):vt(t)}return ht[e]},mt={};mt[_t("toStringTag")]="z";var yt="[object z]"===String(mt),gt={},St=!ye((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),bt=He,Et=je.all,kt=je.IS_HTMLDDA?function(e){return"object"==typeof e?null!==e:bt(e)||e===Et}:function(e){return"object"==typeof e?null!==e:bt(e)},Tt=kt,It=se.document,Rt=Tt(It)&&Tt(It.createElement),At=function(e){return Rt?It.createElement(e):{}},wt=At,Ct=!St&&!ye((function(){return 7!=Object.defineProperty(wt("div"),"a",{get:function(){return 7}}).a})),Ot=St&&ye((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),xt=kt,Nt=String,Dt=TypeError,Pt=function(e){if(xt(e))return e;throw Dt(Nt(e)+" is not an object")},Mt=ge,Lt=Function.prototype.call,Ut=Mt?Lt.bind(Lt):function(){return Lt.apply(Lt,arguments)},Vt=Te({}.isPrototypeOf),Ft=Xe,Bt=He,jt=Vt,Gt=Object,Ht=ot?function(e){return"symbol"==typeof e}:function(e){var t=Ft("Symbol");return Bt(t)&&jt(t.prototype,Gt(e))},zt=String,qt=function(e){try{return zt(e)}catch(t){return"Object"}},Kt=He,Xt=qt,Wt=TypeError,Yt=function(e){if(Kt(e))return e;throw Wt(Xt(e)+" is not a function")},Jt=Yt,Qt=Ie,Zt=function(e,t){var r=e[t];return Qt(r)?void 0:Jt(r)},$t=Ut,er=He,tr=kt,rr=TypeError,nr=Ut,ir=kt,or=Ht,ar=Zt,sr=function(e,t){var r,n;if("string"===t&&er(r=e.toString)&&!tr(n=$t(r,e)))return n;if(er(r=e.valueOf)&&!tr(n=$t(r,e)))return n;if("string"!==t&&er(r=e.toString)&&!tr(n=$t(r,e)))return n;throw rr("Can't convert object to primitive value")},ur=TypeError,cr=_t("toPrimitive"),dr=function(e,t){if(!ir(e)||or(e))return e;var r,n=ar(e,cr);if(n){if(void 0===t&&(t="default"),r=nr(n,e,t),!ir(r)||or(r))return r;throw ur("Can't convert object to primitive value")}return void 0===t&&(t="number"),sr(e,t)},lr=dr,hr=Ht,fr=function(e){var t=lr(e,"string");return hr(t)?t:t+""},pr=St,vr=Ct,_r=Ot,mr=Pt,yr=fr,gr=TypeError,Sr=Object.defineProperty,br=Object.getOwnPropertyDescriptor,Er="enumerable",kr="configurable",Tr="writable";gt.f=pr?_r?function(e,t,r){if(mr(e),t=yr(t),mr(r),"function"==typeof e&&"prototype"===t&&"value"in r&&Tr in r&&!r.writable){var n=br(e,t);n&&n.writable&&(e[t]=r.value,r={configurable:kr in r?r.configurable:n.configurable,enumerable:Er in r?r.enumerable:n.enumerable,writable:!1})}return Sr(e,t,r)}:Sr:function(e,t,r){if(mr(e),t=yr(t),mr(r),vr)try{return Sr(e,t,r)}catch(n){}if("get"in r||"set"in r)throw gr("Accessors not supported");return"value"in r&&(e[t]=r.value),e};var Ir={exports:{}},Rr=St,Ar=Pe,wr=Function.prototype,Cr=Rr&&Object.getOwnPropertyDescriptor,Or=Ar(wr,"name"),xr={EXISTS:Or,PROPER:Or&&"something"===function(){}.name,CONFIGURABLE:Or&&(!Rr||Rr&&Cr(wr,"name").configurable)},Nr=He,Dr=pe,Pr=Te(Function.toString);Nr(Dr.inspectSource)||(Dr.inspectSource=function(e){return Pr(e)});var Mr,Lr,Ur,Vr=Dr.inspectSource,Fr=He,Br=se.WeakMap,jr=Fr(Br)&&/native code/.test(String(Br)),Gr=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},Hr=gt,zr=Gr,qr=St?function(e,t,r){return Hr.f(e,t,zr(1,r))}:function(e,t,r){return e[t]=r,e},Kr=ue.exports,Xr=Fe,Wr=Kr("keys"),Yr=function(e){return Wr[e]||(Wr[e]=Xr(e))},Jr={},Qr=jr,Zr=se,$r=kt,en=qr,tn=Pe,rn=pe,nn=Yr,on=Jr,an="Object already initialized",sn=Zr.TypeError,un=Zr.WeakMap;if(Qr||rn.state){var cn=rn.state||(rn.state=new un);cn.get=cn.get,cn.has=cn.has,cn.set=cn.set,Mr=function(e,t){if(cn.has(e))throw sn(an);return t.facade=e,cn.set(e,t),t},Lr=function(e){return cn.get(e)||{}},Ur=function(e){return cn.has(e)}}else{var dn=nn("state");on[dn]=!0,Mr=function(e,t){if(tn(e,dn))throw sn(an);return t.facade=e,en(e,dn,t),t},Lr=function(e){return tn(e,dn)?e[dn]:{}},Ur=function(e){return tn(e,dn)}}var ln={set:Mr,get:Lr,has:Ur,enforce:function(e){return Ur(e)?Lr(e):Mr(e,{})},getterFor:function(e){return function(t){var r;if(!$r(t)||(r=Lr(t)).type!==e)throw sn("Incompatible receiver, "+e+" required");return r}}},hn=ye,fn=He,pn=Pe,vn=St,_n=xr.CONFIGURABLE,mn=Vr,yn=ln.enforce,gn=ln.get,Sn=Object.defineProperty,bn=vn&&!hn((function(){return 8!==Sn((function(){}),"length",{value:8}).length})),En=String(String).split("String"),kn=Ir.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),(!pn(e,"name")||_n&&e.name!==t)&&(vn?Sn(e,"name",{value:t,configurable:!0}):e.name=t),bn&&r&&pn(r,"arity")&&e.length!==r.arity&&Sn(e,"length",{value:r.arity});try{r&&pn(r,"constructor")&&r.constructor?vn&&Sn(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(i){}var n=yn(e);return pn(n,"source")||(n.source=En.join("string"==typeof t?t:"")),e};Function.prototype.toString=kn((function(){return fn(this)&&gn(this).source||mn(this)}),"toString");var Tn=He,In=gt,Rn=Ir.exports,An=le,wn=function(e,t,r,n){n||(n={});var i=n.enumerable,o=void 0!==n.name?n.name:t;if(Tn(r)&&Rn(r,o,n),n.global)i?e[t]=r:An(t,r);else{try{n.unsafe?e[t]&&(i=!0):delete e[t]}catch(a){}i?e[t]=r:In.f(e,t,{value:r,enumerable:!1,configurable:!n.nonConfigurable,writable:!n.nonWritable})}return e},Cn=Te,On=Cn({}.toString),xn=Cn("".slice),Nn=function(e){return xn(On(e),8,-1)},Dn=yt,Pn=He,Mn=Nn,Ln=_t("toStringTag"),Un=Object,Vn="Arguments"==Mn(function(){return arguments}()),Fn=Dn?Mn: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=Un(e),Ln))?r:Vn?Mn(t):"Object"==(n=Mn(t))&&Pn(t.callee)?"Arguments":n},Bn=Fn,jn=yt?{}.toString:function(){return"[object "+Bn(this)+"]"};yt||wn(Object.prototype,"toString",jn,{unsafe:!0});var Gn={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},Hn=At("span").classList,zn=Hn&&Hn.constructor&&Hn.constructor.prototype,qn=zn===Object.prototype?void 0:zn,Kn=Nn,Xn=Te,Wn=function(e){if("Function"===Kn(e))return Xn(e)},Yn=Yt,Jn=ge,Qn=Wn(Wn.bind),Zn=function(e,t){return Yn(e),void 0===t?e:Jn?Qn(e,t):function(){return e.apply(t,arguments)}},$n=ye,ei=Nn,ti=Object,ri=Te("".split),ni=$n((function(){return!ti("z").propertyIsEnumerable(0)}))?function(e){return"String"==ei(e)?ri(e,""):ti(e)}:ti,ii=Math.ceil,oi=Math.floor,ai=Math.trunc||function(e){var t=+e;return(t>0?oi:ii)(t)},si=function(e){var t=+e;return t!=t||0===t?0:ai(t)},ui=si,ci=Math.min,di=function(e){return e>0?ci(ui(e),9007199254740991):0},li=di,hi=function(e){return li(e.length)},fi=Nn,pi=Array.isArray||function(e){return"Array"==fi(e)},vi=Te,_i=ye,mi=He,yi=Fn,gi=Vr,Si=function(){},bi=[],Ei=Xe("Reflect","construct"),ki=/^\s*(?:class|function)\b/,Ti=vi(ki.exec),Ii=!ki.exec(Si),Ri=function(e){if(!mi(e))return!1;try{return Ei(Si,bi,e),!0}catch(t){return!1}},Ai=function(e){if(!mi(e))return!1;switch(yi(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Ii||!!Ti(ki,gi(e))}catch(t){return!0}};Ai.sham=!0;var wi=!Ei||_i((function(){var e;return Ri(Ri.call)||!Ri(Object)||!Ri((function(){e=!0}))||e}))?Ai:Ri,Ci=pi,Oi=wi,xi=kt,Ni=_t("species"),Di=Array,Pi=function(e){var t;return Ci(e)&&(t=e.constructor,(Oi(t)&&(t===Di||Ci(t.prototype))||xi(t)&&null===(t=t[Ni]))&&(t=void 0)),void 0===t?Di:t},Mi=function(e,t){return new(Pi(e))(0===t?0:t)},Li=Zn,Ui=ni,Vi=xe,Fi=hi,Bi=Mi,ji=Te([].push),Gi=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(u,c,d,l){for(var h,f,p=Vi(u),v=Ui(p),_=Li(c,d),m=Fi(v),y=0,g=l||Bi,S=t?g(u,m):r||a?g(u,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:ji(S,h)}else switch(e){case 4:return!1;case 7:ji(S,h)}return o?-1:n||i?i:S}},Hi={forEach:Gi(0),map:Gi(1),filter:Gi(2),some:Gi(3),every:Gi(4),find:Gi(5),findIndex:Gi(6),filterReject:Gi(7)},zi=ye,qi=function(e,t){var r=[][e];return!!r&&zi((function(){r.call(null,t||function(){return 1},1)}))},Ki=Hi.forEach,Xi=qi("forEach")?[].forEach:function(e){return Ki(this,e,arguments.length>1?arguments[1]:void 0)},Wi=se,Yi=Gn,Ji=qn,Qi=Xi,Zi=qr,$i=function(e){if(e&&e.forEach!==Qi)try{Zi(e,"forEach",Qi)}catch(t){e.forEach=Qi}};for(var eo in Yi)Yi[eo]&&$i(Wi[eo]&&Wi[eo].prototype);$i(Ji);var to={},ro={},no={}.propertyIsEnumerable,io=Object.getOwnPropertyDescriptor,oo=io&&!no.call({1:2},1);ro.f=oo?function(e){var t=io(this,e);return!!t&&t.enumerable}:no;var ao=ni,so=we,uo=function(e){return ao(so(e))},co=St,lo=Ut,ho=ro,fo=Gr,po=uo,vo=fr,_o=Pe,mo=Ct,yo=Object.getOwnPropertyDescriptor;to.f=co?yo:function(e,t){if(e=po(e),t=vo(t),mo)try{return yo(e,t)}catch(r){}if(_o(e,t))return fo(!lo(ho.f,e,t),e[t])};var go={},So=si,bo=Math.max,Eo=Math.min,ko=function(e,t){var r=So(e);return r<0?bo(r+t,0):Eo(r,t)},To=uo,Io=ko,Ro=hi,Ao=function(e){return function(t,r,n){var i,o=To(t),a=Ro(o),s=Io(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}},wo={includes:Ao(!0),indexOf:Ao(!1)},Co=Pe,Oo=uo,xo=wo.indexOf,No=Jr,Do=Te([].push),Po=function(e,t){var r,n=Oo(e),i=0,o=[];for(r in n)!Co(No,r)&&Co(n,r)&&Do(o,r);for(;t.length>i;)Co(n,r=t[i++])&&(~xo(o,r)||Do(o,r));return o},Mo=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Lo=Po,Uo=Mo.concat("length","prototype");go.f=Object.getOwnPropertyNames||function(e){return Lo(e,Uo)};var Vo={};Vo.f=Object.getOwnPropertySymbols;var Fo=Xe,Bo=go,jo=Vo,Go=Pt,Ho=Te([].concat),zo=Fo("Reflect","ownKeys")||function(e){var t=Bo.f(Go(e)),r=jo.f;return r?Ho(t,r(e)):t},qo=Pe,Ko=zo,Xo=to,Wo=gt,Yo=function(e,t,r){for(var n=Ko(t),i=Wo.f,o=Xo.f,a=0;a<n.length;a++){var s=n[a];qo(e,s)||r&&qo(r,s)||i(e,s,o(t,s))}},Jo=ye,Qo=He,Zo=/#|\.prototype\./,$o=function(e,t){var r=ta[ea(e)];return r==na||r!=ra&&(Qo(t)?Jo(t):!!t)},ea=$o.normalize=function(e){return String(e).replace(Zo,".").toLowerCase()},ta=$o.data={},ra=$o.NATIVE="N",na=$o.POLYFILL="P",ia=$o,oa=se,aa=to.f,sa=qr,ua=wn,ca=le,da=Yo,la=ia,ha=function(e,t){var r,n,i,o,a,s=e.target,u=e.global,c=e.stat;if(r=u?oa:c?oa[s]||ca(s,{}):(oa[s]||{}).prototype)for(n in t){if(o=t[n],i=e.dontCallGetSet?(a=aa(r,n))&&a.value:r[n],!la(u?n:s+(c?".":"#")+n,e.forced)&&void 0!==i){if(typeof o==typeof i)continue;da(o,i)}(e.sham||i&&i.sham)&&sa(o,"sham",!0),ua(r,n,o,e)}},fa={},pa=Po,va=Mo,_a=Object.keys||function(e){return pa(e,va)},ma=St,ya=Ot,ga=gt,Sa=Pt,ba=uo,Ea=_a;fa.f=ma&&!ya?Object.defineProperties:function(e,t){Sa(e);for(var r,n=ba(t),i=Ea(t),o=i.length,a=0;o>a;)ga.f(e,r=i[a++],n[r]);return e};var ka,Ta=Xe("document","documentElement"),Ia=Pt,Ra=fa,Aa=Mo,wa=Jr,Ca=Ta,Oa=At,xa=Yr("IE_PROTO"),Na=function(){},Da=function(e){return"<script>"+e+"</"+"script>"},Pa=function(e){e.write(Da("")),e.close();var t=e.parentWindow.Object;return e=null,t},Ma=function(){try{ka=new ActiveXObject("htmlfile")}catch(n){}var e,t;Ma="undefined"!=typeof document?document.domain&&ka?Pa(ka):((t=Oa("iframe")).style.display="none",Ca.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(Da("document.F=Object")),e.close(),e.F):Pa(ka);for(var r=Aa.length;r--;)delete Ma.prototype[Aa[r]];return Ma()};wa[xa]=!0;var La=Object.create||function(e,t){var r;return null!==e?(Na.prototype=Ia(e),r=new Na,Na.prototype=null,r[xa]=e):r=Ma(),void 0===t?r:Ra.f(r,t)},Ua=_t,Va=La,Fa=gt.f,Ba=Ua("unscopables"),ja=Array.prototype;null==ja[Ba]&&Fa(ja,Ba,{configurable:!0,value:Va(null)});var Ga=function(e){ja[Ba][e]=!0},Ha=wo.includes,za=Ga;ha({target:"Array",proto:!0,forced:ye((function(){return!Array(1).includes()}))},{includes:function(e){return Ha(this,e,arguments.length>1?arguments[1]:void 0)}}),za("includes");var qa=kt,Ka=Nn,Xa=_t("match"),Wa=function(e){var t;return qa(e)&&(void 0!==(t=e[Xa])?!!t:"RegExp"==Ka(e))},Ya=Wa,Ja=TypeError,Qa=function(e){if(Ya(e))throw Ja("The method doesn't accept regular expressions");return e},Za=Fn,$a=String,es=function(e){if("Symbol"===Za(e))throw TypeError("Cannot convert a Symbol value to a string");return $a(e)},ts=_t("match"),rs=function(e){var t=/./;try{"/./"[e](t)}catch(r){try{return t[ts]=!1,"/./"[e](t)}catch(n){}}return!1},ns=ha,is=Qa,os=we,as=es,ss=rs,us=Te("".indexOf);ns({target:"String",proto:!0,forced:!ss("includes")},{includes:function(e){return!!~us(as(os(this)),as(is(e)),arguments.length>1?arguments[1]:void 0)}});var cs,ds,ls=Pt,hs=function(){var e=ls(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=ye,ps=se.RegExp,vs=fs((function(){var e=ps("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),_s=vs||fs((function(){return!ps("a","y").sticky})),ms=vs||fs((function(){var e=ps("^r","gy");return e.lastIndex=2,null!=e.exec("str")})),ys={BROKEN_CARET:ms,MISSED_STICKY:_s,UNSUPPORTED_Y:vs},gs=ye,Ss=se.RegExp,bs=gs((function(){var e=Ss(".","s");return!(e.dotAll&&e.exec("\n")&&"s"===e.flags)})),Es=ye,ks=se.RegExp,Ts=Es((function(){var e=ks("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")})),Is=Ut,Rs=Te,As=es,ws=hs,Cs=ys,Os=ue.exports,xs=La,Ns=ln.get,Ds=bs,Ps=Ts,Ms=Os("native-string-replace",String.prototype.replace),Ls=RegExp.prototype.exec,Us=Ls,Vs=Rs("".charAt),Fs=Rs("".indexOf),Bs=Rs("".replace),js=Rs("".slice),Gs=(ds=/b*/g,Is(Ls,cs=/a/,"a"),Is(Ls,ds,"a"),0!==cs.lastIndex||0!==ds.lastIndex),Hs=Cs.BROKEN_CARET,zs=void 0!==/()??/.exec("")[1];(Gs||zs||Hs||Ds||Ps)&&(Us=function(e){var t,r,n,i,o,a,s,u=this,c=Ns(u),d=As(e),l=c.raw;if(l)return l.lastIndex=u.lastIndex,t=Is(Us,l,d),u.lastIndex=l.lastIndex,t;var h=c.groups,f=Hs&&u.sticky,p=Is(ws,u),v=u.source,_=0,m=d;if(f&&(p=Bs(p,"y",""),-1===Fs(p,"g")&&(p+="g"),m=js(d,u.lastIndex),u.lastIndex>0&&(!u.multiline||u.multiline&&"\n"!==Vs(d,u.lastIndex-1))&&(v="(?: "+v+")",m=" "+m,_++),r=new RegExp("^(?:"+v+")",p)),zs&&(r=new RegExp("^"+v+"$(?!\\s)",p)),Gs&&(n=u.lastIndex),i=Is(Ls,f?r:u,m),f?i?(i.input=js(i.input,_),i[0]=js(i[0],_),i.index=u.lastIndex,u.lastIndex+=i[0].length):u.lastIndex=0:Gs&&i&&(u.lastIndex=u.global?i.index+i[0].length:n),zs&&i&&i.length>1&&Is(Ms,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=xs(null),o=0;o<h.length;o++)a[(s=h[o])[0]]=i[s[1]];return i});var qs=Us;ha({target:"RegExp",proto:!0,forced:/./.exec!==qs},{exec:qs});var Ks=Wn,Xs=wn,Ws=qs,Ys=ye,Js=_t,Qs=qr,Zs=Js("species"),$s=RegExp.prototype,eu=function(e,t,r,n){var i=Js(e),o=!Ys((function(){var t={};return t[i]=function(){return 7},7!=""[e](t)})),a=o&&!Ys((function(){var t=!1,r=/a/;return"split"===e&&((r={}).constructor={},r.constructor[Zs]=function(){return r},r.flags="",r[i]=/./[i]),r.exec=function(){return t=!0,null},r[i](""),!t}));if(!o||!a||r){var s=Ks(/./[i]),u=t(i,""[e],(function(e,t,r,n,i){var a=Ks(e),u=t.exec;return u===Ws||u===$s.exec?o&&!i?{done:!0,value:s(t,r,n)}:{done:!0,value:a(r,t,n)}:{done:!1}}));Xs(String.prototype,e,u[0]),Xs($s,i,u[1])}n&&Qs($s[i],"sham",!0)},tu=Object.is||function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t},ru=Ut,nu=Pt,iu=He,ou=Nn,au=qs,su=TypeError,uu=function(e,t){var r=e.exec;if(iu(r)){var n=ru(r,e,t);return null!==n&&nu(n),n}if("RegExp"===ou(e))return ru(au,e,t);throw su("RegExp#exec called on incompatible receiver")},cu=Ut,du=Pt,lu=Ie,hu=we,fu=tu,pu=es,vu=Zt,_u=uu;eu("search",(function(e,t,r){return[function(t){var r=hu(this),n=lu(t)?void 0:vu(t,e);return n?cu(n,t,r):new RegExp(t)[e](pu(r))},function(e){var n=du(this),i=pu(e),o=r(t,n,i);if(o.done)return o.value;var a=n.lastIndex;fu(a,0)||(n.lastIndex=0);var s=_u(n,i);return fu(n.lastIndex,a)||(n.lastIndex=a),null===s?-1:s.index}]}));var mu=ge,yu=Function.prototype,gu=yu.apply,Su=yu.call,bu="object"==typeof Reflect&&Reflect.apply||(mu?Su.bind(gu):function(){return Su.apply(gu,arguments)}),Eu=Te([].slice),ku=ha,Tu=Xe,Iu=bu,Ru=Ut,Au=Te,wu=ye,Cu=pi,Ou=He,xu=kt,Nu=Ht,Du=Eu,Pu=it,Mu=Tu("JSON","stringify"),Lu=Au(/./.exec),Uu=Au("".charAt),Vu=Au("".charCodeAt),Fu=Au("".replace),Bu=Au(1..toString),ju=/[\uD800-\uDFFF]/g,Gu=/^[\uD800-\uDBFF]$/,Hu=/^[\uDC00-\uDFFF]$/,zu=!Pu||wu((function(){var e=Tu("Symbol")();return"[null]"!=Mu([e])||"{}"!=Mu({a:e})||"{}"!=Mu(Object(e))})),qu=wu((function(){return'"\\udf06\\ud834"'!==Mu("\udf06\ud834")||'"\\udead"'!==Mu("\udead")})),Ku=function(e,t){var r=Du(arguments),n=t;if((xu(t)||void 0!==e)&&!Nu(e))return Cu(t)||(t=function(e,t){if(Ou(n)&&(t=Ru(n,this,e,t)),!Nu(t))return t}),r[1]=t,Iu(Mu,null,r)},Xu=function(e,t,r){var n=Uu(r,t-1),i=Uu(r,t+1);return Lu(Gu,e)&&!Lu(Hu,i)||Lu(Hu,e)&&!Lu(Gu,n)?"\\u"+Bu(Vu(e,0),16):e};Mu&&ku({target:"JSON",stat:!0,arity:3,forced:zu||qu},{stringify:function(e,t,r){var n=Du(arguments),i=Iu(zu?Ku:Mu,null,n);return qu&&"string"==typeof i?Fu(i,ju,Xu):i}});var Wu=ye,Yu=tt,Ju=_t("species"),Qu=function(e){return Yu>=51||!Wu((function(){var t=[];return(t.constructor={})[Ju]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},Zu=Hi.map;ha({target:"Array",proto:!0,forced:!Qu("map")},{map:function(e){return Zu(this,e,arguments.length>1?arguments[1]:void 0)}});var $u=Te,ec=si,tc=es,rc=we,nc=$u("".charAt),ic=$u("".charCodeAt),oc=$u("".slice),ac=function(e){return function(t,r){var n,i,o=tc(rc(t)),a=ec(r),s=o.length;return a<0||a>=s?e?"":void 0:(n=ic(o,a))<55296||n>56319||a+1===s||(i=ic(o,a+1))<56320||i>57343?e?nc(o,a):n:e?oc(o,a,a+2):i-56320+(n-55296<<10)+65536}},sc={codeAt:ac(!1),charAt:ac(!0)},uc=sc.charAt,cc=function(e,t,r){return t+(r?uc(e,t).length:1)},dc=Ut,lc=Pt,hc=Ie,fc=di,pc=es,vc=we,_c=Zt,mc=cc,yc=uu;eu("match",(function(e,t,r){return[function(t){var r=vc(this),n=hc(t)?void 0:_c(t,e);return n?dc(n,t,r):new RegExp(t)[e](pc(r))},function(e){var n=lc(this),i=pc(e),o=r(t,n,i);if(o.done)return o.value;if(!n.global)return yc(n,i);var a=n.unicode;n.lastIndex=0;for(var s,u=[],c=0;null!==(s=yc(n,i));){var d=pc(s[0]);u[c]=d,""===d&&(n.lastIndex=mc(i,fc(n.lastIndex),a)),c++}return 0===c?null:u}]}));var gc="\t\n\v\f\r \u2028\u2029\ufeff",Sc=we,bc=es,Ec=Te("".replace),kc="[\t\n\v\f\r \u2028\u2029\ufeff]",Tc=RegExp("^"+kc+kc+"*"),Ic=RegExp(kc+kc+"*$"),Rc=function(e){return function(t){var r=bc(Sc(t));return 1&e&&(r=Ec(r,Tc,"")),2&e&&(r=Ec(r,Ic,"")),r}},Ac={start:Rc(1),end:Rc(2),trim:Rc(3)},wc=se,Cc=ye,Oc=Te,xc=es,Nc=Ac.trim,Dc=gc,Pc=wc.parseInt,Mc=wc.Symbol,Lc=Mc&&Mc.iterator,Uc=/^[+-]?0x/i,Vc=Oc(Uc.exec),Fc=8!==Pc(Dc+"08")||22!==Pc(Dc+"0x16")||Lc&&!Cc((function(){Pc(Object(Lc))}))?function(e,t){var r=Nc(xc(e));return Pc(r,t>>>0||(Vc(Uc,r)?16:10))}:Pc;ha({global:!0,forced:parseInt!=Fc},{parseInt:Fc});var Bc,jc,Gc,Hc={},zc=!ye((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),qc=Pe,Kc=He,Xc=xe,Wc=zc,Yc=Yr("IE_PROTO"),Jc=Object,Qc=Jc.prototype,Zc=Wc?Jc.getPrototypeOf:function(e){var t=Xc(e);if(qc(t,Yc))return t[Yc];var r=t.constructor;return Kc(r)&&t instanceof r?r.prototype:t instanceof Jc?Qc:null},$c=ye,ed=He,td=kt,rd=Zc,nd=wn,id=_t("iterator"),od=!1;[].keys&&("next"in(Gc=[].keys())?(jc=rd(rd(Gc)))!==Object.prototype&&(Bc=jc):od=!0),(!td(Bc)||$c((function(){var e={};return Bc[id].call(e)!==e})))&&(Bc={}),ed(Bc[id])||nd(Bc,id,(function(){return this}));var ad={IteratorPrototype:Bc,BUGGY_SAFARI_ITERATORS:od},sd=gt.f,ud=Pe,cd=_t("toStringTag"),dd=function(e,t,r){e&&!r&&(e=e.prototype),e&&!ud(e,cd)&&sd(e,cd,{configurable:!0,value:t})},ld=ad.IteratorPrototype,hd=La,fd=Gr,pd=dd,vd=Hc,_d=function(){return this},md=function(e,t,r,n){var i=t+" Iterator";return e.prototype=hd(ld,{next:fd(+!n,r)}),pd(e,i,!1),vd[i]=_d,e},yd=He,gd=String,Sd=TypeError,bd=Te,Ed=Pt,kd=function(e){if("object"==typeof e||yd(e))return e;throw Sd("Can't set "+gd(e)+" as a prototype")},Td=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=bd(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(r,[]),t=r instanceof Array}catch(n){}return function(r,n){return Ed(r),kd(n),t?e(r,n):r.__proto__=n,r}}():void 0),Id=ha,Rd=Ut,Ad=He,wd=md,Cd=Zc,Od=Td,xd=dd,Nd=qr,Dd=wn,Pd=Hc,Md=xr.PROPER,Ld=xr.CONFIGURABLE,Ud=ad.IteratorPrototype,Vd=ad.BUGGY_SAFARI_ITERATORS,Fd=_t("iterator"),Bd="keys",jd="values",Gd="entries",Hd=function(){return this},zd=function(e,t,r,n,i,o,a){wd(r,t,n);var s,u,c,d=function(e){if(e===i&&v)return v;if(!Vd&&e in f)return f[e];switch(e){case Bd:case jd:case Gd:return function(){return new r(this,e)}}return function(){return new r(this)}},l=t+" Iterator",h=!1,f=e.prototype,p=f[Fd]||f["@@iterator"]||i&&f[i],v=!Vd&&p||d(i),_="Array"==t&&f.entries||p;if(_&&(s=Cd(_.call(new e)))!==Object.prototype&&s.next&&(Cd(s)!==Ud&&(Od?Od(s,Ud):Ad(s[Fd])||Dd(s,Fd,Hd)),xd(s,l,!0)),Md&&i==jd&&p&&p.name!==jd&&(Ld?Nd(f,"name",jd):(h=!0,v=function(){return Rd(p,this)})),i)if(u={values:d(jd),keys:o?v:d(Bd),entries:d(Gd)},a)for(c in u)(Vd||h||!(c in f))&&Dd(f,c,u[c]);else Id({target:t,proto:!0,forced:Vd||h},u);return f[Fd]!==v&&Dd(f,Fd,v,{name:i}),Pd[t]=v,u},qd=function(e,t){return{value:e,done:t}},Kd=uo,Xd=Ga,Wd=Hc,Yd=ln,Jd=gt.f,Qd=zd,Zd=qd,$d=St,el="Array Iterator",tl=Yd.set,rl=Yd.getterFor(el),nl=Qd(Array,"Array",(function(e,t){tl(this,{type:el,target:Kd(e),index:0,kind:t})}),(function(){var e=rl(this),t=e.target,r=e.kind,n=e.index++;return!t||n>=t.length?(e.target=void 0,Zd(void 0,!0)):Zd("keys"==r?n:"values"==r?t[n]:[n,t[n]],!1)}),"values"),il=Wd.Arguments=Wd.Array;if(Xd("keys"),Xd("values"),Xd("entries"),$d&&"values"!==il.name)try{Jd(il,"name",{value:"values"})}catch(r0){}var ol={exports:{}},al={},sl=fr,ul=gt,cl=Gr,dl=function(e,t,r){var n=sl(t);n in e?ul.f(e,n,cl(0,r)):e[n]=r},ll=ko,hl=hi,fl=dl,pl=Array,vl=Math.max,_l=function(e,t,r){for(var n=hl(e),i=ll(t,n),o=ll(void 0===r?n:r,n),a=pl(vl(o-i,0)),s=0;i<o;i++,s++)fl(a,s,e[i]);return a.length=s,a},ml=Nn,yl=uo,gl=go.f,Sl=_l,bl="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];al.f=function(e){return bl&&"Window"==ml(e)?function(e){try{return gl(e)}catch(r0){return Sl(bl)}}(e):gl(yl(e))};var El=ye((function(){if("function"==typeof ArrayBuffer){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}})),kl=ye,Tl=kt,Il=Nn,Rl=El,Al=Object.isExtensible,wl=kl((function(){Al(1)}))||Rl?function(e){return!!Tl(e)&&((!Rl||"ArrayBuffer"!=Il(e))&&(!Al||Al(e)))}:Al,Cl=!ye((function(){return Object.isExtensible(Object.preventExtensions({}))})),Ol=ha,xl=Te,Nl=Jr,Dl=kt,Pl=Pe,Ml=gt.f,Ll=go,Ul=al,Vl=wl,Fl=Cl,Bl=!1,jl=Fe("meta"),Gl=0,Hl=function(e){Ml(e,jl,{value:{objectID:"O"+Gl++,weakData:{}}})},zl=ol.exports={enable:function(){zl.enable=function(){},Bl=!0;var e=Ll.f,t=xl([].splice),r={};r[jl]=1,e(r).length&&(Ll.f=function(r){for(var n=e(r),i=0,o=n.length;i<o;i++)if(n[i]===jl){t(n,i,1);break}return n},Ol({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:Ul.f}))},fastKey:function(e,t){if(!Dl(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!Pl(e,jl)){if(!Vl(e))return"F";if(!t)return"E";Hl(e)}return e[jl].objectID},getWeakData:function(e,t){if(!Pl(e,jl)){if(!Vl(e))return!0;if(!t)return!1;Hl(e)}return e[jl].weakData},onFreeze:function(e){return Fl&&Bl&&Vl(e)&&!Pl(e,jl)&&Hl(e),e}};Nl[jl]=!0;var ql=Hc,Kl=_t("iterator"),Xl=Array.prototype,Wl=function(e){return void 0!==e&&(ql.Array===e||Xl[Kl]===e)},Yl=Fn,Jl=Zt,Ql=Ie,Zl=Hc,$l=_t("iterator"),eh=function(e){if(!Ql(e))return Jl(e,$l)||Jl(e,"@@iterator")||Zl[Yl(e)]},th=Ut,rh=Yt,nh=Pt,ih=qt,oh=eh,ah=TypeError,sh=function(e,t){var r=arguments.length<2?oh(e):t;if(rh(r))return nh(th(r,e));throw ah(ih(e)+" is not iterable")},uh=Ut,ch=Pt,dh=Zt,lh=function(e,t,r){var n,i;ch(e);try{if(!(n=dh(e,"return"))){if("throw"===t)throw r;return r}n=uh(n,e)}catch(r0){i=!0,n=r0}if("throw"===t)throw r;if(i)throw n;return ch(n),r},hh=Zn,fh=Ut,ph=Pt,vh=qt,_h=Wl,mh=hi,yh=Vt,gh=sh,Sh=eh,bh=lh,Eh=TypeError,kh=function(e,t){this.stopped=e,this.result=t},Th=kh.prototype,Ih=function(e,t,r){var n,i,o,a,s,u,c,d=r&&r.that,l=!(!r||!r.AS_ENTRIES),h=!(!r||!r.IS_RECORD),f=!(!r||!r.IS_ITERATOR),p=!(!r||!r.INTERRUPTED),v=hh(t,d),_=function(e){return n&&bh(n,"normal",e),new kh(!0,e)},m=function(e){return l?(ph(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=Sh(e)))throw Eh(vh(e)+" is not iterable");if(_h(i)){for(o=0,a=mh(e);a>o;o++)if((s=m(e[o]))&&yh(Th,s))return s;return new kh(!1)}n=gh(e,i)}for(u=h?e.next:n.next;!(c=fh(u,n)).done;){try{s=m(c.value)}catch(r0){bh(n,"throw",r0)}if("object"==typeof s&&s&&yh(Th,s))return s}return new kh(!1)},Rh=Vt,Ah=TypeError,wh=function(e,t){if(Rh(t,e))return e;throw Ah("Incorrect invocation")},Ch=_t("iterator"),Oh=!1;try{var xh=0,Nh={next:function(){return{done:!!xh++}},return:function(){Oh=!0}};Nh[Ch]=function(){return this},Array.from(Nh,(function(){throw 2}))}catch(r0){}var Dh=function(e,t){if(!t&&!Oh)return!1;var r=!1;try{var n={};n[Ch]=function(){return{next:function(){return{done:r=!0}}}},e(n)}catch(r0){}return r},Ph=He,Mh=kt,Lh=Td,Uh=function(e,t,r){var n,i;return Lh&&Ph(n=t.constructor)&&n!==r&&Mh(i=n.prototype)&&i!==r.prototype&&Lh(e,i),e},Vh=ha,Fh=se,Bh=Te,jh=ia,Gh=wn,Hh=ol.exports,zh=Ih,qh=wh,Kh=He,Xh=Ie,Wh=kt,Yh=ye,Jh=Dh,Qh=dd,Zh=Uh,$h=function(e,t,r){var n=-1!==e.indexOf("Map"),i=-1!==e.indexOf("Weak"),o=n?"set":"add",a=Fh[e],s=a&&a.prototype,u=a,c={},d=function(e){var t=Bh(s[e]);Gh(s,e,"add"==e?function(e){return t(this,0===e?0:e),this}:"delete"==e?function(e){return!(i&&!Wh(e))&&t(this,0===e?0:e)}:"get"==e?function(e){return i&&!Wh(e)?void 0:t(this,0===e?0:e)}:"has"==e?function(e){return!(i&&!Wh(e))&&t(this,0===e?0:e)}:function(e,r){return t(this,0===e?0:e,r),this})};if(jh(e,!Kh(a)||!(i||s.forEach&&!Yh((function(){(new a).entries().next()})))))u=r.getConstructor(t,e,n,o),Hh.enable();else if(jh(e,!0)){var l=new u,h=l[o](i?{}:-0,1)!=l,f=Yh((function(){l.has(1)})),p=Jh((function(e){new a(e)})),v=!i&&Yh((function(){for(var e=new a,t=5;t--;)e[o](t,t);return!e.has(-0)}));p||((u=t((function(e,t){qh(e,s);var r=Zh(new a,e,u);return Xh(t)||zh(t,r[o],{that:r,AS_ENTRIES:n}),r}))).prototype=s,s.constructor=u),(f||v)&&(d("delete"),d("has"),n&&d("get")),(v||h)&&d(o),i&&s.clear&&delete s.clear}return c[e]=u,Vh({global:!0,constructor:!0,forced:u!=a},c),Qh(u,e),i||r.setStrong(u,e,n),u},ef=wn,tf=function(e,t,r){for(var n in t)ef(e,n,t[n],r);return e},rf=Xe,nf=gt,of=St,af=_t("species"),sf=function(e){var t=rf(e),r=nf.f;of&&t&&!t[af]&&r(t,af,{configurable:!0,get:function(){return this}})},uf=gt.f,cf=La,df=tf,lf=Zn,hf=wh,ff=Ie,pf=Ih,vf=zd,_f=qd,mf=sf,yf=St,gf=ol.exports.fastKey,Sf=ln.set,bf=ln.getterFor,Ef={getConstructor:function(e,t,r,n){var i=e((function(e,i){hf(e,o),Sf(e,{type:t,index:cf(null),first:void 0,last:void 0,size:0}),yf||(e.size=0),ff(i)||pf(i,e[n],{that:e,AS_ENTRIES:r})})),o=i.prototype,a=bf(t),s=function(e,t,r){var n,i,o=a(e),s=u(e,t);return s?s.value=r:(o.last=s={index:i=gf(t,!0),key:t,value:r,previous:n=o.last,next:void 0,removed:!1},o.first||(o.first=s),n&&(n.next=s),yf?o.size++:e.size++,"F"!==i&&(o.index[i]=s)),e},u=function(e,t){var r,n=a(e),i=gf(t);if("F"!==i)return n.index[i];for(r=n.first;r;r=r.next)if(r.key==t)return r};return df(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,yf?e.size=0:this.size=0},delete:function(e){var t=this,r=a(t),n=u(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),yf?r.size--:t.size--}return!!n},forEach:function(e){for(var t,r=a(this),n=lf(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!!u(this,e)}}),df(o,r?{get:function(e){var t=u(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)}}),yf&&uf(o,"size",{get:function(){return a(this).size}}),i},setStrong:function(e,t,r){var n=t+" Iterator",i=bf(t),o=bf(n);vf(e,t,(function(e,t){Sf(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)?_f("keys"==t?r.key:"values"==t?r.value:[r.key,r.value],!1):(e.target=void 0,_f(void 0,!0))}),r?"entries":"values",!r,!0),mf(t)}};$h("Map",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),Ef);var kf=sc.charAt,Tf=es,If=ln,Rf=zd,Af=qd,wf="String Iterator",Cf=If.set,Of=If.getterFor(wf);Rf(String,"String",(function(e){Cf(this,{type:wf,string:Tf(e),index:0})}),(function(){var e,t=Of(this),r=t.string,n=t.index;return n>=r.length?Af(void 0,!0):(e=kf(r,n),t.index+=e.length,Af(e,!1))}));var xf=se,Nf=Gn,Df=qn,Pf=nl,Mf=qr,Lf=_t,Uf=Lf("iterator"),Vf=Lf("toStringTag"),Ff=Pf.values,Bf=function(e,t){if(e){if(e[Uf]!==Ff)try{Mf(e,Uf,Ff)}catch(r0){e[Uf]=Ff}if(e[Vf]||Mf(e,Vf,t),Nf[t])for(var r in Pf)if(e[r]!==Pf[r])try{Mf(e,r,Pf[r])}catch(r0){e[r]=Pf[r]}}};for(var jf in Nf)Bf(xf[jf]&&xf[jf].prototype,jf);Bf(Df,"DOMTokenList");var Gf=xe,Hf=_a;ha({target:"Object",stat:!0,forced:ye((function(){Hf(1)}))},{keys:function(e){return Hf(Gf(e))}});var zf=ha,qf=St,Kf=gt.f;zf({target:"Object",stat:!0,forced:Object.defineProperty!==Kf,sham:!qf},{defineProperty:Kf});var Xf=gt.f,Wf=function(e,t,r){r in e||Xf(e,r,{configurable:!0,get:function(){return t[r]},set:function(e){t[r]=e}})},Yf=es,Jf=function(e,t){return void 0===e?arguments.length<2?"":t:Yf(e)},Qf=kt,Zf=qr,$f=Error,ep=Te("".replace),tp=String($f("zxcasd").stack),rp=/\n\s*at [^:]*:[^\n]*/,np=rp.test(tp),ip=function(e,t){if(np&&"string"==typeof e&&!$f.prepareStackTrace)for(;t--;)e=ep(e,rp,"");return e},op=Gr,ap=!ye((function(){var e=Error("a");return!("stack"in e)||(Object.defineProperty(e,"stack",op(1,7)),7!==e.stack)})),sp=Xe,up=Pe,cp=qr,dp=Vt,lp=Td,hp=Yo,fp=Wf,pp=Uh,vp=Jf,_p=function(e,t){Qf(t)&&"cause"in t&&Zf(e,"cause",t.cause)},mp=ip,yp=ap,gp=St,Sp=ha,bp=bu,Ep=function(e,t,r,n){var i="stackTraceLimit",o=n?2:1,a=e.split("."),s=a[a.length-1],u=sp.apply(null,a);if(u){var c=u.prototype;if(up(c,"cause")&&delete c.cause,!r)return u;var d=sp("Error"),l=t((function(e,t){var r=vp(n?t:e,void 0),i=n?new u(e):new u;return void 0!==r&&cp(i,"message",r),yp&&cp(i,"stack",mp(i.stack,2)),this&&dp(c,this)&&pp(i,this,l),arguments.length>o&&_p(i,arguments[o]),i}));l.prototype=c,"Error"!==s?lp?lp(l,d):hp(l,d,{name:!0}):gp&&i in u&&(fp(l,u,i),fp(l,u,"prepareStackTrace")),hp(l,u);try{c.name!==s&&cp(c,"name",s),c.constructor=l}catch(r0){}return l}},kp="WebAssembly",Tp=se.WebAssembly,Ip=7!==Error("e",{cause:7}).cause,Rp=function(e,t){var r={};r[e]=Ep(e,t,Ip),Sp({global:!0,constructor:!0,arity:1,forced:Ip},r)},Ap=function(e,t){if(Tp&&Tp[e]){var r={};r[e]=Ep("WebAssembly."+e,t,Ip),Sp({target:kp,stat:!0,constructor:!0,arity:1,forced:Ip},r)}};Rp("Error",(function(e){return function(t){return bp(e,this,arguments)}})),Rp("EvalError",(function(e){return function(t){return bp(e,this,arguments)}})),Rp("RangeError",(function(e){return function(t){return bp(e,this,arguments)}})),Rp("ReferenceError",(function(e){return function(t){return bp(e,this,arguments)}})),Rp("SyntaxError",(function(e){return function(t){return bp(e,this,arguments)}})),Rp("TypeError",(function(e){return function(t){return bp(e,this,arguments)}})),Rp("URIError",(function(e){return function(t){return bp(e,this,arguments)}})),Ap("CompileError",(function(e){return function(t){return bp(e,this,arguments)}})),Ap("LinkError",(function(e){return function(t){return bp(e,this,arguments)}})),Ap("RuntimeError",(function(e){return function(t){return bp(e,this,arguments)}}));var wp=Yt,Cp=xe,Op=ni,xp=hi,Np=TypeError,Dp=function(e){return function(t,r,n,i){wp(r);var o=Cp(t),a=Op(o),s=xp(o),u=e?s-1:0,c=e?-1:1;if(n<2)for(;;){if(u in a){i=a[u],u+=c;break}if(u+=c,e?u<0:s<=u)throw Np("Reduce of empty array with no initial value")}for(;e?u>=0:s>u;u+=c)u in a&&(i=r(i,a[u],u,o));return i}},Pp={left:Dp(!1),right:Dp(!0)},Mp="process"==Nn(se.process),Lp=Pp.left,Up=tt,Vp=Mp;ha({target:"Array",proto:!0,forced:!qi("reduce")||!Vp&&Up>79&&Up<83},{reduce:function(e){var t=arguments.length;return Lp(this,e,t,t>1?arguments[1]:void 0)}});var Fp=St,Bp=Te,jp=Ut,Gp=ye,Hp=_a,zp=Vo,qp=ro,Kp=xe,Xp=ni,Wp=Object.assign,Yp=Object.defineProperty,Jp=Bp([].concat),Qp=!Wp||Gp((function(){if(Fp&&1!==Wp({b:1},Wp(Yp({},"a",{enumerable:!0,get:function(){Yp(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!=Wp({},e)[r]||Hp(Wp({},t)).join("")!=n}))?function(e,t){for(var r=Kp(e),n=arguments.length,i=1,o=zp.f,a=qp.f;n>i;)for(var s,u=Xp(arguments[i++]),c=o?Jp(Hp(u),o(u)):Hp(u),d=c.length,l=0;d>l;)s=c[l++],Fp&&!jp(a,u,s)||(r[s]=u[s]);return r}:Wp,Zp=Qp;ha({target:"Object",stat:!0,arity:2,forced:Object.assign!==Zp},{assign:Zp});var $p,ev=ha,tv=Wn,rv=to.f,nv=di,iv=es,ov=Qa,av=we,sv=rs,uv=tv("".endsWith),cv=tv("".slice),dv=Math.min,lv=sv("endsWith");ev({target:"String",proto:!0,forced:!!(lv||($p=rv(String.prototype,"endsWith"),!$p||$p.writable))&&!lv},{endsWith:function(e){var t=iv(av(this));ov(e);var r=arguments.length>1?arguments[1]:void 0,n=t.length,i=void 0===r?n:dv(nv(r),n),o=iv(e);return uv?uv(t,o,i):cv(t,i-o.length,i)===o}});var hv=St,fv=pi,pv=TypeError,vv=Object.getOwnPropertyDescriptor,_v=hv&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(r0){return r0 instanceof TypeError}}()?function(e,t){if(fv(e)&&!vv(e,"length").writable)throw pv("Cannot set read only .length");return e.length=t}:function(e,t){return e.length=t},mv=TypeError,yv=function(e){if(e>9007199254740991)throw mv("Maximum allowed index exceeded");return e},gv=ha,Sv=xe,bv=hi,Ev=_v,kv=yv,Tv=ye((function(){return 4294967297!==[].push.call({length:4294967296},1)})),Iv=!function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(r0){return r0 instanceof TypeError}}();gv({target:"Array",proto:!0,arity:1,forced:Tv||Iv},{push:function(e){var t=Sv(this),r=bv(t),n=arguments.length;kv(r+n);for(var i=0;i<n;i++)t[r]=arguments[i],r++;return Ev(t,r),r}});var Rv=!0,Av=!0;function wv(e,t,r){var n=e.match(t);return n&&n.length>=r&&parseInt(n[r],10)}function Cv(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 Ov(e){return"boolean"!=typeof e?new Error("Argument type: "+a(e)+". Please use a boolean."):(Rv=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function xv(e){return"boolean"!=typeof e?new Error("Argument type: "+a(e)+". Please use a boolean."):(Av=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function Nv(){if("object"===("undefined"==typeof window?"undefined":a(window))){if(Rv)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function Dv(e,t){Av&&console.warn(e+" is deprecated, please use "+t+" instead.")}function Pv(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=wv(r.userAgent,/Firefox\/(\d+)\./,1);else if(r.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection)t.browser="chrome",t.version=wv(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=wv(r.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return t}function Mv(e){return"[object Object]"===Object.prototype.toString.call(e)}function Lv(e){return Mv(e)?Object.keys(e).reduce((function(t,r){var n=Mv(e[r]),i=n?Lv(e[r]):e[r],o=n&&!Object.keys(i).length;return void 0===i||o?t:Object.assign(t,h({},r,i))}),{}):e}function Uv(e,t,r){t&&!r.has(t.id)&&(r.set(t.id,t),Object.keys(t).forEach((function(n){n.endsWith("Id")?Uv(e,e.get(t[n]),r):n.endsWith("Ids")&&t[n].forEach((function(t){Uv(e,e.get(t),r)}))})))}function Vv(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&&Uv(e,r,i)}))})),i}var Fv=ha,Bv=Hi.find,jv=Ga,Gv="find",Hv=!0;Gv in[]&&Array(1).find((function(){Hv=!1})),Fv({target:"Array",proto:!0,forced:Hv},{find:function(e){return Bv(this,e,arguments.length>1?arguments[1]:void 0)}}),jv(Gv);var zv=ha,qv=pi,Kv=wi,Xv=kt,Wv=ko,Yv=hi,Jv=uo,Qv=dl,Zv=_t,$v=Eu,e_=Qu("slice"),t_=Zv("species"),r_=Array,n_=Math.max;zv({target:"Array",proto:!0,forced:!e_},{slice:function(e,t){var r,n,i,o=Jv(this),a=Yv(o),s=Wv(e,a),u=Wv(void 0===t?a:t,a);if(qv(o)&&(r=o.constructor,(Kv(r)&&(r===r_||qv(r.prototype))||Xv(r)&&null===(r=r[t_]))&&(r=void 0),r===r_||void 0===r))return $v(o,s,u);for(n=new(void 0===r?r_:r)(n_(u-s,0)),i=0;s<u;s++,i++)s in o&&Qv(n,i,o[s]);return n.length=i,n}});var i_=ha,o_=wo.indexOf,a_=qi,s_=Wn([].indexOf),u_=!!s_&&1/s_([1],1,-0)<0,c_=a_("indexOf");i_({target:"Array",proto:!0,forced:u_||!c_},{indexOf:function(e){var t=arguments.length>1?arguments[1]:void 0;return u_?s_(this,e,t)||0:o_(this,e,t)}});var d_=qt,l_=TypeError,h_=function(e,t){if(!delete e[t])throw l_("Cannot delete property "+d_(t)+" of "+d_(e))},f_=ha,p_=xe,v_=ko,__=si,m_=hi,y_=_v,g_=yv,S_=Mi,b_=dl,E_=h_,k_=Qu("splice"),T_=Math.max,I_=Math.min;f_({target:"Array",proto:!0,forced:!k_},{splice:function(e,t){var r,n,i,o,a,s,u=p_(this),c=m_(u),d=v_(e,c),l=arguments.length;for(0===l?r=n=0:1===l?(r=0,n=c-d):(r=l-2,n=I_(T_(__(t),0),c-d)),g_(c+r-n),i=S_(u,n),o=0;o<n;o++)(a=d+o)in u&&b_(i,o,u[a]);if(i.length=n,r<n){for(o=d;o<c-n;o++)s=o+r,(a=o+n)in u?u[s]=u[a]:E_(u,s);for(o=c;o>c-n+r;o--)E_(u,o-1)}else if(r>n)for(o=c-n;o>d;o--)s=o+r-1,(a=o+n-1)in u?u[s]=u[a]:E_(u,s);for(o=0;o<r;o++)u[o+d]=arguments[o+2];return y_(u,c-n+r),i}});var R_,A_,w_,C_,O_=wi,x_=qt,N_=TypeError,D_=function(e){if(O_(e))return e;throw N_(x_(e)+" is not a constructor")},P_=Pt,M_=D_,L_=Ie,U_=_t("species"),V_=function(e,t){var r,n=P_(e).constructor;return void 0===n||L_(r=P_(n)[U_])?t:M_(r)},F_=TypeError,B_=function(e,t){if(e<t)throw F_("Not enough arguments");return e},j_=/(?:ipad|iphone|ipod).*applewebkit/i.test(We),G_=se,H_=bu,z_=Zn,q_=He,K_=Pe,X_=ye,W_=Ta,Y_=Eu,J_=At,Q_=B_,Z_=j_,$_=Mp,em=G_.setImmediate,tm=G_.clearImmediate,rm=G_.process,nm=G_.Dispatch,im=G_.Function,om=G_.MessageChannel,am=G_.String,sm=0,um={},cm="onreadystatechange";try{R_=G_.location}catch(r0){}var dm=function(e){if(K_(um,e)){var t=um[e];delete um[e],t()}},lm=function(e){return function(){dm(e)}},hm=function(e){dm(e.data)},fm=function(e){G_.postMessage(am(e),R_.protocol+"//"+R_.host)};em&&tm||(em=function(e){Q_(arguments.length,1);var t=q_(e)?e:im(e),r=Y_(arguments,1);return um[++sm]=function(){H_(t,void 0,r)},A_(sm),sm},tm=function(e){delete um[e]},$_?A_=function(e){rm.nextTick(lm(e))}:nm&&nm.now?A_=function(e){nm.now(lm(e))}:om&&!Z_?(C_=(w_=new om).port2,w_.port1.onmessage=hm,A_=z_(C_.postMessage,C_)):G_.addEventListener&&q_(G_.postMessage)&&!G_.importScripts&&R_&&"file:"!==R_.protocol&&!X_(fm)?(A_=fm,G_.addEventListener("message",hm,!1)):A_=cm in J_("script")?function(e){W_.appendChild(J_("script")).onreadystatechange=function(){W_.removeChild(this),dm(e)}}:function(e){setTimeout(lm(e),0)});var pm,vm,_m,mm,ym,gm,Sm,bm,Em={set:em,clear:tm},km=se,Tm=/ipad|iphone|ipod/i.test(We)&&void 0!==km.Pebble,Im=/web0s(?!.*chrome)/i.test(We),Rm=se,Am=Zn,wm=to.f,Cm=Em.set,Om=j_,xm=Tm,Nm=Im,Dm=Mp,Pm=Rm.MutationObserver||Rm.WebKitMutationObserver,Mm=Rm.document,Lm=Rm.process,Um=Rm.Promise,Vm=wm(Rm,"queueMicrotask"),Fm=Vm&&Vm.value;Fm||(pm=function(){var e,t;for(Dm&&(e=Lm.domain)&&e.exit();vm;){t=vm.fn,vm=vm.next;try{t()}catch(r0){throw vm?mm():_m=void 0,r0}}_m=void 0,e&&e.enter()},Om||Dm||Nm||!Pm||!Mm?!xm&&Um&&Um.resolve?((Sm=Um.resolve(void 0)).constructor=Um,bm=Am(Sm.then,Sm),mm=function(){bm(pm)}):Dm?mm=function(){Lm.nextTick(pm)}:(Cm=Am(Cm,Rm),mm=function(){Cm(pm)}):(ym=!0,gm=Mm.createTextNode(""),new Pm(pm).observe(gm,{characterData:!0}),mm=function(){gm.data=ym=!ym}));var Bm=Fm||function(e){var t={fn:e,next:void 0};_m&&(_m.next=t),vm||(vm=t,mm()),_m=t},jm=se,Gm=function(e){try{return{error:!1,value:e()}}catch(r0){return{error:!0,value:r0}}},Hm=function(){this.head=null,this.tail=null};Hm.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 zm=Hm,qm=se.Promise,Km="object"==typeof Deno&&Deno&&"object"==typeof Deno.version,Xm=!Km&&!Mp&&"object"==typeof window&&"object"==typeof document,Wm=se,Ym=qm,Jm=He,Qm=ia,Zm=Vr,$m=_t,ey=Xm,ty=Km,ry=tt;Ym&&Ym.prototype;var ny=$m("species"),iy=!1,oy=Jm(Wm.PromiseRejectionEvent),ay={CONSTRUCTOR:Qm("Promise",(function(){var e=Zm(Ym),t=e!==String(Ym);if(!t&&66===ry)return!0;if(!ry||ry<51||!/native code/.test(e)){var r=new Ym((function(e){e(1)})),n=function(e){e((function(){}),(function(){}))};if((r.constructor={})[ny]=n,!(iy=r.then((function(){}))instanceof n))return!0}return!t&&(ey||ty)&&!oy})),REJECTION_EVENT:oy,SUBCLASSING:iy},sy={},uy=Yt,cy=TypeError,dy=function(e){var t,r;this.promise=new e((function(e,n){if(void 0!==t||void 0!==r)throw cy("Bad Promise constructor");t=e,r=n})),this.resolve=uy(t),this.reject=uy(r)};sy.f=function(e){return new dy(e)};var ly,hy,fy,py=ha,vy=Mp,_y=se,my=Ut,yy=wn,gy=Td,Sy=dd,by=sf,Ey=Yt,ky=He,Ty=kt,Iy=wh,Ry=V_,Ay=Em.set,wy=Bm,Cy=function(e,t){var r=jm.console;r&&r.error&&(1==arguments.length?r.error(e):r.error(e,t))},Oy=Gm,xy=zm,Ny=ln,Dy=qm,Py=sy,My="Promise",Ly=ay.CONSTRUCTOR,Uy=ay.REJECTION_EVENT,Vy=ay.SUBCLASSING,Fy=Ny.getterFor(My),By=Ny.set,jy=Dy&&Dy.prototype,Gy=Dy,Hy=jy,zy=_y.TypeError,qy=_y.document,Ky=_y.process,Xy=Py.f,Wy=Xy,Yy=!!(qy&&qy.createEvent&&_y.dispatchEvent),Jy="unhandledrejection",Qy=function(e){var t;return!(!Ty(e)||!ky(t=e.then))&&t},Zy=function(e,t){var r,n,i,o=t.value,a=1==t.state,s=a?e.ok:e.fail,u=e.resolve,c=e.reject,d=e.domain;try{s?(a||(2===t.rejection&&ng(t),t.rejection=1),!0===s?r=o:(d&&d.enter(),r=s(o),d&&(d.exit(),i=!0)),r===e.promise?c(zy("Promise-chain cycle")):(n=Qy(r))?my(n,r,u,c):u(r)):c(o)}catch(r0){d&&!i&&d.exit(),c(r0)}},$y=function(e,t){e.notified||(e.notified=!0,wy((function(){for(var r,n=e.reactions;r=n.get();)Zy(r,e);e.notified=!1,t&&!e.rejection&&tg(e)})))},eg=function(e,t,r){var n,i;Yy?((n=qy.createEvent("Event")).promise=t,n.reason=r,n.initEvent(e,!1,!0),_y.dispatchEvent(n)):n={promise:t,reason:r},!Uy&&(i=_y["on"+e])?i(n):e===Jy&&Cy("Unhandled promise rejection",r)},tg=function(e){my(Ay,_y,(function(){var t,r=e.facade,n=e.value;if(rg(e)&&(t=Oy((function(){vy?Ky.emit("unhandledRejection",n,r):eg(Jy,r,n)})),e.rejection=vy||rg(e)?2:1,t.error))throw t.value}))},rg=function(e){return 1!==e.rejection&&!e.parent},ng=function(e){my(Ay,_y,(function(){var t=e.facade;vy?Ky.emit("rejectionHandled",t):eg("rejectionhandled",t,e.value)}))},ig=function(e,t,r){return function(n){e(t,n,r)}},og=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=2,$y(e,!0))},ag=function(e,t,r){if(!e.done){e.done=!0,r&&(e=r);try{if(e.facade===t)throw zy("Promise can't be resolved itself");var n=Qy(t);n?wy((function(){var r={done:!1};try{my(n,t,ig(ag,r,e),ig(og,r,e))}catch(r0){og(r,r0,e)}})):(e.value=t,e.state=1,$y(e,!1))}catch(r0){og({done:!1},r0,e)}}};if(Ly&&(Hy=(Gy=function(e){Iy(this,Hy),Ey(e),my(ly,this);var t=Fy(this);try{e(ig(ag,t),ig(og,t))}catch(r0){og(t,r0)}}).prototype,(ly=function(e){By(this,{type:My,done:!1,notified:!1,parent:!1,reactions:new xy,rejection:!1,state:0,value:void 0})}).prototype=yy(Hy,"then",(function(e,t){var r=Fy(this),n=Xy(Ry(this,Gy));return r.parent=!0,n.ok=!ky(e)||e,n.fail=ky(t)&&t,n.domain=vy?Ky.domain:void 0,0==r.state?r.reactions.add(n):wy((function(){Zy(n,r)})),n.promise})),hy=function(){var e=new ly,t=Fy(e);this.promise=e,this.resolve=ig(ag,t),this.reject=ig(og,t)},Py.f=Xy=function(e){return e===Gy||undefined===e?new hy(e):Wy(e)},ky(Dy)&&jy!==Object.prototype)){fy=jy.then,Vy||yy(jy,"then",(function(e,t){var r=this;return new Gy((function(e,t){my(fy,r,e,t)})).then(e,t)}),{unsafe:!0});try{delete jy.constructor}catch(r0){}gy&&gy(jy,Hy)}py({global:!0,constructor:!0,wrap:!0,forced:Ly},{Promise:Gy}),Sy(Gy,My,!1),by(My);var sg=qm,ug=ay.CONSTRUCTOR||!Dh((function(e){sg.all(e).then(void 0,(function(){}))})),cg=Ut,dg=Yt,lg=sy,hg=Gm,fg=Ih;ha({target:"Promise",stat:!0,forced:ug},{all:function(e){var t=this,r=lg.f(t),n=r.resolve,i=r.reject,o=hg((function(){var r=dg(t.resolve),o=[],a=0,s=1;fg(e,(function(e){var u=a++,c=!1;s++,cg(r,t,e).then((function(e){c||(c=!0,o[u]=e,--s||n(o))}),i)})),--s||n(o)}));return o.error&&i(o.value),r.promise}});var pg=ha,vg=ay.CONSTRUCTOR,_g=qm,mg=Xe,yg=He,gg=wn,Sg=_g&&_g.prototype;if(pg({target:"Promise",proto:!0,forced:vg,real:!0},{catch:function(e){return this.then(void 0,e)}}),yg(_g)){var bg=mg("Promise").prototype.catch;Sg.catch!==bg&&gg(Sg,"catch",bg,{unsafe:!0})}var Eg=Ut,kg=Yt,Tg=sy,Ig=Gm,Rg=Ih;ha({target:"Promise",stat:!0,forced:ug},{race:function(e){var t=this,r=Tg.f(t),n=r.reject,i=Ig((function(){var i=kg(t.resolve);Rg(e,(function(e){Eg(i,t,e).then(r.resolve,n)}))}));return i.error&&n(i.value),r.promise}});var Ag=Ut,wg=sy;ha({target:"Promise",stat:!0,forced:ay.CONSTRUCTOR},{reject:function(e){var t=wg.f(this);return Ag(t.reject,void 0,e),t.promise}});var Cg=Pt,Og=kt,xg=sy,Ng=function(e,t){if(Cg(e),Og(t)&&t.constructor===e)return t;var r=xg.f(e);return(0,r.resolve)(t),r.promise},Dg=ha,Pg=ay.CONSTRUCTOR,Mg=Ng;Xe("Promise"),Dg({target:"Promise",stat:!0,forced:Pg},{resolve:function(e){return Mg(this,e)}});var Lg=Mp,Ug=Ir.exports,Vg=gt,Fg=function(e,t,r){return r.get&&Ug(r.get,t,{getter:!0}),r.set&&Ug(r.set,t,{setter:!0}),Vg.f(e,t,r)},Bg=St,jg=ye,Gg=Pt,Hg=La,zg=Jf,qg=Error.prototype.toString,Kg=jg((function(){if(Bg){var e=Hg(Object.defineProperty({},"name",{get:function(){return this===e}}));if("true"!==qg.call(e))return!0}return"2: 1"!==qg.call({message:1,name:2})||"Error"!==qg.call({})}))?function(){var e=Gg(this),t=zg(e.name,"Error"),r=zg(e.message);return t?r?t+": "+r:t:r}:qg,Xg={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}},Wg=ha,Yg=function(e){try{if(Lg)return Function('return require("'+e+'")')()}catch(r0){}},Jg=Xe,Qg=ye,Zg=La,$g=Gr,eS=gt.f,tS=wn,rS=Fg,nS=Pe,iS=wh,oS=Pt,aS=Kg,sS=Jf,uS=Xg,cS=ip,dS=ln,lS=St,hS="DOMException",fS="DATA_CLONE_ERR",pS=Jg("Error"),vS=Jg(hS)||function(){try{(new(Jg("MessageChannel")||Yg("worker_threads").MessageChannel)).port1.postMessage(new WeakMap)}catch(r0){if(r0.name==fS&&25==r0.code)return r0.constructor}}(),_S=vS&&vS.prototype,mS=pS.prototype,yS=dS.set,gS=dS.getterFor(hS),SS="stack"in pS(hS),bS=function(e){return nS(uS,e)&&uS[e].m?uS[e].c:0},ES=function(){iS(this,kS);var e=arguments.length,t=sS(e<1?void 0:arguments[0]),r=sS(e<2?void 0:arguments[1],"Error"),n=bS(r);if(yS(this,{type:hS,name:r,message:t,code:n}),lS||(this.name=r,this.message=t,this.code=n),SS){var i=pS(t);i.name=hS,eS(this,"stack",$g(1,cS(i.stack,1)))}},kS=ES.prototype=Zg(mS),TS=function(e){return{enumerable:!0,configurable:!0,get:e}},IS=function(e){return TS((function(){return gS(this)[e]}))};lS&&(rS(kS,"code",IS("code")),rS(kS,"message",IS("message")),rS(kS,"name",IS("name"))),eS(kS,"constructor",$g(1,ES));var RS=Qg((function(){return!(new vS instanceof pS)})),AS=RS||Qg((function(){return mS.toString!==aS||"2: 1"!==String(new vS(1,2))})),wS=RS||Qg((function(){return 25!==new vS(1,"DataCloneError").code}));RS||25!==vS.DATA_CLONE_ERR||_S.DATA_CLONE_ERR;Wg({global:!0,constructor:!0,forced:RS},{DOMException:RS?ES:vS});var CS=Jg(hS),OS=CS.prototype;for(var xS in AS&&vS===CS&&tS(OS,"toString",aS),wS&&lS&&vS===CS&&rS(OS,"code",TS((function(){return bS(oS(this).name)}))),uS)if(nS(uS,xS)){var NS=uS[xS],DS=NS.s,PS=$g(6,NS.c);nS(CS,DS)||eS(CS,DS,PS),nS(OS,DS)||eS(OS,DS,PS)}var MS=ha,LS=se,US=Xe,VS=Gr,FS=gt.f,BS=Pe,jS=wh,GS=Uh,HS=Jf,zS=Xg,qS=ip,KS=St,XS="DOMException",WS=US("Error"),YS=US(XS),JS=function(){jS(this,QS);var e=arguments.length,t=HS(e<1?void 0:arguments[0]),r=HS(e<2?void 0:arguments[1],"Error"),n=new YS(t,r),i=WS(t);return i.name=XS,FS(n,"stack",VS(1,qS(i.stack,1))),GS(n,this,JS),n},QS=JS.prototype=YS.prototype,ZS="stack"in WS(XS),$S="stack"in new YS(1,2),eb=YS&&KS&&Object.getOwnPropertyDescriptor(LS,XS),tb=!(!eb||eb.writable&&eb.configurable),rb=ZS&&!tb&&!$S;MS({global:!0,constructor:!0,forced:rb},{DOMException:rb?JS:YS});var nb=US(XS),ib=nb.prototype;if(ib.constructor!==nb)for(var ob in FS(ib,"constructor",VS(1,nb)),zS)if(BS(zS,ob)){var ab=zS[ob],sb=ab.s;BS(nb,sb)||FS(nb,sb,VS(6,ab.c))}var ub="DOMException";dd(Xe(ub),ub);var cb=Hi.filter;ha({target:"Array",proto:!0,forced:!Qu("filter")},{filter:function(e){return cb(this,e,arguments.length>1?arguments[1]:void 0)}});var db=ha,lb=ye,hb=pi,fb=kt,pb=xe,vb=hi,_b=yv,mb=dl,yb=Mi,gb=Qu,Sb=tt,bb=_t("isConcatSpreadable"),Eb=Sb>=51||!lb((function(){var e=[];return e[bb]=!1,e.concat()[0]!==e})),kb=gb("concat"),Tb=function(e){if(!fb(e))return!1;var t=e[bb];return void 0!==t?!!t:hb(e)};db({target:"Array",proto:!0,arity:1,forced:!Eb||!kb},{concat:function(e){var t,r,n,i,o,a=pb(this),s=yb(a,0),u=0;for(t=-1,n=arguments.length;t<n;t++)if(Tb(o=-1===t?a:arguments[t]))for(i=vb(o),_b(u+i),r=0;r<i;r++,u++)r in o&&mb(s,u,o[r]);else _b(u+1),mb(s,u++,o);return s.length=u,s}});var Ib=Te,Rb=xe,Ab=Math.floor,wb=Ib("".charAt),Cb=Ib("".replace),Ob=Ib("".slice),xb=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,Nb=/\$([$&'`]|\d{1,2})/g,Db=bu,Pb=Ut,Mb=Te,Lb=eu,Ub=ye,Vb=Pt,Fb=He,Bb=Ie,jb=si,Gb=di,Hb=es,zb=we,qb=cc,Kb=Zt,Xb=function(e,t,r,n,i,o){var a=r+e.length,s=n.length,u=Nb;return void 0!==i&&(i=Rb(i),u=xb),Cb(o,u,(function(o,u){var c;switch(wb(u,0)){case"$":return"$";case"&":return e;case"`":return Ob(t,0,r);case"'":return Ob(t,a);case"<":c=i[Ob(u,1,-1)];break;default:var d=+u;if(0===d)return o;if(d>s){var l=Ab(d/10);return 0===l?o:l<=s?void 0===n[l-1]?wb(u,1):n[l-1]+wb(u,1):o}c=n[d-1]}return void 0===c?"":c}))},Wb=uu,Yb=_t("replace"),Jb=Math.max,Qb=Math.min,Zb=Mb([].concat),$b=Mb([].push),eE=Mb("".indexOf),tE=Mb("".slice),rE="$0"==="a".replace(/./,"$0"),nE=!!/./[Yb]&&""===/./[Yb]("a","$0"),iE=!Ub((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")}));Lb("replace",(function(e,t,r){var n=nE?"$":"$0";return[function(e,r){var n=zb(this),i=Bb(e)?void 0:Kb(e,Yb);return i?Pb(i,e,n,r):Pb(t,Hb(n),e,r)},function(e,i){var o=Vb(this),a=Hb(e);if("string"==typeof i&&-1===eE(i,n)&&-1===eE(i,"$<")){var s=r(t,o,a,i);if(s.done)return s.value}var u=Fb(i);u||(i=Hb(i));var c=o.global;if(c){var d=o.unicode;o.lastIndex=0}for(var l=[];;){var h=Wb(o,a);if(null===h)break;if($b(l,h),!c)break;""===Hb(h[0])&&(o.lastIndex=qb(a,Gb(o.lastIndex),d))}for(var f,p="",v=0,_=0;_<l.length;_++){for(var m=Hb((h=l[_])[0]),y=Jb(Qb(jb(h.index),a.length),0),g=[],S=1;S<h.length;S++)$b(g,void 0===(f=h[S])?f:String(f));var b=h.groups;if(u){var E=Zb([m],g,y,a);void 0!==b&&$b(E,b);var k=Hb(Db(i,void 0,E))}else k=Xb(m,a,y,g,b,i);y>=v&&(p+=tE(a,v,y)+k,v=y+m.length)}return p+tE(a,v)}]}),!iE||!rE||nE);var oE=Ut,aE=Pe,sE=Vt,uE=hs,cE=RegExp.prototype,dE=function(e){var t=e.flags;return void 0!==t||"flags"in cE||aE(e,"flags")||!sE(cE,e)?t:oE(uE,e)},lE=St,hE=se,fE=Te,pE=ia,vE=Uh,_E=qr,mE=go.f,yE=Vt,gE=Wa,SE=es,bE=dE,EE=ys,kE=Wf,TE=wn,IE=ye,RE=Pe,AE=ln.enforce,wE=sf,CE=bs,OE=Ts,xE=_t("match"),NE=hE.RegExp,DE=NE.prototype,PE=hE.SyntaxError,ME=fE(DE.exec),LE=fE("".charAt),UE=fE("".replace),VE=fE("".indexOf),FE=fE("".slice),BE=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,jE=/a/g,GE=/a/g,HE=new NE(jE)!==jE,zE=EE.MISSED_STICKY,qE=EE.UNSUPPORTED_Y,KE=lE&&(!HE||zE||CE||OE||IE((function(){return GE[xE]=!1,NE(jE)!=jE||NE(GE)==GE||"/a/i"!=NE(jE,"i")})));if(pE("RegExp",KE)){for(var XE=function(e,t){var r,n,i,o,a,s,u=yE(DE,this),c=gE(e),d=void 0===t,l=[],h=e;if(!u&&c&&d&&e.constructor===XE)return e;if((c||yE(DE,e))&&(e=e.source,d&&(t=bE(h))),e=void 0===e?"":SE(e),t=void 0===t?"":SE(t),h=e,CE&&"dotAll"in jE&&(n=!!t&&VE(t,"s")>-1)&&(t=UE(t,/s/g,"")),r=t,zE&&"sticky"in jE&&(i=!!t&&VE(t,"y")>-1)&&qE&&(t=UE(t,/y/g,"")),OE&&(o=function(e){for(var t,r=e.length,n=0,i="",o=[],a={},s=!1,u=!1,c=0,d="";n<=r;n++){if("\\"===(t=LE(e,n)))t+=LE(e,++n);else if("]"===t)s=!1;else if(!s)switch(!0){case"["===t:s=!0;break;case"("===t:ME(BE,FE(e,n+1))&&(n+=2,u=!0),i+=t,c++;continue;case">"===t&&u:if(""===d||RE(a,d))throw new PE("Invalid capture group name");a[d]=!0,o[o.length]=[d,c],u=!1,d="";continue}u?d+=t:i+=t}return[i,o]}(e),e=o[0],l=o[1]),a=vE(NE(e,t),u?this:DE,XE),(n||i||l.length)&&(s=AE(a),n&&(s.dotAll=!0,s.raw=XE(function(e){for(var t,r=e.length,n=0,i="",o=!1;n<=r;n++)"\\"!==(t=LE(e,n))?o||"."!==t?("["===t?o=!0:"]"===t&&(o=!1),i+=t):i+="[\\s\\S]":i+=t+LE(e,++n);return i}(e),r)),i&&(s.sticky=!0),l.length&&(s.groups=l)),e!==h)try{_E(a,"source",""===h?"(?:)":h)}catch(r0){}return a},WE=mE(NE),YE=0;WE.length>YE;)kE(XE,NE,WE[YE++]);DE.constructor=XE,XE.prototype=DE,TE(hE,"RegExp",XE,{constructor:!0})}wE("RegExp");var JE=St,QE=bs,ZE=Nn,$E=Fg,ek=ln.get,tk=RegExp.prototype,rk=TypeError;JE&&QE&&$E(tk,"dotAll",{configurable:!0,get:function(){if(this!==tk){if("RegExp"===ZE(this))return!!ek(this).dotAll;throw rk("Incompatible receiver, RegExp required")}}});var nk=St,ik=ys.MISSED_STICKY,ok=Nn,ak=Fg,sk=ln.get,uk=RegExp.prototype,ck=TypeError;nk&&ik&&ak(uk,"sticky",{configurable:!0,get:function(){if(this!==uk){if("RegExp"===ok(this))return!!sk(this).sticky;throw ck("Incompatible receiver, RegExp required")}}});var dk=xr.PROPER,lk=wn,hk=Pt,fk=es,pk=ye,vk=dE,_k="toString",mk=RegExp.prototype.toString,yk=pk((function(){return"/a/b"!=mk.call({source:"a",flags:"b"})})),gk=dk&&mk.name!=_k;(yk||gk)&&lk(RegExp.prototype,_k,(function(){var e=hk(this);return"/"+fk(e.source)+"/"+fk(vk(e))}),{unsafe:!0});var Sk=ha,bk=ye,Ek=uo,kk=to.f,Tk=St,Ik=bk((function(){kk(1)}));Sk({target:"Object",stat:!0,forced:!Tk||Ik,sham:!Tk},{getOwnPropertyDescriptor:function(e,t){return kk(Ek(e),t)}});var Rk=Nv;function Ak(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 u,c=t.version<66;if(s&&("user"===s.exact||"environment"===s.exact||"user"===s.ideal||"environment"===s.ideal)&&(!r.mediaDevices.getSupportedConstraints||!r.mediaDevices.getSupportedConstraints().facingMode||c))if(delete e.video.facingMode,"environment"===s.exact||"environment"===s.ideal?u=["back","rear"]:"user"!==s.exact&&"user"!==s.ideal||(u=["front"]),u)return r.mediaDevices.enumerateDevices().then((function(t){var r=(t=t.filter((function(e){return"videoinput"===e.kind}))).find((function(e){return u.some((function(t){return e.label.toLowerCase().includes(t)}))}));return!r&&t.length&&u.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 wk(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function Ck(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 Cv(e,"track",(function(e){return e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e}))}function Ok(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 xk(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 u=function(e){i(s(a(e)))};return t.apply(this,[u,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 Vv(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}),Cv(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 Vv(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 Dk(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 Pk(e,t){if(e.RTCPeerConnection){if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return Dk(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]=u(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 u(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 Mk(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 Lk(e,t){Cv(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 Uk,Vk,Fk=Object.freeze(Object.defineProperty({__proto__:null,shimMediaStream:wk,shimOnTrack:Ck,shimGetSendersWithDtmf:Ok,shimGetStats:xk,shimSenderReceiverGetStats:Nk,shimAddTrackRemoveTrackWithNative:Dk,shimAddTrackRemoveTrack:Pk,shimPeerConnection:Mk,fixNegotiationNeeded:Lk,shimGetUserMedia:Ak,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"})),Bk=ha,jk=Ut,Gk=He,Hk=Pt,zk=es,qk=(Uk=!1,(Vk=/[ac]/).exec=function(){return Uk=!0,/./.exec.apply(this,arguments)},!0===Vk.test("abc")&&Uk),Kk=/./.test;Bk({target:"RegExp",proto:!0,forced:!qk},{test:function(e){var t=Hk(this),r=zk(e),n=t.exec;if(!Gk(n))return jk(Kk,t,r);var i=jk(n,t,r);return null!==i&&(Hk(i),!0)}});var Xk=se,Wk=ye,Yk=es,Jk=Ac.trim,Qk=Te("".charAt),Zk=Xk.parseFloat,$k=Xk.Symbol,eT=$k&&$k.iterator,tT=1/Zk("\t\n\v\f\r \u2028\u2029\ufeff-0")!=-1/0||eT&&!Wk((function(){Zk(Object(eT))}))?function(e){var t=Jk(Yk(e)),r=Zk(t);return 0===r&&"-"==Qk(t,0)?-0:r}:Zk;ha({global:!0,forced:parseFloat!=tT},{parseFloat:tT});var rT=ha,nT=qm,iT=ye,oT=Xe,aT=He,sT=V_,uT=Ng,cT=wn,dT=nT&&nT.prototype;if(rT({target:"Promise",proto:!0,real:!0,forced:!!nT&&iT((function(){dT.finally.call({then:function(){}},(function(){}))}))},{finally:function(e){var t=sT(this,oT("Promise")),r=aT(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)}}),aT(nT)){var lT=oT("Promise").prototype.finally;dT.finally!==lT&&cT(dT,"finally",lT,{unsafe:!0})}function hT(e,t){var r=e&&e.navigator,n=e&&e.MediaStreamTrack;if(r.getUserMedia=function(e,t,n){Dv("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 u=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")),u.apply(this,[e])}}}}function fT(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 pT(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 vT(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 _T(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}),Cv(e,"track",(function(e){return e.receiver._pc=e.srcElement,e})),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}}function mT(e){e.RTCPeerConnection&&!("removeStream"in e.RTCPeerConnection.prototype)&&(e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;Dv("removeStream","removeTrack"),this.getSenders().forEach((function(r){r.track&&e.getTracks().includes(r.track)&&t.removeTrack(r)}))})}function yT(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function gT(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 ST(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 ET(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 kT=Object.freeze(Object.defineProperty({__proto__:null,shimOnTrack:fT,shimPeerConnection:pT,shimSenderGetStats:vT,shimReceiverGetStats:_T,shimRemoveStream:mT,shimRTCDataChannel:yT,shimAddTransceiver:gT,shimGetParameters:ST,shimCreateOffer:bT,shimCreateAnswer:ET,shimGetUserMedia:hT,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 TT(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 IT(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 u=function(e,t,r){var n=i.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n};t.setLocalDescription=u,u=function(e,t,r){var n=o.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n},t.setRemoteDescription=u,u=function(e,t,r){var n=s.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n},t.addIceCandidate=u}}function AT(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(wT(e))}}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,r,n){t.mediaDevices.getUserMedia(e).then(r,n)}.bind(t))}function wT(e){return e&&void 0!==e.video?Object.assign({},e,{video:Lv(e.video)}):e}function CT(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")?(Dv("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 OT(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 xT(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 DT=Object.freeze(Object.defineProperty({__proto__:null,shimLocalStreamsAPI:TT,shimRemoteStreamsAPI:IT,shimCallbacksAPI:RT,shimGetUserMedia:AT,shimConstraints:wT,shimRTCIceServerUrls:CT,shimTrackEventTransceiver:OT,shimCreateOfferLegacy:xT,shimAudioContext:NT},Symbol.toStringTag,{value:"Module"})),PT=Ut;ha({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return PT(URL.prototype.toString,this)}});var MT=Te(1..valueOf),LT=St,UT=se,VT=Te,FT=ia,BT=wn,jT=Pe,GT=Uh,HT=Vt,zT=Ht,qT=dr,KT=ye,XT=go.f,WT=to.f,YT=gt.f,JT=MT,QT=Ac.trim,ZT="Number",$T=UT.Number,eI=$T.prototype,tI=UT.TypeError,rI=VT("".slice),nI=VT("".charCodeAt),iI=function(e){var t=qT(e,"number");return"bigint"==typeof t?t:oI(t)},oI=function(e){var t,r,n,i,o,a,s,u,c=qT(e,"number");if(zT(c))throw tI("Cannot convert a Symbol value to a number");if("string"==typeof c&&c.length>2)if(c=QT(c),43===(t=nI(c,0))||45===t){if(88===(r=nI(c,2))||120===r)return NaN}else if(48===t){switch(nI(c,1)){case 66:case 98:n=2,i=49;break;case 79:case 111:n=8,i=55;break;default:return+c}for(a=(o=rI(c,2)).length,s=0;s<a;s++)if((u=nI(o,s))<48||u>i)return NaN;return parseInt(o,n)}return+c};if(FT(ZT,!$T(" 0o1")||!$T("0b1")||$T("+0x1"))){for(var aI,sI=function(e){var t=arguments.length<1?0:$T(iI(e)),r=this;return HT(eI,r)&&KT((function(){JT(r)}))?GT(Object(t),r,sI):t},uI=LT?XT($T):"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(","),cI=0;uI.length>cI;cI++)jT($T,aI=uI[cI])&&!jT(sI,aI)&&YT(sI,aI,WT($T,aI));sI.prototype=eI,eI.constructor=sI,BT(UT,ZT,sI,{constructor:!0})}var dI=xr.PROPER,lI=ye,hI=gc,fI=Ac.trim;ha({target:"String",proto:!0,forced:function(e){return lI((function(){return!!hI[e]()||"
"!=="
"[e]()||dI&&hI[e].name!==e}))}("trim")},{trim:function(){return fI(this)}});var pI,vI,_I={exports:{}};pI=_I,(vI={generateIdentifier:function(){return Math.random().toString(36).substr(2,10)}}).localCName=vI.generateIdentifier(),vI.splitLines=function(e){return e.trim().split("\n").map((function(e){return e.trim()}))},vI.splitSections=function(e){return e.split("\nm=").map((function(e,t){return(t>0?"m="+e:e).trim()+"\r\n"}))},vI.getDescription=function(e){var t=vI.splitSections(e);return t&&t[0]},vI.getMediaSections=function(e){var t=vI.splitSections(e);return t.shift(),t},vI.matchPrefix=function(e,t){return vI.splitLines(e).filter((function(e){return 0===e.indexOf(t)}))},vI.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},vI.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(" ")},vI.parseIceOptions=function(e){return e.substr(14).split(" ")},vI.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},vI.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"},vI.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]}},vI.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+"\r\n"},vI.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},vI.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},vI.parseRtcpFb=function(e){var t=e.substr(e.indexOf(" ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},vI.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},vI.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},vI.parseSsrcGroup=function(e){var t=e.substr(13).split(" ");return{semantics:t.shift(),ssrcs:t.map((function(e){return parseInt(e,10)}))}},vI.getMid=function(e){var t=vI.matchPrefix(e,"a=mid:")[0];if(t)return t.substr(6)},vI.parseFingerprint=function(e){var t=e.substr(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1].toUpperCase()}},vI.getDtlsParameters=function(e,t){return{role:"auto",fingerprints:vI.matchPrefix(e+t,"a=fingerprint:").map(vI.parseFingerprint)}},vI.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},vI.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)}},vI.writeCryptoLine=function(e){return"a=crypto:"+e.tag+" "+e.cryptoSuite+" "+("object"===a(e.keyParams)?vI.writeCryptoKeyParams(e.keyParams):e.keyParams)+(e.sessionParams?" "+e.sessionParams.join(" "):"")+"\r\n"},vI.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}},vI.writeCryptoKeyParams=function(e){return e.keyMethod+":"+e.keySalt+(e.lifeTime?"|"+e.lifeTime:"")+(e.mkiValue&&e.mkiLength?"|"+e.mkiValue+":"+e.mkiLength:"")},vI.getCryptoParameters=function(e,t){return vI.matchPrefix(e+t,"a=crypto:").map(vI.parseCryptoLine)},vI.getIceParameters=function(e,t){var r=vI.matchPrefix(e+t,"a=ice-ufrag:")[0],n=vI.matchPrefix(e+t,"a=ice-pwd:")[0];return r&&n?{usernameFragment:r.substr(12),password:n.substr(10)}:null},vI.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},vI.parseRtpParameters=function(e){for(var t={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},r=vI.splitLines(e)[0].split(" "),n=3;n<r.length;n++){var i=r[n],o=vI.matchPrefix(e,"a=rtpmap:"+i+" ")[0];if(o){var a=vI.parseRtpMap(o),s=vI.matchPrefix(e,"a=fmtp:"+i+" ");switch(a.parameters=s.length?vI.parseFmtp(s[0]):{},a.rtcpFeedback=vI.matchPrefix(e,"a=rtcp-fb:"+i+" ").map(vI.parseRtcpFb),t.codecs.push(a),a.name.toUpperCase()){case"RED":case"ULPFEC":t.fecMechanisms.push(a.name.toUpperCase())}}}return vI.matchPrefix(e,"a=extmap:").forEach((function(e){t.headerExtensions.push(vI.parseExtmap(e))})),t},vI.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+=vI.writeRtpMap(e),r+=vI.writeFmtp(e),r+=vI.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+=vI.writeExtmap(e)})),r},vI.parseRtpEncodingParameters=function(e){var t,r=[],n=vI.parseRtpParameters(e),i=-1!==n.fecMechanisms.indexOf("RED"),o=-1!==n.fecMechanisms.indexOf("ULPFEC"),a=vI.matchPrefix(e,"a=ssrc:").map((function(e){return vI.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute})),s=a.length>0&&a[0].ssrc,u=vI.matchPrefix(e,"a=ssrc-group:FID").map((function(e){return e.substr(17).split(" ").map((function(e){return parseInt(e,10)}))}));u.length>0&&u[0].length>1&&u[0][0]===s&&(t=u[0][1]),n.codecs.forEach((function(e){if("RTX"===e.name.toUpperCase()&&e.parameters.apt){var n={ssrc:s,codecPayloadType:parseInt(e.parameters.apt,10)};s&&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 c=vI.matchPrefix(e,"b=");return c.length&&(c=0===c[0].indexOf("b=TIAS:")?parseInt(c[0].substr(7),10):0===c[0].indexOf("b=AS:")?1e3*parseInt(c[0].substr(5),10)*.95-16e3:void 0,r.forEach((function(e){e.maxBitrate=c}))),r},vI.parseRtcpParameters=function(e){var t={},r=vI.matchPrefix(e,"a=ssrc:").map((function(e){return vI.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute}))[0];r&&(t.cname=r.value,t.ssrc=r.ssrc);var n=vI.matchPrefix(e,"a=rtcp-rsize");t.reducedSize=n.length>0,t.compound=0===n.length;var i=vI.matchPrefix(e,"a=rtcp-mux");return t.mux=i.length>0,t},vI.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},vI.parseMsid=function(e){var t,r=vI.matchPrefix(e,"a=msid:");if(1===r.length)return{stream:(t=r[0].substr(7).split(" "))[0],track:t[1]};var n=vI.matchPrefix(e,"a=ssrc:").map((function(e){return vI.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},vI.parseSctpDescription=function(e){var t,r=vI.parseMLine(e),n=vI.matchPrefix(e,"a=max-message-size:");n.length>0&&(t=parseInt(n[0].substr(19),10)),isNaN(t)&&(t=65536);var i=vI.matchPrefix(e,"a=sctp-port:");if(i.length>0)return{port:parseInt(i[0].substr(12),10),protocol:r.fmt,maxMessageSize:t};var o=vI.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}}},vI.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("")},vI.generateSessionId=function(){return Math.random().toString().substr(2,21)},vI.writeSessionBoilerplate=function(e,t,r){var n=void 0!==t?t:2;return"v=0\r\no="+(r||"thisisadapterortc")+" "+(e||vI.generateSessionId())+" "+n+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},vI.getDirection=function(e,t){for(var r=vI.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?vI.getDirection(t):"sendrecv"},vI.getKind=function(e){return vI.splitLines(e)[0].split(" ")[0].substr(2)},vI.isRejected=function(e){return"0"===e.split(" ",2)[1]},vI.parseMLine=function(e){var t=vI.splitLines(e)[0].substr(2).split(" ");return{kind:t[0],port:parseInt(t[1],10),protocol:t[2],fmt:t.slice(3).join(" ")}},vI.parseOLine=function(e){var t=vI.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]}},vI.isValidSDP=function(e){if("string"!=typeof e||0===e.length)return!1;for(var t=vI.splitLines(e),r=0;r<t.length;r++)if(t[r].length<2||"="!==t[r].charAt(1))return!1;return!0},pI.exports=vI;var mI=_I.exports,yI=e({__proto__:null,default:mI},[_I.exports]);function gI(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=mI.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,Cv(e,"icecandidate",(function(t){return t.candidate&&Object.defineProperty(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t}))}}function SI(e){!e.RTCIceCandidate||e.RTCIceCandidate&&"relayProtocol"in e.RTCIceCandidate.prototype||Cv(e,"icecandidate",(function(e){if(e.candidate){var t=mI.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=mI.splitSections(e.sdp);return t.shift(),t.some((function(e){var t=mI.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=mI.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 u,c=n(arguments[0]),d=i(c),l=o(arguments[0],c);u=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 u}}),this._sctp=h}return a.apply(this,arguments)}}}function EI(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},Cv(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 kI(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 TI(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 II(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 AI=Object.freeze(Object.defineProperty({__proto__:null,shimRTCIceCandidate:gI,shimRTCIceCandidateRelayProtocol:SI,shimMaxMessageSize:bI,shimSendThrowTypeError:EI,shimConnectionState:kI,removeExtmapAllowMixed:TI,shimAddIceCandidateNullOrEmpty:II,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=Nv,i=Pv(t),o={browserDetails:i,commonShim:AI,extractVersion:wv,disableLog:Ov,disableWarnings:xv,sdp:yI};switch(i.browser){case"chrome":if(!Fk||!Mk||!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=Fk,II(t,i),RI(t),Ak(t,i),wk(t),Mk(t,i),Ck(t),Pk(t,i),Ok(t),xk(t),Nk(t),Lk(t,i),gI(t),SI(t),kI(t),bI(t,i),EI(t),TI(t,i);break;case"firefox":if(!kT||!pT||!r.shimFirefox)return n("Firefox shim is not included in this adapter release."),o;n("adapter.js shimming firefox."),o.browserShim=kT,II(t,i),RI(t),hT(t,i),pT(t,i),fT(t),mT(t),vT(t),_T(t),yT(t),gT(t),ST(t),bT(t),ET(t),gI(t),kI(t),bI(t,i),EI(t);break;case"safari":if(!DT||!r.shimSafari)return n("Safari shim is not included in this adapter release."),o;n("adapter.js shimming safari."),o.browserShim=DT,II(t,i),RI(t),CT(t),xT(t),RT(t),TT(t),IT(t),OT(t),AT(t),NT(t),gI(t),SI(t),bI(t,i),EI(t),TI(t,i);break;default:n("Unsupported browser!")}}({window:"undefined"==typeof window?void 0:window});var wI=_l,CI=Math.floor,OI=function(e,t){var r=e.length,n=CI(r/2);return r<8?xI(e,t):NI(e,OI(wI(e,0,n),t),OI(wI(e,n),t),t)},xI=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},DI=OI,PI=We.match(/firefox\/(\d+)/i),MI=!!PI&&+PI[1],LI=/MSIE|Trident/.test(We),UI=We.match(/AppleWebKit\/(\d+)\./),VI=!!UI&&+UI[1],FI=ha,BI=Te,jI=Yt,GI=xe,HI=hi,zI=h_,qI=es,KI=ye,XI=DI,WI=qi,YI=MI,JI=LI,QI=tt,ZI=VI,$I=[],eR=BI($I.sort),tR=BI($I.push),rR=KI((function(){$I.sort(void 0)})),nR=KI((function(){$I.sort(null)})),iR=WI("sort"),oR=!KI((function(){if(QI)return QI<70;if(!(YI&&YI>3)){if(JI)return!0;if(ZI)return ZI<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++)$I.push({k:t+n,v:r})}for($I.sort((function(e,t){return t.v-e.v})),n=0;n<$I.length;n++)t=$I[n].k.charAt(0),i.charAt(i.length-1)!==t&&(i+=t);return"DGBEFHACIJK"!==i}}));FI({target:"Array",proto:!0,forced:rR||!nR||!iR||!oR},{sort:function(e){void 0!==e&&jI(e);var t=GI(this);if(oR)return void 0===e?eR(t):eR(t,e);var r,n,i=[],o=HI(t);for(n=0;n<o;n++)n in t&&tR(i,t[n]);for(XI(i,function(e){return function(t,r){return void 0===r?-1:void 0===t?1:void 0!==e?+e(t,r)||0:qI(t)>qI(r)?1:-1}}(e)),r=HI(i),n=0;n<r;)t[n]=i[n++];for(;n<o;)zI(t,n++);return t}});var aR,sR,uR,cR={exports:{}},dR="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView,lR=dR,hR=St,fR=se,pR=He,vR=kt,_R=Pe,mR=Fn,yR=qt,gR=qr,SR=wn,bR=gt.f,ER=Vt,kR=Zc,TR=Td,IR=_t,RR=Fe,AR=ln.enforce,wR=ln.get,CR=fR.Int8Array,OR=CR&&CR.prototype,xR=fR.Uint8ClampedArray,NR=xR&&xR.prototype,DR=CR&&kR(CR),PR=OR&&kR(OR),MR=Object.prototype,LR=fR.TypeError,UR=IR("toStringTag"),VR=RR("TYPED_ARRAY_TAG"),FR="TypedArrayConstructor",BR=lR&&!!TR&&"Opera"!==mR(fR.opera),jR=!1,GR={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},HR={BigInt64Array:8,BigUint64Array:8},zR=function(e){var t=kR(e);if(vR(t)){var r=wR(t);return r&&_R(r,FR)?r.TypedArrayConstructor:zR(t)}},qR=function(e){if(!vR(e))return!1;var t=mR(e);return _R(GR,t)||_R(HR,t)};for(aR in GR)(uR=(sR=fR[aR])&&sR.prototype)?AR(uR).TypedArrayConstructor=sR:BR=!1;for(aR in HR)(uR=(sR=fR[aR])&&sR.prototype)&&(AR(uR).TypedArrayConstructor=sR);if((!BR||!pR(DR)||DR===Function.prototype)&&(DR=function(){throw LR("Incorrect invocation")},BR))for(aR in GR)fR[aR]&&TR(fR[aR],DR);if((!BR||!PR||PR===MR)&&(PR=DR.prototype,BR))for(aR in GR)fR[aR]&&TR(fR[aR].prototype,PR);if(BR&&kR(NR)!==PR&&TR(NR,PR),hR&&!_R(PR,UR))for(aR in jR=!0,bR(PR,UR,{get:function(){return vR(this)?this[VR]:void 0}}),GR)fR[aR]&&gR(fR[aR],VR,aR);var KR={NATIVE_ARRAY_BUFFER_VIEWS:BR,TYPED_ARRAY_TAG:jR&&VR,aTypedArray:function(e){if(qR(e))return e;throw LR("Target is not a typed array")},aTypedArrayConstructor:function(e){if(pR(e)&&(!TR||ER(DR,e)))return e;throw LR(yR(e)+" is not a typed array constructor")},exportTypedArrayMethod:function(e,t,r,n){if(hR){if(r)for(var i in GR){var o=fR[i];if(o&&_R(o.prototype,e))try{delete o.prototype[e]}catch(r0){try{o.prototype[e]=t}catch(a){}}}PR[e]&&!r||SR(PR,e,r?t:BR&&OR[e]||t,n)}},exportTypedArrayStaticMethod:function(e,t,r){var n,i;if(hR){if(TR){if(r)for(n in GR)if((i=fR[n])&&_R(i,e))try{delete i[e]}catch(r0){}if(DR[e]&&!r)return;try{return SR(DR,e,r?t:BR&&DR[e]||t)}catch(r0){}}for(n in GR)!(i=fR[n])||i[e]&&!r||SR(i,e,t)}},getTypedArrayConstructor:zR,isView:function(e){if(!vR(e))return!1;var t=mR(e);return"DataView"===t||_R(GR,t)||_R(HR,t)},isTypedArray:qR,TypedArray:DR,TypedArrayPrototype:PR},XR=se,WR=ye,YR=Dh,JR=KR.NATIVE_ARRAY_BUFFER_VIEWS,QR=XR.ArrayBuffer,ZR=XR.Int8Array,$R=!JR||!WR((function(){ZR(1)}))||!WR((function(){new ZR(-1)}))||!YR((function(e){new ZR,new ZR(null),new ZR(1.5),new ZR(e)}),!0)||WR((function(){return 1!==new ZR(new QR(2),1,void 0).length})),eA=si,tA=di,rA=RangeError,nA=function(e){if(void 0===e)return 0;var t=eA(e),r=tA(t);if(t!==r)throw rA("Wrong length or index");return r},iA=Array,oA=Math.abs,aA=Math.pow,sA=Math.floor,uA=Math.log,cA=Math.LN2,dA=xe,lA=ko,hA=hi,fA=function(e){for(var t=dA(this),r=hA(t),n=arguments.length,i=lA(n>1?arguments[1]:void 0,r),o=n>2?arguments[2]:void 0,a=void 0===o?r:lA(o,r);a>i;)t[i++]=e;return t},pA=se,vA=Te,_A=St,mA=dR,yA=xr,gA=qr,SA=tf,bA=ye,EA=wh,kA=si,TA=di,IA=nA,RA={pack:function(e,t,r){var n,i,o,a=iA(r),s=8*r-t-1,u=(1<<s)-1,c=u>>1,d=23===t?aA(2,-24)-aA(2,-77):0,l=e<0||0===e&&1/e<0?1:0,h=0;for((e=oA(e))!=e||e===1/0?(i=e!=e?1:0,n=u):(n=sA(uA(e)/cA),e*(o=aA(2,-n))<1&&(n--,o*=2),(e+=n+c>=1?d/o:d*aA(2,1-c))*o>=2&&(n++,o/=2),n+c>=u?(i=0,n=u):n+c>=1?(i=(e*o-1)*aA(2,t),n+=c):(i=e*aA(2,c-1)*aA(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,u=n-1,c=e[u--],d=127&c;for(c>>=7;s>0;)d=256*d+e[u--],s-=8;for(r=d&(1<<-s)-1,d>>=-s,s+=t;s>0;)r=256*r+e[u--],s-=8;if(0===d)d=1-a;else{if(d===o)return r?NaN:c?-1/0:1/0;r+=aA(2,t),d-=a}return(c?-1:1)*r*aA(2,d-t)}},AA=Zc,wA=Td,CA=go.f,OA=gt.f,xA=fA,NA=_l,DA=dd,PA=yA.PROPER,MA=yA.CONFIGURABLE,LA=ln.get,UA=ln.set,VA="ArrayBuffer",FA="DataView",BA="Wrong index",jA=pA.ArrayBuffer,GA=jA,HA=GA&&GA.prototype,zA=pA.DataView,qA=zA&&zA.prototype,KA=Object.prototype,XA=pA.Array,WA=pA.RangeError,YA=vA(xA),JA=vA([].reverse),QA=RA.pack,ZA=RA.unpack,$A=function(e){return[255&e]},ew=function(e){return[255&e,e>>8&255]},tw=function(e){return[255&e,e>>8&255,e>>16&255,e>>24&255]},rw=function(e){return e[3]<<24|e[2]<<16|e[1]<<8|e[0]},nw=function(e){return QA(e,23,4)},iw=function(e){return QA(e,52,8)},ow=function(e,t){OA(e.prototype,t,{get:function(){return LA(this)[t]}})},aw=function(e,t,r,n){var i=IA(r),o=LA(e);if(i+t>o.byteLength)throw WA(BA);var a=LA(o.buffer).bytes,s=i+o.byteOffset,u=NA(a,s,s+t);return n?u:JA(u)},sw=function(e,t,r,n,i,o){var a=IA(r),s=LA(e);if(a+t>s.byteLength)throw WA(BA);for(var u=LA(s.buffer).bytes,c=a+s.byteOffset,d=n(+i),l=0;l<t;l++)u[c+l]=d[o?l:t-l-1]};if(mA){var uw=PA&&jA.name!==VA;if(bA((function(){jA(1)}))&&bA((function(){new jA(-1)}))&&!bA((function(){return new jA,new jA(1.5),new jA(NaN),1!=jA.length||uw&&!MA})))uw&&MA&&gA(jA,"name",VA);else{(GA=function(e){return EA(this,HA),new jA(IA(e))}).prototype=HA;for(var cw,dw=CA(jA),lw=0;dw.length>lw;)(cw=dw[lw++])in GA||gA(GA,cw,jA[cw]);HA.constructor=GA}wA&&AA(qA)!==KA&&wA(qA,KA);var hw=new zA(new GA(2)),fw=vA(qA.setInt8);hw.setInt8(0,2147483648),hw.setInt8(1,2147483649),!hw.getInt8(0)&&hw.getInt8(1)||SA(qA,{setInt8:function(e,t){fw(this,e,t<<24>>24)},setUint8:function(e,t){fw(this,e,t<<24>>24)}},{unsafe:!0})}else HA=(GA=function(e){EA(this,HA);var t=IA(e);UA(this,{bytes:YA(XA(t),0),byteLength:t}),_A||(this.byteLength=t)}).prototype,qA=(zA=function(e,t,r){EA(this,qA),EA(e,HA);var n=LA(e).byteLength,i=kA(t);if(i<0||i>n)throw WA("Wrong offset");if(i+(r=void 0===r?n-i:TA(r))>n)throw WA("Wrong length");UA(this,{buffer:e,byteLength:r,byteOffset:i}),_A||(this.buffer=e,this.byteLength=r,this.byteOffset=i)}).prototype,_A&&(ow(GA,"byteLength"),ow(zA,"buffer"),ow(zA,"byteLength"),ow(zA,"byteOffset")),SA(qA,{getInt8:function(e){return aw(this,1,e)[0]<<24>>24},getUint8:function(e){return aw(this,1,e)[0]},getInt16:function(e){var t=aw(this,2,e,arguments.length>1?arguments[1]:void 0);return(t[1]<<8|t[0])<<16>>16},getUint16:function(e){var t=aw(this,2,e,arguments.length>1?arguments[1]:void 0);return t[1]<<8|t[0]},getInt32:function(e){return rw(aw(this,4,e,arguments.length>1?arguments[1]:void 0))},getUint32:function(e){return rw(aw(this,4,e,arguments.length>1?arguments[1]:void 0))>>>0},getFloat32:function(e){return ZA(aw(this,4,e,arguments.length>1?arguments[1]:void 0),23)},getFloat64:function(e){return ZA(aw(this,8,e,arguments.length>1?arguments[1]:void 0),52)},setInt8:function(e,t){sw(this,1,e,$A,t)},setUint8:function(e,t){sw(this,1,e,$A,t)},setInt16:function(e,t){sw(this,2,e,ew,t,arguments.length>2?arguments[2]:void 0)},setUint16:function(e,t){sw(this,2,e,ew,t,arguments.length>2?arguments[2]:void 0)},setInt32:function(e,t){sw(this,4,e,tw,t,arguments.length>2?arguments[2]:void 0)},setUint32:function(e,t){sw(this,4,e,tw,t,arguments.length>2?arguments[2]:void 0)},setFloat32:function(e,t){sw(this,4,e,nw,t,arguments.length>2?arguments[2]:void 0)},setFloat64:function(e,t){sw(this,8,e,iw,t,arguments.length>2?arguments[2]:void 0)}});DA(GA,VA),DA(zA,FA);var pw={ArrayBuffer:GA,DataView:zA},vw=kt,_w=Math.floor,mw=Number.isInteger||function(e){return!vw(e)&&isFinite(e)&&_w(e)===e},yw=si,gw=RangeError,Sw=function(e){var t=yw(e);if(t<0)throw gw("The argument can't be less than 0");return t},bw=RangeError,Ew=function(e,t){var r=Sw(e);if(r%t)throw bw("Wrong offset");return r},kw=Fn,Tw=Te("".slice),Iw=function(e){return"Big"===Tw(kw(e),0,3)},Rw=dr,Aw=TypeError,ww=function(e){var t=Rw(e,"number");if("number"==typeof t)throw Aw("Can't convert number to bigint");return BigInt(t)},Cw=Zn,Ow=Ut,xw=D_,Nw=xe,Dw=hi,Pw=sh,Mw=eh,Lw=Wl,Uw=Iw,Vw=KR.aTypedArrayConstructor,Fw=ww,Bw=ha,jw=se,Gw=Ut,Hw=St,zw=$R,qw=KR,Kw=pw,Xw=wh,Ww=Gr,Yw=qr,Jw=mw,Qw=di,Zw=nA,$w=Ew,eC=fr,tC=Pe,rC=Fn,nC=kt,iC=Ht,oC=La,aC=Vt,sC=Td,uC=go.f,cC=function(e){var t,r,n,i,o,a,s,u,c=xw(this),d=Nw(e),l=arguments.length,h=l>1?arguments[1]:void 0,f=void 0!==h,p=Mw(d);if(p&&!Lw(p))for(u=(s=Pw(d,p)).next,d=[];!(a=Ow(u,s)).done;)d.push(a.value);for(f&&l>2&&(h=Cw(h,arguments[2])),r=Dw(d),n=new(Vw(c))(r),i=Uw(n),t=0;r>t;t++)o=f?h(d[t],t):d[t],n[t]=i?Fw(o):+o;return n},dC=Hi.forEach,lC=sf,hC=gt,fC=to,pC=Uh,vC=ln.get,_C=ln.set,mC=ln.enforce,yC=hC.f,gC=fC.f,SC=Math.round,bC=jw.RangeError,EC=Kw.ArrayBuffer,kC=EC.prototype,TC=Kw.DataView,IC=qw.NATIVE_ARRAY_BUFFER_VIEWS,RC=qw.TYPED_ARRAY_TAG,AC=qw.TypedArray,wC=qw.TypedArrayPrototype,CC=qw.aTypedArrayConstructor,OC=qw.isTypedArray,xC="BYTES_PER_ELEMENT",NC="Wrong length",DC=function(e,t){CC(e);for(var r=0,n=t.length,i=new e(n);n>r;)i[r]=t[r++];return i},PC=function(e,t){yC(e,t,{get:function(){return vC(this)[t]}})},MC=function(e){var t;return aC(kC,e)||"ArrayBuffer"==(t=rC(e))||"SharedArrayBuffer"==t},LC=function(e,t){return OC(e)&&!iC(t)&&t in e&&Jw(+t)&&t>=0},UC=function(e,t){return t=eC(t),LC(e,t)?Ww(2,e[t]):gC(e,t)},VC=function(e,t,r){return t=eC(t),!(LC(e,t)&&nC(r)&&tC(r,"value"))||tC(r,"get")||tC(r,"set")||r.configurable||tC(r,"writable")&&!r.writable||tC(r,"enumerable")&&!r.enumerable?yC(e,t,r):(e[t]=r.value,e)};Hw?(IC||(fC.f=UC,hC.f=VC,PC(wC,"buffer"),PC(wC,"byteOffset"),PC(wC,"byteLength"),PC(wC,"length")),Bw({target:"Object",stat:!0,forced:!IC},{getOwnPropertyDescriptor:UC,defineProperty:VC}),cR.exports=function(e,t,r){var n=e.match(/\d+$/)[0]/8,i=e+(r?"Clamped":"")+"Array",o="get"+e,a="set"+e,s=jw[i],u=s,c=u&&u.prototype,d={},l=function(e,t){yC(e,t,{get:function(){return function(e,t){var r=vC(e);return r.view[o](t*n+r.byteOffset,!0)}(this,t)},set:function(e){return function(e,t,i){var o=vC(e);r&&(i=(i=SC(i))<0?0:i>255?255:255&i),o.view[a](t*n+o.byteOffset,i,!0)}(this,t,e)},enumerable:!0})};IC?zw&&(u=t((function(e,t,r,i){return Xw(e,c),pC(nC(t)?MC(t)?void 0!==i?new s(t,$w(r,n),i):void 0!==r?new s(t,$w(r,n)):new s(t):OC(t)?DC(u,t):Gw(cC,u,t):new s(Zw(t)),e,u)})),sC&&sC(u,AC),dC(uC(s),(function(e){e in u||Yw(u,e,s[e])})),u.prototype=c):(u=t((function(e,t,r,i){Xw(e,c);var o,a,s,d=0,h=0;if(nC(t)){if(!MC(t))return OC(t)?DC(u,t):Gw(cC,u,t);o=t,h=$w(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=Qw(i)*n)+h>f)throw bC(NC);s=a/n}else s=Zw(t),o=new EC(a=s*n);for(_C(e,{buffer:o,byteOffset:h,byteLength:a,length:s,view:new TC(o)});d<s;)l(e,d++)})),sC&&sC(u,AC),c=u.prototype=oC(wC)),c.constructor!==u&&Yw(c,"constructor",u),mC(c).TypedArrayConstructor=u,RC&&Yw(c,RC,i);var h=u!=s;d[i]=u,Bw({global:!0,constructor:!0,forced:h,sham:!IC},d),xC in u||Yw(u,xC,n),xC in c||Yw(c,xC,n),lC(i)}):cR.exports=function(){},(0,cR.exports)("Uint8",(function(e){return function(t,r,n){return e(this,t,r,n)}}));var FC=hi,BC=si,jC=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("at",(function(e){var t=jC(this),r=FC(t),n=BC(e),i=n>=0?n:r+n;return i<0||i>=r?void 0:t[i]}));var GC=xe,HC=ko,zC=hi,qC=h_,KC=Math.min,XC=[].copyWithin||function(e,t){var r=GC(this),n=zC(r),i=HC(e,n),o=HC(t,n),a=arguments.length>2?arguments[2]:void 0,s=KC((void 0===a?n:HC(a,n))-o,n-i),u=1;for(o<i&&i<o+s&&(u=-1,o+=s-1,i+=s-1);s-- >0;)o in r?r[i]=r[o]:qC(r,i),i+=u,o+=u;return r},WC=KR,YC=Te(XC),JC=WC.aTypedArray;(0,WC.exportTypedArrayMethod)("copyWithin",(function(e,t){return YC(JC(this),e,t,arguments.length>2?arguments[2]:void 0)}));var QC=Hi.every,ZC=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("every",(function(e){return QC(ZC(this),e,arguments.length>1?arguments[1]:void 0)}));var $C=fA,eO=ww,tO=Fn,rO=Ut,nO=ye,iO=KR.aTypedArray,oO=KR.exportTypedArrayMethod,aO=Te("".slice),sO=nO((function(){var e=0;return new Int8Array(2).fill({valueOf:function(){return e++}}),1!==e}));oO("fill",(function(e){var t=arguments.length;iO(this);var r="Big"===aO(tO(this),0,3)?eO(e):+e;return rO($C,this,r,t>1?arguments[1]:void 0,t>2?arguments[2]:void 0)}),sO);var uO=hi,cO=function(e,t){for(var r=0,n=uO(t),i=new e(n);n>r;)i[r]=t[r++];return i},dO=V_,lO=KR.aTypedArrayConstructor,hO=KR.getTypedArrayConstructor,fO=function(e){return lO(dO(e,hO(e)))},pO=cO,vO=fO,_O=Hi.filter,mO=function(e,t){return pO(vO(e),t)},yO=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("filter",(function(e){var t=_O(yO(this),e,arguments.length>1?arguments[1]:void 0);return mO(this,t)}));var gO=Hi.find,SO=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("find",(function(e){return gO(SO(this),e,arguments.length>1?arguments[1]:void 0)}));var bO=Hi.findIndex,EO=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("findIndex",(function(e){return bO(EO(this),e,arguments.length>1?arguments[1]:void 0)}));var kO=Zn,TO=ni,IO=xe,RO=hi,AO=function(e){var t=1==e;return function(r,n,i){for(var o,a=IO(r),s=TO(a),u=kO(n,i),c=RO(s);c-- >0;)if(u(o=s[c],c,a))switch(e){case 0:return o;case 1:return c}return t?-1:void 0}},wO={findLast:AO(0),findLastIndex:AO(1)},CO=wO.findLast,OO=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("findLast",(function(e){return CO(OO(this),e,arguments.length>1?arguments[1]:void 0)}));var xO=wO.findLastIndex,NO=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("findLastIndex",(function(e){return xO(NO(this),e,arguments.length>1?arguments[1]:void 0)}));var DO=Hi.forEach,PO=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("forEach",(function(e){DO(PO(this),e,arguments.length>1?arguments[1]:void 0)}));var MO=wo.includes,LO=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("includes",(function(e){return MO(LO(this),e,arguments.length>1?arguments[1]:void 0)}));var UO=wo.indexOf,VO=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("indexOf",(function(e){return UO(VO(this),e,arguments.length>1?arguments[1]:void 0)}));var FO=se,BO=ye,jO=Te,GO=KR,HO=nl,zO=_t("iterator"),qO=FO.Uint8Array,KO=jO(HO.values),XO=jO(HO.keys),WO=jO(HO.entries),YO=GO.aTypedArray,JO=GO.exportTypedArrayMethod,QO=qO&&qO.prototype,ZO=!BO((function(){QO[zO].call([1])})),$O=!!QO&&QO.values&&QO[zO]===QO.values&&"values"===QO.values.name,ex=function(){return KO(YO(this))};JO("entries",(function(){return WO(YO(this))}),ZO),JO("keys",(function(){return XO(YO(this))}),ZO),JO("values",ex,ZO||!$O,{name:"values"}),JO(zO,ex,ZO||!$O,{name:"values"});var tx=KR.aTypedArray,rx=KR.exportTypedArrayMethod,nx=Te([].join);rx("join",(function(e){return nx(tx(this),e)}));var ix=bu,ox=uo,ax=si,sx=hi,ux=qi,cx=Math.min,dx=[].lastIndexOf,lx=!!dx&&1/[1].lastIndexOf(1,-0)<0,hx=ux("lastIndexOf"),fx=lx||!hx?function(e){if(lx)return ix(dx,this,arguments)||0;var t=ox(this),r=sx(t),n=r-1;for(arguments.length>1&&(n=cx(n,ax(arguments[1]))),n<0&&(n=r+n);n>=0;n--)if(n in t&&t[n]===e)return n||0;return-1}:dx,px=bu,vx=fx,_x=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("lastIndexOf",(function(e){var t=arguments.length;return px(vx,_x(this),t>1?[e,arguments[1]]:[e])}));var mx=Hi.map,yx=fO,gx=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("map",(function(e){return mx(gx(this),e,arguments.length>1?arguments[1]:void 0,(function(e,t){return new(yx(e))(t)}))}));var Sx=Pp.left,bx=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("reduce",(function(e){var t=arguments.length;return Sx(bx(this),e,t,t>1?arguments[1]:void 0)}));var Ex=Pp.right,kx=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("reduceRight",(function(e){var t=arguments.length;return Ex(kx(this),e,t,t>1?arguments[1]:void 0)}));var Tx=KR.aTypedArray,Ix=KR.exportTypedArrayMethod,Rx=Math.floor;Ix("reverse",(function(){for(var e,t=this,r=Tx(t).length,n=Rx(r/2),i=0;i<n;)e=t[i],t[i++]=t[--r],t[r]=e;return t}));var Ax=se,wx=Ut,Cx=KR,Ox=hi,xx=Ew,Nx=xe,Dx=ye,Px=Ax.RangeError,Mx=Ax.Int8Array,Lx=Mx&&Mx.prototype,Ux=Lx&&Lx.set,Vx=Cx.aTypedArray,Fx=Cx.exportTypedArrayMethod,Bx=!Dx((function(){var e=new Uint8ClampedArray(2);return wx(Ux,e,{length:1,0:3},1),3!==e[1]})),jx=Bx&&Cx.NATIVE_ARRAY_BUFFER_VIEWS&&Dx((function(){var e=new Mx(2);return e.set(1),e.set("2",1),0!==e[0]||2!==e[1]}));Fx("set",(function(e){Vx(this);var t=xx(arguments.length>1?arguments[1]:void 0,1),r=Nx(e);if(Bx)return wx(Ux,this,r,t);var n=this.length,i=Ox(r),o=0;if(i+t>n)throw Px("Wrong length");for(;o<i;)this[t+o]=r[o++]}),!Bx||jx);var Gx=fO,Hx=Eu,zx=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("slice",(function(e,t){for(var r=Hx(zx(this),e,t),n=Gx(this),i=0,o=r.length,a=new n(o);o>i;)a[i]=r[i++];return a}),ye((function(){new Int8Array(1).slice()})));var qx=Hi.some,Kx=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("some",(function(e){return qx(Kx(this),e,arguments.length>1?arguments[1]:void 0)}));var Xx=Wn,Wx=ye,Yx=Yt,Jx=DI,Qx=MI,Zx=LI,$x=tt,eN=VI,tN=KR.aTypedArray,rN=KR.exportTypedArrayMethod,nN=se.Uint16Array,iN=nN&&Xx(nN.prototype.sort),oN=!(!iN||Wx((function(){iN(new nN(2),null)}))&&Wx((function(){iN(new nN(2),{})}))),aN=!!iN&&!Wx((function(){if($x)return $x<74;if(Qx)return Qx<67;if(Zx)return!0;if(eN)return eN<602;var e,t,r=new nN(516),n=Array(516);for(e=0;e<516;e++)t=e%4,r[e]=515-e,n[e]=e-2*t+3;for(iN(r,(function(e,t){return(e/4|0)-(t/4|0)})),e=0;e<516;e++)if(r[e]!==n[e])return!0}));rN("sort",(function(e){return void 0!==e&&Yx(e),aN?iN(this,e):Jx(tN(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))}),!aN||oN);var sN=bu,uN=KR,cN=ye,dN=Eu,lN=se.Int8Array,hN=uN.aTypedArray,fN=uN.exportTypedArrayMethod,pN=[].toLocaleString,vN=!!lN&&cN((function(){pN.call(new lN(1))}));fN("toLocaleString",(function(){return sN(pN,vN?dN(hN(this)):hN(this),dN(arguments))}),cN((function(){return[1,2].toLocaleString()!=new lN([1,2]).toLocaleString()}))||!cN((function(){lN.prototype.toLocaleString.call([1,2])})));var _N=KR.exportTypedArrayMethod,mN=ye,yN=Te,gN=se.Uint8Array,SN=gN&&gN.prototype||{},bN=[].toString,EN=yN([].join);mN((function(){bN.call({})}))&&(bN=function(){return EN(this)});var kN=SN.toString!=bN;_N("toString",bN,kN);var TN=hi,IN=function(e,t){for(var r=TN(e),n=new t(r),i=0;i<r;i++)n[i]=e[r-i-1];return n},RN=KR.aTypedArray,AN=KR.getTypedArrayConstructor;(0,KR.exportTypedArrayMethod)("toReversed",(function(){return IN(RN(this),AN(this))}));var wN=Yt,CN=cO,ON=KR.aTypedArray,xN=KR.getTypedArrayConstructor,NN=KR.exportTypedArrayMethod,DN=Te(KR.TypedArrayPrototype.sort);NN("toSorted",(function(e){void 0!==e&&wN(e);var t=ON(this),r=CN(xN(t),t);return DN(r,e)}));var PN=hi,MN=si,LN=RangeError,UN=function(e,t,r,n){var i=PN(e),o=MN(r),a=o<0?i+o:o;if(a>=i||a<0)throw LN("Incorrect index");for(var s=new t(i),u=0;u<i;u++)s[u]=u===a?n:e[u];return s},VN=Iw,FN=si,BN=ww,jN=KR.aTypedArray,GN=KR.getTypedArrayConstructor,HN=KR.exportTypedArrayMethod,zN=!!function(){try{new Int8Array(1).with(2,{valueOf:function(){throw 8}})}catch(r0){return 8===r0}}();HN("with",{with:function(e,t){var r=jN(this),n=FN(e),i=VN(r)?BN(t):+t;return UN(r,GN(r),n,i)}}.with,!zN);var qN=ha,KN=Hi.findIndex,XN=Ga,WN="findIndex",YN=!0;WN in[]&&Array(1).findIndex((function(){YN=!1})),qN({target:"Array",proto:!0,forced:YN},{findIndex:function(e){return KN(this,e,arguments.length>1?arguments[1]:void 0)}}),XN(WN);var JN=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}(JN||{}),QN=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}(QN||{}),ZN=l((function e(t,r,n){c(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})),$N=St,eD=Te,tD=_a,rD=uo,nD=eD(ro.f),iD=eD([].push),oD=function(e){return function(t){for(var r,n=rD(t),i=tD(n),o=i.length,a=0,s=[];o>a;)r=i[a++],$N&&!nD(n,r)||iD(s,e?[r,n[r]]:n[r]);return s}},aD={entries:oD(!0),values:oD(!1)}.entries;ha({target:"Object",stat:!0},{entries:function(e){return aD(e)}});var sD=si,uD=es,cD=we,dD=RangeError,lD=Te,hD=di,fD=es,pD=function(e){var t=uD(cD(this)),r="",n=sD(e);if(n<0||n==1/0)throw dD("Wrong number of repetitions");for(;n>0;(n>>>=1)&&(t+=t))1&n&&(r+=t);return r},vD=we,_D=lD(pD),mD=lD("".slice),yD=Math.ceil,gD=function(e){return function(t,r,n){var i,o,a=fD(vD(t)),s=hD(r),u=a.length,c=void 0===n?" ":fD(n);return s<=u||""==c?a:((o=_D(c,yD((i=s-u)/c.length))).length>i&&(o=mD(o,0,i)),e?a+o:o+a)}},SD={start:gD(!1),end:gD(!0)},bD=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(We),ED=SD.end;ha({target:"String",proto:!0,forced:bD},{padEnd:function(e){return ED(this,e,arguments.length>1?arguments[1]:void 0)}});var kD=Fc;ha({target:"Number",stat:!0,forced:Number.parseInt!=kD},{parseInt:kD});var TD=Pt,ID=lh,RD=Zn,AD=Ut,wD=xe,CD=function(e,t,r,n){try{return n?t(TD(r)[0],r[1]):t(r)}catch(r0){ID(e,"throw",r0)}},OD=Wl,xD=wi,ND=hi,DD=dl,PD=sh,MD=eh,LD=Array,UD=function(e){var t=wD(e),r=xD(this),n=arguments.length,i=n>1?arguments[1]:void 0,o=void 0!==i;o&&(i=RD(i,n>2?arguments[2]:void 0));var a,s,u,c,d,l,h=MD(t),f=0;if(!h||this===LD&&OD(h))for(a=ND(t),s=r?new this(a):LD(a);a>f;f++)l=o?i(t[f],f):t[f],DD(s,f,l);else for(d=(c=PD(t,h)).next,s=r?new this:[];!(u=AD(d,c)).done;f++)l=o?CD(c,i,[u.value,f],!0):u.value,DD(s,f,l);return s.length=f,s},VD=UD;ha({target:"Array",stat:!0,forced:!Dh((function(e){Array.from(e)}))},{from:VD});var FD=Math.log,BD=Math.LOG10E;ha({target:"Math",stat:!0},{log10:Math.log10||function(e){return FD(e)*BD}});var jD,GD=ha,HD=Wn,zD=to.f,qD=di,KD=es,XD=Qa,WD=we,YD=rs,JD=HD("".startsWith),QD=HD("".slice),ZD=Math.min,$D=YD("startsWith"),eP=!$D&&!!function(){var e=zD(String.prototype,"startsWith");return e&&!e.writable}();GD({target:"String",proto:!0,forced:!eP&&!$D},{startsWith:function(e){var t=KD(WD(this));XD(e);var r=qD(ZD(arguments.length>1?arguments[1]:void 0,t.length)),n=KD(e);return JD?JD(t,n,r):QD(t,r,r+n.length)===n}});var tP=new Uint8Array(16);function rP(){if(!jD&&!(jD="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 jD(tP)}var nP=/^(?:[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 iP(e){return"string"==typeof e&&nP.test(e)}for(var oP=[],aP=0;aP<256;++aP)oP.push((aP+256).toString(16).substr(1));function sP(e,t,r){var n=(e=e||{}).random||(e.rng||rP)();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=(oP[e[t+0]]+oP[e[t+1]]+oP[e[t+2]]+oP[e[t+3]]+"-"+oP[e[t+4]]+oP[e[t+5]]+"-"+oP[e[t+6]]+oP[e[t+7]]+"-"+oP[e[t+8]]+oP[e[t+9]]+"-"+oP[e[t+10]]+oP[e[t+11]]+oP[e[t+12]]+oP[e[t+13]]+oP[e[t+14]]+oP[e[t+15]]).toLowerCase();if(!iP(r))throw TypeError("Stringified UUID is invalid");return r}(n)}var uP=new TextDecoder,cP=new TextEncoder,dP=function(){return sP()},lP=function(){return Date.now()};function hP(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 u=new e(t),c=0,d=0,l=n;d<l.length;d++){var h=l[d];u.set(h,c),c+=h.length}return u}var fP=function(){return"undefined"==typeof window},pP=function(){function e(){c(this,e)}var t,r;return l(e,null,[{key:"token2auth",value:function(t,r,n,i){return i?"Bearer ".concat(i):"Basic ".concat(e.createUnsafeToken(t,r,n))}},{key:"createUnsafeToken",value:function(e,t,r){return window.btoa([e,t,r].filter((function(e){return null!==e})).join(":"))}},{key:"merge",value:function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=0,i=Object.entries(t);n<i.length;n++){var o=E(i[n],2),s=o[0],u=o[1];null!==u&&"object"===a(u)?e.merge(t[s],r[s]):void 0!==r[s]&&(t[s]=r[s])}}},{key:"ab2str",value:function(e){return uP.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 cP.encode(e).buffer}},{key:"ab2b64str",value:(r=u(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=u(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 vP(e){return new Promise((function(t){window.setTimeout(t,e)}))}function _P(){var e="none";return fP()||(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 mP=function(){if("chrome-stable"===_P()){var e=window.navigator.userAgent.match(/Chrome\/([\d.]+)/);if(e&&e.length>1)if(Number(e[1].split(".")[0])<114)return!0}return!1}(),yP="mozilla"===_P(),gP="safari"===_P(),SP=!fP()&&navigator.userAgent.toLowerCase().includes("mobile");function bP(){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 EP=function(){return Math.floor(65535*Math.random())};function kP(e){return"string"==typeof e&&e.indexOf("__web__rtc__rtt__")>-1}function TP(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 u={};for(var c in t)u[c]=e(t[c]);return u}return t}))}var IP=function(){var e=u(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],(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=8,r.createOffer();case 8:return n=e.sent,r.close(),e.abrupt("return",n.sdp);case 11:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),RP=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 AP(e){return+Math.max(-127,10*Math.log10(Math.pow(e/255,2))).toFixed(2)}function wP(e){return(e&V.AUDIO)===V.AUDIO}function CP(e){return(e&V.VIDEO)===V.VIDEO}function OP(e){var t={};return Object.keys(e).forEach((function(r){"object"===a(e[r])?t[r]=OP(e[r]):r.startsWith("_")||(t[r]=e[r])})),t}function xP(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 NP(e,t){if("boolean"!=typeof e)throw new ZN(JN.INVALID_PARAMS,"Invalid ".concat(t,": The value should be boolean type."))}function DP(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 ZN(JN.INVALID_PARAMS,"Invalid ".concat(t,": the value range is [").concat(r,", ").concat(n,"]. integer only"));throw i}}function PP(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 ZN(JN.INVALID_PARAMS,"".concat(t," cannot be empty"));if(!BP(e,r,n))throw new ZN(JN.INVALID_PARAMS,"Invalid ".concat(t,": The value should be string type. Length of the string: [").concat(r,",").concat(n,"]"))}function MP(e,t,r){if(!r.includes(e))throw new ZN(JN.INVALID_PARAMS,"Invalid ".concat(t,": The value can only be set as ").concat(JSON.stringify(r)))}function LP(e){if(!(e instanceof MediaStreamTrack))throw new ZN(JN.INVALID_PARAMS,"Invalid track, The value should be MediaStreamTrack type.")}function UP(e,t){if(jP(e))throw new ZN(JN.INVALID_PARAMS,"Invalid ".concat(t,", should not be empty"))}function VP(e,t){if(!(e instanceof ArrayBuffer))throw new ZN(JN.INVALID_PARAMS,"Invalid ".concat(t,", should be ArrayBuffer"))}function FP(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 BP(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 GP(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new ZN(JN.INVALID_PARAMS,"The RoomId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function HP(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new ZN(JN.INVALID_PARAMS,"The userId 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 ZN(JN.INVALID_PARAMS,"The publicStreamId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function qP(e){UP(e,"userInfo"),HP(e.userId),jP(e.extraInfo)||PP(e.extraInfo,"userInfo.extraInfo",1,200)}function KP(e){UP(e,"roomConfig"),NP(e.isAutoPublish,"roomConfig.isAutoPublish"),NP(e.isAutoSubscribeAudio,"roomConfig.isAutoSubscribeAudio"),NP(e.isAutoSubscribeVideo,"roomConfig.isAutoSubscribeVideo")}function XP(e){UP(e,"videoPlayerOption")}function WP(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 ZN(JN.INVALID_PARAMS,"The message cannot be empty");if((null===(t=e instanceof ArrayBuffer?e:pP.str2ab(JSON.stringify(e)))||void 0===t?void 0:t.byteLength)>1e3*r)throw new ZN(JN.INVALID_PARAMS,"The message length must be less than ".concat(r,"K"))}function YP(e){return![ie.onRemoteStreamStats,ie.onLocalStreamStats,ie.onAudioVolumeIndication,ie.onLocalAudioPropertiesReport,ie.onRemoteAudioPropertiesReport].includes(e)}function JP(e){if("number"!=typeof(null==e?void 0:e.width)||"number"!=typeof(null==e?void 0:e.height))throw new ZN(JN.INVALID_PARAMS,"remoteVideoConfig must contain width, height, frameRate")}var QP={},ZP=_t;QP.f=ZP;var $P=se,eM=Pe,tM=QP,rM=gt.f,nM=function(e){var t=$P.Symbol||($P.Symbol={});eM(t,e)||rM(t,e,{value:tM.f(e)})},iM=Ut,oM=Xe,aM=_t,sM=wn,uM=ha,cM=se,dM=Ut,lM=Te,hM=St,fM=it,pM=ye,vM=Pe,_M=Vt,mM=Pt,yM=uo,gM=fr,SM=es,bM=Gr,EM=La,kM=_a,TM=go,IM=al,RM=Vo,AM=to,wM=gt,CM=fa,OM=ro,xM=wn,NM=ue.exports,DM=Jr,PM=Fe,MM=_t,LM=QP,UM=nM,VM=function(){var e=oM("Symbol"),t=e&&e.prototype,r=t&&t.valueOf,n=aM("toPrimitive");t&&!t[n]&&sM(t,n,(function(e){return iM(r,this)}),{arity:1})},FM=dd,BM=ln,jM=Hi.forEach,GM=Yr("hidden"),HM="Symbol",zM=BM.set,qM=BM.getterFor(HM),KM=Object.prototype,XM=cM.Symbol,WM=XM&&XM.prototype,YM=cM.TypeError,JM=cM.QObject,QM=AM.f,ZM=wM.f,$M=IM.f,eL=OM.f,tL=lM([].push),rL=NM("symbols"),nL=NM("op-symbols"),iL=NM("wks"),oL=!JM||!JM.prototype||!JM.prototype.findChild,aL=hM&&pM((function(){return 7!=EM(ZM({},"a",{get:function(){return ZM(this,"a",{value:7}).a}})).a}))?function(e,t,r){var n=QM(KM,t);n&&delete KM[t],ZM(e,t,r),n&&e!==KM&&ZM(KM,t,n)}:ZM,sL=function(e,t){var r=rL[e]=EM(WM);return zM(r,{type:HM,tag:e,description:t}),hM||(r.description=t),r},uL=function(e,t,r){e===KM&&uL(nL,t,r),mM(e);var n=gM(t);return mM(r),vM(rL,n)?(r.enumerable?(vM(e,GM)&&e[GM][n]&&(e[GM][n]=!1),r=EM(r,{enumerable:bM(0,!1)})):(vM(e,GM)||ZM(e,GM,bM(1,{})),e[GM][n]=!0),aL(e,n,r)):ZM(e,n,r)},cL=function(e,t){mM(e);var r=yM(t),n=kM(r).concat(fL(r));return jM(n,(function(t){hM&&!dM(dL,r,t)||uL(e,t,r[t])})),e},dL=function(e){var t=gM(e),r=dM(eL,this,t);return!(this===KM&&vM(rL,t)&&!vM(nL,t))&&(!(r||!vM(this,t)||!vM(rL,t)||vM(this,GM)&&this[GM][t])||r)},lL=function(e,t){var r=yM(e),n=gM(t);if(r!==KM||!vM(rL,n)||vM(nL,n)){var i=QM(r,n);return!i||!vM(rL,n)||vM(r,GM)&&r[GM][n]||(i.enumerable=!0),i}},hL=function(e){var t=$M(yM(e)),r=[];return jM(t,(function(e){vM(rL,e)||vM(DM,e)||tL(r,e)})),r},fL=function(e){var t=e===KM,r=$M(t?nL:yM(e)),n=[];return jM(r,(function(e){!vM(rL,e)||t&&!vM(KM,e)||tL(n,rL[e])})),n};fM||(XM=function(){if(_M(WM,this))throw YM("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?SM(arguments[0]):void 0,t=PM(e),r=function(e){this===KM&&dM(r,nL,e),vM(this,GM)&&vM(this[GM],t)&&(this[GM][t]=!1),aL(this,t,bM(1,e))};return hM&&oL&&aL(KM,t,{configurable:!0,set:r}),sL(t,e)},xM(WM=XM.prototype,"toString",(function(){return qM(this).tag})),xM(XM,"withoutSetter",(function(e){return sL(PM(e),e)})),OM.f=dL,wM.f=uL,CM.f=cL,AM.f=lL,TM.f=IM.f=hL,RM.f=fL,LM.f=function(e){return sL(MM(e),e)},hM&&(ZM(WM,"description",{configurable:!0,get:function(){return qM(this).description}}),xM(KM,"propertyIsEnumerable",dL,{unsafe:!0}))),uM({global:!0,constructor:!0,wrap:!0,forced:!fM,sham:!fM},{Symbol:XM}),jM(kM(iL),(function(e){UM(e)})),uM({target:HM,stat:!0,forced:!fM},{useSetter:function(){oL=!0},useSimple:function(){oL=!1}}),uM({target:"Object",stat:!0,forced:!fM,sham:!hM},{create:function(e,t){return void 0===t?EM(e):cL(EM(e),t)},defineProperty:uL,defineProperties:cL,getOwnPropertyDescriptor:lL}),uM({target:"Object",stat:!0,forced:!fM},{getOwnPropertyNames:hL}),VM(),FM(XM,HM),DM[GM]=!0;var pL=it&&!!Symbol.for&&!!Symbol.keyFor,vL=ha,_L=Xe,mL=Pe,yL=es,gL=ue.exports,SL=pL,bL=gL("string-to-symbol-registry"),EL=gL("symbol-to-string-registry");vL({target:"Symbol",stat:!0,forced:!SL},{for:function(e){var t=yL(e);if(mL(bL,t))return bL[t];var r=_L("Symbol")(t);return bL[t]=r,EL[r]=t,r}});var kL=ha,TL=Pe,IL=Ht,RL=qt,AL=pL,wL=(0,ue.exports)("symbol-to-string-registry");kL({target:"Symbol",stat:!0,forced:!AL},{keyFor:function(e){if(!IL(e))throw TypeError(RL(e)+" is not a symbol");if(TL(wL,e))return wL[e]}});var CL=Vo,OL=xe;ha({target:"Object",stat:!0,forced:!it||ye((function(){CL.f(1)}))},{getOwnPropertySymbols:function(e){var t=CL.f;return t?t(OL(e)):[]}});var xL={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),u=r?r+t:t;return e._events[u]?e._events[u].fn?e._events[u]=[e._events[u],s]:e._events[u].push(s):(e._events[u]=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 u,c,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(c=1,u=new Array(l-1);c<l;c++)u[c-1]=arguments[c];d.fn.apply(d.context,u)}else{var h,f=d.length;for(c=0;c<f;c++)switch(d[c].once&&this.removeListener(e,d[c].fn,void 0,!0),l){case 1:d[c].fn.call(d[c].context);break;case 2:d[c].fn.call(d[c].context,t);break;case 3:d[c].fn.call(d[c].context,t,n);break;case 4:d[c].fn.call(d[c].context,t,n,i);break;default:if(!u)for(h=1,u=new Array(l-1);h<l;h++)u[h-1]=arguments[h];d[c].fn.apply(d[c].context,u)}}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 u=0,c=[],d=s.length;u<d;u++)(s[u].fn!==t||i&&!s[u].once||n&&s[u].context!==n)&&c.push(s[u]);c.length?this._events[o]=1===c.length?c[0]:c: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}(xL);var NL=xL.exports,DL="[VERTC]",PL=["#0050b3","#0050b3","#0050b3","#0050b3","#0050b3"],ML=!fP()&&window.location.search.includes("_rtc_debug_"),LL=function(){function e(t,r,n){c(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){var t;if(ML){for(var r="",n=0;n<this._indent;n++)r+=" ";for(var i=arguments.length,o=new Array(i>1?i-1:0),a=1;a<i;a++)o[a-1]=arguments[a];(t=console).log.apply(t,["%c".concat(DL).concat(r,"[").concat(this._module,".").concat(e,"] ").concat(o.shift()),"color:".concat(PL[this._indent],";")].concat(o))}}}]),e}(),UL=new LL("VERTC",0),VL=function(e){f(n,e);var t,r=g(n);function n(){return c(this,n),r.apply(this,arguments)}return l(n,[{key:"safeEmit",value:function(e){var t=this.listenerCount(e);try{for(var r,i=arguments.length,o=new Array(i>1?i-1:0),a=1;a<i;a++)o[a-1]=arguments[a];return(r=b(p(n.prototype),"emit",this)).call.apply(r,[this,e].concat(o))}catch(r0){return UL.print("safaEmit","safeEmit() | event listener threw an error [event:%s]:%o",e,r0),Boolean(t)}}},{key:"safeEmitAsPromise",value:(t=u(o().mark((function e(t){var r,n,i,a=this,s=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(r=s.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=s[i];return e.abrupt("return",new Promise((function(e,r){try{a.emit.apply(a,[t].concat(n,[e,r]))}catch(r0){UL.print("safeEmitAsPromise","safeEmitAsPromise() | event listener threw an error [event:%s]:%o",t,r0),r(r0)}})));case 2:case"end":return e.stop()}}),e)}))),function(e){return t.apply(this,arguments)})}]),n}(xL.exports.EventEmitter),FL=Pe,BL=function(e){return void 0!==e&&(FL(e,"value")||FL(e,"writable"))},jL=Ut,GL=kt,HL=Pt,zL=BL,qL=to,KL=Zc;ha({target:"Reflect",stat:!0},{get:function e(t,r){var n,i,o=arguments.length<3?t:arguments[2];return HL(t)===o?t[r]:(n=qL.f(t,r))?zL(n)?n.value:void 0===n.get?void 0:jL(n.get,o):GL(i=KL(t))?e(i,r,o):void 0}});var XL=se,WL=dd;ha({global:!0},{Reflect:{}}),WL(XL.Reflect,"Reflect",!0);var YL=Ut,JL=Pt,QL=kt,ZL=BL,$L=gt,eU=to,tU=Zc,rU=Gr;ha({target:"Reflect",stat:!0,forced:ye((function(){var e=function(){},t=$L.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],u=eU.f(JL(t),r);if(!u){if(QL(o=tU(t)))return e(o,r,n,s);u=rU(0)}if(ZL(u)){if(!1===u.writable||!QL(s))return!1;if(i=eU.f(s,r)){if(i.get||i.set||!1===i.writable)return!1;i.value=n,$L.f(s,r,i)}else $L.f(s,r,rU(0,n))}else{if(void 0===(a=u.set))return!1;YL(a,s,n)}return!0}});var nU=ha,iU=xe,oU=hi,aU=_v,sU=h_,uU=yv,cU=1!==[].unshift(0),dU=!function(){try{Object.defineProperty([],"length",{writable:!1}).unshift()}catch(r0){return r0 instanceof TypeError}}();nU({target:"Array",proto:!0,arity:1,forced:cU||dU},{unshift:function(e){var t=iU(this),r=oU(t),n=arguments.length;if(n){uU(r+n);for(var i=r;i--;){var o=i+n;i in t?t[o]=t[i]:sU(t,o)}for(var a=0;a<n;a++)t[a]=arguments[a]}return aU(t,r+n)}}),(0,cR.exports)("Uint16",(function(e){return function(t,r,n){return e(this,t,r,n)}})),(0,cR.exports)("Int32",(function(e){return function(t,r,n){return e(this,t,r,n)}}));var lU={};!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)}(lU);var hU={},fU={},pU={},vU=lU;function _U(e){for(var t=e.length;--t>=0;)e[t]=0}var mU=256,yU=286,gU=30,SU=15,bU=[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],EU=[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],kU=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],TU=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],IU=new Array(576);_U(IU);var RU=new Array(60);_U(RU);var AU=new Array(512);_U(AU);var wU=new Array(256);_U(wU);var CU=new Array(29);_U(CU);var OU,xU,NU,DU=new Array(gU);function PU(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 MU(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function LU(e){return e<256?AU[e]:AU[256+(e>>>7)]}function UU(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function VU(e,t,r){e.bi_valid>16-r?(e.bi_buf|=t<<e.bi_valid&65535,UU(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 FU(e,t,r){VU(e,r[2*t],r[2*t+1])}function BU(e,t){var r=0;do{r|=1&e,e>>>=1,r<<=1}while(--t>0);return r>>>1}function jU(e,t,r){var n,i,o=new Array(16),a=0;for(n=1;n<=SU;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]=BU(o[s]++,s))}}function GU(e){var t;for(t=0;t<yU;t++)e.dyn_ltree[2*t]=0;for(t=0;t<gU;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 HU(e){e.bi_valid>8?UU(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 zU(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 qU(e,t,r){for(var n=e.heap[r],i=r<<1;i<=e.heap_len&&(i<e.heap_len&&zU(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!zU(t,n,e.heap[i],e.depth));)e.heap[r]=e.heap[i],r=i,i<<=1;e.heap[r]=n}function KU(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?FU(e,i,t):(FU(e,(o=wU[i])+mU+1,t),0!==(a=bU[o])&&VU(e,i-=CU[o],a),FU(e,o=LU(--n),r),0!==(a=EU[o])&&VU(e,n-=DU[o],a))}while(s<e.last_lit);FU(e,256,t)}function XU(e,t){var r,n,i,o=t.dyn_tree,a=t.stat_desc.static_tree,s=t.stat_desc.has_stree,u=t.stat_desc.elems,c=-1;for(e.heap_len=0,e.heap_max=573,r=0;r<u;r++)0!==o[2*r]?(e.heap[++e.heap_len]=c=r,e.depth[r]=0):o[2*r+1]=0;for(;e.heap_len<2;)o[2*(i=e.heap[++e.heap_len]=c<2?++c:0)]=1,e.depth[i]=0,e.opt_len--,s&&(e.static_len-=a[2*i+1]);for(t.max_code=c,r=e.heap_len>>1;r>=1;r--)qU(e,o,r);i=u;do{r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],qU(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++,qU(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,u=t.dyn_tree,c=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<=SU;o++)e.bl_count[o]=0;for(u[2*e.heap[e.heap_max]+1]=0,r=e.heap_max+1;r<573;r++)(o=u[2*u[2*(n=e.heap[r])+1]+1]+1)>p&&(o=p,v++),u[2*n+1]=o,n>c||(e.bl_count[o]++,a=0,n>=f&&(a=h[n-f]),s=u[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])>c||(u[2*i+1]!==o&&(e.opt_len+=(o-u[2*i+1])*u[2*i],u[2*i+1]=o),n--)}}(e,t),jU(o,c,e.bl_count)}function WU(e,t,r){var n,i,o=-1,a=t[1],s=0,u=7,c=4;for(0===a&&(u=138,c=3),t[2*(r+1)+1]=65535,n=0;n<=r;n++)i=a,a=t[2*(n+1)+1],++s<u&&i===a||(s<c?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?(u=138,c=3):i===a?(u=6,c=3):(u=7,c=4))}function YU(e,t,r){var n,i,o=-1,a=t[1],s=0,u=7,c=4;for(0===a&&(u=138,c=3),n=0;n<=r;n++)if(i=a,a=t[2*(n+1)+1],!(++s<u&&i===a)){if(s<c)do{FU(e,i,e.bl_tree)}while(0!=--s);else 0!==i?(i!==o&&(FU(e,i,e.bl_tree),s--),FU(e,16,e.bl_tree),VU(e,s-3,2)):s<=10?(FU(e,17,e.bl_tree),VU(e,s-3,3)):(FU(e,18,e.bl_tree),VU(e,s-11,7));s=0,o=i,0===a?(u=138,c=3):i===a?(u=6,c=3):(u=7,c=4)}}_U(DU);var JU=!1;function QU(e,t,r,n){VU(e,0+(n?1:0),3),function(e,t,r,n){HU(e),n&&(UU(e,r),UU(e,~r)),vU.arraySet(e.pending_buf,e.window,t,r,e.pending),e.pending+=r}(e,t,r,!0)}pU._tr_init=function(e){JU||(!function(){var e,t,r,n,i,o=new Array(16);for(r=0,n=0;n<28;n++)for(CU[n]=r,e=0;e<1<<bU[n];e++)wU[r++]=n;for(wU[r-1]=n,i=0,n=0;n<16;n++)for(DU[n]=i,e=0;e<1<<EU[n];e++)AU[i++]=n;for(i>>=7;n<gU;n++)for(DU[n]=i<<7,e=0;e<1<<EU[n]-7;e++)AU[256+i++]=n;for(t=0;t<=SU;t++)o[t]=0;for(e=0;e<=143;)IU[2*e+1]=8,e++,o[8]++;for(;e<=255;)IU[2*e+1]=9,e++,o[9]++;for(;e<=279;)IU[2*e+1]=7,e++,o[7]++;for(;e<=287;)IU[2*e+1]=8,e++,o[8]++;for(jU(IU,287,o),e=0;e<gU;e++)RU[2*e+1]=5,RU[2*e]=BU(e,5);OU=new PU(IU,bU,257,yU,SU),xU=new PU(RU,EU,0,gU,SU),NU=new PU(new Array(0),kU,0,19,7)}(),JU=!0),e.l_desc=new MU(e.dyn_ltree,OU),e.d_desc=new MU(e.dyn_dtree,xU),e.bl_desc=new MU(e.bl_tree,NU),e.bi_buf=0,e.bi_valid=0,GU(e)},pU._tr_stored_block=QU,pU._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<mU;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0}(e)),XU(e,e.l_desc),XU(e,e.d_desc),a=function(e){var t;for(WU(e,e.dyn_ltree,e.l_desc.max_code),WU(e,e.dyn_dtree,e.d_desc.max_code),XU(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*TU[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?QU(e,t,r,n):4===e.strategy||o===i?(VU(e,2+(n?1:0),3),KU(e,IU,RU)):(VU(e,4+(n?1:0),3),function(e,t,r,n){var i;for(VU(e,t-257,5),VU(e,r-1,5),VU(e,n-4,4),i=0;i<n;i++)VU(e,e.bl_tree[2*TU[i]+1],3);YU(e,e.dyn_ltree,t-1),YU(e,e.dyn_dtree,r-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),KU(e,e.dyn_ltree,e.dyn_dtree)),GU(e),n&&HU(e)},pU._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*(wU[r]+mU+1)]++,e.dyn_dtree[2*LU(t)]++),e.last_lit===e.lit_bufsize-1},pU._tr_align=function(e){VU(e,2,3),FU(e,256,IU),function(e){16===e.bi_valid?(UU(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 ZU=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 $U=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 eV,tV=function(e,t,r,n){var i=$U,o=n+r;e^=-1;for(var a=n;a<o;a++)e=e>>>8^i[255&(e^t[a])];return-1^e},rV={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"},nV=lU,iV=pU,oV=ZU,aV=tV,sV=rV,uV=-2,cV=258,dV=262,lV=103,hV=113,fV=666;function pV(e,t){return e.msg=sV[t],t}function vV(e){return(e<<1)-(e>4?9:0)}function _V(e){for(var t=e.length;--t>=0;)e[t]=0}function mV(e){var t=e.state,r=t.pending;r>e.avail_out&&(r=e.avail_out),0!==r&&(nV.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 yV(e,t){iV._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,mV(e.strm)}function gV(e,t){e.pending_buf[e.pending++]=t}function SV(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function bV(e,t){var r,n,i=e.max_chain_length,o=e.strstart,a=e.prev_length,s=e.nice_match,u=e.strstart>e.w_size-dV?e.strstart-(e.w_size-dV):0,c=e.window,d=e.w_mask,l=e.prev,h=e.strstart+cV,f=c[o+a-1],p=c[o+a];e.prev_length>=e.good_match&&(i>>=2),s>e.lookahead&&(s=e.lookahead);do{if(c[(r=t)+a]===p&&c[r+a-1]===f&&c[r]===c[o]&&c[++r]===c[o+1]){o+=2,r++;do{}while(c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&o<h);if(n=cV-(h-o),o=h-cV,n>a){if(e.match_start=t,a=n,n>=s)break;f=c[o+a-1],p=c[o+a]}}}while((t=l[t&d])>u&&0!=--i);return a<=e.lookahead?a:e.lookahead}function EV(e){var t,r,n,i,o,a,s,u,c,d,l=e.w_size;do{if(i=e.window_size-e.lookahead-e.strstart,e.strstart>=l+(l-dV)){nV.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,u=e.strstart+e.lookahead,c=i,d=void 0,(d=a.avail_in)>c&&(d=c),r=0===d?0:(a.avail_in-=d,nV.arraySet(s,a.input,a.next_in,d,u),1===a.state.wrap?a.adler=oV(a.adler,s,d,u):2===a.state.wrap&&(a.adler=aV(a.adler,s,d,u)),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<dV&&0!==e.strm.avail_in)}function kV(e,t){for(var r,n;;){if(e.lookahead<dV){if(EV(e),e.lookahead<dV&&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-dV&&(e.match_length=bV(e,r)),e.match_length>=3)if(n=iV._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=iV._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(n&&(yV(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,4===t?(yV(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(yV(e,!1),0===e.strm.avail_out)?1:2}function TV(e,t){for(var r,n,i;;){if(e.lookahead<dV){if(EV(e),e.lookahead<dV&&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-dV&&(e.match_length=bV(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=iV._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&&(yV(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if((n=iV._tr_tally(e,0,e.window[e.strstart-1]))&&yV(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=iV._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,4===t?(yV(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(yV(e,!1),0===e.strm.avail_out)?1:2}function IV(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 RV(){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 nV.Buf16(1146),this.dyn_dtree=new nV.Buf16(122),this.bl_tree=new nV.Buf16(78),_V(this.dyn_ltree),_V(this.dyn_dtree),_V(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new nV.Buf16(16),this.heap=new nV.Buf16(573),_V(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new nV.Buf16(573),_V(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 AV(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:hV,e.adler=2===t.wrap?0:1,t.last_flush=0,iV._tr_init(t),0):pV(e,uV)}function wV(e){var t,r=AV(e);return 0===r&&((t=e.state).window_size=2*t.w_size,_V(t.head),t.max_lazy_match=eV[t.level].max_lazy,t.good_match=eV[t.level].good_length,t.nice_match=eV[t.level].nice_length,t.max_chain_length=eV[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 CV(e,t,r,n,i,o){if(!e)return uV;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 pV(e,uV);8===n&&(n=9);var s=new RV;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 nV.Buf8(2*s.w_size),s.head=new nV.Buf16(s.hash_size),s.prev=new nV.Buf16(s.w_size),s.lit_bufsize=1<<i+6,s.pending_buf_size=4*s.lit_bufsize,s.pending_buf=new nV.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,wV(e)}eV=[new IV(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(EV(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,yV(e,!1),0===e.strm.avail_out))return 1;if(e.strstart-e.block_start>=e.w_size-dV&&(yV(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(yV(e,!0),0===e.strm.avail_out?3:4):(e.strstart>e.block_start&&(yV(e,!1),e.strm.avail_out),1)})),new IV(4,4,8,4,kV),new IV(4,5,16,8,kV),new IV(4,6,32,32,kV),new IV(4,4,16,16,TV),new IV(8,16,32,32,TV),new IV(8,16,128,128,TV),new IV(8,32,128,256,TV),new IV(32,128,258,1024,TV),new IV(32,258,258,4096,TV)],fU.deflateInit=function(e,t){return CV(e,t,8,15,8,0)},fU.deflateInit2=CV,fU.deflateReset=wV,fU.deflateResetKeep=AV,fU.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?uV:(e.state.gzhead=t,0):uV},fU.deflate=function(e,t){var r,n,i,o;if(!e||!e.state||t>5||t<0)return e?pV(e,uV):uV;if(n=e.state,!e.output||!e.input&&0!==e.avail_in||n.status===fV&&4!==t)return pV(e,0===e.avail_out?-5:uV);if(n.strm=e,r=n.last_flush,n.last_flush=t,42===n.status)if(2===n.wrap)e.adler=0,gV(n,31),gV(n,139),gV(n,8),n.gzhead?(gV(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)),gV(n,255&n.gzhead.time),gV(n,n.gzhead.time>>8&255),gV(n,n.gzhead.time>>16&255),gV(n,n.gzhead.time>>24&255),gV(n,9===n.level?2:n.strategy>=2||n.level<2?4:0),gV(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(gV(n,255&n.gzhead.extra.length),gV(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=aV(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(gV(n,0),gV(n,0),gV(n,0),gV(n,0),gV(n,0),gV(n,9===n.level?2:n.strategy>=2||n.level<2?4:0),gV(n,3),n.status=hV);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=hV,SV(n,a),0!==n.strstart&&(SV(n,e.adler>>>16),SV(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=aV(e.adler,n.pending_buf,n.pending-i,i)),mV(e),i=n.pending,n.pending!==n.pending_buf_size));)gV(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(e.adler=aV(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=aV(e.adler,n.pending_buf,n.pending-i,i)),mV(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,gV(n,o)}while(0!==o);n.gzhead.hcrc&&n.pending>i&&(e.adler=aV(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=aV(e.adler,n.pending_buf,n.pending-i,i)),mV(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,gV(n,o)}while(0!==o);n.gzhead.hcrc&&n.pending>i&&(e.adler=aV(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.status=lV)}else n.status=lV;if(n.status===lV&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&mV(e),n.pending+2<=n.pending_buf_size&&(gV(n,255&e.adler),gV(n,e.adler>>8&255),e.adler=0,n.status=hV)):n.status=hV),0!==n.pending){if(mV(e),0===e.avail_out)return n.last_flush=-1,0}else if(0===e.avail_in&&vV(t)<=vV(r)&&4!==t)return pV(e,-5);if(n.status===fV&&0!==e.avail_in)return pV(e,-5);if(0!==e.avail_in||0!==n.lookahead||0!==t&&n.status!==fV){var s=2===n.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(EV(e),0===e.lookahead)){if(0===t)return 1;break}if(e.match_length=0,r=iV._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(yV(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(yV(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(yV(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<=cV){if(EV(e),e.lookahead<=cV&&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+cV;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=cV-(o-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(r=iV._tr_tally(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=iV._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(yV(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(yV(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(yV(e,!1),0===e.strm.avail_out)?1:2}(n,t):eV[n.level].func(n,t);if(3!==s&&4!==s||(n.status=fV),1===s||3===s)return 0===e.avail_out&&(n.last_flush=-1),0;if(2===s&&(1===t?iV._tr_align(n):5!==t&&(iV._tr_stored_block(n,0,0,!1),3===t&&(_V(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),mV(e),0===e.avail_out))return n.last_flush=-1,0}return 4!==t?0:n.wrap<=0?1:(2===n.wrap?(gV(n,255&e.adler),gV(n,e.adler>>8&255),gV(n,e.adler>>16&255),gV(n,e.adler>>24&255),gV(n,255&e.total_in),gV(n,e.total_in>>8&255),gV(n,e.total_in>>16&255),gV(n,e.total_in>>24&255)):(SV(n,e.adler>>>16),SV(n,65535&e.adler)),mV(e),n.wrap>0&&(n.wrap=-n.wrap),0!==n.pending?0:1)},fU.deflateEnd=function(e){var t;return e&&e.state?42!==(t=e.state.status)&&69!==t&&73!==t&&91!==t&&t!==lV&&t!==hV&&t!==fV?pV(e,uV):(e.state=null,t===hV?pV(e,-3):0):uV},fU.deflateSetDictionary=function(e,t){var r,n,i,o,a,s,u,c,d=t.length;if(!e||!e.state)return uV;if(2===(o=(r=e.state).wrap)||1===o&&42!==r.status||r.lookahead)return uV;for(1===o&&(e.adler=oV(e.adler,t,d,0)),r.wrap=0,d>=r.w_size&&(0===o&&(_V(r.head),r.strstart=0,r.block_start=0,r.insert=0),c=new nV.Buf8(r.w_size),nV.arraySet(c,t,d-r.w_size,r.w_size,0),t=c,d=r.w_size),a=e.avail_in,s=e.next_in,u=e.input,e.avail_in=d,e.next_in=0,e.input=t,EV(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,EV(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=u,e.avail_in=a,r.wrap=o,0},fU.deflateInfo="pako deflate (from Nodeca project)";var OV={},xV=lU,NV=!0,DV=!0;try{String.fromCharCode.apply(null,[0])}catch(n0){NV=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(n0){DV=!1}for(var PV=new xV.Buf8(256),MV=0;MV<256;MV++)PV[MV]=MV>=252?6:MV>=248?5:MV>=240?4:MV>=224?3:MV>=192?2:1;function LV(e,t){if(t<65534&&(e.subarray&&DV||!e.subarray&&NV))return String.fromCharCode.apply(null,xV.shrinkBuf(e,t));for(var r="",n=0;n<t;n++)r+=String.fromCharCode(e[n]);return r}PV[254]=PV[254]=1,OV.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 xV.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},OV.buf2binstring=function(e){return LV(e,e.length)},OV.binstring2buf=function(e){for(var t=new xV.Buf8(e.length),r=0,n=t.length;r<n;r++)t[r]=e.charCodeAt(r);return t},OV.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=PV[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 LV(s,n)},OV.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+PV[e[r]]>t?r:t};var UV=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},VV=fU,FV=lU,BV=OV,jV=rV,GV=UV,HV=Object.prototype.toString;function zV(e){if(!(this instanceof zV))return new zV(e);this.options=FV.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 GV,this.strm.avail_out=0;var r=VV.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(0!==r)throw new Error(jV[r]);if(t.header&&VV.deflateSetHeader(this.strm,t.header),t.dictionary){var n;if(n="string"==typeof t.dictionary?BV.string2buf(t.dictionary):"[object ArrayBuffer]"===HV.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,0!==(r=VV.deflateSetDictionary(this.strm,n)))throw new Error(jV[r]);this._dict_set=!0}}function qV(e,t){var r=new zV(t);if(r.push(e,!0),r.err)throw r.msg||jV[r.err];return r.result}zV.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=BV.string2buf(e):"[object ArrayBuffer]"===HV.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 FV.Buf8(o),i.next_out=0,i.avail_out=o),1!==(r=VV.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(BV.buf2binstring(FV.shrinkBuf(i.output,i.next_out))):this.onData(FV.shrinkBuf(i.output,i.next_out)))}while((i.avail_in>0||0===i.avail_out)&&1!==r);return 4===n?(r=VV.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,0===r):2!==n||(this.onEnd(0),i.avail_out=0,!0)},zV.prototype.onData=function(e){this.chunks.push(e)},zV.prototype.onEnd=function(e){0===e&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=FV.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},hU.Deflate=zV,hU.deflate=qV,hU.deflateRaw=function(e,t){return(t=t||{}).raw=!0,qV(e,t)},hU.gzip=function(e,t){return(t=t||{}).gzip=!0,qV(e,t)};var KV={},XV=St,WV=Fg,YV=hs,JV=ye,QV=se.RegExp,ZV=QV.prototype;XV&&JV((function(){var e=!0;try{QV(".","d")}catch(r0){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(ZV,"flags").get.call(t)!==n||r!==n}))&&WV(ZV,"flags",{configurable:!0,get:YV});var $V={},eF=lU,tF=15,rF=[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],nF=[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],iF=[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],oF=[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],aF=lU,sF=ZU,uF=tV,cF=function(e,t){var r,n,i,o,a,s,u,c,d,l,h,f,p,v,_,m,y,g,S,b,E,k,T,I,R;r=e.state,n=e.next_in,I=e.input,i=n+(e.avail_in-5),o=e.next_out,R=e.output,a=o-(t-e.avail_out),s=o+(e.avail_out-257),u=r.dmax,c=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))R[o++]=65535&g;else{if(!(16&S)){if(0==(64&S)){g=v[(65535&g)+(f&(1<<S)-1)];continue t}if(32&S){r.mode=12;break e}e.msg="invalid literal/length code",r.mode=30;break e}b=65535&g,(S&=15)&&(p<S&&(f+=I[n++]<<p,p+=8),b+=f&(1<<S)-1,f>>>=S,p-=S),p<15&&(f+=I[n++]<<p,p+=8,f+=I[n++]<<p,p+=8),g=_[f&y];r:for(;;){if(f>>>=S=g>>>24,p-=S,!(16&(S=g>>>16&255))){if(0==(64&S)){g=_[(65535&g)+(f&(1<<S)-1)];continue r}e.msg="invalid distance code",r.mode=30;break e}if(E=65535&g,p<(S&=15)&&(f+=I[n++]<<p,(p+=8)<S&&(f+=I[n++]<<p,p+=8)),(E+=f&(1<<S)-1)>u){e.msg="invalid distance too far back",r.mode=30;break e}if(f>>>=S,p-=S,E>(S=o-a)){if((S=E-S)>d&&r.sane){e.msg="invalid distance too far back",r.mode=30;break e}if(k=0,T=h,0===l){if(k+=c-S,S<b){b-=S;do{R[o++]=h[k++]}while(--S);k=o-E,T=R}}else if(l<S){if(k+=c+l-S,(S-=l)<b){b-=S;do{R[o++]=h[k++]}while(--S);if(k=0,l<b){b-=S=l;do{R[o++]=h[k++]}while(--S);k=o-E,T=R}}}else if(k+=l-S,S<b){b-=S;do{R[o++]=h[k++]}while(--S);k=o-E,T=R}for(;b>2;)R[o++]=T[k++],R[o++]=T[k++],R[o++]=T[k++],b-=3;b&&(R[o++]=T[k++],b>1&&(R[o++]=T[k++]))}else{k=o-E;do{R[o++]=R[k++],R[o++]=R[k++],R[o++]=R[k++],b-=3}while(b>2);b&&(R[o++]=R[k++],b>1&&(R[o++]=R[k++]))}break}}break}}while(n<i&&o<s);n-=b=p>>3,f&=(1<<(p-=b<<3))-1,e.next_in=n,e.next_out=o,e.avail_in=n<i?i-n+5:5-(n-i),e.avail_out=o<s?s-o+257:257-(o-s),r.hold=f,r.bits=p},dF=function(e,t,r,n,i,o,a,s){var u,c,d,l,h,f,p,v,_,m=s.bits,y=0,g=0,S=0,b=0,E=0,k=0,T=0,I=0,R=0,A=0,w=null,C=0,O=new eF.Buf16(16),x=new eF.Buf16(16),N=null,D=0;for(y=0;y<=tF;y++)O[y]=0;for(g=0;g<n;g++)O[t[r+g]]++;for(E=m,b=tF;b>=1&&0===O[b];b--);if(E>b&&(E=b),0===b)return i[o++]=20971520,i[o++]=20971520,s.bits=1,0;for(S=1;S<b&&0===O[S];S++);for(E<S&&(E=S),I=1,y=1;y<=tF;y++)if(I<<=1,(I-=O[y])<0)return-1;if(I>0&&(0===e||1!==b))return-1;for(x[1]=0,y=1;y<tF;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=N=a,f=19):1===e?(w=rF,C-=257,N=nF,D-=257,f=256):(w=iF,N=oF,f=-1),A=0,g=0,y=S,h=o,k=E,T=0,d=-1,l=(R=1<<E)-1,1===e&&R>852||2===e&&R>592)return 1;for(;;){p=y-T,a[g]<f?(v=0,_=a[g]):a[g]>f?(v=N[D+a[g]],_=w[C+a[g]]):(v=96,_=0),u=1<<y-T,S=c=1<<k;do{i[h+(A>>T)+(c-=u)]=p<<24|v<<16|_|0}while(0!==c);for(u=1<<y-1;A&u;)u>>=1;if(0!==u?(A&=u-1,A+=u):A=0,g++,0==--O[y]){if(y===b)break;y=t[r+a[g]]}if(y>E&&(A&l)!==d){for(0===T&&(T=E),h+=S,I=1<<(k=y-T);k+T<b&&!((I-=O[k+T])<=0);)k++,I<<=1;if(R+=1<<k,1===e&&R>852||2===e&&R>592)return 1;i[d=A&l]=E<<24|k<<16|h-o|0}}return 0!==A&&(i[h+A]=y-T<<24|64<<16|0),s.bits=E,0},lF=-2,hF=12,fF=30;function pF(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function vF(){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 aF.Buf16(320),this.work=new aF.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function _F(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 aF.Buf32(852),t.distcode=t.distdyn=new aF.Buf32(592),t.sane=1,t.back=-1,0):lF}function mF(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,_F(e)):lF}function yF(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)?lF:(null!==n.window&&n.wbits!==t&&(n.window=null),n.wrap=r,n.wbits=t,mF(e))):lF}function gF(e,t){var r,n;return e?(n=new vF,e.state=n,n.window=null,0!==(r=yF(e,t))&&(e.state=null),r):lF}var SF,bF,EF=!0;function kF(e){if(EF){var t;for(SF=new aF.Buf32(512),bF=new aF.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(dF(1,e.lens,0,288,SF,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;dF(2,e.lens,0,32,bF,0,e.work,{bits:5}),EF=!1}e.lencode=SF,e.lenbits=9,e.distcode=bF,e.distbits=5}function TF(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 aF.Buf8(o.wsize)),n>=o.wsize?(aF.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),aF.arraySet(o.window,t,r-n,i,o.wnext),(n-=i)?(aF.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}$V.inflateReset=mF,$V.inflateReset2=yF,$V.inflateResetKeep=_F,$V.inflateInit=function(e){return gF(e,15)},$V.inflateInit2=gF,$V.inflate=function(e,t){var r,n,i,o,a,s,u,c,d,l,h,f,p,v,_,m,y,g,S,b,E,k,T,I,R=0,A=new aF.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 lF;(r=e.state).mode===hF&&(r.mode=13),a=e.next_out,i=e.output,u=e.avail_out,o=e.next_in,n=e.input,s=e.avail_in,c=r.hold,d=r.bits,l=s,h=u,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--,c+=n[o++]<<d,d+=8}if(2&r.wrap&&35615===c){r.check=0,A[0]=255&c,A[1]=c>>>8&255,r.check=uF(r.check,A,2,0),c=0,d=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&c)<<8)+(c>>8))%31){e.msg="incorrect header check",r.mode=fF;break}if(8!=(15&c)){e.msg="unknown compression method",r.mode=fF;break}if(d-=4,E=8+(15&(c>>>=4)),0===r.wbits)r.wbits=E;else if(E>r.wbits){e.msg="invalid window size",r.mode=fF;break}r.dmax=1<<E,e.adler=r.check=1,r.mode=512&c?10:hF,c=0,d=0;break;case 2:for(;d<16;){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}if(r.flags=c,8!=(255&r.flags)){e.msg="unknown compression method",r.mode=fF;break}if(57344&r.flags){e.msg="unknown header flags set",r.mode=fF;break}r.head&&(r.head.text=c>>8&1),512&r.flags&&(A[0]=255&c,A[1]=c>>>8&255,r.check=uF(r.check,A,2,0)),c=0,d=0,r.mode=3;case 3:for(;d<32;){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}r.head&&(r.head.time=c),512&r.flags&&(A[0]=255&c,A[1]=c>>>8&255,A[2]=c>>>16&255,A[3]=c>>>24&255,r.check=uF(r.check,A,4,0)),c=0,d=0,r.mode=4;case 4:for(;d<16;){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}r.head&&(r.head.xflags=255&c,r.head.os=c>>8),512&r.flags&&(A[0]=255&c,A[1]=c>>>8&255,r.check=uF(r.check,A,2,0)),c=0,d=0,r.mode=5;case 5:if(1024&r.flags){for(;d<16;){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}r.length=c,r.head&&(r.head.extra_len=c),512&r.flags&&(A[0]=255&c,A[1]=c>>>8&255,r.check=uF(r.check,A,2,0)),c=0,d=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&((f=r.length)>s&&(f=s),f&&(r.head&&(E=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),aF.arraySet(r.head.extra,n,o,f,E)),512&r.flags&&(r.check=uF(r.check,n,f,o)),s-=f,o+=f,r.length-=f),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===s)break e;f=0;do{E=n[o+f++],r.head&&E&&r.length<65536&&(r.head.name+=String.fromCharCode(E))}while(E&&f<s);if(512&r.flags&&(r.check=uF(r.check,n,f,o)),s-=f,o+=f,E)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=8;case 8:if(4096&r.flags){if(0===s)break e;f=0;do{E=n[o+f++],r.head&&E&&r.length<65536&&(r.head.comment+=String.fromCharCode(E))}while(E&&f<s);if(512&r.flags&&(r.check=uF(r.check,n,f,o)),s-=f,o+=f,E)break e}else r.head&&(r.head.comment=null);r.mode=9;case 9:if(512&r.flags){for(;d<16;){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}if(c!==(65535&r.check)){e.msg="header crc mismatch",r.mode=fF;break}c=0,d=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=hF;break;case 10:for(;d<32;){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}e.adler=r.check=pF(c),c=0,d=0,r.mode=11;case 11:if(0===r.havedict)return e.next_out=a,e.avail_out=u,e.next_in=o,e.avail_in=s,r.hold=c,r.bits=d,2;e.adler=r.check=1,r.mode=hF;case hF:if(5===t||6===t)break e;case 13:if(r.last){c>>>=7&d,d-=7&d,r.mode=27;break}for(;d<3;){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}switch(r.last=1&c,d-=1,3&(c>>>=1)){case 0:r.mode=14;break;case 1:if(kF(r),r.mode=20,6===t){c>>>=2,d-=2;break e}break;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=fF}c>>>=2,d-=2;break;case 14:for(c>>>=7&d,d-=7&d;d<32;){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}if((65535&c)!=(c>>>16^65535)){e.msg="invalid stored block lengths",r.mode=fF;break}if(r.length=65535&c,c=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>u&&(f=u),0===f)break e;aF.arraySet(i,n,o,f,a),s-=f,o+=f,u-=f,a+=f,r.length-=f;break}r.mode=hF;break;case 17:for(;d<14;){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}if(r.nlen=257+(31&c),c>>>=5,d-=5,r.ndist=1+(31&c),c>>>=5,d-=5,r.ncode=4+(15&c),c>>>=4,d-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=fF;break}r.have=0,r.mode=18;case 18:for(;r.have<r.ncode;){for(;d<3;){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}r.lens[w[r.have++]]=7&c,c>>>=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=dF(0,r.lens,0,19,r.lencode,0,r.work,T),r.lenbits=T.bits,k){e.msg="invalid code lengths set",r.mode=fF;break}r.have=0,r.mode=19;case 19:for(;r.have<r.nlen+r.ndist;){for(;m=(R=r.lencode[c&(1<<r.lenbits)-1])>>>16&255,y=65535&R,!((_=R>>>24)<=d);){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}if(y<16)c>>>=_,d-=_,r.lens[r.have++]=y;else{if(16===y){for(I=_+2;d<I;){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}if(c>>>=_,d-=_,0===r.have){e.msg="invalid bit length repeat",r.mode=fF;break}E=r.lens[r.have-1],f=3+(3&c),c>>>=2,d-=2}else if(17===y){for(I=_+3;d<I;){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}d-=_,E=0,f=3+(7&(c>>>=_)),c>>>=3,d-=3}else{for(I=_+7;d<I;){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}d-=_,E=0,f=11+(127&(c>>>=_)),c>>>=7,d-=7}if(r.have+f>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=fF;break}for(;f--;)r.lens[r.have++]=E}}if(r.mode===fF)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=fF;break}if(r.lenbits=9,T={bits:r.lenbits},k=dF(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=fF;break}if(r.distbits=6,r.distcode=r.distdyn,T={bits:r.distbits},k=dF(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=fF;break}if(r.mode=20,6===t)break e;case 20:r.mode=21;case 21:if(s>=6&&u>=258){e.next_out=a,e.avail_out=u,e.next_in=o,e.avail_in=s,r.hold=c,r.bits=d,cF(e,h),a=e.next_out,i=e.output,u=e.avail_out,o=e.next_in,n=e.input,s=e.avail_in,c=r.hold,d=r.bits,r.mode===hF&&(r.back=-1);break}for(r.back=0;m=(R=r.lencode[c&(1<<r.lenbits)-1])>>>16&255,y=65535&R,!((_=R>>>24)<=d);){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}if(m&&0==(240&m)){for(g=_,S=m,b=y;m=(R=r.lencode[b+((c&(1<<g+S)-1)>>g)])>>>16&255,y=65535&R,!(g+(_=R>>>24)<=d);){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}c>>>=g,d-=g,r.back+=g}if(c>>>=_,d-=_,r.back+=_,r.length=y,0===m){r.mode=26;break}if(32&m){r.back=-1,r.mode=hF;break}if(64&m){e.msg="invalid literal/length code",r.mode=fF;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--,c+=n[o++]<<d,d+=8}r.length+=c&(1<<r.extra)-1,c>>>=r.extra,d-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;m=(R=r.distcode[c&(1<<r.distbits)-1])>>>16&255,y=65535&R,!((_=R>>>24)<=d);){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}if(0==(240&m)){for(g=_,S=m,b=y;m=(R=r.distcode[b+((c&(1<<g+S)-1)>>g)])>>>16&255,y=65535&R,!(g+(_=R>>>24)<=d);){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}c>>>=g,d-=g,r.back+=g}if(c>>>=_,d-=_,r.back+=_,64&m){e.msg="invalid distance code",r.mode=fF;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--,c+=n[o++]<<d,d+=8}r.offset+=c&(1<<r.extra)-1,c>>>=r.extra,d-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=fF;break}r.mode=25;case 25:if(0===u)break e;if(f=h-u,r.offset>f){if((f=r.offset-f)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=fF;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>u&&(f=u),u-=f,r.length-=f;do{i[a++]=v[p++]}while(--f);0===r.length&&(r.mode=21);break;case 26:if(0===u)break e;i[a++]=r.length,u--,r.mode=21;break;case 27:if(r.wrap){for(;d<32;){if(0===s)break e;s--,c|=n[o++]<<d,d+=8}if(h-=u,e.total_out+=h,r.total+=h,h&&(e.adler=r.check=r.flags?uF(r.check,i,h,a-h):sF(r.check,i,h,a-h)),h=u,(r.flags?c:pF(c))!==r.check){e.msg="incorrect data check",r.mode=fF;break}c=0,d=0}r.mode=28;case 28:if(r.wrap&&r.flags){for(;d<32;){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}if(c!==(4294967295&r.total)){e.msg="incorrect length check",r.mode=fF;break}c=0,d=0}r.mode=29;case 29:k=1;break e;case fF:k=-3;break e;case 31:return-4;default:return lF}return e.next_out=a,e.avail_out=u,e.next_in=o,e.avail_in=s,r.hold=c,r.bits=d,(r.wsize||h!==e.avail_out&&r.mode<fF&&(r.mode<27||4!==t))&&TF(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?uF(r.check,i,h,e.next_out-h):sF(r.check,i,h,e.next_out-h)),e.data_type=r.bits+(r.last?64:0)+(r.mode===hF?128:0)+(20===r.mode||15===r.mode?256:0),(0===l&&0===h||4===t)&&0===k&&(k=-5),k},$V.inflateEnd=function(e){if(!e||!e.state)return lF;var t=e.state;return t.window&&(t.window=null),e.state=null,0},$V.inflateGetHeader=function(e,t){var r;return e&&e.state?0==(2&(r=e.state).wrap)?lF:(r.head=t,t.done=!1,0):lF},$V.inflateSetDictionary=function(e,t){var r,n=t.length;return e&&e.state?0!==(r=e.state).wrap&&11!==r.mode?lF:11===r.mode&&sF(1,t,n,0)!==r.check?-3:TF(e,t,n,n)?(r.mode=31,-4):(r.havedict=1,0):lF},$V.inflateInfo="pako inflate (from Nodeca project)";var IF={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 RF=$V,AF=lU,wF=OV,CF=IF,OF=rV,xF=UV,NF=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},DF=Object.prototype.toString;function PF(e){if(!(this instanceof PF))return new PF(e);this.options=AF.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 xF,this.strm.avail_out=0;var r=RF.inflateInit2(this.strm,t.windowBits);if(r!==CF.Z_OK)throw new Error(OF[r]);if(this.header=new NF,RF.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=wF.string2buf(t.dictionary):"[object ArrayBuffer]"===DF.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(r=RF.inflateSetDictionary(this.strm,t.dictionary))!==CF.Z_OK))throw new Error(OF[r])}function MF(e,t){var r=new PF(t);if(r.push(e,!0),r.err)throw r.msg||OF[r.err];return r.result}PF.prototype.push=function(e,t){var r,n,i,o,a,s=this.strm,u=this.options.chunkSize,c=this.options.dictionary,d=!1;if(this.ended)return!1;n=t===~~t?t:!0===t?CF.Z_FINISH:CF.Z_NO_FLUSH,"string"==typeof e?s.input=wF.binstring2buf(e):"[object ArrayBuffer]"===DF.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 AF.Buf8(u),s.next_out=0,s.avail_out=u),(r=RF.inflate(s,CF.Z_NO_FLUSH))===CF.Z_NEED_DICT&&c&&(r=RF.inflateSetDictionary(this.strm,c)),r===CF.Z_BUF_ERROR&&!0===d&&(r=CF.Z_OK,d=!1),r!==CF.Z_STREAM_END&&r!==CF.Z_OK)return this.onEnd(r),this.ended=!0,!1;s.next_out&&(0!==s.avail_out&&r!==CF.Z_STREAM_END&&(0!==s.avail_in||n!==CF.Z_FINISH&&n!==CF.Z_SYNC_FLUSH)||("string"===this.options.to?(i=wF.utf8border(s.output,s.next_out),o=s.next_out-i,a=wF.buf2string(s.output,i),s.next_out=o,s.avail_out=u-o,o&&AF.arraySet(s.output,s.output,i,o,0),this.onData(a)):this.onData(AF.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!==CF.Z_STREAM_END);return r===CF.Z_STREAM_END&&(n=CF.Z_FINISH),n===CF.Z_FINISH?(r=RF.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===CF.Z_OK):n!==CF.Z_SYNC_FLUSH||(this.onEnd(CF.Z_OK),s.avail_out=0,!0)},PF.prototype.onData=function(e){this.chunks.push(e)},PF.prototype.onEnd=function(e){e===CF.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=AF.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},KV.Inflate=PF,KV.inflate=MF,KV.inflateRaw=function(e,t){return(t=t||{}).raw=!0,MF(e,t)},KV.ungzip=MF;var LF={};(0,lU.assign)(LF,hU,KV,IF);var UF=LF,VF="BytePlusRTC",FF=function(){return window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB},BF=function(){function e(t){c(this,e),h(this,"storeName",void 0),h(this,"pendingList",[]),this.storeName=t,!fP()&&FF()&&this._checkAndCreateStore(t)}var t,r;return l(e,[{key:"_checkAndCreateStore",value:function(t,r){var n=this;e.db&&e.db.close();var i=r?FF().open(VF,r):FF().open(VF);i.onupgradeneeded=function(){i.result.createObjectStore(t)},i.onerror=function(e){console.error("IndexedDBInterface error",i.error)},i.onsuccess=function(){var r=i.result;e.db=r;try{e.db.transaction(n.storeName,"readonly"),n.pendingList.forEach(function(){var e=u(o().mark((function e(t){var r,i,a,s;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.txMode,i=t.resolve,a=t.reject,e.prev=1,e.next=4,n._getStore(r);case 4:s=e.sent,i(s),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(1),a();case 11:case"end":return e.stop()}}),e,null,[[1,8]])})));return function(t){return e.apply(this,arguments)}}())}catch(a){n._checkAndCreateStore(t,r.version+1)}}}},{key:"_getStore",value:function(t){var r=this;return new Promise((function(n,i){e.db?n(e.db.transaction(r.storeName,t).objectStore(r.storeName)):r.pendingList.push({txMode:t,resolve:n,reject:i})}))}},{key:"put",value:(r=u(o().mark((function e(t,r){var n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._getStore("readwrite");case 2:return n=e.sent,e.abrupt("return",new Promise((function(e,i){var o=n.put(t,r);o.onsuccess=function(){e()},o.onerror=function(e){i(e)}})));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"get",value:(t=u(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._getStore("readonly");case 2:return r=e.sent,e.abrupt("return",new Promise((function(e,n){var i=r.get(t);i.onsuccess=function(){e(i.result)},i.onerror=function(e){n(e)}})));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})}]),e}();h(BF,"db",void 0),h(BF,"state","init");var jF=function(e){return e.RTC="rtc",e}(jF||{}),GF=function(e){return e.W_5="5",e}(GF||{}),HF=function(e){return e.IOS="ios",e.ANDROID="android",e.WEB="web",e.WINDOWS="windows",e.MAC="mac",e.LINUX="linux",e}(HF||{}),zF=function(e){return e.REQUEST="request",e.RESPONSE="response",e}(zF||{}),qF=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}(qF||{}),KF=function(e){return e.WEBSOCKET="websocket",e.NETWORKCHANGED="networkChanged",e.PEERCONNECTION="peerconnection",e}(KF||{}),XF=function(e){return e.WEBSOCKET_RECONNECTED="websocket reconnected",e.PEERCONNECTION_RECONNECTED="peerconnection reconnected",e}(XF||{}),WF=function(e){return e.WEBSOCKET="websocket",e.NETWORKCHANGED="networkChanged",e.PEERCONNECTION="peerconnection",e}(WF||{}),YF=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}(YF||{}),JF=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}(JF||{}),QF=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}(QF||{}),ZF=function(e){return e.UP="up",e.DOWN="down",e.DIRECT="direct",e}(ZF||{}),$F=function(e){return e.UP="up",e.DOWN="down",e.PRE="pre",e}($F||{}),eB=function(e){return e.UP="up",e.DOWN="down",e.PRE="pre",e}(eB||{}),tB=function(e){return e.W_0="0",e.W_1="1",e}(tB||{}),rB=function(e){return e.UP="up",e.DOWN="down",e}(rB||{}),nB=function(e){return e.ANSWER="answer",e.INCRANSWER="incranswer",e}(nB||{}),iB=function(e){return e.UP="up",e.DOWN="down",e}(iB||{}),oB=function(e){return e.SUCCESS="success",e.FAIL="fail",e}(oB||{}),aB=function(e){return e.W_0="0",e.W_1="1",e}(aB||{}),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.JOIN_ROOM_ACK_FAILED="join room ack failed",e.UNKNOWN="unknown",e}(sB||{}),uB=function(e){return e.SUCCESS="success",e.FAIL="fail",e.IGNORE="ignore",e}(uB||{}),cB=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}(cB||{}),dB=function(e){return e.PLAYOUT_DEVICE_SWITCH="playout_device_switch",e.RECORD_DEVICE_SWITCH="record_device_switch",e.UNKNOWN="unknown",e}(dB||{}),lB=function(e){return e.BEGIN_SEND="begin_send",e.SENT_END="sent_end",e.BEGIN_RECV="begin_recv",e.RECV_END="recv_end",e}(lB||{}),hB=function(e){return e.AUDIO="audio",e.VIDEO="video",e.SCREEN_VIDEO="screen_video",e.SCREEN_AUDIO="screen_audio",e}(hB||{}),fB=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}(fB||{}),pB=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}(pB||{}),vB=function(e){return e.BEGIN="begin",e.END="end",e}(vB||{}),_B=function(e){return e.BEGIN="begin",e.END="end",e}(_B||{}),mB=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}(mB||{}),yB=function(e){return e.P2P="p2p",e.P2P_OUTSIDE_ROOM="p2p_outside_room",e.P2SERVER="p2server",e}(yB||{}),gB=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}(gB||{}),SB=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}(SB||{}),bB=function(){function e(t){c(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,"_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),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:"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"}}]),e}(),EB="ReportErrorBuffer",kB=function(){function e(){c(this,e),h(this,"_buffer",new BF(EB))}var t,r;return l(e,[{key:"set",value:(r=u(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._buffer.put(t,EB);case 2:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"get",value:(t=u(o().mark((function e(){var t;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=[],e.prev=1,e.next=4,this._buffer.get(EB);case 4:t=e.sent,e.next=9;break;case 7:e.prev=7,e.t0=e.catch(1);case 9:return e.abrupt("return",t);case 10:case"end":return e.stop()}}),e,this,[[1,7]])}))),function(){return t.apply(this,arguments)})}]),e}(),TB=function(e){f(n,e);var t,r=g(n);function n(){var e;return c(this,n),h(m(e=r.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),"errSendBuffer",void 0),h(m(e),"commonStats",void 0),h(m(e),"_retryCount",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 bB(m(e)),fP()||window.addEventListener("beforeunload",(function(){clearTimeout(e.errSendTimer),clearTimeout(e.sucSendTimer),e.send(null,!0)})),e}return l(n,[{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:"enableErrorBuffer",value:function(){this.errSendBuffer=new kB,this.loadErrorBuffer()}},{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:i(i({},this.report_common),{},{http_retry_count:this._retryCount}),from:"web",os:"web",version:"1"},o=new XMLHttpRequest;o.timeout=1e4,o.onreadystatechange=function(){if(4===o.readyState){var i,a,s,u;if(e||(r.posting=!1),200===o.status||304===o.status)try{i=JSON.parse(o.responseText)}catch(r0){a=r0}if(i&&0===i.StatusCode){if(!e&&!t)null===(s=r.errSendBuffer)||void 0===s||s.set([]),r.sucSend()}else if(setTimeout((function(){var e;r.rtcError("reportor error, res:".concat(null===(e=i)||void 0===e?void 0:e.toString()," err:").concat(a),o.status,a)}),0),e)r.send(e);else r.unshift(n.data),null===(u=r.errSendBuffer)||void 0===u||u.set(k(r.dataBuffer)),t?r.send():r.errSend()}};var a=JB.LOG_SERVER_URL;if(o.open("POST",a,!0),e||(this.posting=!0),!fP()&&location.search.includes("_rtc_autotest_"))this.safeEmit("report_event",n),0!==this.dataBuffer.length?this.sucSend():this.posting=!1;else if(!fP()&&location.search.includes("_rtc_debug_"))o.send(JSON.stringify(n));else{var s=UF.gzip(JSON.stringify(n));o.setRequestHeader("Content-Encoding","gzip"),o.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"),o.send(s)}}}},{key:"sucSend",value:function(){this.errSendDelay=100,this._retryCount=0,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,this._retryCount++}},{key:"loadErrorBuffer",value:(t=u(o().mark((function e(){var t,r,n=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,null===(r=this.errSendBuffer)||void 0===r?void 0:r.get();case 2:if(e.t1=t=e.sent,e.t0=null!==e.t1,!e.t0){e.next=6;break}e.t0=void 0!==t;case 6:if(!e.t0){e.next=10;break}e.t2=t,e.next=11;break;case 10:e.t2=[];case 11:e.t2.forEach((function(e){n.push(e)}));case 13:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{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,u=t.rtc_sdk_version,c=t.rtc_timestamp,d=t.rtc_sdk_git_commit,l=t.report_id,h=t.rtc_sid,f=t.engine_session_id,p=t.rtc_business_id,v=t.project_key,_=t.network_type,m=t.app_version,y=t.aid,g=t.device_model,S=t.device_brand,b=t.common_extra_info,E=t.had_selected_p2p,k=t.rtc_env_type,T=t.user_agent,I=t.auto_play_policy,R=t.platform,A=t.product;Object.assign(e,{event_key:r,device_id:n,rtc_app_id:i,product_line:o,report_version:a,os:s,rtc_sdk_version:u,rtc_timestamp:c,rtc_sdk_git_commit:d,report_id:l,rtc_sid:h,engine_session_id:f,rtc_business_id:p,project_key:v,network_type:_,app_version:m,aid:y,device_model:g,device_brand:S,common_extra_info:b,had_selected_p2p:E,rtc_env_type:k,user_agent:T,auto_play_policy:I,platform:R,product:A}),this.commonStats.room_id&&(this.modify_ids.room_id=this.commonStats.room_id),this.commonStats.user_id&&(this.modify_ids.user_id=this.commonStats.user_id),this.commonStats.rtc_session_id&&(this.modify_ids.rtc_session_id=this.commonStats.rtc_session_id),this.commonStats.connection_id&&(this.modify_ids.connection_id=this.commonStats.connection_id)}},{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 u=arguments.length>7&&void 0!==arguments[7]?arguments[7]:{},c=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(u)});this.push(c)}},{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]:{},u=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(u)}},{key:"rtcPreIceState",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=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),{},{connection_id:r,common_extra_info:JSON.stringify(n)});this.push(o)}},{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){var a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},s=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,direction:o},this.modify_ids),{},{common_extra_info:JSON.stringify(a)});this.push(s)}},{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,u){var c=arguments.length>8&&void 0!==arguments[8]?arguments[8]:{},d=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),{},{connection_id:u,common_extra_info:JSON.stringify(c)});this.push(d)}},{key:"rtcRecvAnswer",value:function(e,t,r,n,o,a,s){var u=arguments.length>7&&void 0!==arguments[7]?arguments[7]:{},c=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(u)});this.push(c)}},{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=arguments.length>6&&void 0!==arguments[6]?arguments[6]:"",u=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),{},{connection_id:s,common_extra_info:JSON.stringify(a),direction:a.direction});this.push(u)}},{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,u,c,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:u,media_device_id:c,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)}}]),n}(VL),IB=new TB,RB=new TB,AB=new TB,wB=IB.commonStats,CB=RB.commonStats,OB=AB.commonStats,xB={default:IB,rtm:RB,outsideRoom:AB},NB=function(e,t,r){IB.rtcSdkApiCall(e,t,r)},DB=function(e,t,r){IB.rtcSdkCallback(e,t,r)};function PB(){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&&wB.setStats({room_id:i[1]}),xB[e].rtcSdkApiCall(n,0,JSON.stringify(TP(i)),s);var u=o.apply(this,i);return"function"==typeof(null==u?void 0:u.then)?u.then((function(t){return xB[e].rtcSdkCallback(n,0,JSON.stringify(TP([t||{}]))),t})).catch((function(t){throw xB[e].rtcSdkCallback(n,t.code,JSON.stringify(t.message)),t})):(xB[e].rtcSdkCallback(n,0,JSON.stringify(TP([u||{}]))),u)}}}}function MB(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=e===ie.onUserMessageReceivedOutsideRoom||e===ie.onUserBinaryMessageReceivedOutsideRoom;(n?RB:IB).rtcSdkCallback(e,r,JSON.stringify(t))}function LB(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};(n?RB:IB).rtcInvokeStatus(JSON.stringify(t),r,e,"",0,o,i)}var UB="BytePlus",VB="RTC_DEVICE_ID",FB="RTC_ACCESS_NODE",BB="RTC_ACCESS_URLS",jB="RTC_H264_BLACK_LIST",GB="engine_BAC",HB=function(){function e(){c(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}(),zB=function(e){f(r,e);var t=g(r);function r(){return c(this,r),t.apply(this,arguments)}return l(r,[{key:"getDeviceId",value:function(){if(fP())return"";var e=this.get(VB);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[wB,CB,OB].forEach((function(t){return t.setStats({device_id:e})})),this.set(VB,e),e}},{key:"getAccessNode",value:function(e){return this.get("".concat(FB,"_").concat(e,"-").concat(UB))}},{key:"setAccessNode",value:function(e,t,r){return this.set("".concat(FB,"_").concat(e,"-").concat(UB),t,1e3*r)}},{key:"clearAccessNode",value:function(e){this.delete("".concat(FB,"_").concat(e,"-").concat(UB))}},{key:"getAccessUrls",value:function(){return this.get("".concat(BB,"-").concat(UB))}},{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(BB,"-").concat(UB),t)}},{key:"clearAccessUrls",value:function(){this.delete("".concat(BB,"-").concat(UB))}},{key:"getH264BlackList",value:function(){return this.get(jB)}},{key:"setH264BlackList",value:function(e){return this.set(jB,e)}},{key:"getAudioProfile",value:function(){return this.get(GB)}},{key:"setAudioProfile",value:function(e){return this.set(GB,e)}}]),r}(HB),qB=new zB,KB="rtc-access.rtcplus.com,rtc-access-sg.rtcplus.com,rtc-access-va.rtcplus.com,rtc-access-fr.rtcplus.com".split(",");function XB(){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 WB="https://web-log-report.rtcplus.com/video/v1/webrtc_log/",YB="rtc.rtcplus.com".split(","),JB={VERSION:"4.47.17",ICE_CONFIG_REQUEST_URLS_INTERNAL:KB.map(XB),ICE_CONFIG_REQUEST_URLS:[],EXPECTED_ADDR:"",LOG_SERVER_URL:WB,CONFIG_REQUEST_DOMAINS:YB,DEVICE_ID:"",OVERSEA:!1,PLATFORM:"",PRODUCT:"",STATS_SCALLBACK_SUPPORT:!0,ENABLE_REPORT_ERROR_BUFFER:!1};function QB(e,t){if(IB.rtcSdkApiCall("setParameter",0,"key: ".concat(e,", value: ").concat(t)),"VERSION"!==e)return"ICE_CONFIG_REQUEST_URLS"===e?("string"==typeof t&&(t=[t]),void(JB.ICE_CONFIG_REQUEST_URLS=t.map(XB))):void("PLATFORM"!==e||"string"!=typeof t?"PRODUCT"!==e||"string"!=typeof t?"LOG_SERVER_URL"!==e||t!==G.overseas?"LOG_SERVER_URL"!==e||t!==G.domestic?"LOG_SERVER_URL"!==e||"string"!=typeof t?"OVERSEA"!==e?"STATS_SCALLBACK_SUPPORT"!==e?("DEVICE_ID"===e&&qB.setDeviceId(t),"ENABLE_REPORT_ERROR_BUFFER"!==e?JB[e]=t:t&&IB.enableErrorBuffer()):JB.STATS_SCALLBACK_SUPPORT=t:JB.OVERSEA=t:JB.LOG_SERVER_URL=t:JB.LOG_SERVER_URL=WB:JB.LOG_SERVER_URL="https://web-log-report.rtcplus.com/video/v1/webrtc_log/":wB.setStats({product:t}):wB.setStats({platform:t}))}function ZB(e){return"DEVICE_ID"===e?qB.getDeviceId():JB[e]}function $B(e,t){var r,n,i,o,a,s,u,c,d,l,h,f,p,v,_,m,y;return{type:"transcode",action:e,transcodeMeta:{transcode:{url:t.url},control:{protocol:"2.0"},audio:{codec:(null===(r=t.audio)||void 0===r?void 0:r.codec)||rj.audio.codec,bitRate:1e3*((null===(n=t.audio)||void 0===n?void 0:n.kBitRate)||rj.audio.kBitRate),sampleRate:1e3*((null===(i=t.audio)||void 0===i?void 0:i.sampleRate)||rj.audio.sampleRate),channels:(null===(o=t.audio)||void 0===o?void 0:o.channels)||rj.audio.channels,profile:(null===(a=t.audio)||void 0===a?void 0:a.AACProfile)||rj.audio.AACProfile},video:{codec:(null===(s=t.video)||void 0===s?void 0:s.codec)||rj.video.codec,fps:(null===(u=t.video)||void 0===u?void 0:u.fps)||rj.video.fps,gop:(null===(c=t.video)||void 0===c?void 0:c.gop)||rj.video.gop,lowLatency:null!==(d=null===(l=t.video)||void 0===l?void 0:l.lowLatency)&&void 0!==d?d:rj.video.lowLatency,bitRate:1e3*((null===(h=t.video)||void 0===h?void 0:h.kBitRate)||rj.video.kBitRate),width:(null===(f=t.video)||void 0===f?void 0:f.width)||rj.video.width,height:(null===(p=t.video)||void 0===p?void 0:p.height)||rj.video.height},layout:{canvas:{bgnd:(null===(v=t.layout)||void 0===v?void 0:v.backgroundColor)||rj.layout.backgroundColor},regions:(null===(_=t.layout)||void 0===_||null===(m=_.regions)||void 0===m?void 0:m.map((function(e){return{alpha:Math.min(Math.max(+e.alpha,0),1),uid:e.userId,zorder:e.zorder,x:Math.min(Math.max(+e.x,0),1),y:Math.min(Math.max(+e.y,0),1),w:Math.min(Math.max(+e.w,0),1),h:Math.min(Math.max(+e.h,0),1),renderMode:e.renderMode||1,contentControl:e.contentControl||0,screen:e.isScreenStream,local_user:e.isLocalUser}})))||[],app_data:(null===(y=t.layout)||void 0===y?void 0:y.appData)||rj.layout.appData}}}}function ej(e,t,r){var n,i,o,a,s,u,c,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)||q.PREV_FRAME,canvas:{bgColor:(null===(u=r.layout)||void 0===u?void 0:u.backgroundColor)||"#000000",bgImage:(null===(c=r.layout)||void 0===c?void 0:c.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,x:Math.min(Math.max(+e.x,0),1),y:Math.min(Math.max(+e.y,0),1),w:Math.min(Math.max(+e.w,0),1),h:Math.min(Math.max(+e.h,0),1),zorder:e.zorder,renderMode:void 0===e.renderMode?1:e.renderMode,streamType:e.isScreenStream?1:0,mediaType:e.mediaType||0,sourceCrop:e.sourceCrop}})))||[]}}}}var tj,rj={url:"",video:{codec:"H264",width:640,height:360,fps:30,gop:60,kBitRate:600,lowLatency:!0},audio:{codec:"AAC",kBitRate:64,sampleRate:48,channels:2,AACProfile:"LC"},layout:{regions:[],appData:"",backgroundColor:"#000000"}},nj={width:640,height:360,frameRate:30,maxKbps:600},ij={width:1920,height:1080,frameRate:15,maxKbps:3e3},oj=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}(oj||{}),aj=function(e){return e.PushLimitWarn="PushLimitWarn",e}(aj||{}),sj=function(e){return e.ON_ADD_STREAM="onAddStream",e.ON_REMOVE_STREAM="onRemoveStream",e.USER_DISCONNECTION="userDisconnection",e.USER_CONNECTION="userConnection",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_STREAM_FAILED="streamFailed",e}(sj||{}),uj=function(e){return e.RSCP="RSCP",e.RTT="RTT",e}(uj||{}),cj=function(e){return e.ON_CONNECTION_STATE_CHANGE="onConnectionStateChange",e.ABNORMAL_DISCONNECTION="normalConnection",e}(cj||{}),dj=function(e){return e.userLeave="userLeave",e.connectionLost="connectionLost",e.userDuplicateLogin="userDuplicateLogin",e.kickedByAdmin="kickedByAdmin",e.roleChanged="roleChanged",e.onUserTokenDidExpire="onUserTokenDidExpire",e}(dj||{}),lj=function(e){return e[e.roomDismissByAdmin=2]="roomDismissByAdmin",e}(lj||{}),hj=function(e){return e[e.SEND=0]="SEND",e[e.FEEDBACK=1]="FEEDBACK",e}(hj||{}),fj=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}(fj||{}),pj=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}(pj||{}),vj=(h(tj={},0,[0,"success"]),h(tj,1,[JN.USER_MESSAGE_TIMEOUT,"timeout, failed to send."]),h(tj,2,[JN.USER_MESSAGE_BROKEN,"dataChannel broken, failed to send."]),h(tj,3,[JN.USER_MESSAGE_NO_RECEIVER,"cannot find the receiver."]),h(tj,4,[JN.USER_MESSAGE_NO_RELAYPATH,"cannot find relay path."]),h(tj,17,[JN.USER_MESSAGE_SEND_TO_SERVER_ERROR,"failed to send to business server."]),h(tj,18,[JN.USER_MESSAGE_SERVER_RESPONSE_ERROR,"business server response error."]),h(tj,100,[JN.USER_MESSAGE_NOT_JOIN,"not join room"]),h(tj,101,[JN.USER_MESSAGE_INIT,"not init."]),h(tj,102,[JN.USER_MESSAGE_NO_CONNECTION,"no connection."]),h(tj,105,[JN.USER_MESSAGE_NOT_LOGIN,"not login."]),h(tj,106,[JN.USER_MESSAGE_SERVER_PARAMS_NOTSET,"server param is not set."]),h(tj,1e3,[JN.USER_MESSAGE_UNKNOWN,"unknown."]),tj),_j=["msg"],mj=new LL("DataChannelSignaling",3),yj=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}(yj||{}),gj=6e4,Sj=function(e){f(a,e);var t,r,n=g(a);function a(e){var t;return c(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 IB.rtcSignaling(0,JSON.stringify(t),"call-".concat(e),"Send",ZF.UP),new Promise((function(i,o){var a=n._genHeader(r);a.id=bP();var s=a.id.join("-"),u=setTimeout((function(){n._singlingCache.delete(s),o(new ZN(JN.TIME_OUT,"".concat(e," message time out")))}),gj);n._singlingCache.set(s,{signalingType:e,success:function(e){clearTimeout(u),i(e)},error:function(e){clearTimeout(u),o(e)}}),mj.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=u(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,_j),s=n instanceof ArrayBuffer,e.t0=this,e.t1=i,e.t2=i({ver:1,id:this._p2pMessageId++,time:Date.now(),dir:hj.SEND,type:fj.P2P,err:pj.SUCCESS},a),e.t3={},e.t4=s,!s){e.next=13;break}return e.next=10,pP.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 kP(e.msg)?this._rttIds[e.id]=e.id:e.dir===hj.SEND&&mj.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:bP()}));if(e.dir===hj.SEND){var s=setTimeout((function(){t._p2pCache.delete(e.id),o(new ZN(JN.TIME_OUT,"P2P message timeout"))}),gj);t._p2pCache.set(e.id,{success:function(e,t){clearTimeout(s),n(t)},error:function(e){clearTimeout(s);var t=E(vj[e.err]||[JN.USER_MESSAGE_UNKNOWN,"err: ".concat(e.err,", msg: ").concat(e.msg)],2),r=t[0],n=t[1];o({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 ZN(JN.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=pP.str2ab(JSON.stringify([e,r])),a=hP(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}))});mj.print("Signal",">>>>>> [".concat(t,"-res][").concat(e,"]")),this._sendMessage("".concat(t,"-res"),n,r)}},{key:"_handleMessage",value:(t=u(o().mark((function e(t){var r,n,a,s,u,c,d,l,h,f,p,v,_,m,y,g,S,b,k,T,I,R,A,w,C,O,x,N,D,P,M,L;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:c=this._dispartData(t),d=c.data,(l=c.header).zip&&((h=new UF.Inflate).push(d,!0),d=h.result),f=pP.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&&IB.rtcSignalingMsgError(-1,e.t0.message,QF.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],mj.print("Signal","<<<<<< ".concat(_),p,v),this._feedbackSignaling(v,_,_===sj.ON_CUSTOM_MESSAGE?i(i({},p),{},{message:""}):""),!p.binary||"string"!=typeof p.message){e.next=31;break}return e.next=30,pP.b64str2ab(p.message);case 30:p.message=e.sent;case 31:this.emit(_,i({},p)),IB.rtcSignaling(0,f,"on-".concat(_),"Recv",ZF.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)===hj.FEEDBACK||kP(null===(s=p)||void 0===s?void 0:s.msg)?delete this._rttIds[m]:mj.print("Signal","<<<<<< p2p response",p),e.t2=p.dir,e.next=e.t2===hj.SEND?40:e.t2===hj.FEEDBACK?78:81;break;case 40:if(kP(null===(u=p)||void 0===u?void 0:u.msg)){e.next=76;break}if(g=(y=p).binary,S=y.msg,b=y.room,k=y.to,T=y.from,I=""===b?g?sj.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM:sj.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM:g?sj.USER_BINARY_MESSAGE_RECEIVED:sj.USER_MESSAGE_RECEIVED,k){e.next=60;break}if(e.t3=this,e.t4=sj.ON_CUSTOM_MESSAGE,e.t5=T,e.t6=g,!g){e.next=54;break}return e.next=51,pP.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,pP.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:hj.FEEDBACK,msg:""})),e.abrupt("break",82);case 78:return(R=this._p2pCache.get(p.id))&&(this._p2pCache.delete(p.id),p.err===pj.SUCCESS?R.success(p.id,p):R.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===(A=l.id)||void 0===A?void 0:A.join("-"))||"",this._handleAckMessage(w,p[0]||{},f),e.next=100;break;case 88:if(C=E(p,2),O=C[0],x=C[1],N=void 0===x?{}:x,"RXMediaMsg"!==O){e.next=100;break}D=N.type,P=N.data,IB.rtcSignaling(0,f,"on-".concat(D),"Recv",ZF.DOWN),e.t19=D,e.next="RSCP"===e.t19?95:"RTT"===e.t19?97:99;break;case 95:try{M=JSON.parse(P),Array.isArray(M)&&this.emit(D,M)}catch(o){}return e.abrupt("break",100);case 97:try{(L=JSON.parse(P)).length&&this.emit(D,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){mj.print("_handleHandler","dataChannel close",t),e.emit("close",t)},r=function(t){mj.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),mj.print("Signal","<<<<<< [".concat(n.signalingType,"-ack]"),t)),IB.rtcSignaling(0,r,null==n?void 0:n.signalingType,"Ack",ZF.DOWN)}}]),a}(xL.exports.EventEmitter),bj=function(){function e(){c(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,u=e.stringify,c=void 0===u||u;return new Promise((function(e,i){t.isSending=!0;var a=new XMLHttpRequest;a.open(r,n,!0);for(var u=0,d=Object.entries(s);u<d.length;u++){var l=E(d[u],2),h=l[0],f=l[1];a.setRequestHeader(h,f)}a.onreadystatechange=function(){4===a.readyState&&(t.isSending=!1,200===a.status?e(JSON.parse(a.responseText)):i({message:a.statusText,code:a.status}))},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),c&&(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}(),Ej=new LL("ICE Request",3),kj=function(){function e(){c(this,e),h(this,"_request",void 0),this._request=new bj}var t,r,n;return l(e,[{key:"getAccessNode",value:(n=u(o().mark((function e(t,r,n,i,a,s,u,c){var d;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(d=qB.getAccessNode(t))){e.next=9;break}if(this.getAccessNodeFromServer(t,r,n,i,a,s,u,c),LB("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,u,c));case 10:case"end":return e.stop()}}),e,this)}))),function(e,t,r,i,o,a,s,u){return n.apply(this,arguments)})},{key:"getAccessNodeFromServer",value:(r=u(o().mark((function e(t,r,n,i,a,s,u,c){var d,l,h,f,p=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return h=qB.getAccessUrls(),f=!0,LB("es.R.req.cache.urls",h),(null===(d=h)||void 0===d?void 0:d.length)>0||(h=JB.ICE_CONFIG_REQUEST_URLS,f=!1,LB("es.R.req.external.urls",h)),(null===(l=h)||void 0===l?void 0:l.length)>0||(h=JB.ICE_CONFIG_REQUEST_URLS_INTERNAL,f=!1,LB("es.R.req.internal.urls",h)),e.abrupt("return",this.getICEConfigFromServer(h,t,r,n,i,a,s,u,c).then((function(e){var r=e.nodes;return!u&&qB.setAccessNode(t,r,e.ttl||11200),e.dispatchDomains&&!u&&qB.setAccessUrls(e.dispatchDomains),r})).catch((function(e){if(f)return LB("es.R.req.fallback",""),qB.clearAccessUrls(),p.getAccessNodeFromServer(t,r,n,i,a,s,u);throw e})));case 6:case"end":return e.stop()}}),e,this)}))),function(e,t,n,i,o,a,s,u){return r.apply(this,arguments)})},{key:"getICEConfigFromServer",value:(t=u(o().mark((function e(t,r,n,i,a,s,c,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:dP(),os:"web",sdkVersion:JB.VERSION,isOversea:JB.OVERSEA,expectedAddr:ZB("EXPECTED_ADDR"),productPlatform:"BytePlus",enableCloudProxy:d,expectedIDC:l},s&&c&&(h.feedbackInfo=[{feedbackIP:null===(f=c.publicIPs[0])||void 0===f?void 0:f.ip,feedbackReason:{type:"NODE_CHANGED",reason:s}}],delete h.expectedAddr),p=Date.now(),IB.rtcGetAccess(0,JSON.stringify(h),0,YF.REQUEST,t.join(","),h.connectSessionID),v=t.map(function(){var e=u(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 ZN(JN.ICE_SERVER_WRONG,"get ICE config failed",e.t0);case 9:if(200===n.code){e.next=11;break}throw new ZN(JN.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 ZN(JN.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",RP(v).then((function(e){var r=e.result;e.firstNode;var n=e.index;return IB.rtcGetAccess(200,JSON.stringify(r),Date.now()-p,YF.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 IB.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,YF.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,u,c){return t.apply(this,arguments)})},{key:"abort",value:function(){this._request.isSending&&(Ej.print("abort","HTTP Request of [getICEConfigFromServer] abort"),this._request.abort())}}]),e}(),Tj=function(){function e(){c(this,e),h(this,"_request",void 0),this._request=new bj}return l(e,[{key:"getH264BlackList",value:function(){var e=this,t={keys:["web_h264_black_list"],labelSelector:"",sdkVersion:"4.47.17",deviceType:"web"};this._request.timeout=800;var r=JB.CONFIG_REQUEST_DOMAINS.map((function(e){return"https://".concat(e,"/decision/v1/multi")}));IB.rtcGetConfig(0,JSON.stringify(t),0,r.join(","),zF.REQUEST,"",!1);var n=r.map(function(){var r=u(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 ZN(JN.ICE_SERVER_WRONG,"get config failed");case 9:if(Array.isArray(null===(a=s)||void 0===a?void 0:a.web_h264_black_list)){r.next=11;break}throw new ZN(JN.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){RP(n).then((function(t){var n=t.result,i=t.index;qB.setH264BlackList(n.web_h264_black_list),IB.rtcGetConfig(200,JSON.stringify(n),0,r[i],zF.RESPONSE,"",!1),e(n.web_h264_black_list)})).catch((function(t){IB.rtcGetConfig(500,t.message,0,"",zF.RESPONSE,"",!1),e(qB.getH264BlackList()||[])}))}))}},{key:"getAudioProfile",value:function(){var e=this,t={keys:["engine_BAC"],labelSelector:"",sdkVersion:"4.47.17",deviceType:"web"},r=JB.CONFIG_REQUEST_DOMAINS.map((function(e){return"https://".concat(e,"/decision/v1/multi")}));IB.rtcGetConfig(0,JSON.stringify(t),0,r.join(","),zF.REQUEST,"",!1);var n=r.map(function(){var r=u(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 ZN(JN.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 ZN(JN.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){RP(n).then((function(t){var n=t.result,i=t.index;qB.setAudioProfile(n.engine_BAC),IB.rtcGetConfig(200,JSON.stringify(n),0,r[i],zF.RESPONSE,"",!1),e(n.engine_BAC)})).catch((function(t){IB.rtcGetConfig(500,t.message,0,"",zF.RESPONSE,"",!1),e(qB.getAudioProfile()||[])}))}))}}]),e}();function Ij(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 Rj=[{sub_index:0,video_index:0,framerate:30,height:1080,maxkbps:3e3,width:1920},{sub_index:1,video_index:0,framerate:30,height:720,maxkbps:1200,width:1280},{sub_index:2,video_index:0,framerate:30,height:630,maxkbps:1100,width:1120},{sub_index:3,video_index:0,framerate:30,height:540,maxkbps:1e3,width:960},{sub_index:4,video_index:1,framerate:30,height:450,maxkbps:800,width:800},{sub_index:5,video_index:1,framerate:30,height:360,maxkbps:600,width:640},{sub_index:6,video_index:1,framerate:30,height:270,maxkbps:400,width:480},{sub_index:7,video_index:2,framerate:15,height:180,maxkbps:300,width:320},{sub_index:8,video_index:2,framerate:15,height:144,maxkbps:200,width:256},{sub_index:9,video_index:3,framerate:15,height:90,maxkbps:100,width:160}],Aj=[{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 wj={width:160,height:90,frameRate:15,maxkbps:100},Cj={width:480,height:270,frameRate:15,maxkbps:400};var Oj,xj,Nj="chrome-stable"===_P(),Dj=function(){function e(t){c(this,e),h(this,"peer",void 0),h(this,"stats",void 0),this.peer=t,this.stats=[]}var t,r;return l(e,[{key:"handleCodec",value:function(e){return e}},{key:"handleInboundRtp",value:function(e){return e}},{key:"handleOutboundRtp",value:function(e){var t=e.ssrc;return t&&(e.rtxSsrc=t),e}},{key:"handleRemoteInboundRtp",value:function(e){return e}},{key:"handleRemoteOutboundRtp",value:function(e){return e}},{key:"handleMediaSource",value:function(e){return e}},{key:"handleCsrc",value:function(e){return e}},{key:"handlePeerConnection",value:function(e){return e}},{key:"handleDataChannel",value:function(e){return e}},{key:"handleStream",value:function(e){return e}},{key:"handleTrack",value:function(e){return e}},{key:"handleTransceiver",value:function(e){return e}},{key:"handleSender",value:function(e){return e}},{key:"handleReceiver",value:function(e){return e}},{key:"handleTransport",value:function(e){return e}},{key:"handleSctpTransport",value:function(e){return e}},{key:"handleCandidatePair",value:function(e){return e}},{key:"handleLocalCandidate",value:function(e){return e}},{key:"handleRemoteCandidate",value:function(e){return e}},{key:"handleCertificate",value:function(e){return e}},{key:"handleIceServer",value:function(e){return e}},{key:"processStats",value:function(e){var t=this;e.forEach((function(e){var r;switch(e.type){case"candidate-pair":r=t.handleCandidatePair;break;case"certificate":r=t.handleCertificate;break;case"remote-candidate":r=t.handleRemoteCandidate;break;case"remote-inbound-rtp":case"inbound-rtp":r=t.handleInboundRtp;break;case"remote-outbound-rtp":case"outbound-rtp":r=t.handleOutboundRtp;break;case"sctp-transport":r=t.handleSctpTransport;break;case"sender":r=t.handleSender;break;case"stream":r=t.handleStream;break;case"track":r=t.handleTrack;break;case"transceiver":r=t.handleTransceiver;break;case"transport":r=t.handleTransport;break;case"codec":r=t.handleCodec;break;case"csrc":r=t.handleCsrc;break;case"data-channel":r=t.handleDataChannel;break;case"ice-server":r=t.handleIceServer;break;case"media-source":r=t.handleMediaSource;break;case"peer-connection":r=t.handlePeerConnection;break;case"receiver":r=t.handleReceiver;break;case"local-candidate":r=t.handleLocalCandidate;break;default:r=function(e){return e}}r=r.bind(t),t.stats.push(r(e))}))}},{key:"getExtraStats",value:(r=u(o().mark((function e(t){var r=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e,n){if(!Nj||void 0!==window.InstallTrigger)return e(r.stats);try{r.peer.getStats((function(n){n.result().forEach((function(e){if(!Pj.includes(e.type)){var n={};e.names().forEach((function(t){n[t]=e.stat(t)})),n.id=e.id,n.type=e.type,n.timestamp=e.timestamp,"ssrc"===n.type&&null!=t&&t.id?t.id===n.googTrackId&&r.stats.push(n):r.stats.push(n)}})),e(r.stats)}))}catch(r0){n(r0)}})));case 1:case"end":return e.stop()}}),e)}))),function(e){return r.apply(this,arguments)})},{key:"getStats",value:(t=u(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,this.peer.getStats(t);case 3:if(n=e.sent,this.processStats(n),e.prev=5,i=ZB("STATS_SCALLBACK_SUPPORT"),r||!mP||!i){e.next=10;break}return e.next=10,this.getExtraStats(t);case 10:e.next=14;break;case 12:e.prev=12,e.t0=e.catch(5);case 14:e.next=18;break;case 16:e.prev=16,e.t1=e.catch(0);case 18:return e.abrupt("return",this.stats);case 19:case"end":return e.stop()}}),e,this,[[0,16],[5,12]])}))),function(e,r){return t.apply(this,arguments)})}]),e}(),Pj=["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"],Mj=function(){var e=u(o().mark((function e(t,r,n){var i,a;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=[],t instanceof RTCPeerConnection){e.next=3;break}return e.abrupt("return",i);case 3:return a=new Dj(t),e.next=6,a.getStats(r,n);case 6:return i=e.sent,e.abrupt("return",i);case 8:case"end":return e.stop()}}),e)})));return function(t,r,n){return e.apply(this,arguments)}}(),Lj=function(){var e=u(o().mark((function e(){var t;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,!fP()&&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,Uj();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)}}(),Uj=function(){var e=u(o().mark((function e(){var t,r,n,i,a,s,u,c,d,l;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!Oj){e.next=2;break}return e.abrupt("return",Oj);case 2:return t=[],e.prev=3,e.next=6,IP();case 6:if(r=e.sent){e.next=9;break}return e.abrupt("return",t);case 9:if(!(null!=r&&r.includes("level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f")||null!=r&&r.includes("profile-level-id=42e01f;level-asymmetry-allowed=1;packetization-mode=1")||null!=r&&r.includes("packetization-mode=1;profile-level-id=42e01f;level-asymmetry-allowed=1"))){e.next=20;break}return n=navigator.userAgent.toLowerCase(),i=!1,a=["heytapbrowser","mqqbrowser","miuibrowser"],s=new Tj,e.next=16,s.getH264BlackList();case 16:for(u=e.sent,a.push.apply(a,k(u)),c=0,d=a;c<d.length;c++)l=d[c],n.includes(l)&&(i=!0);!i&&t.push("H264");case 20:return null!=r&&r.includes("VP8")&&t.push("vp8"),Oj=t,e.abrupt("return",t);case 25:return e.prev=25,e.t0=e.catch(3),e.abrupt("return",t);case 28:case"end":return e.stop()}}),e,null,[[3,25]])})));return function(){return e.apply(this,arguments)}}(),Vj=function(){var e=u(o().mark((function e(){var t;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Uj();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)}}(),Fj=function(){return"undefined"!=typeof TransformStream&&"undefined"!=typeof RTCRtpSender&&"undefined"!=typeof RTCRtpReceiver&&void 0!==RTCRtpSender.prototype.createEncodedStreams&&void 0!==RTCRtpReceiver.prototype.createEncodedStreams},Bj=new LL("BasicHandler",3),jj={iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan",encodedInsertableStreams:!!Fj()||void 0};function Gj(e){if(void 0===xj){var t=navigator.userAgent.toLowerCase();xj=t.includes("chrome")&&t.includes("mobile")}return xj?Math.ceil(e):e}var Hj=function(e){f(d,e);var t,r,n,a,s=g(d);function d(e,t){var r;return c(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),"connection_id",""),h(m(r),"ms_addr",""),r.monitor=e,r._peerConnection=new RTCPeerConnection(jj),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;Bj.print("constructor","pc.ontrack ".concat(e.track.kind," ").concat(e.track.id," ").concat(null===(t=e.streams)||void 0===t||null===(n=t[0])||void 0===n?void 0:n.id)),r.emit("ontrack",e)},r._peerConnection.onconnectionstatechange=function(e){Bj.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,JF["".concat(t.toUpperCase())],r.connection_id,{ms_addr:r.ms_addr})},r}return l(d,[{key:"disconnect",value:function(){this._peerConnection.close(),this._dataChannel.close(),this._peerConnection.ontrack=null}},{key:"destroy",value:function(){Bj.print("destroy"),this.disconnect(),this._context=void 0}},{key:"_simulcast",value:function(e,t,r,n,o){var a=[],s=function(e){for(var t=0,r=e.width*e.height,n=0;n<Aj.length;n++)if(r>=Aj[n].totalPixels){t=n;break}if(0===t)return Aj[t].maxLayers;var i=Aj[t-1].totalPixels;return(i-r)/(i-Aj[t].totalPixels)<.1?Aj[t-1].maxLayers:Aj[t].maxLayers}(t);Bj.print("simulcast() ","maxLayers: %o",s),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/wj.width,i=e.width/Cj.width):(n=e.height/wj.height,i=e.height/Cj.height),r.push({maxkbps:wj.maxkbps,scaleResolutionDownBy:n,frameRate:wj.frameRate,width:Math.floor(e.width/n),height:Math.floor(e.height/n)}),t<=2||n>2&&r.unshift({maxkbps:Cj.maxkbps,scaleResolutionDownBy:i,frameRate:Cj.frameRate,width:Math.floor(e.width/i),height:Math.floor(e.height/i)}),r}(r,s),Bj.print("simulcast() ","simulcastLayers: %o",a)):(a=e.videoEncodeConfig.slice(1).slice(1-s).map((function(e){return i({frameRate:e.frameRate||15,maxkbps:e.maxKbps||600},Ij(r,e))})),Bj.print("simulcast() ","simulcastLayers2: %o",a)),a.forEach((function(e,t){var r,i={maxBitrate:1e3*e.maxkbps,scaleResolutionDownBy:Gj(e.scaleResolutionDownBy),rid:"".concat(t+1),maxFramerate:e.frameRate};null===(r=n.sendEncodings)||void 0===r||r.unshift(i),o.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,u={direction:"sendonly",streams:[t]},c={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],_=Ij(f,v);e.prevScaleResolutionDownBy=_.scaleResolutionDownBy,e.videoInputConfig=f;var m,y,g={maxBitrate:1e3*v.maxKbps,scaleResolutionDownBy:Gj(_.scaleResolutionDownBy),rid:"0",maxFramerate:v.frameRate||15};if(c.sendEncodings=[g],d.push({width:_.width,height:_.height,framerate:v.frameRate,maxkbps:v.maxKbps,rid:"0"}),o)this._simulcast(e,_,f,c,d),null!==(m=this._context)&&void 0!==m&&null!==(y=m.serverConfig)&&void 0!==y&&y.simulcastOnDemand&&(l=function(e){if(!e.length)return[];var t=e.shift(),r=t.width/t.height,n=0,o=0,a=i(i({},t),{},{video_index:o,sub_index:n++});delete a.rid;for(var s=[a],u=0,c=0;c<Rj.length;c++)if(Rj[c].height<t.height){u=c;break}for(var d=e.shift(),l=u;l<Rj.length;l++){var h,f=Rj[l];if(d&&f.height<=(null===(h=d)||void 0===h?void 0:h.height)){var p,v=f.height===(null===(p=d)||void 0===p?void 0:p.height),_=i(i({},d),{},{video_index:++o,sub_index:n++});if(delete _.rid,s.push(_),d=e.shift(),v)continue}s.push(i(i({},f),{},{width:Math.floor(f.height*r),video_index:o,sub_index:n++}))}return s}([].concat(d))),Bj.print("subVideoDesc","desc: %o ",l)}Bj.print("publish videoTransceiverInit videoDescriptions","",c,d);var S=null==n?void 0:n.getTrack("preprocessing");(null==n?void 0:n.mixType)!==te.PLAYOUT&&null!=n&&n.mixedAudioTrack&&(S=null==n?void 0:n.mixedAudioTrack),S=a&&S?S:"audio";var b=null==r?void 0:r.getTrack("preprocessing");return{semantics:"unified-plan",videoDescriptions:d,subVideoDescriptions:l,transceiverInit:{aTrack:S,vTrack:b=s&&b?b:"video",audioTransceiverInit:u,videoTransceiverInit:c}}}},{key:"updateScaleResolutionDownBy",value:(a=u(o().mark((function e(t){var r,n,i,a,s,u,c,d,l,h;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Bj.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 Bj.print("updateScaleResolutionDownBy()","no pub"),e.abrupt("return");case 6:s=null==i?void 0:i.getSettings(),u={width:Math.floor(s.width),height:Math.floor(s.height),frameRate:Math.floor(s.frameRate)},(c=Ij(u,t.videoEncodeConfig[0])).scaleResolutionDownBy===t.prevScaleResolutionDownBy&&Bj.print("updateScaleResolutionDownBy()","no change %o",t.prevScaleResolutionDownBy),(d=null===(n=a.sender)||void 0===n?void 0:n.getParameters())&&(h=c.scaleResolutionDownBy/t.prevScaleResolutionDownBy,d.encodings=null==d||null===(l=d.encodings)||void 0===l?void 0:l.map((function(e){var r,n;Math.max(e.scaleResolutionDownBy=(e.scaleResolutionDownBy||1)*h,1);var i=+e.rid||0;e.maxFramerate=(null===(r=t.videoEncodeConfig[i])||void 0===r?void 0:r.frameRate)||e.maxFramerate;var o=null===(n=t.videoEncodeConfig[i])||void 0===n?void 0:n.maxKbps;return"number"==typeof o&&(e.maxBitrate=1e3*o),e})),t.prevScaleResolutionDownBy=c.scaleResolutionDownBy,t.videoInputConfig=u,null==a||a.sender.setParameters(d));case 12:case"end":return e.stop()}}),e)}))),function(e){return a.apply(this,arguments)})},{key:"getStats",value:function(e,t){return Mj(this._peerConnection,e,t)}},{key:"setLocalDescription",value:(n=u(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=lP(),e.prev=1,e.next=4,this._peerConnection.setLocalDescription(new RTCSessionDescription({type:"offer",sdp:t}));case 4:this.monitor.rtcSetDescription(0,t,tB.W_1,"local"===(null==r?void 0:r.streamUserId)?rB.UP:rB.DOWN,(null==r?void 0:r.streamId)||"",(null==r?void 0:r.streamUserId)||"",lP()-n,this.connection_id,{type:"offer",ms_addr:this.ms_addr}),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,{ms_addr:s.ms_addr},s.connection_id)},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,{ms_addr:s.ms_addr},s.connection_id)}))),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,tB.W_1,"local"===(null==r?void 0:r.streamUserId)?rB.UP:rB.DOWN,"","",lP()-n,this.connection_id,{type:"offer",ms_addr:this.ms_addr});case 12:case"end":return e.stop()}}),e,this,[[1,8]])}))),function(e,t){return n.apply(this,arguments)})},{key:"setRemoteDescription",value:(r=u(o().mark((function e(t,r){var n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=lP(),e.prev=1,e.next=4,this._peerConnection.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:t}));case 4:this.monitor.rtcSetDescription(0,t,tB.W_0,"local"===(null==r?void 0:r.streamUserId)?rB.UP:rB.DOWN,(null==r?void 0:r.streamId)||"",(null==r?void 0:r.streamUserId)||"",lP()-n,this.connection_id,{type:"answer",ms_addr:this.ms_addr}),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,tB.W_1,"local"===(null==r?void 0:r.streamUserId)?rB.UP:rB.DOWN,(null==r?void 0:r.streamId)||"",(null==r?void 0:r.streamUserId)||"",lP()-n,this.connection_id,{type:"answer",ms_addr:this.ms_addr});case 11:case"end":return e.stop()}}),e,this,[[1,7]])}))),function(e,t){return r.apply(this,arguments)})},{key:"setCurrentDescription",value:(t=u(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:"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(";"))}}))}}]),d}(xL.exports.EventEmitter),zj={},qj=bu,Kj=Ut,Xj=Te,Wj=eu,Yj=Pt,Jj=Ie,Qj=Wa,Zj=we,$j=V_,eG=cc,tG=di,rG=es,nG=Zt,iG=_l,oG=uu,aG=qs,sG=ye,uG=ys.UNSUPPORTED_Y,cG=4294967295,dG=Math.min,lG=[].push,hG=Xj(/./.exec),fG=Xj(lG),pG=Xj("".slice),vG=!sG((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]}));Wj("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=rG(Zj(this)),i=void 0===r?cG:r>>>0;if(0===i)return[];if(void 0===e)return[n];if(!Qj(e))return Kj(t,n,e,i);for(var o,a,s,u=[],c=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.unicode?"u":"")+(e.sticky?"y":""),d=0,l=new RegExp(e.source,c+"g");(o=Kj(aG,l,n))&&!((a=l.lastIndex)>d&&(fG(u,pG(n,d,o.index)),o.length>1&&o.index<n.length&&qj(lG,u,iG(o,1)),s=o[0].length,d=a,u.length>=i));)l.lastIndex===o.index&&l.lastIndex++;return d===n.length?!s&&hG(l,"")||fG(u,""):fG(u,pG(n,d)),u.length>i?iG(u,0,i):u}:"0".split(void 0,0).length?function(e,r){return void 0===e&&0===r?[]:Kj(t,this,e,r)}:t,[function(t,r){var i=Zj(this),o=Jj(t)?void 0:nG(t,e);return o?Kj(o,t,i,r):Kj(n,rG(i),t,r)},function(e,i){var o=Yj(this),a=rG(e),s=r(n,o,a,i,n!==t);if(s.done)return s.value;var u=$j(o,RegExp),c=o.unicode,d=(o.ignoreCase?"i":"")+(o.multiline?"m":"")+(o.unicode?"u":"")+(uG?"g":"y"),l=new u(uG?"^(?:"+o.source+")":o,d),h=void 0===i?cG:i>>>0;if(0===h)return[];if(0===a.length)return null===oG(l,a)?[a]:[];for(var f=0,p=0,v=[];p<a.length;){l.lastIndex=uG?0:p;var _,m=oG(l,uG?pG(a,p):a);if(null===m||(_=dG(tG(l.lastIndex+(uG?p:0)),a.length))===f)p=eG(a,p,c);else{if(fG(v,pG(a,f,p)),v.length===h)return v;for(var y=1;y<=m.length-1;y++)if(fG(v,m[y]),v.length===h)return v;p=f=_}}return fG(v,pG(a,f)),v}]}),!vG,uG);var _G={},mG={exports:{}},yG=mG.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(yG).forEach((function(e){yG[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=mG.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 u=n[t][s];if(u.reg.test(i))return r(u,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}}))}))}}(_G);var gG=mG.exports,SG=/%[sdv%]/g,bG=function(e){var t=1,r=arguments,n=r.length;return e.replace(SG,(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""}}))},EG=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 bG.apply(null,n)},kG=["v","o","s","i","u","e","p","c","b","t","r","z","a"],TG=["i","c","b","a"],IG=_G,RG=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||kG,n=t.innerOrder||TG,i=[];return r.forEach((function(t){gG[t].forEach((function(r){r.name in e&&null!=e[r.name]?i.push(EG(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){i.push(EG(t,r,e))}))}))})),e.media.forEach((function(e){i.push(EG("m",gG.m[0],e)),n.forEach((function(t){gG[t].forEach((function(r){r.name in e&&null!=e[r.name]?i.push(EG(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){i.push(EG(t,r,e))}))}))}))})),i.join("\r\n")+"\r\n"};zj.write=RG,zj.parse=IG.parse,zj.parseParams=IG.parseParams,zj.parseFmtpConfig=IG.parseFmtpConfig,zj.parsePayloads=IG.parsePayloads,zj.parseRemoteCandidates=IG.parseRemoteCandidates,zj.parseImageAttributes=IG.parseImageAttributes,zj.parseSimulcastStreamList=IG.parseSimulcastStreamList;var AG=Math.pow(2,32),wG=function(){return Math.floor(Math.random()*AG+1e3)},CG=function(e,t,r){return r||(r=wG()),[{id:r,attribute:"cname",value:"kp34Za0H+aVf862l"},{id:r,attribute:"msid",value:"".concat(e.id," ").concat(e.id,"-").concat(t)},{id:r,attribute:"mslabel",value:"".concat(e.id)},{id:r,attribute:"label",value:"".concat(e.id,"-").concat(t)}]},OG=function(e,t){var r=wG(),n=wG();return{ssrcs:[r,n].reduce((function(r,n){return r.concat(CG(e,t,n))}),[]),ssrcGroups:[{semantics:"FID",ssrcs:"".concat(r," ").concat(n)}]}};function xG(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 NG=function(e,t,r){var n=i(i({},e),{},{invalid:[{value:"realx-exts:rscp"}],media:[t,r]});return delete n.groups,delete n.msidSemantic,zj.write(n)};function DG(e){return PG.apply(this,arguments)}function PG(){return(PG=u(o().mark((function e(t){var r,n,i,a;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r={},n=t.publicIPs,i=t.certFingerprint,a=t.iceParams,r.fingerprint={type:"sha-256",hash:i},r.icePwd=a.serverIcePwd,e.next=6,LG(a.serverIceUfrag);case 6:return r.iceUfrag=e.sent,r.candidates=MG(n),r.setup="active",r.iceOptions="renomination",e.abrupt("return",r);case 11:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function MG(e){if(!Array.isArray(e))return[];var t=0,r=2130706431,n=[];return e.forEach((function(e){var o={component:1,ip:e.ip,type:"host",generation:e.generation};e.udpPorts&&e.udpPorts.forEach((function(e){n.push(i(i({},o),{},{foundation:t++,transport:"udp",port:e,priority:r}))})),e.tcpPorts&&e.tcpPorts.forEach((function(e){n.push(i(i({},o),{},{foundation:t++,transport:"tcp",port:e,tcptype:"passive",priority:2130705431}))}))})),n}var LG=function(){var e=u(o().mark((function e(t){var r,n,i,a,s,u,c;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,pP.b64str2ab(t);case 5:return e.t1=e.sent,i=new e.t0(e.t1),a=new Uint8Array(4),crypto.getRandomValues(a),(s=new Uint8Array(2))[0]=0,s[1]=1,u=hP(Uint8Array,n,i,a,s),e.next=15,pP.ab2b64str(u.buffer);case 15:return c=e.sent,e.abrupt("return",c);case 17:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),UG=function(e,t){var r=0;if(Array.isArray(e.fmtp)&&Array.isArray(e.rtp)){var n,i=R(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(c){i.e(c)}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 u=[];e.rtp.forEach((function(e){return u.push(e.payload)})),e.payloads=u.join(" ")}},VG=Te,FG=tf,BG=ol.exports.getWeakData,jG=wh,GG=Pt,HG=Ie,zG=kt,qG=Ih,KG=Pe,XG=ln.set,WG=ln.getterFor,YG=Hi.find,JG=Hi.findIndex,QG=VG([].splice),ZG=0,$G=function(e){return e.frozen||(e.frozen=new eH)},eH=function(){this.entries=[]},tH=function(e,t){return YG(e.entries,(function(e){return e[0]===t}))};eH.prototype={get:function(e){var t=tH(this,e);if(t)return t[1]},has:function(e){return!!tH(this,e)},set:function(e,t){var r=tH(this,e);r?r[1]=t:this.entries.push([e,t])},delete:function(e){var t=JG(this.entries,(function(t){return t[0]===e}));return~t&&QG(this.entries,t,1),!!~t}};var rH,nH={getConstructor:function(e,t,r,n){var i=e((function(e,i){jG(e,o),XG(e,{type:t,id:ZG++,frozen:void 0}),HG(i)||qG(i,e[n],{that:e,AS_ENTRIES:r})})),o=i.prototype,a=WG(t),s=function(e,t,r){var n=a(e),i=BG(GG(t),!0);return!0===i?$G(n).set(t,r):i[n.id]=r,e};return FG(o,{delete:function(e){var t=a(this);if(!zG(e))return!1;var r=BG(e);return!0===r?$G(t).delete(e):r&&KG(r,t.id)&&delete r[t.id]},has:function(e){var t=a(this);if(!zG(e))return!1;var r=BG(e);return!0===r?$G(t).has(e):r&&KG(r,t.id)}}),FG(o,r?{get:function(e){var t=a(this);if(zG(e)){var r=BG(e);return!0===r?$G(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}},iH=se,oH=Te,aH=tf,sH=ol.exports,uH=$h,cH=nH,dH=kt,lH=wl,hH=ln.enforce,fH=jr,pH=!iH.ActiveXObject&&"ActiveXObject"in iH,vH=function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}},_H=uH("WeakMap",vH,cH);if(fH&&pH){rH=cH.getConstructor(vH,"WeakMap",!0),sH.enable();var mH=_H.prototype,yH=oH(mH.delete),gH=oH(mH.has),SH=oH(mH.get),bH=oH(mH.set);aH(mH,{delete:function(e){if(dH(e)&&!lH(e)){var t=hH(this);return t.frozen||(t.frozen=new rH),yH(this,e)||t.frozen.delete(e)}return yH(this,e)},has:function(e){if(dH(e)&&!lH(e)){var t=hH(this);return t.frozen||(t.frozen=new rH),gH(this,e)||t.frozen.has(e)}return gH(this,e)},get:function(e){if(dH(e)&&!lH(e)){var t=hH(this);return t.frozen||(t.frozen=new rH),gH(this,e)?SH(this,e):t.frozen.get(e)}return SH(this,e)},set:function(e,t){if(dH(e)&&!lH(e)){var r=hH(this);r.frozen||(r.frozen=new rH),gH(this,e)?bH(this,e,t):r.frozen.set(e,t)}else bH(this,e,t);return this}})}var EH=function(e){f(T,e);var t,r,n,i,a,s,d,p,v,_,y,S,b,E=g(T);function T(){var e;return c(this,T),h(m(e=E.call(this)),"inited",!1),h(m(e),"deviceMap",{audioinput:new Map,audiooutput:new Map,videoinput:new Map}),e._handleDeviceChange=e._handleDeviceChange.bind(m(e)),!fP()&&e.refreshDevices(),e}return l(T,[{key:"refreshDevices",value:(b=u(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=7;break}return e.next=6,navigator.mediaDevices.getUserMedia({audio:!0});case 6:t=e.sent;case 7:return e.next=9,navigator.mediaDevices.enumerateDevices();case 9: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 14:case"end":return e.stop()}}),e,this)}))),function(){return b.apply(this,arguments)})},{key:"initListener",value:(S=u(o().mark((function e(){var t,r=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:"function"==typeof(null===(t=navigator.mediaDevices)||void 0===t?void 0:t.addEventListener)&&navigator.mediaDevices.addEventListener("devicechange",(function(){r._handleDeviceChange(),setTimeout((function(){r._handleDeviceChange()}),300)}));case 1:case"end":return e.stop()}}),e)}))),function(){return S.apply(this,arguments)})},{key:"_handleDeviceChange",value:(y=u(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=e.sent,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(ie.onVideoDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"active"}):e.kind.includes("audio")&&i.emit(ie.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(ie.onVideoDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"inactive"}):e.kind.includes("audio")&&i.emit(ie.onAudioDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"inactive"}))}));case 12:case"end":return e.stop()}}),e,this)}))),function(){return y.apply(this,arguments)})},{key:"getVideoPermission",value:(_=u(o().mark((function e(){var t;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this._getVideoPermission(),e.next=3,this.refreshDevices();case 3:return e.abrupt("return",t);case 4:case"end":return e.stop()}}),e,this)}))),function(){return _.apply(this,arguments)})},{key:"_getVideoPermission",value:(v=u(o().mark((function e(){var t,r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._getNavigatorPermission("camera");case 2:if(!e.sent){e.next=4;break}return e.abrupt("return",!0);case 4:if(r=!1,null===(t=navigator.mediaDevices)||void 0===t||!t.getUserMedia){e.next=8;break}return e.next=8,navigator.mediaDevices.getUserMedia({audio:!1,video:!0}).then((function(e){e&&(e.getTracks().forEach((function(e){return e.stop()})),r=!0)})).catch((function(){}));case 8:return e.abrupt("return",r);case 9:case"end":return e.stop()}}),e,this)}))),function(){return v.apply(this,arguments)})},{key:"getAudioPermission",value:(p=u(o().mark((function e(){var t;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this._getAudioPermission(),e.next=3,this.refreshDevices();case 3:return e.abrupt("return",t);case 4:case"end":return e.stop()}}),e,this)}))),function(){return p.apply(this,arguments)})},{key:"_getAudioPermission",value:(d=u(o().mark((function e(){var t,r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._getNavigatorPermission("microphone");case 2:if(!e.sent){e.next=4;break}return e.abrupt("return",!0);case 4:if(r=!1,null===(t=navigator.mediaDevices)||void 0===t||!t.getUserMedia){e.next=8;break}return e.next=8,navigator.mediaDevices.getUserMedia({audio:!0,video:!1}).then((function(e){e&&(e.getTracks().forEach((function(e){return e.stop()})),r=!0)})).catch((function(){}));case 8:return e.abrupt("return",r);case 9:case"end":return e.stop()}}),e,this)}))),function(){return d.apply(this,arguments)})},{key:"enumerateDevices",value:(s=u(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._getVideoPermission();case 2:return e.next=4,this._getAudioPermission();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 s.apply(this,arguments)})},{key:"enumerateAudioCaptureDevices",value:(a=u(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._getAudioPermission();case 2:return e.abrupt("return",Array.from(this.deviceMap.audioinput.values()));case 3:case"end":return e.stop()}}),e,this)}))),function(){return a.apply(this,arguments)})},{key:"enumerateVideoCaptureDevices",value:(i=u(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._getVideoPermission();case 2:return e.abrupt("return",Array.from(this.deviceMap.videoinput.values()));case 3:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"enumerateAudioPlaybackDevices",value:(n=u(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._getAudioPermission();case 2:return e.abrupt("return",Array.from(this.deviceMap.audiooutput.values()));case 3:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"getDeviceById",value:(r=u(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 r.apply(this,arguments)})},{key:"_getNavigatorPermission",value:(t=u(o().mark((function e(t){var r,n,i,a;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=!1,null===(r=navigator.permissions)||void 0===r||!r.query){e.next=12;break}return e.prev=2,e.next=5,navigator.permissions.query({name:t});case 5:i=e.sent,a=i.state,n="granted"===a,e.next=12;break;case 10:e.prev=10,e.t0=e.catch(2);case 12:return e.abrupt("return",n);case 13:case"end":return e.stop()}}),e,null,[[2,10]])}))),function(e){return t.apply(this,arguments)})}]),T}(VL),kH=new EH,TH=function(){function e(){c(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}(),IH=function(){function e(t){c(this,e),h(this,"_ctx",void 0),h(this,"_analyserNode",void 0),h(this,"_audioSource",void 0);var r=RH.getAudioContextInstance();if(t instanceof MediaStreamTrack){var n=new MediaStream;n.addTrack(t),this._audioSource=r.createMediaStreamSource(n)}else t instanceof AudioNode?this._audioSource=t:(this._audioSource=r.createMediaElementSource(t),this._audioSource.connect(r.destination));var i=r.createAnalyser();this._audioSource.connect(i),this._analyserNode=i,this._ctx=r}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:"destroy",value:function(){this._audioSource.disconnect(),this._analyserNode.disconnect()}}]),e}(),RH=new TH,AH=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}(AH||{}),wH=function(){function e(){c(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=u(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=R(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}(),CH=new LL("VERTC",0),OH=new WeakMap,xH=function(e){f(r,e);var t=g(r);function r(e,n){var i;return c(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}(VL),NH=function(e){f(n,e);var t,r=g(n);function n(e,t,i){var o;return c(this,n),h(m(o=r.call(this,t,i)),"_mediaTrack",void 0),h(m(o),"_preProcessingTrack",void 0),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=u(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;return this._mediaTrack.onended=null,this._mediaTrack.onmute=null,this._mediaTrack.onunmute=null,null===(e=this._preProcessingTrack)||void 0===e||e.stop(),null===(t=this._mediaTrack)||void 0===t?void 0:t.stop()}},{key:"_initListeners",value:function(){var e=this;this._mediaTrack instanceof MediaStreamTrack&&this._mediaTrack.addEventListener("ended",(function(){IB.rtcError("track-ended mediaType: ".concat(e._mediaTrack.kind),-1001),e.emit("track-ended",e)}))}}]),n}(xH),DH=function(e){f(r,e);var t=g(r);function r(e,n,i){var o;return c(this,r),h(m(o=t.call(this,n,i)),"_mediaTrack",void 0),o._mediaTrack=e,o}return l(r,[{key:"getTrack",value:function(){return this._mediaTrack}}]),r}(xH),PH=function(e){f(n,e);var t,r=g(n);function n(e,t){var i;return c(this,n),h(m(i=r.call(this,e,t,"video")),"resolution",void 0),h(m(i),"videoCaptureConfig",void 0),h(m(i),"dummy",!1),i.resolution={width:0,height:0},i}return l(n,[{key:"updateVideoCaptureConfig",value:(t=u(o().mark((function e(){var t;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.videoCaptureConfig&&this.getTrack()){e.next=2;break}return e.abrupt("return");case 2:return CH.print("updateVideoEncoderConfig","update localVideoTrack: ",this.videoCaptureConfig),delete i({},this.videoCaptureConfig).contentHint,e.next=7,this.getTrack().applyConstraints(this.videoCaptureConfig);case 7:((t=this.getTrack().getSettings()).width&&t.width!==this.resolution.width||t.height&&t.height!==this.resolution.height)&&(this.resolution={width:t.width,height:t.height},this.emit("resolution-change",this.resolution));case 9:case"end":return e.stop()}}),e,this)}))),function(){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}(NH),MH=function(e){f(n,e);var t,r=g(n);function n(e,t){var i;return c(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",te.PLAYOUT_AND_PUBLISH),i}return l(n,[{key:"getAudioLevel",value:function(){return this._audioLevelFetcher||(this._audioLevelFetcher=new IH(this.getTrack("preprocessing"))),this._audioLevelFetcher.getAudioLevel()}},{key:"updateAudioCaptureConfig",value:(t=u(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 CH.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}(NH),LH=function(e){f(r,e);var t=g(r);function r(e,n){return c(this,r),t.call(this,e,n,"video")}return l(r)}(DH),UH=function(e){f(r,e);var t=g(r);function r(e,n){var i;return c(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 IH(this.getTrack())),this._audioLevelFetcher.getAudioLevel()}}]),r}(DH),VH=function(e){f(r,e);var t=g(r);function r(){var e;c(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",U.STREAM_INDEX_MAIN),e}return l(r)}(MH),FH=function(e){f(r,e);var t=g(r);function r(){var e;c(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",U.STREAM_INDEX_MAIN),e}return l(r)}(PH),BH=function(e){f(r,e);var t=g(r);function r(){var e;c(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",U.STREAM_INDEX_MAIN),h(m(e),"sourceType",0),e}return l(r)}(PH),jH=function(e){f(r,e);var t=g(r);function r(){var e;c(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",U.STREAM_INDEX_MAIN),h(m(e),"sourceType",0),e}return l(r)}(MH),GH=function(e){f(r,e);var t=g(r);function r(){var e;c(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",U.STREAM_INDEX_SCREEN),e}return l(r)}(PH),HH=function(e){f(r,e);var t=g(r);function r(){var e;c(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",U.STREAM_INDEX_SCREEN),e}return l(r)}(MH),zH=function(e){f(r,e);var t=g(r);function r(){var e;c(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",U.STREAM_INDEX_SCREEN),h(m(e),"sourceType",0),e}return l(r)}(PH),qH=function(e){f(r,e);var t=g(r);function r(){var e;c(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",U.STREAM_INDEX_SCREEN),h(m(e),"sourceType",0),e}return l(r)}(MH);function KH(e,t){return XH.apply(this,arguments)}function XH(){return(XH=u(o().mark((function e(t,r){var n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=new FH(t,dP())).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 WH(e,t){return YH.apply(this,arguments)}function YH(){return(YH=u(o().mark((function e(t,r){var n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=new GH(t,dP())).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 JH(e,t){return QH.apply(this,arguments)}function QH(){return(QH=u(o().mark((function e(t,r){var n,i,a,s,u,c;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,CH.print("createCameraVideoTrack","constraints:",t),IB.rtcVideoCaptureEvent({event_type:gB.START,media_device_id:a}),s=lP(),e.next=7,navigator.mediaDevices.getUserMedia({video:t});case 7:i=e.sent,IB.rtcVideoCaptureEvent({event_type:gB.START_CAPTURE_RESULT,media_device_id:a,reason:SB.SUCCESS,elapse:lP()-s}),kH.refreshDevices(),e.next=16;break;case 12:throw e.prev=12,e.t0=e.catch(1),IB.rtcVideoCaptureEvent({event_type:gB.RUNNING_FAILED,media_device_id:a,error_code:e.t0.code,reason:e.t0.name+e.t0.message}),new ZN(JN.GET_VIDEO_TRACK_FAILED,"throw error from getUserMedia",e.t0);case 16:return u=i.getVideoTracks()[0],OH.set(u,i),(c=new FH(u,dP())).videoCaptureConfig=t,e.next=22,c.generatePreProcessingTrack(r);case 22:return e.abrupt("return",c);case 23:case"end":return e.stop()}}),e,null,[[1,12]])})))).apply(this,arguments)}function ZH(e,t,r){return $H.apply(this,arguments)}function $H(){return($H=u(o().mark((function e(t,r,n){var i,a,s,u,c,d,l,h,f,p,v,_;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return CH.print("createCameraVideoTrack","constraints:",t),s=(null==t||null===(i=t.deviceId)||void 0===i?void 0:i.exact)||"default",u=(null==n?void 0:n.config)||{},c=u.sampleRate,d=u.channel,l=u.agc,h=u.ans,f=u.aec,void 0===t.sampleRate&&(t.sampleRate=c),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,IB.rtcVideoCaptureEvent({event_type:gB.START,media_device_id:s}),p=lP(),r.getPluginByName(AH.PRE_PROCESSING,"RTCAIAnsExtension")&&(t.autoGainControl=!0,t.noiseSuppression=!1),e.next=14,navigator.mediaDevices.getUserMedia({audio:t});case 14:a=e.sent,IB.rtcVideoCaptureEvent({event_type:gB.START_CAPTURE_RESULT,media_device_id:s,reason:SB.SUCCESS,elapse:lP()-p}),kH.refreshDevices(),e.next=23;break;case 19:throw e.prev=19,e.t0=e.catch(8),IB.rtcVideoCaptureEvent({event_type:gB.RUNNING_FAILED,media_device_id:s,error_code:e.t0.code,reason:e.t0.name+e.t0.message}),new ZN(JN.GET_AUDIO_TRACK_FAILED,"throw error from getUserMedia",e.t0);case 23:return v=a.getAudioTracks()[0],OH.set(v,a),_=new VH(v,dP()),e.next=28,_.generatePreProcessingTrack(r);case 28:return e.abrupt("return",_);case 29:case"end":return e.stop()}}),e,null,[[8,19]])})))).apply(this,arguments)}function ez(){return tz.apply(this,arguments)}function tz(){return tz=u(o().mark((function e(){var t,r,n,i,a,s,u,c,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,CH.print("createScreenTracks","withAudio: %o, constraints: %o",t,n),e.prev=4,IB.rtcVideoCaptureEvent({event_type:gB.START,media_device_id:"screen"}),a=lP(),e.next=9,navigator.mediaDevices.getDisplayMedia({video:!(n&&!gP)||n,audio:!!t&&{channelCount:2,noiseSuppression:!1,echoCancellation:!1,autoGainControl:!1}});case 9:i=e.sent,IB.rtcVideoCaptureEvent({event_type:gB.START_CAPTURE_RESULT,media_device_id:"screen",reason:SB.SUCCESS,elapse:lP()-a}),e.next=17;break;case 13:throw e.prev=13,e.t0=e.catch(4),IB.rtcVideoCaptureEvent({event_type:gB.RUNNING_FAILED,media_device_id:"screen",error_code:e.t0.code,reason:e.t0.name+e.t0.message}),new ZN(JN.GET_SCREEN_TRACK_FAILED,"throw error from getDisplayMedia",e.t0);case 17:return s=i.getVideoTracks()[0],u=new GH(s,dP()),e.next=21,u.generatePreProcessingTrack(r);case 21:if(!(c=i.getAudioTracks()[0])){e.next=27;break}return d=new HH(c,dP()),e.next=26,d.generatePreProcessingTrack(r);case 26:return e.abrupt("return",[u,d]);case 27:return e.abrupt("return",[u,void 0]);case 28:case"end":return e.stop()}}),e,null,[[4,13]])}))),tz.apply(this,arguments)}function rz(e,t){return nz.apply(this,arguments)}function nz(){return(nz=u(o().mark((function e(t,r){var n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new BH(t,dP()),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 iz(e,t){return oz.apply(this,arguments)}function oz(){return(oz=u(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,dP()),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 az(e,t){return sz.apply(this,arguments)}function sz(){return(sz=u(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,dP()),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 uz(e,t){return cz.apply(this,arguments)}function cz(){return(cz=u(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,dP()),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 dz=MH,lz=function(e){return e[e.NONE=0]="NONE",e}(lz||{}),hz=function(){function e(){c(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}(),fz=function(){function e(t){c(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}(),pz=function(e){return e[e.internal=0]="internal",e[e.external=1]="external",e[e.bypass=2]="bypass",e}(pz||{}),vz=new Uint8Array([109,167,53,190,103,90,72,1,170,89,63,164,194,199,19,85]),_z=new Uint8Array([109,167,53,190,103,90,72,1,170,89,63,164,194,199,19,84]),mz=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 yz(e){for(var t=[];e>=255;)e-=255,t.push(255);return t.push(e),new Uint8Array(t)}function gz(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 Sz=function(){function e(){c(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?vz:_z,a=yz(e.byteLength+o.byteLength),s=mz(e);return new Uint8Array([].concat(k(r),k(n),k(i),k(a),k(o),k(s),[128]))}},{key:"decodeSeiBody",value:function(e){var t=function(e){for(var t=[],r=0;r<e.length;r++)e[r]<=3&&0===e[r-1]&&0===e[r-2]||t.push(e[r]);return new Uint8Array(t)}(e=e.slice(0,e.length-1));if(!(t.byteLength<2)){var r=0;if(5===t[1]||100===t[1]){var n=E(gz(t,r+=2),2),i=n[0],o=2,a=(r=n[1])+i;return t.byteLength>=_z.byteLength&&i>=_z.byteLength&&t.slice(r,r+_z.byteLength).toString()===_z.toString()?(r+=_z.byteLength,o=1):t.byteLength>=_z.byteLength&&i>=_z.byteLength&&t.slice(r,r+vz.byteLength).toString()===vz.toString()&&(r+=vz.byteLength,o=0),{type:o,payload:t.slice(r,a)}}}}},{key:"parseInternalSEI",value:function(e){var t=new Map,r=0;if(0===e.type){for(;e.payload.byteLength-r>=2;){var n=E(gz(e.payload,r),2),i=n[0];r=n[1];var o=E(gz(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=R(e);try{for(n.s();!(t=n.n()).done;){var i=E(t.value,2),o=i[0],a=i[1],s=yz(o),u=yz(a.byteLength);r.push(s,u,a)}}catch(l){n.e(l)}finally{n.f()}var c=r.reduce((function(e,t){return e+t.byteLength}),0),d=new Uint8Array(c);return r.reduce((function(e,t){return d.set(t,e),e+t.byteLength}),0),d}}]),e}(),bz=function(){function e(t){c(this,e),h(this,"_stream",void 0),h(this,"_timer",void 0),h(this,"player",void 0),h(this,"client",void 0),h(this,"handler",void 0),h(this,"monitor",void 0),this._stream=t}return l(e,[{key:"setVar",value:function(e,t,r){this.client=e,this.handler=t,this.monitor=r}},{key:"delStatsEvtInterval",value:function(){clearTimeout(this._timer),this._timer=void 0}},{key:"filterIllegal",value:function(e){var t={};return Object.keys(e).forEach((function(r){null===e[r]||void 0===e[r]||Number.isNaN(e[r])||(t[r]=e[r])})),t}},{key:"destroy",value:function(){this.delStatsEvtInterval()}}]),e}(),Ez=function(e){f(i,e);var t,r,n=g(i);function i(e){var t;return c(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(cj.ABNORMAL_DISCONNECTION,(function(){s.destroy()}));var c={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,c,null===(a=d.audioTrack)||void 0===a?void 0:a.getAudioLevel()),this.getVideoStats(h,c),this.delStatsEvtInterval();var f=function(){var e=u(o().mark((function e(){var t,r,n,i,a,u,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,c,null===(n=d.audioTrack)||void 0===n?void 0:n.getAudioLevel());case 4:return u=e.sent,e.next=7,s.getVideoStats(a,c);case 7:return l=e.sent,e.abrupt("return",{audioStats:u,videoStats:l,isScreen:d.isScreen});case 9:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),p=function(){var e=u(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=setTimeout(p,2e3);case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();this._timer=setTimeout(p,2e3)}}},{key:"unpublish",value:function(){this.delStatsEvtInterval()}},{key:"getAudioStats",value:(r=u(o().mark((function e(t,r,n){var i,a,s,u,c,d,l,h,f,p;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i={},a={timestamp:Date.now()},s=this._stream,u=s.streamId,c=s.audioMid,d=s.isScreen,l=s.pubAttributes,h={media_type:"audio",is_screen:!!d,direction:"up",stream_id:u,vid:c,connection_status:navigator.onLine,capture_state:l.localaudio?"capture_state_on":"capture_state_off"},t&&this.handler){e.next=6;break}return e.abrupt("return",i);case 6:return e.next=8,this.handler.getStats(t);case 8:if((f=e.sent).length){e.next=11;break}return e.abrupt("return",i);case 11:if(f.forEach((function(e){var t=e.type,r=e.packetsSent,n=e.packetsLost,o=e.bytesSent,s=e.clockRate,u=e.roundTripTime,c=e.channels,d=e.audioLevel;e.googRtt;var l=e.mimeType,f=e.availableIncomingBitrate,p=e.availableOutgoingBitrate,v=e.bytesReceived,_=e.nominated,m=e.id,y=e.currentRoundTripTime,g=e.state,S=e.writable,b=e.requestsReceived,E=e.responsesReceived,k=e.requestsSent,T=e.consentRequestsSent,I=e.responsesSent,R=e.jitter,A=e.candidateType,w=e.ip,C=e.address,O=e.networkType,x=e.port,N=e.protocol,D=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,h.bytes=o,h.packetsSent=r,h.nackCount=D,h.ssrc=U,h.retransmitted_bytes_sent=P,h.retransmitted_packets_sent=M,a.retransmittedBytesSent=P,a.retransmittedPacketsSent=M):"remote-inbound-rtp"===t?(a.packetsLost=n,h.packetsLost=n,h.net_jitter=1e3*R,i.rtt=1e3*u,h.rtt=i.rtt,i._fractionLost=j||0):"codec"===t?(i.recordSampleRate=s,i.numChannels=c,h.codecName=l):"media-source"===t&&void 0!==d?(h.audio_level=d?-10*Math.log10(Math.pow(d,2)):d,h.volume=255*d,h.total_audio_energy=V,h.totalInputDuration=F):"ssrc"===t&&"audio"===B?h.send_level=L:"candidate-pair"===t?(h.ice_available_incoming_bitrate=f,h.ice_available_outgoing_bitrate=p,h.ice_bytes_received=v,h.ice_bytes_sent=o,h.ice_nominated=+_,h.ice_pair_id=m,h.ice_pair_rtt=y,h.ice_pair_state=g,h.ice_pair_writable=S,h.recv_ping_requests=b,h.recv_ping_responses=E,h.sent_ping_requests_before_first_response=k,h.sent_ping_requests_total=k+(T||0),h.sent_ping_responses=I):"local-candidate"===t?(h.local_candidate_type=A,h.local_ip=w||C,h.local_network_type=O,h.local_port=x,h.protocol=N):"remote-candidate"===t&&(h.remote_candidate_type=A,h.remote_ip=w||C,h.remote_port=x);var G=ZB("STATS_SCALLBACK_SUPPORT");mP&&G||"media-source"===t&&(h.send_level=d)})),void 0===h.volume&&void 0!==n&&(h.volume=n,h.audio_level=n?-10*Math.log10(Math.pow(n/255,2)):n),(p=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-p.packetsLost)/(a.packetsSent-p.packetsSent),i.audioLossRate=Number.isNaN(i.audioLossRate)?0:i.audioLossRate,h.fraction_lost=i.audioLossRate),i.statsInterval=a.timestamp-p.timestamp,h.stats_interval=i.statsInterval,i.sendKBitrate=(a.bytesSent-p.bytesSent||0)/i.statsInterval*8,h.mediaBitratebps=Math.round(1e3*i.sendKBitrate),h.bandwidth=Math.round(h.mediaBitratebps/1024),void 0!==a.retransmittedBytesSent&&(h.retransmitBitratebps=(a.retransmittedBytesSent-p.retransmittedBytesSent||0)/i.statsInterval),r.audio=a,this.monitor.rtcMediaStatistics(h,{}),i._retransmittedRate=(a.retransmittedPacketsSent-p.retransmittedPacketsSent)/(a.packetsSent-p.packetsSent),i._fractionLost=Math.max(i._fractionLost,i.audioLossRate),e.abrupt("return",this.filterIllegal(i));case 29:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return r.apply(this,arguments)})},{key:"getVideoStats",value:(t=u(o().mark((function e(t,r){var n,i,a,s,u,c,d,l,h,f,p,v,_,m;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n={},i={timestamp:Date.now(),simulcast:{}},a=this._stream,s=a.streamId,u=a.videoMid,c=a.isScreen,d=a.pubAttributes,l=a.enableSimulcast,h={media_type:"video",is_screen:!!c,direction:"up",stream_id:s,vid:u,connection_status:navigator.onLine,capture_state:d.localvideo?"capture_state_on":"capture_state_off"},t&&this.handler){e.next=6;break}return e.abrupt("return",n);case 6:return n.isScreen=c,e.next=9,this.handler.getStats(t);case 9:if((f=e.sent).length){e.next=12;break}return e.abrupt("return",n);case 12:if(p=0,f.forEach((function(e){var o=e.type,a=e.framesEncoded,s=e.packetsLost,u=e.bytesSent,c=e.framesSent,d=e.retransmittedBytesSent,f=e.totalPacketSendDelay,v=e.totalEncodeTime,_=e.firCount,m=e.qualityLimitationReason,y=e.targetBitrate,g=e.roundTripTime,S=e.mimeType,b=e.frameWidth,E=e.frameHeight,k=e.packetsSent,T=e.googActualEncBitrate,I=e.googAvailableReceiveBandwidth,R=e.googAvailableSendBandwidth,A=e.googAvgEncodeMs,w=e.googBucketDelay,C=e.googEncodeUsagePercent,O=e.googFrameRateInput,x=e.availableIncomingBitrate,N=e.availableOutgoingBitrate,D=e.bytesReceived,P=e.nominated,M=e.id,L=e.currentRoundTripTime,U=e.state,V=e.writable,F=e.candidateType,B=e.ip,j=e.address,G=e.networkType,H=e.port,z=e.nackCount,q=e.pliCount,K=e.protocol,X=e.qpSum,W=e.requestsReceived,Y=e.responsesReceived,J=e.googRetransmitBitrate,Q=e.requestsSent,Z=e.consentRequestsSent,$=e.responsesSent,ee=e.ssrc,te=e.googTargetEncBitrate,re=e.googTransmitBitrate,ne=e.retransmittedPacketsSent,ie=e.encoderImplementation,oe=e.jitter,ae=e.rid,se=e.fractionLost,ue=e.googAdaptationChanges,ce=e.googBandwidthLimitedResolution,de=e.googCpuLimitedResolution,le=e.googFirsReceived,he=e.googFrameRateSent;"outbound-rtp"===o?(l&&(ae?i.simulcast[ae]=e:i.simulcast[p]=e,p++),i.framesEncoded=a,i.bytesSent=u,i.framesSent=c,h.bytes=u,i.packetsSent=k,i.retransmittedBytesSent=d,h.packetsSent=k,h.nackCount=z,h.pli_count=q,h.qp_sum=X,h.ssrc=ee,h.retransmitted_packets_sent=ne,i.retransmittedPacketsSent=ne,h.encoder_implementation=ie,void 0!==b&&(n.encodedFrameWidth=b,n.encodedFrameHeight=E,h.frame_size_height=E,h.frame_size_width=b)):"track"===o?(n.encodedFrameWidth=b,n.encodedFrameHeight=E,h.frame_size_height=E,h.frame_size_width=b):"remote-inbound-rtp"===o?(i.packetsLost=s,n.rtt=1e3*g,h.rtt=n.rtt,h.jitter=oe,h.packetsLost=s,n._fractionLost=se||0):"codec"===o?(n.codecType=S,h.codecName=S):"candidate-pair"===o?(h.ice_available_incoming_bitrate=x,h.ice_available_outgoing_bitrate=N,h.ice_bytes_received=D,h.ice_bytes_sent=u,h.ice_nominated=+P,h.ice_pair_id=M,h.ice_pair_rtt=L,h.ice_pair_state=U,h.ice_pair_writable=V,h.recv_ping_requests=W,h.recv_ping_responses=Y,h.sent_ping_requests_before_first_response=Q,h.sent_ping_requests_total=Q+Z,h.sent_ping_responses=$):"local-candidate"===o?(h.local_candidate_type=F,h.local_ip=B||j,h.local_network_type=G,h.local_port=H,h.protocol=K):"remote-candidate"===o?(h.remote_candidate_type=F,h.remote_ip=B||j,h.remote_port=H):"VideoBwe"===o?(h.encBitratebps=T,h.available_receive_bandwidth=I,h.available_send_bandwidth=R,h.bucket_delay=w,h.retransmitBitratebps=J,h.targetEncBitratebps=te,h.transmit_bitrate=re,n._sendBandWidth=+R):"ssrc"===o&&(h.avg_encode_ms=A,h.encodeUsage=C,h.frame_rate_input=O,h.orignal_input_Framerate=+O,h.ddaptationChanges=ue,h.qualityLimitationReason=ce,h.qualityLimitationDurations=de,h.firsReceived=le,h.frameRateSent=he);var fe=ZB("STATS_SCALLBACK_SUPPORT");if(!mP||!fe){var pe=r.video,ve=i.timestamp-pe.timestamp;if("outbound-rtp"===o){var _e=u-pe.bytesSent,me=d-pe.retransmittedBytesSent;h.encBitratebps=Math.round(8e3*(_e-me)/ve),h.bucket_delay=f/k,h.retransmitBitratebps=Math.round(8e3*me/ve),h.targetEncBitratebps=y,h.transmit_bitrate=Math.round(1e3*(u-pe.bytesSent)*8/ve),h.avg_encode_ms=1e3*v/a,h.firsReceived=_+q,h.qualityLimitationReason="bandwidth"===m,h.qualityLimitationDurations="cpu"===m}else"candidate-pair"===o&&(h.available_send_bandwidth=N,n._sendBandWidth=N);if(t){var ye=null==t?void 0:t.getSettings().frameRate;h.orignal_input_Framerate=ye,h.frameRateSent=t.getSettings().frameRate}}})),(v=r.video).timestamp){e.next=18;break}return r.video=i,e.abrupt("return",this.filterIllegal(n));case 18:return n.statsInterval=i.timestamp-v.timestamp,h.stats_interval=n.statsInterval,_=Object.keys(i.simulcast),l?(h.sim_enc_width=[],h.sim_enc_height=[],h.sim_enc_bps=[],h.sim_enc_framerate=[],h.sim_rids=[],h.sim_enc_bandwidth=[],h.sim_sent_framerate=[],h.sim_fraction_lost=[],h.sim_keyencoded=[],h.active_sim_streams=[],h.sim_retransmittedRate=[],m=!1,_.sort((function(e,t){return+e-+t})).forEach((function(e){var t=i.simulcast[e],r=t.frameWidth,o=t.frameHeight,a=t.bytesSent,s=t.framesEncoded,u=t.framesSent,c=t.packetsLost,d=t.packetsSent,l=t.qualityLimitationReason,f=t.qualityLimitationDurations,p=t.qualityLimitationResolutionChanges,_=t.retransmittedPacketsSent,y=t.pliCount;void 0!==l&&(h.sim_qualityLimitationReason||(h.sim_qualityLimitationReason=[],h.sim_qualityLimitationDurations=[],h.sim_qualityLimitationResolutionChanges=[]),h.sim_qualityLimitationReason.push(l),h.sim_qualityLimitationDurations.push(f),h.sim_qualityLimitationResolutionChanges.push(p));var g=v.simulcast[e];if(h.sim_enc_width.push(r||0),h.sim_enc_height.push(o||0),g){var S=(a-g.bytesSent||0)/n.statsInterval;h.sim_enc_bps.push(Math.round(8e3*S)),h.sim_enc_bandwidth.push(Math.round(8e3*S/1024));var b=1e3*(s-g.framesEncoded)/n.statsInterval;h.sim_enc_framerate.push(Math.round(b)),h.sim_rids.push(e);var E=void 0!==u?u-g.framesSent:s-g.framesEncoded,k=1e3*E/n.statsInterval;h.sim_sent_framerate.push(Math.round(k));var T=(c-g.packetsLost)/(d-g.packetsSent);n._retransmittedRate=(_-g.retransmittedPacketsSent)/(d-g.packetsSent),T=Number.isNaN(T)?0:T,h.sim_fraction_lost.push(T),h.sim_keyencoded.push(y-g.pliCount>0),h.active_sim_streams.push(S>=0),h.sim_retransmittedRate.push(n._retransmittedRate),r>0&&!m&&(n.sentKBitrate=8*S,n.encoderOutputFrameRate=b,n.encodedFrameCount=E,n.sentFrameRate=k,n.videoLossRate=T,m=!0)}})),this.monitor.rtcMediaStatistics(h,{})):(n.encodedFrameCount=void 0!==i.framesSent?i.framesSent-v.framesSent:i.framesEncoded-v.framesEncoded,n.sentKBitrate=(i.bytesSent-v.bytesSent||0)/n.statsInterval*8,h.bitrate=Math.round(1e3*n.sentKBitrate),h.bandwidth=Math.round(h.bitrate/1024),n.encoderOutputFrameRate=1e3*(i.framesEncoded-v.framesEncoded)/n.statsInterval,h.frame_rate_encoded=Math.round(n.encoderOutputFrameRate),n.sentFrameRate=1e3*n.encodedFrameCount/n.statsInterval,h.frame_rate_sent=Math.round(n.sentFrameRate),n.videoLossRate=(i.packetsLost-v.packetsLost)/(i.packetsSent-v.packetsSent),n.videoLossRate=Number.isNaN(n.videoLossRate)?0:n.videoLossRate,h.fraction_lost=n.videoLossRate,n._retransmittedRate=(i.retransmittedPacketsSent-v.retransmittedPacketsSent)/(i.packetsSent-v.packetsSent),this.monitor.rtcMediaStatistics(h,{})),r.video=i,n._fractionLost=Math.max(n._fractionLost,n.videoLossRate),e.abrupt("return",this.filterIllegal(n));case 25:case"end":return e.stop()}}),e,this)}))),function(e,r){return t.apply(this,arguments)})}]),i}(bz),kz=function(e){f(a,e);var t,r,n,i=g(a);function a(e){var t;return c(this,a),h(m(t=i.call(this,e)),"_audioStallCount",void 0),h(m(t),"_setAudioStallCount",void 0),h(m(t),"_audioStallTimer",void 0),h(m(t),"_audioStallInterval",void 0),h(m(t),"_audioStallRatio",void 0),h(m(t),"_videoInWaiting",void 0),h(m(t),"_context",void 0),t._videoInWaiting=!1,t}return l(a,[{key:"setRemoteStreamStatsEvtInterval",value:(n=u(o().mark((function e(t,r,n,i){var s,c,d,l,h,f,p,v,_,m,y,g,S,b,E=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._timer){e.next=2;break}return e.abrupt("return");case 2:return this.setVar(t,r,n),this._context=i,t.once(cj.ABNORMAL_DISCONNECTION,(function(){E.destroy()})),this._audioStallInterval=a.audioStallInterval||100,this._audioStallRatio=a.audioStallRatio||.6,d={audio:{},video:{}},l=this._stream,h=null===(s=l.audioTrack)||void 0===s?void 0:s.getTrack(),f=null===(c=l.videoTrack)||void 0===c?void 0:c.getTrack(),this.getRemoteVideoStats(f,d),e.next=14,this.getRemoteAudioStats(h,d);case 14:this.delStatsEvtInterval(),p=0,v=0,m=[],y=0,g=lP(),this._setAudioStallCount=function(){if(E._audioStallInterval>0&&void 0!==d.audio.concealedSamples){var e=d.audio.concealedSamples,t=d.audio.totalSamplesReceived;g=lP();var r={isStall:!1,counted:!1,diff:0},n=.5*E._audioStallInterval;E._audioStallCount=u(o().mark((function i(){var a,s,u,c,d,h,f,_,S,b,k,T,I,R,A;return o().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(s=l.hasAudio,u=l.subAudio,s&&u){i.next=7;break}return r.isStall=!1,r.counted=!1,m.push({reason:"hasAudio: ".concat(s,", subAudio: ").concat(u)}),g=lP(),i.abrupt("return",{stall_count:p,stall_duration:v,stall_list:m,stats_count:y});case 7:return c=null===(a=l.audioTrack)||void 0===a?void 0:a.getTrack(),d=Date.now(),i.next=11,E.handler.getStats(c,!0);case 11:if(h=i.sent,f=Date.now(),_=lP(),!((S=_-g)<n)){i.next=18;break}return m.push({diff:S,start:g,end:_,get_stats_cost:f-d,get_stats_start:d,get_stats_end:f,reason:"diff(".concat(S,") < minInterval(").concat(n,")")}),i.abrupt("return",{stall_count:p,stall_duration:v,stall_list:m,stats_count:y});case 18:if(b=h.length,k=h.find((function(e){return"inbound-rtp"===e.type}))){i.next=23;break}return m.push({diff:S,start:g,end:_,get_stats_cost:f-d,get_stats_start:d,get_stats_end:f,reason:b?"no inbound-rtp":"no report"}),i.abrupt("return",{stall_count:p,stall_duration:v,stall_list:m,stats_count:y});case 23:return T=k.concealedSamples,I=k.totalSamplesReceived,A=I-t,(R=T-e)>=0&&A>=0&&R>=E._audioStallRatio*A?(m.push({concealed:R,received:A,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:R,received:A,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=u(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!E._audioStallCount&&E._setAudioStallCount&&E._setAudioStallCount(),!E._audioStallCount){e.next=5;break}return e.next=4,E._audioStallCount();case 4:E._audioStallTimer=setTimeout(_,E._audioStallInterval);case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),clearTimeout(E._audioStallTimer),E._audioStallTimer=setTimeout(_,E._audioStallInterval)}},this._setAudioStallCount(),S=function(){var e=u(o().mark((function e(){var t,r,n,i,a,s;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=null===(t=l.audioTrack)||void 0===t?void 0:t.getTrack(),i=null===(r=l.videoTrack)||void 0===r?void 0:r.getTrack(),e.next=4,E.getRemoteAudioStats(n,d);case 4:return a=e.sent,p=0,v=0,m=[],y=0,e.next=11,E.getRemoteVideoStats(i,d);case 11:return s=e.sent,e.abrupt("return",{audioStats:a,videoStats:s,isScreen:l.isScreen,userId:l.userId});case 13:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),b=function(){var e=u(o().mark((function e(){var t,r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,S();case 2:r=e.sent,null===(t=E.client)||void 0===t||t.emit("onRemoteStreamStats",r),_&&(g=lP(),clearTimeout(E._audioStallTimer),E._audioStallTimer=setTimeout(_,E._audioStallInterval)),E._timer=setTimeout(b,2e3);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),this._timer=setTimeout(b,2e3);case 25:case"end":return e.stop()}}),e,this)}))),function(e,t,r,i){return n.apply(this,arguments)})},{key:"delStatsEvtInterval",value:function(){b(p(a.prototype),"delStatsEvtInterval",this).call(this),clearTimeout(this._audioStallTimer),this._audioStallCount=void 0,this._setAudioStallCount=void 0}},{key:"unsubscribe",value:function(){this.delStatsEvtInterval(),this._videoInWaiting=!1}},{key:"getRemoteAudioStats",value:(r=u(o().mark((function e(t,r){var n,i,a,s,u,c,d,l,h,f,p,v,_,m,y,g,S,b,E=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n={},i={},a=this._stream,s=a.streamId,u=a.userId,c=a.isScreen,d=a.audioMid,l=a.subMediaType,h=a._attributes,f={media_type:"audio",is_screen:!!c,direction:"down",stream_id:s,stream_user_id:u,vid:d,connection_status:navigator.onLine,mute_state:wP(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((p=e.sent).length){e.next=11;break}return e.abrupt("return",n);case 11:if(p.forEach((function(e){var t=e.type,r=e.packetsLost,o=e.packetsReceived,a=e.bytesReceived,u=e.jitterBufferDelay,c=e.jitterBufferEmittedCount,d=e.clockRate,l=e.channels,h=e.totalSamplesReceived,p=e.concealedSamples,v=e.silentConcealedSamples,_=e.concealmentEvents,m=e.totalRoundTripTime,y=e.packetsDiscarded,g=e.state,S=e.currentRoundTripTime,b=e.audioLevel,k=e.totalAudioEnergy,T=e.totalSamplesDuration,I=e.mimeType,R=e.googDecodingNormal,A=e.availableIncomingBitrate,w=e.availableOutgoingBitrate,C=e.bytesSent,O=e.nominated,x=e.id,N=e.writable,D=e.jitter,P=e.candidateType,M=e.ip,L=e.address,U=e.networkType,V=e.port,F=e.protocol,B=e.audioOutputLevel,j=e.requestsReceived,G=e.responsesReceived,H=e.requestsSent,z=e.consentRequestsSent,q=e.responsesSent,K=e.ssrc;e.kind;var X=e.nackCount,W=e.lastPacketReceivedTimestamp,Y=e.concealmentevents,J=e.fecPacketsReceived;if("inbound-rtp"===t)i.packetsLost=r,i.packetsReceived=o,f.packetsReceived=o,f.packetsDiscarded=y,f.nackCount=X,f.lastPacketReceivedTimestamp=W,f.concealmentevents=Y,i.bytesReceived=a,void 0!==u&&(n.jitterBufferDelay=u/c*1e3,f.average_jitter_buffer_delay_ms=n.jitterBufferDelay),void 0!==h&&(i.totalSamplesReceived=h,n.concealedSamples=p,i.concealedSamples=p,i.silentConcealedSamples=v,f.concealedSamples=p,n.concealmentEvents=_,f.totalSamplesReceived=h),void 0!==J&&(f.fec_packets_received=J,i.fecPacketsReceived=J),f.jitter=1e3*D,f.ssrc=K,void 0!==b&&(f.audio_level=b?-10*Math.log10(Math.pow(b,2)):b),void 0!==b&&(f.volume=255*b),void 0!==k&&(f.total_audio_energy=k),void 0!==T&&(f.totalAudioDuration=T);else if("codec"===t)n.recordSampleRate=d,l&&(n.numChannels=l),f.codecName=I;else if("candidate-pair"===t){var Q,Z,$;f.ice_available_incoming_bitrate=A,f.ice_available_outgoing_bitrate=w,f.ice_bytes_received=a,f.ice_bytes_sent=C,f.ice_nominated=+O,f.ice_pair_id=x,f.ice_pair_rtt=S,f.rtt=1e3*S,f.rtt&&null!==(Q=E._context)&&void 0!==Q&&null!==(Z=Q.streamRTT)&&void 0!==Z&&null!==($=Z[s])&&void 0!==$&&$.audio&&(f.total_rtt_ms=f.rtt+E._context.streamRTT[s].audio),f.ice_pair_state=g,f.ice_pair_writable=N,f.recv_ping_requests=j,f.recv_ping_responses=G,f.sent_ping_requests_before_first_response=H,f.sent_ping_requests_total=H+(z||0),f.sent_ping_responses=q,"succeeded"===g&&(n.rtt=1e3*S,n.total_rtt=1e3*m)}else"track"===t&&void 0!==b?(f.audio_level=b?-10*Math.log10(Math.pow(b,2)):b,f.volume=255*b,f.total_audio_energy=k,f.totalAudioDuration=T):"ssrc"===t?(f.decodingNormal=R,f.recvAudioLevel=B):"local-candidate"===t?(f.local_candidate_type=P,f.local_ip=M||L,f.local_network_type=U,f.local_port=V,f.protocol=F):"remote-candidate"===t&&(f.remote_candidate_type=P,f.remote_ip=M||L,f.remote_port=V)})),(v=r.audio).timestamp){e.next=17;break}return i.timestamp=Date.now(),r.audio=i,e.abrupt("return",this.filterIllegal(n));case 17:if(_={},void 0!==i.concealedSamples&&(f.interval_concealed_samples=i.concealedSamples-v.concealedSamples,f.interval_samples_received=i.totalSamplesReceived-v.totalSamplesReceived,f.interval_silent_concealed_samples=i.silentConcealedSamples-v.silentConcealedSamples),!(this._audioStallInterval>0&&void 0!==v.concealedSamples)){e.next=35;break}if(!this._audioStallCount&&this._setAudioStallCount&&this._setAudioStallCount(),clearTimeout(this._audioStallTimer),!this._audioStallCount){e.next=35;break}return e.next=25,this._audioStallCount();case 25:m=e.sent,y=m.stall_count,g=m.stall_duration,S=m.stall_list,b=m.stats_count,_.stall_list=S,_.stats_count=b,f.concealedSamples===f.interval_concealed_samples&&f.totalSamplesReceived===f.interval_samples_received?(f.stall_count=0,f.stall_duration=0):(f.stall_count=y,f.stall_duration=g),n.stallCount=f.stall_count,n.stallDuration=f.stall_duration;case 35:return i.timestamp=Date.now(),n.audioLossRate=(i.packetsLost-v.packetsLost)/(i.packetsReceived-v.packetsReceived+(i.packetsLost-v.packetsLost)),n.audioLossRate=Number.isNaN(n.audioLossRate)?0:n.audioLossRate,f.packetsLost=Math.round(i.packetsLost-v.packetsLost),f.fraction_lost=n.audioLossRate,n.statsInterval=i.timestamp-v.timestamp,f.stats_interval=n.statsInterval,n.receivedKBitrate=(i.bytesReceived-v.bytesReceived||0)/n.statsInterval*8,f.bandwidth=Math.round(1e3*n.receivedKBitrate/1024),void 0!==i.concealedSamples&&(n.receivedSampleRate=1e3*f.interval_samples_received/n.statsInterval),void 0!==i.fecPacketsReceived&&(f.fecBitratebps=(i.fecPacketsReceived-v.fecPacketsReceived||0)/n.statsInterval),r.audio=i,this.monitor.rtcMediaStatistics(f,{},_),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=u(o().mark((function e(t,r){var n,i,a,s,u,c,d,l,h,f,p,v=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n={},i={timestamp:Date.now()},a=this._stream,s=a.streamId,u=a.userId,c=a.isScreen,d=a.subMediaType,l=a._attributes,h={media_type:"video",is_screen:!!c,direction:"down",stream_id:s,stream_user_id:u,vid:this._stream.videoMid,connection_status:navigator.onLine,mute_state:CP(d)?"mute_state_off":"mute_state_on",remote_user_capture_state:l.localvideo?"capture_state_on":"capture_state_off",remote_user_mute_state:l.localvideo&&l.videostream?"mute_state_off":"mute_state_on"},t&&this.handler){e.next=6;break}return e.abrupt("return",n);case 6:return n.isScreen=c,e.next=9,this.handler.getStats(t);case 9:if((f=e.sent).length){e.next=12;break}return e.abrupt("return",n);case 12:if(f.forEach((function(e){var t=e.type,r=e.frameHeight,o=e.frameWidth,a=e.packetsLost,u=e.packetsReceived,c=e.bytesReceived,d=e.framesDecoded,l=e.jitterBufferDelay,f=e.jitterBufferEmittedCount,p=e.mimeType,_=e.firCount,m=e.availableIncomingBitrate,y=e.availableOutgoingBitrate,g=e.bytesSent,S=e.nominated,b=e.id,E=e.currentRoundTripTime,k=e.state,T=e.writable,I=e.candidateType,R=e.ip,A=e.address,w=e.networkType,C=e.port,O=e.nackCount,x=e.pliCount,N=e.protocol,D=e.requestsReceived,P=e.responsesReceived,M=e.requestsSent,L=e.consentRequestsSent,U=e.responsesSent,V=e.ssrc,F=e.jitter,B=e.framesReceived,j=e.keyFramesDecoded,G=e.decoderImplementation,H=e.lastPacketReceivedTimestamp;if("inbound-rtp"===t)i.packetsLost=a,h.packetsLost=a,i.packetsReceived=u,h.packetsReceived=u,i.bytesReceived=c,h.bytes=c,i.framesDecoded=d,void 0!==l&&(i.jitterBufferDelay=l/f*1e3,h.average_jitter_buffer_delay_ms=i.jitterBufferDelay),h.fir_count=_,h.nackCount=O,i.nackCount=O,h.pli_count=x,h.ssrc=V,h.jitter=F,h.framesReceived=B,i.framesReceived=B,h.framesDecoded=d,h.key_frames_decoded=j,h.decoder_name=G,h.last_packet_received_timestamp=H,void 0!==o&&(n.width=o,h.frame_size_width=o,n.height=r,h.frame_size_height=r);else if("track"===t&&void 0!==o)n.width=o,h.frame_size_width=o,n.height=r,h.frame_size_height=r,void 0!==B&&(h.framesReceived=B,i.framesReceived=B);else if("codec"===t)h.codecName=p;else if("candidate-pair"===t){var z,q,K;h.ice_available_incoming_bitrate=m,h.ice_available_outgoing_bitrate=y,h.ice_bytes_received=c,h.ice_bytes_sent=g,h.ice_nominated=+S,h.ice_pair_id=b,h.ice_pair_rtt=E,h.rtt=1e3*E,h.rtt&&null!==(z=v._context)&&void 0!==z&&null!==(q=z.streamRTT)&&void 0!==q&&null!==(K=q[s])&&void 0!==K&&K.video&&(h.total_rtt_ms=h.rtt+v._context.streamRTT[s].video),n.rtt=h.rtt,h.ice_pair_state=k,h.ice_pair_writable=T,h.recv_ping_requests=D,h.recv_ping_responses=P,h.sent_ping_requests_before_first_response=M,h.sent_ping_requests_total=M+(L||0),h.sent_ping_responses=U}else"local-candidate"===t?(h.local_candidate_type=I,h.local_ip=R||A,h.local_network_type=w,h.local_port=C,h.protocol=N):"remote-candidate"===t&&(h.remote_candidate_type=I,h.remote_ip=R||A,h.remote_port=C)})),(p=r.video).timestamp){e.next=17;break}return r.video=i,e.abrupt("return",this.filterIllegal(n));case 17:return n.videoLossRate=(i.packetsLost-p.packetsLost)/(i.packetsReceived-p.packetsReceived+(i.packetsLost-p.packetsLost)),n._retransmittedRate=(i.nackCount-p.nackCount)/(i.packetsReceived-p.packetsReceived+(i.packetsLost-p.packetsLost)),n.videoLossRate=Number.isNaN(n.videoLossRate)?0:n.videoLossRate,h.fraction_lost=n.videoLossRate,n.statsInterval=i.timestamp-p.timestamp,h.stats_interval=n.statsInterval,n.receivedKBitrate=(i.bytesReceived-p.bytesReceived||0)/n.statsInterval*8,h.bitrate=Math.round(1e3*n.receivedKBitrate),h.bandwidth=Math.round(h.bitrate/1024),n.decoderOutputFrameRate=1e3*(i.framesDecoded-p.framesDecoded)/n.statsInterval,n.receivedFrameRate=1e3*(i.framesReceived-p.framesReceived)/n.statsInterval,h.frame_rate_decoded=Math.round(n.decoderOutputFrameRate),h.frame_rate_received=h.frame_rate_decoded,r.video=i,this.processStall(this._stream,h,n,c),this.monitor.rtcMediaStatistics(h,{}),e.abrupt("return",this.filterIllegal(n));case 34:case"end":return e.stop()}}),e,this)}))),function(e,r){return t.apply(this,arguments)})},{key:"processStall",value:function(e,t,r,n){var i,o=0,a=0,s=0;if(e.recordedVideoFrames&&this.player&&null!==(i=this.player)&&void 0!==i&&i.played){e.recordedVideoFrames.forEach((function(e){e.isStall&&(o+=e.stallCount,a+=e.stallDuration),s=e.playTime})),e.recordedVideoFrames.length||(a=2e3,o=this._videoInWaiting?0:1,this._videoInWaiting=!0);var u=e.recordedVideoFrames.pop();u&&(u.isStall?this._videoInWaiting=!0:this._videoInWaiting=!1),e.recordedVideoFrames=[]}t.stall_count=o,n?(t.stuck_length=a,t.stall_duration=void 0):(t.stall_duration=a,t.stuck_length=void 0),t.play_time=s,r.stallCount=o,r.stallDuration=a}},{key:"destroy",value:function(){b(p(a.prototype),"destroy",this).call(this),this.delStatsEvtInterval(),this._videoInWaiting=!1}}],[{key:"audioStallConfig",set:function(e){a.audioStallInterval=((null==e?void 0:e.audio_stall_interval)||200)/2,a.audioStallRatio=null==e?void 0:e.audio_stall_ratio}}]),a}(bz);h(kz,"audioStallInterval",void 0),h(kz,"audioStallRatio",void 0);var Tz,Iz,Rz,Az=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}(Az||{}),wz=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}(wz||{}),Cz=function(e){return e[e.PUB=0]="PUB",e[e.UNPUB=1]="UNPUB",e}(Cz||{}),Oz=function(e){return e[e.SUB=0]="SUB",e[e.UNSUB=1]="UNSUB",e}(Oz||{}),xz=new LL("Stream",0),Nz=function(e){return e[e.INIT=0]="INIT",e[e.SUB_ING=1]="SUB_ING",e[e.SUB_ED=2]="SUB_ED",e}(Nz||{}),Dz=function(){function e(){c(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",[nj]),h(this,"subVideoDescriptions",[]),h(this,"enableSimulcast",!1),h(this,"observer",void 0),h(this,"statsReport",void 0),h(this,"prevScaleResolutionDownBy",1),h(this,"pubAudio",!1),h(this,"pubVideo",!1),h(this,"pubAttributes",void 0),this.stream=new MediaStream,this.videoInputConfig={width:640,height:360,frameRate:30},this.pubAttributes={localaudio:!1,localvideo:!1,videostream:!1,audiostream:!1,extvideo:!1,extaudio:!1},this.statsReport=new Ez(this)}return l(e,[{key:"audioHasCapture",get:function(){return this.pubAttributes.localaudio}},{key:"audioHasPublish",get:function(){return this.pubAttributes.audiostream}},{key:"videoHasCapture",get:function(){return this.pubAttributes.localvideo}},{key:"videoHasPublish",get:function(){return this.pubAttributes.videostream}},{key:"hasPublished",get:function(){return this.videoTransceiver&&this.audioTransceiver}},{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(Fj()){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=Sz.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 xz.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 xz.print("no sender found when trying to bind encodedTransform")}},{key:"clean",value:function(){var e;this.audioMid=void 0,this.videoMid=void 0,this.videoTransceiver=void 0,this.audioTransceiver=void 0,null===(e=this.observer)||void 0===e||e.reset(),this.statsReport.destroy(),this.prevScaleResolutionDownBy=1,this.subVideoDescriptions=[]}},{key:"switchTrackEnableState",value:function(e,t){var r,n;"audio"===e?n=this.audioTrack:"video"===e&&(n=this.videoTrack);var i=null===(r=n)||void 0===r?void 0:r.getTrack();return!(!i||(null==i?void 0:i.enabled)===t)&&(i.enabled=t,!0)}}]),e}(),Pz=function(e){f(r,e);var t=g(r);function r(e,n,i,o){var a,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:X.LOW;return c(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),"autosubAudioMid",void 0),h(m(a),"autosubVideoMid",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),"_workaround_1_",void 0),h(m(a),"paused",void 0),h(m(a),"originalMediaType",void 0),h(m(a),"originalStreamIndex",0),a.userPriority=s,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=lz.NONE,a.subLayer={spatialLayer:0,spatialSubLayer:-1},a.streamState=0,a.statsReport=new kz(m(a)),a}return l(r,[{key:"audioHasCapture",get:function(){return this._attributes.localaudio}},{key:"audioHasPublish",get:function(){return this._attributes.audiostream}},{key:"videoHasCapture",get:function(){return this._attributes.localvideo}},{key:"videoHasPublish",get:function(){return this._attributes.videostream}},{key:"sequenceId",get:function(){return this._sequenceId||-1},set:function(e){"number"==typeof e&&(this._sequenceId=e)}},{key:"hasSubscribed",get:function(){return 2===this.streamState}},{key:"attributes",get:function(){return this._attributes},set:function(e){this.hasVideo=e.localvideo&&e.videostream,this.hasAudio=e.localaudio&&e.audiostream,this._attributes=e}},{key:"initVideoEncodedTransform",value:function(){var e=this;if(this.videoTransceiver&&this.videoTransceiver.receiver){var t=this.videoTransceiver.receiver.createEncodedStreams(),r=t.readable,n=t.writable;r.pipeThrough(new TransformStream({transform:function(t,r){hz.getNalunits(new fz(t.data)).forEach((function(t){if(t.sei){var r=Sz.decodeSeiBody(t.body);r&&r.type!==pz.internal&&e.safeEmit("onSEIMessage",r.payload)}})),r.enqueue(t)}})).pipeTo(n)}else xz.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 xz.print("no receiver found when trying to bind encodedTransform")}},{key:"ontrack",value:function(e){var t,r;if((null===(t=e.streams)||void 0===t||null===(r=t[0])||void 0===r?void 0:r.id)===this.streamId){var n,i=e.track;"video"===(null==i?void 0:i.kind)?this._setVideoTrack(i):"audio"===(null===(n=e.track)||void 0===n?void 0:n.kind)&&this._setAudioTrack(i),this._setStream(e.streams[0])}this.safeEmit("ontrack",e)}},{key:"clean",value:function(){var e;xz.print("clean","exec stream.clean ".concat(this.streamId," ").concat(this.userId)),this.subAudio=!1,this.subVideo=!1,this.audioMid=void 0,this.videoMid=void 0,this.sequenceId=0,this.videoTrack=void 0,this.audioTrack=void 0,this.stream=void 0,this.videoTransceiver=void 0,this.audioTransceiver=void 0,this.recordedVideoFrames=void 0,this.paused=!1,this._workaround_1_=!1,null===(e=this.observer)||void 0===e||e.reset(),this.statsReport.destroy()}},{key:"resetHasSubscribed",value:function(){this.streamState=0}},{key:"setRemoteUserPriority",value:function(e){this.userPriority=e}},{key:"getStreamPriority",value:function(){var e=this.isScreen?20:this.hasAudio||this.hasVideo?this.attributes.videoDescriptions.length>1?10-this.subLayer.spatialLayer:9:0;return 1e4*this.userPriority+100*e}},{key:"getSubscribeFallbackParams",value:function(e){if(e!==K.DISABLE&&this.subVideo){if(this.attributes.videoDescriptions.length-1>this.subLayer.spatialLayer)return[this.originalMediaType,Oz.SUB,this._getSubLayerBySpatialLayer(this.subLayer.spatialLayer+1)];if(e===K.AUDIO_ONLY)return[V.VIDEO,Oz.UNSUB]}return null}},{key:"getSubscribeRecoverParams",value:function(){if(this.originalMediaType&&CP(this.originalMediaType)){if(!1===this.subVideo)return[this.originalMediaType,Oz.SUB,this.subLayer];if("number"==typeof this.originalStreamIndex&&this.subLayer.spatialLayer>this.originalStreamIndex)return[this.originalMediaType,Oz.SUB,this._getSubLayerBySpatialLayer(this.subLayer.spatialLayer-1)]}return null}},{key:"_setStream",value:function(e){var t=this;this.stream=e,e.onaddtrack=function(e){"video"===e.track.kind?t._setVideoTrack(e.track):"audio"===e.track.kind&&t._setAudioTrack(e.track)}}},{key:"_setAudioTrack",value:function(e){var t,r;(null===(t=this.audioTrack)||void 0===t||null===(r=t.getTrack())||void 0===r?void 0:r.id)!==(null==e?void 0:e.id)&&(this.audioTrack=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:dP();return new UH(e,t)}(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]:dP();return new LH(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,u=i.find((function(e){return e.width===a&&e.height===s}));return{spatialLayer:e,spatialSubLayer:(null==u?void 0:u.sub_index)||-1}}}]),r}(VL),Mz=new LL("queue",4),Lz=function(e){return e[e.ADD=0]="ADD",e[e.CLOSE=1]="CLOSE",e}(Lz||{}),Uz=function(e){return e.publish="publish",e.unpublish="unpublish",e.subscribe="subscribe",e.unsubscribe="unsubscribe",e.pushtrack="pushtrack",e.removetrack="removetrack",e}(Uz||{}),Vz=(h(Tz={},"publish","unpublish"),h(Tz,"subscribe","unsubscribe"),h(Tz,"pushtrack","removetrack"),Tz),Fz=(h(Iz={},"publish",0),h(Iz,"subscribe",0),h(Iz,"pushtrack",0),h(Iz,"unpublish",1),h(Iz,"unsubscribe",1),h(Iz,"removetrack",1),Iz),Bz=function(e){f(r,e);var t=g(r);function r(){var e;return c(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!==Vz[t.action]||(r=t.streamId,Mz.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;for(var e=Fz[this._queue[0].action],t=1;t<this._queue.length;t++)if(Fz[this._queue[t].action]!==e)return{sdpStrategy:e,items:this._queue.splice(0,t)};return{sdpStrategy:e,items:this._queue.splice(0,this._queue.length)}}}]),r}(NL),jz=new LL("ChromeHandler",3),Gz=Fj(),Hz=function(e){f(T,e);var r,n,a,s,d,v,_,y,S,k=g(T);function T(e,t){var r;return c(this,T),h(m(r=k.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",0),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),"_msidIndexMap",{}),h(m(r),"_mlinesCache",{}),r._sdpQueue=new Bz,r._sdpQueue.on("start",(function(){r._queueBusy||"stable"!==r._peerConnection.signalingState||(jz.print("dequeue start"),r.dequeue())})),r}return l(T,[{key:"connect",value:(S=u(o().mark((function e(t){var r,n,a,s,u,c,d,l,h=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return jz.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,DG(t);case 4:return this._answerIce=e.sent,this.connection_id=this._answerIce.iceUfrag||"",this.ms_addr=JSON.stringify((null==t||null===(a=t.publicIPs)||void 0===a?void 0:a.map((function(e){return{ip:e.ip,tcp:e.tcpPorts,udp:e.udpPorts}})))||[]),e.next=9,this._peerConnection.createOffer();case 9:return s=e.sent,u=zj.parse(s.sdp),c=E(u.media,1),d=c[0],this._offerIce.fingerprint=u.fingerprint||d.fingerprint,delete u.media,this._offerSession=i({},u),this._answerSession=i({},u),this._answerSession.fingerprint&&(this._answerSession.fingerprint=this._answerIce.fingerprint),l=this._mid++,this._offerMlines=[i(i(i({},d),this._offerIce),{},{mid:"".concat(l)})],this._answerMlines=[i(i(i({},d),this._answerIce),{},{sctpmap:{sctpmapNumber:5e3,app:"webrtc-datachannel",maxMessageSize:262144},mid:"".concat(l)})],this.setDescription(),e.next=23,new Promise((function(e,t){h._dataChannel.onopen=function(){jz.print("connect","dataChannel open"),LB("es.dc.open","",0,!1,h.connection_id,{ms_addr:h.ms_addr}),e("")},h._dataChannel.onerror=function(e){IB.rtcSignalingMsgError(e.error.sdpLineNumber,e.error.errorDetail,QF.INVALID_DATA),LB("es.dc.error","",0,!1,h.connection_id,{ms_addr:h.ms_addr}),t(e)},h._dataChannel.onclose=function(e){LB("es.dc.close","",0,!1,h.connection_id,{ms_addr:h.ms_addr}),t(e)},h._peerConnection.addEventListener("connectionstatechange",(function(e){"failed"!==h._peerConnection.iceConnectionState&&"closed"!==h._peerConnection.iceConnectionState&&"failed"!==h._peerConnection.connectionState||t(e)}))}));case 23:return jz.print("connect","dataChannel establish success"),e.abrupt("return",this._dataChannel);case 25:case"end":return e.stop()}}),e,this)}))),function(e){return S.apply(this,arguments)})},{key:"disconnect",value:function(){this._peerConnection.close(),this._dataChannel.close(),this._peerConnection.ontrack=null}},{key:"destroy",value:function(){b(p(T.prototype),"destroy",this).call(this),this._mlinesCache={}}},{key:"publish",value:(y=u(o().mark((function e(t){var r,n,a,s,u,c,d,l,h,f,v,_,m,y,g,S,k,I,R,A,w,C,O,x,N,D,P;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return u=t.stream,c=t.enableSimulcast,d=b(p(T.prototype),"internalPublish",this).call(this,t),l=d.videoDescriptions,h=d.subVideoDescriptions,f=d.transceiverInit,v="".concat(this._mid++),_="".concat(this._mid++),m=i(i(i({},this._aSendonlyOfferTpl),this._offerIce),{},{mid:v,msid:"".concat(u.id," ").concat(u.id,"-audio"),ssrcs:CG(u,"audio")}),y=i(i(i({},this._vSendonlyOfferTpl),this._offerIce),{},{mid:_,msid:"".concat(u.id," ").concat(u.id,"-video")}),c?(jz.print("subVideoDesc","desc: %o ",h),delete y.ssrcGroups,delete y.ssrcs,g=[],y.rids=l.map((function(e){var t=e.rid;return g.unshift(t),{id:t,direction:"send"}})),y.simulcast={dir1:"send",list1:g.join(";")}):(S=OG(u,"video"),k=S.ssrcs,I=S.ssrcGroups,y.ssrcs=k,y.ssrcGroups=I),gP&&SP&&Array.isArray(y.ext)&&(y.ext=y.ext.filter((function(e){var t;return!(null!=e&&null!==(t=e.uri)&&void 0!==t&&t.includes("video-orientation"))}))),null!==(r=this._context)&&void 0!==r&&null!==(n=r.serverConfig)&&void 0!==n&&n.audioRed&&Array.isArray(m.rtp)&&-1!==(R=m.rtp.findIndex((function(e){return"red"===e.codec})))&&(A=m.rtp.splice(R,1),w=E(A,1),C=w[0],m.rtp.unshift(C)),null!==(a=this._context)&&void 0!==a&&null!==(s=a.serverConfig)&&void 0!==s&&s.videoCodec&&UG(y,null===(O=this._context)||void 0===O||null===(x=O.serverConfig)||void 0===x?void 0:x.videoCodec),(N=null==m?void 0:m.rtp.find((function(e){return"opus"===e.codec})))&&m.fmtp&&(P=m.fmtp.find((function(e){return e.payload===N.payload})))&&null!==(D=this._context)&&void 0!==D&&D.audioProfileManager&&(P.config+=this._context.audioProfileManager.getOpusConfigStr()),this.addBitrateLimit(y,t.videoEncodeConfig[0].maxKbps),this._mlinesCache[t.stream.id]=[m,y],e.abrupt("return",{partialSdp:NG(this._offerSession,m,y),audioMid:v,videoMid:_,type:"incroffer",semantics:"unified-plan",videoDescriptions:l,subVideoDescriptions:h,transceiverInit:f});case 15:case"end":return e.stop()}}),e,this)}))),function(e){return y.apply(this,arguments)})},{key:"subscribe",value:(_=u(o().mark((function e(t,r){var n,a,s,u,c,d,l,h,f,p;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(jz.print("subscribe","mids: ",r),n="incroffer",a="unified-plan",this._aRecvonlyOfferTpl&&this._vRecvonlyOfferTpl){e.next=9;break}return e.next=6,this._genOfferSdp();case 6:return s=e.sent,e.next=9,this.createAVMlineOfferTpl(s);case 9:if(!this._mlinesCache[t.streamId]){e.next=14;break}return u=E(this._mlinesCache[t.streamId],2),c=u[0],d=u[1],c.mid=t.audioMid,d.mid=t.videoMid,e.abrupt("return",{partialSdp:NG(this._offerSession,c,d),audioMid:c.mid,videoMid:d.mid,type:n,semantics:a});case 14:return l="".concat(this._mid++),h="".concat(this._mid++),f=i(i(i({},this._aRecvonlyOfferTpl),this._offerIce),{},{mid:l}),p=i(i(i({},this._vRecvonlyOfferTpl),this._offerIce),{},{mid:h}),this._mlinesCache[t.streamId]=[f,p],e.abrupt("return",{partialSdp:NG(this._offerSession,f,p),audioMid:l,videoMid:h,type:n,semantics:a,transceiverInit:{aTrack:"audio",vTrack:"video",audioTransceiverInit:{direction:"recvonly"},videoTransceiverInit:{direction:"recvonly"}}});case 20:case"end":return e.stop()}}),e,this)}))),function(e,t){return _.apply(this,arguments)})},{key:"handleAck",value:(v=u(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return jz.print("handleAck()","item: %o",t),e.abrupt("return",this._sdpQueue.enqueue(t));case 2:case"end":return e.stop()}}),e,this)}))),function(e){return v.apply(this,arguments)})},{key:"dequeue",value:(d=u(o().mark((function e(){var r,n,a,s,u,c,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(),jz.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=[],u=[],c=[],a!==Lz.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=17;break}return a=p.value,e.delegateYield(o().mark((function e(){var t,n,d,l,h,f,p,v,m,y,g,S,b,k,T,I,R,A,w,C,O;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=a.action,n=a.transceiverInit,d=a.signalingAck,l=a.stream,h=l instanceof Pz,a.onSuccess&&c.push(a.onSuccess),!(h&&(null==d?void 0:d.sequenceId)<l.sequenceId)){e.next=5;break}return e.abrupt("return","break");case 5:if(f={},p={},v=zj.parse(d.sdp),Array.isArray(v.media)&&(m="",v.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(e){"audio"===(e=i(i({},e),r)).type?(f=e,jz.print("audioMsid",e.msid),e.msid&&(m=e.msid.replace("audio","video"))):(p=e,jz.print("videoMsid",m),m&&(p.msid=m,m=""))}))),y=l.streamId,t===Uz.publish&&(y=null===(g=l.stream)||void 0===g?void 0:g.id),_._mlinesCache[y]){e.next=13;break}return e.abrupt("return","break");case 13:if(S=E(_._mlinesCache[y],2),b=S[0],k=S[1],!n){e.next=31;break}l.audioTransceiver=_._peerConnection.addTransceiver(n.aTrack,n.audioTransceiverInit),l.videoTransceiver=_._peerConnection.addTransceiver(n.vTrack,n.videoTransceiverInit),(T=_._inactiveMlineIndex.shift())||(T=_._offerMlines.length),_._offerMlines[T]=i(i({},b),{},{mid:f.mid}),_._answerMlines[T]=f,(I=_._inactiveMlineIndex.shift())||(I=_._offerMlines.length),_._offerMlines[I]=i(i({},k),{},{mid:p.mid}),_._answerMlines[I]=p,_._msidIndexMap[l.streamId]=[T,I],Gz&&(l.initAudioEncodedTransform(),l.initVideoEncodedTransform()),s.push(l.streamId||""),u.push(h?l.userId:"local"),e.next=49;break;case 31:if(!h){e.next=49;break}if(R=_._msidIndexMap[l.streamId]||[],A=E(R,2),w=A[0],C=A[1],!w||!C){e.next=48;break}if((null===(O=_._offerMlines[w])||void 0===O?void 0:O.mid)===f.mid){e.next=44;break}return _._offerMlines[w]=xG(_._offerMlines[w]),_._offerMlines[C]=xG(_._offerMlines[C]),_._answerMlines[w]=xG(_._answerMlines[w]),_._answerMlines[C]=xG(_._answerMlines[C]),e.next=41,_.setDescription();case 41:_._offerMlines[w]=i(i({},_._aRecvonlyOfferTpl),{},{mid:f.mid}),_._offerMlines[C]=i(i({},_._vRecvonlyOfferTpl),{},{mid:p.mid}),jz.print("enqueue","hack: %o",l.streamId);case 44:_._answerMlines[w]=f,_._answerMlines[C]=p,e.next=49;break;case 48:jz.print("dequeue","pushtrack before subscribe: %o",l.userId);case 49:h&&(l.sequenceId=null==d?void 0:d.sequenceId);case 50:case"end":return e.stop()}}),e)}))(),"t0",11);case 11:if("break"!==e.t0){e.next=14;break}return e.abrupt("break",17);case 14:d=!1,e.next=6;break;case 17:e.next=23;break;case 19:e.prev=19,e.t1=e.catch(4),l=!0,h=e.t1;case 23:if(e.prev=23,e.prev=24,!d||null==f.return){e.next=28;break}return e.next=28,f.return();case 28:if(e.prev=28,!l){e.next=31;break}throw h;case 31:return e.finish(28);case 32:return e.finish(23);case 33:case"end":return e.stop()}}),e,null,[[4,19,23,33],[24,,28,32]])}))(),"t0",13);case 13:e.next=20;break;case 15:v={},n.forEach((function(e){var t,r,n=e.audioMid,i=e.videoMid,o=e.stream;v[n]=n,v[i]=i,delete _._msidIndexMap[null===(t=e.stream)||void 0===t?void 0:t.streamId],o instanceof Dz?delete _._mlinesCache[null==o||null===(r=o.stream)||void 0===r?void 0:r.id]:delete _._mlinesCache[null==o?void 0:o.streamId]})),this._offerMlines=this._offerMlines.map((function(e,t){return v[e.mid]&&(e=xG(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=xG(e)),e}));case 20:return e.next=22,this.setDescription(s.length?{streamId:s.join(","),streamUserId:u.join(",")}:void 0);case 22:try{c.forEach((function(e){return e()}))}catch(r0){}jz.print("dequeue","loop"),e.next=29;break;case 26:e.prev=26,e.t1=e.catch(6),jz.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 d.apply(this,arguments)})},{key:"setDescription",value:(s=u(o().mark((function e(t){var r,n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return jz.print("setDescription","_offerMlines: %o, _answerMlines: %o",this._offerMlines,this._answerMlines),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=lP(),t&&IB.rtcBeginCreateOffer("local"===t.streamUserId?$F.UP:$F.DOWN,t.streamId,t.streamUserId),e.next=10,this._peerConnection.createOffer();case 10:return t&&IB.rtcCreateOffer(0,"local"===t.streamUserId?eB.UP:eB.DOWN,t.streamId,t.streamUserId,lP()-n),e.next=13,this.setLocalDescription(zj.write(this._offerSession),t);case 13:return e.next=15,this.setRemoteDescription(zj.write(this._answerSession),t);case 15:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"getDefaultSdp",value:(a=u(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,this._genOfferSdp();case 2:return t=e.sent,this.createAVMlineOfferTpl(t),r=zj.parse(t),n=[],r.media=r.media.filter((function(e){return"recvonly"===e.direction&&(n.push(e.mid+""),!0)})),r.groups=[{mids:n.join(" "),type:"BUNDLE"}],e.abrupt("return",{sdp:zj.write(r),semantics:"unified-plan",type:"offer"});case 9:case"end":return e.stop()}}),e,this)}))),function(){return a.apply(this,arguments)})},{key:"rollback",value:(n=u(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 n.apply(this,arguments)})},{key:"createAVMlineOfferTpl",value:function(e){var t=this;zj.parse(e).media.forEach((function(e){"audio"===e.type?"sendonly"===e.direction?t._aSendonlyOfferTpl=e:t._aRecvonlyOfferTpl=e:"video"===e.type&&("sendonly"===e.direction?t._vSendonlyOfferTpl=e:t._vRecvonlyOfferTpl=e)}))}},{key:"_genOfferSdp",value:(r=u(o().mark((function e(){var t,r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,IP(!0);case 3:if(t=e.sent){e.next=6;break}throw"pc.createOffer() return empty.";case 6:e.next=12;break;case 8:throw e.prev=8,e.t0=e.catch(0),r="Get offer Error. ".concat(e.t0.message|e.t0),new ZN(JN.NOT_SUPPORTED,r);case 12:return e.abrupt("return",t);case 13:case"end":return e.stop()}}),e,null,[[0,8]])}))),function(){return r.apply(this,arguments)})}]),T}(Hj),zz=new LL("FirefoxHandler",3),qz=function(e){f(S,e);var t,r,n,a,s,d,v,_,y=g(S);function S(){var e;c(this,S);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return h(m(e=y.call.apply(y,[this].concat(r))),"name","firefox"),e}return l(S,[{key:"connect",value:(_=u(o().mark((function e(t){var r,n,a,s,u,c,d,l,h=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,DG(t);case 4:return this._answerIce=e.sent,this.connection_id=this._answerIce.iceUfrag||"",this.ms_addr=JSON.stringify((null==t||null===(a=t.publicIPs)||void 0===a?void 0:a.map((function(e){return{ip:e.ip,tcp:e.tcpPorts,udp:e.udpPorts}})))||[]),this._peerConnection.addTransceiver("audio",{direction:"recvonly"}),this._peerConnection.addTransceiver("video",{direction:"recvonly"}),e.next=11,this._peerConnection.createOffer();case 11:return s=e.sent,u=zj.parse(s.sdp),c=E(u.media,1),d=c[0],this._offerIce.fingerprint=u.fingerprint||d.fingerprint,u.media=u.media.map((function(e){return i(i({},e),h._offerIce)})),(l=i({},u)).fingerprint=this._answerIce.fingerprint,l.media=l.media.map((function(e){return delete(e=i(i({},e),h._answerIce)).bundleOnly,e.port=9,"application"===e.type?e.sctpmap={sctpmapNumber:5e3,app:"webrtc-datachannel",maxMessageSize:262144}:e.direction="sendonly",e})),e.next=21,this.setLocalDescription(zj.write(u));case 21:return e.next=23,this.setRemoteDescription(zj.write(l));case 23:return e.next=25,new Promise((function(e,t){h._dataChannel.onopen=function(){zz.print("connect","dataChannel open"),LB("es.dc.open","",0,!1,h.connection_id,{ms_addr:h.ms_addr}),e("")},h._dataChannel.onerror=function(e){IB.rtcSignalingMsgError(e.error.sdpLineNumber,e.error.errorDetail,QF.INVALID_DATA),LB("es.dc.error","",0,!1,h.connection_id,{ms_addr:h.ms_addr}),t(e)},h._dataChannel.onclose=function(e){LB("es.dc.close","",0,!1,h.connection_id,{ms_addr:h.ms_addr}),t(e)},h._peerConnection.addEventListener("connectionstatechange",(function(e){"failed"!==h._peerConnection.iceConnectionState&&"closed"!==h._peerConnection.iceConnectionState&&"failed"!==h._peerConnection.connectionState||t(e)}))}));case 25:return zz.print("connect","dataChannel establish success"),e.abrupt("return",this._dataChannel);case 27:case"end":return e.stop()}}),e,this)}))),function(e){return _.apply(this,arguments)})},{key:"publish",value:(v=u(o().mark((function e(t){var r,n,a,s,u,c,d,l,h,f,v,_,m,y=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=b(p(S.prototype),"internalPublish",this).call(this,t),s=a.videoDescriptions,u=a.subVideoDescriptions,c=a.transceiverInit,t.audioTransceiver=this._peerConnection.addTransceiver(c.aTrack,c.audioTransceiverInit),t.videoTransceiver=this._peerConnection.addTransceiver(c.vTrack,c.videoTransceiverInit),d=lP(),IB.rtcBeginCreateOffer($F.UP,"",""),e.next=7,this._peerConnection.createOffer();case 7:return l=e.sent,IB.rtcCreateOffer(0,eB.UP,"","",lP()-d),(h=zj.parse(l.sdp)).media=null===(r=h.media)||void 0===r?void 0:r.map((function(e){return i(i({},e),y._offerIce)})),e.next=13,this.setLocalDescription(zj.write(h));case 13:return f=t.audioTransceiver.mid,v=t.videoTransceiver.mid,_=null,m=null,h.media=null===(n=h.media)||void 0===n?void 0:n.map((function(e){if("".concat(e.mid)===f){var t,r=null===(t=_=e)||void 0===t?void 0:t.rtp.find((function(e){return"opus"===e.codec}));if(r&&_.fmtp){var n,i=_.fmtp.find((function(e){return e.payload===r.payload}));i&&null!==(n=y._context)&&void 0!==n&&n.audioProfileManager&&(i.config+=y._context.audioProfileManager.getOpusConfigStr())}}else if("".concat(e.mid)===v){var o,a,s,u;null!==(o=y._context)&&void 0!==o&&null!==(a=o.serverConfig)&&void 0!==a&&a.videoCodec&&UG(e,null===(s=y._context)||void 0===s||null===(u=s.serverConfig)||void 0===u?void 0:u.videoCodec),m=e}return e})),this.addBitrateLimit(m,t.videoEncodeConfig[0].maxKbps),e.next=21,this.setLocalDescription(zj.write(h));case 21:return e.abrupt("return",{partialSdp:NG(h,_,m),audioMid:f,videoMid:v,type:"incroffer",semantics:"unified-plan",videoDescriptions:s,subVideoDescriptions:u,transceiverInit:c});case 22:case"end":return e.stop()}}),e,this)}))),function(e){return v.apply(this,arguments)})},{key:"subscribe",value:(d=u(o().mark((function e(t){var r,n,a,s,u,c,d,l,h,f,p,v,_,m,y=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(zz.print("subscribe()"),!t.audioMid||!t.videoMid){e.next=11;break}return u=zj.parse(null===(a=this._peerConnection.localDescription)||void 0===a?void 0:a.sdp),c=null,d=null,u.media.forEach((function(e){"".concat(e.mid)===t.audioMid?(c=e,t.autosubAudioMid&&(c.mid=t.autosubAudioMid)):"".concat(e.mid)===t.videoMid&&(d=e,t.autosubVideoMid&&(d.mid=t.autosubVideoMid))})),e.next=8,this._peerConnection.createOffer();case 8:return e.next=10,this.setLocalDescription(null===(s=this._peerConnection.localDescription)||void 0===s?void 0:s.sdp,{streamId:t.streamId||"",streamUserId:t.userId});case 10:return e.abrupt("return",{partialSdp:NG(u,c,d),audioMid:t.audioMid,videoMid:t.videoMid,autosubAudioMid:t.autosubAudioMid,autosubVideoMid:t.autosubVideoMid,type:"incroffer",semantics:"unified-plan"});case 11:return t.audioTransceiver=this._peerConnection.addTransceiver("audio",{direction:"recvonly"}),t.videoTransceiver=this._peerConnection.addTransceiver("video",{direction:"recvonly"}),l=lP(),IB.rtcBeginCreateOffer($F.UP,t.streamId,t.userId),e.next=17,this._peerConnection.createOffer();case 17:return h=e.sent,IB.rtcCreateOffer(0,eB.UP,t.streamId,t.userId,lP()-l),(f=zj.parse(h.sdp)).media=null===(r=f.media)||void 0===r?void 0:r.map((function(e){return i(i({},e),y._offerIce)})),e.next=23,this.setLocalDescription(zj.write(f),{streamId:t.streamId||"",streamUserId:t.userId});case 23:return p=t.audioTransceiver.mid,v=t.videoTransceiver.mid,_=null,m=null,null===(n=f.media)||void 0===n||n.forEach((function(e){"".concat(e.mid)===p?_=e:"".concat(e.mid)===v&&(m=e)})),e.abrupt("return",{partialSdp:NG(f,_,m),audioMid:p,videoMid:v,type:"incroffer",semantics:"unified-plan"});case 29:case"end":return e.stop()}}),e,this)}))),function(e){return d.apply(this,arguments)})},{key:"handleAck",value:(s=u(o().mark((function e(t){var r,n,a,s,u,c,d,l,h,f=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=t.signalingAck,s=t.stream,(u=t.action)!==Uz.unpublish&&u!==Uz.unsubscribe&&u!==Uz.removetrack){e.next=5;break}return e.next=4,this.close(s);case 4:return e.abrupt("return",s.streamId||"");case 5:return c={},(d=zj.parse(null===(r=this._peerConnection.remoteDescription)||void 0===r?void 0:r.sdp)).media.forEach((function(e){void 0!==e.mid&&(c[e.mid]=e)})),zj.parse(null==a?void 0:a.sdp).media.forEach((function(e){"audio"===(e=i(i({},e),f._answerIce)).type&&(s.audioMid?(e.mid=s.audioMid,c[s.audioMid]=e):c[e.mid]=e),"video"===e.type&&(s.videoMid?(e.mid=s.videoMid,c[s.videoMid]=e):c[e.mid]=e)})),l=zj.parse(null===(n=this._peerConnection.localDescription)||void 0===n?void 0:n.sdp),h=l.media.map((function(e){var t=c[e.mid];return"inactive"===e.direction?e:t})),d.groups=l.groups,d.media=h,this.setRemoteDescription(zj.write(d)),e.abrupt("return","");case 16:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"getDefaultSdp",value:(a=u(o().mark((function e(){var t,r,n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=zj.parse(null===(t=this._peerConnection.localDescription)||void 0===t?void 0:t.sdp),n=[],r.media=r.media.filter((function(e){return"recvonly"===e.direction&&(n.push(e.mid+""),!0)})),r.groups=[{mids:n.join(" "),type:"BUNDLE"}],e.abrupt("return",{sdp:zj.write(r),semantics:"unified-plan",type:"offer"});case 5:case"end":return e.stop()}}),e,this)}))),function(){return a.apply(this,arguments)})},{key:"rollback",value:(n=u(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.close(r));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return n.apply(this,arguments)})},{key:"close",value:(r=u(o().mark((function e(t){var r,n,a,s,u,c,d=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(zz.print("close()"),!t.audioTransceiver||!t.videoTransceiver){e.next=19;break}return t.audioTransceiver.stop(),t.videoTransceiver.stop(),n=[],e.next=7,this._peerConnection.createOffer();case 7:return a=e.sent,(s=zj.parse(null==a?void 0:a.sdp)).media=s.media.map((function(e){return"".concat(e.mid)!==t.audioMid&&"".concat(e.mid)!==t.videoMid||(e=xG(e)),"inactive"!==e.direction&&n.push(e.mid),i(i({},e),d._offerIce)})),u=zj.parse(null===(r=this._peerConnection.remoteDescription)||void 0===r?void 0:r.sdp),c={},u.media.forEach((function(e){c[e.mid]=e})),u.media=s.media.map((function(e){return"inactive"===e.direction?e:c[e.mid]})),s.groups&&u.groups&&(s.groups[0].mids=n.join(" "),u.groups[0].mids=n.join(" ")),e.next=17,this.setLocalDescription(zj.write(s));case 17:return e.next=19,this.setRemoteDescription(zj.write(u));case 19:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"setCurrentDescription",value:(t=u(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)})}]),S}(Hj),Kz=function(e,t){return yP?new qz(e,t):new Hz(e,t)},Xz=new LL("Locker",2),Wz=1,Yz=function(){function e(t){c(this,e),h(this,"lockingPromise",Promise.resolve()),h(this,"locks",0),h(this,"name",""),h(this,"lockId",void 0),this.lockId=Wz++,t&&(this.name=t),Xz.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,Xz.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,Xz.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}(),Jz=(h(Rz={},J.communication,[0]),h(Rz,J.chat,[0]),h(Rz,J.chatRoom,[1,"IES_chatroom"]),h(Rz,J.coHost,[1,"IES_PK"]),h(Rz,J.meeting,[16]),h(Rz,J.classRoom,[0]),Rz),Qz=Object.defineProperty,Zz=Object.getOwnPropertyDescriptor,$z=function(e,t,r,n){for(var i,o=n>1?void 0:n?Zz(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&&Qz(t,r,o),o},eq=new LL("MediaServerClient",2),tq=6e4,rq=function(e){return e.DISCONNECTED="disconnected",e.DISCONNECTING="disconnecting",e.CONNECTED="connected",e.CONNECTING="connecting",e}(rq||{}),nq=function(e,t){eq.print(e,"userId: %o, subAudio: %o, subVideo: %o, paused: %o, audioMid: %o, videoMid: %o, workaround_1_: %o, sequenceId: %o",t.userId,t.subAudio,t.subVideo,t.paused,t.audioMid,t.videoMid,t._workaround_1_,t.sequenceId)},iq=function(e){f(O,e);var t,r,n,a,s,d,p,v,_,y,S,b,k,T,I,R,A,w,C=g(O);function O(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:IB;return c(this,O),h(m(t=C.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",J.communication),h(m(t),"_context",void 0),h(m(t),"_subStreamQueue",{}),t.monitor=r,t._pubSubLock=new Yz("pubSubLock"),t._joinLeaveLock=new Yz("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(O,[{key:"_addHandlerEvents",value:function(){var e,t=this;null===(e=this._handler)||void 0===e||e.once("disconnect",(function(){eq.print("emit ABNORMAL_DISCONNECTION ice"),t.safeEmit(cj.ABNORMAL_DISCONNECTION)}))}},{key:"_addSignalEventHandler",value:function(){var e,t=this;[sj.ON_ADD_STREAM,sj.ON_REMOVE_STREAM,sj.USER_CONNECTION,sj.USER_DISCONNECTION,sj.ON_UPDATE_STREAM_ATTRIBUTES,sj.ON_UPDATE_ROOM_ATTRIBUTES,sj.ON_PUSH_TRACK,sj.ON_REMOVE_TRACK,sj.NODE_CHANGE,sj.ON_CUSTOM_MESSAGE,sj.USER_MESSAGE_RECEIVED,sj.USER_BINARY_MESSAGE_RECEIVED,sj.POST_PROCESSING_MESSAGE,sj.ON_USER_TOKEN_WILL_EXPIRE,sj.STREAM_CONTROL_MESSAGE,sj.ON_SCENE_CONFIG,sj.ON_UPDATE_USER_ATTRIBUTES,uj.RSCP,uj.RTT,sj.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(){eq.print("emit ABNORMAL_DISCONNECTION datachannel"),t.safeEmit(cj.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(cj.ON_CONNECTION_STATE_CHANGE,{prev:this._state,next:e}),this._state=e)}},{key:"connect",value:(w=u(o().mark((function e(t){var r,n,i,a,s,u,c,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],LB("es.join.nodeChange",i),e.next=20;break;case 11:return Promise.resolve().then((function(){return l.emit("onGetIceConfigHook")})),this._iceConfigRequestManager=new kj,e.next=15,null===(s=this._iceConfigRequestManager)||void 0===s?void 0:s.getAccessNode(t,r,n,qB.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 LB("es.join.getNodeFailed",""),new ZN(JN.ICE_SERVER_WRONG,"get ICE config failed");case 19:LB("es.join.getNodeSuccess",a);case 20:return this._addHandlerEvents(),Promise.resolve().then((function(){return l.emit("onEstablishConnectionHook")})),e.prev=22,c=!1,d=a.map((function(e){var t=Kz(l.monitor,l._context);return t.connect(e).then((function(r){var n;l.emit("onConnectSuccessHook",null===(n=a)||void 0===n?void 0:n.length),c?t.destroy():(c=!0,u=r,l.safeEmit("prevIceNode",e),l._handler=t,wB.setStats({connection_id:t.connection_id}),l.supportConcurrent="chrome"===t.name,l._addHandlerEvents())})).catch((function(e){throw t.destroy(),e}))})),e.next=27,RP(d);case 27:eq.print("join","establish peerConnection success"),e.next=34;break;case 30:throw e.prev=30,e.t0=e.catch(22),this.connectionState="disconnected",new ZN(JN.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed",e.t0);case 34:if(!u){e.next=40;break}this._dataChannelSignal=new Sj(u),this._addSignalEventHandler(),this._dataChannelSignal.sendPingSignaling(),e.next=42;break;case 40:throw this.connectionState="disconnected",new ZN(JN.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed");case 42:case"end":return e.stop()}}),e,this,[[22,30]])}))),function(e){return w.apply(this,arguments)})},{key:"join",value:(A=u(o().mark((function e(t){var r,n,i,a,s,u,c,d,l,h,f,p,v,_,m,y,g,S,b,E,k,T,I=this,R=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=R.length>1&&void 0!==R[1]?R[1]:{},i=R.length>2&&void 0!==R[2]&&R[2],a=R.length>3?R[3]:void 0,eq.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=pP.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,Uj();case 26:return e.t6=e.sent,e.t7=window.navigator.userAgent,e.t8=JB.VERSION,e.t9=qB.getDeviceId(),e.t10=this._appId,e.t11=this._roomId,e.t12=this._clientId,e.t13=this._businessId,e.t14=this._useCloudProxy,e.t15=Jz[this._roomProfile]?Jz[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},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,v=i?"reconnected":"joinRoom",e.next=44,this._dataChannelSignal.sendSignaling(v,s);case 44:return _=e.sent,eq.print("join","send join message success"),this._authorization=s.Authorization,this.connectionState="connected",this._context&&(this._context.serverConfig={videoCodec:null===(m=_.config)||void 0===m||null===(y=m.engine_WEB)||void 0===y?void 0:y.video_codec,audioRed:!(null===(g=_.config)||void 0===g||null===(S=g.engine_WEB)||void 0===S||!S.pub_audio_red),muteReplaceUnsub:!(null===(b=_.config)||void 0===b||!b.mute_replace_unsub),simulcastOnDemand:!(!1===(null===(E=_.config)||void 0===E||null===(k=E.engine_VPM)||void 0===k||null===(T=k.ondemand)||void 0===T?void 0:T.enable))}),kz.audioStallConfig=null===(u=_.config)||void 0===u?void 0:u.engine_WEB,null===(c=this._context)||void 0===c||null===(d=c.audioProfileManager)||void 0===d||d.updateEngineBAC(null===(l=_.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=_.config)||void 0===p?void 0:p.engine_ANM),e.abrupt("return",_);case 55:if(e.prev=55,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=60;break}throw new ZN(JN.INVALID_TOKEN,(null===e.t18||void 0===e.t18?void 0:e.t18.message)||"Invalid token");case 60:if(200===(null===e.t18||void 0===e.t18?void 0:e.t18.code)){e.next=62;break}throw new ZN(JN.JOIN_ROOM_FAILED,(null===e.t18||void 0===e.t18?void 0:e.t18.message)||"Join room failed");case 62:case"end":return e.stop()}}),e,this,[[40,55]])}))),function(e){return A.apply(this,arguments)})},{key:"publish",value:(R=u(o().mark((function e(t){var r,n,a,s,u,c,d,l,h,f,p,v,_,m,y,g,S=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return eq.print("publish()","localStream: %o",t),r=t.videoTrack,n=t.audioTrack,a=lP(),s="",u="",e.prev=6,e.next=9,null===(c=this._handler)||void 0===c?void 0:c.publish(t);case 9:if(v=e.sent){e.next=12;break}throw new ZN(JN.ADD_TRANSCEIVER_FAILED,"add transceiver failed");case 12:return s=v.audioMid,u=v.videoMid,t.pubAttributes={localaudio:!!n,localvideo:!!r,videostream:t.pubVideo,audiostream:t.pubAudio,extvideo:!!(r instanceof BH),extaudio:!!(n instanceof jH)},_={attributes:i({videoDescriptions:v.videoDescriptions},t.pubAttributes),audio:!0,video:!0,screen:t.isScreen,audioMid:s,videoMid:u,sdpInfo:{msid:t.stream.id,type:v.type,sdp:v.partialSdp,semantics:v.semantics}},t.enableSimulcast&&null!==(d=this._context)&&void 0!==d&&null!==(l=d.serverConfig)&&void 0!==l&&l.simulcastOnDemand&&(_.attributes.subVideoDescriptions=v.subVideoDescriptions),e.next=19,null===(h=this._dataChannelSignal)||void 0===h?void 0:h.sendSignaling("publish",_);case 19:if(200===(null==(m=e.sent)?void 0:m.code)){e.next=22;break}throw new ZN(JN.PUBLISH_FAILED,(null==m?void 0:m.message)||"publish failed");case 22:return IB.rtcRecvAnswer(0,nB.INCRANSWER,(null==m||null===(f=m.relayMessage)||void 0===f?void 0:f.sequenceId)||0,null==m||null===(p=m.relayMessage)||void 0===p?void 0:p.sdp,iB.UP,"",""),y=new Promise((function(e,r){var n,i,o,a,c;null===(n=S._handler)||void 0===n||n.handleAck({action:Uz.publish,streamId:m.streamId,audioMid:s,videoMid:u,transceiverInit:v.transceiverInit,signalingAck:{audioMid:null==m||null===(i=m.relayMessage)||void 0===i?void 0:i.audioMid,videoMid:null==m||null===(o=m.relayMessage)||void 0===o?void 0:o.videoMid,sdp:null==m||null===(a=m.relayMessage)||void 0===a?void 0:a.sdp,sequenceId:null==m||null===(c=m.relayMessage)||void 0===c?void 0:c.sequenceId},stream:t,onSuccess:function(){eq.print("publish()","publish success"),e(0)}})})),e.next=26,y;case 26:return t.streamId=m.streamId,t.videoMid=u,t.audioMid=s,t.subVideoDescriptions=v.subVideoDescriptions,this.monitor.rtcPublishStat(oB.SUCCESS,aB.W_0,a,sB.UNKNOWN),t.statsReport.setLocalStreamStatsEvtInterval(this,this._handler,this.monitor),e.abrupt("return");case 35:return e.prev=35,e.t0=e.catch(6),e.t0 instanceof Error&&this.monitor.rtcPublishStat(oB.FAIL,aB.W_0,a,e.t0.message),e.next=40,null===(g=this._handler)||void 0===g?void 0:g.rollback(t.stream.id,t);case 40:throw e.t0;case 41:case"end":return e.stop()}}),e,this,[[6,35]])}))),function(e){return R.apply(this,arguments)})},{key:"updatePubTrack",value:(I=u(o().mark((function e(t){var r,n,i,a,s,u,c,d,l,h,f,p,v,_,m,y,g,S,b,k,T,I,R,A,w,C,O,x,N,D,P;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(eq.print("updatePubTrack()","localStream: %o",t),i=t.videoTrack,a=t.audioTrack,s=t.pubAudio,u=t.pubVideo,c=null==a?void 0:a.getTrack("preprocessing"),d=null==i?void 0:i.getTrack("preprocessing"),u&&d?null===(l=t.videoTransceiver)||void 0===l||l.sender.replaceTrack(d):null===(h=t.videoTransceiver)||void 0===h||h.sender.replaceTrack(null),null===(r=this._handler)||void 0===r||r.updateScaleResolutionDownBy(t),s&&c?(p=a.mixType,(v=a.mixedAudioTrack)&&p!==te.PLAYOUT&&!0===c.enabled&&(c=v),null===(f=t.audioTransceiver)||void 0===f||f.sender.replaceTrack(c)):null===(_=t.audioTransceiver)||void 0===_||_.sender.replaceTrack(null),m={localaudio:!!a,localvideo:!!i,videostream:u,audiostream:s,extvideo:!!(i instanceof BH),extaudio:!!(a instanceof jH)},y={},g=0,S=Object.entries(m);g<S.length;g++)b=E(S[g],2),k=b[0],(T=b[1])!==Reflect.get(t.pubAttributes,k)&&Reflect.set(y,k,T);if(Object.keys(y).length){e.next=12;break}return e.abrupt("return");case 12:return t.observer&&(I=t.observer,R=y.audiostream,A=y.videostream,w=y.localaudio,C=y.localvideo,O=y.extaudio,x=y.extvideo,void 0!==C?void 0!==x?I.setPushVideo(x):I.setEnableVideo(C):void 0!==A&&I.setUnmuteVideo(A),void 0!==w?void 0!==O?I.setPushAudio(O):I.setEnableAudio(w):void 0!==R&&I.setUnmuteAudio(R)),t.pubAttributes=m,N={roomId:this._roomId,streamId:t.streamId,attributes:y},e.next=17,null===(n=this._dataChannelSignal)||void 0===n?void 0:n.sendSignaling("updateStreamAttributes",N);case 17:if(200===(null==(D=e.sent)?void 0:D.code)){e.next=20;break}throw new ZN(JN.UPDATE_TRACK_FAILED,(null==D?void 0:D.message)||"update track failed");case 20:if(!yP){e.next=23;break}return e.next=23,null===(P=this._handler)||void 0===P?void 0:P.setCurrentDescription();case 23:case"end":return e.stop()}}),e,this)}))),function(e){return I.apply(this,arguments)})},{key:"updateToken",value:(T=u(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(eq.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 ZN(JN.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 ZN(JN.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 T.apply(this,arguments)})},{key:"unpublish",value:(k=u(o().mark((function e(t){var r,n,i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return eq.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:Uz.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 k.apply(this,arguments)})},{key:"subscribe",value:(b=u(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=u(o().mark((function e(a,s){var u,c,d,l,f,p,v,_,m,y,g,S,b,E,k,T,I,R,A,w,C,O,x,N,D,P,M,L,U,V,F,B,j,G,H,z,q,K;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.streamState!==Nz.SUB_ED){e.next=2;break}return e.abrupt("return",i._updateSubTrack(t,r,Oz.SUB,n).then(a,s));case 2:if(t.streamState!==Nz.SUB_ING){e.next=7;break}return i._subStreamQueue[t.streamId]||(i._subStreamQueue[t.streamId]=[]),eq.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(eq.print("subscribe()","mediaType: %o",r),nq("subscribe()",t),t.streamState=Nz.SUB_ING,u=!1,c=!1,wP(r)&&(c=!0),CP(r)&&(u=!0),u||!i._multiChatMode()){e.next=17;break}return t.streamState=Nz.INIT,i.emit("SUB_END",t.streamId),e.abrupt("return",a(null));case 17:if(d=lP(),l=t.audioMid,f=t.videoMid,v=t.paused,_=t.subVideo,e.prev=22,!l||!f){e.next=29;break}return e.next=26,null===(D=i._handler)||void 0===D?void 0:D.subscribe(t,{audioMid:l,videoMid:f});case 26:p=e.sent,e.next=36;break;case 29:return e.next=31,null===(P=i._handler)||void 0===P?void 0:P.subscribe(t);case 31:if(p=e.sent){e.next=34;break}throw new ZN(JN.ADD_TRANSCEIVER_FAILED,"add transceiver failed");case 34:l=p.audioMid,f=p.videoMid;case 36:return t.paused=!u,t.subVideo=u,M={spatialLayer:(null==n?void 0:n.spatialLayer)||0,temporalLayer:0,spatialSubLayer:(null==n?void 0:n.spatialSubLayer)||-1},L={audio:!i._multiChatMode(),video:!0,data:!0,screen:t.isScreen,browser:"chrome-stable",videoMid:(null===(m=p)||void 0===m?void 0:m.autosubVideoMid)||f,audioMid:(null===(y=p)||void 0===y?void 0:y.autosubAudioMid)||l,sdpInfo:{sdp:null===(g=p)||void 0===g?void 0:g.partialSdp,semantics:null===(S=p)||void 0===S?void 0:S.semantics,type:null===(b=p)||void 0===b?void 0:b.type},streamUserId:t.userId,streamId:t.streamId,config:{enableMediaType:{audio:!!i._multiChatMode()||c,video:u},qualityLayer:M},extra:{enableSendRTT:!0}},e.next=42,null===(E=i._dataChannelSignal)||void 0===E?void 0:E.sendSignaling("subscribe",L);case 42:if(200===(null==(U=e.sent)?void 0:U.code)){e.next=45;break}throw new ZN(JN.SUBSCRIBE_FAILED,(null==U?void 0:U.message)||"subscribe failed");case 45:return V=[],F=!i._multiChatMode(),B=!t.videoTrack,i._subResolves[t.streamId]||(i._subResolves[t.streamId]=[]),B&&V.push(new Promise((function(e,r){i._subResolves[t.streamId].push(e);var n=setTimeout((function(){return r(new ZN(JN.TIME_OUT,"wait video timeout for userId: ".concat(t.userId)))}),tq);t.on("ontrack",(function r(i){"video"===i.mediaType&&(eq.print("remoteStream ".concat(t.userId," received video track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),F&&V.push(new Promise((function(e,r){i._subResolves[t.streamId].push(e);var n=setTimeout((function(){return r(new ZN(JN.TIME_OUT,"wait audio timeout for userId: ".concat(t.userId)))}),tq);t.on("ontrack",(function r(i){"audio"===i.mediaType&&(eq.print("remoteStream ".concat(t.userId," received audio track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),j=function(e){t.ontrack(e)},null===(k=i._handler)||void 0===k||k.on("ontrack",j),i._ontrackCallbackMap.set(t,j),G=null==U?void 0:U.relayMessage,H=G.audioMid,z=G.videoMid,h(T={},l,H),h(T,f,z),q=T,eq.print("sub midmap",t.userId,q),yP?(t.videoMid=f,t.audioMid=l):(t.videoMid=z,t.audioMid=H),t._workaround_1_=!1,t.subMediaType=r,t.streamState=Nz.SUB_ED,t.subLayer=M,IB.rtcRecvAnswer(0,nB.INCRANSWER,(null==U||null===(I=U.relayMessage)||void 0===I?void 0:I.sequenceId)||0,null==U||null===(R=U.relayMessage)||void 0===R?void 0:R.sdp,iB.DOWN,t.streamId,t.userId),e.next=65,null===(A=i._handler)||void 0===A?void 0:A.handleAck({action:Uz.subscribe,streamId:t.streamId,audioMid:l,videoMid:f,transceiverInit:null===(w=p)||void 0===w?void 0:w.transceiverInit,signalingAck:{audioMid:null==U||null===(C=U.relayMessage)||void 0===C?void 0:C.audioMid,videoMid:null==U||null===(O=U.relayMessage)||void 0===O?void 0:O.videoMid,sdp:null==U||null===(x=U.relayMessage)||void 0===x?void 0:x.sdp,sequenceId:null==U||null===(N=U.relayMessage)||void 0===N?void 0:N.sequenceId},stream:t});case 65:return e.next=67,Promise.all(V);case 67:i._multiChatMode()||(t.subAudio=c),i.monitor.rtcSubscribeStat(uB.SUCCESS,d,cB.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=84;break;case 74:return e.prev=74,e.t0=e.catch(22),e.t0 instanceof Error&&i.monitor.rtcSubscribeStat(uB.FAIL,d,e.t0.message,t.userId),t.paused=v,t.subVideo=_,t.streamState=Nz.INIT,e.next=82,null===(K=i._handler)||void 0===K?void 0:K.rollback(t.streamId,t);case 82:s(e.t0),i.emit("SUB_END",t.streamId);case 84:case"end":return e.stop()}}),e,null,[[22,74]])})));return function(t,r){return e.apply(this,arguments)}}()));case 1:case"end":return e.stop()}}),e)}))),function(e,t,r){return b.apply(this,arguments)})},{key:"_handleSubStreamQueue",value:function(e){var t,r=this;if(null!==(t=this._subStreamQueue[e])&&void 0!==t&&t.length){eq.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 eq.print("_subStreamQueue","streamId: %o, END",e)}},{key:"controlMessage",value:(S=u(o().mark((function e(t){var r,n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return eq.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 S.apply(this,arguments)})},{key:"updateUserAttributes",value:(y=u(o().mark((function e(t){var r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return eq.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 y.apply(this,arguments)})},{key:"updateSubTrack",value:(_=u(o().mark((function e(t,r,n,i){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._updateSubTrack(t,r,n,i||t.subLayer));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t,r,n){return _.apply(this,arguments)})},{key:"_updateSubTrack",value:(v=u(o().mark((function e(t,r,n,i){var a,s,u,c,d,l,h,f,p;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return eq.print("updateSubTrack()","mediaType: %o, subLayer: %o",r,i),nq("updateSubTrack()",t),u=0,u=n===Oz.SUB?t.subMediaType|r:t.subMediaType-(t.subMediaType&r),eq.print("updateSubTrack","prev: %o, direction: %o, mediaType: %o, newMediaType: %o",t.subMediaType,n,r,u),t.subMediaType===u&&eq.print("updateSubTrack","mediaType no change"),c=!1,d=!1,wP(u)&&(d=!0),CP(u)&&(c=!0),l=i||t.subLayer,h={roomId:this._roomId,streamList:[t.streamId],config:{enableMediaType:{video:c,audio:!!this._multiChatMode()||d},qualityLayer:l}},e.next=13,null===(a=this._dataChannelSignal)||void 0===a?void 0:a.sendSignaling("updateSubscribe",h);case 13:if(200===(null==(f=e.sent)?void 0:f.code)){e.next=16;break}throw new ZN(JN.UPDATE_TRACK_FAILED,(null==f?void 0:f.message)||"update track failed");case 16:return t.paused=!c,this._multiChatMode()||(null===(p=t.observer)||void 0===p||p.setUnmuteAudio(d),t.subAudio=d),null===(s=t.observer)||void 0===s||s.setUnmuteVideo(c),t.subVideo=c,t.subMediaType=u,t.subLayer=l,e.abrupt("return",t);case 23:case"end":return e.stop()}}),e,this)}))),function(e,t,r,n){return v.apply(this,arguments)})},{key:"subscribe4pushTrack",value:(p=u(o().mark((function e(t,r){var n,i,a,s,u,c,d,l,f,p,v,_,m,y,g,S,b,E=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(eq.print("subscribe4pushTrack()","streamInfo: %o",r),nq("subscribe4pushTrack()",t),c=null==r?void 0:r.message,d=c.audioMid,l=c.videoMid,f=c.sequenceId,t.subAudio=!0,!(f<t.sequenceId)){e.next=7;break}return eq.print("subscribe4pushTrack","sequenceId return",f,t.sequenceId),e.abrupt("return");case 7:if(p=t.audioMid,v=t.videoMid,null===(n=t.observer)||void 0===n||n.setPushTrack(!0),!p||!v){e.next=16;break}return e.next=13,null===(m=this._handler)||void 0===m?void 0:m.subscribe(t,{audioMid:p,videoMid:v});case 13:_=e.sent,e.next=23;break;case 16:return e.next=18,null===(y=this._handler)||void 0===y?void 0:y.subscribe(t);case 18:if(_=e.sent){e.next=21;break}throw new ZN(JN.ADD_TRANSCEIVER_FAILED,"add transceiver failed");case 21:p=_.audioMid,v=_.videoMid;case 23:return h(i={},p,d),h(i,v,l),g=i,eq.print("onpushtrack midmap",t.userId,g),yP?(t.audioMid=p,t.videoMid=v):(t.audioMid=d,t.videoMid=l),t.autosubAudioMid=d,t.autosubVideoMid=l,t.sequenceId=f,this._subResolves[t.streamId]||(this._subResolves[t.streamId]=[]),S=[],t.audioTrack||S.push(new Promise((function(e,r){E._subResolves[t.streamId].push(e);var n=setTimeout((function(){return r(new ZN(JN.TIME_OUT,"wait audio timeout for userId: ".concat(t.userId)))}),tq);t.on("ontrack",(function r(i){"audio"===i.mediaType&&(eq.print("remoteStream ".concat(t.userId," received audio track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),b=function(e){t.ontrack(e)},null===(a=this._handler)||void 0===a||a.on("ontrack",b),this._ontrackCallbackMap.set(t,b),e.next=37,null===(s=this._handler)||void 0===s?void 0:s.handleAck({action:Uz.pushtrack,streamId:t.streamId,audioMid:p,videoMid:v,stream:t,transceiverInit:null===(u=_)||void 0===u?void 0:u.transceiverInit,signalingAck:null==r?void 0:r.message});case 37:return e.next=39,Promise.all(S);case 39:this._context&&t.statsReport.setRemoteStreamStatsEvtInterval(this,this._handler,this.monitor,this._context);case 40:case"end":return e.stop()}}),e,this)}))),function(e,t){return p.apply(this,arguments)})},{key:"unsubscribe4removeTrack",value:(d=u(o().mark((function e(t,r){var n,i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(nq("unsubscribe4removeTrack()",t),eq.print("unsubscribe4removeTrack()","sequenceId: ",r.sequenceId),!(r.sequenceId<t.sequenceId)){e.next=5;break}return eq.print("unsubscribe4removeTrack()","sequenceId return"),e.abrupt("return");case 5:if(t.subAudio=!1,!t.subVideo&&!t.paused){e.next=10;break}return t.sequenceId=r.sequenceId,eq.print("unsubscribe4removeTrack()","foo %o",t.userId),e.abrupt("return");case 10:return null===(n=t.observer)||void 0===n||n.setPushTrack(!1),e.next=13,null===(i=this._handler)||void 0===i?void 0:i.handleAck({action:Uz.removetrack,streamId:t.streamId,audioMid:t.audioMid,videoMid:t.videoMid,stream:t});case 13:this._subResolves[t.streamId]&&this._subResolves[t.streamId].forEach((function(e){return e(0)})),eq.print("clean unsubscribe4removeTrack"),t.clean(),t.resetHasSubscribed(),t.statsReport.unsubscribe();case 18:case"end":return e.stop()}}),e,this)}))),function(e,t){return d.apply(this,arguments)})},{key:"unsubscribe",value:(s=u(o().mark((function e(t,r){var n,i,a,s,u,c,d,l,h=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=h.length>2&&void 0!==h[2]&&h[2],nq("unsubscribe()",t),s=t.subMediaType-(t.subMediaType&r),a||!this._subConfig.muteReplaceUnsub&&s===lz.NONE){e.next=5;break}return e.abrupt("return",this._updateSubTrack(t,r,Oz.UNSUB));case 5:if(u={roomId:this._roomId,streamId:t.streamId,userId:t.userId},null===(n=this._dataChannelSignal)||void 0===n||n.sendSignaling("unsubscribe",u).catch((function(){})),t.streamState=Nz.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,t.paused=!1,t._workaround_1_||(t.subAudio=!1),null===(i=t.observer)||void 0===i||i.setSubscribeVideo(!1),t.subAudio){e.next=23;break}return null===(c=t.observer)||void 0===c||c.setSubscribeAudio(!1),e.next=17,null===(d=this._handler)||void 0===d?void 0:d.handleAck({action:Uz.unsubscribe,streamId:t.streamId,audioMid:t.audioMid,videoMid:t.videoMid,stream:t});case 17:l=e.sent,this._subResolves[l]&&this._subResolves[l].forEach((function(e){return e(0)})),eq.print("unsubscribe","clean unsub ".concat(t.userId)),t.clean(),this.removeOnTrackListener(t),t.statsReport.unsubscribe();case 23: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=u(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(nq("handleRemoveStream()",t),t.subVideo=!1,r.message&&r.message!==oj.videoMuted?t._workaround_1_=!1:t._workaround_1_=!0,t.hasSubscribed){e.next=5;break}return e.abrupt("return");case 5:this.unsubscribe(t,V.AUDIO_AND_VIDEO,!0);case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return a.apply(this,arguments)})},{key:"leave",value:(n=u(o().mark((function e(){var t,r,n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(eq.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 ZN(JN.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=u(o().mark((function e(t){var r,n,i,a,s,u,c,d,l,h,f,p,v,_,m,y,g,S=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);case 2:if(s=e.sent){e.next=5;break}throw new ZN(JN.ADD_TRANSCEIVER_FAILED,"add transceiver failed");case 5:return u=lP(),c=s.audioMid,d=s.videoMid,e.t0=this._appId,e.t1=t.streamId,e.t2=c,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,Uj();case 15:return e.t5=e.sent,e.t6=window.navigator.userAgent,e.t7=JB.VERSION,e.t8=qB.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){S._subResolves[t.streamId].push(e);var n=setTimeout((function(){return r(new ZN(JN.TIME_OUT,"wait video timeout for streamId: ".concat(t.streamId)))}),tq);t.on("ontrack",(function r(i){"video"===i.mediaType&&(eq.print("remoteStream ".concat(t.userId," received video track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),f.push(new Promise((function(e,r){S._subResolves[t.streamId].push(e);var n=setTimeout((function(){return r(new ZN(JN.TIME_OUT,"wait audio timeout for streamId: ".concat(t.streamId)))}),tq);t.on("ontrack",(function r(i){"audio"===i.mediaType&&(eq.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.audioMid,m=v.videoMid,y=v.sequenceId,g=v.sdp,t.videoMid=m,t.audioMid=_,t.sequenceId=y,t._workaround_1_=!1,t.paused=!1,t.streamState=Nz.SUB_ED,t.subAudio=!0,t.subVideo=!0,e.next=46,null===(a=this._handler)||void 0===a?void 0:a.handleAck({action:Uz.subscribe,streamId:t.streamId,audioMid:c,videoMid:d,transceiverInit:null==s?void 0:s.transceiverInit,signalingAck:{audioMid:_,videoMid:m,sdp:g,sequenceId:y},stream:t});case 46:return e.next=48,Promise.all(f);case 48:this.monitor.rtcSubscribeStat(uB.SUCCESS,u,cB.UNKNOWN,t.userId),this._context&&t.statsReport.setRemoteStreamStatsEvtInterval(this,this._handler,this.monitor,this._context);case 50:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"unsubscribePublicStream",value:(t=u(o().mark((function e(t){var r,n,i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return nq("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=Nz.INIT,t.subVideo=!1,t.subAudio=!1,e.next=14,null===(r=this._handler)||void 0===r?void 0:r.handleAck({action:Uz.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;eq.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}}]),O}(VL);function oq(e,t,r){var n=r.value;return r.value=u(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 ZN(JN.NOT_CONNECTED_YET,"error in ".concat(t,": try again after joined"));case 7:case"end":return e.stop()}}),e,this)}))),r}function aq(e,t,r){var n=r.value;return r.value=u(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}$z([function(e,t,r){var n=r.value;return r.value=u(o().mark((function e(){var t,r,i,a,s=this,c=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(t=c.length,r=new Array(t),i=0;i<t;i++)r[i]=c[i];return a=!1,e.abrupt("return",new Promise(function(){var e=u(o().mark((function e(t,i){var u;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s.on("INTERRUPT",(function(){a=!0,i(new ZN(JN.OPERATION_CANCEL,"operation not finish when leave"))})),e.prev=1,e.next=4,n.apply(s,r);case 4:u=e.sent,t(u),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}],iq.prototype,"join",1),$z([aq,oq],iq.prototype,"publish",1),$z([aq,oq],iq.prototype,"updatePubTrack",1),$z([aq,oq],iq.prototype,"unpublish",1),$z([aq,oq],iq.prototype,"subscribe",1),$z([oq],iq.prototype,"controlMessage",1),$z([oq],iq.prototype,"updateUserAttributes",1),$z([oq],iq.prototype,"updateSubTrack",1),$z([aq,oq],iq.prototype,"subscribe4pushTrack",1),$z([aq,oq],iq.prototype,"unsubscribe4removeTrack",1),$z([aq,oq],iq.prototype,"unsubscribe",1),$z([oq],iq.prototype,"handleRemoveStream",1),$z([aq],iq.prototype,"subscribePublicStream",1),$z([aq],iq.prototype,"unsubscribePublicStream",1);var sq=ha,uq=St,cq=se,dq=Te,lq=Pe,hq=He,fq=Vt,pq=es,vq=gt.f,_q=Yo,mq=cq.Symbol,yq=mq&&mq.prototype;if(uq&&hq(mq)&&(!("description"in yq)||void 0!==mq().description)){var gq={},Sq=function(){var e=arguments.length<1||void 0===arguments[0]?void 0:pq(arguments[0]),t=fq(yq,this)?new mq(e):void 0===e?mq():mq(e);return""===e&&(gq[t]=!0),t};_q(Sq,mq),Sq.prototype=yq,yq.constructor=Sq;var bq="Symbol(test)"==String(mq("test")),Eq=dq(yq.valueOf),kq=dq(yq.toString),Tq=/^Symbol\((.*)\)[^)]+$/,Iq=dq("".replace),Rq=dq("".slice);vq(yq,"description",{configurable:!0,get:function(){var e=Eq(this);if(lq(gq,e))return"";var t=kq(e),r=bq?Rq(t,7,-1):Iq(t,Tq,"$1");return""===r?void 0:r}}),sq({global:!0,constructor:!0,forced:!0},{Symbol:Sq})}nM("iterator");var Aq=Pp.right,wq=tt,Cq=Mp;ha({target:"Array",proto:!0,forced:!qi("reduceRight")||!Cq&&wq>79&&wq<83},{reduceRight:function(e){return Aq(this,e,arguments.length,arguments.length>1?arguments[1]:void 0)}});var Oq={};Object.defineProperty(Oq,"__esModule",{value:!0});var xq=function(){return(xq=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 Nq(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 Dq(e){return"object"==a(e)&&null!==e}function Pq(e){return"function"==typeof e}function Mq(){if("object"==("undefined"==typeof window?"undefined":a(window))&&Dq(window))return window}function Lq(){if("object"==("undefined"==typeof document?"undefined":a(document))&&Dq(document))return document}var Uq=function(e){if(e)return e.__SLARDAR_REGISTRY__||(e.__SLARDAR_REGISTRY__={Slardar:{plugins:[],errors:[],subject:{}}}),e.__SLARDAR_REGISTRY__.Slardar},Vq=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))}([],Nq(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=Uq(Mq());r&&(r.errors||(r.errors=[]),r.errors.push(e))}(o),[]}},Fq=function(e){return e.requestIdleCallback||function(t){return e.setTimeout(t,1)}},Bq=function(){return Date.now()};var jq=function(e,t){return Dq(e)?xq(xq({},t),e):!!e&&t};var Gq=["SCRIPT","STYLE","META","HEAD"],Hq=["js_error","http","resource_error"],zq=["performance","performance_longtask","performance_timing","custom"],qq=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=Gq),!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)},Kq=function(e,t,r,n){if(function(){if(Mq()&&"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(){Fq(r)((function(){r.html2canvas&&r.html2canvas(n.body,{scale:360/r.innerWidth}).then((function(t){e(t.toDataURL("image/jpeg",.1))}))}))}},Xq=function(e,t,r,n,i){if(void 0===e&&(e=Mq()),void 0===t&&(t=Lq()),void 0===r&&(r=function(){if(Mq()&&Pq(window.PerformanceObserver))return window.PerformanceObserver}()),void 0===n&&(n=function(){if(Mq()&&Pq(window.MutationObserver))return window.MutationObserver}()),void 0===i&&(i=function(){if(Mq()&&Dq(window.performance))return window.performance}()),t&&e)return function(o,a){var s,u,c,d,l,h,f=o.threshold,p=o.screenshot,v=o.rootSelector,_=o.autoDetect,m=o.ssUrl,y=Fq(e),g=Nq(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 Pq(r)&&r.call(e,t)||[]},function(){var t=(e||{}).clearResourceTimings;Pq(t)&&t.call(e)},function(t){var r=(e||{}).getEntriesByName;return Pq(r)&&r.call(e,t)||[]}]}(i),2)[1],S=0,b=!1,E=function(e){s&&a&&a({ev_type:"blank_screen",payload:{timestamp:s[0],score:s[1],screenshot:e,error:u}})},k=(d=function(){s&&!b&&(b=!0,I(),p?Kq(E,m,e,t):E())},function(){l||(h=Bq(),l=e.setTimeout((function(){l=0,h<S||d()}),g()>1e4?2e3:8e3))});function T(){c&&clearTimeout(c),c=e.setTimeout((function(){y((function(){e.requestAnimationFrame((function(){var e=v?t.querySelector(v):t.body;e&&((e=qq(e,0,0,f))<f?(s=[Bq(),e],k()):s=void 0)}))}))}),1e3)}!function(e){var t=Nq(function(e){var t=!1;return[function(r){t||(t=!0,e&&e(r))}]}(e),1)[0];["unload","beforeunload","pagehide"].forEach((function(e){addEventListener(e,t)}))}((function(){!b&&u&&E()}));var I=function(){clearTimeout(c),A&&A(),C&&C()},R=(o=Nq(function(e,t){var r=e&&new e(t);return[function(e,t){r&&e&&r.observe(e,t)},function(){return r&&r.disconnect()}]}(n,T),2),o[0]),A=o[1],w=(o=Nq(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 c&&1<r.length&&T()})),2),o[0]),C=o[1];return _&&function(e){var t=Mq(),r=Lq();t&&r&&("loading"!==r.readyState?e():t.addEventListener("DOMContentLoaded",(function(){setTimeout((function(){e()}),0)}),!1))}((function(){var e;R(null===(e=Lq())||void 0===e?void 0:e.body,{subtree:!0,childList:!0}),w("longtask","resource"),T()})),[I,function(e){b||function(e){return~zq.indexOf(e.ev_type)}(e)||(S=Bq(),u&&S-u.timestamp>1e4&&(u=void 0),u=function(e,t){if(-1===Hq.indexOf(t.ev_type))return e;if("http"===t.ev_type&&t.payload.response.status<400)return e;if(e&&Hq.indexOf(e.type)<Hq.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:Bq()}}(u,e))},T]}},Wq="blankScreen";function Yq(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],jq(t,r)}(e,Wq,t)||jq(r,t);a&&(a=Nq(Vq(Xq,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 Jq={autoDetect:!0,threshold:1.5,screenshot:!0,ssUrl:"https://apm.volccdn.com/mars-web/apmplus/web/html2canvas.min.js"};var Qq=Oq.blankScreenPlugin=function(e){return{name:Wq,setup:function(t){!function(e,t){Yq(e,Jq,t)}(t,e)}}},Zq=xe,$q=Zc,eK=zc;ha({target:"Object",stat:!0,forced:ye((function(){$q(1)})),sham:!eK},{getPrototypeOf:function(e){return $q(Zq(e))}});var tK=SD.start;ha({target:"String",proto:!0,forced:bD},{padStart:function(e){return tK(this,e,arguments.length>1?arguments[1]:void 0)}});var rK,nK={};Object.defineProperty(nK,"__esModule",{value:!0});var iK=function(){return(iK=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 oK(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 aK(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 sK=function(e){return JSON.stringify({ev_type:"batch",list:e})};var uK=["init","start","config","beforeDestroy","provide","beforeReport","report","beforeBuild","build","beforeSend","send","beforeConfig"],cK=function(){return{}};function dK(e){return"object"==a(e)&&null!==e}var lK=Object.prototype;function hK(e){return!!dK(e)&&("function"!=typeof Object.getPrototypeOf?"[object Object]"===lK.toString.call(e):(e=Object.getPrototypeOf(e))===lK||null===e)}function fK(e){return"[object Array]"===lK.toString.call(e)}function pK(e){return"function"==typeof e}function vK(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function _K(e,t){var r,n=iK({},e);for(r in t)vK(t,r)&&void 0!==t[r]&&(dK(t[r])&&hK(t[r])?n[r]=_K(dK(e[r])?e[r]:{},t[r]):fK(t[r])&&fK(e[r])?n[r]=mK(e[r],t[r]):n[r]=t[r]);return n}function mK(e,t){return e=fK(e)?e:[],t=fK(t)?t:[],Array.prototype.concat.call(e,t).map((function(e){return e instanceof RegExp?e:dK(e)&&hK(e)?_K({},e):fK(e)?mK([],e):e}))}function yK(e,t){if(!fK(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 gK=function(e,t){if(!fK(e))return e;var r=e.indexOf(t);return 0<=r?((t=e.slice()).splice(r,1),t):e},SK=function(e,t,r){return function(e,t,r){for(var n,i=(t=oK(t.split(".")))[0],o=t.slice(1);e&&0<o.length;)e=e[i],i=(n=oK(o))[0],o=n.slice(1);if(e)return r(e,i)}(e,t,(function(e,t){if(e&&t in e&&pK(e[t]))try{return e[t].apply(e,r)}catch(n){return}}))};function bK(e){try{return function(e){return"string"==typeof e}(e)?e:JSON.stringify(e)}catch(t){return"[FAILED_TO_STRINGIFY]:"+String(t)}}var EK=0,kK=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];console.error.apply(console,aK(["[SDK]",Date.now(),(""+EK++).padStart(8," ")],oK(e),!1))},TK=0,IK=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];console.warn.apply(console,aK(["[SDK]",Date.now(),(""+TK++).padStart(8," ")],oK(e),!1))},RK=function(e){return function(t){for(var r=t,n=0;n<e.length&&r;n++)try{r=e[n](r)}catch(i){kK(i)}return r}};function AK(){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 wK=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)}},CK=function(e){function t(e){n=gK(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 wK(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 OK=function(e){var t,r,n,i=(t={},r={},n={set:function(e,i){return t[e]=i,r[e]=bK(i),n},merge:function(e){return t=iK(iK({},t),e),Object.keys(e).forEach((function(t){r[t]=bK(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 iK({},r)}},n);e.provide("context",i),e.on("report",(function(e){return e.extra||(e.extra={}),e.extra.context=i.toString(),e}))},xK=function(e,t,r){function n(){for(var r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];if(u=r[0]){var a=u.split(".")[0];if(a in n)return SK(n,u,[].slice.call(r,1));var s=o[a]||[],u=null!==(u=null==t?void 0:t(e))&&void 0!==u?u:{};s.push(aK([u],oK(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 cK;var a=e[t],s=r.apply(void 0,aK([a],oK(i),!1)),u=s;return pK(u)&&n&&(u=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];try{return s.apply(this,e)}catch(r){return pK(a)&&a.apply(this,e)}}),e[t]=u,function(r){r||(u===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=oK(t))[0];var n=n.slice(1);null!=r&&r(e,t,n)})),o[t]=null)})),n};function NK(e,t){var r=t||{};e.provide("initSubject",(function(e){var t=(e=oK(e,2))[0];e=e[1];return r[t]||(r[t]=function(t,r){var n=CK();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 DK(){if("object"==("undefined"==typeof window?"undefined":a(window))&&dK(window))return window}function PK(){var e=function(){if(DK()&&"navigator"in window)return window.navigator}();if(e)return e.connection||e.mozConnection||e.webkitConnection}function MK(){var e=DK()&&DK()&&window.location;return null==e?void 0:e.href}var LK=function(e){var t={url:MK(),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 UK(e){return(null==e?void 0:e.effectiveType)||(null==e?void 0:e.type)||""}var VK=function(e,t,r){var n,i=t.url,o=t.data,a=void 0===(n=t.success)?cK:n,s=void 0===(n=t.fail)?cK:n,u=void 0===(n=t.getResponseText)?cK: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!=u&&u(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)},FK=function(){var e=function(){if("function"==typeof XMLHttpRequest&&pK(XMLHttpRequest))return XMLHttpRequest}();return e?{get:function(t){VK("GET",t,e)},post:function(t){VK("POST",t,e)}}:{get:cK,post:cK}};function BK(e){function t(e){n.post(r.getEndpoint(),sK([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 u(){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&&u.call(this),clearTimeout(s),s=setTimeout(u.bind(this),o)},flush:function(){clearTimeout(s),u.call(this)},getBatchData:function(){return a.length?sK(a):""},clear:function(){clearTimeout(s),a=[]}}}(e),n=function(){var e=DK();return e&&e.navigator.sendBeacon?{get:function(){},post:function(t,r){e.navigator.sendBeacon(t,r)}}:{get:cK,post:cK}}();return function(e){var t=oK(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 jK={build:function(e){return{ev_type:e.ev_type,payload:e.payload,common:iK(iK({},e.extra||{}),e.overrides||{})}}};function GK(e){var t,r=e.plugins||{};for(t in r)r[t]&&!dK(r[t])&&(r[t]={});return iK(iK({},e),{plugins:r})}function HK(e){return dK(e)&&"aid"in e}function zK(e){return iK({},e)}var qK="/settings/get/webpro",KK="/monitor_web/collect",XK=[KK,qK,"/monitor_browser/collect"],WK={sample_rate:1,include_users:[],sample_granularity:"session",rules:{}},YK=function(e,t){return void 0===t&&(t=KK),(e&&0<=e.indexOf("//")?"":"https://")+e+t},JK=function(e,t){return void 0===t&&(t=qK),(e&&0<=e.indexOf("//")?"":"https://")+e+t},QK=function(e){return e+"_"+Date.now()},ZK=function(e){return"APMPLUS"+e},$K=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=ZK(e))||{userId:AK(),deviceId:AK(),r:Math.random()}},eX=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=ZK(t),{userId:r,deviceId:n,r:e.r})},tX=function(e){var t,r,n,i=e,o={},a=cK,s=cK;return{getConfig:function(){return i},setConfig:function(e){return o=iK(iK({},o),e||{}),u(),t||(t=e,i.useLocalConfig?(n={},a()):r?c():function(e,t,r,n){e.get({withCredentials:!0,url:JK(t)+"?aid="+r,success:function(e){n(e.data||{})},fail:function(){n()}})}(i.transport,i.domain,i.aid,(function(e){r=e,c()}))),i},onChange:function(e){s=e},onReady:function(t){a=function(){e.userId!==i.userId&&(e.sample.r=Math.random(),u()),eX(i),t()},n&&a()}};function u(){var t=iK(iK(iK({},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=_K(r,e[n++]);return r}(e.plugins,(null==n?void 0:n.plugins)||{},o.plugins||{}),t.sample=rX(rX(e.sample,null==n?void 0:n.sample),o.sample),i=t,s()}function c(){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),u(),a()}};function rX(e,t){if(!e||!t)return e||t;var r=iK(iK({},e),t);return r.include_users=aK(aK([],oK(e.include_users||[]),!1),oK(t.include_users||[]),!1),r.rules=aK(aK([],oK(Object.keys(e.rules||{})),!1),oK(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]=iK(iK({},e.rules[n]),t.rules[n]),r[n].conditional_sample_rules=aK(aK([],oK(e.rules[n].conditional_sample_rules||[]),!1),oK(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 nX=function(e){e.on("report",(function(e){return function(e){var t={url:MK(),timestamp:Date.now()};return iK(iK({},e),{extra:iK(iK({},t),e.extra||{})})}(e)}))},iX=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,iK(iK({},e),{extra:iK(iK({},r),e.extra||{})})}(t,e.config())}))},oX=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 dK(e)?Object.keys(e).reduce((function(t,r){return t+"&"+r+"="+e[r]}),"").replace("&","?"):""}(r))}))},aX=function(e){return e=$K(e.aid),{aid:0,pid:"",token:"",viewId:QK("_"),userId:e.userId,deviceId:e.deviceId,sessionId:AK(),domain:"apmplus.volces.com",plugins:{ajax:{ignoreUrls:XK},fetch:{ignoreUrls:XK},breadcrumb:{},pageview:{},jsError:{},resource:{},resourceError:{},performance:{},tti:{},fmp:{},blankScreen:!1},release:"",env:"production",sample:iK(iK({},WK),{r:e.r}),transport:FK()}};rK=nK.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,u=e.initConfigNormalizer,c=e.validateInitConfig,d={};uK.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)IK("already inited");else{if(!(e&&dK(e)&&c(e)))throw new Error("invalid InitConfig, init failed");var n=o(e);if(!n)throw new Error("defaultConfig missing");if(e=u(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&&dK(e)&&(m("beforeConfig",!1,e),null!=r&&r.setConfig(e))},config:function(e){if(l)return e&&dK(e)&&(m("beforeConfig",!1,e),null!=r&&r.setConfig(s(e))),null==r?void 0:r.getConfig()},provide:function(e,t){yK(v,e)?IK("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=RK(d.beforeReport)(e))||(e=RK(d.report)(e))&&(h?this.build(e):p.push(e)))},build:function(e){!h||(e=RK(d.beforeBuild)(e))&&(!(e=n.build(e))||(e=RK(d.build)(e))&&this.send(e))},send:function(e){!h||(e=RK(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]=gK(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,aK([],oK(r),!1))}catch(t){}})),t&&(d[e].length=0)}}({validateInitConfig:HK,initConfigNormalizer:GK,userConfigNormalizer:zK,createSender:void 0===t?function(e){return BK({size:20,endpoint:YK(e.domain),transport:e.transport})}:t,builder:void 0===e?jK:e,createDefaultConfig:void 0===r?aX:r,createConfigManager:tX});return OK(n),r=function(e){if(e)return e.__SLARDAR_REGISTRY__||(e.__SLARDAR_REGISTRY__={Slardar:{plugins:[],errors:[],subject:{}}}),e.__SLARDAR_REGISTRY__.Slardar}(DK()),NK(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),iX(n),nX(n),function(e){var t=PK(),r=UK(t);t&&(t.onchange=function(){r=UK(t)}),e.on("report",(function(e){return iK(iK({},e),{extra:iK(iK({},e.extra||{}),{network_type:r})})}))}(n),oX(n),r=xK(n,LK,(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=oK(r))[0],t=t.slice(1);n[e].apply(n,aK([],oK(t),!1))}))})),function(e){e.on("init",(function(){var t=[],r=e.config();r&&r.integrations&&r.integrations.forEach((function(r){yK(t,r.name)||(t.push(r.name),r.setup(e),r.tearDown&&e.on("beforeDestroy",r.tearDown))}))}))}(r),r},nK.getDefaultConfig=aX;var sX={};Object.defineProperty(sX,"__esModule",{value:!0});var uX=function(){return(uX=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 cX(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 dX(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 lX=function(){return{}};function hX(e){return"object"==a(e)&&null!==e}var fX=Object.prototype;function pX(e){return"function"==typeof e}function vX(e){return"string"==typeof e}function _X(e){return function(e){return"[object Array]"===fX.toString.call(e)}(e)&&e.length?function(e){for(var t=[],r=e.length,n=0;n<r;n++){var i=e[n];vX(i)?t.push(i.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")):i&&i.source&&t.push(i.source)}return new RegExp(t.join("|"),"i")}(e):null}function mX(e){try{return vX(e)?e:JSON.stringify(e)}catch(t){return"[FAILED_TO_STRINGIFY]:"+String(t)}}var yX=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 lX;var a=e[t],s=r.apply(void 0,dX([a],cX(i),!1)),u=s;return pX(u)&&n&&(u=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];try{return s.apply(this,e)}catch(r){return pX(a)&&a.apply(this,e)}}),e[t]=u,function(r){r||(u===e[t]?e[t]=a:s=a)}}};function gX(){if("object"==("undefined"==typeof window?"undefined":a(window))&&hX(window))return window}var SX=function(e){if(e)return e.__SLARDAR_REGISTRY__||(e.__SLARDAR_REGISTRY__={Slardar:{plugins:[],errors:[],subject:{}}}),e.__SLARDAR_REGISTRY__.Slardar},bX=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=SX(gX());r&&(r.errors||(r.errors=[]),r.errors.push(e))};function EX(e,t,r){return function(e,t){return hX(e)?uX(uX({},t),e):!!e&&t}(t=null===(e=e.config())||void 0===e?void 0:e.plugins[t],r)}var kX=["name","message","stack","filename","lineno","colno"],TX=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&&hX(e)?t.reduce((function(t,r){return t[r]=e[r],t}),{}):e}(e,kX):(function(e){return!!hX(e)&&("function"!=typeof Object.getPrototypeOf?"[object Object]"===fX.toString.call(e):(e=Object.getPrototypeOf(e))===fX||null===e)}(e)||function(e){return"undefined"!=typeof Event&&function(e,t){try{return e instanceof t}catch(r){return!1}}(e,Event)}(e)||vX(e))&&(t={message:mX(e)}),t},IX=function(e){return TX(e.error)},RX=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=TX(r);return uX(uX({},n),{name:null!==(t=n&&n.name)&&void 0!==t?t:"UnhandledRejection"})}}catch(i){}},AX=function(e){return(function(e){return"[object ErrorEvent]"===Object.prototype.toString.call(e)}(e)?IX:function(e){return"[object PromiseRejectionEvent]"===Object.prototype.toString.call(e)}(e)?RX:TX)(e)},wX=["EventTarget","Window","Node","ApplicationCache","ChannelMergerNode","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","MessagePort","Notification","SVGElementInstance","Screen","TextTrack","TextTrackCue","TextTrackList","WebSocket","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],CX=["setTimeout","setInterval","requestAnimationFrame","requestIdleCallback"],OX=["onload","onerror","onprogress","onreadystatechange"],xX="addEventListener",NX=function(e,t,r){function n(t,r){if(!pX(t))return t;var i={type:"capture-global",data:uX({},r)},o=t._w_||(t._w_=function(){try{return(t.handleEvent&&pX(t.handleEvent)?t.handleEvent:t).apply(this,[].map.call(arguments,(function(e){return n(e,r)})))}catch(a){var o=TX(a);throw o&&e({error:o,source:i}),a}});return o._hook_=!0,o}void 0===t&&(t=gX()),void 0===r&&(r=function(){if("function"==typeof XMLHttpRequest&&pX(XMLHttpRequest))return XMLHttpRequest}());var i=[];return t&&i.push.apply(i,dX([],cX(CX.filter((function(e){return t[e]})).map((function(e){return yX(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,dX([this,n(r,{function:e})],cX(i),!1))}}),!1)()}))),!1)),r&&r.prototype&&i.push(yX(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,dX([],cX(OX.filter((function(e){return t[e]&&!t[e]._hook_})).map((function(e){var r=yX(t,e,(function(t){return n(t,{function:e})}),!1)();return function(){r(),t[e]._hook_=void 0}}))),!1)),e.apply(this,r)}}),!1)()),wX.forEach((function(e){var r=t[e]&&t[e].prototype;r&&r.addEventListener&&(i.push(yX(r,xX,(function(t){return function(r,i,o){try{var a=i.handleEvent;pX(a)&&(i.handleEvent=n(a,{function:"handleEvent",target:e}))}catch(s){}return t&&t.call(this,r,n(i,{function:xX,target:e}),o)}}),!1)()),i.push(yX(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},DX=function(e,t){return e&&t&&e===t},PX=function(){var e;return function(t){try{if(function(e,t){return!!(e&&t&&DX(e.message,t.message)&&DX(e.stack,t.stack))}(t,e))return void(e=t)}catch(r){bX(r)}return e=t}},MX=function(e){if(e=void 0===e?gX():e)return function(t,r){var n,i,o=t.ignoreErrors,a=t.onerror,s=t.onunhandledrejection,u=t.dedupe,c=(t=t.captureGlobalAsync,_X(o)),d=[],l=PX(),h=function(e){var t=e.error,n=e.extra,i=e.react;e=e.source,t=u?l(t):t;r&&t&&(c&&c.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:IX(e),source:{type:"onerror"}})}),d.push((function(){return e.removeEventListener("error",n)}))),s&&(e.addEventListener("unhandledrejection",i=function(e){return h({error:RX(e),source:{type:"onunhandledrejection"}})}),d.push((function(){return e.removeEventListener("unhandledrejection",i)}))),t&&d.push.apply(d,dX([],cX(NX(h)),!1)),[function(e,t,r){return h({error:AX(e),extra:t,react:r,source:{type:"manual"}})},function(){d.forEach((function(e){return e()}))}]}},LX="jsError",UX={ignoreErrors:[],onerror:!0,onunhandledrejection:!0,captureGlobalAsync:!1,dedupe:!0};function VX(e){e.on("init",(function(){window.removeEventListener("error",e.pcErr,!0),window.removeEventListener("unhandledrejection",e.pcRej,!0);var t,r=EX(e,LX,UX);r&&(r=(t=cX(function(e,t,r,n){void 0===t&&(t={}),void 0===n&&(n=[]);try{var i=e.apply(void 0,dX([],cX(n),!1));return i&&i(t,r)||[]}catch(o){return bX(o),[]}}(MX,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 FX=sX.jsErrorPlugin=function(){return{name:LX,setup:function(e){VX(e)}}},BX={};Object.defineProperty(BX,"__esModule",{value:!0});var jX=function(){return(jX=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 GX(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 HX(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 zX=function(){return{}};function qX(e){return"object"==a(e)&&null!==e}function KX(e){return"function"==typeof e}var XX=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 zX;var a=e[t],s=r.apply(void 0,HX([a],GX(i),!1)),u=s;return KX(u)&&n&&(u=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];try{return s.apply(this,e)}catch(r){return KX(a)&&a.apply(this,e)}}),e[t]=u,function(r){r||(u===e[t]?e[t]=a:s=a)}}};function WX(){if("object"==("undefined"==typeof window?"undefined":a(window))&&qX(window))return window}var YX=function(e){if(e)return e.__SLARDAR_REGISTRY__||(e.__SLARDAR_REGISTRY__={Slardar:{plugins:[],errors:[],subject:{}}}),e.__SLARDAR_REGISTRY__.Slardar},JX=function(e,t,r,n){void 0===t&&(t={}),void 0===n&&(n=[]);try{var i=e.apply(void 0,HX([],GX(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=YX(WX());r&&(r.errors||(r.errors=[]),r.errors.push(e))}(o),[]}};function QX(e){var t=function(){if("object"==("undefined"==typeof document?"undefined":a(document))&&qX(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 ZX(e,t,r){return function(e,t){return qX(e)?jX(jX({},t),e):!!e&&t}(t=null===(e=e.config())||void 0===e?void 0:e.plugins[t],r)}var $X=["hash_0",function(e,t){var r,n=WX();n&&(n.addEventListener("hashchange",r=function(){return e(location.href)},!0),t((function(){return n.removeEventListener("hashchange",r,!0)})))}],eW=["history_0",function(e,t){var r,n,i,o=WX()&&window.history;o&&(n=function(){return e(location.href)},(r=[]).push(XX(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()}}})(),XX(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()}))})))}],tW=function(e,t){if(void 0===e&&(e=WX()),void 0===t&&(t=WX()&&window.location),e&&t)return function(e,r){var n,i,o,a=e.sendInit,s=e.initPid,u=e.routeMode,c=e.extractPid,d=e.onPidUpdate,l=(e=e.createObserver,[]),h="manual"===u?function(){return""}:function(e){return function(t){var r;return"hash"===e?(null===(r=QX(t).hash)||void 0===r?void 0:r.replace(/^#/,""))||"/":QX(t).path}}(u),f=c||function(){},p=(s=GX(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"!==u&&(o=GX(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=GX(e(u),1)[0],l.push(e((function(e){return o(u,e)})))),a&&d(),[s,function(){l.forEach((function(e){return e()}))}]}},rW="pageview",nW={sendInit:!0,routeMode:"history"};var iW,oW=BX.pageviewPlugin=function(){return{name:rW,setup:function(e){var t;(t=e).on("init",(function(){var e,r=ZX(t,rW,nW);r&&(r=GX(JX(tW,jX(jX({},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?$X:eW)}}),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))}))}}};fP()||window.__rtc_slardar__||((iW=rK())("init",{aid:432410,token:"d7271e1eac254529abcffc63e36b02c3",integrations:[oW(),FX(),Qq({screenshot:!1})]}),iW("start"),window.__rtc_slardar__=iW);var aW,sW=new(function(){function e(){c(this,e)}return l(e,[{key:"setStats",value:function(e){!fP()&&iW&&Object.keys(e).forEach((function(t){iW("context.set",t,e[t])}))}}]),e}()),uW=function(){function e(t,r){c(this,e),h(this,"_audioEventSessionId",EP()),h(this,"_videoEventSessionId",EP()),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:fB.LOGIN}),h(this,"_currentVideoRecv",{startTime:0,eventSessionId:0,type:fB.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=u(o().mark((function e(t,r){var n,i,a,s,u,c,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=fB.LOGIN,s=fB.UNMUTE,u=fB.SUBSCRIBE,c=fB.PUSH_TRACK,[a,s,u,c].indexOf(r)>=0&&(n=0,i=!1),t===hB.AUDIO?(i||this._audioEventSessionId++,this._currentAudioRecv={startTime:Date.now(),eventSessionId:this._audioEventSessionId,type:r},h={media_type:t,event_type:lB.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(hB.AUDIO,pB.TIMEOUT),m._firstAudioFrameInterval&&window.clearInterval(m._firstAudioFrameInterval)}),this._timeout),IB.rtcFirstFrame(h),this._watchForFirstAudioFrameRecv(),this._audioFirstFrameState=1,this._login=!0,this._unMuteAudio=!0,this._enableAudio=!0,this._remoteUnmuteAudio=!0):t===hB.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?hB.SCREEN_VIDEO:t,event_type:lB.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(hB.VIDEO,pB.TIMEOUT),m._firstVideoFrameInterval&&window.clearInterval(m._firstVideoFrameInterval)}),this._timeout),this._watchForFirstVideoFrameRecv(),IB.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===hB.AUDIO){var r,n,i;if(1!==this._audioFirstFrameState)return;var o={event_type:lB.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,IB.rtcFirstFrame(o),this._audioFirstFrameState=2}else if(e===hB.VIDEO){var a,s,u,c;if(1!==this._videoFirstFrameState)return;var d={event_type:lB.RECV_END,media_type:null!==(a=this._stream)&&void 0!==a&&a.isScreen?hB.SCREEN_VIDEO:e,start:null===(s=this._currentVideoRecv)||void 0===s?void 0:s.startTime,reason:t,result:!1,stream_user_id:null===(u=this._stream)||void 0===u?void 0:u.userId,event_session_id:this._videoEventSessionId,type:null===(c=this._currentVideoRecv)||void 0===c?void 0:c.type};this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),delete this._currentVideoRecv,IB.rtcFirstFrame(d),this._videoFirstFrameState=2}}},{key:"recvFrameFinish",value:(n=u(o().mark((function e(t){var r,n,i,a,s,u,c,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=fB.LOGIN,i=fB.UNMUTE,a=fB.SUBSCRIBE,s=fB.PUSH_TRACK,t!==hB.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:c=this._currentAudioRecv,d=c.type,l=c.startTime,[n,i,a,s].indexOf(d)>=0&&(r=0),h={event_type:lB.RECV_END,media_type:t,start:l,result:!0,stream_user_id:null===(u=this._stream)||void 0===u?void 0:u.userId,event_session_id:this._audioEventSessionId,type:d,transport_delay:r},delete this._currentAudioRecv,this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),IB.rtcFirstFrame(h),this._audioFirstFrameState=3,e.next=30;break;case 18:if(t!==hB.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:lB.RECV_END,media_type:null!==(f=this._stream)&&void 0!==f&&f.isScreen?hB.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),IB.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(hB.AUDIO,fB.LOGIN),e&&null!==(r=this._stream)&&void 0!==r&&r.hasVideo&&o.video&&this.beginRecvFrame(hB.VIDEO,fB.LOGIN),!e&&null!==(n=this._stream)&&void 0!==n&&n.hasAudio&&this.stopRecvFrame(hB.AUDIO,pB.LEAVE_ROOM),!e&&null!==(i=this._stream)&&void 0!==i&&i.hasVideo&&this.stopRecvFrame(hB.VIDEO,pB.LEAVE_ROOM))}},{key:"setUnmuteAudio",value:function(e){var t,r,n;this._unMuteAudio!==e&&(this._unMuteAudio=e,null!==(t=this._stream)&&void 0!==t&&t.audioHasCapture&&null!==(r=this._stream)&&void 0!==r&&r.audioHasPublish&&(this._unMuteAudio?this.beginRecvFrame(hB.AUDIO,fB.UNMUTE):null!==(n=this._stream)&&void 0!==n&&n.hasAudio&&this.stopRecvFrame(hB.AUDIO,pB.MUTE)))}},{key:"setRemoteUnmuteAudio",value:function(e){var t;this._remoteUnmuteAudio!==e&&(this._remoteUnmuteAudio=e,this._remoteUnmuteAudio?this.beginRecvFrame(hB.AUDIO,fB.REMOTE_UNMUTE):null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(hB.AUDIO,pB.REMOTE_MUTE))}},{key:"setEnableAudio",value:function(e){var t;this._enableAudio!==e&&(this._enableAudio=e,this._enableAudio?this.beginRecvFrame(hB.AUDIO,fB.ENABLE):null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(hB.AUDIO,pB.DISABLE))}},{key:"setUnmuteVideo",value:function(e){var t,r,n;this._unMuteVideo!==e&&(this._unMuteVideo=e,null!==(t=this._stream)&&void 0!==t&&t.videoHasCapture&&null!==(r=this._stream)&&void 0!==r&&r.videoHasPublish&&(this._unMuteVideo?this.beginRecvFrame(hB.VIDEO,fB.UNMUTE):null!==(n=this._stream)&&void 0!==n&&n.hasVideo&&this.stopRecvFrame(hB.VIDEO,pB.MUTE)))}},{key:"setRemoteUnmuteVideo",value:function(e){var t;this._remoteUnmuteVideo!==e&&(this._remoteUnmuteVideo=e,this._remoteUnmuteVideo?this.beginRecvFrame(hB.VIDEO,fB.REMOTE_UNMUTE):null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(hB.VIDEO,pB.REMOTE_MUTE))}},{key:"setEnableVideo",value:function(e){this._enableVideo!==e&&(this._enableVideo=e,this._enableVideo?this.beginRecvFrame(hB.VIDEO,fB.ENABLE):this.stopRecvFrame(hB.VIDEO,pB.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(hB.AUDIO,fB.PUSH),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.beginRecvFrame(hB.AUDIO,fB.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(hB.VIDEO,fB.PUSH),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasVideo&&this.beginRecvFrame(hB.VIDEO,fB.PUSH)}},{key:"setPublishVideo",value:function(e){var t;this._publishVideo!==e&&(this._publishVideo=e),this._publishVideo&&this.beginRecvFrame(hB.VIDEO,fB.PUBLISH),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasVideo&&this.stopRecvFrame(hB.VIDEO,pB.UNPUBLISH)}},{key:"setPublishAudio",value:function(e){var t;this._publishAudio!==e&&(this._publishAudio=e),this._publishAudio&&this.beginRecvFrame(hB.AUDIO,fB.PUBLISH),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(hB.AUDIO,pB.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(hB.AUDIO,fB.SUBSCRIBE));!e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(hB.AUDIO,pB.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(hB.VIDEO,fB.SUBSCRIBE));!e&&null!==(t=this._stream)&&void 0!==t&&t.hasVideo&&this.stopRecvFrame(hB.VIDEO,pB.UNSUBSCRIBE)}},{key:"setPushTrack",value:function(e){var t;this._pushTrack!==e&&(e&&!this._isScreen&&this.beginRecvFrame(hB.AUDIO,fB.PUSH_TRACK),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(hB.AUDIO,pB.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.setInterval(u(o().mark((function n(){var i,a,s,u,c,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,Mj(null===(u=e._handler)||void 0===u?void 0:u.pc,null===(c=e._stream)||void 0===c||null===(d=c.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(hB.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.setInterval(u(o().mark((function n(){var i,a,s,u,c,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,Mj(null===(u=e._handler)||void 0===u?void 0:u.pc,null===(c=e._stream)||void 0===c||null===(d=c.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(hB.AUDIO),window.clearInterval(e._firstAudioFrameInterval);case 12:case"end":return n.stop()}}),n)}))),200)}},{key:"getTransportDelay",value:(r=u(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(u(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=u(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,Mj(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:fB.LOGIN},this._currentVideoRecv={startTime:0,eventSessionId:0,type:fB.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}(),cW=function(){function e(t,r){c(this,e),h(this,"_audioEventSessionId",EP()),h(this,"_videoEventSessionId",EP()),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:fB.LOGIN}),h(this,"_currentVideoSend",{startTime:0,eventSessionId:0,type:fB.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===hB.AUDIO){var n;this._audioEventSessionId++,this._currentAudioSend={startTime:Date.now(),eventSessionId:this._audioEventSessionId,type:t};var i={media_type:e,event_type:lB.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(hB.AUDIO,pB.TIMEOUT),r._firstAudioFrameInterval&&window.clearInterval(r._firstAudioFrameInterval)}),this._timeout),IB.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===hB.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?hB.SCREEN_VIDEO:e,event_type:lB.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(hB.VIDEO,pB.TIMEOUT),r._firstVideoFrameInterval&&window.clearInterval(r._firstVideoFrameInterval)}),this._timeout),this._watchForFirstVideoFrameSend(),IB.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===hB.AUDIO){var r,n;if(1!==this._audioFirstFrameState)return;var i={event_type:lB.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,IB.rtcFirstFrame(i),this._audioFirstFrameState=2}else if(e===hB.VIDEO){var o,a,s;if(1!==this._videoFirstFrameState)return;var u={event_type:lB.SENT_END,media_type:null!==(o=this._stream)&&void 0!==o&&o.isScreen?hB.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,IB.rtcFirstFrame(u),this._videoFirstFrameState=2}}},{key:"sendFrameFinish",value:function(e){if(e===hB.AUDIO){if(1!==this._audioFirstFrameState)return;if(!this._currentAudioSend)return;var t=this._currentAudioSend,r=t.type,n=t.startTime,i={event_type:lB.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),IB.rtcFirstFrame(i),this._audioFirstFrameState=3}else if(e===hB.VIDEO){var o;if(1!==this._videoFirstFrameState)return;if(!this._currentVideoSend)return;var a=this._currentVideoSend,s=a.type,u=a.startTime,c={event_type:lB.SENT_END,media_type:null!==(o=this._stream)&&void 0!==o&&o.isScreen?hB.SCREEN_VIDEO:e,start:u,result:!0,event_session_id:this._videoEventSessionId,type:s};delete this._currentVideoSend,this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),IB.rtcFirstFrame(c),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(hB.VIDEO,fB.LOGIN),null!==(r=this._stream)&&void 0!==r&&r.audioTrack&&this.beginSendFrame(hB.AUDIO,fB.LOGIN);!e&&this._audioSending&&this.stopSendFrame(hB.AUDIO,pB.LEAVE_ROOM),!e&&this._videoSending&&this.stopSendFrame(hB.VIDEO,pB.LEAVE_ROOM)}}},{key:"setPublish",value:function(e){if(this._publish!==e){var t,r,n,i;if(this._publish=e,e)(null===(t=this._stream)||void 0===t?void 0:t.videoTrack)&&(null===(r=this._stream)||void 0===r?void 0:r.pubVideo)&&this.beginSendFrame(hB.VIDEO,fB.PUBLISH),(null===(n=this._stream)||void 0===n?void 0:n.audioTrack)&&(null===(i=this._stream)||void 0===i?void 0:i.pubAudio)&&this.beginSendFrame(hB.AUDIO,fB.PUBLISH);!e&&this._audioSending&&this.stopSendFrame(hB.AUDIO,pB.UNPUBLISH),!e&&this._videoSending&&this.stopSendFrame(hB.VIDEO,pB.UNPUBLISH)}}},{key:"setUnmuteAudio",value:function(e){var t;this._unMuteAudio!==e&&(this._unMuteAudio=e,null!==(t=this._stream)&&void 0!==t&&t.audioHasCapture&&(e&&this.beginSendFrame(hB.AUDIO,fB.UNMUTE),!e&&this._audioSending&&this.stopSendFrame(hB.AUDIO,pB.MUTE)))}},{key:"setEnableAudio",value:function(e){var t;this._enableAudio!==e&&null!==(t=this._stream)&&void 0!==t&&t.pubAudio&&(this._enableAudio=e,e&&this.beginSendFrame(hB.AUDIO,fB.ENABLE),!e&&this._audioSending&&this.stopSendFrame(hB.AUDIO,pB.DISABLE))}},{key:"setUnmuteVideo",value:function(e){var t;this._unMuteVideo!==e&&(this._unMuteVideo=e,null!==(t=this._stream)&&void 0!==t&&t.videoHasCapture&&(e&&this.beginSendFrame(hB.VIDEO,fB.UNMUTE),!e&&this._videoSending&&this.stopSendFrame(hB.VIDEO,pB.MUTE)))}},{key:"setEnableVideo",value:function(e){var t;this._enableVideo!==e&&null!==(t=this._stream)&&void 0!==t&&t.pubVideo&&(this._enableVideo=e,e&&this.beginSendFrame(hB.VIDEO,fB.ENABLE),!e&&this._videoSending&&this.stopSendFrame(hB.VIDEO,pB.DISABLE))}},{key:"setExternalAudioSource",value:function(e){this._audioExternal!==e&&(this._audioExternal=e,e&&(this._audioSending&&this.stopSendFrame(hB.AUDIO,pB.DISABLE),this._enableAudio=!1),e||(this._audioSending&&this.stopSendFrame(hB.AUDIO,pB.STOP_PUSH),this._pushAudio=!1))}},{key:"setPushAudio",value:function(e){this._pushAudio!==e&&(this._pushAudio=e,e&&this.beginSendFrame(hB.AUDIO,fB.PUSH),!e&&this._audioSending&&this.stopSendFrame(hB.AUDIO,pB.STOP_PUSH))}},{key:"setExternalVideoSource",value:function(e){this._videoExternal!==e&&(this._videoExternal=e,e&&(this._videoSending&&this.stopSendFrame(hB.VIDEO,pB.DISABLE),this._enableVideo=!1),e||(this._videoSending&&this.stopSendFrame(hB.VIDEO,pB.STOP_PUSH),this._pushVideo=!1))}},{key:"setPushVideo",value:function(e){this._pushVideo!==e&&(this._pushVideo=e,e&&this.beginSendFrame(hB.VIDEO,fB.PUSH),!e&&this._videoSending&&this.stopSendFrame(hB.VIDEO,pB.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(hB.AUDIO,pB.AUDIENCE),!e&&this._videoSending&&this.stopSendFrame(hB.VIDEO,pB.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=u(o().mark((function e(){var t,r,n,i,a,s,u,c;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,Mj(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 u=e.sent,c=u.find((function(e){return"outbound-rtp"===e.type})),e.abrupt("return",c);case 6:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"_getFirstAudioFrameStats",value:(t=u(o().mark((function e(){var t,r,n,i,a,s,u,c;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,Mj(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 u=e.sent,c=u.find((function(e){return"outbound-rtp"===e.type})),e.abrupt("return",c);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.setInterval(u(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(hB.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.setInterval(u(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(hB.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:fB.LOGIN},this._currentVideoSend={startTime:0,eventSessionId:0,type:fB.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}(),dW=(h(aW={},"audio",{delay:1200,stallRadio:.3}),h(aW,"video",{delay:1200,stallRadio:.6}),h(aW,"screen_audio",{delay:1600,stallRadio:.8}),h(aW,"screen_video",{delay:1600,stallRadio:.8}),aW),lW=function(){function e(){c(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",rq.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,u=this._getQosLevel(o,a||0,s||0),c=this._preUplinkStats.get(i)||[u];this._preUplinkStats.set(i,[].concat(k(c),[u]).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,u=e.videoStats,c=e.isScreen,d=e.userId;if(o)if(0===s.receivedKBitrate)r=W.VBAD;else{var l=s.rtt,h=s.audioLossRate,f=s.stallDuration,p=s.statsInterval,v=s.e2eDelay,_=f/p,m=c?"screen_audio":"audio",y=this._getQosLevel(l,h||0,u._retransmittedRate||0),g=this._getDownlinkQoE(m,_,v);r=this._getNetworkQuality(y,g)}if(a)if(0===u.receivedKBitrate||0===u.rtt)n=W.VBAD;else{var S=u.rtt,b=u.videoLossRate,E=u.stallDuration,T=u.statsInterval,I=u.e2eDelay,R=u._retransmittedRate,A=E/T,w=c?"screen_video":"video",C=this._getQosLevel(S,b||0,R||0),O=this._getDownlinkQoE(w,A,I);n=this._getNetworkQuality(C,O)}var x=r&&n?Math.ceil((r+n)/2):r||n;if(x){var N="".concat(d).concat(c?"_screen":""),D=this._preDownlinkStats.get(N)||[x];this._preDownlinkStats.set(N,[].concat(k(D),[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!==rq.CONNECTED)e=t=W.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")||W.UNKNOWN;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)||W.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=dW[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=W.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&&wP(t)&&r.localaudio&&r.audiostream,videoActive:n&&CP(t)&&r.localvideo&&r.videostream}}}]),e}(),hW=function(){function e(t){c(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,u=s[i]||{},c=u.width,d=void 0===c?0:c,l=u.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}(),fW=new LL("SubscribeFallbackManager",2),pW=1e4,vW=function(){function e(t){c(this,e),h(this,"_preDownlinkNetworkQuality",[]),h(this,"_isSubscribeFallbackOrRecover",!1),h(this,"_inSubscribeRecoverChecking",!1),h(this,"_subRecoverCheckTimer",void 0),h(this,"_forbidSubRecover",!1),h(this,"_forbidSubRecoverTimer",void 0),h(this,"_forbidSubRecoverDuration",pW),h(this,"onSubscribeFallback",void 0),this._room=t}var t;return l(e,[{key:"updateNetworkQuality",value:function(e,t){this._preDownlinkNetworkQuality.push(t),this._preDownlinkNetworkQuality=this._preDownlinkNetworkQuality.slice(-10),this._inSubscribeRecoverChecking&&this._preDownlinkNetworkQuality.find((function(e){return e===W.BAD||e===W.VBAD}))&&this._startForbidSubRecover(),this._preDownlinkNetworkQuality.slice(-3).reduce((function(e,t){return e+t}),0)>3*W.POOR&&this._subscribeFallbackOrRecover("fallback"),!this._forbidSubRecover&&10===this._preDownlinkNetworkQuality.length&&this._preDownlinkNetworkQuality.every((function(e){return e===W.EXCELLENT}))&&this._subscribeFallbackOrRecover("recover")}},{key:"destroy",value:function(){this._stopSubscribeRecoverCheck(),this._stopForbidSubRecover(),delete this.onSubscribeFallback}},{key:"_subscribeFallbackOrRecover",value:(t=u(o().mark((function e(t){var r,n,i,a,s,u,c,d,l,h,f=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._isSubscribeFallbackOrRecover&&this._room.connectionState===rq.CONNECTED){e.next=2;break}return e.abrupt("return");case 2:if(this._room.subscribeFallbackOption!==K.AUDIO_ONLY&&this._room.subscribeFallbackOption!==K.VIDEO_STREAM_LOW){e.next=24;break}if(r=new Map,this._room.remoteStreams.forEach((function(e){e.forEach((function(e){if(e.hasSubscribed){var n="fallback"===t?e.getSubscribeFallbackParams(f._room.subscribeFallbackOption):e.getSubscribeRecoverParams();if(n){var i=e.getStreamPriority(),o=r.get(i)||[];o.push({stream:e,fallbackOrRecoverOption:n}),r.set(i,o)}}}))})),!(r.size>0)){e.next=24;break}if(fW.print("_subscribeFallbackOrRecover()","start subscribe ".concat(t,".")),n=Array.from(r.keys()).sort((function(e,t){return e-t}))["fallback"===t?0:r.size-1],i=r.get(n)||[],a=E(i,1),!(s=a[0])){e.next=24;break}return u=s.stream,c=s.fallbackOrRecoverOption,this._isSubscribeFallbackOrRecover=!0,d=u.subLayer.spatialLayer,l=u.subVideo,fW.print("_subscribeFallbackOrRecover()","".concat(u.userId,"'s stream will be ").concat(t," to: MediaType=").concat(c[0]," subState=").concat(c[1]," subLayer=").concat(c[2])),e.prev=15,e.next=18,RP([(h=this._room).updateSubTrack.apply(h,[u].concat(k(c))).then((function(){"recover"===t?f._startSubscribeRecoverCheck():fW.print("_subscribeFallbackOrRecover()","fallback success."),"function"==typeof f.onSubscribeFallback&&f.onSubscribeFallback({userId:u.userId,isScreen:u.isScreen,beforeEnable:l,beforeVideoIndex:d,afterEnable:u.subVideo,afterVideoIndex:u.subLayer.spatialLayer,reason:"fallback"===t?Y.SubscribeFallbackByBandwidth:Y.SubscribeRecoverByBandwidth})})),vP(2e3)]);case 18:e.next=22;break;case 20:e.prev=20,e.t0=e.catch(15);case 22:this._preDownlinkNetworkQuality=[],this._isSubscribeFallbackOrRecover=!1;case 24:case"end":return e.stop()}}),e,this,[[15,20]])}))),function(e){return t.apply(this,arguments)})},{key:"_startSubscribeRecoverCheck",value:function(){var e=this;this._stopSubscribeRecoverCheck(),this._inSubscribeRecoverChecking=!0,this._subRecoverCheckTimer=window.setTimeout((function(){e._inSubscribeRecoverChecking=!1,e._forbidSubRecoverDuration=pW,delete e._subRecoverCheckTimer,fW.print("_subscribeFallbackOrRecover()","recover success.")}),2e4)}},{key:"_stopSubscribeRecoverCheck",value:function(){this._subRecoverCheckTimer&&(window.clearTimeout(this._subRecoverCheckTimer),delete this._subRecoverCheckTimer),this._inSubscribeRecoverChecking=!1}},{key:"_startForbidSubRecover",value:function(){var e=this;this._stopSubscribeRecoverCheck(),this._stopForbidSubRecover(),this._forbidSubRecoverDuration=Math.min(this._forbidSubRecoverDuration+2e4,12e4),fW.print("_subscribeFallbackOrRecover()","subscribe-recover failed, and subscribe-recover not allowed within ".concat(this._forbidSubRecoverDuration/1e3,"s")),this._forbidSubRecover=!0,this._forbidSubRecoverTimer=window.setTimeout((function(){e._forbidSubRecover=!1,delete e._forbidSubRecoverTimer}),this._forbidSubRecoverDuration)}},{key:"_stopForbidSubRecover",value:function(){this._forbidSubRecoverTimer&&(window.clearTimeout(this._forbidSubRecoverTimer),delete this._forbidSubRecoverTimer)}}]),e}(),_W=new LL("Room",1),mW=function(e){f(L,e);var t,r,n,a,s,d,p,v,_,y,S,b,k,T,I,A,w,C,x,N,D,M=g(L);function L(e,t){var r;return c(this,L),h(m(r=M.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),"_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),"_roomConfig",void 0),h(m(r),"_roomInfo",void 0),h(m(r),"_waitForNewToken",!1),h(m(r),"_userDuplicateLoginTimerMap",new Map),h(m(r),"_networkQualityManager",void 0),h(m(r),"userPriorityMap",void 0),h(m(r),"subscribeFallbackOption",void 0),h(m(r),"_videoSizeObserver",void 0),h(m(r),"_subFallbackManager",void 0),h(m(r),"_hasPublished",!1),r._roomConfig=e,r._mediaServerClient=new iq(t),r._reconnectRecord=new yW,r._addHandlerEventHandler(),r._isReconnecting=!1,r._networkQualityManager=new lW,r._networkQualityManager.reportor=r._reportNetworkQuality.bind(m(r)),r._videoSizeObserver=new hW(m(r)),r._videoSizeObserver.onchange=r._emitVideoSizeChange.bind(m(r)),r._subFallbackManager=new vW(m(r)),r._subFallbackManager.onSubscribeFallback=r._emitSubscribeFallback.bind(m(r)),r._context=t,r}return l(L,[{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,u,c,d,l,h,f,p,v,_,m,y,g,S,b,E,k,T,I,R=this;null===(e=this._mediaServerClient)||void 0===e||e.on(sj.ON_ADD_STREAM,this._onAddStream.bind(this)),null===(t=this._mediaServerClient)||void 0===t||t.on(sj.ON_REMOVE_STREAM,this._onRemoveStream.bind(this)),null===(r=this._mediaServerClient)||void 0===r||r.on(sj.USER_CONNECTION,this._onUserConnection.bind(this)),null===(n=this._mediaServerClient)||void 0===n||n.on(sj.USER_DISCONNECTION,this._onUserDisconnection.bind(this)),null===(i=this._mediaServerClient)||void 0===i||i.on(sj.ON_UPDATE_ROOM_ATTRIBUTES,this._onUpdateRoomAttributes.bind(this)),null===(o=this._mediaServerClient)||void 0===o||o.on(sj.ON_UPDATE_USER_ATTRIBUTES,this._onUpdateUserAttributes.bind(this)),null===(a=this._mediaServerClient)||void 0===a||a.on(sj.ON_UPDATE_STREAM_ATTRIBUTES,this._onUpdateStreamAttributes.bind(this)),null===(s=this._mediaServerClient)||void 0===s||s.on(sj.ON_PUSH_TRACK,this._onPushTrack.bind(this)),null===(u=this._mediaServerClient)||void 0===u||u.on(sj.ON_REMOVE_TRACK,this._onRemoveTrack.bind(this)),null===(c=this._mediaServerClient)||void 0===c||c.on(sj.NODE_CHANGE,this._nodeChange.bind(this)),null===(d=this._mediaServerClient)||void 0===d||d.on(sj.ON_CUSTOM_MESSAGE,this._onCustomMessage.bind(this)),null===(l=this._mediaServerClient)||void 0===l||l.on(sj.USER_MESSAGE_RECEIVED,this._onUserMessageReceived.bind(this)),null===(h=this._mediaServerClient)||void 0===h||h.on(sj.USER_BINARY_MESSAGE_RECEIVED,this._onUserBinaryMessageReceived.bind(this)),null===(f=this._mediaServerClient)||void 0===f||f.on(sj.POST_PROCESSING_MESSAGE,this._onPostProcessingMessage.bind(this)),null===(p=this._mediaServerClient)||void 0===p||p.on(sj.ON_USER_TOKEN_WILL_EXPIRE,this._onUserTokenWillExpire.bind(this)),null===(v=this._mediaServerClient)||void 0===v||v.on(sj.STREAM_CONTROL_MESSAGE,this._onStreamControlMessage.bind(this)),null===(_=this._mediaServerClient)||void 0===_||_.on(sj.ON_SCENE_CONFIG,this._onSceneConfig.bind(this)),null===(m=this._mediaServerClient)||void 0===m||m.on(sj.ON_STREAM_FAILED,this._onStreamFailed.bind(this)),null===(y=this._mediaServerClient)||void 0===y||y.on(uj.RSCP,this._onPublishOnDemand.bind(this)),null===(g=this._mediaServerClient)||void 0===g||g.on(uj.RTT,this._onRTT.bind(this)),null===(S=this._mediaServerClient)||void 0===S||S.on(cj.ON_CONNECTION_STATE_CHANGE,this._onConnectionStateChange.bind(this)),null===(b=this._mediaServerClient)||void 0===b||b.on(cj.ABNORMAL_DISCONNECTION,this._handleAbnormalDisconnection.bind(this)),null===(E=this._mediaServerClient)||void 0===E||E.on("onRemoteStreamStats",(function(e){R._networkQualityManager.updateDownlinkStats(e,R._findRemoteStreamByScreen(e.userId,e.isScreen)),R.emit(Az.ON_REMOTE_STREAM_STATS,OP(e))})),null===(k=this._mediaServerClient)||void 0===k||k.on("onLocalStreamStats",(function(e){R._networkQualityManager.updateUplinkStats(e),R.emit(Az.ON_LOCAL_STREAM_STATS,OP(e))})),null===(T=this._mediaServerClient)||void 0===T||T.on("prevIceNode",(function(e){R._getAccessFeedbackIceNode=e})),null===(I=this._mediaServerClient)||void 0===I||I.on("prevIceNode",(function(e){R._getAccessFeedbackIceNode=e}))}},{key:"_removeHandlerEventHandler",value:function(){var e;null===(e=this._mediaServerClient)||void 0===e||e.removeAllListeners()}},{key:"join",value:(D=u(o().mark((function e(t,r,n,i,a,s,u){var c=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return wB.setStats({rtc_app_id:t,room_id:r,user_id:i.userId}),sW.setStats({rtc_session_id:t,rtc_room_id:r}),_W.print("join()"),e.abrupt("return",new Promise((function(e,o){var d,l,h=lP();c._joinResolveCallback=function(t){var r;IB.joinRoom(_B.END,h,!0,"",{enable_cloud_proxy:null===(r=c._roomInfo)||void 0===r?void 0:r.useCloudProxy}),e(t)},c._joinRejectCallback=function(e){var t;IB.joinRoom(_B.END,h,!1,e.message,{enable_cloud_proxy:null===(t=c._roomInfo)||void 0===t?void 0:t.useCloudProxy}),o(e)},c._liveControlMessage=a,c._roomInfo={appId:t,roomId:r,token:n,userInfo:i,useCloudProxy:s,roomProfile:c._roomConfig.roomProfileType,expectedIDC:u},c.setSessionId(),IB.joinRoom(_B.BEGIN,h,!1,"",{enable_cloud_proxy:null===(d=c._roomInfo)||void 0===d?void 0:d.useCloudProxy,expectedIDC:null===(l=c._roomInfo)||void 0===l?void 0:l.expectedIDC}),c._join(c._joinResolveCallback,c._joinRejectCallback,!1)})));case 4:case"end":return e.stop()}}),e)}))),function(e,t,r,n,i,o,a){return D.apply(this,arguments)})},{key:"_join",value:(N=u(o().mark((function e(t,r){var n,i,a,s=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=s.length>2&&void 0!==s[2]&&s[2],i=lP(),_W.print("_join()"),e.prev=3,e.next=6,this._mediaServerClient.join(this._roomInfo,{node:this._getAccessNode,reason:this._getAccessFeedback,sessionId:this._sessionId,feedbackNode:this._getAccessFeedbackIceNode},n,this._liveControlMessage);case 6:a=e.sent,this._mediaServerClient.roomAttributes=a.roomAttributes,this._reconnectRecord.clear(),this._joinResolveCallback=void 0,this._joinRejectCallback=void 0,this._getAccessFeedback=void 0,this._getAccessNode=void 0,"function"==typeof t&&t({users:a.clients,streams:a.streams}),this._isReconnecting=!1,IB.rtcJoinRoom(0,"web","web",lP()-i),this._onJoinSucc(a,n),e.next=23;break;case 19:if(e.prev=19,e.t0=e.catch(3),e.t0.code===JN.OPERATION_CANCEL||"function"!=typeof r){e.next=23;break}return e.abrupt("return",r(e.t0));case 23:case"end":return e.stop()}}),e,this,[[3,19]])}))),function(e,t){return N.apply(this,arguments)})},{key:"publishScreen",value:(x=u(o().mark((function e(t,r,n,i,a){var s,u,c,d,l,h,f,p,v,_;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(_W.print("publishScreen()"),this._localScreenStream||(this._localScreenStream=new Dz,this._localScreenStream.isScreen=!0,this._mediaServerClient.handler&&(this._localScreenStream.observer=new cW(this._localScreenStream,this._mediaServerClient.handler))),s=!1,u=!1,c=!1,d=!1,!this._localScreenStream.videoTrack&&r?(r instanceof BH&&(u=!0),s=!0):this._localScreenStream.videoTrack&&!r&&(s=!1),!this._localScreenStream.audioTrack&&n?(n instanceof jH&&(d=!0),c=!0):this._localScreenStream.audioTrack&&!n&&(c=!1),this._localScreenStream.videoTrack=r,this._localScreenStream.audioTrack=n,this._localScreenStream.videoEncodeConfig=t,i&&(wP(i)&&(this._localScreenStream.pubAudio=a===Cz.PUB),CP(i)&&(this._localScreenStream.pubVideo=a===Cz.PUB),_W.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 u?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(c):null===(_=this._localScreenStream.observer)||void 0===_||_.setEnableAudio(c),e.next=28,this.updatePubScreenTrack();case 28:case"end":return e.stop()}}),e,this)}))),function(e,t,r,n,i){return x.apply(this,arguments)})},{key:"updatePubScreenTrack",value:(C=u(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(_W.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 C.apply(this,arguments)})},{key:"unpublishScreen",value:(w=u(o().mark((function e(){var t;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(_W.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 w.apply(this,arguments)})},{key:"liveControlMessage",value:(A=u(o().mark((function e(t){var r,n=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return _W.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;case 6:case"end":return e.stop()}}),e,this)}))),function(e){return A.apply(this,arguments)})},{key:"publicStreamControlMessage",value:(I=u(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 I.apply(this,arguments)})},{key:"updateUserAttributes",value:(T=u(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return _W.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 T.apply(this,arguments)})},{key:"publish",value:(k=u(o().mark((function e(t,r,n,i,a,s){var u,c,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(u=S.length>6&&void 0!==S[6]&&S[6],_W.print("publish","Invoke publish"),c=!1,this._localStream||(this._localStream=new Dz,this._mediaServerClient.handler&&(this._localStream.observer=new cW(this._localStream,this._mediaServerClient.handler)),c=!0),this._localStream.videoTrack=n,this._localStream.audioTrack=i,this._localStream.videoEncodeConfig=t,this._localStream.enableSimulcast=r,a&&(wP(a)&&(this._localStream.pubAudio=s===Cz.PUB),CP(a)&&(this._localStream.pubVideo=s===Cz.PUB),_W.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,u?null===(d=this._localStream.observer)||void 0===d||d.setLogin(!0):c&&(l=!!this._localStream.videoTrack,h=!!this._localStream.audioTrack,f=this._localStream.videoTrack instanceof BH,p=this._localStream.audioTrack instanceof jH,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(Az.ON_PUBLISH_RESULT,{isScreen:!1,state:P.PUBLISH_SUCC}),e.next=24;break;case 20:throw e.prev=20,e.t0=e.catch(12),this.emit(Az.ON_PUBLISH_RESULT,{isScreen:!1,state:P.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 k.apply(this,arguments)})},{key:"updatePubTrack",value:(b=u(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(_W.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 b.apply(this,arguments)})},{key:"unpublish",value:(S=u(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(_W.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 S.apply(this,arguments)})},{key:"subscribe",value:(y=u(o().mark((function e(t,r,n){var i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return _W.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 y.apply(this,arguments)})},{key:"updateSubTrack",value:(_=u(o().mark((function e(t,r,n,i){var a;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return _W.print("updateSubTrack","Invoke updateSubTrack"),e.abrupt("return",null===(a=this._mediaServerClient)||void 0===a?void 0:a.updateSubTrack(t,r,n,i));case 2:case"end":return e.stop()}}),e,this)}))),function(e,t,r,n){return _.apply(this,arguments)})},{key:"updateSubVideoConfig",value:(v=u(o().mark((function e(t,r){var n,i,a,s,u;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 u=this._getSubLayer(r,s),s.originalStreamIndex=u.spatialLayer,e.abrupt("return",null===(a=this._mediaServerClient)||void 0===a?void 0:a.updateSubTrack(s,s.subMediaType,Oz.SUB,u));case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return v.apply(this,arguments)})},{key:"_getSubLayer",value:function(e,t){for(var r,n,i,o,a,s=null==t?void 0:t.attributes,u=s.videoDescriptions,c=s.subVideoDescriptions,d=Array.isArray(c)?c:u,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:(p=u(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return _W.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 p.apply(this,arguments)})},{key:"leave",value:(d=u(o().mark((function e(){var t,r,n,i,a,s,u=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=u.length>0&&void 0!==u[0]&&u[0],_W.print("leave","Invoke leave"),r=lP(),e.prev=3,this._mediaServerClient.connectionState!==rq.CONNECTED&&this._joinRejectCallback&&this._joinRejectCallback(new Error(mB.LEAVE_ROOM)),clearTimeout(this._reconnectTimer),n=R(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(),IB.rtcLeaveRoom(0,"",lP()-r),e.next=23;break;case 15:if(e.prev=15,e.t0=e.catch(3),!t){e.next=21;break}throw e.t0;case 21:this.destroy();case 22:e.t0 instanceof Error&&IB.rtcLeaveRoom(-1,e.t0.message,lP()-r);case 23:case"end":return e.stop()}}),e,this,[[3,15]])}))),function(){return d.apply(this,arguments)})},{key:"setRemoteUserPriority",value:function(e,t){var r,n;null===(r=this.remoteStreams.get(e))||void 0===r||r.forEach((function(e){return e.setRemoteUserPriority(t)})),null===(n=this.userPriorityMap)||void 0===n||n.set(e,t)}},{key:"destroy",value:function(){_W.print("destroy","Invoke destroy"),this._destroyAndInitMediaServerClient(),this._roomInfo=void 0,this._remoteUsers=new Map;var e,t,r,n=R(this._remoteStreams);try{for(n.s();!(e=n.n()).done;){var i=E(e.value,2)[1];Array.isArray(i)&&i.forEach((function(e){e&&e.clean()}))}}catch(o){n.e(o)}finally{n.f()}(this._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 yW,this._removeHandlerEventHandler(),clearTimeout(this._connectionLostTimer),this._userDuplicateLoginTimerMap.forEach((function(e){clearTimeout(e)})),this._userDuplicateLoginTimerMap.clear(),this._networkQualityManager.destroy(),this._videoSizeObserver.destroy(),this._subFallbackManager.destroy(),this._remoteStreamStreamIdUserIdMap={}}},{key:"updateToken",value:(s=u(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return _W.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 s.apply(this,arguments)})},{key:"pauseAllSubscribedStream",value:(a=u(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:r=[],n=R(this._remoteStreams.values());try{for(n.s();!(i=n.n()).done;)a=i.value,Array.isArray(a)&&a.forEach((function(e){if(e.hasSubscribed){var n=s.updateSubTrack(e,t,Oz.UNSUB);n&&r.push(n)}}))}catch(o){n.e(o)}finally{n.f()}return e.abrupt("return",Promise.all(r));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"resumeAllSubscribedStream",value:(n=u(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:r=[],n=R(this._remoteStreams.values());try{for(n.s();!(i=n.n()).done;)a=i.value,Array.isArray(a)&&a.forEach((function(e){if(e.hasSubscribed&&e.hasSubscribed){var n=s.updateSubTrack(e,t,Oz.SUB);n&&r.push(n)}}))}catch(o){n.e(o)}finally{n.f()}return e.abrupt("return",Promise.all(r));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"sendUserMessage",value:function(e,t){var r;return null===(r=this._mediaServerClient)||void 0===r?void 0:r.sendUserMessage(e,t)}},{key:"setSessionId",value:function(){this._sessionId=sP(),wB.setStats({rtc_session_id:this._sessionId}),sW.setStats({rtc_session_id:this._sessionId})}},{key:"sendRoomMessage",value:(r=u(o().mark((function e(t){var r,n,i,a,s=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=s.length>1&&void 0!==s[1]&&s[1],a={clientId:null===(r=this._roomInfo)||void 0===r?void 0:r.userInfo.userId,binary:i,message:""},!i){e.next=8;break}return e.next=5,pP.ab2b64str(t);case 5:a.message=e.sent,e.next=9;break;case 8:a.message=t;case 9:return e.abrupt("return",null===(n=this._mediaServerClient)||void 0===n?void 0:n.sendRoomMessage(a));case 10:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"_destroyAndInitMediaServerClient",value:function(){_W.print("_destroyAndInitMediaServerClient()"),this._mediaServerClient&&(this._mediaServerClient.destroy(),this._removeHandlerEventHandler()),this._mediaServerClient=new iq(this._context),this._addHandlerEventHandler()}},{key:"_onJoinSucc",value:function(e,t){var r,n=this;_W.print("JoinSuccess()"),this._serverConfig=e.config;var i=[],o=[],a=[],s=[],u=[];null===(r=e.clientsDetail)||void 0===r||r.forEach((function(t){if(t.attributes&&(t.attributes.serverMuteVideo&&n.safeEmit(Az.ON_VIDEO_STREAM_BANNED,{uid:t.clientId,banned:1===t.attributes.serverMuteVideo}),t.attributes.serverMuteAudio&&n.safeEmit(Az.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 c,d=R(this._remoteUsers.values());try{for(d.s();!(c=d.n()).done;){var l=c.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,u.push(e)):s.push(e)}));var h,f=R(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:oj.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,!0,!1)})),u.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=this._roomConfig,n=r.isAutoSubscribeAudio,i=r.isAutoSubscribeVideo,a=R(this._remoteStreams.values());try{for(a.s();!(t=a.n()).done;){var s=t.value;Array.isArray(s)&&s.forEach(function(){var t=u(o().mark((function t(r){var a,s;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(a=r.hasSubscribed,s=r.subMediaType,a||!n&&!i||(a=!0,n&&(s|=V.AUDIO),i&&(s|=V.VIDEO)),!a){t.next=18;break}return r.resetHasSubscribed(),t.prev=5,_W.print("start resubscribe ".concat(r.userId," with ").concat(s)),t.next=9,e._mediaServerClient.subscribe(r,s);case 9:_W.print("success resubscribe ".concat(r.userId," with ").concat(s)),e.safeEmit(Az.RESUBSCRIBE,{stream:r}),t.next=18;break;case 13:t.prev=13,t.t0=t.catch(5),_W.print("failed resubscribe ".concat(r.userId," with ").concat(s,", error:").concat(t.t0)),r.clean(),null==r||r.resetHasSubscribed();case 18:case"end":return t.stop()}}),t,null,[[5,13]])})));return function(e){return t.apply(this,arguments)}}())}}catch(c){a.e(c)}finally{a.f()}}},{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=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(e.clientId!==(null===(t=this._roomInfo)||void 0===t?void 0:t.userInfo.userId)){var i=this._roomConfig,o=i.isAutoSubscribeAudio,a=i.isAutoSubscribeVideo,s=this._findRemoteStreamByScreen(e.clientId,e.screen);if(s&&s.streamId!==e.streamId){var u,c=null===(u=this._remoteStreams.get(e.clientId))||void 0===u?void 0:u.filter((function(e){return e.streamId!==s.streamId}));s.clean(),this._remoteStreams.set(e.clientId,c||[])}var d=this._findRemoteStream(e.clientId,e.streamId);if(this._remoteStreamStreamIdUserIdMap[e.streamId]=e.clientId,d)d.attributes=e.attributes;else{var l;d=new Pz(e.clientId,e.streamId,e.screen,e.attributes,null===(l=this.userPriorityMap)||void 0===l?void 0:l.get(e.clientId)),this._initStreamListeners(d);var h=this._remoteStreams.get(e.clientId);h?h.push(d):this._remoteStreams.set(e.clientId,[d])}if(this._mediaServerClient.handler&&(d.observer=new uW(d,this._mediaServerClient.handler)),!d.isScreen&&a){var f,p,v,_,m,y,g,S;if(n&&d.hasVideo)if(d.attributes.extvideo)null===(f=d.observer)||void 0===f||f.setExternalVideoSource(!0),null===(p=d.observer)||void 0===p||p.setPushVideo(!0);else null===(v=d.observer)||void 0===v||v.setExternalVideoSource(!1),null===(_=d.observer)||void 0===_||_.setPublishVideo(!0);if(n&&d.hasAudio&&o&&!this._mediaServerClient.roomAttributes.multiChatMode)if(d.attributes.extaudio)null===(m=d.observer)||void 0===m||m.setExternalAudioSource(!0),null===(y=d.observer)||void 0===y||y.setPushAudio(!0);else null===(g=d.observer)||void 0===g||g.setExternalAudioSource(!1),null===(S=d.observer)||void 0===S||S.setPublishAudio(!0);if(!0===r&&!1===n){var b,E=this._roomConfig,k=E.isAutoSubscribeAudio,T=E.isAutoSubscribeVideo;null===(b=d.observer)||void 0===b||b.setLogin(!0,{audio:!!k,video:!!T})}}return r&&this.safeEmit(sj.ON_ADD_STREAM,{stream:d}),d}}},{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(sj.USER_CONNECTION,{userInfo:n}),e.attributes&&(e.attributes.serverMuteVideo&&this.safeEmit(Az.ON_VIDEO_STREAM_BANNED,{uid:e.clientId,banned:1===e.attributes.serverMuteVideo}),e.attributes.serverMuteAudio&&this.safeEmit(Az.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===dj.kickedByAdmin?a=JN.KICKED_OUT:i===dj.onUserTokenDidExpire?a=JN.TOKEN_EXPIRED:i===dj.userDuplicateLogin&&(a=JN.DUPLICATE_LOGIN),o===lj.roomDismissByAdmin&&(a=JN.ROOM_DISMISS),a&&this.safeEmit(Az.ON_ROOM_ERROR,{errorCode:a})}else{var s=O.DROPPED;i===dj.userLeave?s=O.QUIT:i===dj.kickedByAdmin?s=O.KICKED_BY_ADMIN:i===dj.roleChanged&&(s=O.SWITCH_TO_INVISIBLE);var u=function(){var e;r._remoteUsers.delete(n),null===(e=r._remoteStreams.get(n))||void 0===e||e.forEach((function(e){r._onRemoveStream({clientId:e.userId,streamId:e.streamId,message:"client disconnected"})})),r._remoteStreams.delete(n),r.safeEmit(Az.ON_USER_LEAVE,{userInfo:{userId:n},reason:s})};if(i===dj.userDuplicateLogin){var c=this._userDuplicateLoginTimerMap.get(n);c&&self.clearTimeout(c);var d=self.setTimeout(u,5e3);this._userDuplicateLoginTimerMap.set(n,d)}else u()}}},{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(){if(null==i||!i._workaround_1_){var t=r._remoteStreams.get(e.clientId);if(!t)return;t=t.filter((function(t){return t.streamId!==e.streamId})),r._remoteStreams.set(e.clientId,t)}})).finally((function(){r.safeEmit(sj.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(Az.ON_VIDEO_STREAM_BANNED,{uid:e.clientId,banned:1===e.attributes.serverMuteVideo}),e.attributes.serverMuteAudio&&this.safeEmit(Az.ON_AUDIO_STREAM_BANNED,{uid:e.clientId,banned:1===e.attributes.serverMuteAudio}))}},{key:"_onUpdateRoomAttributes",value:function(e){e.roomAttributes&&(this._mediaServerClient.roomAttributes=i(i({},this._mediaServerClient.roomAttributes),e.roomAttributes))}},{key:"_onUpdateStreamAttributes",value:function(e){var t=this._roomConfig,r=t.isAutoSubscribeAudio,n=t.isAutoSubscribeVideo,o=e.clientId,a=e.streamId,s=e.attributes,u=this._findRemoteStream(o,a);if(u){var c,d,l=u.attributes,h=i(i({},l),s),f=!1,p=h.localaudio!==l.localaudio,v=!1,_=!1,m=h.localvideo!==l.localvideo,y=!1,g=lz.NONE,S=lz.NONE;if(h.audiostream!==l.audiostream&&(f=h.localaudio,v=!!h.audiostream,h.audiostream?g|=V.AUDIO:S|=V.AUDIO),h.videostream!==l.videostream&&(_=h.localvideo,y=!!h.videostream,h.videostream?g|=V.VIDEO:S|=V.VIDEO),g&&this.safeEmit(Az.ON_USER_PUBLISH_STATE_CHANGE,{userId:o,mediaType:g,isScreen:u.isScreen,pubState:Cz.PUB,remoteStream:u}),S&&this.safeEmit(Az.ON_USER_PUBLISH_STATE_CHANGE,{userId:o,mediaType:S,isScreen:u.isScreen,pubState:Cz.UNPUB,remoteStream:u}),u.attributes=h,h.localaudio!==l.localaudio)if(h.localaudio){var b,E,k,T;if(r)if(h.extaudio)null===(b=u.observer)||void 0===b||b.setExternalAudioSource(!0),null===(E=u.observer)||void 0===E||E.setPushAudio(!0);else null===(k=u.observer)||void 0===k||k.setExternalAudioSource(!1),null===(T=u.observer)||void 0===T||T.setEnableAudio(!0);this.safeEmit(Az.ON_USER_START_AUDIO_CAPTURE,{userId:o},u)}else{var I,R,A,w;if(h.extaudio)null===(I=u.observer)||void 0===I||I.setExternalAudioSource(!0),null===(R=u.observer)||void 0===R||R.setPushAudio(!1);else null===(A=u.observer)||void 0===A||A.setExternalAudioSource(!1),null===(w=u.observer)||void 0===w||w.setEnableAudio(!1);!u.isScreen&&this.safeEmit(Az.ON_USER_STOP_AUDIO_CAPTURE,{userId:o})}if(h.localvideo!==l.localvideo)if(h.localvideo){var C,O,x,N;if(n)if(h.extvideo)null===(C=u.observer)||void 0===C||C.setExternalVideoSource(!0),null===(O=u.observer)||void 0===O||O.setPushVideo(!0);else null===(x=u.observer)||void 0===x||x.setExternalVideoSource(!1),null===(N=u.observer)||void 0===N||N.setEnableVideo(!0);this.safeEmit(Az.ON_USER_START_VIDEO_CAPTURE,{userId:o})}else{var D,P,M,L;if(h.extvideo)null===(D=u.observer)||void 0===D||D.setExternalVideoSource(!0),null===(P=u.observer)||void 0===P||P.setPushVideo(!1);else null===(M=u.observer)||void 0===M||M.setExternalVideoSource(!1),null===(L=u.observer)||void 0===L||L.setEnableVideo(!1);!u.isScreen&&this.safeEmit(Az.ON_USER_STOP_VIDEO_CAPTURE,{userId:o})}if(f&&!p)null===(c=u.observer)||void 0===c||c.setRemoteUnmuteAudio(v);if(_&&!m)null===(d=u.observer)||void 0===d||d.setRemoteUnmuteVideo(y)}}},{key:"_onPushTrack",value:function(e){var t=this,r=e.clientId,n=e.streamId,i=this._findRemoteStream(r,n);i||(i=this._onAddStream(e,!1,!1)),this._mediaServerClient.subscribe4pushTrack(i,e).then((function(){return t.safeEmit(Az.SUBSCRIBE_PUSH_TRACK,{stream:i})})).catch((function(e){_W.print("subscribe push track failed: ".concat(e))}))}},{key:"_onRemoveTrack",value:function(e){var t=this,r=e.clientId,n=e.streamId,i=e.message,o=this._findRemoteStream(r,n);o&&this._mediaServerClient.unsubscribe4removeTrack(o,i).then((function(){if(o._workaround_1_){var e,i=null===(e=t._remoteStreams.get(r))||void 0===e?void 0:e.filter((function(e){return e.streamId!==n}));t._remoteStreams.set(r,i||[])}t.safeEmit(Az.REMOVE_PUSH_TRACK,{stream:o})})).catch((function(e){_W.print("remove push track failed: ".concat(e))}))}},{key:"_nodeChange",value:function(e){var t,r=e.nodes,n=e.reason;qB.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,IB.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=R(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()}IB.rtcReconnect(1002,qF.PEERCONNECTION_RECONNECTING,this._roomInfo.userInfo.userId,KF.PEERCONNECTION),this._join((function(){IB.rtcReconnected(XF.PEERCONNECTION_RECONNECTED,WF.PEERCONNECTION)}),(function(t){e._reconnectRecord.record(t),e._reconnectRecord.shouldReconnect?(_W.print("Reconnecting error, will reconnect after 3s",t),e._reconnectTimer=window.setTimeout(e._reconnect.bind(e),3e3)):(e.safeEmit(Az.RECONNECT_FAILED),e.destroy())}),!0)}},{key:"_handleAbnormalDisconnection",value:function(){_W.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===rq.DISCONNECTED)t=B.CONNECTION_STATE_DISCONNECTED;else if(e.next===rq.CONNECTED)clearTimeout(this._connectionLostTimer),t=this._isReconnecting?B.CONNECTION_STATE_RECONNECTED:B.CONNECTION_STATE_CONNECTED;else{if(e.next!==rq.CONNECTING)return;t=this._isReconnecting?B.CONNECTION_STATE_RECONNECTING:B.CONNECTION_STATE_CONNECTING}e.prev===rq.CONNECTED&&e.next===rq.DISCONNECTED&&(this._connectionLostTimer=window.setTimeout((function(){r.safeEmit(cj.ON_CONNECTION_STATE_CHANGE,{state:B.CONNECTION_STATE_LOST})}),1e4)),this._networkQualityManager.setConnectionState(e.next),this.safeEmit(cj.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(Az.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?U.STREAM_INDEX_SCREEN:U.STREAM_INDEX_MAIN}})}))}},{key:"_onCustomMessage",value:function(e){this.safeEmit(sj.ON_CUSTOM_MESSAGE,e)}},{key:"_onUserMessageReceived",value:function(e){this.safeEmit(sj.USER_MESSAGE_RECEIVED,{userId:e.from,message:e.msg})}},{key:"_onUserBinaryMessageReceived",value:function(e){this.safeEmit(sj.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=wz.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=wz.START_FAILED);break;case"TranscodeStateChanged":n=0!==t.error?wz.START_FAILED:wz.START_SUCCESS;break;case"TranscodeStopped":n=0!==t.error?wz.STOP_FAILED:wz.STOP_SUCCESS;break;case"TranscodeUpdated":n=0!==t.error?wz.UPDATE_FAILED:wz.UPDATE_SUCCESS}this.safeEmit(sj.POST_PROCESSING_MESSAGE,{code:r,protocol:t.protocol,error:t.error,eventType:n,message:i[r]})}this.safeEmit(sj.POST_PROCESSING_MESSAGE,{code:r,message:i[r],type:e.type})}}},{key:"_onUserTokenWillExpire",value:function(){this.safeEmit(sj.ON_USER_TOKEN_WILL_EXPIRE,null)}},{key:"_onSceneConfig",value:function(e){var t=e.multiSceneConfig,r=Jz[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)}}},{key:"_onStreamFailed",value:(t=u(o().mark((function e(t){var r,n,i,a,s,u,c,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(u=void 0,(null===(r=this.localStream)||void 0===r?void 0:r.streamId)===t.streamId?u=this.localStream:(null===(n=this.localScreenStream)||void 0===n?void 0:n.streamId)===t.streamId&&(u=this.localScreenStream),u){e.next=5;break}return e.abrupt("return");case 5:return null===(i=u)||void 0===i||i.clean(),e.next=8,null===(a=this._mediaServerClient)||void 0===a?void 0:a.unpublish(u).catch((function(){}));case 8:null===(s=this._mediaServerClient)||void 0===s||s.publish(u).catch((function(){})),e.next=20;break;case 11:if("subscribe"!==t.type){e.next=20;break}if(c=this._remoteStreamStreamIdUserIdMap[t.streamId],!(d=this._findRemoteStream(c,t.streamId))){e.next=20;break}return e.next=17,null===(l=this._mediaServerClient)||void 0===l?void 0:l.unsubscribe(d,V.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(Az.RESUBSCRIBE,{stream:d});case 20:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"_onStreamControlMessage",value:function(e){var t,r;e.type===aj.PushLimitWarn&&(null!==(t=this._localStream)&&void 0!==t&&t.pubAudio||null!==(r=this._localStream)&&void 0!==r&&r.pubVideo||this.unpublish())}},{key:"_onPublishOnDemand",value:function(e){var t,r,n,i,o;if(!1!==(null===(t=this._serverConfig)||void 0===t||null===(r=t.engine_VPM)||void 0===r||null===(n=r.ondemand)||void 0===n?void 0:n.enable)&&null!==(i=this._localStream)&&void 0!==i&&i.enableSimulcast&&null!==(o=this._localStream)&&void 0!==o&&o.videoTransceiver){var a,s,u=null===(a=this._localStream)||void 0===a?void 0:a.stream.id,c=null===(s=this._localStream)||void 0===s?void 0:s.videoTransceiver.sender,d=c.getParameters();if(Array.isArray(d.encodings)&&Array.isArray(e)){var l,h,f,p,v={};_W.print("_onPublishOnDemand","usedDescriptions: %o",e),e.forEach((function(e){var t;if(null!=e&&null!==(t=e.StreamIds)&&void 0!==t&&t.includes(u)){var r=null==e?void 0:e.Metadata.SubvideoIndex;v[r]=r}}));var _={};null===(l=this._localStream)||void 0===l||null===(h=l.subVideoDescriptions)||void 0===h||h.forEach((function(e){void 0!==v[e.sub_index]&&(_[e.video_index]=e)}));var m=(null===(f=c.track)||void 0===f||null===(p=f.getSettings())||void 0===p?void 0:p.height)||720,y=[];d.encodings=d.encodings.map((function(e){return e.rid&&(_[e.rid]?(e.active=!0,e.scaleResolutionDownBy=Math.max(m/_[e.rid].height,1),y.push({type:1,rid:e.rid,downBy:e.scaleResolutionDownBy})):(y.push({type:0,rid:e.rid}),e.active=!1)),e})),IB.rtcInvokeStatus(JSON.stringify(y),0,"rscp",u,0)}c.setParameters(d)}}},{key:"_onRTT",value:function(e){var t=e.StreamIds,r=e.Metadata;if(t.length&&r){var n,i=t[0];null!==(n=this._context)&&void 0!==n&&n.streamRTT&&(this._context.streamRTT[i]={audio:r.audio_rtt,video:r.video_rtt})}}},{key:"_reportNetworkQuality",value:function(e,t){this._subFallbackManager.updateNetworkQuality(e,t),this.emit(Az.ON_NETWORK_QUALITY,e,t)}},{key:"_emitVideoSizeChange",value:function(e,t,r,n){var i;this.emit(Az.ON_REMOTE_VIDEO_SIZE_CHANGED,{roomId:null===(i=this.roomInfo)||void 0===i?void 0:i.roomId,userId:e,streamIndex:t?U.STREAM_INDEX_SCREEN:U.STREAM_INDEX_MAIN},{width:r,height:n})}},{key:"_emitSubscribeFallback",value:function(e){this.emit(Az.ON_SIMULCAST_SUBSCRIBE_FALLBACK,e)}}]),L}(VL),yW=function(){function e(){c(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}(),gW=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=document.createElement(e);return t.id&&(r.id=t.id),t.classList&&t.classList.forEach((function(e){r.classList.add(e)})),t.style&&Object.assign(r.style,t.style),t.attributes&&Object.entries(t.attributes).forEach((function(e){var t=E(e,2),n=t[0],i=t[1];"muted"===n?r.muted=!0:r.setAttribute(n,i)})),r},SW=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.id&&(e.id=t.id),t.classList&&t.classList.forEach((function(t){e.classList.add(t)})),t.style&&Object.assign(e.style,t.style),t.attributes&&Object.entries(t.attributes).forEach((function(t){var r=E(t,2),n=r[0],i=r[1];e.setAttribute(n,i)})),e},bW=new LL("Player",0),EW=["play","playing","pause","ended","error","seeking","seeked","waiting","canplay","canplaythrough","durationchange","volumechange","loadedmetadata","loadeddata","loadstart","timeupdate"],kW={playsinline:"","webkit-playsinline":""},TW={playsinline:"","webkit-playsinline":"","x5-playsinline":"","x5-video-player-type":"h5","x-webkit-airplay":"allow",preload:"",muted:""},IW=new(function(){function e(){c(this,e),h(this,"videoCache",[]),h(this,"audioCache",[])}return l(e,[{key:"getOrCreate",value:function(e,t){var r="audio"===e?kW:TW;if("video"===e&&this.videoCache.length>0){var n=this.videoCache.pop();if(n)return SW(n,{style:t,attributes:r}),n}else if("audio"===e&&this.audioCache.length>0){var i=this.audioCache.pop();if(i)return SW(i,{style:t,attributes:r}),i}return gW(e,{style:t,attributes:r})}},{key:"recycle",value:function(e){for(;e.attributes.length>0;)e.removeAttribute(e.attributes[0].name);e instanceof HTMLVideoElement?this.videoCache.push(e):this.audioCache.push(e)}}]),e}()),RW=function(e){f(n,e);var t,r=g(n);function n(e){var t;c(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",j.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),"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};t.emit("playback_event",i)})),h(m(t),"_internalPlay",(function(){var e;if(null!==(e=t._videoDom)&&void 0!==e&&e.paused){var r=t._videoDom.play();null!=r&&r.then&&r.catch((function(e){var r,n;t._emitPlayFailed||(t._emitPlayFailed=!0,IB.rtcError("video autoplay failed, userId: ".concat(t.userId),-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}))}))}}));var i=e.renderDom,o=e.userId;t.renderMode=void 0!==e.renderMode?e.renderMode:L.RENDER_MODE_FIT;var a="string"==typeof i?document.getElementById(i):i;if(!a)throw new ZN(JN.CANT_FIND_DOM,"can't find dom");return 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=IW.getOrCreate("video",{width:"100%",height:"100%"}),this._videoDom.id="".concat(this.userId,"_").concat(dP()),this.renderMode===L.RENDER_MODE_FIT?this._videoDom.style.objectFit="contain":this._videoDom.style.objectFit="cover",this.mirror(this.mirrorType===j.MIRROR_TYPE_RENDER)),this._containerDom.appendChild(this._videoDom),this._initListeners()}},{key:"_initListeners",value:function(){var e=this;this._videoDom&&EW.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&&(EW.forEach((function(t){var r;null===(r=e._videoDom)||void 0===r||r.removeEventListener(t,e.emitVideoEvent)})),this._videoDom.addEventListener("canplay",this._internalPlay),this._videoDom.addEventListener("loadeddata",this._internalPlay))}},{key:"_recordFrame",value:function(e){var t=this;this.on("playback_event",(function(r){var n,i=e.isScreen?1.5:.5;if("timeupdate"===r.eventName){if(0===(null===(n=t._videoDom)||void 0===n?void 0:n.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>i;e.recordedVideoFrames.push({playTime:t._videoDom.currentTime,isStall:a,stallCount:a?1:0,stallDuration:o%2e3})}t.__cumulativeTime=t._videoDom.currentTime}}))}},{key:"playVideo",value:(t=u(o().mark((function e(t,r){var n,i,a,s,u=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=this._videoDom,bW.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=4;break}return e.abrupt("return");case 4:a||(this._initVideo(),a=this._videoDom),bW.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(a)&&this._containerDom.appendChild(a),a.addEventListener("canplay",this._internalPlay),a.addEventListener("loadeddata",this._internalPlay),setTimeout((function(){return u._internalPlay()})),r&&(this._recordFrame(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(bW.print("Invoke VideoPlayer.manuallyPlay"),this._emitPlayFailed=!1,!this._videoDom)throw new ZN(JN.INVALID_PARAMS,"Player not found");return this._videoDom.play()}},{key:"mirror",value:function(e){bW.print("mirror","".concat(this.userId," set mirror: ").concat(e)),this.mirrorType=e?j.MIRROR_TYPE_RENDER:j.MIRROR_TYPE_NONE,this._videoDom&&(this._videoDom.style.transform=e?"rotateY(180deg)":"")}},{key:"stop",value:function(){var e=this._containerDom;bW.print("stop","stop video track: ".concat(this.userId)),this._videoDom&&(this._videoDom.srcObject=null,null!=e&&e.contains(this._videoDom)&&e.removeChild(this._videoDom)),this.__cumulativeTime=void 0,this.played=!1}},{key:"destroy",value:function(){bW.print("destroy","video player: ".concat(this.userId)),this.stop(),b(p(n.prototype),"removeAllListeners",this).call(this),this._removeListeners(),this._videoDom&&(IW.recycle(this._videoDom),delete this._videoDom)}},{key:"domElement",get:function(){return this._videoDom}}]),n}(xL.exports.EventEmitter),AW=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},o=r.divId,a=r.muted;if(c(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),"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};t.emit("playback_event",i)})),h(m(t),"_internalPlay",(function(){var e,r;if(LB("_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)})).then((function(){LB("_internalPlay successfully",{userId:t.userId})}))}catch(i){t._autoPlayError(i)}})),o){var s=document.getElementById(o);if(!s)throw new ZN(JN.CANT_FIND_DOM,"can't find dom");t._containerDom=s}else t._containerDom=document.body;return t.userId=e,t.muted=a,t._initAudio(),t}return l(i,[{key:"_initAudio",value:function(){this._audioDom||(this._audioDom=IW.getOrCreate("audio",{display:"none"}),this._audioDom.volume=this.muted?0:1,this._audioDom.id="".concat(this.userId,"_").concat(dP()),this._containerDom.appendChild(this._audioDom)),this._initListeners()}},{key:"_initListeners",value:function(){var e=this;this._audioDom&&EW.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&&(EW.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=u(o().mark((function e(t){var r,n,i,a,s,u=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(bW.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 u._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,IB.rtcError("audio autoplay failed, userId: ".concat(this.userId,": ").concat(e.message),-1e3),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:"manuallyPlay",value:function(){var e;if(bW.print("Invoke AudioPlayer.manuallyPlay"),this._emitPlayFailed=!1,!this._audioDom)throw new ZN(JN.INVALID_PARAMS,"Player not found");this._audioDom.volume=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=u(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return bW.print("setPlaybackDevice","setPlaybackDevice: ".concat(t)),e.next=3,kH.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;bW.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)}},{key:"domElement",get:function(){return this._audioDom}},{key:"destroy",value:function(){bW.print("destroy","audio player: ".concat(this.userId)),this.stop(),b(p(i.prototype),"removeAllListeners",this).call(this),this._removeListeners(),this._audioDom&&(IW.recycle(this._audioDom),delete this._audioDom)}}]),i}(xL.exports.EventEmitter),wW=function(){function e(){c(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(){this._report(),this._reset()}},{key:"_report",value:function(){var e=this;IB.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_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){var r=this.userMessage["".concat(t,"-").concat(e)];r&&r.dc_send_fail++}},{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,yB.P2P,t)}},{key:"recvP2PMessage",value:function(e){this._recvUserMessage(e,yB.P2P)}},{key:"sendP2PFail",value:function(e){this._sendUserFail(e,yB.P2P)}},{key:"sendP2PAck",value:function(e,t,r,n){this._sendUserAck(e,yB.P2P,t,r,n)}},{key:"sendP2POutRoomMessage",value:function(e,t){this._sendUserMessage(e,yB.P2P_OUTSIDE_ROOM,t)}},{key:"recvP2POutRoomMessage",value:function(e){this._recvUserMessage(e,yB.P2P_OUTSIDE_ROOM)}},{key:"sendP2POutRoomFail",value:function(e){this._sendUserFail(e,yB.P2P_OUTSIDE_ROOM)}},{key:"sendP2POutRoomAck",value:function(e,t,r,n){this._sendUserAck(e,yB.P2P_OUTSIDE_ROOM,t,r,n)}},{key:"sendP2serverMessage",value:function(e){this._sendUserMessage("",yB.P2SERVER,e)}},{key:"sendP2serverFail",value:function(){this._sendUserFail("",yB.P2SERVER)}},{key:"sendP2serveAck",value:function(e){this._sendUserAck("",yB.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)}},{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)}},{key:"countServerMessage",value:function(e,t,r){this.sendP2serverMessage(t),e?this.sendP2serveAck(Date.now()-r):this.sendP2serverFail()}},{key:"destroy",value:function(){this._reset(),clearTimeout(this._timer)}}]),e}(),CW="object"==typeof global&&global&&global.Object===Object&&global,OW="object"==typeof self&&self&&self.Object===Object&&self,xW=CW||OW||Function("return this")(),NW=xW.Symbol,DW=Object.prototype,PW=DW.hasOwnProperty,MW=DW.toString,LW=NW?NW.toStringTag:void 0;var UW=Object.prototype.toString;var VW=NW?NW.toStringTag:void 0;function FW(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":VW&&VW in Object(e)?function(e){var t=PW.call(e,LW),r=e[LW];try{e[LW]=void 0;var n=!0}catch(o){}var i=MW.call(e);return n&&(t?e[LW]=r:delete e[LW]),i}(e):function(e){return UW.call(e)}(e)}function BW(e){return null!=e&&"object"==typeof e}var jW=Array.isArray;function GW(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function HW(e){return e}function zW(e){if(!GW(e))return!1;var t=FW(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}var qW,KW=xW["__core-js_shared__"],XW=(qW=/[^.]+$/.exec(KW&&KW.keys&&KW.keys.IE_PROTO||""))?"Symbol(src)_1."+qW:"";var WW=Function.prototype.toString;var YW=/^\[object .+?Constructor\]$/,JW=Function.prototype,QW=Object.prototype,ZW=JW.toString,$W=QW.hasOwnProperty,eY=RegExp("^"+ZW.call($W).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function tY(e){return!(!GW(e)||(t=e,XW&&XW in t))&&(zW(e)?eY:YW).test(function(e){if(null!=e){try{return WW.call(e)}catch(t){}try{return e+""}catch(t){}}return""}(e));var t}function rY(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 nY=Date.now;var iY,oY,aY,sY=function(){try{var e=tY(t=function(e,t){return null==e?void 0:e[t]}(Object,"defineProperty"))?t:void 0;return e({},"",{}),e}catch(r){}var t}(),uY=sY,cY=uY?function(e,t){return uY(e,"toString",{configurable:!0,enumerable:!1,value:(r=t,function(){return r}),writable:!0});var r}:HW,dY=(iY=cY,oY=0,aY=0,function(){var e=nY(),t=16-(e-aY);if(aY=e,t>0){if(++oY>=800)return arguments[0]}else oY=0;return iY.apply(void 0,arguments)}),lY=dY,hY=/^(?:0|[1-9]\d*)$/;function fY(e,t){var r=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==r||"symbol"!=r&&hY.test(e))&&e>-1&&e%1==0&&e<t}function pY(e,t,r){"__proto__"==t&&uY?uY(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function vY(e,t){return e===t||e!=e&&t!=t}var _Y=Object.prototype.hasOwnProperty;function mY(e,t,r){var n=e[t];_Y.call(e,t)&&vY(n,r)&&(void 0!==r||t in e)||pY(e,t,r)}var yY=Math.max;function gY(e,t){return lY(function(e,t,r){return t=yY(void 0===t?e.length-1:t,0),function(){for(var n=arguments,i=-1,o=yY(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),rY(e,this,s)}}(e,t,HW),e+"")}function SY(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function bY(e){return null!=e&&SY(e.length)&&!zW(e)}var EY=Object.prototype;function kY(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||EY)}function TY(e){return BW(e)&&"[object Arguments]"==FW(e)}var IY=Object.prototype,RY=IY.hasOwnProperty,AY=IY.propertyIsEnumerable,wY=TY(function(){return arguments}())?TY:function(e){return BW(e)&&RY.call(e,"callee")&&!AY.call(e,"callee")},CY=wY;var OY="object"==typeof exports&&exports&&!exports.nodeType&&exports,xY=OY&&"object"==typeof module&&module&&!module.nodeType&&module,NY=xY&&xY.exports===OY?xW.Buffer:void 0,DY=(NY?NY.isBuffer:void 0)||function(){return!1},PY={};PY["[object Float32Array]"]=PY["[object Float64Array]"]=PY["[object Int8Array]"]=PY["[object Int16Array]"]=PY["[object Int32Array]"]=PY["[object Uint8Array]"]=PY["[object Uint8ClampedArray]"]=PY["[object Uint16Array]"]=PY["[object Uint32Array]"]=!0,PY["[object Arguments]"]=PY["[object Array]"]=PY["[object ArrayBuffer]"]=PY["[object Boolean]"]=PY["[object DataView]"]=PY["[object Date]"]=PY["[object Error]"]=PY["[object Function]"]=PY["[object Map]"]=PY["[object Number]"]=PY["[object Object]"]=PY["[object RegExp]"]=PY["[object Set]"]=PY["[object String]"]=PY["[object WeakMap]"]=!1;var MY="object"==typeof exports&&exports&&!exports.nodeType&&exports,LY=MY&&"object"==typeof module&&module&&!module.nodeType&&module,UY=LY&&LY.exports===MY&&CW.process,VY=function(){try{var e=LY&&LY.require&&LY.require("util").types;return e||UY&&UY.binding&&UY.binding("util")}catch(t){}}(),FY=VY&&VY.isTypedArray,BY=FY?function(e){return function(t){return e(t)}}(FY):function(e){return BW(e)&&SY(e.length)&&!!PY[FW(e)]},jY=BY,GY=Object.prototype.hasOwnProperty;function HY(e,t){var r=jW(e),n=!r&&CY(e),i=!r&&!n&&DY(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):[],u=s.length;for(var c in e)!t&&!GY.call(e,c)||a&&("length"==c||i&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||fY(c,u))||s.push(c);return s}var zY=function(e,t){return function(r){return e(t(r))}}(Object.keys,Object),qY=zY,KY=Object.prototype.hasOwnProperty;function XY(e){return bY(e)?HY(e):function(e){if(!kY(e))return qY(e);var t=[];for(var r in Object(e))KY.call(e,r)&&"constructor"!=r&&t.push(r);return t}(e)}var WY=Object.prototype.hasOwnProperty;function YY(e){if(!GW(e))return function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t}(e);var t=kY(e),r=[];for(var n in e)("constructor"!=n||!t&&WY.call(e,n))&&r.push(n);return r}var JY,QY=(JY=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],u=n?n(r[s],e[s],s,r,e):void 0;void 0===u&&(u=e[s]),i?pY(r,s,u):mY(r,s,u)}}(t,function(e){return bY(e)?HY(e,!0):YY(e)}(t),e)},gY((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=JY.length>3&&"function"==typeof i?(n--,i):void 0,o&&function(e,t,r){if(!GW(r))return!1;var n=typeof t;return!!("number"==n?bY(r)&&fY(t,r.length):"string"==n&&t in r)&&vY(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&&JY(e,a,r,i)}return e})));function ZY(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 $Y(e){return null==e?[]:ZY(e,XY(e))}var eJ=ye,tJ=_t("iterator"),rJ=!eJ((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[tJ]||"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})),nJ=Te,iJ=2147483647,oJ=/[^\0-\u007E]/,aJ=/[.\u3002\uFF0E\uFF61]/g,sJ="Overflow: input needs wider integers to process",uJ=RangeError,cJ=nJ(aJ.exec),dJ=Math.floor,lJ=String.fromCharCode,hJ=nJ("".charCodeAt),fJ=nJ([].join),pJ=nJ([].push),vJ=nJ("".replace),_J=nJ("".split),mJ=nJ("".toLowerCase),yJ=function(e){return e+22+75*(e<26)},gJ=function(e,t,r){var n=0;for(e=r?dJ(e/700):e>>1,e+=dJ(e/t);e>455;)e=dJ(e/35),n+=36;return dJ(n+36*e/(e+38))},SJ=function(e){var t=[];e=function(e){for(var t=[],r=0,n=e.length;r<n;){var i=hJ(e,r++);if(i>=55296&&i<=56319&&r<n){var o=hJ(e,r++);56320==(64512&o)?pJ(t,((1023&i)<<10)+(1023&o)+65536):(pJ(t,i),r--)}else pJ(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&&pJ(t,lJ(n));var u=t.length,c=u;for(u&&pJ(t,"-");c<i;){var d=iJ;for(r=0;r<e.length;r++)(n=e[r])>=o&&n<d&&(d=n);var l=c+1;if(d-o>dJ((iJ-a)/l))throw uJ(sJ);for(a+=(d-o)*l,o=d,r=0;r<e.length;r++){if((n=e[r])<o&&++a>iJ)throw uJ(sJ);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;pJ(t,lJ(yJ(p+v%_))),h=dJ(v/_),f+=36}pJ(t,lJ(yJ(h))),s=gJ(a,l,c==u),a=0,c++}}a++,o++}return fJ(t,"")},bJ=ha,EJ=se,kJ=Ut,TJ=Te,IJ=St,RJ=rJ,AJ=wn,wJ=tf,CJ=dd,OJ=md,xJ=ln,NJ=wh,DJ=He,PJ=Pe,MJ=Zn,LJ=Fn,UJ=Pt,VJ=kt,FJ=es,BJ=La,jJ=Gr,GJ=sh,HJ=eh,zJ=B_,qJ=DI,KJ=_t("iterator"),XJ="URLSearchParams",WJ="URLSearchParamsIterator",YJ=xJ.set,JJ=xJ.getterFor(XJ),QJ=xJ.getterFor(WJ),ZJ=Object.getOwnPropertyDescriptor,$J=function(e){if(!IJ)return EJ[e];var t=ZJ(EJ,e);return t&&t.value},eQ=$J("fetch"),tQ=$J("Request"),rQ=$J("Headers"),nQ=tQ&&tQ.prototype,iQ=rQ&&rQ.prototype,oQ=EJ.RegExp,aQ=EJ.TypeError,sQ=EJ.decodeURIComponent,uQ=EJ.encodeURIComponent,cQ=TJ("".charAt),dQ=TJ([].join),lQ=TJ([].push),hQ=TJ("".replace),fQ=TJ([].shift),pQ=TJ([].splice),vQ=TJ("".split),_Q=TJ("".slice),mQ=/\+/g,yQ=Array(4),gQ=function(e){return yQ[e-1]||(yQ[e-1]=oQ("((?:%[\\da-f]{2}){"+e+"})","gi"))},SQ=function(e){try{return sQ(e)}catch(r0){return e}},bQ=function(e){var t=hQ(e,mQ," "),r=4;try{return sQ(t)}catch(r0){for(;r;)t=hQ(t,gQ(r--),SQ);return t}},EQ=/[!'()~]|%20/g,kQ={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},TQ=function(e){return kQ[e]},IQ=function(e){return hQ(uQ(e),EQ,TQ)},RQ=OJ((function(e,t){YJ(this,{type:WJ,iterator:GJ(JJ(e).entries),kind:t})}),"Iterator",(function(){var e=QJ(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),AQ=function(e){this.entries=[],this.url=null,void 0!==e&&(VJ(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===cQ(e,0)?_Q(e,1):e:FJ(e)))};AQ.prototype={type:XJ,bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t,r,n,i,o,a,s,u=HJ(e);if(u)for(r=(t=GJ(e,u)).next;!(n=kJ(r,t)).done;){if(o=(i=GJ(UJ(n.value))).next,(a=kJ(o,i)).done||(s=kJ(o,i)).done||!kJ(o,i).done)throw aQ("Expected sequence with length 2");lQ(this.entries,{key:FJ(a.value),value:FJ(s.value)})}else for(var c in e)PJ(e,c)&&lQ(this.entries,{key:c,value:FJ(e[c])})},parseQuery:function(e){if(e)for(var t,r,n=vQ(e,"&"),i=0;i<n.length;)(t=n[i++]).length&&(r=vQ(t,"="),lQ(this.entries,{key:bQ(fQ(r)),value:bQ(dQ(r,"="))}))},serialize:function(){for(var e,t=this.entries,r=[],n=0;n<t.length;)e=t[n++],lQ(r,IQ(e.key)+"="+IQ(e.value));return dQ(r,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var wQ=function(){NJ(this,CQ);var e=arguments.length>0?arguments[0]:void 0;YJ(this,new AQ(e))},CQ=wQ.prototype;if(wJ(CQ,{append:function(e,t){zJ(arguments.length,2);var r=JJ(this);lQ(r.entries,{key:FJ(e),value:FJ(t)}),r.updateURL()},delete:function(e){zJ(arguments.length,1);for(var t=JJ(this),r=t.entries,n=FJ(e),i=0;i<r.length;)r[i].key===n?pQ(r,i,1):i++;t.updateURL()},get:function(e){zJ(arguments.length,1);for(var t=JJ(this).entries,r=FJ(e),n=0;n<t.length;n++)if(t[n].key===r)return t[n].value;return null},getAll:function(e){zJ(arguments.length,1);for(var t=JJ(this).entries,r=FJ(e),n=[],i=0;i<t.length;i++)t[i].key===r&&lQ(n,t[i].value);return n},has:function(e){zJ(arguments.length,1);for(var t=JJ(this).entries,r=FJ(e),n=0;n<t.length;)if(t[n++].key===r)return!0;return!1},set:function(e,t){zJ(arguments.length,1);for(var r,n=JJ(this),i=n.entries,o=!1,a=FJ(e),s=FJ(t),u=0;u<i.length;u++)(r=i[u]).key===a&&(o?pQ(i,u--,1):(o=!0,r.value=s));o||lQ(i,{key:a,value:s}),n.updateURL()},sort:function(){var e=JJ(this);qJ(e.entries,(function(e,t){return e.key>t.key?1:-1})),e.updateURL()},forEach:function(e){for(var t,r=JJ(this).entries,n=MJ(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 RQ(this,"keys")},values:function(){return new RQ(this,"values")},entries:function(){return new RQ(this,"entries")}},{enumerable:!0}),AJ(CQ,KJ,CQ.entries,{name:"entries"}),AJ(CQ,"toString",(function(){return JJ(this).serialize()}),{enumerable:!0}),CJ(wQ,XJ),bJ({global:!0,constructor:!0,forced:!RJ},{URLSearchParams:wQ}),!RJ&&DJ(rQ)){var OQ=TJ(iQ.has),xQ=TJ(iQ.set),NQ=function(e){if(VJ(e)){var t,r=e.body;if(LJ(r)===XJ)return t=e.headers?new rQ(e.headers):new rQ,OQ(t,"content-type")||xQ(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),BJ(e,{body:jJ(0,FJ(r)),headers:jJ(0,t)})}return e};if(DJ(eQ)&&bJ({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(e){return eQ(e,arguments.length>1?NQ(arguments[1]):{})}}),DJ(tQ)){var DQ=function(e){return NJ(this,nQ),new tQ(e,arguments.length>1?NQ(arguments[1]):{})};nQ.constructor=DQ,DQ.prototype=nQ,bJ({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:DQ})}}var PQ,MQ=ha,LQ=St,UQ=rJ,VQ=se,FQ=Zn,BQ=Te,jQ=wn,GQ=Fg,HQ=wh,zQ=Pe,qQ=Qp,KQ=UD,XQ=_l,WQ=sc.codeAt,YQ=function(e){var t,r,n=[],i=_J(vJ(mJ(e),aJ,"."),".");for(t=0;t<i.length;t++)r=i[t],pJ(n,cJ(oJ,r)?"xn--"+SJ(r):r);return fJ(n,".")},JQ=es,QQ=dd,ZQ=B_,$Q={URLSearchParams:wQ,getState:JJ},eZ=ln,tZ=eZ.set,rZ=eZ.getterFor("URL"),nZ=$Q.URLSearchParams,iZ=$Q.getState,oZ=VQ.URL,aZ=VQ.TypeError,sZ=VQ.parseInt,uZ=Math.floor,cZ=Math.pow,dZ=BQ("".charAt),lZ=BQ(/./.exec),hZ=BQ([].join),fZ=BQ(1..toString),pZ=BQ([].pop),vZ=BQ([].push),_Z=BQ("".replace),mZ=BQ([].shift),yZ=BQ("".split),gZ=BQ("".slice),SZ=BQ("".toLowerCase),bZ=BQ([].unshift),EZ="Invalid scheme",kZ="Invalid host",TZ="Invalid port",IZ=/[a-z]/i,RZ=/[\d+-.a-z]/i,AZ=/\d/,wZ=/^0x/i,CZ=/^[0-7]+$/,OZ=/^\d+$/,xZ=/^[\da-f]+$/i,NZ=/[\0\t\n\r #%/:<>?@[\\\]^|]/,DZ=/[\0\t\n\r #/:<>?@[\\\]^|]/,PZ=/^[\u0000-\u0020]+|[\u0000-\u0020]+$/g,MZ=/[\t\n\r]/g,LZ=function(e){var t,r,n,i;if("number"==typeof e){for(t=[],r=0;r<4;r++)bZ(t,e%256),e=uZ(e/256);return hZ(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+=fZ(e[r],16),r<7&&(t+=":")));return"["+t+"]"}return e},UZ={},VZ=qQ({},UZ,{" ":1,'"':1,"<":1,">":1,"`":1}),FZ=qQ({},VZ,{"#":1,"?":1,"{":1,"}":1}),BZ=qQ({},FZ,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),jZ=function(e,t){var r=WQ(e,0);return r>32&&r<127&&!zQ(t,e)?e:encodeURIComponent(e)},GZ={ftp:21,file:null,http:80,https:443,ws:80,wss:443},HZ=function(e,t){var r;return 2==e.length&&lZ(IZ,dZ(e,0))&&(":"==(r=dZ(e,1))||!t&&"|"==r)},zZ=function(e){var t;return e.length>1&&HZ(gZ(e,0,2))&&(2==e.length||"/"===(t=dZ(e,2))||"\\"===t||"?"===t||"#"===t)},qZ=function(e){return"."===e||"%2e"===SZ(e)},KZ={},XZ={},WZ={},YZ={},JZ={},QZ={},ZZ={},$Z={},e$={},t$={},r$={},n$={},i$={},o$={},a$={},s$={},u$={},c$={},d$={},l$={},h$={},f$=function(e,t,r){var n,i,o,a=JQ(e);if(t){if(i=this.parse(a))throw aZ(i);this.searchParams=null}else{if(void 0!==r&&(n=new f$(r,!0)),i=this.parse(a,null,n))throw aZ(i);(o=iZ(new nZ)).bindURL(this),this.searchParams=o}};f$.prototype={type:"URL",parse:function(e,t,r){var n,i,o,a,s,u=this,c=t||KZ,d=0,l="",h=!1,f=!1,p=!1;for(e=JQ(e),t||(u.scheme="",u.username="",u.password="",u.host=null,u.port=null,u.path=[],u.query=null,u.fragment=null,u.cannotBeABaseURL=!1,e=_Z(e,PZ,"")),e=_Z(e,MZ,""),n=KQ(e);d<=n.length;){switch(i=n[d],c){case KZ:if(!i||!lZ(IZ,i)){if(t)return EZ;c=WZ;continue}l+=SZ(i),c=XZ;break;case XZ:if(i&&(lZ(RZ,i)||"+"==i||"-"==i||"."==i))l+=SZ(i);else{if(":"!=i){if(t)return EZ;l="",c=WZ,d=0;continue}if(t&&(u.isSpecial()!=zQ(GZ,l)||"file"==l&&(u.includesCredentials()||null!==u.port)||"file"==u.scheme&&!u.host))return;if(u.scheme=l,t)return void(u.isSpecial()&&GZ[u.scheme]==u.port&&(u.port=null));l="","file"==u.scheme?c=o$:u.isSpecial()&&r&&r.scheme==u.scheme?c=YZ:u.isSpecial()?c=$Z:"/"==n[d+1]?(c=JZ,d++):(u.cannotBeABaseURL=!0,vZ(u.path,""),c=d$)}break;case WZ:if(!r||r.cannotBeABaseURL&&"#"!=i)return EZ;if(r.cannotBeABaseURL&&"#"==i){u.scheme=r.scheme,u.path=XQ(r.path),u.query=r.query,u.fragment="",u.cannotBeABaseURL=!0,c=h$;break}c="file"==r.scheme?o$:QZ;continue;case YZ:if("/"!=i||"/"!=n[d+1]){c=QZ;continue}c=e$,d++;break;case JZ:if("/"==i){c=t$;break}c=c$;continue;case QZ:if(u.scheme=r.scheme,i==PQ)u.username=r.username,u.password=r.password,u.host=r.host,u.port=r.port,u.path=XQ(r.path),u.query=r.query;else if("/"==i||"\\"==i&&u.isSpecial())c=ZZ;else if("?"==i)u.username=r.username,u.password=r.password,u.host=r.host,u.port=r.port,u.path=XQ(r.path),u.query="",c=l$;else{if("#"!=i){u.username=r.username,u.password=r.password,u.host=r.host,u.port=r.port,u.path=XQ(r.path),u.path.length--,c=c$;continue}u.username=r.username,u.password=r.password,u.host=r.host,u.port=r.port,u.path=XQ(r.path),u.query=r.query,u.fragment="",c=h$}break;case ZZ:if(!u.isSpecial()||"/"!=i&&"\\"!=i){if("/"!=i){u.username=r.username,u.password=r.password,u.host=r.host,u.port=r.port,c=c$;continue}c=t$}else c=e$;break;case $Z:if(c=e$,"/"!=i||"/"!=dZ(l,d+1))continue;d++;break;case e$:if("/"!=i&&"\\"!=i){c=t$;continue}break;case t$:if("@"==i){h&&(l="%40"+l),h=!0,o=KQ(l);for(var v=0;v<o.length;v++){var _=o[v];if(":"!=_||p){var m=jZ(_,BZ);p?u.password+=m:u.username+=m}else p=!0}l=""}else if(i==PQ||"/"==i||"?"==i||"#"==i||"\\"==i&&u.isSpecial()){if(h&&""==l)return"Invalid authority";d-=KQ(l).length+1,l="",c=r$}else l+=i;break;case r$:case n$:if(t&&"file"==u.scheme){c=s$;continue}if(":"!=i||f){if(i==PQ||"/"==i||"?"==i||"#"==i||"\\"==i&&u.isSpecial()){if(u.isSpecial()&&""==l)return kZ;if(t&&""==l&&(u.includesCredentials()||null!==u.port))return;if(a=u.parseHost(l))return a;if(l="",c=u$,t)return;continue}"["==i?f=!0:"]"==i&&(f=!1),l+=i}else{if(""==l)return kZ;if(a=u.parseHost(l))return a;if(l="",c=i$,t==n$)return}break;case i$:if(!lZ(AZ,i)){if(i==PQ||"/"==i||"?"==i||"#"==i||"\\"==i&&u.isSpecial()||t){if(""!=l){var y=sZ(l,10);if(y>65535)return TZ;u.port=u.isSpecial()&&y===GZ[u.scheme]?null:y,l=""}if(t)return;c=u$;continue}return TZ}l+=i;break;case o$:if(u.scheme="file","/"==i||"\\"==i)c=a$;else{if(!r||"file"!=r.scheme){c=c$;continue}if(i==PQ)u.host=r.host,u.path=XQ(r.path),u.query=r.query;else if("?"==i)u.host=r.host,u.path=XQ(r.path),u.query="",c=l$;else{if("#"!=i){zZ(hZ(XQ(n,d),""))||(u.host=r.host,u.path=XQ(r.path),u.shortenPath()),c=c$;continue}u.host=r.host,u.path=XQ(r.path),u.query=r.query,u.fragment="",c=h$}}break;case a$:if("/"==i||"\\"==i){c=s$;break}r&&"file"==r.scheme&&!zZ(hZ(XQ(n,d),""))&&(HZ(r.path[0],!0)?vZ(u.path,r.path[0]):u.host=r.host),c=c$;continue;case s$:if(i==PQ||"/"==i||"\\"==i||"?"==i||"#"==i){if(!t&&HZ(l))c=c$;else if(""==l){if(u.host="",t)return;c=u$}else{if(a=u.parseHost(l))return a;if("localhost"==u.host&&(u.host=""),t)return;l="",c=u$}continue}l+=i;break;case u$:if(u.isSpecial()){if(c=c$,"/"!=i&&"\\"!=i)continue}else if(t||"?"!=i)if(t||"#"!=i){if(i!=PQ&&(c=c$,"/"!=i))continue}else u.fragment="",c=h$;else u.query="",c=l$;break;case c$:if(i==PQ||"/"==i||"\\"==i&&u.isSpecial()||!t&&("?"==i||"#"==i)){if(".."===(s=SZ(s=l))||"%2e."===s||".%2e"===s||"%2e%2e"===s?(u.shortenPath(),"/"==i||"\\"==i&&u.isSpecial()||vZ(u.path,"")):qZ(l)?"/"==i||"\\"==i&&u.isSpecial()||vZ(u.path,""):("file"==u.scheme&&!u.path.length&&HZ(l)&&(u.host&&(u.host=""),l=dZ(l,0)+":"),vZ(u.path,l)),l="","file"==u.scheme&&(i==PQ||"?"==i||"#"==i))for(;u.path.length>1&&""===u.path[0];)mZ(u.path);"?"==i?(u.query="",c=l$):"#"==i&&(u.fragment="",c=h$)}else l+=jZ(i,FZ);break;case d$:"?"==i?(u.query="",c=l$):"#"==i?(u.fragment="",c=h$):i!=PQ&&(u.path[0]+=jZ(i,UZ));break;case l$:t||"#"!=i?i!=PQ&&("'"==i&&u.isSpecial()?u.query+="%27":u.query+="#"==i?"%23":jZ(i,UZ)):(u.fragment="",c=h$);break;case h$:i!=PQ&&(u.fragment+=jZ(i,VZ))}d++}},parseHost:function(e){var t,r,n;if("["==dZ(e,0)){if("]"!=dZ(e,e.length-1))return kZ;if(t=function(e){var t,r,n,i,o,a,s,u=[0,0,0,0,0,0,0,0],c=0,d=null,l=0,h=function(){return dZ(e,l)};if(":"==h()){if(":"!=dZ(e,1))return;l+=2,d=++c}for(;h();){if(8==c)return;if(":"!=h()){for(t=r=0;r<4&&lZ(xZ,h());)t=16*t+sZ(h(),16),l++,r++;if("."==h()){if(0==r)return;if(l-=r,c>6)return;for(n=0;h();){if(i=null,n>0){if(!("."==h()&&n<4))return;l++}if(!lZ(AZ,h()))return;for(;lZ(AZ,h());){if(o=sZ(h(),10),null===i)i=o;else{if(0==i)return;i=10*i+o}if(i>255)return;l++}u[c]=256*u[c]+i,2!=++n&&4!=n||c++}if(4!=n)return;break}if(":"==h()){if(l++,!h())return}else if(h())return;u[c++]=t}else{if(null!==d)return;l++,d=++c}}if(null!==d)for(a=c-d,c=7;0!=c&&a>0;)s=u[c],u[c--]=u[d+a-1],u[d+--a]=s;else if(8!=c)return;return u}(gZ(e,1,-1)),!t)return kZ;this.host=t}else if(this.isSpecial()){if(e=YQ(e),lZ(NZ,e))return kZ;if(t=function(e){var t,r,n,i,o,a,s,u=yZ(e,".");if(u.length&&""==u[u.length-1]&&u.length--,(t=u.length)>4)return e;for(r=[],n=0;n<t;n++){if(""==(i=u[n]))return e;if(o=10,i.length>1&&"0"==dZ(i,0)&&(o=lZ(wZ,i)?16:8,i=gZ(i,8==o?1:2)),""===i)a=0;else{if(!lZ(10==o?OZ:8==o?CZ:xZ,i))return e;a=sZ(i,o)}vZ(r,a)}for(n=0;n<t;n++)if(a=r[n],n==t-1){if(a>=cZ(256,5-t))return null}else if(a>255)return null;for(s=pZ(r),n=0;n<r.length;n++)s+=r[n]*cZ(256,3-n);return s}(e),null===t)return kZ;this.host=t}else{if(lZ(DZ,e))return kZ;for(t="",r=KQ(e),n=0;n<r.length;n++)t+=jZ(r[n],UZ);this.host=t}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||"file"==this.scheme},includesCredentials:function(){return""!=this.username||""!=this.password},isSpecial:function(){return zQ(GZ,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;!t||"file"==this.scheme&&1==t&&HZ(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,u=e.fragment,c=t+":";return null!==i?(c+="//",e.includesCredentials()&&(c+=r+(n?":"+n:"")+"@"),c+=LZ(i),null!==o&&(c+=":"+o)):"file"==t&&(c+="//"),c+=e.cannotBeABaseURL?a[0]:a.length?"/"+hZ(a,"/"):"",null!==s&&(c+="?"+s),null!==u&&(c+="#"+u),c},setHref:function(e){var t=this.parse(e);if(t)throw aZ(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if("blob"==e)try{return new p$(e.path[0]).origin}catch(r0){return"null"}return"file"!=e&&this.isSpecial()?e+"://"+LZ(this.host)+(null!==t?":"+t:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse(JQ(e)+":",KZ)},getUsername:function(){return this.username},setUsername:function(e){var t=KQ(JQ(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var r=0;r<t.length;r++)this.username+=jZ(t[r],BZ)}},getPassword:function(){return this.password},setPassword:function(e){var t=KQ(JQ(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var r=0;r<t.length;r++)this.password+=jZ(t[r],BZ)}},getHost:function(){var e=this.host,t=this.port;return null===e?"":null===t?LZ(e):LZ(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,r$)},getHostname:function(){var e=this.host;return null===e?"":LZ(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,n$)},getPort:function(){var e=this.port;return null===e?"":JQ(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""==(e=JQ(e))?this.port=null:this.parse(e,i$))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+hZ(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,u$))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){""==(e=JQ(e))?this.query=null:("?"==dZ(e,0)&&(e=gZ(e,1)),this.query="",this.parse(e,l$)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){""!=(e=JQ(e))?("#"==dZ(e,0)&&(e=gZ(e,1)),this.fragment="",this.parse(e,h$)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var p$=function(e){var t=HQ(this,v$),r=ZQ(arguments.length,1)>1?arguments[1]:void 0,n=tZ(t,new f$(e,!1,r));LQ||(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())},v$=p$.prototype,_$=function(e,t){return{get:function(){return rZ(this)[e]()},set:t&&function(e){return rZ(this)[t](e)},configurable:!0,enumerable:!0}};if(LQ&&(GQ(v$,"href",_$("serialize","setHref")),GQ(v$,"origin",_$("getOrigin")),GQ(v$,"protocol",_$("getProtocol","setProtocol")),GQ(v$,"username",_$("getUsername","setUsername")),GQ(v$,"password",_$("getPassword","setPassword")),GQ(v$,"host",_$("getHost","setHost")),GQ(v$,"hostname",_$("getHostname","setHostname")),GQ(v$,"port",_$("getPort","setPort")),GQ(v$,"pathname",_$("getPathname","setPathname")),GQ(v$,"search",_$("getSearch","setSearch")),GQ(v$,"searchParams",_$("getSearchParams")),GQ(v$,"hash",_$("getHash","setHash"))),jQ(v$,"toJSON",(function(){return rZ(this).serialize()}),{enumerable:!0}),jQ(v$,"toString",(function(){return rZ(this).serialize()}),{enumerable:!0}),oZ){var m$=oZ.createObjectURL,y$=oZ.revokeObjectURL;m$&&jQ(p$,"createObjectURL",FQ(m$,oZ)),y$&&jQ(p$,"revokeObjectURL",FQ(y$,oZ))}QQ(p$,"URL"),MQ({global:!0,constructor:!0,forced:!UQ,sham:!LQ},{URL:p$});var g$=function(){var e=u(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)}}(),S$=Object.defineProperty,b$=Object.getOwnPropertyDescriptor,E$=function(e,t,r,n){for(var i,o=n>1?void 0:n?b$(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&&S$(t,r,o),o},k$=function(){function e(t){c(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,"mixingMap",new Map),h(this,"resourcesCache",new Map),h(this,"volumeConfig",new Map),h(this,"cachedBuffer",[]),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=u(o().mark((function e(t,r,n){var i,a,s,u,c,d,l,h,f,p,v,_,m,y=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=n.playCount,MP(a=n.type,"mixingType",$Y(te)),s=this._context.getLocalAudioTrack()){e.next=5;break}return e.abrupt("return");case 5:if((u=s.getTrack("preprocessing"))&&this.mixMediaStream(new MediaStream([u])),null!=(c=this.mixingMap.get(t))&&c.audioNode){c.audioNode.pause(),this._context.emitMessage({mixId:t,state:re.AUDIO_MIXING_STATE_STOPPED,error:QN.AUDIO_MIXING_ERROR_OK});try{c.gainNode.disconnect(this._audioDestination),c.audioSource.disconnect(c.gainNode)}catch(o){}}if(!(l=this.resourcesCache.get(t))||l.filePath!==r){e.next=14;break}d=l.getAudioNode(),e.next=27;break;case 14:return e.next=16,fetch(r,{mode:"cors",credentials:"include"}).then((function(e){if(e.ok)return e.arrayBuffer();throw y._context.emitMessage({mixId:t,state:re.AUDIO_MIXING_STATE_FAILED,error:QN.AUDIO_MIXING_ERROR_START_FAILED}),new ZN(JN.LOAD_RESOURCES_FAILED,e.statusText)}));case 16:return h=e.sent,r.endsWith("mp3")?f={type:"audio/mpeg"}:r.endsWith("aac")&&(f={type:"audio/aac"}),e.next=20,g$(h,f);case 20:if(e.sent){e.next=24;break}throw this._context.emitMessage({mixId:t,state:re.AUDIO_MIXING_STATE_FAILED,error:QN.AUDIO_MIXING_ERROR_START_FAILED}),new ZN(JN.LOAD_RESOURCES_FAILED,"invalid audio resource");case 24:(d=new Audio).crossOrigin="anonymous",d.src=URL.createObjectURL(new Blob([h],f));case 27: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:re.AUDIO_MIXING_STATE_FINISHED,error:QN.AUDIO_MIXING_ERROR_OK}))}),e.prev=28,e.next=31,d.play();case 31:e.next=38;break;case 33:e.prev=33,e.t0=e.catch(28),console.error(e.t0),this._failedAudioList.push(d),this._context.onAutoPlayFailed();case 38:if(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===te.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:re.AUDIO_MIXING_STATE_PLAYING,error:QN.AUDIO_MIXING_ERROR_OK});case 47:case"end":return e.stop()}}),e,this,[[28,33]])}))),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:re.AUDIO_MIXING_STATE_STOPPED,error:QN.AUDIO_MIXING_ERROR_OK}))}},{key:"pauseAudioMixing",value:function(e){var t=this.mixingMap.get(e);t&&(this._context.emitMessage({mixId:e,state:re.AUDIO_MIXING_STATE_PAUSED,error:QN.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:re.AUDIO_MIXING_STATE_PLAYING,error:QN.AUDIO_MIXING_ERROR_OK}),t.audioNode.play())}},{key:"preloadAudioMixing",value:(r=u(o().mark((function e(t,r){var n,i=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 i._context.emitMessage({mixId:t,state:re.AUDIO_MIXING_STATE_FAILED,error:QN.AUDIO_MIXING_ERROR_PRELOAD_FAILED}),new ZN(JN.LOAD_RESOURCES_FAILED,e.statusText)})).catch((function(e){throw i._context.emitMessage({mixId:t,state:re.AUDIO_MIXING_STATE_FAILED,error:QN.AUDIO_MIXING_ERROR_PRELOAD_FAILED}),new ZN(JN.LOAD_RESOURCES_FAILED,"Load resources failed",e)}));case 3:return n=e.sent,e.next=6,g$(n);case 6:if(e.sent){e.next=10;break}throw this._context.emitMessage({mixId:t,state:re.AUDIO_MIXING_STATE_FAILED,error:QN.AUDIO_MIXING_ERROR_PRELOAD_FAILED}),new ZN(JN.LOAD_RESOURCES_FAILED,"Load resources failed");case 10:this._context.emitMessage({mixId:t,state:re.AUDIO_MIXING_STATE_PRELOADED,error:QN.AUDIO_MIXING_ERROR_OK}),this.resourcesCache.set(t,{getAudioNode:function(){return new Audio(URL.createObjectURL(new Blob([n])))},filePath:r});case 12: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){MP(e,"type",$Y(te));var t=this._context.getLocalAudioTrack();if(t){var r=t.getTrack("preprocessing");if(r&&this.mixMediaStream(new MediaStream([r])),e===te.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:re.AUDIO_MIXING_STATE_PCM_ENABLED,error:QN.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:re.AUDIO_MIXING_STATE_PCM_DISABLED,error:QN.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=u(o().mark((function e(){var t,r,n,i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=[],r=R(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(),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()}}]),e}();E$([PB("default","id","filePath","options")],k$.prototype,"startAudioMixing",1),E$([PB("default","id")],k$.prototype,"stopAudioMixing",1),E$([PB("default","id")],k$.prototype,"pauseAudioMixing",1),E$([PB("default","id")],k$.prototype,"resumeAudioMixing",1),E$([PB("default","id")],k$.prototype,"preloadAudioMixing",1),E$([PB("default","id")],k$.prototype,"unloadAudioMixing",1),E$([PB("default","id")],k$.prototype,"getAudioMixingVolume",1),E$([PB("default","id","volume")],k$.prototype,"setAudioMixingVolume",1),E$([PB("default","id")],k$.prototype,"getAudioMixingDuration",1),E$([PB("default","id")],k$.prototype,"getAudioMixingCurrentPosition",1),E$([PB("default","id","position")],k$.prototype,"setAudioMixingPosition",1),E$([PB("default","type")],k$.prototype,"enableAudioMixingBuffer",1),E$([PB()],k$.prototype,"disableAudioMixingBuffer",1),E$([PB("default","buffer")],k$.prototype,"pushAudioMixingBuffer",1);var T$=function(e){return e.NORMAL_USER="normalUser",e.SILENT_USER="silentUser",e}(T$||{}),I$=new LL("RTMClient",1),R$=function(e){f(_,e);var t,r,n,i,a,s,d,v=g(_);function _(e){var t;return c(this,_),h(m(t=v.call(this)),"_dataChannelSignal",null),h(m(t),"_handler",null),h(m(t),"_dataChannelSignalState",rq.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(I$.print("login","invoke login, token: %o, userId: %o",e,t),r._loginSessionId)throw new ZN(JN.ALREADY_LOGIN,"Already logined");if(r._loginResolveCallback)throw new ZN(JN.LOGIN_FAILED,"Is logging in, please try again later.");r._userId=t,r._token=e,CB.setStats({rtc_app_id:r._appId,user_id:t}),r._loginResolveCallback=n,r._loginRejectCallback=i,r._dataChannelSignal?r._login():(I$.print("login","init dataChannelSingling"),r._dataChannelSignalState=rq.CONNECTING,r._createDataChannelSignaling(t).then((function(e){r._dataChannelSignal=e,r._login()})).catch((function(){r._onDisconnect()})))}))}},{key:"logout",value:(d=u(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 ZN(JN.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:yj.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=u(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=u(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 ZN(JN.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:yj.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=u(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 ZN(JN.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=u(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,PP(t,"signature"),PP(r,"url"),this._loginSessionId&&this._userId){e.next=5;break}throw new ZN(JN.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:yj.C2RTM}).catch((function(e){throw new ZN(JN.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=u(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 ZN(JN.NOT_LOGIN,"login first");case 2:return this._checkDataChannelSignal(),e.abrupt("return",this._dataChannelSignal.sendP2PMessage({from:this._userId,app:this._appId,to:"",room:"",type:fj.BUSINESS_SERVER,msg:t}));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"destroy",value:function(){this._clearState(),this._closeDataChannelSignaling(),b(p(_.prototype),"removeAllListeners",this).call(this),delete this._serverParamsCache}},{key:"_login",value:function(){var e=this;if(this._userId){var t=dP();this._checkDataChannelSignal(),this._dataChannelSignal.sendSignaling("login",{Token:pP.token2auth(this._appId,null,this._userId,this._token),timestamp:Date.now(),loginSessionId:t,params:{deviceType:"web",userAgent:window.navigator.userAgent,sdkVersion:JB.VERSION,deviceId:qB.getDeviceId(),appId:this._appId,userId:this._userId}},{functionType:yj.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=JN.INVALID_PARAMS,n="Invalid userId"):(r=JN.INVALID_TOKEN,n="Invalid token",e._wait_login_token=!0,e._loginRejectCallback||e.emit("onRTMTokenError")):(r=JN.LOGIN_FAILED,n="login failed"),"function"==typeof e._loginRejectCallback&&e._loginRejectCallback(new ZN(r,a||n))})).finally((function(){e._loginResolveCallback=null,e._loginRejectCallback=null}))}}},{key:"_createDataChannelSignaling",value:(t=u(o().mark((function e(t){var r,n,i,a,s,u,c,d=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=new kj,i=this._iceConfigNode){e.next=16;break}return e.prev=3,e.next=6,null==n?void 0:n.getAccessNode(this._appId,"",t,qB.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),LB("rtm.login.getNodeFailed","",0,!0),new ZN(JN.ICE_SERVER_WRONG,"get ICE config failed");case 16:return LB("rtm.login.getNodeSuccess",i,0,!0),I$.print("_createDataChannelSignaling()","get node success",i),this._handler=Kz(RB),null===(r=this._handler)||void 0===r||r.once("disconnect",(function(){I$.print("_createDataChannelSignaling()","recv BasicHandler event: disconnect"),d._onDisconnect()})),e.prev=20,e.next=23,null===(u=this._handler)||void 0===u?void 0:u.connect(i);case 23:s=e.sent,I$.print("_createDataChannelSignaling()","establish peerConnection success"),this._dataChannelSignalState=rq.CONNECTED,e.next=33;break;case 28:throw e.prev=28,e.t1=e.catch(20),this._iceConfigNode=null,this._dataChannelSignalState=rq.DISCONNECTED,new ZN(JN.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed",e.t1);case 33:return c=new Sj(s),I$.print("_createDataChannelSignaling()","send ping"),c.sendPingSignaling(),c.once("close",(function(){I$.print("_createDataChannelSignaling()","recv DataChannelSignaling event: close"),d._onDisconnect()})),c.on(sj.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM,(function(e){d.emit("onUserMessageReceivedOutsideRoom",{userId:e.from,message:e.msg})})),c.on(sj.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM,(function(e){d.emit("onUserBinaryMessageReceivedOutsideRoom",{userId:e.from,message:e.msg})})),c.on(sj.USER_DISCONNECTION,(function(){d.emit("onUserDisconnection"),d._clearState()})),c.on(sj.NODE_CHANGE,(function(e){LB("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",c);case 42:case"end":return e.stop()}}),e,this,[[3,12],[20,28]])}))),function(e){return t.apply(this,arguments)})},{key:"_closeDataChannelSignaling",value:function(){var e,t;null===(e=this._dataChannelSignal)||void 0===e||e.destroy(),this._dataChannelSignal=null,null===(t=this._handler)||void 0===t||t.destroy(),this._handler=null}},{key:"_checkDataChannelSignal",value:function(){if(!this._dataChannelSignal||this._dataChannelSignalState!==rq.CONNECTED)throw new ZN(JN.NOT_CONNECTED_YET,"datachannel not connect")}},{key:"_onDisconnect",value:function(){this._dataChannelSignalState=rq.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&&(I$.print("_reconnect()","start reconnect..."),this._isReconnecting=!0,this._createDataChannelSignaling(this._userId).then((function(t){I$.print("_reconnect()","reconnect success!"),e._dataChannelSignal=t,e._login(),e._reconnectTimer=null})).catch((function(t){I$.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)}}]),_}(xL.exports.EventEmitter),A$=function(e){f(a,e);var t,r,n,i=g(a);function a(e){var t;return c(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=u(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._mediaServerClient=new iq({}),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=u(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 ZN(JN.REPEAT_PLAY,"repeat play public media stream");case 2:return(r=new Pz(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=xP(e),i=0;i<t.seiCount;i++)n.emit(Az.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=u(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=R(this.remoteStreams);try{for(n=function(){var e=E(r.value,1)[0];i.remoteStreams.delete(e),i.startPlayPublicStream(e).then((function(){var t=i.remoteStreams.get(e);i.safeEmit(Az.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(cj.ABNORMAL_DISCONNECTION,this._reconnect.bind(this)),null===(t=this._mediaServerClient)||void 0===t||t.on("onRemoteStreamStats",(function(e){r.emit("onRemoteStreamStats",e)}))}}]),a}(VL),w$=new LL("AudioDeviceManager",1),C$=function(e){f(a,e);var t,r,n,i=g(a);function a(e){var t;return c(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),t._extensionManager=e,t}return l(a,[{key:"startAudioPlaybackDeviceTest",value:(n=u(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 ZN(JN.REPEAT_DEVICE_TEST,"device test cannot be called repeatedly at the same time.");case 2:return this._isAudioPlaybackDeviceTesting=!0,w$.print("startAudioPlaybackDeviceTest()","Invoke"),e.prev=4,e.next=7,this._playAudioFile(t,{loop:!0});case 7:e.next=13;break;case 9:throw e.prev=9,e.t0=e.catch(4),this.stopAudioPlaybackDeviceTest(),e.t0;case 13:this._startEmitAudioPlaybackDeviceTestVolume(r);case 14:case"end":return e.stop()}}),e,this,[[4,9]])}))),function(e,t){return n.apply(this,arguments)})},{key:"stopAudioPlaybackDeviceTest",value:function(){this._isAudioPlaybackDeviceTesting&&(w$.print("stopAudioPlaybackDeviceTest()","Invoke"),this._isAudioPlaybackDeviceTesting=!1,this._stopEmitAudioPlaybackDeviceTestVolume(),this._destroyAudioElement())}},{key:"startAudioDeviceRecordTest",value:(r=u(o().mark((function e(t){var r=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._isAudioDeviceRecordTesting){e.next=2;break}throw new ZN(JN.REPEAT_DEVICE_TEST,"device test cannot be called repeatedly at the same time.");case 2:return this._isAudioDeviceRecordTesting=!0,w$.print("startAudioDeviceRecordTest()","Invoke"),this._recoderTimer=window.setTimeout((function(){w$.print("startAudioDeviceRecordTest()","".concat(3e4,'ms automatic call method "stopAudioDeviceRecordAndPlayTest"')),r._stopAudioCaptureAndRecoder()}),3e4),e.next=7,this._startAudioCaptureAndRecoder(t);case 7:delete this._audioCaptureAndRecoderResolve;case 8:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"stopAudioDeviceRecordAndPlayTest",value:function(){w$.print("stopAudioDeviceRecordAndPlayTest()","Invoke"),void 0!==this._recoderTimer&&(clearTimeout(this._recoderTimer),delete this._recoderTimer),this._stopAudioCaptureAndRecoder()}},{key:"stopAudioDevicePlayTest",value:function(){this._isAudioDeviceRecordTesting&&(w$.print("stopAudioDevicePlayTest()","Invoke"),this._isAudioDeviceRecordTesting=!1,this.stopAudioDeviceRecordAndPlayTest(),this._stopEmitAudioPlaybackDeviceTestVolume(),this._destroyAudioElement())}},{key:"getRecordTrack",value:function(){return this._audioTrack}},{key:"destroy",value:function(){w$.print("destroy()","Invoke"),b(p(a.prototype),"removeAllListeners",this).call(this),this.stopAudioPlaybackDeviceTest(),this.stopAudioDevicePlayTest()}},{key:"_playAudioFile",value:function(e,t){var r=this;return new Promise((function(n,i){r._audioElement=gW("audio",{attributes:{src:e,crossOrigin:"",autoplay:"true"}}),r._audioElement.loop=t.loop,w$.print("_playAudioFile()","url=".concat(e,";loop=").concat(t.loop)),r._audioElement.oncanplay=function(){w$.print("_playAudioFile()","oncanplay"),n()},r._audioElement.onerror=function(e){var t,n;i(new ZN(JN.LOAD_RESOURCES_FAILED,"audio error: ".concat(e.message||(null===(t=r._audioElement)||void 0===t||null===(n=t.error)||void 0===n?void 0:n.message))))}}))}},{key:"_destroyAudioElement",value:function(){this._audioElement&&(w$.print("_destroyAudioElement()","Invoke"),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&&(w$.print("_startEmitAudioPlaybackDeviceTestVolume()","start timer(".concat(e,"ms)")),this._audioLevelFetcher=new IH(this._audioElement),this._playbackDeviceTestTimer=self.setInterval((function(){t._audioLevelFetcher&&t.emit("onAudioPlaybackDeviceTestVolume",t._audioLevelFetcher.getAudioLevel())}),e))}},{key:"_stopEmitAudioPlaybackDeviceTestVolume",value:function(){var e;void 0!==this._playbackDeviceTestTimer&&(w$.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=u(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,ZH({},this._extensionManager);case 2:return this._audioTrack=e.sent,i=this._audioTrack.getTrack("preprocessing"),r=OH.get(i),w$.print("startAudioDeviceRecordTest()","create microphone track success!"),e.abrupt("return",new Promise((function(e,i){n._mediaRecorder=new MediaRecorder(r),n._mediaRecorder.ondataavailable=function(){var r=u(o().mark((function r(a){var s,u;return o().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!n._isAudioDeviceRecordTesting){r.next=16;break}return w$.print("startAudioDeviceRecordTest()","get recorded file."),u=new Blob([a.data]),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===(s=n._audioElement)||void 0===s||s.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 ZN(JN.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}(xL.exports.EventEmitter),O$=function(){function e(){c(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=u(o().mark((function e(){var t;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=new Tj,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 Q.fluent:r=16e3,t=24e3;break;case Q.standard:r=48e3,t=48e3;break;case Q.hd:r=48e3,t=128e3,n=2;break;case Q.standardStereo:r=48e3,t=8e4,n=2;break;case Q.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 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.playChannel&&t.playChannel>1&&(e+="stereo=1;"),e.slice(0,-1)}},{key:"config",get:function(){var e,t,r,n,i,o,a,s,u,c,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===(u=s.record)||void 0===u?void 0:u.chn),aec:this.aec,agc:this.agc,ans:this.ans,encSampleRate:this.sampleRate||(null===(c=this.engineBAC.codec)||void 0===c?void 0:c.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}(),x$=new LL("VideoSnapshot",1),N$=function(e){var t=null==e?void 0:e.domElement;if(t&&!t.paused&&4===t.readyState)return t},D$=function(){var e=u(o().mark((function e(t,r,n){var i,a,s,u,c,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)},u=Date.now(),!(c=N$(n))){e.next=16;break}return x$.print("takeSnapshot","VideoPlayer already set."),e.next=11,s(c,c.videoWidth,c.videoHeight);case 11:return d=e.sent,x$.print("takeSnapshot","success, cost ".concat(Date.now()-u,"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 x$.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,x$.print("takeSnapshot","success, cost ".concat(Date.now()-u,"ms")),e.abrupt("return",h);case 29:return x$.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);x$.print("takeSnapshot","success, cost ".concat(Date.now()-u,"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)}}(),P$=new WeakMap,M$=function(e,t,r){var n;if(requestAnimationFrame){var i=P$.get(e);null!==(n=i)&&void 0!==n&&n[t]?L$(e,t):i||(i={},P$.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))}()}},L$=function(e,t){var r=P$.get(e);t&&r[t]?cancelAnimationFrame(r[t]):Object.keys(r).length&&Object.keys(r).forEach((function(e){cancelAnimationFrame(r[e])}))},U$=Object.defineProperty,V$=Object.getOwnPropertyDescriptor,F$=function(e,t,r,n){for(var i,o=n>1?void 0:n?V$(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&&U$(t,r,o),o},B$=new LL("Engine",0),j$=function(e){f(Fe,e);var t,r,n,a,s,d,v,_,y,S,k,T,I,R,A,O,x,N,M,L,G,H,z,q,W,Y,Q,$,ee,re,ne,oe,ae,se,ue,ce,de,le,he,fe,pe,ve,_e,me,ye,ge,Se,be,Ee,ke,Te,Ie,Re,Ae,we,Ce,Oe,xe,Ne,De,Pe,Me,Le,Ue,Ve=g(Fe);function Fe(e,t){var r;return c(this,Fe),h(m(r=Ve.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),"_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",{}),h(m(r),"_audioStreamConstraints",{}),h(m(r),"_enableSimulcast",!1),h(m(r),"_videoStreamEncodeConfig",[nj]),h(m(r),"_screenStreamEncodeConfig",[ij]),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:!1,video:!1}),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",j.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),"_tempRoomConfig",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 wH),h(m(r),"_audioDeviceManager",new C$(r._extensionManager)),h(m(r),"_audioProfileManager",new O$),h(m(r),"_remoteVideoConfig",new Map),h(m(r),"_userPriorityMap",new Map),h(m(r),"_subscribeFallbackOption",K.DISABLE),h(m(r),"_cameraCapturing",!1),h(m(r),"_interruptCameraCapture",!1),h(m(r),"_micCapturing",!1),h(m(r),"_interruptMicCapture",!1),h(m(r),"_config",void 0),h(m(r),"_updateMixAudioTrack",function(){var e=u(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]:te.PLAYOUT_AND_PUBLISH,B$.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(ie.onAudioMixingStateChanged,e)})),h(m(r),"_onAudioMixingAutoplayFailed",(function(){r.safeEmit(ie.onAutoplayFailed,{})})),r._appId=e,r._pubLock=new Yz("pubLock"),r._addDeviceEventHandler(),r._audioMixingManager=new k$({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:w.VIDEO_SOURCE_TYPE_INTERNAL,screenVideo:w.VIDEO_SOURCE_TYPE_INTERNAL,audio:C.AUDIO_SOURCE_TYPE_INTERNAL,screenAudio:C.AUDIO_SOURCE_TYPE_INTERNAL},r._config=t,r._rtmClient=new R$(e),r._handleRTMClient(r._rtmClient),r._useCloudProxy=!1,r._handleAudioDeviceManager(),r._messageStatisticsObserver=new wW,r._extensionManager.setMinotor(IB),r}return l(Fe,[{key:"appId",get:function(){return this._appId},set:function(e){this._appId=e}},{key:"updateToken",value:(Ue=u(o().mark((function e(t){var r,n,i,a,s,u,c;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(B$.print("updateToken()","token: %s",t),PP(t,"token"),!(this.waitForNewToken&&null!==(r=this._room)&&void 0!==r&&r._roomInfo&&this._tempRoomConfig)){e.next=9;break}return a=null===(i=this._room)||void 0===i?void 0:i._roomInfo,s=a.roomId,u=a.userInfo,c=this._tempRoomConfig,delete this._tempRoomConfig,e.next=8,this.joinRoom(t,s,u,c);case 8:return e.abrupt("return",e.sent);case 9:if(this._room){e.next=11;break}throw new ZN(JN.UPDATE_TOKEN_BEFORE_JOIN,"update token before join room");case 11:return e.next=13,null===(n=this._room)||void 0===n?void 0:n.updateToken(t);case 13:case"end":return e.stop()}}),e,this)}))),function(e){return Ue.apply(this,arguments)})},{key:"setVideoCaptureDevice",value:(Le=u(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(B$.print("setVideoCaptureDevice()","deviceId: %s",t),PP(t,"deviceId"),this._localVideoDeviceId=t,this._localVideoTrack){e.next=5;break}return e.abrupt("return");case 5:return a=this._videoStreamConstraints,"user"===t||"environment"===t||"left"===t||"right"===t?(delete a.deviceId,a.facingMode=t):a.deviceId={exact:t},this._videoStreamConstraints=a,e.next=10,JH(a,this._extensionManager);case 10:if(s=e.sent,this._initLocalTrackEvents(s),this._localVideoTrack.close(),this._localVideoTrack=s,null!==(r=this._videoPlayer)&&void 0!==r&&r.played&&(this._videoPlayer.stop(),this._videoPlayer.playVideo(s),this._videoPlayer.mirror(!!this._mirrorType)),this._room){e.next=17;break}return e.abrupt("return");case 17:if(null===(n=this._room)||void 0===n||null===(i=n.localStream)||void 0===i||!i.pubVideo){e.next=20;break}return e.next=20,this._updatePublish();case 20:case"end":return e.stop()}}),e,this)}))),function(e){return Le.apply(this,arguments)})},{key:"setAudioCaptureDevice",value:(Me=u(o().mark((function e(t){var r,n,i,a;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(B$.print("setAudioCaptureDevice()","deviceId: %s",t),PP(t,"deviceId"),this._localAudioDeviceId=t,this._localAudioTrack){e.next=5;break}return e.abrupt("return");case 5:return(i=this._audioStreamConstraints).deviceId={exact:t},this._audioStreamConstraints=i,this._localAudioTrack.close(),e.next=11,ZH(i,this._extensionManager,this._audioProfileManager);case 11:if(a=e.sent,this._initLocalTrackEvents(a),this._localAudioTrack=a,this._room){e.next=16;break}return e.abrupt("return");case 16:if(null===(r=this._room)||void 0===r||null===(n=r.localStream)||void 0===n||!n.pubAudio){e.next=19;break}return e.next=19,this._updatePublish();case 19:case"end":return e.stop()}}),e,this)}))),function(e){return Me.apply(this,arguments)})},{key:"_addDeviceEventHandler",value:function(){kH.on(ie.onVideoDeviceStateChanged,this._onVideoDeviceStateChange.bind(this)),kH.on(ie.onAudioDeviceStateChanged,this._onAudioDeviceStateChange.bind(this))}},{key:"_addHandlerEventHandler",value:function(){var e,t,r,n,i,o,a,s,u,c,d,l,h,f,p,v,_,m,y,g,S,b,E,k,T,I,R,A,w,C=this;null===(e=this._room)||void 0===e||e.on(sj.ON_ADD_STREAM,this._onAddStream.bind(this)),null===(t=this._room)||void 0===t||t.on(sj.ON_REMOVE_STREAM,this._onRemoveStream.bind(this)),null===(r=this._room)||void 0===r||r.on(sj.USER_CONNECTION,this._onUserConnection.bind(this)),null===(n=this._room)||void 0===n||n.on(Az.ON_USER_LEAVE,this._onUserLeave.bind(this)),null===(i=this._room)||void 0===i||i.on(Az.ON_ROOM_ERROR,this._onRoomError.bind(this)),null===(o=this._room)||void 0===o||o.on(Az.ON_NETWORK_QUALITY,this._onNetworkQuality.bind(this)),null===(a=this._room)||void 0===a||a.on(sj.ON_CUSTOM_MESSAGE,this._onCustomMessage.bind(this)),null===(s=this._room)||void 0===s||s.on(sj.USER_MESSAGE_RECEIVED,this._onUserMessageReceived.bind(this)),null===(u=this._room)||void 0===u||u.on(sj.USER_BINARY_MESSAGE_RECEIVED,this._onUserBinaryMessageReceived.bind(this)),null===(c=this._room)||void 0===c||c.on(sj.ON_USER_TOKEN_WILL_EXPIRE,this._onUserTokenWillExpire.bind(this)),null===(d=this._room)||void 0===d||d.on(sj.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(cj.ON_CONNECTION_STATE_CHANGE,this._onConnectionStateChange.bind(this)),null===(h=this._room)||void 0===h||h.on(Az.RESUBSCRIBE,this._onResubscribe.bind(this)),null===(f=this._room)||void 0===f||f.on(Az.SUBSCRIBE_PUSH_TRACK,this._onSubscribePushTrack.bind(this)),null===(p=this._room)||void 0===p||p.on(Az.REMOVE_PUSH_TRACK,this._onRemovePushTrack.bind(this)),null===(v=this._room)||void 0===v||v.on(Az.ON_PUBLISH_RESULT,(function(e){var t;null!==(t=C._room)&&void 0!==t&&t._roomConfig.isAutoPublish&&C.safeEmit(ie.onAutoPublishResult,e)})),null===(_=this._room)||void 0===_||_.on(Az.ON_REMOTE_STREAM_STATS,(function(e){C.safeEmit(ie.onRemoteStreamStats,e)})),null===(m=this._room)||void 0===m||m.on(Az.ON_LOCAL_STREAM_STATS,(function(e){C.safeEmit(ie.onLocalStreamStats,e)})),null===(y=this._room)||void 0===y||y.on(Az.ON_USER_PUBLISH_STATE_CHANGE,this._onUserPublishStateChange.bind(this)),null===(g=this._room)||void 0===g||g.on(Az.ON_USER_START_AUDIO_CAPTURE,(function(e,t){var r=e.userId;C._updateAudioPlayerState(t),C.safeEmit(ie.onUserStartAudioCapture,{userId:r})})),null===(S=this._room)||void 0===S||S.on(Az.ON_USER_STOP_AUDIO_CAPTURE,(function(e){var t=e.userId;C.safeEmit(ie.onUserStopAudioCapture,{userId:t})})),null===(b=this._room)||void 0===b||b.on(Az.ON_USER_START_VIDEO_CAPTURE,(function(e){var t=e.userId;C.safeEmit(ie.onUserStartVideoCapture,{userId:t})})),null===(E=this._room)||void 0===E||E.on(Az.ON_USER_STOP_VIDEO_CAPTURE,(function(e){var t=e.userId;C.safeEmit(ie.onUserStopVideoCapture,{userId:t})})),null===(k=this._room)||void 0===k||k.on(Az.ON_SEI_MESSAGED_RECEIVED,(function(e){C.safeEmit(ie.onSEIMessageReceived,e)})),null===(T=this._room)||void 0===T||T.on(Az.ON_REMOTE_VIDEO_SIZE_CHANGED,(function(e,t){C.safeEmit(ie.onRemoteVideoSizeChanged,e,t)})),null===(I=this._room)||void 0===I||I.on(Az.ON_SIMULCAST_SUBSCRIBE_FALLBACK,(function(e){return C.safeEmit(ie.onSimulcastSubscribeFallback,e)})),null===(R=this._room)||void 0===R||R.on(Az.RECONNECT_FAILED,(function(){C.safeEmit(ie.onError,{errorCode:JN.RECONNECT_FAILED})})),null===(A=this._room)||void 0===A||A.on(Az.ON_VIDEO_STREAM_BANNED,(function(e){C.safeEmit(ie.onVideoStreamBanned,{uid:e.uid,banned:e.banned})})),null===(w=this._room)||void 0===w||w.on(Az.ON_AUDIO_STREAM_BANNED,(function(e){C.safeEmit(ie.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 YP(e)&&MB(e,TP(n)),(t=b(p(Fe.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:(Pe=u(o().mark((function e(t,r,n,a){var s,u,c,d;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(B$.print("joinRoom()","token: %o roomId: %o, userInfo: %o, roomConfig: %o",t,r,n,a),jP(t)||PP(t,"token"),GP(r),qP(n),s={isAutoPublish:!0,isAutoSubscribeAudio:!0,isAutoSubscribeVideo:!0,roomProfileType:J.communication},QY(s,a),KP(s),!this._room||this._room.connectionState===rq.DISCONNECTED){e.next=11;break}throw new ZN(JN.REPEAT_JOIN,"Already joined");case 11:return this._room=new mW(a,{audioProfileManager:this._audioProfileManager,streamRTT:{}}),this._room.userPriorityMap=this._userPriorityMap,this._room.subscribeFallbackOption=this._subscribeFallbackOption,this._addHandlerEventHandler(),u=this._liveTranscodeConfig&&$B("started",this._liveTranscodeConfig),e.prev=16,this._useCloudProxy&&(this._startCloudProxyTimestamp=Date.now()),e.next=20,this._room.join(this._appId,r,t,i(i({},n),{},{businessId:this._businessId,role:this._visibility?T$.NORMAL_USER:T$.SILENT_USER}),u,this._useCloudProxy,null===(c=this._config)||void 0===c?void 0:c.expectedIDC);case 20:return d=e.sent,this._roomConfig=a,this._tempRoomConfig&&delete this._tempRoomConfig,null!=a&&a.isAutoPublish&&(this._visibility?this._updatePublish({invokeByJoinRoom:!0,mediaType:V.AUDIO_AND_VIDEO}):this.safeEmit(ie.onAutoPublishResult,{isScreen:!1,state:P.PUBLISH_FAIL})),e.abrupt("return",d);case 27:throw e.prev=27,e.t0=e.catch(16),e.t0.code===JN.INVALID_TOKEN&&(this._tempRoomConfig=a),e.t0;case 31:case"end":return e.stop()}}),e,this,[[16,27]])}))),function(e,t,r,n){return Pe.apply(this,arguments)})},{key:"leaveRoom",value:(De=u(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],B$.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._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 19:case"end":return e.stop()}}),e,this)}))),function(){return De.apply(this,arguments)})},{key:"destroy",value:function(){var e,t,r;B$.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=[nj],this._screenStreamEncodeConfig=[ij],this._pauseAllSubscribeState={audio:!1,video:!1},this._messageStatisticsObserver.destroy(),clearInterval(this._audioVolumeIndicationTimer),clearInterval(this._dummyMainTimer),clearInterval(this._dummyScreenTimer),this._audioVolumeIndicationTimer=void 0,this._stopAudioPropertiesReport(),this._localAudioTrack&&(this._localAudioTrack.close(),this._localAudioTrack=void 0),this._localVideoTrack&&(this._localVideoTrack.close(),this._localVideoTrack=void 0),this._localScreenAudioTrack&&(this._localScreenAudioTrack.close(),this._localScreenAudioTrack=void 0),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._remoteScreenPlayer.forEach((function(e){return e.destroy()})),this._remoteScreenPlayer=new Map,this._remoteVideoPlayer.forEach((function(e){return e.destroy()})),this._remoteVideoPlayer=new Map,this._publicStreamAudioPlayer.forEach((function(e){return e.destroy()})),this._publicStreamAudioPlayer=new Map,this._publicStreamVideoPlayer.forEach((function(e){return e.destroy()})),this._publicStreamVideoPlayer=new Map,this._roomConfig=void 0,this._audioMixingManager.destroy(),this._rtmClient.destroy(),null===(r=this._outsideRoom)||void 0===r||r.destroy(),this._publicStreamIds=new Map,this._audioDeviceManager.destroy(),this._remoteVideoConfig=new Map,this._userPriorityMap.clear(),this._extensionManager.destroy(),this._cameraCapturing=!1,this._micCapturing=!1,this._interruptCameraCapture=!1,this._interruptMicCapture=!1}},{key:"publishStream",value:(Ne=u(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(B$.print("publishStream()","mediaType: %o",t),this._checkMediaType(t),this._assertNotInRoom(),!CP(t)||this._localVideoTrack||!this._localImgVideoTrack){e.next=7;break}return e.next=6,KH(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 Ne.apply(this,arguments)})},{key:"unpublishStream",value:(xe=u(o().mark((function e(t,r){var n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(B$.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:Cz.UNPUB});case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return xe.apply(this,arguments)})},{key:"publishScreen",value:(Oe=u(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(B$.print("publishScreen()","mediaType: %o",t),this._checkMediaType(t),this._assertNotInRoom(),e.prev=3,!CP(t)||this._localScreenVideoTrack||!this._localImgScreenTrack){e.next=8;break}return e.next=7,WH(this._localImgScreenTrack,this._extensionManager);case 7:this._localScreenVideoTrack=e.sent;case 8:return e.next=10,this._updateScreenPublish({mediaType:t,pubState:Cz.PUB});case 10:e.next=19;break;case 12:if(e.prev=12,e.t0=e.catch(3),!(e.t0 instanceof ZN)){e.next=18;break}throw e.t0;case 18:throw new ZN(JN.UNEXPECTED_ERROR,"unexpected error",e.t0);case 19:case"end":return e.stop()}}),e,this,[[3,12]])}))),function(e){return Oe.apply(this,arguments)})},{key:"unpublishScreen",value:(Ce=u(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return B$.print("unpublishScreen()","mediaType: %o",t),this._checkMediaType(t),this._assertNotInRoom(),e.next=5,this._updateScreenPublish({mediaType:t,pubState:Cz.UNPUB});case 5:case"end":return e.stop()}}),e,this)}))),function(e){return Ce.apply(this,arguments)})},{key:"subscribeStream",value:(we=u(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return B$.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 we.apply(this,arguments)})},{key:"_subscribe",value:(Ae=u(o().mark((function e(t,r,n){var i,a,s,u,c,d,l,h,f,p;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._checkMediaType(n),this._assertNotInRoom(),u=this._room.remoteStreams.get(r),c=null==u?void 0:u.find((function(e){return e.isScreen===t}))){e.next=6;break}throw new ZN(JN.STREAM_NOT_EXIST,"stream not exist");case 6:return this._pauseAllSubscribeState.audio&&(n-=n&V.AUDIO),this._pauseAllSubscribeState.video&&(n-=n&V.VIDEO),B$.print("subscribeStream()","due to pauseAll mediaType: %o",n),d=c.hasSubscribed,l=this._remoteVideoConfig.get(r)||(null===(i=this._roomConfig)||void 0===i?void 0:i.remoteVideoConfig),c.originalMediaType=n,e.next=14,this._room.subscribe(c,n,l);case 14:wP(n)&&this._updateAudioPlayerState(c),CP(n)&&this._updateVideoPlayerState(c),!t&&(null!==(a=this._roomConfig)&&void 0!==a&&a.isAutoSubscribeAudio||null!==(s=this._roomConfig)&&void 0!==s&&s.isAutoSubscribeVideo)&&(c.audioTrack||c.videoTrack)&&(h={userId:r,isScreen:!1,state:D.SUBSCRIBE_SUCC},this.safeEmit(ie.onAutoSubscribeResult,h)),!d&&wP(n)&&c.hasAudio&&(null===(f=c.observer)||void 0===f||f.setSubscribeAudio(!0)),!d&&CP(n)&&c.hasVideo&&(null===(p=c.observer)||void 0===p||p.setSubscribeVideo(!0));case 19:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return Ae.apply(this,arguments)})},{key:"unsubscribeStream",value:(Re=u(o().mark((function e(t,r){var n,i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(B$.print("unsubscribeStream()","userId: %o, mediaType: %o",t,r),this._checkMediaType(r),this._assertNotInRoom(),n=this._room.remoteStreams.get(t),null!=(i=null==n?void 0:n.find((function(e){return!e.isScreen})))&&i.hasSubscribed){e.next=7;break}throw new ZN(JN.STREAM_NOT_EXIST,"stream not exist");case 7:this._room.unsubscribe(i,r);case 8:case"end":return e.stop()}}),e,this)}))),function(e,t){return Re.apply(this,arguments)})},{key:"subscribeScreen",value:(Ie=u(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return B$.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 Ie.apply(this,arguments)})},{key:"unsubscribeScreen",value:(Te=u(o().mark((function e(t,r){var n,i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(B$.print("unsubscribeScreen() userId: %o, mediaType: %o",t,r),this._checkMediaType(r),this._assertNotInRoom(),n=this._room.remoteStreams.get(t),null!=(i=null==n?void 0:n.find((function(e){return e.isScreen})))&&i.hasSubscribed){e.next=7;break}throw new ZN(JN.STREAM_NOT_EXIST,"stream not exist");case 7:this._room.unsubscribe(i,r);case 8:case"end":return e.stop()}}),e,this)}))),function(e,t){return Te.apply(this,arguments)})},{key:"setRemoteVideoConfig",value:(ke=u(o().mark((function e(t,r){var n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return B$.print("setRemoteVideoConfig() userId: %o, remoteVideoConfig: %o",t,r),HP(t),JP(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 ke.apply(this,arguments)})},{key:"startVideoCapture",value:(Ee=u(o().mark((function e(t){var r,n,i,a,s,u,c,d,l,h,f,p=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(B$.print("startVideoCapture()","deviceId: %s",t),jP(t)||PP(t,"deviceId"),t=t||this._localVideoDeviceId,this._localVideoDeviceId=t,!(this._cameraCapturing||this._localVideoTrack&&!this._localVideoTrack.dummy)){e.next=6;break}throw new ZN(JN.REPEAT_CAPTURE,"Has already capture");case 6:return s=this._videoStreamConstraints,t&&("user"===t||"environment"===t||"left"===t||"right"===t?s.facingMode=t:s.deviceId={exact:t},this._videoStreamConstraints=s),u={},e.prev=9,this._cameraCapturing=!0,e.next=13,JH(s,this._extensionManager);case 13:if(d=e.sent,!this._interruptCameraCapture){e.next=18;break}throw this._interruptCameraCapture=!1,d.close(),new ZN(JN.INTERRUPT,"interrupt by stopVideoCapture");case 18:this._initLocalTrackEvents(d),this._localVideoTrack=d,null===(c=this._videoPlayer)||void 0===c||c.playVideo(d),(l=null==d?void 0:d.getTrack())&&(u=l.getSettings(),h={width:u.width,height:u.height},this._localVideoTrack.resolution=h,setTimeout((function(){return p.safeEmit(ie.onLocalVideoSizeChanged,{streamIndex:U.STREAM_INDEX_MAIN,info:h})})));case 23:return e.prev=23,this._cameraCapturing=!1,e.finish(23);case 26:if(this._room){e.next=28;break}return e.abrupt("return",u);case 28:return f=this._room._roomConfig.isAutoPublish,(null!==(r=this._room)&&void 0!==r&&null!==(n=r.localStream)&&void 0!==n&&n.pubVideo||f)&&(this._visibility?this._updatePublish():this.safeEmit(ie.onAutoPublishResult,{isScreen:!1,state:P.PUBLISH_FAIL})),null===(i=this._room.localStream)||void 0===i||null===(a=i.observer)||void 0===a||a.setEnableVideo(!0),e.abrupt("return",u);case 32:case"end":return e.stop()}}),e,this,[[9,,23,26]])}))),function(e){return Ee.apply(this,arguments)})},{key:"stopVideoCapture",value:(be=u(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(B$.print("stopVideoCapture()"),!this._cameraCapturing){e.next=5;break}return this._interruptCameraCapture=!0,B$.print("stopVideoCapture()","capturing"),e.abrupt("return");case 5:if(this._trackSourceType.video!==w.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=7;break}throw new ZN(JN.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._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||null===(n=r.localStream)||void 0===n||!n.pubVideo){e.next=14;break}return e.next=14,this._updatePublish();case 14:null===(i=this._room.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 be.apply(this,arguments)})},{key:"startAudioCapture",value:(Se=u(o().mark((function e(t){var r,n,i,a,s,u,c;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(B$.print("startAudioCapture()","deviceId: $o",t),jP(t)||PP(t,"deviceId"),t=t||this._localAudioDeviceId,this._localAudioDeviceId=t,!this._micCapturing&&!this._localAudioTrack){e.next=6;break}throw new ZN(JN.REPEAT_CAPTURE,"Has already capture");case 6:return s=this._audioStreamConstraints,t&&(s.deviceId={exact:t},this._audioStreamConstraints=s),e.prev=8,this._micCapturing=!0,e.next=12,ZH(s,this._extensionManager,this._audioProfileManager);case 12:if(u=e.sent,!this._interruptMicCapture){e.next=17;break}throw this._interruptMicCapture=!1,u.close(),new ZN(JN.INTERRUPT,"interrupt by stopAudioCapture");case 17:this._initLocalTrackEvents(u),this._localAudioTrack=u,this._tempMixingAudioTrack&&(this._localAudioTrack.mixType=this._tempMixingAudioTrack.type,this._localAudioTrack.mixedAudioTrack=this._tempMixingAudioTrack.track,delete this._tempMixingAudioTrack);case 20:return e.prev=20,this._micCapturing=!1,e.finish(20);case 23:if(this._room){e.next=25;break}return e.abrupt("return");case 25:c=this._room._roomConfig.isAutoPublish,(null!==(r=this._room)&&void 0!==r&&null!==(n=r.localStream)&&void 0!==n&&n.pubAudio||c)&&(this._visibility?this._updatePublish():this.safeEmit(ie.onAutoPublishResult,{isScreen:!1,state:P.PUBLISH_FAIL})),null===(i=this._room.localStream)||void 0===i||null===(a=i.observer)||void 0===a||a.setEnableAudio(!0);case 28:case"end":return e.stop()}}),e,this,[[8,,20,23]])}))),function(e){return Se.apply(this,arguments)})},{key:"stopAudioCapture",value:(ge=u(o().mark((function e(){var t,r,n,i,a;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(B$.print("stopAudioCapture()"),!this._micCapturing){e.next=5;break}return this._interruptMicCapture=!0,B$.print("stopAudioCapture()","capturing"),e.abrupt("return");case 5:if(null===(t=this._localAudioTrack)||void 0===t||t.close(),this._localAudioTrack=void 0,this._audioMixingManager.stopAll(),this._trackSourceType.audio!==C.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=10;break}throw new ZN(JN.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");case 10:if(this._room){e.next=12;break}return e.abrupt("return");case 12:if(null===(r=this._room)||void 0===r||null===(n=r.localStream)||void 0===n||!n.pubAudio){e.next=15;break}return e.next=15,this._updatePublish();case 15:null===(i=this._room.localStream)||void 0===i||null===(a=i.observer)||void 0===a||a.setEnableAudio(!1);case 16:case"end":return e.stop()}}),e,this)}))),function(){return ge.apply(this,arguments)})},{key:"getAudioMixingManager",value:function(){return B$.print("getAudioMixingManager()"),this._audioMixingManager}},{key:"startScreenCapture",value:(ye=u(o().mark((function e(){var t,r,n,i,a,s,u,c,d,l,h,f,p,v,_,m,y,g,S=this,b=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c=b.length>0&&void 0!==b[0]?b[0]:{},B$.print("startScreenCapture()","config: %o",c),d=c.enableAudio,l=void 0!==d&&d,this._trackSourceType.screenVideo!==w.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=5;break}throw new ZN(JN.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as internal first");case 5:if(this._trackSourceType.screenAudio!==C.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=7;break}throw new ZN(JN.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");case 7:return e.next=9,ez(l,this._extensionManager,this._screenStreamEncodeConfig[0]);case 9:if(h=e.sent,f=E(h,2),p=f[0],v=f[1],this._localScreenVideoTrack&&!this._localScreenVideoTrack.dummy&&this._localScreenVideoTrack.close(),null===(t=this._localScreenAudioTrack)||void 0===t||t.close(),this._localScreenVideoTrack=p,null!==(r=this._screenStreamEncodeConfig[0])&&void 0!==r&&r.contentHint&&p.setContentHint(null===(_=this._screenStreamEncodeConfig[0])||void 0===_?void 0:_.contentHint),(m=null==p?void 0:p.getTrack())&&(y=m.getSettings(),g={width:y.width,height:y.height},p.resolution=g,setTimeout((function(){return S.safeEmit(ie.onLocalVideoSizeChanged,{streamIndex:U.STREAM_INDEX_SCREEN,info:{width:y.width,height:y.height}})}))),v&&(this._localScreenAudioTrack=v,this._initLocalTrackEvents(v)),null===(n=this._screenPlayer)||void 0===n||n.playVideo(this._localScreenVideoTrack),this._initLocalTrackEvents(this._localScreenVideoTrack,!0),!(null!==(i=this._room)&&void 0!==i&&null!==(a=i.localScreenStream)&&void 0!==a&&a.pubAudio||null!==(s=this._room)&&void 0!==s&&null!==(u=s.localScreenStream)&&void 0!==u&&u.pubVideo)){e.next=25;break}return e.next=25,this._updateScreenPublish();case 25:case"end":return e.stop()}}),e,this)}))),function(){return ye.apply(this,arguments)})},{key:"stopScreenCapture",value:(me=u(o().mark((function e(){var t,r,n,i,a,s,u;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(B$.print("stopScreenCapture()"),null===(t=this._screenPlayer)||void 0===t||t.stop(),this._localScreenVideoTrack&&(this._localScreenVideoTrack.dummy||(this._localScreenVideoTrack.close(),this._localImgScreenTrack&&(null===(u=this._localScreenVideoTrack)||void 0===u||u.setTrack(this._localImgScreenTrack,this._extensionManager),this._localScreenVideoTrack.dummy=!0))),null===(r=this._localScreenAudioTrack)||void 0===r||r.close(),this._localScreenAudioTrack=void 0,!(null!==(n=this._room)&&void 0!==n&&null!==(i=n.localScreenStream)&&void 0!==i&&i.pubAudio||null!==(a=this._room)&&void 0!==a&&null!==(s=a.localScreenStream)&&void 0!==s&&s.pubVideo)){e.next=8;break}return e.next=8,this._updateScreenPublish();case 8:case"end":return e.stop()}}),e,this)}))),function(){return me.apply(this,arguments)})},{key:"setLocalVideoPlayer",value:function(e,t){if(B$.print("setLocalVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",e,t),MP(e,"streamIndex",[U.STREAM_INDEX_MAIN,U.STREAM_INDEX_SCREEN]),t&&t.renderDom){var r,n,o=i(i({userId:this._getUserId()},t),{},{isLocal:!0});if(XP(o),e===U.STREAM_INDEX_MAIN&&!this._videoPlayer)return this._videoPlayer=new RW(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)!==Z.PLAY_MANUALLY&&this._videoPlayer.playVideo(this._localVideoTrack),this._videoPlayer.domElement;if(e===U.STREAM_INDEX_SCREEN&&!this._screenPlayer)return this._screenPlayer=new RW(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)!==Z.PLAY_MANUALLY&&this._screenPlayer.playVideo(this._localScreenVideoTrack),this._screenPlayer.domElement}else{var a,s;e===U.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:(_e=u(o().mark((function e(t){var r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return B$.print("startLiveTranscoding()","transcode: %o",t),PP(t.url,"liveTranscode.url"),this._liveTranscodeConfig=t,e.prev=3,this.safeEmit(ie.onStreamMixingEvent,{event:wz.START,error:0,message:""}),e.next=7,null===(r=this._room)||void 0===r?void 0:r.liveControlMessage($B("started",this._liveTranscodeConfig));case 7:e.next=16;break;case 9:if(e.prev=9,e.t0=e.catch(3),!(e.t0 instanceof ZN)){e.next=15;break}throw e.t0;case 15:throw new ZN(JN.UNEXPECTED_ERROR,"unexpected error",e.t0);case 16:case"end":return e.stop()}}),e,this,[[3,9]])}))),function(e){return _e.apply(this,arguments)})},{key:"updateLiveTranscoding",value:(ve=u(o().mark((function e(t){var r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(B$.print("updateLiveTranscoding()","transcode: %o",t),this._liveTranscodeConfig){e.next=3;break}return e.abrupt("return");case 3:return this._liveTranscodeConfig=QY(this._liveTranscodeConfig,t),e.prev=4,this.safeEmit(ie.onStreamMixingEvent,{event:wz.UPDATE,error:0,message:""}),e.next=8,null===(r=this._room)||void 0===r?void 0:r.liveControlMessage($B("layoutChanged",this._liveTranscodeConfig));case 8:e.next=17;break;case 10:if(e.prev=10,e.t0=e.catch(4),!(e.t0 instanceof ZN)){e.next=16;break}throw e.t0;case 16:throw new ZN(JN.UNEXPECTED_ERROR,"unexpected error",e.t0);case 17:case"end":return e.stop()}}),e,this,[[4,10]])}))),function(e){return ve.apply(this,arguments)})},{key:"stopLiveTranscoding",value:(pe=u(o().mark((function e(){var t;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(B$.print("stopLiveTranscoding()"),this._liveTranscodeConfig){e.next=3;break}return e.abrupt("return");case 3:return delete this._liveTranscodeConfig,e.prev=4,this.safeEmit(ie.onStreamMixingEvent,{event:wz.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 ZN)){e.next=16;break}throw e.t0;case 16:throw new ZN(JN.UNEXPECTED_ERROR,"unexpected error",e.t0);case 17:case"end":return e.stop()}}),e,this,[[4,10]])}))),function(){return pe.apply(this,arguments)})},{key:"setBusinessId",value:function(e){return B$.print("setBusinessId()","businessId: %s",e),!function(e){return"string"!=typeof e}(e)&&!this._room&&(wB.setStats({rtc_business_id:e}),sW.setStats({rtc_business_id:e}),this._businessId=e,!0)}},{key:"setUserVisibility",value:(fe=u(o().mark((function e(t){var r,n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(B$.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._room.connectionState===rq.CONNECTED){e.next=9;break}throw new ZN(JN.NOT_CONNECTED_YET,"server not connected");case 9:if(this._room.localStream&&(null===(n=this._room.localStream.observer)||void 0===n||n.setPublisher(t)),e.t0=!t,!e.t0){e.next=14;break}return e.next=14,this._room.unpublish();case 14:return e.next=16,this._room.updateUserAttributes({role:t?T$.NORMAL_USER:T$.SILENT_USER});case 16:this._visibility=t,t&&null!==(r=this._roomConfig)&&void 0!==r&&r.isAutoPublish&&this._updatePublish({mediaType:V.AUDIO_AND_VIDEO});case 18:case"end":return e.stop()}}),e,this)}))),function(e){return fe.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]:U.STREAM_INDEX_MAIN,i=n===U.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(ie.onFirstPublicStreamAudioFrameDecoded,{publicStreamId:o}):(t.safeEmit(ie.onAudioFirstFrameDecoded,{userId:o,isScreen:i}),t.safeEmit(ie.onRemoteAudioFirstFrame,{userId:o,isScreen:i})),IB.firstRemoteAudioRender("",o||"",{isScreen:i})}else{var a,s,u={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?(u.publicStreamId=u.userId,delete u.userId,delete u.isScreen,t.safeEmit(ie.onFirstPublicStreamVideoFrameRendered,u),t.safeEmit(ie.onFirstPublicStreamVideoFrameDecoded,u)):e.isLocal||(t.safeEmit(ie.onVideoFirstFrameRendered,u),t.safeEmit(ie.onVideoFirstFrameDecoded,u),t.safeEmit(ie.onRemoteVideoFirstFrame,u)),IB.firstRemoteVideoRender("",n.userId||"",{isScreen:i})}break;case"autoplay-error":return r&&(n.publicStreamId=n.userId),void t.safeEmit(ie.onAutoplayFailed,{userId:n.userId||n.publicStreamId,kind:e instanceof RW?"video":"audio"})}t.safeEmit(ie.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(ie.onTrackEnded,{kind:e.getTrack().kind,isScreen:r})})),e.on("resolution-change",(function(e){t.safeEmit(ie.onLocalVideoSizeChanged,{streamIndex:r?U.STREAM_INDEX_SCREEN:U.STREAM_INDEX_MAIN,info:e})}))}},{key:"setRemoteVideoPlayer",value:function(e,t){B$.print("setRemoteVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",e,t),MP(e,"streamIndex",[U.STREAM_INDEX_MAIN,U.STREAM_INDEX_SCREEN]),XP(t);var r,n,o,a=t.userId;if(e===U.STREAM_INDEX_MAIN){var s,u,c;if(null===(s=this._remoteVideoPlayer.get(a))||void 0===s||s.destroy(),!t.renderDom)return;var d=new RW(t);this._initPlayerEvents(d,!1,e),this._remoteVideoPlayer.set(a,d);var l=null===(u=this._room)||void 0===u||null===(c=u.remoteStreams.get(a))||void 0===c?void 0:c.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 RW(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){B$.print("setLocalVideoMirrorType()","mirrorType: %o",e),MP(e,"mirrorType",[j.MIRROR_TYPE_NONE,j.MIRROR_TYPE_RENDER]),this._mirrorType=e,this._videoPlayer&&this._videoPlayer.mirror(!!e)}},{key:"setAudioPlaybackDevice",value:(he=u(o().mark((function e(t){var r,n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(B$.print("setAudioPlaybackDevice()","deviceId: %s",t),PP(t,"deviceId"),void 0!==HTMLAudioElement.prototype.setSinkId){e.next=5;break}return B$.print("setAudioPlaybackDevice failed","setSinkId not supported by current browser"),e.abrupt("return");case 5:return e.next=7,kH.enumerateAudioPlaybackDevices();case 7:if(r=e.sent,n=r.find((function(e){return e.deviceId===t}))){e.next=11;break}throw new ZN(JN.INVALID_DEVICE_ID,"audio playback device id ".concat(t," is invalid"));case 11:this._remoteAudioPlayer.forEach((function(e){e.setPlaybackDevice(t)})),this._audioPlaybackDeviceId=t,n&&this.safeEmit(ie.onAudioPlaybackDeviceChanged,n),IB.rtcAudioDevice(dB.PLAYOUT_DEVICE_SWITCH,t,0);case 15:case"end":return e.stop()}}),e,this)}))),function(e){return he.apply(this,arguments)})},{key:"play",value:(le=u(o().mark((function e(t){var r,n,i,a,s,u,c,d,l;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(B$.print("play()","userId | publicStreamId: %s",t),s=null===(r=this._room)||void 0===r||null===(n=r.remoteStreams.get(t||""))||void 0===n?void 0:n.find((function(e){return!e.isScreen})),i=this._remoteAudioPlayer.get(t||""),a=this._remoteVideoPlayer.get(t||""),i||(i=this._publicStreamAudioPlayer.get(t||"")),a||(a=this._publicStreamVideoPlayer.get(t||"")),!t&&this._videoPlayer&&(a=this._videoPlayer),a&&(a.played?a.manuallyPlay():null!=s&&s.videoTrack?a.playVideo(s.videoTrack,s):!t&&this._localVideoTrack&&(a.mirror(!!this._mirrorType),a.playVideo(this._localVideoTrack))),i&&(i.played?i.manuallyPlay():null!=s&&s.audioTrack&&(i.playAudio(s.audioTrack),(c=null==s||null===(u=s.audioTrack._audioLevelFetcher)||void 0===u?void 0:u._ctx)&&c.resume())),null!=s&&s.audioTrack&&(l=null==s||null===(d=s.audioTrack._audioLevelFetcher)||void 0===d?void 0:d._ctx)&&"suspended"===l.state&&l.resume(),t||!this._audioMixingManager){e.next=13;break}return e.next=13,this._audioMixingManager.resumeLocalPlay();case 13:case"end":return e.stop()}}),e,this)}))),function(e){return le.apply(this,arguments)})},{key:"pauseAllSubscribedStream",value:(de=u(o().mark((function e(t){var r,n=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(B$.print("pauseAllSubscribedStream()","mediaType: %o",t),this._checkMediaType(t),!this._pauseAllSubscribeState.audio||!this._pauseAllSubscribeState.video){e.next=4;break}return e.abrupt("return",Promise.resolve());case 4:if(r=function(){wP(t)&&(n._pauseAllSubscribeState.audio=!0),CP(t)&&(n._pauseAllSubscribeState.video=!0)},this._room){e.next=8;break}return r(),e.abrupt("return",Promise.resolve());case 8:return e.abrupt("return",this._room.pauseAllSubscribedStream(t).then((function(){r()})));case 9:case"end":return e.stop()}}),e,this)}))),function(e){return de.apply(this,arguments)})},{key:"resumeAllSubscribedStream",value:(ce=u(o().mark((function e(t){var r,n=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(B$.print("resumeAllSubscribedStream()","mediaType: %o",t),this._checkMediaType(t),this._pauseAllSubscribeState.audio||this._pauseAllSubscribeState.video){e.next=4;break}return e.abrupt("return",Promise.resolve());case 4:if(r=function(){wP(t)&&(n._pauseAllSubscribeState.audio=!1),CP(t)&&(n._pauseAllSubscribeState.video=!1)},this._room){e.next=8;break}return r(),e.abrupt("return",Promise.resolve());case 8:return e.abrupt("return",this._room.resumeAllSubscribedStream(t).then((function(){var e,t;r(),null===(e=n._room)||void 0===e||null===(t=e.remoteStreams)||void 0===t||t.forEach((function(e){Array.isArray(e)&&e.forEach((function(e){n._updateAudioPlayerState(e),n._updateVideoPlayerState(e)}))}))})));case 9:case"end":return e.stop()}}),e,this)}))),function(e){return ce.apply(this,arguments)})},{key:"sendUserMessage",value:(ue=u(o().mark((function e(t,r){var n,i,a=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(HP(t),WP(r),this._room&&this._room.connectionState===rq.CONNECTED){e.next=4;break}throw new ZN(JN.IM_BEFORE_JOIN,"join first");case 4:return i=Date.now(),e.abrupt("return",null===(n=this._room.sendUserMessage(t,r))||void 0===n?void 0:n.then((function(e){return a._messageStatisticsObserver.countP2PMessage(!0,t,!1,i,e),e.id})).catch((function(e){throw a._messageStatisticsObserver.countP2PMessage(!1,t,!1,i),e})));case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return ue.apply(this,arguments)})},{key:"sendUserBinaryMessage",value:(se=u(o().mark((function e(t,r){var n,i,a=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(HP(t),VP(r,"message"),WP(r),this._room&&this._room.connectionState===rq.CONNECTED){e.next=5;break}throw new ZN(JN.IM_BEFORE_JOIN,"join first");case 5:return i=Date.now(),e.abrupt("return",null===(n=this._room.sendUserMessage(t,r))||void 0===n?void 0:n.then((function(e){return a._messageStatisticsObserver.countP2PMessage(!0,t,!0,i,e),e.id})).catch((function(e){throw a._messageStatisticsObserver.countP2PMessage(!1,t,!0,i),e})));case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return se.apply(this,arguments)})},{key:"sendRoomMessage",value:(ae=u(o().mark((function e(t){var r,n=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(WP(t),this._room&&this._room.connectionState===rq.CONNECTED){e.next=3;break}throw new ZN(JN.IM_BEFORE_JOIN,"join first");case 3:return r=Date.now(),e.abrupt("return",this._room.sendRoomMessage(t).then((function(e){var t,i;return n._messageStatisticsObserver.countRoomMessage(!0,null===(t=n._room)||void 0===t||null===(i=t.roomInfo)||void 0===i?void 0:i.roomId,!1,r),e})).catch((function(e){var t,i;throw n._messageStatisticsObserver.countRoomMessage(!1,null===(t=n._room)||void 0===t||null===(i=t.roomInfo)||void 0===i?void 0:i.roomId,!1,r),e})));case 5:case"end":return e.stop()}}),e,this)}))),function(e){return ae.apply(this,arguments)})},{key:"sendRoomBinaryMessage",value:(oe=u(o().mark((function e(t){var r,n=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(WP(t),this._room&&this._room.connectionState===rq.CONNECTED){e.next=3;break}throw new ZN(JN.IM_BEFORE_JOIN,"join first");case 3:return r=Date.now(),e.abrupt("return",this._room.sendRoomMessage(t,!0).then((function(e){var t,i;return n._messageStatisticsObserver.countRoomMessage(!0,null===(t=n._room)||void 0===t||null===(i=t.roomInfo)||void 0===i?void 0:i.roomId,!0,r),e})).catch((function(e){var t,i;throw n._messageStatisticsObserver.countRoomMessage(!1,null===(t=n._room)||void 0===t||null===(i=t.roomInfo)||void 0===i?void 0:i.roomId,!0,r),e})));case 5:case"end":return e.stop()}}),e,this)}))),function(e){return oe.apply(this,arguments)})},{key:"setAudioCaptureConfig",value:(ne=u(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]:{},B$.print("setAudioCaptureConfig()","config: %o",t),delete t.deviceId,FP(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 ne.apply(this,arguments)})},{key:"setVideoCaptureConfig",value:(re=u(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]:{},B$.print("setVideoCaptureConfig()","config: %o",t),delete t.deviceId,FP(t),r=this._videoStreamConstraints.deviceId,this._videoStreamConstraints=t,r&&(this._videoStreamConstraints.deviceId=r),!this._localVideoTrack){e.next=12;break}return this._localVideoTrack.videoCaptureConfig=this._videoStreamConstraints,e.next=11,null===(n=this._localVideoTrack)||void 0===n?void 0:n.updateVideoCaptureConfig();case 11:this._updatePublish();case 12:case"end":return e.stop()}}),e,this)}))),function(){return re.apply(this,arguments)})},{key:"enableSimulcastMode",value:function(e){return B$.print("enableSimulcastMode()","enabled: %o",e),this._enableSimulcast=e,!0}},{key:"setVideoEncoderConfig",value:(ee=u(o().mark((function e(t){var r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:B$.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,null!==(r=this._room)&&void 0!==r&&r.hasPublished&&this._updatePublish();case 6:case"end":return e.stop()}}),e,this)}))),function(e){return ee.apply(this,arguments)})},{key:"setScreenEncoderConfig",value:($=u(o().mark((function e(t){var r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:B$.print("setScreenEncoderConfig()","description: %o",t),this._screenStreamEncodeConfig=[t],this._localScreenVideoTrack&&(this._localScreenVideoTrack.videoCaptureConfig=t,this._localScreenVideoTrack.updateVideoCaptureConfig(),t.contentHint&&this._localScreenVideoTrack.setContentHint(t.contentHint)),null!==(r=this._room)&&void 0!==r&&r.hasScreenPublished&&this._updateScreenPublish();case 4:case"end":return e.stop()}}),e,this)}))),function(e){return $.apply(this,arguments)})},{key:"sendSEIMessage",value:function(e,t,r){B$.print("sendSEIMessage()","streamIdex: %o, message: %o, repeatCount: %o",e,t,r),MP(e,"streamIndex",[U.STREAM_INDEX_MAIN,U.STREAM_INDEX_SCREEN]),DP(r,"repeatCount",0,30);var n="string"==typeof t?new Uint8Array(pP.str2ab(t)):t;if(t.length){var i;if(e===U.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 u,c,d;if(null===(u=this._room)||void 0===u||null===(c=u.localScreenStream)||void 0===c||!c.hasPublished)return;i=null===(d=this._room)||void 0===d?void 0:d.localScreenStream}if(n.byteLength>4096)B$.print("sei size must not bigger than 4KB");else{var l=dP();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 B$.print("sei message must not be empty")}},{key:"setAudioVolumeIndicationInterval",value:function(e){var t=this;B$.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(ie.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(ie.onActiveSpeaker,{userId:o.userId,extraInfo:o.extraInfo})}}}},{key:"enableAudioPropertiesReport",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};B$.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:U.STREAM_INDEX_MAIN,audioPropertiesInfo:{linearVolume:i,nonlinearVolume:AP(i)}})}if(e._localScreenAudioTrack){var o=e._localScreenAudioTrack.getAudioLevel();t.push({streamIndex:U.STREAM_INDEX_SCREEN,audioPropertiesInfo:{linearVolume:o,nonlinearVolume:AP(o)}})}if(e.safeEmit(ie.onLocalAudioPropertiesReport,t),e._room){var a=[];e._room.remoteStreams.forEach((function(t,r){t.forEach((function(t){if(t.audioTrack){var n,i,o=t.audioTrack.getAudioLevel();a.push({streamKey:{userId:r,streamIndex:t.isScreen?U.STREAM_INDEX_SCREEN:U.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:AP(o)}})}}))})),e._sendActiveSpeaker(t,a.filter((function(e){return e.streamKey.streamIndex!==U.STREAM_INDEX_SCREEN}))),e.safeEmit(ie.onRemoteAudioPropertiesReport,a)}}}),o))}},{key:"setVideoSourceType",value:(Q=u(o().mark((function e(t,r){var n,i,a,s,u,c,d,l,h,f,p,v,_,m,y,g,S,b,E,k,T,I,R;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(B$.print("setVideoSourceType()","index: %o, videoSourceType: %o",t,r),MP(t,"streamIndex",[U.STREAM_INDEX_MAIN,U.STREAM_INDEX_SCREEN]),MP(r,"VideoSourceType",[w.VIDEO_SOURCE_TYPE_EXTERNAL,w.VIDEO_SOURCE_TYPE_INTERNAL]),n=t===U.STREAM_INDEX_MAIN?"video":"screenVideo",this._trackSourceType[n]===r){e.next=26;break}if(this._trackSourceType[n]=r,B$.print("setVideoSourceType","set ".concat(n," source type to ").concat(r)),!this._localVideoTrack||t!==U.STREAM_INDEX_MAIN){e.next=17;break}if(c=!1,r===w.VIDEO_SOURCE_TYPE_EXTERNAL&&(c=!0,this._localVideoTrack.close()),null===(i=this._videoPlayer)||void 0===i||i.stop(),this._localVideoTrack=void 0,d=null===(a=this._room)||void 0===a?void 0:a._roomConfig.isAutoPublish,c?null===(l=this._room)||void 0===l||null===(h=l.localStream)||void 0===h||null===(f=h.observer)||void 0===f||f.setEnableVideo(!1):null===(p=this._room)||void 0===p||null===(v=p.localStream)||void 0===v||null===(_=v.observer)||void 0===_||_.setPushVideo(!1),!(null!==(s=this._room)&&void 0!==s&&null!==(u=s.localStream)&&void 0!==u&&u.pubVideo||d)){e.next=17;break}return e.next=17,this._updatePublish();case 17:if(!this._localScreenVideoTrack||t!==U.STREAM_INDEX_SCREEN){e.next=26;break}if(S=!1,r===w.VIDEO_SOURCE_TYPE_EXTERNAL&&(S=!0,this._localScreenVideoTrack.close()),null===(m=this._screenPlayer)||void 0===m||m.stop(),this._localScreenVideoTrack=void 0,S?null===(b=this._room)||void 0===b||null===(E=b.localScreenStream)||void 0===E||null===(k=E.observer)||void 0===k||k.setEnableVideo(!1):null===(T=this._room)||void 0===T||null===(I=T.localScreenStream)||void 0===I||null===(R=I.observer)||void 0===R||R.setPushVideo(!1),null===(y=this._room)||void 0===y||null===(g=y.localScreenStream)||void 0===g||!g.pubVideo){e.next=26;break}return e.next=26,this._updateScreenPublish();case 26:case"end":return e.stop()}}),e,this)}))),function(e,t){return Q.apply(this,arguments)})},{key:"setExternalVideoTrack",value:(Y=u(o().mark((function e(t,r){var n,i,a,s,u,c,d,l,h,f,p;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(B$.print("setExternalVideoTrack()","index: %o, track: %o",t,r),MP(t,"streamIndex",[U.STREAM_INDEX_MAIN,U.STREAM_INDEX_SCREEN]),LP(r),t!==U.STREAM_INDEX_MAIN){e.next=15;break}if(this._trackSourceType.video===w.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=6;break}throw new ZN(JN.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as external first");case 6:return e.next=8,rz(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),u=null===(i=this._room)||void 0===i?void 0:i._roomConfig.isAutoPublish,!(null!==(a=this._room)&&void 0!==a&&null!==(s=a.localStream)&&void 0!==s&&s.pubVideo||u)){e.next=15;break}return e.next=15,this._updatePublish();case 15:if(t!==U.STREAM_INDEX_SCREEN){e.next=27;break}if(this._trackSourceType.screenVideo===w.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=18;break}throw new ZN(JN.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as external first");case 18:return e.next=20,az(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===(d=this._room)||void 0===d||null===(l=d.localScreenStream)||void 0===l||null===(h=l.observer)||void 0===h||h.setPushVideo(!0),null===(f=this._room)||void 0===f||null===(p=f.localScreenStream)||void 0===p||!p.pubVideo){e.next=27;break}return e.next=27,this._updateScreenPublish();case 27:case"end":return e.stop()}}),e,this)}))),function(e,t){return Y.apply(this,arguments)})},{key:"setAudioSourceType",value:(W=u(o().mark((function e(t,r){var n,i,a,s,u,c,d,l,h,f,p,v,_,m,y,g,S,b,E,k,T;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(B$.print("setAudioSourceType()","index: %o, audioSourceType: %o",t,r),MP(t,"streamIndex",[U.STREAM_INDEX_MAIN,U.STREAM_INDEX_SCREEN]),MP(r,"audioSourceType",[C.AUDIO_SOURCE_TYPE_EXTERNAL,C.AUDIO_SOURCE_TYPE_INTERNAL]),n=t===U.STREAM_INDEX_MAIN?"audio":"screenAudio",this._trackSourceType[n]===r){e.next=24;break}if(this._trackSourceType[n]=r,B$.print("setVideoSourceType","set ".concat(n," source type to ").concat(r)),!this._localAudioTrack||t!==U.STREAM_INDEX_MAIN){e.next=16;break}if(u=!1,this._trackSourceType.audio===C.AUDIO_SOURCE_TYPE_EXTERNAL&&(u=!0,this._localAudioTrack.close()),this._localAudioTrack=void 0,c=null===(i=this._room)||void 0===i?void 0:i._roomConfig.isAutoPublish,u?null===(d=this._room)||void 0===d||null===(l=d.localStream)||void 0===l||null===(h=l.observer)||void 0===h||h.setEnableAudio(!1):null===(f=this._room)||void 0===f||null===(p=f.localStream)||void 0===p||null===(v=p.observer)||void 0===v||v.setPushAudio(!1),!(null!==(a=this._room)&&void 0!==a&&null!==(s=a.localStream)&&void 0!==s&&s.pubAudio||c)){e.next=16;break}return e.next=16,this._updatePublish();case 16:if(!this._localScreenAudioTrack||t!==U.STREAM_INDEX_SCREEN){e.next=24;break}if(y=!1,this._trackSourceType.audio===C.AUDIO_SOURCE_TYPE_EXTERNAL&&(y=!0,this._localScreenAudioTrack.close()),this._localScreenAudioTrack=void 0,y?null===(g=this._room)||void 0===g||null===(S=g.localScreenStream)||void 0===S||null===(b=S.observer)||void 0===b||b.setEnableAudio(!1):null===(E=this._room)||void 0===E||null===(k=E.localScreenStream)||void 0===k||null===(T=k.observer)||void 0===T||T.setPushAudio(!1),null===(_=this._room)||void 0===_||null===(m=_.localScreenStream)||void 0===m||!m.pubAudio){e.next=24;break}return e.next=24,this._updateScreenPublish();case 24:case"end":return e.stop()}}),e,this)}))),function(e,t){return W.apply(this,arguments)})},{key:"setExternalAudioTrack",value:(q=u(o().mark((function e(t,r){var n,i,a,s,u,c,d,l,h,f,p,v;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(B$.print("setExternalAudioTrack()","index: %o, track: %o",t,r),MP(t,"streamIndex",[U.STREAM_INDEX_MAIN,U.STREAM_INDEX_SCREEN]),LP(r),t!==U.STREAM_INDEX_MAIN){e.next=15;break}if(this._trackSourceType.audio===C.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=6;break}throw new ZN(JN.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as external first");case 6:return e.next=8,iz(r,this._extensionManager);case 8:if(this._localAudioTrack=e.sent,this._initLocalTrackEvents(this._localAudioTrack),d=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!==(u=this._room)&&void 0!==u&&null!==(c=u.localStream)&&void 0!==c&&c.pubAudio||d)){e.next=15;break}return e.next=15,this._updatePublish();case 15:if(t!==U.STREAM_INDEX_SCREEN){e.next=26;break}if(this._trackSourceType.screenAudio===C.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=18;break}throw new ZN(JN.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as external first");case 18:return e.next=20,uz(r,this._extensionManager);case 20:if(this._localScreenAudioTrack=e.sent,this._initLocalTrackEvents(this._localScreenAudioTrack),null===(l=this._room)||void 0===l||null===(h=l.localScreenStream)||void 0===h||null===(f=h.observer)||void 0===f||f.setPushAudio(!0),null===(p=this._room)||void 0===p||null===(v=p.localScreenStream)||void 0===v||!v.pubAudio){e.next=26;break}return e.next=26,this._updateScreenPublish();case 26:case"end":return e.stop()}}),e,this)}))),function(e,t){return q.apply(this,arguments)})},{key:"login",value:(z=u(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return B$.print("login()","token: %o, userInfo: %o",t,r),jP(t)||PP(t,"token"),HP(r),e.abrupt("return",this._rtmClient.login(t,r));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return z.apply(this,arguments)})},{key:"logout",value:(H=u(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return B$.print("logout()"),e.abrupt("return",this._rtmClient.logout());case 2:case"end":return e.stop()}}),e,this)}))),function(){return H.apply(this,arguments)})},{key:"updateLoginToken",value:(G=u(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return B$.print("updateLoginToken()","token: %o",t),jP(t)||PP(t,"token"),e.abrupt("return",this._rtmClient.updateLoginToken(t));case 3:case"end":return e.stop()}}),e,this)}))),function(e){return G.apply(this,arguments)})},{key:"getPeerOnlineStatus",value:(L=u(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return B$.print("getPeerOnlineStatus()","userId: %o",t),HP(t),e.abrupt("return",this._rtmClient.getPeerOnlineStatus(t));case 3:case"end":return e.stop()}}),e,this)}))),function(e){return L.apply(this,arguments)})},{key:"sendUserMessageOutsideRoom",value:(M=u(o().mark((function e(t,r){var n,i=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return HP(t),WP(r),n=Date.now(),e.prev=3,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})));case 7:throw e.prev=7,e.t0=e.catch(3),this._messageStatisticsObserver.countUserMessageOutsideRoom(!1,t,!1,n),e.t0;case 11:case"end":return e.stop()}}),e,this,[[3,7]])}))),function(e,t){return M.apply(this,arguments)})},{key:"sendUserBinaryMessageOutsideRoom",value:(N=u(o().mark((function e(t,r){var n,i=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return HP(t),VP(r,"message"),WP(r),n=Date.now(),e.prev=4,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})));case 8:throw e.prev=8,e.t0=e.catch(4),this._messageStatisticsObserver.countUserMessageOutsideRoom(!1,t,!0,n),e.t0;case 12:case"end":return e.stop()}}),e,this,[[4,8]])}))),function(e,t){return N.apply(this,arguments)})},{key:"setServerParams",value:(x=u(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return B$.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 x.apply(this,arguments)})},{key:"sendServerMessage",value:(O=u(o().mark((function e(t){var r,n=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return PP(t,"message"),WP(t),r=Date.now(),e.prev=3,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})));case 7:throw e.prev=7,e.t0=e.catch(3),this._messageStatisticsObserver.countServerMessage(!1,!1,r),e.t0;case 11:case"end":return e.stop()}}),e,this,[[3,7]])}))),function(e){return O.apply(this,arguments)})},{key:"sendServerBinaryMessage",value:(A=u(o().mark((function e(t){var r,n=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return VP(t,"message"),WP(t),r=Date.now(),e.prev=3,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})));case 7:throw e.prev=7,e.t0=e.catch(3),this._messageStatisticsObserver.countServerMessage(!1,!0,r),e.t0;case 11:case"end":return e.stop()}}),e,this,[[3,7]])}))),function(e){return A.apply(this,arguments)})},{key:"startCloudProxy",value:function(e){if(this._room)throw new ZN(JN.START_CLOUD_PROXY_AFTER_JOIN,"[startCloudProxy] should be invoke before join room ");B$.print("startCloudProxy()",e),PP(e.logProxy,"logProxy"),PP(e.accessProxy,"accessProxy"),PP(e.configProxy,"configProxy"),this._originIceConfigRequestUrls=ZB("ICE_CONFIG_REQUEST_URLS"),this._originLogServerUrl=ZB("LOG_SERVER_URL"),this._originConfigServerUrls=ZB("CONFIG_REQUEST_DOMAINS"),QB("ICE_CONFIG_REQUEST_URLS",e.accessProxy),QB("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)),QB("CONFIG_REQUEST_DOMAINS",[e.configProxy]),qB.clearAccessNode(this._appId),qB.clearAccessUrls(),this._useCloudProxy=!0}},{key:"stopCloudProxy",value:function(){var e;if(this._room)throw new ZN(JN.STOP_CLOUD_PROXY_BEFORE_LEAVE,"[stopCloudProxy] should be invoke after leave room ");B$.print("stopCloudProxy()"),QB("ICE_CONFIG_REQUEST_URLS",null===(e=this._originIceConfigRequestUrls)||void 0===e?void 0:e.map((function(e){return e.replace("https://","").replace("/dispatch/v1/AccessInfo?Action=GetAccessInfo","")}))),QB("LOG_SERVER_URL",this._originLogServerUrl),QB("CONFIG_REQUEST_DOMAINS",this._originConfigServerUrls),this._useCloudProxy=!1,qB.clearAccessNode(this._appId),qB.clearAccessUrls(),this._startCloudProxyTimestamp=void 0}},{key:"startPushPublicStream",value:(R=u(o().mark((function e(t,r){var n,i=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(B$.print("startPushPublicStream()","publicStreamId: %o, publicStreamParam: %o",t,r),zP(t),this._room&&this._room.connectionState===rq.CONNECTED){e.next=4;break}throw new ZN(JN.START_PUBLIC_STREAM_BEFORE_JOIN,"join first");case 4:if(!this._publicStreamIds.get(t)){e.next=6;break}throw new ZN(JN.REPEAT_PUSH,"repeat push public media stream");case 6:return n=ej(t,"started",r),e.abrupt("return",this._room.publicStreamControlMessage(n).then((function(){i._publicStreamIds.set(t,t)})));case 8:case"end":return e.stop()}}),e,this)}))),function(e,t){return R.apply(this,arguments)})},{key:"updatePublicStreamParam",value:(I=u(o().mark((function e(t,r){var n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(B$.print("startPushPublicStream()","publicStreamId: %o, publicStreamParam: %o",t,r),zP(t),this._room&&this._room.connectionState===rq.CONNECTED){e.next=4;break}throw new ZN(JN.START_PUBLIC_STREAM_BEFORE_JOIN,"join first");case 4:return n=ej(t,"layoutChanged",r),e.abrupt("return",this._room.publicStreamControlMessage(n));case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return I.apply(this,arguments)})},{key:"stopPushPublicStream",value:(T=u(o().mark((function e(t){var r=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(B$.print("startPushPublicStream()","publicStreamId: %o",t),zP(t),this._room&&this._room.connectionState===rq.CONNECTED){e.next=4;break}throw new ZN(JN.START_PUBLIC_STREAM_BEFORE_JOIN,"join first");case 4:return e.abrupt("return",this._room.publicStreamControlMessage({type:"publicstream",action:"stopped",publicStreamID:t}).then((function(){r._publicStreamIds.delete(t)})));case 5:case"end":return e.stop()}}),e,this)}))),function(e){return T.apply(this,arguments)})},{key:"startPlayPublicStream",value:(k=u(o().mark((function e(t){var r,n,i,a,s,u,c=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(zP(t),this._outsideRoom){e.next=8;break}return this._outsideRoom=new A$(this._appId),this._outsideRoom.on(Az.RESUBSCRIBE,(function(e){var t=e.stream;if(t){var r,n=c._publicStreamAudioPlayer.get(t.streamId);n&&t.audioTrack&&(n.stop(),n.playAudio(null===(r=e.stream)||void 0===r?void 0:r.audioTrack));var i,o=c._publicStreamVideoPlayer.get(t.streamId);o&&t.videoTrack&&o.playVideo(null===(i=e.stream)||void 0===i?void 0:i.videoTrack)}})),null===(r=this._outsideRoom)||void 0===r||r.on("onRemoteStreamStats",(function(e){e.publicStreamId=e.userId,delete e.userId,delete e.isScreen,c.safeEmit(ie.onPublicStreamStats,e)})),null===(n=this._outsideRoom)||void 0===n||n.on(Az.ON_SEI_MESSAGED_RECEIVED,(function(e){c.safeEmit(ie.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 AW(t,{muted:(null===(u=this._config)||void 0===u?void 0:u.autoPlayPolicy)===Z.VIDEO_ONLY}),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 k.apply(this,arguments)})},{key:"stopPlayPublicStream",value:(S=u(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 S.apply(this,arguments)})},{key:"setAudioProfile",value:(y=u(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 y.apply(this,arguments)})},{key:"setPublicStreamVideoPlayer",value:function(e,t){var r,n,o,a;B$.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 RW(i(i({},t),{},{userId:e})),this._initPlayerEvents(s,!0),this._publicStreamVideoPlayer.set(e,s);var u=null===(n=this._outsideRoom)||void 0===n||null===(o=n.remoteStreams)||void 0===o?void 0:o.get(e);null!=u&&u.videoTrack&&(null===(a=this._config)||void 0===a?void 0:a.autoPlayPolicy)!==Z.PLAY_MANUALLY&&s.playVideo(u.videoTrack,u)}else this._publicStreamVideoPlayer.delete(e)}},{key:"setDummyCaptureImagePath",value:(_=u(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){PP(r,"filePath");var o=new Image;o.crossOrigin="anonymous",o.src=r,o.onload=function(){try{var r=document.createElement("canvas"),a=r.getContext("2d");if(!a)return i(new ZN(JN.UNEXPECTED_ERROR,"Not support canvas"));r.width=o.width,r.height=o.height,a.drawImage(o,0,0,o.width,o.height);var s=window.setInterval((function(){a.drawImage(o,0,0,o.width,o.height)}),200);t===U.STREAM_INDEX_MAIN?(clearInterval(n._dummyMainTimer),n._dummyMainTimer=s):(clearInterval(n._dummyScreenTimer),n._dummyScreenTimer=s);var u=r.captureStream(5).getVideoTracks()[0];t===U.STREAM_INDEX_MAIN?n._localImgVideoTrack=u:n._localImgScreenTrack=u,e()}catch(c){i(new ZN(JN.UNEXPECTED_ERROR,c.message))}},o.onerror=function(){i(new ZN(JN.UNEXPECTED_ERROR,"Load image error"))}})));case 1:case"end":return e.stop()}}),e)}))),function(e,t){return _.apply(this,arguments)})},{key:"registerExtension",value:(v=u(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.monitor=IB,t.isSupported()){e.next=3;break}throw new Error("This extension is not supported.");case 3:return e.next=5,t.init();case 5:this._extensionManager.register(t);case 6:case"end":return e.stop()}}),e,this)}))),function(e){return v.apply(this,arguments)})},{key:"defaultTranscoding",value:function(){return JSON.parse(JSON.stringify(rj))}},{key:"_updatePublish",value:(d=u(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]:{},B$.print("_updatePublish()","config: %o",t),r={mediaType:void 0,invokeByJoinRoom:!1,pubState:Cz.PUB},t=i(i({},r),t),this._visibility){e.next=6;break}throw new ZN(JN.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===rq.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 ZN)){e.next=23;break}throw e.t0;case 23:throw new ZN(JN.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 d.apply(this,arguments)})},{key:"startAudioPlaybackDeviceTest",value:(s=u(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return B$.print("startAudioPlaybackDeviceTest()","filePath: %o, indicationInterval: %o",t,r),PP(t,"filePath"),DP(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 s.apply(this,arguments)})},{key:"stopAudioPlaybackDeviceTest",value:function(){B$.print("stopAudioPlaybackDeviceTest()"),this._audioDeviceManager.stopAudioPlaybackDeviceTest()}},{key:"startAudioDeviceRecordTest",value:(a=u(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return B$.print("startAudioDeviceRecordTest()","indicationInterval: %o",t),DP(t,"indicationInterval"),e.next=4,this._audioDeviceManager.startAudioDeviceRecordTest(t);case 4:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"stopAudioDeviceRecordAndPlayTest",value:function(){B$.print("stopAudioDeviceRecordAndPlayTest()"),this._audioDeviceManager.stopAudioDeviceRecordAndPlayTest()}},{key:"stopAudioDevicePlayTest",value:function(){B$.print("stopAudioDevicePlayTest()"),this._audioDeviceManager.stopAudioDevicePlayTest()}},{key:"setRemoteUserPriority",value:function(e,t){var r;B$.print("setRemoteUserPriority()","userId: %o, priority: %o",e,t);try{HP(e),MP(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.setRemoteUserPriority(e,t),!0}},{key:"takeLocalSnapshot",value:(n=u(o().mark((function e(t){var r,n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(B$.print("takeLocalSnapshot()","streamIndex: %o",t),MP(t,"streamIndex",[U.STREAM_INDEX_MAIN,U.STREAM_INDEX_SCREEN]),r=t===U.STREAM_INDEX_MAIN?this.localVideoTrack:this.localScreenVideoTrack){e.next=5;break}throw new ZN(JN.INVOKED_BEFORE_CAPTURE,"capture first");case 5:return n=t===U.STREAM_INDEX_MAIN?this._videoPlayer:this._screenPlayer,e.abrupt("return",D$(r.getTrack("preprocessing"),(null==n?void 0:n.mirrorType)===j.MIRROR_TYPE_RENDER,n));case 7:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"takeRemoteSnapshot",value:(r=u(o().mark((function e(t,r){var n,i,a,s,u,c;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(B$.print("takeRemoteSnapshot()","id: %o, streamIndex: %o",t,r),PP(t,"id"),MP(r,"streamIndex",[U.STREAM_INDEX_MAIN,U.STREAM_INDEX_SCREEN]),c=(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===U.STREAM_INDEX_SCREEN)})))||void 0===a?void 0:a.videoTrack)||(null===(s=this._outsideRoom)||void 0===s||null===(u=s.remoteStreams.get(t))||void 0===u?void 0:u.videoTrack)){e.next=6;break}throw new ZN(JN.STREAM_NOT_EXIST,"stream not exist");case 6:return e.abrupt("return",D$(c.getTrack(),!1,r===U.STREAM_INDEX_MAIN?this._remoteVideoPlayer.get(t):this._remoteScreenPlayer.get(t)));case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"setSubscribeFallbackOption",value:function(e){B$.print("setSubscribeFallbackOption()","option: %o",e);try{MP(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===U.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 dz&&r.mixedAudioTrack?r.mixedAudioTrack:r.getTrack("preprocessing");if(o){var a=n();return M$(o,"enabled",this._reportMsTrackEvent.bind(this,"enabled",(null==a?void 0:a.streamId)||"","getLocalStreamTrack",t)),M$(o,"readyState",(function(e){"ended"===e&&(L$(o,"enabled"),L$(o,"readyState")),i._reportMsTrackEvent("readyState",(null==a?void 0:a.streamId)||"","getLocalStreamTrack",t,e)})),o.addEventListener("ended",(function(){L$(o,"enabled"),L$(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,u,c,d,l;if(t===U.STREAM_INDEX_MAIN)s=a.find((function(e){return!e.isScreen})),i="video"===r?null===(u=s)||void 0===u?void 0:u.videoTrack:null===(c=s)||void 0===c?void 0:c.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 M$(h,"enabled",this._reportMsTrackEvent.bind(this,"enabled",f,"getRemoteStreamTrack",r)),M$(h,"readyState",(function(e){"ended"===e&&(L$(h,"enabled"),L$(h,"readyState")),o._reportMsTrackEvent("readyState",f,"getRemoteStreamTrack",r,e)})),h.addEventListener("ended",(function(){L$(h,"enabled"),L$(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 M$(o,"enabled",this._reportMsTrackEvent.bind(this,"enabled",a,"getPublicStreamTrack",t)),M$(o,"readyState",(function(e){"ended"===e&&(L$(o,"enabled"),L$(o,"readyState")),r._reportMsTrackEvent("readyState",a,"getPublicStreamTrack",t,e)})),o.addEventListener("ended",(function(){L$(o,"enabled"),L$(o,"readyState")})),o}}}}}},{key:"_reportMsTrackEvent",value:function(e,t,r,n,i){var o;switch(e){case"readyState":o="live"!==i?"".concat(n," stopped"):"unknown";break;case"enabled":o="".concat(n,!0===i?" unmuted":" muted");break;default:o="unknown"}IB.rtcInvokeStatus(o,0,r,t||"",0,{direction:"getLocalStreamTrack"===r?"up":"down"})}},{key:"_updateScreenPublish",value:(t=u(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]:{},B$.print("_updateScreenPublish()"),r={mediaType:void 0,pubState:Cz.PUB},t=i(i({},r),t),e.next=6,this._pubLock.lock();case 6:if(n=e.sent,this._room&&this._room.connectionState===rq.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 ZN)){e.next=21;break}throw e.t0;case 21:throw new ZN(JN.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 t.apply(this,arguments)})},{key:"_updateAudioPlayerState",value:function(e){B$.print("_updateAudioPlayerState()");var t,r=e.userId,n=e.isScreen;if(t=n?this._remoteAudioPlayer.get("".concat(r,"_screen")):this._remoteAudioPlayer.get(r),e.audioTrack&&(e.attributes.audiostream&&e.subAudio||this.multiChatMode)){var i;if(!t){var o,a=n?"".concat(r,"_screen"):r;t=new AW(a,{muted:(null===(o=this._config)||void 0===o?void 0:o.autoPlayPolicy)===Z.VIDEO_ONLY}),this._initPlayerEvents(t,!1,n?U.STREAM_INDEX_SCREEN:U.STREAM_INDEX_MAIN),this._remoteAudioPlayer.set(a,t),this._audioPlaybackDeviceId&&t.setPlaybackDevice(this._audioPlaybackDeviceId)}(null===(i=this._config)||void 0===i?void 0:i.autoPlayPolicy)!==Z.PLAY_MANUALLY&&t.playAudio(e.audioTrack)}else{var s;null===(s=t)||void 0===s||s.stop()}}},{key:"_updateVideoPlayerState",value:function(e){var t;B$.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)!==Z.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=lz.NONE;if(i&&(s|=V.AUDIO),a&&(s|=V.VIDEO),s){var u;if(null!=t&&t.isScreen)this.safeEmit(ie.onUserPublishScreen,{userId:t.userId,mediaType:s});else this.safeEmit(ie.onUserPublishStream,{userId:t.userId,mediaType:s,videoStreamDescriptions:null==t||null===(u=t.attributes)||void 0===u?void 0:u.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(ie.onUserStartAudioCapture,{userId:t.userId}),o&&this.safeEmit(ie.onUserStartVideoCapture,{userId:t.userId}))}}},{key:"_handleAutoSubscribe",value:function(e,t){var r,n,i=lz.NONE;if(null!==(r=this._roomConfig)&&void 0!==r&&r.isAutoSubscribeAudio&&(i|=V.AUDIO),null!==(n=this._roomConfig)&&void 0!==n&&n.isAutoSubscribeVideo&&(i|=V.VIDEO),B$.print("_onAddStream","autoSubType: ".concat(i)),i){var o,a;if(t&&wP(i))null===(o=e.observer)||void 0===o||o.setAutoSubscribeAudio(!0);if(t&&CP(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=G$[e.reason])&&void 0!==t?t:F.STREAM_REMOVE_REASON_OTHER,o=n.isScreen?ie.onUserUnpublishScreen:ie.onUserUnpublishStream,a=lz.NONE;n.attributes.audiostream&&(a|=V.AUDIO),n.attributes.videostream&&(a|=V.VIDEO),null!=n&&n._workaround_1_&&(a=V.VIDEO),a!==lz.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){if(null==n||!n._workaround_1_){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(ie.onUserJoined,e)}},{key:"_onUserLeave",value:function(e){this.safeEmit(ie.onUserLeave,e)}},{key:"_onRoomError",value:function(e){var t;this.safeEmit(ie.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,[ie.onNetworkQuality].concat(t))}},{key:"_onConnectionStateChange",value:function(e){void 0!==this._startCloudProxyTimestamp&&this._useCloudProxy&&e.state===B.CONNECTION_STATE_CONNECTED&&this.safeEmit(ie.onCloudProxyConnected,{interval:Date.now()-this._startCloudProxyTimestamp}),this.safeEmit(ie.onConnectionStateChanged,e)}},{key:"_getRemotePlayer",value:function(e,t){return[this._remoteAudioPlayer.get(t?"".concat(e,"_screen"):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(ie.onVideoDeviceStateChanged,e)}},{key:"_onAudioDeviceStateChange",value:function(e){this.safeEmit(ie.onAudioDeviceStateChanged,e)}},{key:"_onUserPublishStateChange",value:function(e){var t,r=this,n=e.userId,o=e.isScreen,a=e.mediaType,s=e.pubState,u=e.remoteStream,c={userId:n,mediaType:a};(a&V.AUDIO&&setTimeout((function(){r._updateAudioPlayerState(u)})),o)?s===Cz.PUB?this.safeEmit(ie.onUserPublishScreen,c):this.safeEmit(ie.onUserUnpublishScreen,i(i({},c),{},{reason:F.STREAM_REMOVE_REASON_UNPUBLISH})):s===Cz.PUB?(c.videoStreamDescriptions=null==u||null===(t=u.attributes)||void 0===t?void 0:t.videoDescriptions,this.safeEmit(ie.onUserPublishStream,c),this._handleAutoSubscribe(u,!0)):this.safeEmit(ie.onUserUnpublishStream,i(i({},c),{},{reason:F.STREAM_REMOVE_REASON_UNPUBLISH}))}},{key:"_onCustomMessage",value:function(e){var t=e.message;e.binary?this.safeEmit(ie.onRoomBinaryMessageReceived,{userId:e.clientId,message:t}):this.safeEmit(ie.onRoomMessageReceived,{userId:e.clientId,message:t})}},{key:"_onUserMessageReceived",value:function(e){this._messageStatisticsObserver.recvP2PMessage(e.userId),this.safeEmit(ie.onUserMessageReceived,e)}},{key:"_onUserBinaryMessageReceived",value:function(e){this._messageStatisticsObserver.recvP2PMessage(e.userId),this.safeEmit(ie.onUserBinaryMessageReceived,e)}},{key:"_onLiveTranscodingResult",value:function(e){this.safeEmit(ie.onLiveTranscodingResult,e)}},{key:"_onStreamMixingEvent",value:function(e){this.safeEmit(ie.onStreamMixingEvent,e)}},{key:"_onUserTokenWillExpire",value:function(){this.safeEmit(ie.onTokenWillExpire)}},{key:"_onPushPublicStreamResult",value:function(e){this.safeEmit(ie.onPushPublicStreamResult,e)}},{key:"_handleRTMClient",value:function(e){var t=this;e.on("onUserMessageReceivedOutsideRoom",(function(e){t._messageStatisticsObserver.recvP2POutRoomMessage(e.userId),t.safeEmit(ie.onUserMessageReceivedOutsideRoom,e)})),e.on("onUserBinaryMessageReceivedOutsideRoom",(function(e){t._messageStatisticsObserver.recvP2POutRoomMessage(e.userId),t.safeEmit(ie.onUserBinaryMessageReceivedOutsideRoom,e)})),e.on("onUserDisconnection",(function(){t.safeEmit(ie.onError,{errorCode:JN.RTM_DUPLICATE_LOGIN})})),e.on("onRTMTokenError",(function(){t.safeEmit(ie.onError,{errorCode:JN.RTM_TOKEN_ERROR})})),e.on("onServerParamsSetResult",(function(e){t.safeEmit(ie.onServerParamsSetResult,null==e?void 0:e.code)}))}},{key:"waitForNewToken",get:function(){return!!this._tempRoomConfig}},{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:"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(ie.onAudioPlaybackDeviceTestVolume,t)}))}},{key:"_assertNotInRoom",value:function(){if(!this._room||this._room.connectionState!==rq.CONNECTED)throw new ZN(JN.INVOKED_BEFORE_JOIN_ROOM,"join first")}},{key:"_checkMediaType",value:function(e){MP(e,"mediaType",[V.AUDIO,V.VIDEO,V.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"}}]),Fe}(VL);F$([PB()],j$.prototype,"updateToken",1),F$([PB()],j$.prototype,"setVideoCaptureDevice",1),F$([PB()],j$.prototype,"setAudioCaptureDevice",1),F$([PB()],j$.prototype,"joinRoom",1),F$([PB()],j$.prototype,"leaveRoom",1),F$([PB()],j$.prototype,"destroy",1),F$([PB()],j$.prototype,"publishStream",1),F$([PB()],j$.prototype,"unpublishStream",1),F$([PB()],j$.prototype,"publishScreen",1),F$([PB()],j$.prototype,"unpublishScreen",1),F$([PB()],j$.prototype,"subscribeStream",1),F$([PB()],j$.prototype,"unsubscribeStream",1),F$([PB()],j$.prototype,"subscribeScreen",1),F$([PB()],j$.prototype,"unsubscribeScreen",1),F$([PB()],j$.prototype,"setRemoteVideoConfig",1),F$([PB()],j$.prototype,"startVideoCapture",1),F$([PB()],j$.prototype,"stopVideoCapture",1),F$([PB()],j$.prototype,"startAudioCapture",1),F$([PB()],j$.prototype,"stopAudioCapture",1),F$([PB()],j$.prototype,"getAudioMixingManager",1),F$([PB()],j$.prototype,"startScreenCapture",1),F$([PB()],j$.prototype,"stopScreenCapture",1),F$([PB()],j$.prototype,"setLocalVideoPlayer",1),F$([PB()],j$.prototype,"startLiveTranscoding",1),F$([PB()],j$.prototype,"updateLiveTranscoding",1),F$([PB()],j$.prototype,"stopLiveTranscoding",1),F$([PB()],j$.prototype,"setBusinessId",1),F$([PB()],j$.prototype,"setUserVisibility",1),F$([PB()],j$.prototype,"setRemoteVideoPlayer",1),F$([PB()],j$.prototype,"setLocalVideoMirrorType",1),F$([PB()],j$.prototype,"setAudioPlaybackDevice",1),F$([PB()],j$.prototype,"play",1),F$([PB()],j$.prototype,"pauseAllSubscribedStream",1),F$([PB()],j$.prototype,"resumeAllSubscribedStream",1),F$([PB()],j$.prototype,"sendUserMessage",1),F$([PB()],j$.prototype,"sendUserBinaryMessage",1),F$([PB()],j$.prototype,"sendRoomMessage",1),F$([PB()],j$.prototype,"sendRoomBinaryMessage",1),F$([PB()],j$.prototype,"setAudioCaptureConfig",1),F$([PB()],j$.prototype,"setVideoCaptureConfig",1),F$([PB()],j$.prototype,"enableSimulcastMode",1),F$([PB()],j$.prototype,"setVideoEncoderConfig",1),F$([PB()],j$.prototype,"setScreenEncoderConfig",1),F$([PB()],j$.prototype,"sendSEIMessage",1),F$([PB()],j$.prototype,"setAudioVolumeIndicationInterval",1),F$([PB()],j$.prototype,"enableAudioPropertiesReport",1),F$([PB()],j$.prototype,"setVideoSourceType",1),F$([PB()],j$.prototype,"setExternalVideoTrack",1),F$([PB()],j$.prototype,"setAudioSourceType",1),F$([PB()],j$.prototype,"setExternalAudioTrack",1),F$([PB("rtm")],j$.prototype,"login",1),F$([PB("rtm")],j$.prototype,"logout",1),F$([PB("rtm")],j$.prototype,"updateLoginToken",1),F$([PB("rtm")],j$.prototype,"getPeerOnlineStatus",1),F$([PB("rtm")],j$.prototype,"sendUserMessageOutsideRoom",1),F$([PB("rtm")],j$.prototype,"sendUserBinaryMessageOutsideRoom",1),F$([PB("rtm")],j$.prototype,"setServerParams",1),F$([PB("rtm")],j$.prototype,"sendServerMessage",1),F$([PB("rtm")],j$.prototype,"sendServerBinaryMessage",1),F$([PB()],j$.prototype,"startCloudProxy",1),F$([PB()],j$.prototype,"stopCloudProxy",1),F$([PB()],j$.prototype,"startPushPublicStream",1),F$([PB()],j$.prototype,"updatePublicStreamParam",1),F$([PB()],j$.prototype,"stopPushPublicStream",1),F$([PB("outsideRoom","streamId")],j$.prototype,"startPlayPublicStream",1),F$([PB("outsideRoom","streamId")],j$.prototype,"stopPlayPublicStream",1),F$([PB()],j$.prototype,"setAudioProfile",1),F$([PB("outsideRoom")],j$.prototype,"setPublicStreamVideoPlayer",1),F$([PB()],j$.prototype,"setDummyCaptureImagePath",1),F$([PB()],j$.prototype,"registerExtension",1),F$([PB()],j$.prototype,"startAudioPlaybackDeviceTest",1),F$([PB()],j$.prototype,"stopAudioPlaybackDeviceTest",1),F$([PB()],j$.prototype,"startAudioDeviceRecordTest",1),F$([PB()],j$.prototype,"stopAudioDeviceRecordAndPlayTest",1),F$([PB()],j$.prototype,"stopAudioDevicePlayTest",1),F$([PB()],j$.prototype,"setRemoteUserPriority",1),F$([PB()],j$.prototype,"takeLocalSnapshot",1),F$([PB()],j$.prototype,"takeRemoteSnapshot",1),F$([PB()],j$.prototype,"setSubscribeFallbackOption",1),F$([PB()],j$.prototype,"getLocalStreamTrack",1),F$([PB()],j$.prototype,"getRemoteStreamTrack",1),F$([PB()],j$.prototype,"getPublicStreamTrack",1);var G$={"client unpublished":F.STREAM_REMOVE_REASON_UNPUBLISH,"publish failed":F.STREAM_REMOVE_REASON_PUBLISH_FAILED,"stream removed":F.STREAM_REMOVE_REASON_KEEP_LIVE_FAILED,"client disconnected":F.STREAM_REMOVE_REASON_CLIENT_DISCONNECTED,"client republish":F.STREAM_REMOVE_REASON_REPUBLISH},H$=new LL("VERTC",0);[wB,CB,OB].forEach((function(e){var t;return e.setStats({rtc_sdk_version:JB.VERSION,product_line:jF.RTC,report_version:GF.W_5,os:HF.WEB,device_id:qB.getDeviceId(),user_agent:fP()?"":null===(t=navigator)||void 0===t?void 0:t.userAgent})})),sW.setStats({rtc_sdk_version:JB.VERSION});var z$=function(e,t){return H$.print("createEngine","Invoke VERTC.createEngine"),PP(e,"appId"),[wB,CB,OB].forEach((function(r){return r.setStats({rtc_app_id:e,auto_play_policy:null==t?void 0:t.autoPlayPolicy})})),sW.setStats({rtc_app_id:e}),IB.sdkInitEngine(Date.now(),vB.BEGIN),new j$(e,t)},q$=function(e){if(H$.print("destroyEngine","Invoke VERTC.destroyEngine"),!(e instanceof j$))throw new ZN(JN.INVALID_ENGINE,"Invalid engine object");e.destroy(),IB.sdkInitEngine(Date.now(),vB.END)},K$=function(){var e=u(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",kH.enumerateDevices());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),X$=function(){var e=u(o().mark((function e(){var t,r,n,i,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]:{video:!0,audio:!0},r=t.video,n=t.audio,i={video:!1,audio:!1},!r){e.next=12;break}return e.prev=4,e.next=7,kH.getVideoPermission();case 7:i.video=e.sent,e.next=12;break;case 10:e.prev=10,e.t0=e.catch(4);case 12:if(!n){e.next=21;break}return e.prev=13,e.next=16,kH.getAudioPermission();case 16:i.audio=e.sent,e.next=21;break;case 19:e.prev=19,e.t1=e.catch(13);case 21:return e.abrupt("return",i);case 22:case"end":return e.stop()}}),e,null,[[4,10],[13,19]])})));return function(){return e.apply(this,arguments)}}(),W$=function(){var e=u(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",kH.enumerateAudioCaptureDevices());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Y$=function(){var e=u(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",kH.enumerateVideoCaptureDevices());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),J$=function(){var e=u(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",kH.enumerateAudioPlaybackDevices());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Q$=function(){return JB.VERSION},Z$=function(){return IB.rtcSdkApiCall("isSupported",0,""),Lj()},$$=function(){return IB.rtcSdkApiCall("getSupportedCodecs",0,""),Vj()};function e0(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return JSON.stringify(t.map((function(e){return e instanceof j$?"[ENGINE]":e})))}function t0(e,t){return function(){NB(t,0,e0.apply(void 0,arguments));var r=e.apply(void 0,arguments);return"function"==typeof(null==r?void 0:r.then)?r.then((function(e){return DB(t,0,e0(e)),e})).catch((function(e){throw DB(t,e.code,e.message),e})):(DB(t,0,e0(r)),r)}}return!fP()&&location.search.includes("_rtc_autotest_"),i(i(i(i({},new(l((function e(){c(this,e),h(this,"getSdkVersion",t0(Q$,"getSdkVersion")),h(this,"createEngine",t0(z$,"createEngine")),h(this,"destroyEngine",t0(q$,"destroyEngine")),h(this,"enumerateDevices",t0(K$,"enumerateDevices")),h(this,"enableDevices",t0(X$,"enableDevices")),h(this,"enumerateAudioCaptureDevices",t0(W$,"enumerateAudioCaptureDevices")),h(this,"enumerateVideoCaptureDevices",t0(Y$,"enumerateVideoCaptureDevices")),h(this,"enumerateAudioPlaybackDevices",t0(J$,"enumerateAudioPlaybackDevices")),h(this,"getParameter",ZB),h(this,"setParameter",QB),h(this,"isSupported",t0(Z$,"isSupported")),h(this,"getSupportedCodecs",t0($$,"getSupportedCodecs")),h(this,"events",ie),h(this,"ErrorCode",JN),h(this,"platform","".concat({}.PRODUCT_PLATFORM)),h(this,"_monitor",IB)})))),$),ne),{},{events:ie})}));
|