@byteplus/rtc 4.46.3 → 4.47.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/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.46.3
4
+ * version: 4.47.0
5
5
  */
6
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).BytePlusRTC=t()}(this,(function(){"use strict";function e(e,t){return t.forEach((function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach((function(r){if("default"!==r&&!(r in e)){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})}}))})),Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}function t(e){var t,n,i,o=2;for("undefined"!=typeof Symbol&&(n=Symbol.asyncIterator,i=Symbol.iterator);o--;){if(n&&null!=(t=e[n]))return t.call(e);if(i&&null!=(t=e[i]))return new r(t.call(e));n="@@asyncIterator",i="@@iterator"}throw new TypeError("Object is not async iterable")}function r(e){function t(e){if(Object(e)!==e)return Promise.reject(new TypeError(e+" is not an object."));var t=e.done;return Promise.resolve(e.value).then((function(e){return{value:e,done:t}}))}return r=function(e){this.s=e,this.n=e.next},r.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){l(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(e){return o="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},o(e)}function a(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 s(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function s(e){a(o,n,i,s,u,"next",e)}function u(e){a(o,n,i,s,u,"throw",e)}s(void 0)}))}}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function d(e,t,r){return t&&c(e.prototype,t),r&&c(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function l(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function h(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&&p(e,t)}function f(e){return f=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},f(e)}function p(e,t){return p=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},p(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 v(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function m(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 v(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=f(e);if(t){var i=f(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return m(this,r)}}function y(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=f(e)););return e}function S(){return S="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=y(e,t);if(n){var i=Object.getOwnPropertyDescriptor(n,t);return i.get?i.get.call(arguments.length<3?e:r):i.value}},S.apply(this,arguments)}function b(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var n,i,o=[],a=!0,s=!1;try{for(r=r.call(e);!(a=(n=r.next()).done)&&(o.push(n.value),!t||o.length!==t);a=!0);}catch(LU){s=!0,i=LU}finally{try{a||null==r.return||r.return()}finally{if(s)throw i}}return o}(e,t)||k(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 E(e){return function(e){if(Array.isArray(e))return R(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||k(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 k(e,t){if(e){if("string"==typeof e)return R(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)?R(e,t):void 0}}function R(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 T(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=k(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}var I=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}(I||{}),A=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}(A||{}),w=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}(w||{}),C=function(e){return e[e.CHANNEL_PROFILE_COMMUNICATION=0]="CHANNEL_PROFILE_COMMUNICATION",e[e.CHANNEL_PROFILE_LIVE_BROADCASTING=1]="CHANNEL_PROFILE_LIVE_BROADCASTING",e}(C||{}),O=function(e){return e[e.AUTO_SUBSCRIBE_MODE=0]="AUTO_SUBSCRIBE_MODE",e[e.MANUAL_SUBSCRIBE_MODE=1]="MANUAL_SUBSCRIBE_MODE",e}(O||{}),x=function(e){return e[e.SUBSCRIBE_SUCC=0]="SUBSCRIBE_SUCC",e[e.SUBSCRIBE_FAIL=1]="SUBSCRIBE_FAIL",e}(x||{}),N=function(e){return e[e.PUBLISH_SUCC=0]="PUBLISH_SUCC",e[e.PUBLISH_FAIL=1]="PUBLISH_FAIL",e}(N||{}),D=function(e){return e[e.MIRROR_MODE_OFF=0]="MIRROR_MODE_OFF",e[e.MIRROR_MODE_ON=1]="MIRROR_MODE_ON",e}(D||{}),P=function(e){return e[e.RENDER_MODE_HIDDEN=0]="RENDER_MODE_HIDDEN",e[e.RENDER_MODE_FIT=1]="RENDER_MODE_FIT",e}(P||{}),M=function(e){return e[e.STREAM_INDEX_MAIN=0]="STREAM_INDEX_MAIN",e[e.STREAM_INDEX_SCREEN=1]="STREAM_INDEX_SCREEN",e}(M||{}),U=function(e){return e[e.AUDIO=1]="AUDIO",e[e.VIDEO=2]="VIDEO",e[e.AUDIO_AND_VIDEO=3]="AUDIO_AND_VIDEO",e}(U||{}),L=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}(L||{}),V=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}(V||{}),F=function(e){return e[e.MIRROR_TYPE_NONE=0]="MIRROR_TYPE_NONE",e[e.MIRROR_TYPE_RENDER=1]="MIRROR_TYPE_RENDER",e}(F||{}),B=function(e){return e[e.domestic=0]="domestic",e[e.overseas=1]="overseas",e}(B||{}),j=function(e){return e[e.OFFLINE=0]="OFFLINE",e[e.ONLINE=1]="ONLINE",e[e.UNREACHABLE=2]="UNREACHABLE",e}(j||{}),G=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}(G||{}),H=function(e){return e[e.PREV_FRAME=0]="PREV_FRAME",e[e.OTHER_FRAME=1]="OTHER_FRAME",e}(H||{}),z=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}(z||{}),K=function(e){return e[e.LOW=0]="LOW",e[e.MEDIUM=100]="MEDIUM",e[e.HIGH=200]="HIGH",e}(K||{}),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||{}),X=function(e){return e[e.Unknown=-1]="Unknown",e[e.SubscribeFallbackByBandwidth=0]="SubscribeFallbackByBandwidth",e[e.SubscribeRecoverByBandwidth=2]="SubscribeRecoverByBandwidth",e}(X||{}),Y=function(e){return e[e.communication=0]="communication",e[e.chat=5]="chat",e[e.chatRoom=6]="chatRoom",e[e.coHost=9]="coHost",e[e.meeting=16]="meeting",e[e.classRoom=18]="classRoom",e}(Y||{}),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||{}),J=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}(J||{}),Q=Object.freeze(Object.defineProperty({__proto__:null,VideoSourceType:I,AudioSourceType:A,UserOfflineReason:w,ChannelProfile:C,SubscribeMode:O,SubscribeState:x,PublishState:N,MirrorMode:D,VideoRenderMode:P,StreamIndex:M,MediaType:U,StreamRemoveReason:L,ConnectionState:V,MirrorType:F,LogChannel:B,USER_ONLINE_STATUS:j,PublicStreamType:G,PublicInterpolationMode:H,SubscribeFallbackOption:z,RemoteUserPriority:K,NetworkQuality:W,FallbackOrRecoverReason:X,RoomProfileType:Y,AudioProfileType:q,RTCAutoPlayPolicy:J},Symbol.toStringTag,{value:"Module"})),Z=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}(Z||{}),$=function(e){return e[e.PLAYOUT=0]="PLAYOUT",e[e.PUBLISH=1]="PUBLISH",e[e.PLAYOUT_AND_PUBLISH=2]="PLAYOUT_AND_PUBLISH",e}($||{}),ee=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}(ee||{}),te=Object.freeze(Object.defineProperty({__proto__:null,AudioMixingDualMonoMode:Z,AudioMixingType:$,AudioMixingState:ee},Symbol.toStringTag,{value:"Module"})),re=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.onAudioFirstFrameDecoded="onAudioFirstFrameDecoded",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}(re||{}),ne="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},ie=function(e){return e&&e.Math==Math&&e},oe=ie("object"==typeof globalThis&&globalThis)||ie("object"==typeof window&&window)||ie("object"==typeof self&&self)||ie("object"==typeof ne&&ne)||function(){return this}()||Function("return this")(),ae={},se=function(e){try{return!!e()}catch(t){return!0}},ue=!se((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),ce=!se((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),de=ce,le=Function.prototype.call,he=de?le.bind(le):function(){return le.apply(le,arguments)},fe={},pe={}.propertyIsEnumerable,_e=Object.getOwnPropertyDescriptor,ve=_e&&!pe.call({1:2},1);fe.f=ve?function(e){var t=_e(this,e);return!!t&&t.enumerable}:pe;var me,ge,ye=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},Se=ce,be=Function.prototype,Ee=be.bind,ke=be.call,Re=Se&&Ee.bind(ke,ke),Te=Se?function(e){return e&&Re(e)}:function(e){return e&&function(){return ke.apply(e,arguments)}},Ie=Te,Ae=Ie({}.toString),we=Ie("".slice),Ce=function(e){return we(Ae(e),8,-1)},Oe=Te,xe=se,Ne=Ce,De=oe.Object,Pe=Oe("".split),Me=xe((function(){return!De("z").propertyIsEnumerable(0)}))?function(e){return"String"==Ne(e)?Pe(e,""):De(e)}:De,Ue=oe.TypeError,Le=function(e){if(null==e)throw Ue("Can't call method on "+e);return e},Ve=Me,Fe=Le,Be=function(e){return Ve(Fe(e))},je=function(e){return"function"==typeof e},Ge=je,He=function(e){return"object"==typeof e?null!==e:Ge(e)},ze=oe,Ke=je,We=function(e){return Ke(e)?e:void 0},Xe=function(e,t){return arguments.length<2?We(ze[e]):ze[e]&&ze[e][t]},Ye=Te({}.isPrototypeOf),qe=Xe("navigator","userAgent")||"",Je=oe,Qe=qe,Ze=Je.process,$e=Je.Deno,et=Ze&&Ze.versions||$e&&$e.version,tt=et&&et.v8;tt&&(ge=(me=tt.split("."))[0]>0&&me[0]<4?1:+(me[0]+me[1])),!ge&&Qe&&(!(me=Qe.match(/Edge\/(\d+)/))||me[1]>=74)&&(me=Qe.match(/Chrome\/(\d+)/))&&(ge=+me[1]);var rt=ge,nt=rt,it=se,ot=!!Object.getOwnPropertySymbols&&!it((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&nt&&nt<41})),at=ot&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,st=Xe,ut=je,ct=Ye,dt=at,lt=oe.Object,ht=dt?function(e){return"symbol"==typeof e}:function(e){var t=st("Symbol");return ut(t)&&ct(t.prototype,lt(e))},ft=oe.String,pt=function(e){try{return ft(e)}catch(t){return"Object"}},_t=je,vt=pt,mt=oe.TypeError,gt=function(e){if(_t(e))return e;throw mt(vt(e)+" is not a function")},yt=gt,St=function(e,t){var r=e[t];return null==r?void 0:yt(r)},bt=he,Et=je,kt=He,Rt=oe.TypeError,Tt={exports:{}},It=oe,At=Object.defineProperty,wt=function(e,t){try{At(It,e,{value:t,configurable:!0,writable:!0})}catch(r){It[e]=t}return t},Ct=wt,Ot="__core-js_shared__",xt=oe[Ot]||Ct(Ot,{}),Nt=xt;(Tt.exports=function(e,t){return Nt[e]||(Nt[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.21.0",mode:"global",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.21.0/LICENSE",source:"https://github.com/zloirock/core-js"});var Dt=Le,Pt=oe.Object,Mt=function(e){return Pt(Dt(e))},Ut=Mt,Lt=Te({}.hasOwnProperty),Vt=Object.hasOwn||function(e,t){return Lt(Ut(e),t)},Ft=Te,Bt=0,jt=Math.random(),Gt=Ft(1..toString),Ht=function(e){return"Symbol("+(void 0===e?"":e)+")_"+Gt(++Bt+jt,36)},zt=oe,Kt=Tt.exports,Wt=Vt,Xt=Ht,Yt=ot,qt=at,Jt=Kt("wks"),Qt=zt.Symbol,Zt=Qt&&Qt.for,$t=qt?Qt:Qt&&Qt.withoutSetter||Xt,er=function(e){if(!Wt(Jt,e)||!Yt&&"string"!=typeof Jt[e]){var t="Symbol."+e;Yt&&Wt(Qt,e)?Jt[e]=Qt[e]:Jt[e]=qt&&Zt?Zt(t):$t(t)}return Jt[e]},tr=he,rr=He,nr=ht,ir=St,or=function(e,t){var r,n;if("string"===t&&Et(r=e.toString)&&!kt(n=bt(r,e)))return n;if(Et(r=e.valueOf)&&!kt(n=bt(r,e)))return n;if("string"!==t&&Et(r=e.toString)&&!kt(n=bt(r,e)))return n;throw Rt("Can't convert object to primitive value")},ar=er,sr=oe.TypeError,ur=ar("toPrimitive"),cr=function(e,t){if(!rr(e)||nr(e))return e;var r,n=ir(e,ur);if(n){if(void 0===t&&(t="default"),r=tr(n,e,t),!rr(r)||nr(r))return r;throw sr("Can't convert object to primitive value")}return void 0===t&&(t="number"),or(e,t)},dr=cr,lr=ht,hr=function(e){var t=dr(e,"string");return lr(t)?t:t+""},fr=He,pr=oe.document,_r=fr(pr)&&fr(pr.createElement),vr=function(e){return _r?pr.createElement(e):{}},mr=vr,gr=!ue&&!se((function(){return 7!=Object.defineProperty(mr("div"),"a",{get:function(){return 7}}).a})),yr=ue,Sr=he,br=fe,Er=ye,kr=Be,Rr=hr,Tr=Vt,Ir=gr,Ar=Object.getOwnPropertyDescriptor;ae.f=yr?Ar:function(e,t){if(e=kr(e),t=Rr(t),Ir)try{return Ar(e,t)}catch(r){}if(Tr(e,t))return Er(!Sr(br.f,e,t),e[t])};var wr={},Cr=ue&&se((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Or=oe,xr=He,Nr=Or.String,Dr=Or.TypeError,Pr=function(e){if(xr(e))return e;throw Dr(Nr(e)+" is not an object")},Mr=ue,Ur=gr,Lr=Cr,Vr=Pr,Fr=hr,Br=oe.TypeError,jr=Object.defineProperty,Gr=Object.getOwnPropertyDescriptor,Hr="enumerable",zr="configurable",Kr="writable";wr.f=Mr?Lr?function(e,t,r){if(Vr(e),t=Fr(t),Vr(r),"function"==typeof e&&"prototype"===t&&"value"in r&&Kr in r&&!r.writable){var n=Gr(e,t);n&&n.writable&&(e[t]=r.value,r={configurable:zr in r?r.configurable:n.configurable,enumerable:Hr in r?r.enumerable:n.enumerable,writable:!1})}return jr(e,t,r)}:jr:function(e,t,r){if(Vr(e),t=Fr(t),Vr(r),Ur)try{return jr(e,t,r)}catch(n){}if("get"in r||"set"in r)throw Br("Accessors not supported");return"value"in r&&(e[t]=r.value),e};var Wr=wr,Xr=ye,Yr=ue?function(e,t,r){return Wr.f(e,t,Xr(1,r))}:function(e,t,r){return e[t]=r,e},qr={exports:{}},Jr=je,Qr=xt,Zr=Te(Function.toString);Jr(Qr.inspectSource)||(Qr.inspectSource=function(e){return Zr(e)});var $r,en,tn,rn=Qr.inspectSource,nn=je,on=rn,an=oe.WeakMap,sn=nn(an)&&/native code/.test(on(an)),un=Tt.exports,cn=Ht,dn=un("keys"),ln=function(e){return dn[e]||(dn[e]=cn(e))},hn={},fn=sn,pn=oe,_n=Te,vn=He,mn=Yr,gn=Vt,yn=xt,Sn=ln,bn=hn,En="Object already initialized",kn=pn.TypeError,Rn=pn.WeakMap;if(fn||yn.state){var Tn=yn.state||(yn.state=new Rn),In=_n(Tn.get),An=_n(Tn.has),wn=_n(Tn.set);$r=function(e,t){if(An(Tn,e))throw new kn(En);return t.facade=e,wn(Tn,e,t),t},en=function(e){return In(Tn,e)||{}},tn=function(e){return An(Tn,e)}}else{var Cn=Sn("state");bn[Cn]=!0,$r=function(e,t){if(gn(e,Cn))throw new kn(En);return t.facade=e,mn(e,Cn,t),t},en=function(e){return gn(e,Cn)?e[Cn]:{}},tn=function(e){return gn(e,Cn)}}var On={set:$r,get:en,has:tn,enforce:function(e){return tn(e)?en(e):$r(e,{})},getterFor:function(e){return function(t){var r;if(!vn(t)||(r=en(t)).type!==e)throw kn("Incompatible receiver, "+e+" required");return r}}},xn=ue,Nn=Vt,Dn=Function.prototype,Pn=xn&&Object.getOwnPropertyDescriptor,Mn=Nn(Dn,"name"),Un={EXISTS:Mn,PROPER:Mn&&"something"===function(){}.name,CONFIGURABLE:Mn&&(!xn||xn&&Pn(Dn,"name").configurable)},Ln=oe,Vn=je,Fn=Vt,Bn=Yr,jn=wt,Gn=rn,Hn=Un.CONFIGURABLE,zn=On.get,Kn=On.enforce,Wn=String(String).split("String");(qr.exports=function(e,t,r,n){var i,o=!!n&&!!n.unsafe,a=!!n&&!!n.enumerable,s=!!n&&!!n.noTargetGet,u=n&&void 0!==n.name?n.name:t;Vn(r)&&("Symbol("===String(u).slice(0,7)&&(u="["+String(u).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),(!Fn(r,"name")||Hn&&r.name!==u)&&Bn(r,"name",u),(i=Kn(r)).source||(i.source=Wn.join("string"==typeof u?u:""))),e!==Ln?(o?!s&&e[t]&&(a=!0):delete e[t],a?e[t]=r:Bn(e,t,r)):a?e[t]=r:jn(t,r)})(Function.prototype,"toString",(function(){return Vn(this)&&zn(this).source||Gn(this)}));var Xn={},Yn=Math.ceil,qn=Math.floor,Jn=function(e){var t=+e;return t!=t||0===t?0:(t>0?qn:Yn)(t)},Qn=Jn,Zn=Math.max,$n=Math.min,ei=function(e,t){var r=Qn(e);return r<0?Zn(r+t,0):$n(r,t)},ti=Jn,ri=Math.min,ni=function(e){return e>0?ri(ti(e),9007199254740991):0},ii=ni,oi=function(e){return ii(e.length)},ai=Be,si=ei,ui=oi,ci=function(e){return function(t,r,n){var i,o=ai(t),a=ui(o),s=si(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}},di={includes:ci(!0),indexOf:ci(!1)},li=Vt,hi=Be,fi=di.indexOf,pi=hn,_i=Te([].push),vi=function(e,t){var r,n=hi(e),i=0,o=[];for(r in n)!li(pi,r)&&li(n,r)&&_i(o,r);for(;t.length>i;)li(n,r=t[i++])&&(~fi(o,r)||_i(o,r));return o},mi=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],gi=vi,yi=mi.concat("length","prototype");Xn.f=Object.getOwnPropertyNames||function(e){return gi(e,yi)};var Si={};Si.f=Object.getOwnPropertySymbols;var bi=Xe,Ei=Xn,ki=Si,Ri=Pr,Ti=Te([].concat),Ii=bi("Reflect","ownKeys")||function(e){var t=Ei.f(Ri(e)),r=ki.f;return r?Ti(t,r(e)):t},Ai=Vt,wi=Ii,Ci=ae,Oi=wr,xi=function(e,t,r){for(var n=wi(t),i=Oi.f,o=Ci.f,a=0;a<n.length;a++){var s=n[a];Ai(e,s)||r&&Ai(r,s)||i(e,s,o(t,s))}},Ni=se,Di=je,Pi=/#|\.prototype\./,Mi=function(e,t){var r=Li[Ui(e)];return r==Fi||r!=Vi&&(Di(t)?Ni(t):!!t)},Ui=Mi.normalize=function(e){return String(e).replace(Pi,".").toLowerCase()},Li=Mi.data={},Vi=Mi.NATIVE="N",Fi=Mi.POLYFILL="P",Bi=Mi,ji=oe,Gi=ae.f,Hi=Yr,zi=qr.exports,Ki=wt,Wi=xi,Xi=Bi,Yi=function(e,t){var r,n,i,o,a,s=e.target,u=e.global,c=e.stat;if(r=u?ji:c?ji[s]||Ki(s,{}):(ji[s]||{}).prototype)for(n in t){if(o=t[n],i=e.noTargetGet?(a=Gi(r,n))&&a.value:r[n],!Xi(u?n:s+(c?".":"#")+n,e.forced)&&void 0!==i){if(typeof o==typeof i)continue;Wi(o,i)}(e.sham||i&&i.sham)&&Hi(o,"sham",!0),zi(r,n,o,e)}},qi=ce,Ji=Function.prototype,Qi=Ji.apply,Zi=Ji.call,$i="object"==typeof Reflect&&Reflect.apply||(qi?Zi.bind(Qi):function(){return Zi.apply(Qi,arguments)}),eo=Ce,to=Array.isArray||function(e){return"Array"==eo(e)},ro={};ro[er("toStringTag")]="z";var no="[object z]"===String(ro),io=oe,oo=no,ao=je,so=Ce,uo=er("toStringTag"),co=io.Object,lo="Arguments"==so(function(){return arguments}()),ho=oo?so: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=co(e),uo))?r:lo?so(t):"Object"==(n=so(t))&&ao(t.callee)?"Arguments":n},fo=ho,po=oe.String,_o=function(e){if("Symbol"===fo(e))throw TypeError("Cannot convert a Symbol value to a string");return po(e)},vo={},mo=vi,go=mi,yo=Object.keys||function(e){return mo(e,go)},So=ue,bo=Cr,Eo=wr,ko=Pr,Ro=Be,To=yo;vo.f=So&&!bo?Object.defineProperties:function(e,t){ko(e);for(var r,n=Ro(t),i=To(t),o=i.length,a=0;o>a;)Eo.f(e,r=i[a++],n[r]);return e};var Io,Ao=Xe("document","documentElement"),wo=Pr,Co=vo,Oo=mi,xo=hn,No=Ao,Do=vr,Po=ln("IE_PROTO"),Mo=function(){},Uo=function(e){return"<script>"+e+"</"+"script>"},Lo=function(e){e.write(Uo("")),e.close();var t=e.parentWindow.Object;return e=null,t},Vo=function(){try{Io=new ActiveXObject("htmlfile")}catch(n){}var e,t;Vo="undefined"!=typeof document?document.domain&&Io?Lo(Io):((t=Do("iframe")).style.display="none",No.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(Uo("document.F=Object")),e.close(),e.F):Lo(Io);for(var r=Oo.length;r--;)delete Vo.prototype[Oo[r]];return Vo()};xo[Po]=!0;var Fo=Object.create||function(e,t){var r;return null!==e?(Mo.prototype=wo(e),r=new Mo,Mo.prototype=null,r[Po]=e):r=Vo(),void 0===t?r:Co.f(r,t)},Bo={},jo=hr,Go=wr,Ho=ye,zo=function(e,t,r){var n=jo(t);n in e?Go.f(e,n,Ho(0,r)):e[n]=r},Ko=ei,Wo=oi,Xo=zo,Yo=oe.Array,qo=Math.max,Jo=function(e,t,r){for(var n=Wo(e),i=Ko(t,n),o=Ko(void 0===r?n:r,n),a=Yo(qo(o-i,0)),s=0;i<o;i++,s++)Xo(a,s,e[i]);return a.length=s,a},Qo=Ce,Zo=Be,$o=Xn.f,ea=Jo,ta="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];Bo.f=function(e){return ta&&"Window"==Qo(e)?function(e){try{return $o(e)}catch(t){return ea(ta)}}(e):$o(Zo(e))};var ra=Te([].slice),na={},ia=er;na.f=ia;var oa=oe,aa=Vt,sa=na,ua=wr.f,ca=function(e){var t=oa.Symbol||(oa.Symbol={});aa(t,e)||ua(t,e,{value:sa.f(e)})},da=wr.f,la=Vt,ha=er("toStringTag"),fa=function(e,t,r){e&&!r&&(e=e.prototype),e&&!la(e,ha)&&da(e,ha,{configurable:!0,value:t})},pa=gt,_a=ce,va=Te(Te.bind),ma=function(e,t){return pa(e),void 0===t?e:_a?va(e,t):function(){return e.apply(t,arguments)}},ga=Te,ya=se,Sa=je,ba=ho,Ea=rn,ka=function(){},Ra=[],Ta=Xe("Reflect","construct"),Ia=/^\s*(?:class|function)\b/,Aa=ga(Ia.exec),wa=!Ia.exec(ka),Ca=function(e){if(!Sa(e))return!1;try{return Ta(ka,Ra,e),!0}catch(t){return!1}},Oa=function(e){if(!Sa(e))return!1;switch(ba(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return wa||!!Aa(Ia,Ea(e))}catch(t){return!0}};Oa.sham=!0;var xa=!Ta||ya((function(){var e;return Ca(Ca.call)||!Ca(Object)||!Ca((function(){e=!0}))||e}))?Oa:Ca,Na=oe,Da=to,Pa=xa,Ma=He,Ua=er("species"),La=Na.Array,Va=function(e){var t;return Da(e)&&(t=e.constructor,(Pa(t)&&(t===La||Da(t.prototype))||Ma(t)&&null===(t=t[Ua]))&&(t=void 0)),void 0===t?La:t},Fa=function(e,t){return new(Va(e))(0===t?0:t)},Ba=ma,ja=Me,Ga=Mt,Ha=oi,za=Fa,Ka=Te([].push),Wa=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=Ga(u),_=ja(p),v=Ba(c,d),m=Ha(_),g=0,y=l||za,S=t?y(u,m):r||a?y(u,0):void 0;m>g;g++)if((s||g in _)&&(f=v(h=_[g],g,p),e))if(t)S[g]=f;else if(f)switch(e){case 3:return!0;case 5:return h;case 6:return g;case 2:Ka(S,h)}else switch(e){case 4:return!1;case 7:Ka(S,h)}return o?-1:n||i?i:S}},Xa={forEach:Wa(0),map:Wa(1),filter:Wa(2),some:Wa(3),every:Wa(4),find:Wa(5),findIndex:Wa(6),filterReject:Wa(7)},Ya=Yi,qa=oe,Ja=Xe,Qa=$i,Za=he,$a=Te,es=ue,ts=ot,rs=se,ns=Vt,is=to,os=je,as=He,ss=Ye,us=ht,cs=Pr,ds=Mt,ls=Be,hs=hr,fs=_o,ps=ye,_s=Fo,vs=yo,ms=Xn,gs=Bo,ys=Si,Ss=ae,bs=wr,Es=vo,ks=fe,Rs=ra,Ts=qr.exports,Is=Tt.exports,As=hn,ws=Ht,Cs=er,Os=na,xs=ca,Ns=fa,Ds=On,Ps=Xa.forEach,Ms=ln("hidden"),Us="Symbol",Ls=Cs("toPrimitive"),Vs=Ds.set,Fs=Ds.getterFor(Us),Bs=Object.prototype,js=qa.Symbol,Gs=js&&js.prototype,Hs=qa.TypeError,zs=qa.QObject,Ks=Ja("JSON","stringify"),Ws=Ss.f,Xs=bs.f,Ys=gs.f,qs=ks.f,Js=$a([].push),Qs=Is("symbols"),Zs=Is("op-symbols"),$s=Is("string-to-symbol-registry"),eu=Is("symbol-to-string-registry"),tu=Is("wks"),ru=!zs||!zs.prototype||!zs.prototype.findChild,nu=es&&rs((function(){return 7!=_s(Xs({},"a",{get:function(){return Xs(this,"a",{value:7}).a}})).a}))?function(e,t,r){var n=Ws(Bs,t);n&&delete Bs[t],Xs(e,t,r),n&&e!==Bs&&Xs(Bs,t,n)}:Xs,iu=function(e,t){var r=Qs[e]=_s(Gs);return Vs(r,{type:Us,tag:e,description:t}),es||(r.description=t),r},ou=function(e,t,r){e===Bs&&ou(Zs,t,r),cs(e);var n=hs(t);return cs(r),ns(Qs,n)?(r.enumerable?(ns(e,Ms)&&e[Ms][n]&&(e[Ms][n]=!1),r=_s(r,{enumerable:ps(0,!1)})):(ns(e,Ms)||Xs(e,Ms,ps(1,{})),e[Ms][n]=!0),nu(e,n,r)):Xs(e,n,r)},au=function(e,t){cs(e);var r=ls(t),n=vs(r).concat(du(r));return Ps(n,(function(t){es&&!Za(su,r,t)||ou(e,t,r[t])})),e},su=function(e){var t=hs(e),r=Za(qs,this,t);return!(this===Bs&&ns(Qs,t)&&!ns(Zs,t))&&(!(r||!ns(this,t)||!ns(Qs,t)||ns(this,Ms)&&this[Ms][t])||r)},uu=function(e,t){var r=ls(e),n=hs(t);if(r!==Bs||!ns(Qs,n)||ns(Zs,n)){var i=Ws(r,n);return!i||!ns(Qs,n)||ns(r,Ms)&&r[Ms][n]||(i.enumerable=!0),i}},cu=function(e){var t=Ys(ls(e)),r=[];return Ps(t,(function(e){ns(Qs,e)||ns(As,e)||Js(r,e)})),r},du=function(e){var t=e===Bs,r=Ys(t?Zs:ls(e)),n=[];return Ps(r,(function(e){!ns(Qs,e)||t&&!ns(Bs,e)||Js(n,Qs[e])})),n};(ts||(js=function(){if(ss(Gs,this))throw Hs("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?fs(arguments[0]):void 0,t=ws(e),r=function(e){this===Bs&&Za(r,Zs,e),ns(this,Ms)&&ns(this[Ms],t)&&(this[Ms][t]=!1),nu(this,t,ps(1,e))};return es&&ru&&nu(Bs,t,{configurable:!0,set:r}),iu(t,e)},Ts(Gs=js.prototype,"toString",(function(){return Fs(this).tag})),Ts(js,"withoutSetter",(function(e){return iu(ws(e),e)})),ks.f=su,bs.f=ou,Es.f=au,Ss.f=uu,ms.f=gs.f=cu,ys.f=du,Os.f=function(e){return iu(Cs(e),e)},es&&(Xs(Gs,"description",{configurable:!0,get:function(){return Fs(this).description}}),Ts(Bs,"propertyIsEnumerable",su,{unsafe:!0}))),Ya({global:!0,wrap:!0,forced:!ts,sham:!ts},{Symbol:js}),Ps(vs(tu),(function(e){xs(e)})),Ya({target:Us,stat:!0,forced:!ts},{for:function(e){var t=fs(e);if(ns($s,t))return $s[t];var r=js(t);return $s[t]=r,eu[r]=t,r},keyFor:function(e){if(!us(e))throw Hs(e+" is not a symbol");if(ns(eu,e))return eu[e]},useSetter:function(){ru=!0},useSimple:function(){ru=!1}}),Ya({target:"Object",stat:!0,forced:!ts,sham:!es},{create:function(e,t){return void 0===t?_s(e):au(_s(e),t)},defineProperty:ou,defineProperties:au,getOwnPropertyDescriptor:uu}),Ya({target:"Object",stat:!0,forced:!ts},{getOwnPropertyNames:cu,getOwnPropertySymbols:du}),Ya({target:"Object",stat:!0,forced:rs((function(){ys.f(1)}))},{getOwnPropertySymbols:function(e){return ys.f(ds(e))}}),Ks)&&Ya({target:"JSON",stat:!0,forced:!ts||rs((function(){var e=js();return"[null]"!=Ks([e])||"{}"!=Ks({a:e})||"{}"!=Ks(Object(e))}))},{stringify:function(e,t,r){var n=Rs(arguments),i=t;if((as(t)||void 0!==e)&&!us(e))return is(t)||(t=function(e,t){if(os(i)&&(t=Za(i,this,e,t)),!us(t))return t}),n[1]=t,Qa(Ks,null,n)}});if(!Gs[Ls]){var lu=Gs.valueOf;Ts(Gs,Ls,(function(e){return Za(lu,this)}))}Ns(js,Us),As[Ms]=!0;var hu=Yi,fu=ue,pu=oe,_u=Te,vu=Vt,mu=je,gu=Ye,yu=_o,Su=wr.f,bu=xi,Eu=pu.Symbol,ku=Eu&&Eu.prototype;if(fu&&mu(Eu)&&(!("description"in ku)||void 0!==Eu().description)){var Ru={},Tu=function(){var e=arguments.length<1||void 0===arguments[0]?void 0:yu(arguments[0]),t=gu(ku,this)?new Eu(e):void 0===e?Eu():Eu(e);return""===e&&(Ru[t]=!0),t};bu(Tu,Eu),Tu.prototype=ku,ku.constructor=Tu;var Iu="Symbol(test)"==String(Eu("test")),Au=_u(ku.toString),wu=_u(ku.valueOf),Cu=/^Symbol\((.*)\)[^)]+$/,Ou=_u("".replace),xu=_u("".slice);Su(ku,"description",{configurable:!0,get:function(){var e=wu(this),t=Au(e);if(vu(Ru,e))return"";var r=Iu?xu(t,7,-1):Ou(t,Cu,"$1");return""===r?void 0:r}}),hu({global:!0,forced:!0},{Symbol:Tu})}var Nu=ho,Du=no?{}.toString:function(){return"[object "+Nu(this)+"]"},Pu=no,Mu=qr.exports,Uu=Du;Pu||Mu(Object.prototype,"toString",Uu,{unsafe:!0}),ca("iterator");var Lu=Fo,Vu=wr,Fu=er("unscopables"),Bu=Array.prototype;null==Bu[Fu]&&Vu.f(Bu,Fu,{configurable:!0,value:Lu(null)});var ju,Gu,Hu,zu=function(e){Bu[Fu][e]=!0},Ku={},Wu=!se((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),Xu=oe,Yu=Vt,qu=je,Ju=Mt,Qu=Wu,Zu=ln("IE_PROTO"),$u=Xu.Object,ec=$u.prototype,tc=Qu?$u.getPrototypeOf:function(e){var t=Ju(e);if(Yu(t,Zu))return t[Zu];var r=t.constructor;return qu(r)&&t instanceof r?r.prototype:t instanceof $u?ec:null},rc=se,nc=je,ic=tc,oc=qr.exports,ac=er("iterator"),sc=!1;[].keys&&("next"in(Hu=[].keys())?(Gu=ic(ic(Hu)))!==Object.prototype&&(ju=Gu):sc=!0);var uc=null==ju||rc((function(){var e={};return ju[ac].call(e)!==e}));uc&&(ju={}),nc(ju[ac])||oc(ju,ac,(function(){return this}));var cc={IteratorPrototype:ju,BUGGY_SAFARI_ITERATORS:sc},dc=cc.IteratorPrototype,lc=Fo,hc=ye,fc=fa,pc=Ku,_c=function(){return this},vc=function(e,t,r,n){var i=t+" Iterator";return e.prototype=lc(dc,{next:hc(+!n,r)}),fc(e,i,!1),pc[i]=_c,e},mc=oe,gc=je,yc=mc.String,Sc=mc.TypeError,bc=Te,Ec=Pr,kc=function(e){if("object"==typeof e||gc(e))return e;throw Sc("Can't set "+yc(e)+" as a prototype")},Rc=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=bc(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(r,[]),t=r instanceof Array}catch(n){}return function(r,n){return Ec(r),kc(n),t?e(r,n):r.__proto__=n,r}}():void 0),Tc=Yi,Ic=he,Ac=Un,wc=je,Cc=vc,Oc=tc,xc=Rc,Nc=fa,Dc=Yr,Pc=qr.exports,Mc=Ku,Uc=Ac.PROPER,Lc=Ac.CONFIGURABLE,Vc=cc.IteratorPrototype,Fc=cc.BUGGY_SAFARI_ITERATORS,Bc=er("iterator"),jc="keys",Gc="values",Hc="entries",zc=function(){return this},Kc=function(e,t,r,n,i,o,a){Cc(r,t,n);var s,u,c,d=function(e){if(e===i&&_)return _;if(!Fc&&e in f)return f[e];switch(e){case jc:case Gc:case Hc:return function(){return new r(this,e)}}return function(){return new r(this)}},l=t+" Iterator",h=!1,f=e.prototype,p=f[Bc]||f["@@iterator"]||i&&f[i],_=!Fc&&p||d(i),v="Array"==t&&f.entries||p;if(v&&(s=Oc(v.call(new e)))!==Object.prototype&&s.next&&(Oc(s)!==Vc&&(xc?xc(s,Vc):wc(s[Bc])||Pc(s,Bc,zc)),Nc(s,l,!0)),Uc&&i==Gc&&p&&p.name!==Gc&&(Lc?Dc(f,"name",Gc):(h=!0,_=function(){return Ic(p,this)})),i)if(u={values:d(Gc),keys:o?_:d(jc),entries:d(Hc)},a)for(c in u)(Fc||h||!(c in f))&&Pc(f,c,u[c]);else Tc({target:t,proto:!0,forced:Fc||h},u);return f[Bc]!==_&&Pc(f,Bc,_,{name:i}),Mc[t]=_,u},Wc=Be,Xc=zu,Yc=Ku,qc=On,Jc=wr.f,Qc=Kc,Zc=ue,$c="Array Iterator",ed=qc.set,td=qc.getterFor($c),rd=Qc(Array,"Array",(function(e,t){ed(this,{type:$c,target:Wc(e),index:0,kind:t})}),(function(){var e=td(this),t=e.target,r=e.kind,n=e.index++;return!t||n>=t.length?(e.target=void 0,{value:void 0,done:!0}):"keys"==r?{value:n,done:!1}:"values"==r?{value:t[n],done:!1}:{value:[n,t[n]],done:!1}}),"values"),nd=Yc.Arguments=Yc.Array;if(Xc("keys"),Xc("values"),Xc("entries"),Zc&&"values"!==nd.name)try{Jc(nd,"name",{value:"values"})}catch(RY){}var id=Te,od=Jn,ad=_o,sd=Le,ud=id("".charAt),cd=id("".charCodeAt),dd=id("".slice),ld=function(e){return function(t,r){var n,i,o=ad(sd(t)),a=od(r),s=o.length;return a<0||a>=s?e?"":void 0:(n=cd(o,a))<55296||n>56319||a+1===s||(i=cd(o,a+1))<56320||i>57343?e?ud(o,a):n:e?dd(o,a,a+2):i-56320+(n-55296<<10)+65536}},hd={codeAt:ld(!1),charAt:ld(!0)},fd=hd.charAt,pd=_o,_d=On,vd=Kc,md="String Iterator",gd=_d.set,yd=_d.getterFor(md);vd(String,"String",(function(e){gd(this,{type:md,string:pd(e),index:0})}),(function(){var e,t=yd(this),r=t.string,n=t.index;return n>=r.length?{value:void 0,done:!0}:(e=fd(r,n),t.index+=e.length,{value:e,done:!1})}));var Sd={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},bd=vr("span").classList,Ed=bd&&bd.constructor&&bd.constructor.prototype,kd=Ed===Object.prototype?void 0:Ed,Rd=oe,Td=Sd,Id=kd,Ad=rd,wd=Yr,Cd=er,Od=Cd("iterator"),xd=Cd("toStringTag"),Nd=Ad.values,Dd=function(e,t){if(e){if(e[Od]!==Nd)try{wd(e,Od,Nd)}catch(RY){e[Od]=Nd}if(e[xd]||wd(e,xd,t),Td[t])for(var r in Ad)if(e[r]!==Ad[r])try{wd(e,r,Ad[r])}catch(RY){e[r]=Ad[r]}}};for(var Pd in Td)Dd(Rd[Pd]&&Rd[Pd].prototype,Pd);Dd(Id,"DOMTokenList"),ca("asyncIterator"),ca("toStringTag"),fa(oe.JSON,"JSON",!0),fa(Math,"Math",!0);var Md=Yi,Ud=ue,Ld=wr.f;Md({target:"Object",stat:!0,forced:Object.defineProperty!==Ld,sham:!Ud},{defineProperty:Ld});var Vd=Mt,Fd=tc,Bd=Wu;Yi({target:"Object",stat:!0,forced:se((function(){Fd(1)})),sham:!Bd},{getPrototypeOf:function(e){return Fd(Vd(e))}}),Yi({target:"Object",stat:!0},{setPrototypeOf:Rc});var jd=oe.Promise,Gd=qr.exports,Hd=function(e,t,r){for(var n in t)Gd(e,n,t[n],r);return e},zd=Xe,Kd=wr,Wd=ue,Xd=er("species"),Yd=function(e){var t=zd(e),r=Kd.f;Wd&&t&&!t[Xd]&&r(t,Xd,{configurable:!0,get:function(){return this}})},qd=Ye,Jd=oe.TypeError,Qd=function(e,t){if(qd(t,e))return e;throw Jd("Incorrect invocation")},Zd=Ku,$d=er("iterator"),el=Array.prototype,tl=function(e){return void 0!==e&&(Zd.Array===e||el[$d]===e)},rl=ho,nl=St,il=Ku,ol=er("iterator"),al=function(e){if(null!=e)return nl(e,ol)||nl(e,"@@iterator")||il[rl(e)]},sl=he,ul=gt,cl=Pr,dl=pt,ll=al,hl=oe.TypeError,fl=function(e,t){var r=arguments.length<2?ll(e):t;if(ul(r))return cl(sl(r,e));throw hl(dl(e)+" is not iterable")},pl=he,_l=Pr,vl=St,ml=function(e,t,r){var n,i;_l(e);try{if(!(n=vl(e,"return"))){if("throw"===t)throw r;return r}n=pl(n,e)}catch(RY){i=!0,n=RY}if("throw"===t)throw r;if(i)throw n;return _l(n),r},gl=ma,yl=he,Sl=Pr,bl=pt,El=tl,kl=oi,Rl=Ye,Tl=fl,Il=al,Al=ml,wl=oe.TypeError,Cl=function(e,t){this.stopped=e,this.result=t},Ol=Cl.prototype,xl=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_ITERATOR),f=!(!r||!r.INTERRUPTED),p=gl(t,d),_=function(e){return n&&Al(n,"normal",e),new Cl(!0,e)},v=function(e){return l?(Sl(e),f?p(e[0],e[1],_):p(e[0],e[1])):f?p(e,_):p(e)};if(h)n=e;else{if(!(i=Il(e)))throw wl(bl(e)+" is not iterable");if(El(i)){for(o=0,a=kl(e);a>o;o++)if((s=v(e[o]))&&Rl(Ol,s))return s;return new Cl(!1)}n=Tl(e,i)}for(u=n.next;!(c=yl(u,n)).done;){try{s=v(c.value)}catch(RY){Al(n,"throw",RY)}if("object"==typeof s&&s&&Rl(Ol,s))return s}return new Cl(!1)},Nl=er("iterator"),Dl=!1;try{var Pl=0,Ml={next:function(){return{done:!!Pl++}},return:function(){Dl=!0}};Ml[Nl]=function(){return this},Array.from(Ml,(function(){throw 2}))}catch(RY){}var Ul,Ll,Vl,Fl,Bl=function(e,t){if(!t&&!Dl)return!1;var r=!1;try{var n={};n[Nl]=function(){return{next:function(){return{done:r=!0}}}},e(n)}catch(RY){}return r},jl=xa,Gl=pt,Hl=oe.TypeError,zl=function(e){if(jl(e))return e;throw Hl(Gl(e)+" is not a constructor")},Kl=Pr,Wl=zl,Xl=er("species"),Yl=function(e,t){var r,n=Kl(e).constructor;return void 0===n||null==(r=Kl(n)[Xl])?t:Wl(r)},ql=oe.TypeError,Jl=function(e,t){if(e<t)throw ql("Not enough arguments");return e},Ql=/(?:ipad|iphone|ipod).*applewebkit/i.test(qe),Zl="process"==Ce(oe.process),$l=oe,eh=$i,th=ma,rh=je,nh=Vt,ih=se,oh=Ao,ah=ra,sh=vr,uh=Jl,ch=Ql,dh=Zl,lh=$l.setImmediate,hh=$l.clearImmediate,fh=$l.process,ph=$l.Dispatch,_h=$l.Function,vh=$l.MessageChannel,mh=$l.String,gh=0,yh={},Sh="onreadystatechange";try{Ul=$l.location}catch(RY){}var bh=function(e){if(nh(yh,e)){var t=yh[e];delete yh[e],t()}},Eh=function(e){return function(){bh(e)}},kh=function(e){bh(e.data)},Rh=function(e){$l.postMessage(mh(e),Ul.protocol+"//"+Ul.host)};lh&&hh||(lh=function(e){uh(arguments.length,1);var t=rh(e)?e:_h(e),r=ah(arguments,1);return yh[++gh]=function(){eh(t,void 0,r)},Ll(gh),gh},hh=function(e){delete yh[e]},dh?Ll=function(e){fh.nextTick(Eh(e))}:ph&&ph.now?Ll=function(e){ph.now(Eh(e))}:vh&&!ch?(Fl=(Vl=new vh).port2,Vl.port1.onmessage=kh,Ll=th(Fl.postMessage,Fl)):$l.addEventListener&&rh($l.postMessage)&&!$l.importScripts&&Ul&&"file:"!==Ul.protocol&&!ih(Rh)?(Ll=Rh,$l.addEventListener("message",kh,!1)):Ll=Sh in sh("script")?function(e){oh.appendChild(sh("script")).onreadystatechange=function(){oh.removeChild(this),bh(e)}}:function(e){setTimeout(Eh(e),0)});var Th,Ih,Ah,wh,Ch,Oh,xh,Nh,Dh={set:lh,clear:hh},Ph=oe,Mh=/ipad|iphone|ipod/i.test(qe)&&void 0!==Ph.Pebble,Uh=/web0s(?!.*chrome)/i.test(qe),Lh=oe,Vh=ma,Fh=ae.f,Bh=Dh.set,jh=Ql,Gh=Mh,Hh=Uh,zh=Zl,Kh=Lh.MutationObserver||Lh.WebKitMutationObserver,Wh=Lh.document,Xh=Lh.process,Yh=Lh.Promise,qh=Fh(Lh,"queueMicrotask"),Jh=qh&&qh.value;Jh||(Th=function(){var e,t;for(zh&&(e=Xh.domain)&&e.exit();Ih;){t=Ih.fn,Ih=Ih.next;try{t()}catch(RY){throw Ih?wh():Ah=void 0,RY}}Ah=void 0,e&&e.enter()},jh||zh||Hh||!Kh||!Wh?!Gh&&Yh&&Yh.resolve?((xh=Yh.resolve(void 0)).constructor=Yh,Nh=Vh(xh.then,xh),wh=function(){Nh(Th)}):zh?wh=function(){Xh.nextTick(Th)}:(Bh=Vh(Bh,Lh),wh=function(){Bh(Th)}):(Ch=!0,Oh=Wh.createTextNode(""),new Kh(Th).observe(Oh,{characterData:!0}),wh=function(){Oh.data=Ch=!Ch}));var Qh=Jh||function(e){var t={fn:e,next:void 0};Ah&&(Ah.next=t),Ih||(Ih=t,wh()),Ah=t},Zh={},$h=gt,ef=function(e){var t,r;this.promise=new e((function(e,n){if(void 0!==t||void 0!==r)throw TypeError("Bad Promise constructor");t=e,r=n})),this.resolve=$h(t),this.reject=$h(r)};Zh.f=function(e){return new ef(e)};var tf=Pr,rf=He,nf=Zh,of=function(e,t){if(tf(e),rf(t)&&t.constructor===e)return t;var r=nf.f(e);return(0,r.resolve)(t),r.promise},af=oe,sf=function(){this.head=null,this.tail=null};sf.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 uf,cf,df,lf,hf=sf,ff="object"==typeof window,pf=Yi,_f=oe,vf=Xe,mf=he,gf=jd,yf=qr.exports,Sf=Hd,bf=Rc,Ef=fa,kf=Yd,Rf=gt,Tf=je,If=He,Af=Qd,wf=rn,Cf=xl,Of=Bl,xf=Yl,Nf=Dh.set,Df=Qh,Pf=of,Mf=function(e,t){var r=af.console;r&&r.error&&(1==arguments.length?r.error(e):r.error(e,t))},Uf=Zh,Lf=function(e){try{return{error:!1,value:e()}}catch(RY){return{error:!0,value:RY}}},Vf=hf,Ff=On,Bf=Bi,jf=ff,Gf=Zl,Hf=rt,zf=er("species"),Kf="Promise",Wf=Ff.getterFor(Kf),Xf=Ff.set,Yf=Ff.getterFor(Kf),qf=gf&&gf.prototype,Jf=gf,Qf=qf,Zf=_f.TypeError,$f=_f.document,ep=_f.process,tp=Uf.f,rp=tp,np=!!($f&&$f.createEvent&&_f.dispatchEvent),ip=Tf(_f.PromiseRejectionEvent),op="unhandledrejection",ap=!1,sp=Bf(Kf,(function(){var e=wf(Jf),t=e!==String(Jf);if(!t&&66===Hf)return!0;if(Hf>=51&&/native code/.test(e))return!1;var r=new Jf((function(e){e(1)})),n=function(e){e((function(){}),(function(){}))};return(r.constructor={})[zf]=n,!(ap=r.then((function(){}))instanceof n)||!t&&jf&&!ip})),up=sp||!Of((function(e){Jf.all(e).catch((function(){}))})),cp=function(e){var t;return!(!If(e)||!Tf(t=e.then))&&t},dp=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&&_p(t),t.rejection=1),!0===s?r=o:(d&&d.enter(),r=s(o),d&&(d.exit(),i=!0)),r===e.promise?c(Zf("Promise-chain cycle")):(n=cp(r))?mf(n,r,u,c):u(r)):c(o)}catch(RY){d&&!i&&d.exit(),c(RY)}},lp=function(e,t){e.notified||(e.notified=!0,Df((function(){for(var r,n=e.reactions;r=n.get();)dp(r,e);e.notified=!1,t&&!e.rejection&&fp(e)})))},hp=function(e,t,r){var n,i;np?((n=$f.createEvent("Event")).promise=t,n.reason=r,n.initEvent(e,!1,!0),_f.dispatchEvent(n)):n={promise:t,reason:r},!ip&&(i=_f["on"+e])?i(n):e===op&&Mf("Unhandled promise rejection",r)},fp=function(e){mf(Nf,_f,(function(){var t,r=e.facade,n=e.value;if(pp(e)&&(t=Lf((function(){Gf?ep.emit("unhandledRejection",n,r):hp(op,r,n)})),e.rejection=Gf||pp(e)?2:1,t.error))throw t.value}))},pp=function(e){return 1!==e.rejection&&!e.parent},_p=function(e){mf(Nf,_f,(function(){var t=e.facade;Gf?ep.emit("rejectionHandled",t):hp("rejectionhandled",t,e.value)}))},vp=function(e,t,r){return function(n){e(t,n,r)}},mp=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=2,lp(e,!0))},gp=function(e,t,r){if(!e.done){e.done=!0,r&&(e=r);try{if(e.facade===t)throw Zf("Promise can't be resolved itself");var n=cp(t);n?Df((function(){var r={done:!1};try{mf(n,t,vp(gp,r,e),vp(mp,r,e))}catch(RY){mp(r,RY,e)}})):(e.value=t,e.state=1,lp(e,!1))}catch(RY){mp({done:!1},RY,e)}}};if(sp&&(Qf=(Jf=function(e){Af(this,Qf),Rf(e),mf(uf,this);var t=Wf(this);try{e(vp(gp,t),vp(mp,t))}catch(RY){mp(t,RY)}}).prototype,(uf=function(e){Xf(this,{type:Kf,done:!1,notified:!1,parent:!1,reactions:new Vf,rejection:!1,state:0,value:void 0})}).prototype=Sf(Qf,{then:function(e,t){var r=Yf(this),n=tp(xf(this,Jf));return r.parent=!0,n.ok=!Tf(e)||e,n.fail=Tf(t)&&t,n.domain=Gf?ep.domain:void 0,0==r.state?r.reactions.add(n):Df((function(){dp(n,r)})),n.promise},catch:function(e){return this.then(void 0,e)}}),cf=function(){var e=new uf,t=Wf(e);this.promise=e,this.resolve=vp(gp,t),this.reject=vp(mp,t)},Uf.f=tp=function(e){return e===Jf||e===df?new cf(e):rp(e)},Tf(gf)&&qf!==Object.prototype)){lf=qf.then,ap||(yf(qf,"then",(function(e,t){var r=this;return new Jf((function(e,t){mf(lf,r,e,t)})).then(e,t)}),{unsafe:!0}),yf(qf,"catch",Qf.catch,{unsafe:!0}));try{delete qf.constructor}catch(RY){}bf&&bf(qf,Qf)}pf({global:!0,wrap:!0,forced:sp},{Promise:Jf}),Ef(Jf,Kf,!1),kf(Kf),df=vf(Kf),pf({target:Kf,stat:!0,forced:sp},{reject:function(e){var t=tp(this);return mf(t.reject,void 0,e),t.promise}}),pf({target:Kf,stat:!0,forced:sp},{resolve:function(e){return Pf(this,e)}}),pf({target:Kf,stat:!0,forced:up},{all:function(e){var t=this,r=tp(t),n=r.resolve,i=r.reject,o=Lf((function(){var r=Rf(t.resolve),o=[],a=0,s=1;Cf(e,(function(e){var u=a++,c=!1;s++,mf(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},race:function(e){var t=this,r=tp(t),n=r.reject,i=Lf((function(){var i=Rf(t.resolve);Cf(e,(function(e){mf(i,t,e).then(r.resolve,n)}))}));return i.error&&n(i.value),r.promise}});var yp=je,Sp=He,bp=Rc,Ep=function(e,t,r){var n,i;return bp&&yp(n=t.constructor)&&n!==r&&Sp(i=n.prototype)&&i!==r.prototype&&bp(e,i),e},kp=_o,Rp=function(e,t){return void 0===e?arguments.length<2?"":t:kp(e)},Tp=He,Ip=Yr,Ap=Te("".replace),wp=String(Error("zxcasd").stack),Cp=/\n\s*at [^:]*:[^\n]*/,Op=Cp.test(wp),xp=function(e,t){if(Op&&"string"==typeof e)for(;t--;)e=Ap(e,Cp,"");return e},Np=ye,Dp=!se((function(){var e=Error("a");return!("stack"in e)||(Object.defineProperty(e,"stack",Np(1,7)),7!==e.stack)})),Pp=Xe,Mp=Vt,Up=Yr,Lp=Ye,Vp=Rc,Fp=xi,Bp=Ep,jp=Rp,Gp=function(e,t){Tp(t)&&"cause"in t&&Ip(e,"cause",t.cause)},Hp=xp,zp=Dp,Kp=Yi,Wp=$i,Xp=function(e,t,r,n){var i=n?2:1,o=e.split("."),a=o[o.length-1],s=Pp.apply(null,o);if(s){var u=s.prototype;if(Mp(u,"cause")&&delete u.cause,!r)return s;var c=Pp("Error"),d=t((function(e,t){var r=jp(n?t:e,void 0),o=n?new s(e):new s;return void 0!==r&&Up(o,"message",r),zp&&Up(o,"stack",Hp(o.stack,2)),this&&Lp(u,this)&&Bp(o,this,d),arguments.length>i&&Gp(o,arguments[i]),o}));d.prototype=u,"Error"!==a&&(Vp?Vp(d,c):Fp(d,c,{name:!0})),Fp(d,s);try{u.name!==a&&Up(u,"name",a),u.constructor=d}catch(RY){}return d}},Yp="WebAssembly",qp=oe.WebAssembly,Jp=7!==Error("e",{cause:7}).cause,Qp=function(e,t){var r={};r[e]=Xp(e,t,Jp),Kp({global:!0,forced:Jp},r)},Zp=function(e,t){if(qp&&qp[e]){var r={};r[e]=Xp("WebAssembly."+e,t,Jp),Kp({target:Yp,stat:!0,forced:Jp},r)}};Qp("Error",(function(e){return function(t){return Wp(e,this,arguments)}})),Qp("EvalError",(function(e){return function(t){return Wp(e,this,arguments)}})),Qp("RangeError",(function(e){return function(t){return Wp(e,this,arguments)}})),Qp("ReferenceError",(function(e){return function(t){return Wp(e,this,arguments)}})),Qp("SyntaxError",(function(e){return function(t){return Wp(e,this,arguments)}})),Qp("TypeError",(function(e){return function(t){return Wp(e,this,arguments)}})),Qp("URIError",(function(e){return function(t){return Wp(e,this,arguments)}})),Zp("CompileError",(function(e){return function(t){return Wp(e,this,arguments)}})),Zp("LinkError",(function(e){return function(t){return Wp(e,this,arguments)}})),Zp("RuntimeError",(function(e){return function(t){return Wp(e,this,arguments)}}));var $p=se,e_=function(e,t){var r=[][e];return!!r&&$p((function(){r.call(null,t||function(){throw 1},1)}))},t_=Xa.forEach,r_=e_("forEach")?[].forEach:function(e){return t_(this,e,arguments.length>1?arguments[1]:void 0)},n_=oe,i_=Sd,o_=kd,a_=r_,s_=Yr,u_=function(e){if(e&&e.forEach!==a_)try{s_(e,"forEach",a_)}catch(RY){e.forEach=a_}};for(var c_ in i_)i_[c_]&&u_(n_[c_]&&n_[c_].prototype);u_(o_);var d_=se,l_=rt,h_=er("species"),f_=function(e){return l_>=51||!d_((function(){var t=[];return(t.constructor={})[h_]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},p_=Yi,__=oe,v_=to,m_=xa,g_=He,y_=ei,S_=oi,b_=Be,E_=zo,k_=er,R_=ra,T_=f_("slice"),I_=k_("species"),A_=__.Array,w_=Math.max;p_({target:"Array",proto:!0,forced:!T_},{slice:function(e,t){var r,n,i,o=b_(this),a=S_(o),s=y_(e,a),u=y_(void 0===t?a:t,a);if(v_(o)&&(r=o.constructor,(m_(r)&&(r===A_||v_(r.prototype))||g_(r)&&null===(r=r[I_]))&&(r=void 0),r===A_||void 0===r))return R_(o,s,u);for(n=new(void 0===r?A_:r)(w_(u-s,0)),i=0;s<u;s++,i++)s in o&&E_(n,i,o[s]);return n.length=i,n}}),Yi({global:!0},{globalThis:oe});!function(e){var t=function(e){var t,r=Object.prototype,n=r.hasOwnProperty,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(LU){c=function(e,t,r){return e[t]=r}}function d(e,t,r,n){var i=t&&t.prototype instanceof m?t:m,o=Object.create(i.prototype),a=new C(n||[]);return o._invoke=function(e,t,r){var n=h;return function(i,o){if(n===p)throw new Error("Generator is already running");if(n===_){if("throw"===i)throw o;return x()}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var s=I(a,r);if(s){if(s===v)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===h)throw n=_,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=p;var u=l(e,t,r);if("normal"===u.type){if(n=r.done?_:f,u.arg===v)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n=_,r.method="throw",r.arg=u.arg)}}}(e,r,a),o}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(LU){return{type:"throw",arg:LU}}}e.wrap=d;var h="suspendedStart",f="suspendedYield",p="executing",_="completed",v={};function m(){}function g(){}function y(){}var S={};c(S,a,(function(){return this}));var b=Object.getPrototypeOf,E=b&&b(b(O([])));E&&E!==r&&n.call(E,a)&&(S=E);var k=y.prototype=m.prototype=Object.create(S);function R(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function T(e,t){function r(i,a,s,u){var c=l(e[i],e,a);if("throw"!==c.type){var d=c.arg,h=d.value;return h&&"object"===o(h)&&n.call(h,"__await")?t.resolve(h.__await).then((function(e){r("next",e,s,u)}),(function(e){r("throw",e,s,u)})):t.resolve(h).then((function(e){d.value=e,s(d)}),(function(e){return r("throw",e,s,u)}))}u(c.arg)}var i;this._invoke=function(e,n){function o(){return new t((function(t,i){r(e,n,t,i)}))}return i=i?i.then(o,o):o()}}function I(e,r){var n=e.iterator[r.method];if(n===t){if(r.delegate=null,"throw"===r.method){if(e.iterator.return&&(r.method="return",r.arg=t,I(e,r),"throw"===r.method))return v;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return v}var i=l(n,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,v;var o=i.arg;return o?o.done?(r[e.resultName]=o.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,v):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,v)}function A(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 w(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function C(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(A,this),this.reset(!0)}function O(e){if(e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,o=function r(){for(;++i<e.length;)if(n.call(e,i))return r.value=e[i],r.done=!1,r;return r.value=t,r.done=!0,r};return o.next=o}}return{next:x}}function x(){return{value:t,done:!0}}return g.prototype=y,c(k,"constructor",y),c(y,"constructor",g),g.displayName=c(y,u,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,y):(e.__proto__=y,c(e,u,"GeneratorFunction")),e.prototype=Object.create(k),e},e.awrap=function(e){return{__await:e}},R(T.prototype),c(T.prototype,s,(function(){return this})),e.AsyncIterator=T,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var a=new T(d(t,r,n,i),o);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},R(k),c(k,u,"Generator"),c(k,a,(function(){return this})),c(k,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=O,C.prototype={constructor:C,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(w),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},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 r=this;function i(n,i){return s.type="throw",s.arg=e,r.next=n,i&&(r.method="next",r.arg=t),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),c=n.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var 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,v):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),v},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),w(r),v}},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;w(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:O(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),v}},e}(e.exports);try{regeneratorRuntime=t}catch(r){"object"===("undefined"==typeof globalThis?"undefined":o(globalThis))?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}}({exports:{}});var C_=di.includes,O_=zu;Yi({target:"Array",proto:!0},{includes:function(e){return C_(this,e,arguments.length>1?arguments[1]:void 0)}}),O_("includes");var x_=He,N_=Ce,D_=er("match"),P_=function(e){var t;return x_(e)&&(void 0!==(t=e[D_])?!!t:"RegExp"==N_(e))},M_=P_,U_=oe.TypeError,L_=function(e){if(M_(e))throw U_("The method doesn't accept regular expressions");return e},V_=er("match"),F_=function(e){var t=/./;try{"/./"[e](t)}catch(r){try{return t[V_]=!1,"/./"[e](t)}catch(n){}}return!1},B_=Yi,j_=L_,G_=Le,H_=_o,z_=F_,K_=Te("".indexOf);B_({target:"String",proto:!0,forced:!z_("includes")},{includes:function(e){return!!~K_(H_(G_(this)),H_(j_(e)),arguments.length>1?arguments[1]:void 0)}});var W_=Pr,X_=function(){var e=W_(this),t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.sticky&&(t+="y"),t},Y_=se,q_=oe.RegExp,J_=Y_((function(){var e=q_("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),Q_=J_||Y_((function(){return!q_("a","y").sticky})),Z_=J_||Y_((function(){var e=q_("^r","gy");return e.lastIndex=2,null!=e.exec("str")})),$_={BROKEN_CARET:Z_,MISSED_STICKY:Q_,UNSUPPORTED_Y:J_},ev=se,tv=oe.RegExp,rv=ev((function(){var e=tv(".","s");return!(e.dotAll&&e.exec("\n")&&"s"===e.flags)})),nv=se,iv=oe.RegExp,ov=nv((function(){var e=iv("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")})),av=he,sv=Te,uv=_o,cv=X_,dv=$_,lv=Tt.exports,hv=Fo,fv=On.get,pv=rv,_v=ov,vv=lv("native-string-replace",String.prototype.replace),mv=RegExp.prototype.exec,gv=mv,yv=sv("".charAt),Sv=sv("".indexOf),bv=sv("".replace),Ev=sv("".slice),kv=function(){var e=/a/,t=/b*/g;return av(mv,e,"a"),av(mv,t,"a"),0!==e.lastIndex||0!==t.lastIndex}(),Rv=dv.BROKEN_CARET,Tv=void 0!==/()??/.exec("")[1];(kv||Tv||Rv||pv||_v)&&(gv=function(e){var t,r,n,i,o,a,s,u=this,c=fv(u),d=uv(e),l=c.raw;if(l)return l.lastIndex=u.lastIndex,t=av(gv,l,d),u.lastIndex=l.lastIndex,t;var h=c.groups,f=Rv&&u.sticky,p=av(cv,u),_=u.source,v=0,m=d;if(f&&(p=bv(p,"y",""),-1===Sv(p,"g")&&(p+="g"),m=Ev(d,u.lastIndex),u.lastIndex>0&&(!u.multiline||u.multiline&&"\n"!==yv(d,u.lastIndex-1))&&(_="(?: "+_+")",m=" "+m,v++),r=new RegExp("^(?:"+_+")",p)),Tv&&(r=new RegExp("^"+_+"$(?!\\s)",p)),kv&&(n=u.lastIndex),i=av(mv,f?r:u,m),f?i?(i.input=Ev(i.input,v),i[0]=Ev(i[0],v),i.index=u.lastIndex,u.lastIndex+=i[0].length):u.lastIndex=0:kv&&i&&(u.lastIndex=u.global?i.index+i[0].length:n),Tv&&i&&i.length>1&&av(vv,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=hv(null),o=0;o<h.length;o++)a[(s=h[o])[0]]=i[s[1]];return i});var Iv=gv;Yi({target:"RegExp",proto:!0,forced:/./.exec!==Iv},{exec:Iv});var Av=Te,wv=qr.exports,Cv=Iv,Ov=se,xv=er,Nv=Yr,Dv=xv("species"),Pv=RegExp.prototype,Mv=function(e,t,r,n){var i=xv(e),o=!Ov((function(){var t={};return t[i]=function(){return 7},7!=""[e](t)})),a=o&&!Ov((function(){var t=!1,r=/a/;return"split"===e&&((r={}).constructor={},r.constructor[Dv]=function(){return r},r.flags="",r[i]=/./[i]),r.exec=function(){return t=!0,null},r[i](""),!t}));if(!o||!a||r){var s=Av(/./[i]),u=t(i,""[e],(function(e,t,r,n,i){var a=Av(e),u=t.exec;return u===Cv||u===Pv.exec?o&&!i?{done:!0,value:s(t,r,n)}:{done:!0,value:a(r,t,n)}:{done:!1}}));wv(String.prototype,e,u[0]),wv(Pv,i,u[1])}n&&Nv(Pv[i],"sham",!0)},Uv=Object.is||function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t},Lv=he,Vv=Pr,Fv=je,Bv=Ce,jv=Iv,Gv=oe.TypeError,Hv=function(e,t){var r=e.exec;if(Fv(r)){var n=Lv(r,e,t);return null!==n&&Vv(n),n}if("RegExp"===Bv(e))return Lv(jv,e,t);throw Gv("RegExp#exec called on incompatible receiver")},zv=he,Kv=Pr,Wv=Le,Xv=Uv,Yv=_o,qv=St,Jv=Hv;Mv("search",(function(e,t,r){return[function(t){var r=Wv(this),n=null==t?void 0:qv(t,e);return n?zv(n,t,r):new RegExp(t)[e](Yv(r))},function(e){var n=Kv(this),i=Yv(e),o=r(t,n,i);if(o.done)return o.value;var a=n.lastIndex;Xv(a,0)||(n.lastIndex=0);var s=Jv(n,i);return Xv(n.lastIndex,a)||(n.lastIndex=a),null===s?-1:s.index}]}));var Qv=hd.charAt,Zv=function(e,t,r){return t+(r?Qv(e,t).length:1)},$v=he,em=Pr,tm=ni,rm=_o,nm=Le,im=St,om=Zv,am=Hv;Mv("match",(function(e,t,r){return[function(t){var r=nm(this),n=null==t?void 0:im(t,e);return n?$v(n,t,r):new RegExp(t)[e](rm(r))},function(e){var n=em(this),i=rm(e),o=r(t,n,i);if(o.done)return o.value;if(!n.global)return am(n,i);var a=n.unicode;n.lastIndex=0;for(var s,u=[],c=0;null!==(s=am(n,i));){var d=rm(s[0]);u[c]=d,""===d&&(n.lastIndex=om(i,tm(n.lastIndex),a)),c++}return 0===c?null:u}]}));var sm="\t\n\v\f\r                 \u2028\u2029\ufeff",um=Le,cm=_o,dm=Te("".replace),lm="[\t\n\v\f\r                 \u2028\u2029\ufeff]",hm=RegExp("^"+lm+lm+"*"),fm=RegExp(lm+lm+"*$"),pm=function(e){return function(t){var r=cm(um(t));return 1&e&&(r=dm(r,hm,"")),2&e&&(r=dm(r,fm,"")),r}},_m={start:pm(1),end:pm(2),trim:pm(3)},vm=oe,mm=se,gm=Te,ym=_o,Sm=_m.trim,bm=sm,Em=vm.parseInt,km=vm.Symbol,Rm=km&&km.iterator,Tm=/^[+-]?0x/i,Im=gm(Tm.exec),Am=8!==Em(bm+"08")||22!==Em(bm+"0x16")||Rm&&!mm((function(){Em(Object(Rm))}))?function(e,t){var r=Sm(ym(e));return Em(r,t>>>0||(Im(Tm,r)?16:10))}:Em;Yi({global:!0,forced:parseInt!=Am},{parseInt:Am});var wm={exports:{}},Cm=se((function(){if("function"==typeof ArrayBuffer){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}})),Om=se,xm=He,Nm=Ce,Dm=Cm,Pm=Object.isExtensible,Mm=Om((function(){Pm(1)}))||Dm?function(e){return!!xm(e)&&((!Dm||"ArrayBuffer"!=Nm(e))&&(!Pm||Pm(e)))}:Pm,Um=!se((function(){return Object.isExtensible(Object.preventExtensions({}))})),Lm=Yi,Vm=Te,Fm=hn,Bm=He,jm=Vt,Gm=wr.f,Hm=Xn,zm=Bo,Km=Mm,Wm=Um,Xm=!1,Ym=Ht("meta"),qm=0,Jm=function(e){Gm(e,Ym,{value:{objectID:"O"+qm++,weakData:{}}})},Qm=wm.exports={enable:function(){Qm.enable=function(){},Xm=!0;var e=Hm.f,t=Vm([].splice),r={};r[Ym]=1,e(r).length&&(Hm.f=function(r){for(var n=e(r),i=0,o=n.length;i<o;i++)if(n[i]===Ym){t(n,i,1);break}return n},Lm({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:zm.f}))},fastKey:function(e,t){if(!Bm(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!jm(e,Ym)){if(!Km(e))return"F";if(!t)return"E";Jm(e)}return e[Ym].objectID},getWeakData:function(e,t){if(!jm(e,Ym)){if(!Km(e))return!0;if(!t)return!1;Jm(e)}return e[Ym].weakData},onFreeze:function(e){return Wm&&Xm&&Km(e)&&!jm(e,Ym)&&Jm(e),e}};Fm[Ym]=!0;var Zm=Yi,$m=oe,eg=Te,tg=Bi,rg=qr.exports,ng=wm.exports,ig=xl,og=Qd,ag=je,sg=He,ug=se,cg=Bl,dg=fa,lg=Ep,hg=function(e,t,r){var n=-1!==e.indexOf("Map"),i=-1!==e.indexOf("Weak"),o=n?"set":"add",a=$m[e],s=a&&a.prototype,u=a,c={},d=function(e){var t=eg(s[e]);rg(s,e,"add"==e?function(e){return t(this,0===e?0:e),this}:"delete"==e?function(e){return!(i&&!sg(e))&&t(this,0===e?0:e)}:"get"==e?function(e){return i&&!sg(e)?void 0:t(this,0===e?0:e)}:"has"==e?function(e){return!(i&&!sg(e))&&t(this,0===e?0:e)}:function(e,r){return t(this,0===e?0:e,r),this})};if(tg(e,!ag(a)||!(i||s.forEach&&!ug((function(){(new a).entries().next()})))))u=r.getConstructor(t,e,n,o),ng.enable();else if(tg(e,!0)){var l=new u,h=l[o](i?{}:-0,1)!=l,f=ug((function(){l.has(1)})),p=cg((function(e){new a(e)})),_=!i&&ug((function(){for(var e=new a,t=5;t--;)e[o](t,t);return!e.has(-0)}));p||((u=t((function(e,t){og(e,s);var r=lg(new a,e,u);return null!=t&&ig(t,r[o],{that:r,AS_ENTRIES:n}),r}))).prototype=s,s.constructor=u),(f||_)&&(d("delete"),d("has"),n&&d("get")),(_||h)&&d(o),i&&s.clear&&delete s.clear}return c[e]=u,Zm({global:!0,forced:u!=a},c),dg(u,e),i||r.setStrong(u,e,n),u},fg=wr.f,pg=Fo,_g=Hd,vg=ma,mg=Qd,gg=xl,yg=Kc,Sg=Yd,bg=ue,Eg=wm.exports.fastKey,kg=On.set,Rg=On.getterFor,Tg={getConstructor:function(e,t,r,n){var i=e((function(e,i){mg(e,o),kg(e,{type:t,index:pg(null),first:void 0,last:void 0,size:0}),bg||(e.size=0),null!=i&&gg(i,e[n],{that:e,AS_ENTRIES:r})})),o=i.prototype,a=Rg(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=Eg(t,!0),key:t,value:r,previous:n=o.last,next:void 0,removed:!1},o.first||(o.first=s),n&&(n.next=s),bg?o.size++:e.size++,"F"!==i&&(o.index[i]=s)),e},u=function(e,t){var r,n=a(e),i=Eg(t);if("F"!==i)return n.index[i];for(r=n.first;r;r=r.next)if(r.key==t)return r};return _g(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,bg?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),bg?r.size--:t.size--}return!!n},forEach:function(e){for(var t,r=a(this),n=vg(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)}}),_g(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)}}),bg&&fg(o,"size",{get:function(){return a(this).size}}),i},setStrong:function(e,t,r){var n=t+" Iterator",i=Rg(t),o=Rg(n);yg(e,t,(function(e,t){kg(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)?"keys"==t?{value:r.key,done:!1}:"values"==t?{value:r.value,done:!1}:{value:[r.key,r.value],done:!1}:(e.target=void 0,{value:void 0,done:!0})}),r?"entries":"values",!r,!0),Sg(t)}};hg("Map",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),Tg);var Ig=Mt,Ag=yo;Yi({target:"Object",stat:!0,forced:se((function(){Ag(1)}))},{keys:function(e){return Ag(Ig(e))}});var wg=gt,Cg=Mt,Og=Me,xg=oi,Ng=oe.TypeError,Dg=function(e){return function(t,r,n,i){wg(r);var o=Cg(t),a=Og(o),s=xg(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 Ng("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}},Pg={left:Dg(!1),right:Dg(!0)},Mg=Pg.left,Ug=rt,Lg=Zl;Yi({target:"Array",proto:!0,forced:!e_("reduce")||!Lg&&Ug>79&&Ug<83},{reduce:function(e){var t=arguments.length;return Mg(this,e,t,t>1?arguments[1]:void 0)}});var Vg=ue,Fg=Te,Bg=he,jg=se,Gg=yo,Hg=Si,zg=fe,Kg=Mt,Wg=Me,Xg=Object.assign,Yg=Object.defineProperty,qg=Fg([].concat),Jg=!Xg||jg((function(){if(Vg&&1!==Xg({b:1},Xg(Yg({},"a",{enumerable:!0,get:function(){Yg(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!=Xg({},e)[r]||Gg(Xg({},t)).join("")!=n}))?function(e,t){for(var r=Kg(e),n=arguments.length,i=1,o=Hg.f,a=zg.f;n>i;)for(var s,u=Wg(arguments[i++]),c=o?qg(Gg(u),o(u)):Gg(u),d=c.length,l=0;d>l;)s=c[l++],Vg&&!Bg(a,u,s)||(r[s]=u[s]);return r}:Xg,Qg=Jg;Yi({target:"Object",stat:!0,forced:Object.assign!==Qg},{assign:Qg});var Zg=Yi,$g=Te,ey=ae.f,ty=ni,ry=_o,ny=L_,iy=Le,oy=F_,ay=$g("".endsWith),sy=$g("".slice),uy=Math.min,cy=oy("endsWith"),dy=!cy&&!!function(){var e=ey(String.prototype,"endsWith");return e&&!e.writable}();Zg({target:"String",proto:!0,forced:!dy&&!cy},{endsWith:function(e){var t=ry(iy(this));ny(e);var r=arguments.length>1?arguments[1]:void 0,n=t.length,i=void 0===r?n:uy(ty(r),n),o=ry(e);return ay?ay(t,o,i):sy(t,i-o.length,i)===o}});var ly=!0,hy=!0;function fy(e,t,r){var n=e.match(t);return n&&n.length>=r&&parseInt(n[r],10)}function py(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 _y(e){return"boolean"!=typeof e?new Error("Argument type: "+o(e)+". Please use a boolean."):(ly=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function vy(e){return"boolean"!=typeof e?new Error("Argument type: "+o(e)+". Please use a boolean."):(hy=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function my(){if("object"===("undefined"==typeof window?"undefined":o(window))){if(ly)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function gy(e,t){hy&&console.warn(e+" is deprecated, please use "+t+" instead.")}function yy(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=fy(r.userAgent,/Firefox\/(\d+)\./,1);else if(r.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection&&!e.RTCIceGatherer)t.browser="chrome",t.version=fy(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=fy(r.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return t}function Sy(e){return"[object Object]"===Object.prototype.toString.call(e)}function by(e){return Sy(e)?Object.keys(e).reduce((function(t,r){var n=Sy(e[r]),i=n?by(e[r]):e[r],o=n&&!Object.keys(i).length;return void 0===i||o?t:Object.assign(t,l({},r,i))}),{}):e}function Ey(e,t,r){t&&!r.has(t.id)&&(r.set(t.id,t),Object.keys(t).forEach((function(n){n.endsWith("Id")?Ey(e,e.get(t[n]),r):n.endsWith("Ids")&&t[n].forEach((function(t){Ey(e,e.get(t),r)}))})))}function ky(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&&Ey(e,r,i)}))})),i}var Ry=Yi,Ty=Xa.find,Iy=zu,Ay="find",wy=!0;Ay in[]&&Array(1).find((function(){wy=!1})),Ry({target:"Array",proto:!0,forced:wy},{find:function(e){return Ty(this,e,arguments.length>1?arguments[1]:void 0)}}),Iy(Ay);var Cy=Yi,Oy=di.indexOf,xy=e_,Ny=Te([].indexOf),Dy=!!Ny&&1/Ny([1],1,-0)<0,Py=xy("indexOf");Cy({target:"Array",proto:!0,forced:Dy||!Py},{indexOf:function(e){var t=arguments.length>1?arguments[1]:void 0;return Dy?Ny(this,e,t)||0:Oy(this,e,t)}});var My=Yi,Uy=oe,Ly=ei,Vy=Jn,Fy=oi,By=Mt,jy=Fa,Gy=zo,Hy=f_("splice"),zy=Uy.TypeError,Ky=Math.max,Wy=Math.min,Xy=9007199254740991,Yy="Maximum allowed length exceeded";My({target:"Array",proto:!0,forced:!Hy},{splice:function(e,t){var r,n,i,o,a,s,u=By(this),c=Fy(u),d=Ly(e,c),l=arguments.length;if(0===l?r=n=0:1===l?(r=0,n=c-d):(r=l-2,n=Wy(Ky(Vy(t),0),c-d)),c+r-n>Xy)throw zy(Yy);for(i=jy(u,n),o=0;o<n;o++)(a=d+o)in u&&Gy(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]:delete u[s];for(o=c;o>c-n+r;o--)delete 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]:delete u[s];for(o=0;o<r;o++)u[o+d]=arguments[o+2];return u.length=c-n+r,i}});var qy=Xa.map;Yi({target:"Array",proto:!0,forced:!f_("map")},{map:function(e){return qy(this,e,arguments.length>1?arguments[1]:void 0)}});var Jy=Zl,Qy=ue,Zy=se,$y=Pr,eS=Fo,tS=Rp,rS=Error.prototype.toString,nS=Zy((function(){if(Qy){var e=eS(Object.defineProperty({},"name",{get:function(){return this===e}}));if("true"!==rS.call(e))return!0}return"2: 1"!==rS.call({message:1,name:2})||"Error"!==rS.call({})}))?function(){var e=$y(this),t=tS(e.name,"Error"),r=tS(e.message);return t?r?t+": "+r:t:r}:rS,iS={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}},oS=Yi,aS=function(e){try{if(Jy)return Function('return require("'+e+'")')()}catch(RY){}},sS=Xe,uS=se,cS=Fo,dS=ye,lS=wr.f,hS=vo.f,fS=qr.exports,pS=Vt,_S=Qd,vS=Pr,mS=nS,gS=Rp,yS=iS,SS=xp,bS=On,ES=ue,kS="DOMException",RS="DATA_CLONE_ERR",TS=sS("Error"),IS=sS(kS)||function(){try{(new(sS("MessageChannel")||aS("worker_threads").MessageChannel)).port1.postMessage(new WeakMap)}catch(RY){if(RY.name==RS&&25==RY.code)return RY.constructor}}(),AS=IS&&IS.prototype,wS=TS.prototype,CS=bS.set,OS=bS.getterFor(kS),xS="stack"in TS(kS),NS=function(e){return pS(yS,e)&&yS[e].m?yS[e].c:0},DS=function(){_S(this,PS);var e=arguments.length,t=gS(e<1?void 0:arguments[0]),r=gS(e<2?void 0:arguments[1],"Error"),n=NS(r);if(CS(this,{type:kS,name:r,message:t,code:n}),ES||(this.name=r,this.message=t,this.code=n),xS){var i=TS(t);i.name=kS,lS(this,"stack",dS(1,SS(i.stack,1)))}},PS=DS.prototype=cS(wS),MS=function(e){return{enumerable:!0,configurable:!0,get:e}},US=function(e){return MS((function(){return OS(this)[e]}))};ES&&hS(PS,{name:US("name"),message:US("message"),code:US("code")}),lS(PS,"constructor",dS(1,DS));var LS=uS((function(){return!(new IS instanceof TS)})),VS=LS||uS((function(){return wS.toString!==mS||"2: 1"!==String(new IS(1,2))})),FS=LS||uS((function(){return 25!==new IS(1,"DataCloneError").code}));LS||25!==IS.DATA_CLONE_ERR||AS.DATA_CLONE_ERR;oS({global:!0,forced:LS},{DOMException:LS?DS:IS});var BS=sS(kS),jS=BS.prototype;for(var GS in VS&&IS===BS&&fS(jS,"toString",mS),FS&&ES&&IS===BS&&lS(jS,"code",MS((function(){return NS(vS(this).name)}))),yS)if(pS(yS,GS)){var HS=yS[GS],zS=HS.s,KS=dS(6,HS.c);pS(BS,zS)||lS(BS,zS,KS),pS(jS,zS)||lS(jS,zS,KS)}var WS=Yi,XS=Xe,YS=ye,qS=wr.f,JS=Vt,QS=Qd,ZS=Ep,$S=Rp,eb=iS,tb=xp,rb="DOMException",nb=XS("Error"),ib=XS(rb),ob=function(){QS(this,ab);var e=arguments.length,t=$S(e<1?void 0:arguments[0]),r=$S(e<2?void 0:arguments[1],"Error"),n=new ib(t,r),i=nb(t);return i.name=rb,qS(n,"stack",YS(1,tb(i.stack,1))),ZS(n,this,ob),n},ab=ob.prototype=ib.prototype,sb="stack"in nb(rb),ub="stack"in new ib(1,2),cb=sb&&!ub;WS({global:!0,forced:cb},{DOMException:cb?ob:ib});var db=XS(rb),lb=db.prototype;if(lb.constructor!==db)for(var hb in qS(lb,"constructor",YS(1,db)),eb)if(JS(eb,hb)){var fb=eb[hb],pb=fb.s;JS(db,pb)||qS(db,pb,YS(6,fb.c))}var _b="DOMException";fa(Xe(_b),_b);var vb=Xa.filter;Yi({target:"Array",proto:!0,forced:!f_("filter")},{filter:function(e){return vb(this,e,arguments.length>1?arguments[1]:void 0)}});var mb=Yi,gb=oe,yb=se,Sb=to,bb=He,Eb=Mt,kb=oi,Rb=zo,Tb=Fa,Ib=f_,Ab=rt,wb=er("isConcatSpreadable"),Cb=9007199254740991,Ob="Maximum allowed index exceeded",xb=gb.TypeError,Nb=Ab>=51||!yb((function(){var e=[];return e[wb]=!1,e.concat()[0]!==e})),Db=Ib("concat"),Pb=function(e){if(!bb(e))return!1;var t=e[wb];return void 0!==t?!!t:Sb(e)};mb({target:"Array",proto:!0,forced:!Nb||!Db},{concat:function(e){var t,r,n,i,o,a=Eb(this),s=Tb(a,0),u=0;for(t=-1,n=arguments.length;t<n;t++)if(Pb(o=-1===t?a:arguments[t])){if(u+(i=kb(o))>Cb)throw xb(Ob);for(r=0;r<i;r++,u++)r in o&&Rb(s,u,o[r])}else{if(u>=Cb)throw xb(Ob);Rb(s,u++,o)}return s.length=u,s}});var Mb=Te,Ub=Mt,Lb=Math.floor,Vb=Mb("".charAt),Fb=Mb("".replace),Bb=Mb("".slice),jb=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,Gb=/\$([$&'`]|\d{1,2})/g,Hb=$i,zb=he,Kb=Te,Wb=Mv,Xb=se,Yb=Pr,qb=je,Jb=Jn,Qb=ni,Zb=_o,$b=Le,eE=Zv,tE=St,rE=function(e,t,r,n,i,o){var a=r+e.length,s=n.length,u=Gb;return void 0!==i&&(i=Ub(i),u=jb),Fb(o,u,(function(o,u){var c;switch(Vb(u,0)){case"$":return"$";case"&":return e;case"`":return Bb(t,0,r);case"'":return Bb(t,a);case"<":c=i[Bb(u,1,-1)];break;default:var d=+u;if(0===d)return o;if(d>s){var l=Lb(d/10);return 0===l?o:l<=s?void 0===n[l-1]?Vb(u,1):n[l-1]+Vb(u,1):o}c=n[d-1]}return void 0===c?"":c}))},nE=Hv,iE=er("replace"),oE=Math.max,aE=Math.min,sE=Kb([].concat),uE=Kb([].push),cE=Kb("".indexOf),dE=Kb("".slice),lE="$0"==="a".replace(/./,"$0"),hE=!!/./[iE]&&""===/./[iE]("a","$0"),fE=!Xb((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")}));Wb("replace",(function(e,t,r){var n=hE?"$":"$0";return[function(e,r){var n=$b(this),i=null==e?void 0:tE(e,iE);return i?zb(i,e,n,r):zb(t,Zb(n),e,r)},function(e,i){var o=Yb(this),a=Zb(e);if("string"==typeof i&&-1===cE(i,n)&&-1===cE(i,"$<")){var s=r(t,o,a,i);if(s.done)return s.value}var u=qb(i);u||(i=Zb(i));var c=o.global;if(c){var d=o.unicode;o.lastIndex=0}for(var l=[];;){var h=nE(o,a);if(null===h)break;if(uE(l,h),!c)break;""===Zb(h[0])&&(o.lastIndex=eE(a,Qb(o.lastIndex),d))}for(var f,p="",_=0,v=0;v<l.length;v++){for(var m=Zb((h=l[v])[0]),g=oE(aE(Jb(h.index),a.length),0),y=[],S=1;S<h.length;S++)uE(y,void 0===(f=h[S])?f:String(f));var b=h.groups;if(u){var E=sE([m],y,g,a);void 0!==b&&uE(E,b);var k=Zb(Hb(i,void 0,E))}else k=rE(m,a,g,y,b,i);g>=_&&(p+=dE(a,_,g)+k,_=g+m.length)}return p+dE(a,_)}]}),!fE||!lE||hE);var pE=ue,_E=oe,vE=Te,mE=Bi,gE=Ep,yE=Yr,SE=wr.f,bE=Xn.f,EE=Ye,kE=P_,RE=_o,TE=X_,IE=$_,AE=qr.exports,wE=se,CE=Vt,OE=On.enforce,xE=Yd,NE=rv,DE=ov,PE=er("match"),ME=_E.RegExp,UE=ME.prototype,LE=_E.SyntaxError,VE=vE(TE),FE=vE(UE.exec),BE=vE("".charAt),jE=vE("".replace),GE=vE("".indexOf),HE=vE("".slice),zE=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,KE=/a/g,WE=/a/g,XE=new ME(KE)!==KE,YE=IE.MISSED_STICKY,qE=IE.UNSUPPORTED_Y,JE=pE&&(!XE||YE||NE||DE||wE((function(){return WE[PE]=!1,ME(KE)!=KE||ME(WE)==WE||"/a/i"!=ME(KE,"i")})));if(mE("RegExp",JE)){for(var QE=function(e,t){var r,n,i,o,a,s,u=EE(UE,this),c=kE(e),d=void 0===t,l=[],h=e;if(!u&&c&&d&&e.constructor===QE)return e;if((c||EE(UE,e))&&(e=e.source,d&&(t="flags"in h?h.flags:VE(h))),e=void 0===e?"":RE(e),t=void 0===t?"":RE(t),h=e,NE&&"dotAll"in KE&&(n=!!t&&GE(t,"s")>-1)&&(t=jE(t,/s/g,"")),r=t,YE&&"sticky"in KE&&(i=!!t&&GE(t,"y")>-1)&&qE&&(t=jE(t,/y/g,"")),DE&&(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=BE(e,n)))t+=BE(e,++n);else if("]"===t)s=!1;else if(!s)switch(!0){case"["===t:s=!0;break;case"("===t:FE(zE,HE(e,n+1))&&(n+=2,u=!0),i+=t,c++;continue;case">"===t&&u:if(""===d||CE(a,d))throw new LE("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=gE(ME(e,t),u?this:UE,QE),(n||i||l.length)&&(s=OE(a),n&&(s.dotAll=!0,s.raw=QE(function(e){for(var t,r=e.length,n=0,i="",o=!1;n<=r;n++)"\\"!==(t=BE(e,n))?o||"."!==t?("["===t?o=!0:"]"===t&&(o=!1),i+=t):i+="[\\s\\S]":i+=t+BE(e,++n);return i}(e),r)),i&&(s.sticky=!0),l.length&&(s.groups=l)),e!==h)try{yE(a,"source",""===h?"(?:)":h)}catch(RY){}return a},ZE=function(e){e in QE||SE(QE,e,{configurable:!0,get:function(){return ME[e]},set:function(t){ME[e]=t}})},$E=bE(ME),ek=0;$E.length>ek;)ZE($E[ek++]);UE.constructor=QE,QE.prototype=UE,AE(_E,"RegExp",QE)}xE("RegExp");var tk=oe,rk=ue,nk=rv,ik=Ce,ok=wr.f,ak=On.get,sk=RegExp.prototype,uk=tk.TypeError;rk&&nk&&ok(sk,"dotAll",{configurable:!0,get:function(){if(this!==sk){if("RegExp"===ik(this))return!!ak(this).dotAll;throw uk("Incompatible receiver, RegExp required")}}});var ck=oe,dk=ue,lk=$_.MISSED_STICKY,hk=Ce,fk=wr.f,pk=On.get,_k=RegExp.prototype,vk=ck.TypeError;dk&&lk&&fk(_k,"sticky",{configurable:!0,get:function(){if(this!==_k){if("RegExp"===hk(this))return!!pk(this).sticky;throw vk("Incompatible receiver, RegExp required")}}});var mk=Te,gk=Un.PROPER,yk=qr.exports,Sk=Pr,bk=Ye,Ek=_o,kk=se,Rk=X_,Tk="toString",Ik=RegExp.prototype,Ak=Ik.toString,wk=mk(Rk),Ck=kk((function(){return"/a/b"!=Ak.call({source:"a",flags:"b"})})),Ok=gk&&Ak.name!=Tk;(Ck||Ok)&&yk(RegExp.prototype,Tk,(function(){var e=Sk(this),t=Ek(e.source),r=e.flags;return"/"+t+"/"+Ek(void 0===r&&bk(Ik,e)&&!("flags"in Ik)?wk(e):r)}),{unsafe:!0});var xk=Yi,Nk=se,Dk=Be,Pk=ae.f,Mk=ue,Uk=Nk((function(){Pk(1)}));xk({target:"Object",stat:!0,forced:!Mk||Uk,sham:!Mk},{getOwnPropertyDescriptor:function(e,t){return Pk(Dk(e),t)}});var Lk=Yi,Vk=Xe,Fk=$i,Bk=Te,jk=se,Gk=oe.Array,Hk=Vk("JSON","stringify"),zk=Bk(/./.exec),Kk=Bk("".charAt),Wk=Bk("".charCodeAt),Xk=Bk("".replace),Yk=Bk(1..toString),qk=/[\uD800-\uDFFF]/g,Jk=/^[\uD800-\uDBFF]$/,Qk=/^[\uDC00-\uDFFF]$/,Zk=function(e,t,r){var n=Kk(r,t-1),i=Kk(r,t+1);return zk(Jk,e)&&!zk(Qk,i)||zk(Qk,e)&&!zk(Jk,n)?"\\u"+Yk(Wk(e,0),16):e},$k=jk((function(){return'"\\udf06\\ud834"'!==Hk("\udf06\ud834")||'"\\udead"'!==Hk("\udead")}));Hk&&Lk({target:"JSON",stat:!0,forced:$k},{stringify:function(e,t,r){for(var n=0,i=arguments.length,o=Gk(i);n<i;n++)o[n]=arguments[n];var a=Fk(Hk,null,o);return"string"==typeof a?Xk(a,qk,Zk):a}});var eR=my;function tR(e,t){var r=e&&e.navigator;if(r.mediaDevices){var n=function(e){if("object"!==o(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"===o(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 a={};"number"==typeof n.ideal?(a[i("min",r)]=n.ideal,t.optional.push(a),(a={})[i("max",r)]=n.ideal,t.optional.push(a)):(a[i("",r)]=n.ideal,t.optional.push(a))}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"===o(e.audio)){var a=function(e,t,r){t in e&&!(r in e)&&(e[r]=e[t],delete e[t])};a((e=JSON.parse(JSON.stringify(e))).audio,"autoGainControl","googAutoGainControl"),a(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=n(e.audio)}if(e&&"object"===o(e.video)){var s=e.video.facingMode;s=s&&("object"===o(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),eR("chrome: "+JSON.stringify(e)),i(e)}));e.video=n(e.video)}return eR("chrome: "+JSON.stringify(e)),i(e)},a=function(e){return t.version>=64?e:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[e.name]||e.name,message:e.message,constraint:e.constraint||e.constraintName,toString: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(a(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(a(e))}))}))}}}}function rR(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function nR(e){if("object"===o(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 py(e,"track",(function(e){return e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e}))}function iR(e){if("object"===o(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 a=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;this._senders=this._senders||[],a.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"===o(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 oR(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 aR(e){if("object"===o(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 ky(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}),py(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 ky(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 sR(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 uR(e,t){if(e.RTCPeerConnection){if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return sR(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=l({},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 cR(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=l({},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 dR(e,t){py(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 lR,hR,fR=Object.freeze(Object.defineProperty({__proto__:null,shimMediaStream:rR,shimOnTrack:nR,shimGetSendersWithDtmf:iR,shimGetStats:oR,shimSenderReceiverGetStats:aR,shimAddTrackRemoveTrackWithNative:sR,shimAddTrackRemoveTrack:uR,shimPeerConnection:cR,fixNegotiationNeeded:dR,shimGetUserMedia:tR,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"})),pR=Yi,_R=oe,vR=he,mR=Te,gR=je,yR=He,SR=(lR=!1,(hR=/[ac]/).exec=function(){return lR=!0,/./.exec.apply(this,arguments)},!0===hR.test("abc")&&lR),bR=_R.Error,ER=mR(/./.test);pR({target:"RegExp",proto:!0,forced:!SR},{test:function(e){var t=this.exec;if(!gR(t))return ER(this,e);var r=vR(t,this,e);if(null!==r&&!yR(r))throw new bR("RegExp exec method returned something other than an Object or null");return!!r}});var kR=oe,RR=se,TR=_o,IR=_m.trim,AR=Te("".charAt),wR=kR.parseFloat,CR=kR.Symbol,OR=CR&&CR.iterator,xR=1/wR("\t\n\v\f\r                 \u2028\u2029\ufeff-0")!=-1/0||OR&&!RR((function(){wR(Object(OR))}))?function(e){var t=IR(TR(e)),r=wR(t);return 0===r&&"-"==AR(t,0)?-0:r}:wR;Yi({global:!0,forced:parseFloat!=xR},{parseFloat:xR});var NR=Yi,DR=jd,PR=se,MR=Xe,UR=je,LR=Yl,VR=of,FR=qr.exports;if(NR({target:"Promise",proto:!0,real:!0,forced:!!DR&&PR((function(){DR.prototype.finally.call({then:function(){}},(function(){}))}))},{finally:function(e){var t=LR(this,MR("Promise")),r=UR(e);return this.then(r?function(r){return VR(t,e()).then((function(){return r}))}:e,r?function(r){return VR(t,e()).then((function(){throw r}))}:e)}}),UR(DR)){var BR=MR("Promise").prototype.finally;DR.prototype.finally!==BR&&FR(DR.prototype,"finally",BR,{unsafe:!0})}function jR(e,t){var r=e&&e.navigator,n=e&&e.MediaStreamTrack;if(r.getUserMedia=function(e,t,n){gy("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])},a=r.mediaDevices.getUserMedia.bind(r.mediaDevices);if(r.mediaDevices.getUserMedia=function(e){return"object"===o(e)&&"object"===o(e.audio)&&(e=JSON.parse(JSON.stringify(e)),i(e.audio,"autoGainControl","mozAutoGainControl"),i(e.audio,"noiseSuppression","mozNoiseSuppression")),a(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"===o(e)&&(e=JSON.parse(JSON.stringify(e)),i(e,"autoGainControl","mozAutoGainControl"),i(e,"noiseSuppression","mozNoiseSuppression")),u.apply(this,[e])}}}}function GR(e){"object"===o(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 HR(e,t){if("object"===o(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=l({},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 zR(e){if("object"===o(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 KR(e){if("object"===o(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}),py(e,"track",(function(e){return e.receiver._pc=e.srcElement,e})),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}}function WR(e){e.RTCPeerConnection&&!("removeStream"in e.RTCPeerConnection.prototype)&&(e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;gy("removeStream","removeTrack"),this.getSenders().forEach((function(r){r.track&&e.getTracks().includes(r.track)&&t.removeTrack(r)}))})}function XR(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function YR(e){if("object"===o(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.addTransceiver;t&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];var e=arguments[1],r=e&&"sendEncodings"in e;r&&e.sendEncodings.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.sendEncodings,i.sendEncodings=e.sendEncodings,this.setParametersPromises.push(i.setParameters(o).then((function(){delete i.sendEncodings})).catch((function(){delete i.sendEncodings}))))}return n})}}function qR(e){if("object"===o(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 JR(e){if("object"===o(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 QR(e){if("object"===o(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 ZR=Object.freeze(Object.defineProperty({__proto__:null,shimOnTrack:GR,shimPeerConnection:HR,shimSenderGetStats:zR,shimReceiverGetStats:KR,shimRemoveStream:WR,shimRTCDataChannel:XR,shimAddTransceiver:YR,shimGetParameters:qR,shimCreateOffer:JR,shimCreateAnswer:QR,shimGetUserMedia:jR,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 $R(e){if("object"===o(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 eT(e){if("object"===o(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 tT(e){if("object"===o(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype,r=t.createOffer,n=t.createAnswer,i=t.setLocalDescription,a=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=a.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 rT(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(nT(e))}}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,r,n){t.mediaDevices.getUserMedia(e).then(r,n)}.bind(t))}function nT(e){return e&&void 0!==e.video?Object.assign({},e,{video:by(e.video)}):e}function iT(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")?(gy("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"===o(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 aT(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 sT(e){"object"!==o(e)||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var uT=Object.freeze(Object.defineProperty({__proto__:null,shimLocalStreamsAPI:$R,shimRemoteStreamsAPI:eT,shimCallbacksAPI:tT,shimGetUserMedia:rT,shimConstraints:nT,shimRTCIceServerUrls:iT,shimTrackEventTransceiver:oT,shimCreateOfferLegacy:aT,shimAudioContext:sT},Symbol.toStringTag,{value:"Module"})),cT=he;Yi({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return cT(URL.prototype.toString,this)}});var dT=Te(1..valueOf),lT=ue,hT=oe,fT=Te,pT=Bi,_T=qr.exports,vT=Vt,mT=Ep,gT=Ye,yT=ht,ST=cr,bT=se,ET=Xn.f,kT=ae.f,RT=wr.f,TT=dT,IT=_m.trim,AT="Number",wT=hT.Number,CT=wT.prototype,OT=hT.TypeError,xT=fT("".slice),NT=fT("".charCodeAt),DT=function(e){var t=ST(e,"number");return"bigint"==typeof t?t:PT(t)},PT=function(e){var t,r,n,i,o,a,s,u,c=ST(e,"number");if(yT(c))throw OT("Cannot convert a Symbol value to a number");if("string"==typeof c&&c.length>2)if(c=IT(c),43===(t=NT(c,0))||45===t){if(88===(r=NT(c,2))||120===r)return NaN}else if(48===t){switch(NT(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=xT(c,2)).length,s=0;s<a;s++)if((u=NT(o,s))<48||u>i)return NaN;return parseInt(o,n)}return+c};if(pT(AT,!wT(" 0o1")||!wT("0b1")||wT("+0x1"))){for(var MT,UT=function(e){var t=arguments.length<1?0:wT(DT(e)),r=this;return gT(CT,r)&&bT((function(){TT(r)}))?mT(Object(t),r,UT):t},LT=lT?ET(wT):"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(","),VT=0;LT.length>VT;VT++)vT(wT,MT=LT[VT])&&!vT(UT,MT)&&RT(UT,MT,kT(wT,MT));UT.prototype=CT,CT.constructor=UT,_T(hT,AT,UT)}var FT=$i,BT=he,jT=Te,GT=Mv,HT=P_,zT=Pr,KT=Le,WT=Yl,XT=Zv,YT=ni,qT=_o,JT=St,QT=Jo,ZT=Hv,$T=Iv,eI=se,tI=$_.UNSUPPORTED_Y,rI=4294967295,nI=Math.min,iI=[].push,oI=jT(/./.exec),aI=jT(iI),sI=jT("".slice),uI=!eI((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]}));GT("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=qT(KT(this)),i=void 0===r?rI:r>>>0;if(0===i)return[];if(void 0===e)return[n];if(!HT(e))return BT(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=BT($T,l,n))&&!((a=l.lastIndex)>d&&(aI(u,sI(n,d,o.index)),o.length>1&&o.index<n.length&&FT(iI,u,QT(o,1)),s=o[0].length,d=a,u.length>=i));)l.lastIndex===o.index&&l.lastIndex++;return d===n.length?!s&&oI(l,"")||aI(u,""):aI(u,sI(n,d)),u.length>i?QT(u,0,i):u}:"0".split(void 0,0).length?function(e,r){return void 0===e&&0===r?[]:BT(t,this,e,r)}:t,[function(t,r){var i=KT(this),o=null==t?void 0:JT(t,e);return o?BT(o,t,i,r):BT(n,qT(i),t,r)},function(e,i){var o=zT(this),a=qT(e),s=r(n,o,a,i,n!==t);if(s.done)return s.value;var u=WT(o,RegExp),c=o.unicode,d=(o.ignoreCase?"i":"")+(o.multiline?"m":"")+(o.unicode?"u":"")+(tI?"g":"y"),l=new u(tI?"^(?:"+o.source+")":o,d),h=void 0===i?rI:i>>>0;if(0===h)return[];if(0===a.length)return null===ZT(l,a)?[a]:[];for(var f=0,p=0,_=[];p<a.length;){l.lastIndex=tI?0:p;var v,m=ZT(l,tI?sI(a,p):a);if(null===m||(v=nI(YT(l.lastIndex+(tI?p:0)),a.length))===f)p=XT(a,p,c);else{if(aI(_,sI(a,f,p)),_.length===h)return _;for(var g=1;g<=m.length-1;g++)if(aI(_,m[g]),_.length===h)return _;p=f=v}}return aI(_,sI(a,f)),_}]}),!uI,tI);var cI=Un.PROPER,dI=se,lI=sm,hI=_m.trim;Yi({target:"String",proto:!0,forced:function(e){return dI((function(){return!!lI[e]()||"​…᠎"!=="​…᠎"[e]()||cI&&lI[e].name!==e}))}("trim")},{trim:function(){return hI(this)}});var fI={exports:{}};!function(e){var t={generateIdentifier:function(){return Math.random().toString(36).substr(2,10)}};t.localCName=t.generateIdentifier(),t.splitLines=function(e){return e.trim().split("\n").map((function(e){return e.trim()}))},t.splitSections=function(e){return e.split("\nm=").map((function(e,t){return(t>0?"m="+e:e).trim()+"\r\n"}))},t.getDescription=function(e){var r=t.splitSections(e);return r&&r[0]},t.getMediaSections=function(e){var r=t.splitSections(e);return r.shift(),r},t.matchPrefix=function(e,r){return t.splitLines(e).filter((function(e){return 0===e.indexOf(r)}))},t.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},t.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(" ")},t.parseIceOptions=function(e){return e.substr(14).split(" ")},t.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},t.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"},t.parseExtmap=function(e){var t=e.substr(9).split(" ");return{id:parseInt(t[0],10),direction:t[0].indexOf("/")>0?t[0].split("/")[1]:"sendrecv",uri:t[1]}},t.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+"\r\n"},t.parseFmtp=function(e){for(var t,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},t.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},t.parseRtcpFb=function(e){var t=e.substr(e.indexOf(" ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},t.writeRtcpFb=function(e){var t="",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},t.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},t.parseSsrcGroup=function(e){var t=e.substr(13).split(" ");return{semantics:t.shift(),ssrcs:t.map((function(e){return parseInt(e,10)}))}},t.getMid=function(e){var r=t.matchPrefix(e,"a=mid:")[0];if(r)return r.substr(6)},t.parseFingerprint=function(e){var t=e.substr(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1].toUpperCase()}},t.getDtlsParameters=function(e,r){return{role:"auto",fingerprints:t.matchPrefix(e+r,"a=fingerprint:").map(t.parseFingerprint)}},t.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},t.parseCryptoLine=function(e){var t=e.substr(9).split(" ");return{tag:parseInt(t[0],10),cryptoSuite:t[1],keyParams:t[2],sessionParams:t.slice(3)}},t.writeCryptoLine=function(e){return"a=crypto:"+e.tag+" "+e.cryptoSuite+" "+("object"===o(e.keyParams)?t.writeCryptoKeyParams(e.keyParams):e.keyParams)+(e.sessionParams?" "+e.sessionParams.join(" "):"")+"\r\n"},t.parseCryptoKeyParams=function(e){if(0!==e.indexOf("inline:"))return null;var t=e.substr(7).split("|");return{keyMethod:"inline",keySalt:t[0],lifeTime:t[1],mkiValue:t[2]?t[2].split(":")[0]:void 0,mkiLength:t[2]?t[2].split(":")[1]:void 0}},t.writeCryptoKeyParams=function(e){return e.keyMethod+":"+e.keySalt+(e.lifeTime?"|"+e.lifeTime:"")+(e.mkiValue&&e.mkiLength?"|"+e.mkiValue+":"+e.mkiLength:"")},t.getCryptoParameters=function(e,r){return t.matchPrefix(e+r,"a=crypto:").map(t.parseCryptoLine)},t.getIceParameters=function(e,r){var n=t.matchPrefix(e+r,"a=ice-ufrag:")[0],i=t.matchPrefix(e+r,"a=ice-pwd:")[0];return n&&i?{usernameFragment:n.substr(12),password:i.substr(10)}:null},t.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},t.parseRtpParameters=function(e){for(var r={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},n=t.splitLines(e)[0].split(" "),i=3;i<n.length;i++){var o=n[i],a=t.matchPrefix(e,"a=rtpmap:"+o+" ")[0];if(a){var s=t.parseRtpMap(a),u=t.matchPrefix(e,"a=fmtp:"+o+" ");switch(s.parameters=u.length?t.parseFmtp(u[0]):{},s.rtcpFeedback=t.matchPrefix(e,"a=rtcp-fb:"+o+" ").map(t.parseRtcpFb),r.codecs.push(s),s.name.toUpperCase()){case"RED":case"ULPFEC":r.fecMechanisms.push(s.name.toUpperCase())}}}return t.matchPrefix(e,"a=extmap:").forEach((function(e){r.headerExtensions.push(t.parseExtmap(e))})),r},t.writeRtpDescription=function(e,r){var n="";n+="m="+e+" ",n+=r.codecs.length>0?"9":"0",n+=" UDP/TLS/RTP/SAVPF ",n+=r.codecs.map((function(e){return void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType})).join(" ")+"\r\n",n+="c=IN IP4 0.0.0.0\r\n",n+="a=rtcp:9 IN IP4 0.0.0.0\r\n",r.codecs.forEach((function(e){n+=t.writeRtpMap(e),n+=t.writeFmtp(e),n+=t.writeRtcpFb(e)}));var i=0;return r.codecs.forEach((function(e){e.maxptime>i&&(i=e.maxptime)})),i>0&&(n+="a=maxptime:"+i+"\r\n"),r.headerExtensions&&r.headerExtensions.forEach((function(e){n+=t.writeExtmap(e)})),n},t.parseRtpEncodingParameters=function(e){var r,n=[],i=t.parseRtpParameters(e),o=-1!==i.fecMechanisms.indexOf("RED"),a=-1!==i.fecMechanisms.indexOf("ULPFEC"),s=t.matchPrefix(e,"a=ssrc:").map((function(e){return t.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute})),u=s.length>0&&s[0].ssrc,c=t.matchPrefix(e,"a=ssrc-group:FID").map((function(e){return e.substr(17).split(" ").map((function(e){return parseInt(e,10)}))}));c.length>0&&c[0].length>1&&c[0][0]===u&&(r=c[0][1]),i.codecs.forEach((function(e){if("RTX"===e.name.toUpperCase()&&e.parameters.apt){var t={ssrc:u,codecPayloadType:parseInt(e.parameters.apt,10)};u&&r&&(t.rtx={ssrc:r}),n.push(t),o&&((t=JSON.parse(JSON.stringify(t))).fec={ssrc:u,mechanism:a?"red+ulpfec":"red"},n.push(t))}})),0===n.length&&u&&n.push({ssrc:u});var d=t.matchPrefix(e,"b=");return d.length&&(d=0===d[0].indexOf("b=TIAS:")?parseInt(d[0].substr(7),10):0===d[0].indexOf("b=AS:")?1e3*parseInt(d[0].substr(5),10)*.95-16e3:void 0,n.forEach((function(e){e.maxBitrate=d}))),n},t.parseRtcpParameters=function(e){var r={},n=t.matchPrefix(e,"a=ssrc:").map((function(e){return t.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute}))[0];n&&(r.cname=n.value,r.ssrc=n.ssrc);var i=t.matchPrefix(e,"a=rtcp-rsize");r.reducedSize=i.length>0,r.compound=0===i.length;var o=t.matchPrefix(e,"a=rtcp-mux");return r.mux=o.length>0,r},t.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},t.parseMsid=function(e){var r,n=t.matchPrefix(e,"a=msid:");if(1===n.length)return{stream:(r=n[0].substr(7).split(" "))[0],track:r[1]};var i=t.matchPrefix(e,"a=ssrc:").map((function(e){return t.parseSsrcMedia(e)})).filter((function(e){return"msid"===e.attribute}));return i.length>0?{stream:(r=i[0].value.split(" "))[0],track:r[1]}:void 0},t.parseSctpDescription=function(e){var r,n=t.parseMLine(e),i=t.matchPrefix(e,"a=max-message-size:");i.length>0&&(r=parseInt(i[0].substr(19),10)),isNaN(r)&&(r=65536);var o=t.matchPrefix(e,"a=sctp-port:");if(o.length>0)return{port:parseInt(o[0].substr(12),10),protocol:n.fmt,maxMessageSize:r};var a=t.matchPrefix(e,"a=sctpmap:");if(a.length>0){var s=a[0].substr(10).split(" ");return{port:parseInt(s[0],10),protocol:s[1],maxMessageSize:r}}},t.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("")},t.generateSessionId=function(){return Math.random().toString().substr(2,21)},t.writeSessionBoilerplate=function(e,r,n){var i=void 0!==r?r:2;return"v=0\r\no="+(n||"thisisadapterortc")+" "+(e||t.generateSessionId())+" "+i+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},t.getDirection=function(e,r){for(var n=t.splitLines(e),i=0;i<n.length;i++)switch(n[i]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return n[i].substr(2)}return r?t.getDirection(r):"sendrecv"},t.getKind=function(e){return t.splitLines(e)[0].split(" ")[0].substr(2)},t.isRejected=function(e){return"0"===e.split(" ",2)[1]},t.parseMLine=function(e){var r=t.splitLines(e)[0].substr(2).split(" ");return{kind:r[0],port:parseInt(r[1],10),protocol:r[2],fmt:r.slice(3).join(" ")}},t.parseOLine=function(e){var r=t.matchPrefix(e,"o=")[0].substr(2).split(" ");return{username:r[0],sessionId:r[1],sessionVersion:parseInt(r[2],10),netType:r[3],addressType:r[4],address:r[5]}},t.isValidSDP=function(e){if("string"!=typeof e||0===e.length)return!1;for(var r=t.splitLines(e),n=0;n<r.length;n++)if(r[n].length<2||"="!==r[n].charAt(1))return!1;return!0},e.exports=t}(fI);var pI=fI.exports,_I=e({__proto__:null,default:pI},[fI.exports]);function vI(e){if(!(!e.RTCIceCandidate||e.RTCIceCandidate&&"foundation"in e.RTCIceCandidate.prototype)){var t=e.RTCIceCandidate;e.RTCIceCandidate=function(e){if("object"===o(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=pI.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,py(e,"icecandidate",(function(t){return t.candidate&&Object.defineProperty(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t}))}}function mI(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=pI.splitSections(e.sdp);return t.shift(),t.some((function(e){var t=pI.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=pI.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 gI(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},py(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 yI(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 SI(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 bI(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 EI(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"!==o(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 kI=Object.freeze(Object.defineProperty({__proto__:null,shimRTCIceCandidate:vI,shimMaxMessageSize:mI,shimSendThrowTypeError:gI,shimConnectionState:yI,removeExtmapAllowMixed:SI,shimAddIceCandidateNullOrEmpty:bI,shimParameterlessSetLocalDescription:EI},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=my,i=yy(t),o={browserDetails:i,commonShim:kI,extractVersion:fy,disableLog:_y,disableWarnings:vy,sdp:_I};switch(i.browser){case"chrome":if(!fR||!cR||!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=fR,bI(t,i),EI(t),tR(t,i),rR(t),cR(t,i),nR(t),uR(t,i),iR(t),oR(t),aR(t),dR(t,i),vI(t),yI(t),mI(t,i),gI(t),SI(t,i);break;case"firefox":if(!ZR||!HR||!r.shimFirefox)return n("Firefox shim is not included in this adapter release."),o;n("adapter.js shimming firefox."),o.browserShim=ZR,bI(t,i),EI(t),jR(t,i),HR(t,i),GR(t),WR(t),zR(t),KR(t),XR(t),YR(t),qR(t),JR(t),QR(t),vI(t),yI(t),mI(t,i),gI(t);break;case"safari":if(!uT||!r.shimSafari)return n("Safari shim is not included in this adapter release."),o;n("adapter.js shimming safari."),o.browserShim=uT,bI(t,i),EI(t),iT(t),aT(t),tT(t),$R(t),eT(t),oT(t),rT(t),sT(t),vI(t),mI(t,i),gI(t),SI(t,i);break;default:n("Unsupported browser!")}}({window:"undefined"==typeof window?void 0:window});var RI=Jo,TI=Math.floor,II=function(e,t){var r=e.length,n=TI(r/2);return r<8?AI(e,t):wI(e,II(RI(e,0,n),t),II(RI(e,n),t),t)},AI=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},wI=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},CI=II,OI=qe.match(/firefox\/(\d+)/i),xI=!!OI&&+OI[1],NI=/MSIE|Trident/.test(qe),DI=qe.match(/AppleWebKit\/(\d+)\./),PI=!!DI&&+DI[1],MI=Yi,UI=Te,LI=gt,VI=Mt,FI=oi,BI=_o,jI=se,GI=CI,HI=e_,zI=xI,KI=NI,WI=rt,XI=PI,YI=[],qI=UI(YI.sort),JI=UI(YI.push),QI=jI((function(){YI.sort(void 0)})),ZI=jI((function(){YI.sort(null)})),$I=HI("sort"),eA=!jI((function(){if(WI)return WI<70;if(!(zI&&zI>3)){if(KI)return!0;if(XI)return XI<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++)YI.push({k:t+n,v:r})}for(YI.sort((function(e,t){return t.v-e.v})),n=0;n<YI.length;n++)t=YI[n].k.charAt(0),i.charAt(i.length-1)!==t&&(i+=t);return"DGBEFHACIJK"!==i}}));MI({target:"Array",proto:!0,forced:QI||!ZI||!$I||!eA},{sort:function(e){void 0!==e&&LI(e);var t=VI(this);if(eA)return void 0===e?qI(t):qI(t,e);var r,n,i=[],o=FI(t);for(n=0;n<o;n++)n in t&&JI(i,t[n]);for(GI(i,function(e){return function(t,r){return void 0===r?-1:void 0===t?1:void 0!==e?+e(t,r)||0:BI(t)>BI(r)?1:-1}}(e)),r=i.length,n=0;n<r;)t[n]=i[n++];for(;n<o;)delete t[n++];return t}});var tA,rA,nA,iA={exports:{}},oA="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView,aA=oA,sA=ue,uA=oe,cA=je,dA=He,lA=Vt,hA=ho,fA=pt,pA=Yr,_A=qr.exports,vA=wr.f,mA=Ye,gA=tc,yA=Rc,SA=er,bA=Ht,EA=uA.Int8Array,kA=EA&&EA.prototype,RA=uA.Uint8ClampedArray,TA=RA&&RA.prototype,IA=EA&&gA(EA),AA=kA&&gA(kA),wA=Object.prototype,CA=uA.TypeError,OA=SA("toStringTag"),xA=bA("TYPED_ARRAY_TAG"),NA=bA("TYPED_ARRAY_CONSTRUCTOR"),DA=aA&&!!yA&&"Opera"!==hA(uA.opera),PA=!1,MA={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},UA={BigInt64Array:8,BigUint64Array:8},LA=function(e){if(!dA(e))return!1;var t=hA(e);return lA(MA,t)||lA(UA,t)};for(tA in MA)(nA=(rA=uA[tA])&&rA.prototype)?pA(nA,NA,rA):DA=!1;for(tA in UA)(nA=(rA=uA[tA])&&rA.prototype)&&pA(nA,NA,rA);if((!DA||!cA(IA)||IA===Function.prototype)&&(IA=function(){throw CA("Incorrect invocation")},DA))for(tA in MA)uA[tA]&&yA(uA[tA],IA);if((!DA||!AA||AA===wA)&&(AA=IA.prototype,DA))for(tA in MA)uA[tA]&&yA(uA[tA].prototype,AA);if(DA&&gA(TA)!==AA&&yA(TA,AA),sA&&!lA(AA,OA))for(tA in PA=!0,vA(AA,OA,{get:function(){return dA(this)?this[xA]:void 0}}),MA)uA[tA]&&pA(uA[tA],xA,tA);var VA={NATIVE_ARRAY_BUFFER_VIEWS:DA,TYPED_ARRAY_CONSTRUCTOR:NA,TYPED_ARRAY_TAG:PA&&xA,aTypedArray:function(e){if(LA(e))return e;throw CA("Target is not a typed array")},aTypedArrayConstructor:function(e){if(cA(e)&&(!yA||mA(IA,e)))return e;throw CA(fA(e)+" is not a typed array constructor")},exportTypedArrayMethod:function(e,t,r,n){if(sA){if(r)for(var i in MA){var o=uA[i];if(o&&lA(o.prototype,e))try{delete o.prototype[e]}catch(RY){try{o.prototype[e]=t}catch(a){}}}AA[e]&&!r||_A(AA,e,r?t:DA&&kA[e]||t,n)}},exportTypedArrayStaticMethod:function(e,t,r){var n,i;if(sA){if(yA){if(r)for(n in MA)if((i=uA[n])&&lA(i,e))try{delete i[e]}catch(RY){}if(IA[e]&&!r)return;try{return _A(IA,e,r?t:DA&&IA[e]||t)}catch(RY){}}for(n in MA)!(i=uA[n])||i[e]&&!r||_A(i,e,t)}},isView:function(e){if(!dA(e))return!1;var t=hA(e);return"DataView"===t||lA(MA,t)||lA(UA,t)},isTypedArray:LA,TypedArray:IA,TypedArrayPrototype:AA},FA=oe,BA=se,jA=Bl,GA=VA.NATIVE_ARRAY_BUFFER_VIEWS,HA=FA.ArrayBuffer,zA=FA.Int8Array,KA=!GA||!BA((function(){zA(1)}))||!BA((function(){new zA(-1)}))||!jA((function(e){new zA,new zA(null),new zA(1.5),new zA(e)}),!0)||BA((function(){return 1!==new zA(new HA(2),1,void 0).length})),WA=Jn,XA=ni,YA=oe.RangeError,qA=function(e){if(void 0===e)return 0;var t=WA(e),r=XA(t);if(t!==r)throw YA("Wrong length or index");return r},JA=oe.Array,QA=Math.abs,ZA=Math.pow,$A=Math.floor,ew=Math.log,tw=Math.LN2,rw={pack:function(e,t,r){var n,i,o,a=JA(r),s=8*r-t-1,u=(1<<s)-1,c=u>>1,d=23===t?ZA(2,-24)-ZA(2,-77):0,l=e<0||0===e&&1/e<0?1:0,h=0;for((e=QA(e))!=e||e===1/0?(i=e!=e?1:0,n=u):(n=$A(ew(e)/tw),e*(o=ZA(2,-n))<1&&(n--,o*=2),(e+=n+c>=1?d/o:d*ZA(2,1-c))*o>=2&&(n++,o/=2),n+c>=u?(i=0,n=u):n+c>=1?(i=(e*o-1)*ZA(2,t),n+=c):(i=e*ZA(2,c-1)*ZA(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+=ZA(2,t),d-=a}return(c?-1:1)*r*ZA(2,d-t)}},nw=Mt,iw=ei,ow=oi,aw=function(e){for(var t=nw(this),r=ow(t),n=arguments.length,i=iw(n>1?arguments[1]:void 0,r),o=n>2?arguments[2]:void 0,a=void 0===o?r:iw(o,r);a>i;)t[i++]=e;return t},sw=oe,uw=Te,cw=ue,dw=oA,lw=Un,hw=Yr,fw=Hd,pw=se,_w=Qd,vw=Jn,mw=ni,gw=qA,yw=rw,Sw=tc,bw=Rc,Ew=Xn.f,kw=wr.f,Rw=aw,Tw=Jo,Iw=fa,Aw=lw.PROPER,ww=lw.CONFIGURABLE,Cw=On.get,Ow=On.set,xw="ArrayBuffer",Nw="DataView",Dw="Wrong index",Pw=sw.ArrayBuffer,Mw=Pw,Uw=Mw&&Mw.prototype,Lw=sw.DataView,Vw=Lw&&Lw.prototype,Fw=Object.prototype,Bw=sw.Array,jw=sw.RangeError,Gw=uw(Rw),Hw=uw([].reverse),zw=yw.pack,Kw=yw.unpack,Ww=function(e){return[255&e]},Xw=function(e){return[255&e,e>>8&255]},Yw=function(e){return[255&e,e>>8&255,e>>16&255,e>>24&255]},qw=function(e){return e[3]<<24|e[2]<<16|e[1]<<8|e[0]},Jw=function(e){return zw(e,23,4)},Qw=function(e){return zw(e,52,8)},Zw=function(e,t){kw(e.prototype,t,{get:function(){return Cw(this)[t]}})},$w=function(e,t,r,n){var i=gw(r),o=Cw(e);if(i+t>o.byteLength)throw jw(Dw);var a=Cw(o.buffer).bytes,s=i+o.byteOffset,u=Tw(a,s,s+t);return n?u:Hw(u)},eC=function(e,t,r,n,i,o){var a=gw(r),s=Cw(e);if(a+t>s.byteLength)throw jw(Dw);for(var u=Cw(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(dw){var tC=Aw&&Pw.name!==xw;if(pw((function(){Pw(1)}))&&pw((function(){new Pw(-1)}))&&!pw((function(){return new Pw,new Pw(1.5),new Pw(NaN),tC&&!ww})))tC&&ww&&hw(Pw,"name",xw);else{(Mw=function(e){return _w(this,Uw),new Pw(gw(e))}).prototype=Uw;for(var rC,nC=Ew(Pw),iC=0;nC.length>iC;)(rC=nC[iC++])in Mw||hw(Mw,rC,Pw[rC]);Uw.constructor=Mw}bw&&Sw(Vw)!==Fw&&bw(Vw,Fw);var oC=new Lw(new Mw(2)),aC=uw(Vw.setInt8);oC.setInt8(0,2147483648),oC.setInt8(1,2147483649),!oC.getInt8(0)&&oC.getInt8(1)||fw(Vw,{setInt8:function(e,t){aC(this,e,t<<24>>24)},setUint8:function(e,t){aC(this,e,t<<24>>24)}},{unsafe:!0})}else Uw=(Mw=function(e){_w(this,Uw);var t=gw(e);Ow(this,{bytes:Gw(Bw(t),0),byteLength:t}),cw||(this.byteLength=t)}).prototype,Vw=(Lw=function(e,t,r){_w(this,Vw),_w(e,Uw);var n=Cw(e).byteLength,i=vw(t);if(i<0||i>n)throw jw("Wrong offset");if(i+(r=void 0===r?n-i:mw(r))>n)throw jw("Wrong length");Ow(this,{buffer:e,byteLength:r,byteOffset:i}),cw||(this.buffer=e,this.byteLength=r,this.byteOffset=i)}).prototype,cw&&(Zw(Mw,"byteLength"),Zw(Lw,"buffer"),Zw(Lw,"byteLength"),Zw(Lw,"byteOffset")),fw(Vw,{getInt8:function(e){return $w(this,1,e)[0]<<24>>24},getUint8:function(e){return $w(this,1,e)[0]},getInt16:function(e){var t=$w(this,2,e,arguments.length>1?arguments[1]:void 0);return(t[1]<<8|t[0])<<16>>16},getUint16:function(e){var t=$w(this,2,e,arguments.length>1?arguments[1]:void 0);return t[1]<<8|t[0]},getInt32:function(e){return qw($w(this,4,e,arguments.length>1?arguments[1]:void 0))},getUint32:function(e){return qw($w(this,4,e,arguments.length>1?arguments[1]:void 0))>>>0},getFloat32:function(e){return Kw($w(this,4,e,arguments.length>1?arguments[1]:void 0),23)},getFloat64:function(e){return Kw($w(this,8,e,arguments.length>1?arguments[1]:void 0),52)},setInt8:function(e,t){eC(this,1,e,Ww,t)},setUint8:function(e,t){eC(this,1,e,Ww,t)},setInt16:function(e,t){eC(this,2,e,Xw,t,arguments.length>2?arguments[2]:void 0)},setUint16:function(e,t){eC(this,2,e,Xw,t,arguments.length>2?arguments[2]:void 0)},setInt32:function(e,t){eC(this,4,e,Yw,t,arguments.length>2?arguments[2]:void 0)},setUint32:function(e,t){eC(this,4,e,Yw,t,arguments.length>2?arguments[2]:void 0)},setFloat32:function(e,t){eC(this,4,e,Jw,t,arguments.length>2?arguments[2]:void 0)},setFloat64:function(e,t){eC(this,8,e,Qw,t,arguments.length>2?arguments[2]:void 0)}});Iw(Mw,xw),Iw(Lw,Nw);var sC={ArrayBuffer:Mw,DataView:Lw},uC=He,cC=Math.floor,dC=Number.isInteger||function(e){return!uC(e)&&isFinite(e)&&cC(e)===e},lC=Jn,hC=oe.RangeError,fC=function(e){var t=lC(e);if(t<0)throw hC("The argument can't be less than 0");return t},pC=oe.RangeError,_C=function(e,t){var r=fC(e);if(r%t)throw pC("Wrong offset");return r},vC=ma,mC=he,gC=zl,yC=Mt,SC=oi,bC=fl,EC=al,kC=tl,RC=VA.aTypedArrayConstructor,TC=Yi,IC=oe,AC=he,wC=ue,CC=KA,OC=VA,xC=sC,NC=Qd,DC=ye,PC=Yr,MC=dC,UC=ni,LC=qA,VC=_C,FC=hr,BC=Vt,jC=ho,GC=He,HC=ht,zC=Fo,KC=Ye,WC=Rc,XC=Xn.f,YC=function(e){var t,r,n,i,o,a,s=gC(this),u=yC(e),c=arguments.length,d=c>1?arguments[1]:void 0,l=void 0!==d,h=EC(u);if(h&&!kC(h))for(a=(o=bC(u,h)).next,u=[];!(i=mC(a,o)).done;)u.push(i.value);for(l&&c>2&&(d=vC(d,arguments[2])),r=SC(u),n=new(RC(s))(r),t=0;r>t;t++)n[t]=l?d(u[t],t):u[t];return n},qC=Xa.forEach,JC=Yd,QC=wr,ZC=ae,$C=Ep,eO=On.get,tO=On.set,rO=QC.f,nO=ZC.f,iO=Math.round,oO=IC.RangeError,aO=xC.ArrayBuffer,sO=aO.prototype,uO=xC.DataView,cO=OC.NATIVE_ARRAY_BUFFER_VIEWS,dO=OC.TYPED_ARRAY_CONSTRUCTOR,lO=OC.TYPED_ARRAY_TAG,hO=OC.TypedArray,fO=OC.TypedArrayPrototype,pO=OC.aTypedArrayConstructor,_O=OC.isTypedArray,vO="BYTES_PER_ELEMENT",mO="Wrong length",gO=function(e,t){pO(e);for(var r=0,n=t.length,i=new e(n);n>r;)i[r]=t[r++];return i},yO=function(e,t){rO(e,t,{get:function(){return eO(this)[t]}})},SO=function(e){var t;return KC(sO,e)||"ArrayBuffer"==(t=jC(e))||"SharedArrayBuffer"==t},bO=function(e,t){return _O(e)&&!HC(t)&&t in e&&MC(+t)&&t>=0},EO=function(e,t){return t=FC(t),bO(e,t)?DC(2,e[t]):nO(e,t)},kO=function(e,t,r){return t=FC(t),!(bO(e,t)&&GC(r)&&BC(r,"value"))||BC(r,"get")||BC(r,"set")||r.configurable||BC(r,"writable")&&!r.writable||BC(r,"enumerable")&&!r.enumerable?rO(e,t,r):(e[t]=r.value,e)};wC?(cO||(ZC.f=EO,QC.f=kO,yO(fO,"buffer"),yO(fO,"byteOffset"),yO(fO,"byteLength"),yO(fO,"length")),TC({target:"Object",stat:!0,forced:!cO},{getOwnPropertyDescriptor:EO,defineProperty:kO}),iA.exports=function(e,t,r){var n=e.match(/\d+$/)[0]/8,i=e+(r?"Clamped":"")+"Array",o="get"+e,a="set"+e,s=IC[i],u=s,c=u&&u.prototype,d={},l=function(e,t){rO(e,t,{get:function(){return function(e,t){var r=eO(e);return r.view[o](t*n+r.byteOffset,!0)}(this,t)},set:function(e){return function(e,t,i){var o=eO(e);r&&(i=(i=iO(i))<0?0:i>255?255:255&i),o.view[a](t*n+o.byteOffset,i,!0)}(this,t,e)},enumerable:!0})};cO?CC&&(u=t((function(e,t,r,i){return NC(e,c),$C(GC(t)?SO(t)?void 0!==i?new s(t,VC(r,n),i):void 0!==r?new s(t,VC(r,n)):new s(t):_O(t)?gO(u,t):AC(YC,u,t):new s(LC(t)),e,u)})),WC&&WC(u,hO),qC(XC(s),(function(e){e in u||PC(u,e,s[e])})),u.prototype=c):(u=t((function(e,t,r,i){NC(e,c);var o,a,s,d=0,h=0;if(GC(t)){if(!SO(t))return _O(t)?gO(u,t):AC(YC,u,t);o=t,h=VC(r,n);var f=t.byteLength;if(void 0===i){if(f%n)throw oO(mO);if((a=f-h)<0)throw oO(mO)}else if((a=UC(i)*n)+h>f)throw oO(mO);s=a/n}else s=LC(t),o=new aO(a=s*n);for(tO(e,{buffer:o,byteOffset:h,byteLength:a,length:s,view:new uO(o)});d<s;)l(e,d++)})),WC&&WC(u,hO),c=u.prototype=zC(fO)),c.constructor!==u&&PC(c,"constructor",u),PC(c,dO,u),lO&&PC(c,lO,i),d[i]=u,TC({global:!0,forced:u!=s,sham:!cO},d),vO in u||PC(u,vO,n),vO in c||PC(c,vO,n),JC(i)}):iA.exports=function(){},(0,iA.exports)("Uint8",(function(e){return function(t,r,n){return e(this,t,r,n)}}));var RO=oi,TO=Jn,IO=VA.aTypedArray;(0,VA.exportTypedArrayMethod)("at",(function(e){var t=IO(this),r=RO(t),n=TO(e),i=n>=0?n:r+n;return i<0||i>=r?void 0:t[i]}));var AO=Mt,wO=ei,CO=oi,OO=Math.min,xO=[].copyWithin||function(e,t){var r=AO(this),n=CO(r),i=wO(e,n),o=wO(t,n),a=arguments.length>2?arguments[2]:void 0,s=OO((void 0===a?n:wO(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]:delete r[i],i+=u,o+=u;return r},NO=VA,DO=Te(xO),PO=NO.aTypedArray;(0,NO.exportTypedArrayMethod)("copyWithin",(function(e,t){return DO(PO(this),e,t,arguments.length>2?arguments[2]:void 0)}));var MO=Xa.every,UO=VA.aTypedArray;(0,VA.exportTypedArrayMethod)("every",(function(e){return MO(UO(this),e,arguments.length>1?arguments[1]:void 0)}));var LO=he,VO=aw,FO=VA.aTypedArray;(0,VA.exportTypedArrayMethod)("fill",(function(e){var t=arguments.length;return LO(VO,FO(this),e,t>1?arguments[1]:void 0,t>2?arguments[2]:void 0)}));var BO=oi,jO=Yl,GO=VA.TYPED_ARRAY_CONSTRUCTOR,HO=VA.aTypedArrayConstructor,zO=function(e){return HO(jO(e,e[GO]))},KO=function(e,t){for(var r=0,n=BO(t),i=new e(n);n>r;)i[r]=t[r++];return i},WO=zO,XO=Xa.filter,YO=function(e,t){return KO(WO(e),t)},qO=VA.aTypedArray;(0,VA.exportTypedArrayMethod)("filter",(function(e){var t=XO(qO(this),e,arguments.length>1?arguments[1]:void 0);return YO(this,t)}));var JO=Xa.find,QO=VA.aTypedArray;(0,VA.exportTypedArrayMethod)("find",(function(e){return JO(QO(this),e,arguments.length>1?arguments[1]:void 0)}));var ZO=Xa.findIndex,$O=VA.aTypedArray;(0,VA.exportTypedArrayMethod)("findIndex",(function(e){return ZO($O(this),e,arguments.length>1?arguments[1]:void 0)}));var ex=Xa.forEach,tx=VA.aTypedArray;(0,VA.exportTypedArrayMethod)("forEach",(function(e){ex(tx(this),e,arguments.length>1?arguments[1]:void 0)}));var rx=di.includes,nx=VA.aTypedArray;(0,VA.exportTypedArrayMethod)("includes",(function(e){return rx(nx(this),e,arguments.length>1?arguments[1]:void 0)}));var ix=di.indexOf,ox=VA.aTypedArray;(0,VA.exportTypedArrayMethod)("indexOf",(function(e){return ix(ox(this),e,arguments.length>1?arguments[1]:void 0)}));var ax=oe,sx=se,ux=Te,cx=VA,dx=rd,lx=er("iterator"),hx=ax.Uint8Array,fx=ux(dx.values),px=ux(dx.keys),_x=ux(dx.entries),vx=cx.aTypedArray,mx=cx.exportTypedArrayMethod,gx=hx&&hx.prototype,yx=!sx((function(){gx[lx].call([1])})),Sx=!!gx&&gx.values&&gx[lx]===gx.values&&"values"===gx.values.name,bx=function(){return fx(vx(this))};mx("entries",(function(){return _x(vx(this))}),yx),mx("keys",(function(){return px(vx(this))}),yx),mx("values",bx,yx||!Sx,{name:"values"}),mx(lx,bx,yx||!Sx,{name:"values"});var Ex=VA.aTypedArray,kx=VA.exportTypedArrayMethod,Rx=Te([].join);kx("join",(function(e){return Rx(Ex(this),e)}));var Tx=$i,Ix=Be,Ax=Jn,wx=oi,Cx=e_,Ox=Math.min,xx=[].lastIndexOf,Nx=!!xx&&1/[1].lastIndexOf(1,-0)<0,Dx=Cx("lastIndexOf"),Px=Nx||!Dx?function(e){if(Nx)return Tx(xx,this,arguments)||0;var t=Ix(this),r=wx(t),n=r-1;for(arguments.length>1&&(n=Ox(n,Ax(arguments[1]))),n<0&&(n=r+n);n>=0;n--)if(n in t&&t[n]===e)return n||0;return-1}:xx,Mx=$i,Ux=Px,Lx=VA.aTypedArray;(0,VA.exportTypedArrayMethod)("lastIndexOf",(function(e){var t=arguments.length;return Mx(Ux,Lx(this),t>1?[e,arguments[1]]:[e])}));var Vx=Xa.map,Fx=zO,Bx=VA.aTypedArray;(0,VA.exportTypedArrayMethod)("map",(function(e){return Vx(Bx(this),e,arguments.length>1?arguments[1]:void 0,(function(e,t){return new(Fx(e))(t)}))}));var jx=Pg.left,Gx=VA.aTypedArray;(0,VA.exportTypedArrayMethod)("reduce",(function(e){var t=arguments.length;return jx(Gx(this),e,t,t>1?arguments[1]:void 0)}));var Hx=Pg.right,zx=VA.aTypedArray;(0,VA.exportTypedArrayMethod)("reduceRight",(function(e){var t=arguments.length;return Hx(zx(this),e,t,t>1?arguments[1]:void 0)}));var Kx=VA.aTypedArray,Wx=VA.exportTypedArrayMethod,Xx=Math.floor;Wx("reverse",(function(){for(var e,t=this,r=Kx(t).length,n=Xx(r/2),i=0;i<n;)e=t[i],t[i++]=t[--r],t[r]=e;return t}));var Yx=oe,qx=he,Jx=VA,Qx=oi,Zx=_C,$x=Mt,eN=se,tN=Yx.RangeError,rN=Yx.Int8Array,nN=rN&&rN.prototype,iN=nN&&nN.set,oN=Jx.aTypedArray,aN=Jx.exportTypedArrayMethod,sN=!eN((function(){var e=new Uint8ClampedArray(2);return qx(iN,e,{length:1,0:3},1),3!==e[1]})),uN=sN&&Jx.NATIVE_ARRAY_BUFFER_VIEWS&&eN((function(){var e=new rN(2);return e.set(1),e.set("2",1),0!==e[0]||2!==e[1]}));aN("set",(function(e){oN(this);var t=Zx(arguments.length>1?arguments[1]:void 0,1),r=$x(e);if(sN)return qx(iN,this,r,t);var n=this.length,i=Qx(r),o=0;if(i+t>n)throw tN("Wrong length");for(;o<i;)this[t+o]=r[o++]}),!sN||uN);var cN=zO,dN=ra,lN=VA.aTypedArray;(0,VA.exportTypedArrayMethod)("slice",(function(e,t){for(var r=dN(lN(this),e,t),n=cN(this),i=0,o=r.length,a=new n(o);o>i;)a[i]=r[i++];return a}),se((function(){new Int8Array(1).slice()})));var hN=Xa.some,fN=VA.aTypedArray;(0,VA.exportTypedArrayMethod)("some",(function(e){return hN(fN(this),e,arguments.length>1?arguments[1]:void 0)}));var pN=oe,_N=Te,vN=se,mN=gt,gN=CI,yN=VA,SN=xI,bN=NI,EN=rt,kN=PI,RN=pN.Array,TN=yN.aTypedArray,IN=yN.exportTypedArrayMethod,AN=pN.Uint16Array,wN=AN&&_N(AN.prototype.sort),CN=!(!wN||vN((function(){wN(new AN(2),null)}))&&vN((function(){wN(new AN(2),{})}))),ON=!!wN&&!vN((function(){if(EN)return EN<74;if(SN)return SN<67;if(bN)return!0;if(kN)return kN<602;var e,t,r=new AN(516),n=RN(516);for(e=0;e<516;e++)t=e%4,r[e]=515-e,n[e]=e-2*t+3;for(wN(r,(function(e,t){return(e/4|0)-(t/4|0)})),e=0;e<516;e++)if(r[e]!==n[e])return!0}));IN("sort",(function(e){return void 0!==e&&mN(e),ON?wN(this,e):gN(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))}),!ON||CN);var xN=$i,NN=VA,DN=se,PN=ra,MN=oe.Int8Array,UN=NN.aTypedArray,LN=NN.exportTypedArrayMethod,VN=[].toLocaleString,FN=!!MN&&DN((function(){VN.call(new MN(1))}));LN("toLocaleString",(function(){return xN(VN,FN?PN(UN(this)):UN(this),PN(arguments))}),DN((function(){return[1,2].toLocaleString()!=new MN([1,2]).toLocaleString()}))||!DN((function(){MN.prototype.toLocaleString.call([1,2])})));var BN=VA.exportTypedArrayMethod,jN=se,GN=Te,HN=oe.Uint8Array,zN=HN&&HN.prototype||{},KN=[].toString,WN=GN([].join);jN((function(){KN.call({})}))&&(KN=function(){return WN(this)});var XN=zN.toString!=KN;BN("toString",KN,XN);var YN=ma,qN=Me,JN=Mt,QN=oi,ZN=function(e){var t=1==e;return function(r,n,i){for(var o,a=JN(r),s=qN(a),u=YN(n,i),c=QN(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}},$N={findLast:ZN(0),findLastIndex:ZN(1)},eD=$N.findLast,tD=VA.aTypedArray;(0,VA.exportTypedArrayMethod)("findLast",(function(e){return eD(tD(this),e,arguments.length>1?arguments[1]:void 0)}));var rD=$N.findLastIndex,nD=VA.aTypedArray;(0,VA.exportTypedArrayMethod)("findLastIndex",(function(e){return rD(nD(this),e,arguments.length>1?arguments[1]:void 0)}));var iD=Yi,oD=Xa.findIndex,aD=zu,sD="findIndex",uD=!0;sD in[]&&Array(1).findIndex((function(){uD=!1})),iD({target:"Array",proto:!0,forced:uD},{findIndex:function(e){return oD(this,e,arguments.length>1?arguments[1]:void 0)}}),aD(sD);var cD=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.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}(cD||{}),dD=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}(dD||{}),lD=d((function e(t,r,n){u(this,e),l(this,"code",void 0),l(this,"message",void 0),l(this,"error",void 0),this.code=t,this.message=r,this.error=n})),hD=ue,fD=Te,pD=yo,_D=Be,vD=fD(fe.f),mD=fD([].push),gD=function(e){return function(t){for(var r,n=_D(t),i=pD(n),o=i.length,a=0,s=[];o>a;)r=i[a++],hD&&!vD(n,r)||mD(s,e?[r,n[r]]:n[r]);return s}},yD={entries:gD(!0),values:gD(!1)}.entries;Yi({target:"Object",stat:!0},{entries:function(e){return yD(e)}});var SD=Jn,bD=_o,ED=Le,kD=oe.RangeError,RD=Te,TD=ni,ID=_o,AD=function(e){var t=bD(ED(this)),r="",n=SD(e);if(n<0||n==1/0)throw kD("Wrong number of repetitions");for(;n>0;(n>>>=1)&&(t+=t))1&n&&(r+=t);return r},wD=Le,CD=RD(AD),OD=RD("".slice),xD=Math.ceil,ND=function(e){return function(t,r,n){var i,o,a=ID(wD(t)),s=TD(r),u=a.length,c=void 0===n?" ":ID(n);return s<=u||""==c?a:((o=CD(c,xD((i=s-u)/c.length))).length>i&&(o=OD(o,0,i)),e?a+o:o+a)}},DD={start:ND(!1),end:ND(!0)},PD=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(qe),MD=DD.end;Yi({target:"String",proto:!0,forced:PD},{padEnd:function(e){return MD(this,e,arguments.length>1?arguments[1]:void 0)}});var UD=Am;Yi({target:"Number",stat:!0,forced:Number.parseInt!=UD},{parseInt:UD});var LD=Pr,VD=ml,FD=ma,BD=he,jD=Mt,GD=function(e,t,r,n){try{return n?t(LD(r)[0],r[1]):t(r)}catch(RY){VD(e,"throw",RY)}},HD=tl,zD=xa,KD=oi,WD=zo,XD=fl,YD=al,qD=oe.Array,JD=function(e){var t=jD(e),r=zD(this),n=arguments.length,i=n>1?arguments[1]:void 0,o=void 0!==i;o&&(i=FD(i,n>2?arguments[2]:void 0));var a,s,u,c,d,l,h=YD(t),f=0;if(!h||this==qD&&HD(h))for(a=KD(t),s=r?new this(a):qD(a);a>f;f++)l=o?i(t[f],f):t[f],WD(s,f,l);else for(d=(c=XD(t,h)).next,s=r?new this:[];!(u=BD(d,c)).done;f++)l=o?GD(c,i,[u.value,f],!0):u.value,WD(s,f,l);return s.length=f,s},QD=JD;Yi({target:"Array",stat:!0,forced:!Bl((function(e){Array.from(e)}))},{from:QD});var ZD=Math.log,$D=Math.LOG10E;Yi({target:"Math",stat:!0},{log10:Math.log10||function(e){return ZD(e)*$D}});var eP,tP=Yi,rP=Te,nP=ae.f,iP=ni,oP=_o,aP=L_,sP=Le,uP=F_,cP=rP("".startsWith),dP=rP("".slice),lP=Math.min,hP=uP("startsWith"),fP=!hP&&!!function(){var e=nP(String.prototype,"startsWith");return e&&!e.writable}();tP({target:"String",proto:!0,forced:!fP&&!hP},{startsWith:function(e){var t=oP(sP(this));aP(e);var r=iP(lP(arguments.length>1?arguments[1]:void 0,t.length)),n=oP(e);return cP?cP(t,n,r):dP(t,r,r+n.length)===n}});var pP=new Uint8Array(16);function _P(){if(!eP&&!(eP="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 eP(pP)}var vP=/^(?:[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 mP(e){return"string"==typeof e&&vP.test(e)}for(var gP=[],yP=0;yP<256;++yP)gP.push((yP+256).toString(16).substr(1));function SP(e,t,r){var n=(e=e||{}).random||(e.rng||_P)();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=(gP[e[t+0]]+gP[e[t+1]]+gP[e[t+2]]+gP[e[t+3]]+"-"+gP[e[t+4]]+gP[e[t+5]]+"-"+gP[e[t+6]]+gP[e[t+7]]+"-"+gP[e[t+8]]+gP[e[t+9]]+"-"+gP[e[t+10]]+gP[e[t+11]]+gP[e[t+12]]+gP[e[t+13]]+gP[e[t+14]]+gP[e[t+15]]).toLowerCase();if(!mP(r))throw TypeError("Stringified UUID is invalid");return r}(n)}var bP=new TextDecoder,EP=new TextEncoder,kP=function(){return SP()},RP=function(){return Date.now()};function TP(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 IP=function(){return"undefined"==typeof window},AP=function(){function e(){u(this,e)}var t,r;return d(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 a=b(i[n],2),s=a[0],u=a[1];null!==u&&"object"===o(u)?e.merge(t[s],r[s]):void 0!==r[s]&&(t[s]=r[s])}}},{key:"ab2str",value:function(e){return bP.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 EP.encode(e).buffer}},{key:"ab2b64str",value:(r=s(regeneratorRuntime.mark((function e(t){var r;return regeneratorRuntime.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=s(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.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 wP(e){return new Promise((function(t){window.setTimeout(t,e)}))}function CP(){var e="none";return IP()||(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 OP="mozilla"===CP();function xP(){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 NP=function(){return Math.floor(65535*Math.random())};function DP(e){return"string"==typeof e&&e.indexOf("__web__rtc__rtt__")>-1}function PP(e){return e.map((function e(t){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(E(a),["..."],E(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 MP=function(){var e=s(regeneratorRuntime.mark((function e(){var t,r,n,i=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=i.length>0&&void 0!==i[0]&&i[0],e.prev=1,(r=new RTCPeerConnection({iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan"})).createDataChannel("default"),r.addTransceiver("audio",{direction:"recvonly"}),r.addTransceiver("video",{direction:"recvonly"}),t&&(r.addTransceiver("audio",{direction:"sendonly"}),r.addTransceiver("video",{direction:"sendonly"})),e.next=9,r.createOffer();case 9:return n=e.sent,r.close(),e.abrupt("return",n.sdp);case 14:e.prev=14,e.t0=e.catch(1);case 16:case"end":return e.stop()}}),e,null,[[1,14]])})));return function(){return e.apply(this,arguments)}}(),UP=function(e){return new Promise((function(t,r){var n=(e=Array.isArray(e)?e:[]).length,i=[];0===n?r([]):e.forEach((function(e){e.then((function(e){t(e)}),(function(e){n--,i.push(e),0===n&&r(i)}))}))}))};function LP(e){return+Math.max(-127,10*Math.log10(Math.pow(e/255,2))).toFixed(2)}function VP(e){return(e&U.AUDIO)===U.AUDIO}function FP(e){return(e&U.VIDEO)===U.VIDEO}function BP(e){var t={};return Object.keys(e).forEach((function(r){"object"===o(e[r])?t[r]=BP(e[r]):r.startsWith("_")||(t[r]=e[r])})),t}function jP(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 GP(e,t){if("boolean"!=typeof e)throw new lD(cD.INVALID_PARAMS,"Invalid ".concat(t,": The value should be boolean type."))}function HP(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Number.POSITIVE_INFINITY;if(e<r||e>n||"number"!=typeof e){var i=new lD(cD.INVALID_PARAMS,"Invalid ".concat(t,": the value range is [").concat(r,", ").concat(n,"]. integer only"));throw i}}function zP(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Number.POSITIVE_INFINITY;if(null==e)throw new lD(cD.INVALID_PARAMS,"".concat(t," cannot be empty"));if(!qP(e,r,n))throw new lD(cD.INVALID_PARAMS,"Invalid ".concat(t,": The value should be string type. Length of the string: [").concat(r,",").concat(n,"]"))}function KP(e,t,r){if(!r.includes(e))throw new lD(cD.INVALID_PARAMS,"Invalid ".concat(t,": The value can only be set as ").concat(JSON.stringify(r)))}function WP(e,t){if(JP(e))throw new lD(cD.INVALID_PARAMS,"Invalid ".concat(t,", should not be empty"))}function XP(e,t){if(!(e instanceof ArrayBuffer))throw new lD(cD.INVALID_PARAMS,"Invalid ".concat(t,", should be ArrayBuffer"))}function YP(e){try{for(var t=navigator.mediaDevices.getSupportedConstraints(),r=0,n=Object.keys(e);r<n.length;r++){var i=n[r];t[i]||delete e[i]}}catch(o){}}function qP(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Number.POSITIVE_INFINITY;return"string"==typeof e&&e.length<=r&&e.length>=t}function JP(e){return null==e}function QP(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new lD(cD.INVALID_PARAMS,"The RoomId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function ZP(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new lD(cD.INVALID_PARAMS,"The userId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function $P(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new lD(cD.INVALID_PARAMS,"The publicStreamId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function eM(e){WP(e,"userInfo"),ZP(e.userId),JP(e.extraInfo)||zP(e.extraInfo,"userInfo.extraInfo",1,200)}function tM(e){WP(e,"roomConfig"),GP(e.isAutoPublish,"roomConfig.isAutoPublish"),GP(e.isAutoSubscribeAudio,"roomConfig.isAutoSubscribeAudio"),GP(e.isAutoSubscribeVideo,"roomConfig.isAutoSubscribeVideo")}function rM(e){WP(e,"videoPlayerOption")}function nM(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:64;if(!e||0===(null==e?void 0:e.byteLength))throw new lD(cD.INVALID_PARAMS,"The message cannot be empty");if((null===(t=e instanceof ArrayBuffer?e:AP.str2ab(JSON.stringify(e)))||void 0===t?void 0:t.byteLength)>1e3*r)throw new lD(cD.INVALID_PARAMS,"The message length must be less than ".concat(r,"K"))}function iM(e){return![re.onRemoteStreamStats,re.onLocalStreamStats,re.onAudioVolumeIndication,re.onLocalAudioPropertiesReport,re.onRemoteAudioPropertiesReport].includes(e)}function oM(e){if("number"!=typeof(null==e?void 0:e.width)||"number"!=typeof(null==e?void 0:e.height))throw new lD(cD.INVALID_PARAMS,"remoteVideoConfig must contain width, height, frameRate")}var aM={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}(aM);var sM=aM.exports,uM="[VERTC]",cM=["#0050b3","#0050b3","#0050b3","#0050b3","#0050b3"],dM=!IP()&&window.location.search.includes("_rtc_debug_"),lM=function(){function e(t,r,n){u(this,e),l(this,"_indent",void 0),l(this,"_module",void 0),l(this,"_id",void 0),this._module=t,this._indent=r}return d(e,[{key:"print",value:function(e){var t;if(dM){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(uM).concat(r,"[").concat(this._module,".").concat(e,"] ").concat(o.shift()),"color:".concat(cM[this._indent],";")].concat(o))}}}]),e}(),hM=new lM("VERTC",0),fM=function(e){h(n,e);var t,r=g(n);function n(){return u(this,n),r.apply(this,arguments)}return d(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=S(f(n.prototype),"emit",this)).call.apply(r,[this,e].concat(o))}catch(RY){return hM.print("safaEmit","safeEmit() | event listener threw an error [event:%s]:%o",e,RY),Boolean(t)}}},{key:"safeEmitAsPromise",value:(t=s(regeneratorRuntime.mark((function e(t){var r,n,i,o=this,a=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(r=a.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=a[i];return e.abrupt("return",new Promise((function(e,r){try{o.emit.apply(o,[t].concat(n,[e,r]))}catch(RY){hM.print("safeEmitAsPromise","safeEmitAsPromise() | event listener threw an error [event:%s]:%o",t,RY),r(RY)}})));case 2:case"end":return e.stop()}}),e)}))),function(e){return t.apply(this,arguments)})}]),n}(aM.exports.EventEmitter),pM=Vt,_M=function(e){return void 0!==e&&(pM(e,"value")||pM(e,"writable"))},vM=he,mM=He,gM=Pr,yM=_M,SM=ae,bM=tc;Yi({target:"Reflect",stat:!0},{get:function e(t,r){var n,i,o=arguments.length<3?t:arguments[2];return gM(t)===o?t[r]:(n=SM.f(t,r))?yM(n)?n.value:void 0===n.get?void 0:vM(n.get,o):mM(i=bM(t))?e(i,r,o):void 0}});var EM=oe,kM=fa;Yi({global:!0},{Reflect:{}}),kM(EM.Reflect,"Reflect",!0);var RM=Yi,TM=he,IM=Pr,AM=He,wM=_M,CM=wr,OM=ae,xM=tc,NM=ye;var DM=se((function(){var e=function(){},t=CM.f(new e,"a",{configurable:!0});return!1!==Reflect.set(e.prototype,"a",1,t)}));RM({target:"Reflect",stat:!0,forced:DM},{set:function e(t,r,n){var i,o,a,s=arguments.length<4?t:arguments[3],u=OM.f(IM(t),r);if(!u){if(AM(o=xM(t)))return e(o,r,n,s);u=NM(0)}if(wM(u)){if(!1===u.writable||!AM(s))return!1;if(i=OM.f(s,r)){if(i.get||i.set||!1===i.writable)return!1;i.value=n,CM.f(s,r,i)}else CM.f(s,r,NM(0,n))}else{if(void 0===(a=u.set))return!1;TM(a,s,n)}return!0}}),(0,iA.exports)("Uint16",(function(e){return function(t,r,n){return e(this,t,r,n)}})),(0,iA.exports)("Int32",(function(e){return function(t,r,n){return e(this,t,r,n)}}));var PM={};!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"!==o(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)}(PM);var MM={},UM={},LM={},VM=PM;function FM(e){for(var t=e.length;--t>=0;)e[t]=0}var BM=256,jM=286,GM=30,HM=15,zM=[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],KM=[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],WM=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],XM=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],YM=new Array(576);FM(YM);var qM=new Array(60);FM(qM);var JM=new Array(512);FM(JM);var QM=new Array(256);FM(QM);var ZM=new Array(29);FM(ZM);var $M,eU,tU,rU=new Array(GM);function nU(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 iU(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function oU(e){return e<256?JM[e]:JM[256+(e>>>7)]}function aU(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function sU(e,t,r){e.bi_valid>16-r?(e.bi_buf|=t<<e.bi_valid&65535,aU(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 uU(e,t,r){sU(e,r[2*t],r[2*t+1])}function cU(e,t){var r=0;do{r|=1&e,e>>>=1,r<<=1}while(--t>0);return r>>>1}function dU(e,t,r){var n,i,o=new Array(16),a=0;for(n=1;n<=HM;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]=cU(o[s]++,s))}}function lU(e){var t;for(t=0;t<jM;t++)e.dyn_ltree[2*t]=0;for(t=0;t<GM;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?aU(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 fU(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 pU(e,t,r){for(var n=e.heap[r],i=r<<1;i<=e.heap_len&&(i<e.heap_len&&fU(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!fU(t,n,e.heap[i],e.depth));)e.heap[r]=e.heap[i],r=i,i<<=1;e.heap[r]=n}function _U(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?uU(e,i,t):(uU(e,(o=QM[i])+BM+1,t),0!==(a=zM[o])&&sU(e,i-=ZM[o],a),uU(e,o=oU(--n),r),0!==(a=KM[o])&&sU(e,n-=rU[o],a))}while(s<e.last_lit);uU(e,256,t)}function vU(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--)pU(e,o,r);i=u;do{r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],pU(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++,pU(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,_=0;for(o=0;o<=HM;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,_++),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!==_){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]--,_-=2}while(_>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),dU(o,c,e.bl_count)}function mU(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 gU(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{uU(e,i,e.bl_tree)}while(0!=--s);else 0!==i?(i!==o&&(uU(e,i,e.bl_tree),s--),uU(e,16,e.bl_tree),sU(e,s-3,2)):s<=10?(uU(e,17,e.bl_tree),sU(e,s-3,3)):(uU(e,18,e.bl_tree),sU(e,s-11,7));s=0,o=i,0===a?(u=138,c=3):i===a?(u=6,c=3):(u=7,c=4)}}FM(rU);var yU=!1;function SU(e,t,r,n){sU(e,0+(n?1:0),3),function(e,t,r,n){hU(e),n&&(aU(e,r),aU(e,~r)),VM.arraySet(e.pending_buf,e.window,t,r,e.pending),e.pending+=r}(e,t,r,!0)}LM._tr_init=function(e){yU||(!function(){var e,t,r,n,i,o=new Array(16);for(r=0,n=0;n<28;n++)for(ZM[n]=r,e=0;e<1<<zM[n];e++)QM[r++]=n;for(QM[r-1]=n,i=0,n=0;n<16;n++)for(rU[n]=i,e=0;e<1<<KM[n];e++)JM[i++]=n;for(i>>=7;n<GM;n++)for(rU[n]=i<<7,e=0;e<1<<KM[n]-7;e++)JM[256+i++]=n;for(t=0;t<=HM;t++)o[t]=0;for(e=0;e<=143;)YM[2*e+1]=8,e++,o[8]++;for(;e<=255;)YM[2*e+1]=9,e++,o[9]++;for(;e<=279;)YM[2*e+1]=7,e++,o[7]++;for(;e<=287;)YM[2*e+1]=8,e++,o[8]++;for(dU(YM,287,o),e=0;e<GM;e++)qM[2*e+1]=5,qM[2*e]=cU(e,5);$M=new nU(YM,zM,257,jM,HM),eU=new nU(qM,KM,0,GM,HM),tU=new nU(new Array(0),WM,0,19,7)}(),yU=!0),e.l_desc=new iU(e.dyn_ltree,$M),e.d_desc=new iU(e.dyn_dtree,eU),e.bl_desc=new iU(e.bl_tree,tU),e.bi_buf=0,e.bi_valid=0,lU(e)},LM._tr_stored_block=SU,LM._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<BM;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0}(e)),vU(e,e.l_desc),vU(e,e.d_desc),a=function(e){var t;for(mU(e,e.dyn_ltree,e.l_desc.max_code),mU(e,e.dyn_dtree,e.d_desc.max_code),vU(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*XM[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?SU(e,t,r,n):4===e.strategy||o===i?(sU(e,2+(n?1:0),3),_U(e,YM,qM)):(sU(e,4+(n?1:0),3),function(e,t,r,n){var i;for(sU(e,t-257,5),sU(e,r-1,5),sU(e,n-4,4),i=0;i<n;i++)sU(e,e.bl_tree[2*XM[i]+1],3);gU(e,e.dyn_ltree,t-1),gU(e,e.dyn_dtree,r-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),_U(e,e.dyn_ltree,e.dyn_dtree)),lU(e),n&&hU(e)},LM._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*(QM[r]+BM+1)]++,e.dyn_dtree[2*oU(t)]++),e.last_lit===e.lit_bufsize-1},LM._tr_align=function(e){sU(e,2,3),uU(e,256,YM),function(e){16===e.bi_valid?(aU(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 bU=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 EU=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 kU,RU=function(e,t,r,n){var i=EU,o=n+r;e^=-1;for(var a=n;a<o;a++)e=e>>>8^i[255&(e^t[a])];return-1^e},TU={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"},IU=PM,AU=LM,wU=bU,CU=RU,OU=TU,xU=-2,NU=258,DU=262,PU=103,MU=113,UU=666;function LU(e,t){return e.msg=OU[t],t}function VU(e){return(e<<1)-(e>4?9:0)}function FU(e){for(var t=e.length;--t>=0;)e[t]=0}function BU(e){var t=e.state,r=t.pending;r>e.avail_out&&(r=e.avail_out),0!==r&&(IU.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 jU(e,t){AU._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,BU(e.strm)}function GU(e,t){e.pending_buf[e.pending++]=t}function HU(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function zU(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-DU?e.strstart-(e.w_size-DU):0,c=e.window,d=e.w_mask,l=e.prev,h=e.strstart+NU,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=NU-(h-o),o=h-NU,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 KU(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-DU)){IU.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,IU.arraySet(s,a.input,a.next_in,d,u),1===a.state.wrap?a.adler=wU(a.adler,s,d,u):2===a.state.wrap&&(a.adler=CU(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<DU&&0!==e.strm.avail_in)}function WU(e,t){for(var r,n;;){if(e.lookahead<DU){if(KU(e),e.lookahead<DU&&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-DU&&(e.match_length=zU(e,r)),e.match_length>=3)if(n=AU._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=AU._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(n&&(jU(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,4===t?(jU(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(jU(e,!1),0===e.strm.avail_out)?1:2}function XU(e,t){for(var r,n,i;;){if(e.lookahead<DU){if(KU(e),e.lookahead<DU&&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-DU&&(e.match_length=zU(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=AU._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&&(jU(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if((n=AU._tr_tally(e,0,e.window[e.strstart-1]))&&jU(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=AU._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,4===t?(jU(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(jU(e,!1),0===e.strm.avail_out)?1:2}function YU(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 qU(){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 IU.Buf16(1146),this.dyn_dtree=new IU.Buf16(122),this.bl_tree=new IU.Buf16(78),FU(this.dyn_ltree),FU(this.dyn_dtree),FU(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new IU.Buf16(16),this.heap=new IU.Buf16(573),FU(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new IU.Buf16(573),FU(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 JU(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:MU,e.adler=2===t.wrap?0:1,t.last_flush=0,AU._tr_init(t),0):LU(e,xU)}function QU(e){var t,r=JU(e);return 0===r&&((t=e.state).window_size=2*t.w_size,FU(t.head),t.max_lazy_match=kU[t.level].max_lazy,t.good_match=kU[t.level].good_length,t.nice_match=kU[t.level].nice_length,t.max_chain_length=kU[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 ZU(e,t,r,n,i,o){if(!e)return xU;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 LU(e,xU);8===n&&(n=9);var s=new qU;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 IU.Buf8(2*s.w_size),s.head=new IU.Buf16(s.hash_size),s.prev=new IU.Buf16(s.w_size),s.lit_bufsize=1<<i+6,s.pending_buf_size=4*s.lit_bufsize,s.pending_buf=new IU.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,QU(e)}kU=[new YU(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(KU(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,jU(e,!1),0===e.strm.avail_out))return 1;if(e.strstart-e.block_start>=e.w_size-DU&&(jU(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(jU(e,!0),0===e.strm.avail_out?3:4):(e.strstart>e.block_start&&(jU(e,!1),e.strm.avail_out),1)})),new YU(4,4,8,4,WU),new YU(4,5,16,8,WU),new YU(4,6,32,32,WU),new YU(4,4,16,16,XU),new YU(8,16,32,32,XU),new YU(8,16,128,128,XU),new YU(8,32,128,256,XU),new YU(32,128,258,1024,XU),new YU(32,258,258,4096,XU)],UM.deflateInit=function(e,t){return ZU(e,t,8,15,8,0)},UM.deflateInit2=ZU,UM.deflateReset=QU,UM.deflateResetKeep=JU,UM.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?xU:(e.state.gzhead=t,0):xU},UM.deflate=function(e,t){var r,n,i,o;if(!e||!e.state||t>5||t<0)return e?LU(e,xU):xU;if(n=e.state,!e.output||!e.input&&0!==e.avail_in||n.status===UU&&4!==t)return LU(e,0===e.avail_out?-5:xU);if(n.strm=e,r=n.last_flush,n.last_flush=t,42===n.status)if(2===n.wrap)e.adler=0,GU(n,31),GU(n,139),GU(n,8),n.gzhead?(GU(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)),GU(n,255&n.gzhead.time),GU(n,n.gzhead.time>>8&255),GU(n,n.gzhead.time>>16&255),GU(n,n.gzhead.time>>24&255),GU(n,9===n.level?2:n.strategy>=2||n.level<2?4:0),GU(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(GU(n,255&n.gzhead.extra.length),GU(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=CU(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(GU(n,0),GU(n,0),GU(n,0),GU(n,0),GU(n,0),GU(n,9===n.level?2:n.strategy>=2||n.level<2?4:0),GU(n,3),n.status=MU);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=MU,HU(n,a),0!==n.strstart&&(HU(n,e.adler>>>16),HU(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=CU(e.adler,n.pending_buf,n.pending-i,i)),BU(e),i=n.pending,n.pending!==n.pending_buf_size));)GU(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(e.adler=CU(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=CU(e.adler,n.pending_buf,n.pending-i,i)),BU(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,GU(n,o)}while(0!==o);n.gzhead.hcrc&&n.pending>i&&(e.adler=CU(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=CU(e.adler,n.pending_buf,n.pending-i,i)),BU(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,GU(n,o)}while(0!==o);n.gzhead.hcrc&&n.pending>i&&(e.adler=CU(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.status=PU)}else n.status=PU;if(n.status===PU&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&BU(e),n.pending+2<=n.pending_buf_size&&(GU(n,255&e.adler),GU(n,e.adler>>8&255),e.adler=0,n.status=MU)):n.status=MU),0!==n.pending){if(BU(e),0===e.avail_out)return n.last_flush=-1,0}else if(0===e.avail_in&&VU(t)<=VU(r)&&4!==t)return LU(e,-5);if(n.status===UU&&0!==e.avail_in)return LU(e,-5);if(0!==e.avail_in||0!==n.lookahead||0!==t&&n.status!==UU){var s=2===n.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(KU(e),0===e.lookahead)){if(0===t)return 1;break}if(e.match_length=0,r=AU._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(jU(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(jU(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(jU(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<=NU){if(KU(e),e.lookahead<=NU&&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+NU;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=NU-(o-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(r=AU._tr_tally(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=AU._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(jU(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(jU(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(jU(e,!1),0===e.strm.avail_out)?1:2}(n,t):kU[n.level].func(n,t);if(3!==s&&4!==s||(n.status=UU),1===s||3===s)return 0===e.avail_out&&(n.last_flush=-1),0;if(2===s&&(1===t?AU._tr_align(n):5!==t&&(AU._tr_stored_block(n,0,0,!1),3===t&&(FU(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),BU(e),0===e.avail_out))return n.last_flush=-1,0}return 4!==t?0:n.wrap<=0?1:(2===n.wrap?(GU(n,255&e.adler),GU(n,e.adler>>8&255),GU(n,e.adler>>16&255),GU(n,e.adler>>24&255),GU(n,255&e.total_in),GU(n,e.total_in>>8&255),GU(n,e.total_in>>16&255),GU(n,e.total_in>>24&255)):(HU(n,e.adler>>>16),HU(n,65535&e.adler)),BU(e),n.wrap>0&&(n.wrap=-n.wrap),0!==n.pending?0:1)},UM.deflateEnd=function(e){var t;return e&&e.state?42!==(t=e.state.status)&&69!==t&&73!==t&&91!==t&&t!==PU&&t!==MU&&t!==UU?LU(e,xU):(e.state=null,t===MU?LU(e,-3):0):xU},UM.deflateSetDictionary=function(e,t){var r,n,i,o,a,s,u,c,d=t.length;if(!e||!e.state)return xU;if(2===(o=(r=e.state).wrap)||1===o&&42!==r.status||r.lookahead)return xU;for(1===o&&(e.adler=wU(e.adler,t,d,0)),r.wrap=0,d>=r.w_size&&(0===o&&(FU(r.head),r.strstart=0,r.block_start=0,r.insert=0),c=new IU.Buf8(r.w_size),IU.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,KU(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,KU(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},UM.deflateInfo="pako deflate (from Nodeca project)";var $U={},eL=PM,tL=!0,rL=!0;try{String.fromCharCode.apply(null,[0])}catch(TY){tL=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(TY){rL=!1}for(var nL=new eL.Buf8(256),iL=0;iL<256;iL++)nL[iL]=iL>=252?6:iL>=248?5:iL>=240?4:iL>=224?3:iL>=192?2:1;function oL(e,t){if(t<65534&&(e.subarray&&rL||!e.subarray&&tL))return String.fromCharCode.apply(null,eL.shrinkBuf(e,t));for(var r="",n=0;n<t;n++)r+=String.fromCharCode(e[n]);return r}nL[254]=nL[254]=1,$U.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 eL.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},$U.buf2binstring=function(e){return oL(e,e.length)},$U.binstring2buf=function(e){for(var t=new eL.Buf8(e.length),r=0,n=t.length;r<n;r++)t[r]=e.charCodeAt(r);return t},$U.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=nL[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 oL(s,n)},$U.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+nL[e[r]]>t?r:t};var aL=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},sL=UM,uL=PM,cL=$U,dL=TU,lL=aL,hL=Object.prototype.toString;function fL(e){if(!(this instanceof fL))return new fL(e);this.options=uL.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 lL,this.strm.avail_out=0;var r=sL.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(0!==r)throw new Error(dL[r]);if(t.header&&sL.deflateSetHeader(this.strm,t.header),t.dictionary){var n;if(n="string"==typeof t.dictionary?cL.string2buf(t.dictionary):"[object ArrayBuffer]"===hL.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,0!==(r=sL.deflateSetDictionary(this.strm,n)))throw new Error(dL[r]);this._dict_set=!0}}function pL(e,t){var r=new fL(t);if(r.push(e,!0),r.err)throw r.msg||dL[r.err];return r.result}fL.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=cL.string2buf(e):"[object ArrayBuffer]"===hL.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 uL.Buf8(o),i.next_out=0,i.avail_out=o),1!==(r=sL.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(cL.buf2binstring(uL.shrinkBuf(i.output,i.next_out))):this.onData(uL.shrinkBuf(i.output,i.next_out)))}while((i.avail_in>0||0===i.avail_out)&&1!==r);return 4===n?(r=sL.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,0===r):2!==n||(this.onEnd(0),i.avail_out=0,!0)},fL.prototype.onData=function(e){this.chunks.push(e)},fL.prototype.onEnd=function(e){0===e&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=uL.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},MM.Deflate=fL,MM.deflate=pL,MM.deflateRaw=function(e,t){return(t=t||{}).raw=!0,pL(e,t)},MM.gzip=function(e,t){return(t=t||{}).gzip=!0,pL(e,t)};var _L={},vL=ue,mL=wr,gL=X_,yL=se,SL=RegExp.prototype;vL&&yL((function(){return"sy"!==Object.getOwnPropertyDescriptor(SL,"flags").get.call({dotAll:!0,sticky:!0})}))&&mL.f(SL,"flags",{configurable:!0,get:gL});var bL={},EL=PM,kL=15,RL=[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],TL=[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],IL=[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],AL=[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],wL=PM,CL=bU,OL=RU,xL=function(e,t){var r,n,i,o,a,s,u,c,d,l,h,f,p,_,v,m,g,y,S,b,E,k,R,T,I;r=e.state,n=e.next_in,T=e.input,i=n+(e.avail_in-5),o=e.next_out,I=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,_=r.lencode,v=r.distcode,m=(1<<r.lenbits)-1,g=(1<<r.distbits)-1;e:do{p<15&&(f+=T[n++]<<p,p+=8,f+=T[n++]<<p,p+=8),y=_[f&m];t:for(;;){if(f>>>=S=y>>>24,p-=S,0===(S=y>>>16&255))I[o++]=65535&y;else{if(!(16&S)){if(0==(64&S)){y=_[(65535&y)+(f&(1<<S)-1)];continue t}if(32&S){r.mode=12;break e}e.msg="invalid literal/length code",r.mode=30;break e}b=65535&y,(S&=15)&&(p<S&&(f+=T[n++]<<p,p+=8),b+=f&(1<<S)-1,f>>>=S,p-=S),p<15&&(f+=T[n++]<<p,p+=8,f+=T[n++]<<p,p+=8),y=v[f&g];r:for(;;){if(f>>>=S=y>>>24,p-=S,!(16&(S=y>>>16&255))){if(0==(64&S)){y=v[(65535&y)+(f&(1<<S)-1)];continue r}e.msg="invalid distance code",r.mode=30;break e}if(E=65535&y,p<(S&=15)&&(f+=T[n++]<<p,(p+=8)<S&&(f+=T[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,R=h,0===l){if(k+=c-S,S<b){b-=S;do{I[o++]=h[k++]}while(--S);k=o-E,R=I}}else if(l<S){if(k+=c+l-S,(S-=l)<b){b-=S;do{I[o++]=h[k++]}while(--S);if(k=0,l<b){b-=S=l;do{I[o++]=h[k++]}while(--S);k=o-E,R=I}}}else if(k+=l-S,S<b){b-=S;do{I[o++]=h[k++]}while(--S);k=o-E,R=I}for(;b>2;)I[o++]=R[k++],I[o++]=R[k++],I[o++]=R[k++],b-=3;b&&(I[o++]=R[k++],b>1&&(I[o++]=R[k++]))}else{k=o-E;do{I[o++]=I[k++],I[o++]=I[k++],I[o++]=I[k++],b-=3}while(b>2);b&&(I[o++]=I[k++],b>1&&(I[o++]=I[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},NL=function(e,t,r,n,i,o,a,s){var u,c,d,l,h,f,p,_,v,m=s.bits,g=0,y=0,S=0,b=0,E=0,k=0,R=0,T=0,I=0,A=0,w=null,C=0,O=new EL.Buf16(16),x=new EL.Buf16(16),N=null,D=0;for(g=0;g<=kL;g++)O[g]=0;for(y=0;y<n;y++)O[t[r+y]]++;for(E=m,b=kL;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),T=1,g=1;g<=kL;g++)if(T<<=1,(T-=O[g])<0)return-1;if(T>0&&(0===e||1!==b))return-1;for(x[1]=0,g=1;g<kL;g++)x[g+1]=x[g]+O[g];for(y=0;y<n;y++)0!==t[r+y]&&(a[x[t[r+y]]++]=y);if(0===e?(w=N=a,f=19):1===e?(w=RL,C-=257,N=TL,D-=257,f=256):(w=IL,N=AL,f=-1),A=0,y=0,g=S,h=o,k=E,R=0,d=-1,l=(I=1<<E)-1,1===e&&I>852||2===e&&I>592)return 1;for(;;){p=g-R,a[y]<f?(_=0,v=a[y]):a[y]>f?(_=N[D+a[y]],v=w[C+a[y]]):(_=96,v=0),u=1<<g-R,S=c=1<<k;do{i[h+(A>>R)+(c-=u)]=p<<24|_<<16|v|0}while(0!==c);for(u=1<<g-1;A&u;)u>>=1;if(0!==u?(A&=u-1,A+=u):A=0,y++,0==--O[g]){if(g===b)break;g=t[r+a[y]]}if(g>E&&(A&l)!==d){for(0===R&&(R=E),h+=S,T=1<<(k=g-R);k+R<b&&!((T-=O[k+R])<=0);)k++,T<<=1;if(I+=1<<k,1===e&&I>852||2===e&&I>592)return 1;i[d=A&l]=E<<24|k<<16|h-o|0}}return 0!==A&&(i[h+A]=g-R<<24|64<<16|0),s.bits=E,0},DL=-2,PL=12,ML=30;function UL(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function LL(){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 wL.Buf16(320),this.work=new wL.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function VL(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 wL.Buf32(852),t.distcode=t.distdyn=new wL.Buf32(592),t.sane=1,t.back=-1,0):DL}function FL(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,VL(e)):DL}function BL(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)?DL:(null!==n.window&&n.wbits!==t&&(n.window=null),n.wrap=r,n.wbits=t,FL(e))):DL}function jL(e,t){var r,n;return e?(n=new LL,e.state=n,n.window=null,0!==(r=BL(e,t))&&(e.state=null),r):DL}var GL,HL,zL=!0;function KL(e){if(zL){var t;for(GL=new wL.Buf32(512),HL=new wL.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(NL(1,e.lens,0,288,GL,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;NL(2,e.lens,0,32,HL,0,e.work,{bits:5}),zL=!1}e.lencode=GL,e.lenbits=9,e.distcode=HL,e.distbits=5}function WL(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 wL.Buf8(o.wsize)),n>=o.wsize?(wL.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),wL.arraySet(o.window,t,r-n,i,o.wnext),(n-=i)?(wL.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}bL.inflateReset=FL,bL.inflateReset2=BL,bL.inflateResetKeep=VL,bL.inflateInit=function(e){return jL(e,15)},bL.inflateInit2=jL,bL.inflate=function(e,t){var r,n,i,o,a,s,u,c,d,l,h,f,p,_,v,m,g,y,S,b,E,k,R,T,I=0,A=new wL.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 DL;(r=e.state).mode===PL&&(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=OL(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=ML;break}if(8!=(15&c)){e.msg="unknown compression method",r.mode=ML;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=ML;break}r.dmax=1<<E,e.adler=r.check=1,r.mode=512&c?10:PL,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=ML;break}if(57344&r.flags){e.msg="unknown header flags set",r.mode=ML;break}r.head&&(r.head.text=c>>8&1),512&r.flags&&(A[0]=255&c,A[1]=c>>>8&255,r.check=OL(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=OL(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=OL(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=OL(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)),wL.arraySet(r.head.extra,n,o,f,E)),512&r.flags&&(r.check=OL(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=OL(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=OL(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=ML;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=PL;break;case 10:for(;d<32;){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}e.adler=r.check=UL(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=PL;case PL: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(KL(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=ML}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=ML;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;wL.arraySet(i,n,o,f,a),s-=f,o+=f,u-=f,a+=f,r.length-=f;break}r.mode=PL;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=ML;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,R={bits:r.lenbits},k=NL(0,r.lens,0,19,r.lencode,0,r.work,R),r.lenbits=R.bits,k){e.msg="invalid code lengths set",r.mode=ML;break}r.have=0,r.mode=19;case 19:for(;r.have<r.nlen+r.ndist;){for(;m=(I=r.lencode[c&(1<<r.lenbits)-1])>>>16&255,g=65535&I,!((v=I>>>24)<=d);){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}if(g<16)c>>>=v,d-=v,r.lens[r.have++]=g;else{if(16===g){for(T=v+2;d<T;){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}if(c>>>=v,d-=v,0===r.have){e.msg="invalid bit length repeat",r.mode=ML;break}E=r.lens[r.have-1],f=3+(3&c),c>>>=2,d-=2}else if(17===g){for(T=v+3;d<T;){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}d-=v,E=0,f=3+(7&(c>>>=v)),c>>>=3,d-=3}else{for(T=v+7;d<T;){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}d-=v,E=0,f=11+(127&(c>>>=v)),c>>>=7,d-=7}if(r.have+f>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=ML;break}for(;f--;)r.lens[r.have++]=E}}if(r.mode===ML)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=ML;break}if(r.lenbits=9,R={bits:r.lenbits},k=NL(1,r.lens,0,r.nlen,r.lencode,0,r.work,R),r.lenbits=R.bits,k){e.msg="invalid literal/lengths set",r.mode=ML;break}if(r.distbits=6,r.distcode=r.distdyn,R={bits:r.distbits},k=NL(2,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,R),r.distbits=R.bits,k){e.msg="invalid distances set",r.mode=ML;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,xL(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===PL&&(r.back=-1);break}for(r.back=0;m=(I=r.lencode[c&(1<<r.lenbits)-1])>>>16&255,g=65535&I,!((v=I>>>24)<=d);){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}if(m&&0==(240&m)){for(y=v,S=m,b=g;m=(I=r.lencode[b+((c&(1<<y+S)-1)>>y)])>>>16&255,g=65535&I,!(y+(v=I>>>24)<=d);){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}c>>>=y,d-=y,r.back+=y}if(c>>>=v,d-=v,r.back+=v,r.length=g,0===m){r.mode=26;break}if(32&m){r.back=-1,r.mode=PL;break}if(64&m){e.msg="invalid literal/length code",r.mode=ML;break}r.extra=15&m,r.mode=22;case 22:if(r.extra){for(T=r.extra;d<T;){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=(I=r.distcode[c&(1<<r.distbits)-1])>>>16&255,g=65535&I,!((v=I>>>24)<=d);){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}if(0==(240&m)){for(y=v,S=m,b=g;m=(I=r.distcode[b+((c&(1<<y+S)-1)>>y)])>>>16&255,g=65535&I,!(y+(v=I>>>24)<=d);){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}c>>>=y,d-=y,r.back+=y}if(c>>>=v,d-=v,r.back+=v,64&m){e.msg="invalid distance code",r.mode=ML;break}r.offset=g,r.extra=15&m,r.mode=24;case 24:if(r.extra){for(T=r.extra;d<T;){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=ML;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=ML;break}f>r.wnext?(f-=r.wnext,p=r.wsize-f):p=r.wnext-f,f>r.length&&(f=r.length),_=r.window}else _=i,p=a-r.offset,f=r.length;f>u&&(f=u),u-=f,r.length-=f;do{i[a++]=_[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?OL(r.check,i,h,a-h):CL(r.check,i,h,a-h)),h=u,(r.flags?c:UL(c))!==r.check){e.msg="incorrect data check",r.mode=ML;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=ML;break}c=0,d=0}r.mode=29;case 29:k=1;break e;case ML:k=-3;break e;case 31:return-4;default:return DL}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<ML&&(r.mode<27||4!==t))&&WL(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?OL(r.check,i,h,e.next_out-h):CL(r.check,i,h,e.next_out-h)),e.data_type=r.bits+(r.last?64:0)+(r.mode===PL?128:0)+(20===r.mode||15===r.mode?256:0),(0===l&&0===h||4===t)&&0===k&&(k=-5),k},bL.inflateEnd=function(e){if(!e||!e.state)return DL;var t=e.state;return t.window&&(t.window=null),e.state=null,0},bL.inflateGetHeader=function(e,t){var r;return e&&e.state?0==(2&(r=e.state).wrap)?DL:(r.head=t,t.done=!1,0):DL},bL.inflateSetDictionary=function(e,t){var r,n=t.length;return e&&e.state?0!==(r=e.state).wrap&&11!==r.mode?DL:11===r.mode&&CL(1,t,n,0)!==r.check?-3:WL(e,t,n,n)?(r.mode=31,-4):(r.havedict=1,0):DL},bL.inflateInfo="pako inflate (from Nodeca project)";var XL={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 YL=bL,qL=PM,JL=$U,QL=XL,ZL=TU,$L=aL,eV=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},tV=Object.prototype.toString;function rV(e){if(!(this instanceof rV))return new rV(e);this.options=qL.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 $L,this.strm.avail_out=0;var r=YL.inflateInit2(this.strm,t.windowBits);if(r!==QL.Z_OK)throw new Error(ZL[r]);if(this.header=new eV,YL.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=JL.string2buf(t.dictionary):"[object ArrayBuffer]"===tV.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(r=YL.inflateSetDictionary(this.strm,t.dictionary))!==QL.Z_OK))throw new Error(ZL[r])}function nV(e,t){var r=new rV(t);if(r.push(e,!0),r.err)throw r.msg||ZL[r.err];return r.result}rV.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?QL.Z_FINISH:QL.Z_NO_FLUSH,"string"==typeof e?s.input=JL.binstring2buf(e):"[object ArrayBuffer]"===tV.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 qL.Buf8(u),s.next_out=0,s.avail_out=u),(r=YL.inflate(s,QL.Z_NO_FLUSH))===QL.Z_NEED_DICT&&c&&(r=YL.inflateSetDictionary(this.strm,c)),r===QL.Z_BUF_ERROR&&!0===d&&(r=QL.Z_OK,d=!1),r!==QL.Z_STREAM_END&&r!==QL.Z_OK)return this.onEnd(r),this.ended=!0,!1;s.next_out&&(0!==s.avail_out&&r!==QL.Z_STREAM_END&&(0!==s.avail_in||n!==QL.Z_FINISH&&n!==QL.Z_SYNC_FLUSH)||("string"===this.options.to?(i=JL.utf8border(s.output,s.next_out),o=s.next_out-i,a=JL.buf2string(s.output,i),s.next_out=o,s.avail_out=u-o,o&&qL.arraySet(s.output,s.output,i,o,0),this.onData(a)):this.onData(qL.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!==QL.Z_STREAM_END);return r===QL.Z_STREAM_END&&(n=QL.Z_FINISH),n===QL.Z_FINISH?(r=YL.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===QL.Z_OK):n!==QL.Z_SYNC_FLUSH||(this.onEnd(QL.Z_OK),s.avail_out=0,!0)},rV.prototype.onData=function(e){this.chunks.push(e)},rV.prototype.onEnd=function(e){e===QL.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=qL.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},_L.Inflate=rV,_L.inflate=nV,_L.inflateRaw=function(e,t){return(t=t||{}).raw=!0,nV(e,t)},_L.ungzip=nV;var iV={};(0,PM.assign)(iV,MM,_L,XL);var oV=iV,aV=function(e){return e.RTC="rtc",e}(aV||{}),sV=function(e){return e.W_5="5",e}(sV||{}),uV=function(e){return e.IOS="ios",e.ANDROID="android",e.WEB="web",e.WINDOWS="windows",e.MAC="mac",e.LINUX="linux",e}(uV||{}),cV=function(e){return e.REQUEST="request",e.RESPONSE="response",e}(cV||{}),dV=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}(dV||{}),lV=function(e){return e.WEBSOCKET="websocket",e.NETWORKCHANGED="networkChanged",e.PEERCONNECTION="peerconnection",e}(lV||{}),hV=function(e){return e.WEBSOCKET_RECONNECTED="websocket reconnected",e.PEERCONNECTION_RECONNECTED="peerconnection reconnected",e}(hV||{}),fV=function(e){return e.WEBSOCKET="websocket",e.NETWORKCHANGED="networkChanged",e.PEERCONNECTION="peerconnection",e}(fV||{}),pV=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}(pV||{}),_V=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}(_V||{}),vV=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}(vV||{}),mV=function(e){return e.UP="up",e.DOWN="down",e.DIRECT="direct",e}(mV||{}),gV=function(e){return e.UP="up",e.DOWN="down",e.PRE="pre",e}(gV||{}),yV=function(e){return e.UP="up",e.DOWN="down",e.PRE="pre",e}(yV||{}),SV=function(e){return e.W_0="0",e.W_1="1",e}(SV||{}),bV=function(e){return e.UP="up",e.DOWN="down",e}(bV||{}),EV=function(e){return e.ANSWER="answer",e.INCRANSWER="incranswer",e}(EV||{}),kV=function(e){return e.UP="up",e.DOWN="down",e}(kV||{}),RV=function(e){return e.SUCCESS="success",e.FAIL="fail",e}(RV||{}),TV=function(e){return e.W_0="0",e.W_1="1",e}(TV||{}),IV=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}(IV||{}),AV=function(e){return e.SUCCESS="success",e.FAIL="fail",e.IGNORE="ignore",e}(AV||{}),wV=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}(wV||{}),CV=function(e){return e.PLAYOUT_DEVICE_SWITCH="playout_device_switch",e.RECORD_DEVICE_SWITCH="record_device_switch",e.UNKNOWN="unknown",e}(CV||{}),OV=function(e){return e.BEGIN_SEND="begin_send",e.SENT_END="sent_end",e.BEGIN_RECV="begin_recv",e.RECV_END="recv_end",e}(OV||{}),xV=function(e){return e.AUDIO="audio",e.VIDEO="video",e.SCREEN_VIDEO="screen_video",e.SCREEN_AUDIO="screen_audio",e}(xV||{}),NV=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}(NV||{}),DV=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}(DV||{}),PV=function(e){return e.BEGIN="begin",e.END="end",e}(PV||{}),MV=function(e){return e.BEGIN="begin",e.END="end",e}(MV||{}),UV=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}(UV||{}),LV=function(e){return e.P2P="p2p",e.P2P_OUTSIDE_ROOM="p2p_outside_room",e.P2SERVER="p2server",e}(LV||{}),VV=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}(VV||{}),FV=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}(FV||{}),BV=function(){function e(t){u(this,e),l(this,"_event_key",void 0),l(this,"_device_id",void 0),l(this,"_rtc_app_id",void 0),l(this,"_product_line",void 0),l(this,"_report_version",void 0),l(this,"_os",void 0),l(this,"_rtc_sdk_version",void 0),l(this,"_rtc_timestamp",void 0),l(this,"_rtc_sdk_git_commit",void 0),l(this,"_report_id",void 0),l(this,"_connection_id",void 0),l(this,"_rtc_sid",void 0),l(this,"_engine_session_id",void 0),l(this,"_rtc_business_id",void 0),l(this,"_project_key",void 0),l(this,"_network_type",void 0),l(this,"_app_version",void 0),l(this,"_aid",void 0),l(this,"_device_model",void 0),l(this,"_device_brand",void 0),l(this,"_common_extra_info",void 0),l(this,"_had_selected_p2p",void 0),l(this,"_rtc_env_type",void 0),l(this,"_room_id",void 0),l(this,"_user_id",void 0),l(this,"_rtc_session_id",void 0),l(this,"_user_agent",void 0),l(this,"_auto_play_policy",void 0),this.monitor=t}return d(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}}]),e}(),jV=function(e){h(r,e);var t=g(r);function r(){var e;return u(this,r),l(v(e=t.call(this)),"report_id",void 0),l(v(e),"report_common",void 0),l(v(e),"modify_ids",void 0),l(v(e),"dataBuffer",void 0),l(v(e),"posting",void 0),l(v(e),"sucSendTimer",void 0),l(v(e),"preSucTime",void 0),l(v(e),"errSendTimer",void 0),l(v(e),"errSendDelay",void 0),l(v(e),"commonStats",void 0),e.report_id=0,e.dataBuffer=[],e.posting=!1,e.report_common={},e.modify_ids={},e.preSucTime=0,e.errSendDelay=100,e.commonStats=new BV(v(e)),IP()||window.addEventListener("beforeunload",(function(){clearTimeout(e.errSendTimer),clearTimeout(e.sucSendTimer),e.send(null,!0)})),e}return d(r,[{key:"push",value:function(e,t){t?this.send(e):(this.dataBuffer.push(e),!this.posting&&!this.errSendTimer&&Date.now()-this.preSucTime>2e3&&(clearTimeout(this.sucSendTimer),this.send()))}},{key:"unshift",value:function(e){this.dataBuffer=e.concat(this.dataBuffer)}},{key:"send",value:function(e,t){var r=this;if(e||this.dataBuffer.length){var n={data:e||this.dataBuffer.splice(0,4e3),header:this.report_common,from:"web",os:"web",version:"1"},i=new XMLHttpRequest;i.timeout=1e4,i.onreadystatechange=function(){if(4===i.readyState){var o;if(e||(r.posting=!1),200===i.status||304===i.status)try{o=JSON.parse(i.responseText)}catch(RY){}o&&0===o.StatusCode?e||t||r.sucSend():e?r.send(e):(r.unshift(n.data),t?r.send():r.errSend())}};var o=lF.LOG_SERVER_URL;if(i.open("POST",o,!0),e||(this.posting=!0),!IP()&&location.search.includes("_rtc_autotest_"))this.safeEmit("report_event",n),0!==this.dataBuffer.length?this.sucSend():this.posting=!1;else if(!IP()&&location.search.includes("_rtc_debug_"))i.send(JSON.stringify(n));else{var a=oV.gzip(JSON.stringify(n));i.setRequestHeader("Content-Encoding","gzip"),i.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"),i.send(a)}}}},{key:"sucSend",value:function(){this.errSendDelay=100,this.preSucTime=Date.now(),this.sucSendTimer=setTimeout(this.send.bind(this),2e3)}},{key:"errSend",value:function(){var e=this;this.errSendTimer=setTimeout((function(){e.send(),e.errSendTimer=null}),this.errSendDelay),this.errSendDelay*=2}},{key:"StartUp",value:function(){var e=this.report_common,t=this.commonStats,r=t.event_key,n=t.device_id,i=t.rtc_app_id,o=t.product_line,a=t.report_version,s=t.os,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,_=t.project_key,v=t.network_type,m=t.app_version,g=t.aid,y=t.device_model,S=t.device_brand,b=t.common_extra_info,E=t.had_selected_p2p,k=t.rtc_env_type,R=t.user_agent,T=t.auto_play_policy;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:_,network_type:v,app_version:m,aid:g,device_model:y,device_brand:S,common_extra_info:b,had_selected_p2p:E,rtc_env_type:k,user_agent:R,auto_play_policy:T}),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)});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){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i({event_key:"rtc_pre_ice_state",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,ice_state:t},this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}},{key:"rtcNodeChange",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=i(i({event_key:"rtc_node_change",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,reason:r},this.modify_ids),{},{common_extra_info:JSON.stringify(n)});this.push(o)}},{key:"rtcSignalingMsgError",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=i(i({event_key:"rtc_signaling_msg_error",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,reason:r},this.modify_ids),{},{common_extra_info:JSON.stringify(n)});this.push(o)}},{key:"rtcSignaling",value:function(e,t,r,n,o){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){var u=arguments.length>7&&void 0!==arguments[7]?arguments[7]:{},c=i(i({event_key:"rtc_set_description",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,is_local:r,direction:n,stream_id:o,stream_user_id:a,elapse:s},this.modify_ids),{},{common_extra_info:JSON.stringify(u)});this.push(c)}},{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=i(i({event_key:"rtc_invoke_status",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,error_code:t,sdk_api_name:r,stream_id:n,elapse:o},this.modify_ids),{},{common_extra_info:JSON.stringify(a)});this.push(s)}},{key:"rtcFirstFrame",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=i(i(i({event_key:"rtc_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),this.modify_ids),{},{common_extra_info:JSON.stringify(t)});this.push(r)}},{key:"rtcMuteRemote",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i({event_key:"rtc_mute_remote",report_id:this.report_id++,rtc_timestamp:Date.now(),mute_info:e,media_type:t},this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}},{key:"sdkInitEngine",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i({event_key:"sdk_init_engine",report_id:this.report_id++,rtc_timestamp:Date.now(),start:e,type:t},this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}},{key:"joinRoom",value:function(e,t,r,n){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},a=i(i({event_key:"join_room",report_id:this.report_id++,rtc_timestamp:Date.now(),type:e,start:t,result:r,reason:n},this.modify_ids),{},{common_extra_info:JSON.stringify(o)});this.push(a)}},{key:"p2pConnectionStatus",value:function(e,t,r,n,o){var a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},s=i(i({event_key:"p2p_connection_status",report_id:this.report_id++,rtc_timestamp:Date.now(),room_id:e,user_id:t,peer_user_id:r,status:n,elapse:o},this.modify_ids),{},{common_extra_info:JSON.stringify(a)});this.push(s)}},{key:"p2pConnectClosed",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=i(i({event_key:"p2p_connect_closed",report_id:this.report_id++,rtc_timestamp:Date.now(),p2p_selected:e},this.modify_ids),{},{common_extra_info:JSON.stringify(t)});this.push(r)}},{key:"rtcDeviceError",value:function(e,t,r,n,o,a,s,u,c,d,l,h,f,p,_,v){var m=arguments.length>16&&void 0!==arguments[16]?arguments[16]:{},g=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:_,media_mode:v},this.modify_ids),{},{common_extra_info:JSON.stringify(m)});this.push(g)}},{key:"rtcVideoDevice",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i({event_key:"rtc_video_device",report_id:this.report_id++,rtc_timestamp:Date.now(),media_device_id:e,media_device_name:t},this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}},{key:"rtcVideoCaptureEvent",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=i(i(i({event_key:"rtc_video_capture_event",report_id:this.report_id++,rtc_timestamp:Date.now()},e),this.modify_ids),{},{common_extra_info:JSON.stringify(t)});this.push(r)}},{key:"rtcEncodeFirstFrame",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i(i(i({event_key:"rtc_encode_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}},{key:"rtcFirstFrameEncoded",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i(i(i({event_key:"rtc_first_frame_encoded",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}},{key:"rtcSendFirstPacket",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i(i(i({event_key:"rtc_send_first_packet",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}},{key:"rtcRecvFirstPacket",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i(i(i({event_key:"rtc_recv_first_packet",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}},{key:"rtcRecvFirstFrame",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i(i(i({event_key:"rtc_recv_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}},{key:"rtcDecodeFirstFrame",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i(i(i({event_key:"rtc_decode_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}}]),r}(fM),GV=new jV,HV=new jV,zV=new jV,KV=GV.commonStats,WV=HV.commonStats,XV=zV.commonStats,YV={default:GV,rtm:HV,outsideRoom:zV};function qV(){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&&KV.setStats({room_id:i[1]}),YV[e].rtcSdkApiCall(n,0,JSON.stringify(PP(i)),s);var u=o.apply(this,i);return"function"==typeof(null==u?void 0:u.then)?u.then((function(t){return YV[e].rtcSdkCallback(n,0,JSON.stringify(PP([t||{}]))),t})).catch((function(t){throw YV[e].rtcSdkCallback(n,t.code,JSON.stringify(t.message)),t})):(YV[e].rtcSdkCallback(n,0,JSON.stringify(PP([u||{}]))),u)}}}}function JV(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=e===re.onUserMessageReceivedOutsideRoom||e===re.onUserBinaryMessageReceivedOutsideRoom;(n?HV:GV).rtcSdkCallback(e,r,JSON.stringify(t))}function QV(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];(n?HV:GV).rtcInvokeStatus(JSON.stringify(t),r,e,"",0)}var ZV="BytePlus",$V="RTC_DEVICE_ID",eF="RTC_ACCESS_NODE",tF="RTC_ACCESS_URLS",rF="RTC_H264_BLACK_LIST",nF="engine_BAC",iF=function(){function e(){u(this,e)}return d(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}(),oF=function(e){h(r,e);var t=g(r);function r(){return u(this,r),t.apply(this,arguments)}return d(r,[{key:"getDeviceId",value:function(){if(IP())return"";var e=this.get($V);return e||(e=SP()),this.set($V,e),e}},{key:"setDeviceId",value:function(e){return[KV,WV,XV].forEach((function(t){return t.setStats({device_id:e})})),this.set($V,e),e}},{key:"getAccessNode",value:function(e){return this.get("".concat(eF,"_").concat(e,"-").concat(ZV))}},{key:"setAccessNode",value:function(e,t,r){return this.set("".concat(eF,"_").concat(e,"-").concat(ZV),t,1e3*r)}},{key:"clearAccessNode",value:function(e){this.delete("".concat(eF,"_").concat(e,"-").concat(ZV))}},{key:"getAccessUrls",value:function(){return this.get("".concat(tF,"-").concat(ZV))}},{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(tF,"-").concat(ZV),t)}},{key:"clearAccessUrls",value:function(){this.delete("".concat(tF,"-").concat(ZV))}},{key:"getH264BlackList",value:function(){return this.get(rF)}},{key:"setH264BlackList",value:function(e){return this.set(rF,e)}},{key:"getAudioProfile",value:function(){return this.get(nF)}},{key:"setAudioProfile",value:function(e){return this.set(nF,e)}}]),r}(iF),aF=new oF,sF="rtc-access.rtcplus.com,rtc-access-sg.rtcplus.com,rtc-access-va.rtcplus.com,rtc-access-fr.rtcplus.com".split(",");function uF(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return"https://".concat(e,"/dispatch/v1/AccessInfo?Action=GetAccessInfo")}var cF="https://web-log-report.rtcplus.com/video/v1/webrtc_log/",dF="rtc.rtcplus.com".split(","),lF={VERSION:"4.46.3",ICE_CONFIG_REQUEST_URLS_INTERNAL:sF.map(uF),ICE_CONFIG_REQUEST_URLS:[],EXPECTED_ADDR:"",LOG_SERVER_URL:cF,CONFIG_REQUEST_DOMAINS:dF,DEVICE_ID:"",OVERSEA:!1};function hF(e,t){if("VERSION"!==e)return"ICE_CONFIG_REQUEST_URLS"===e?("string"==typeof t&&(t=[t]),void(lF.ICE_CONFIG_REQUEST_URLS=t.map(uF))):void("LOG_SERVER_URL"!==e||t!==B.overseas?"LOG_SERVER_URL"!==e||t!==B.domestic?"LOG_SERVER_URL"!==e||"string"!=typeof t?"OVERSEA"!==e?("DEVICE_ID"===e&&aF.setDeviceId(t),lF[e]=t):lF.OVERSEA=t:lF.LOG_SERVER_URL=t:lF.LOG_SERVER_URL=cF:lF.LOG_SERVER_URL="https://web-log-report.rtcplus.com/video/v1/webrtc_log/")}function fF(e){return"DEVICE_ID"===e?aF.getDeviceId():lF[e]}function pF(e,t){var r,n,i,o,a,s,u,c,d,l,h,f,p,_,v,m,g;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)||mF.audio.codec,bitRate:1e3*((null===(n=t.audio)||void 0===n?void 0:n.kBitRate)||mF.audio.kBitRate),sampleRate:1e3*((null===(i=t.audio)||void 0===i?void 0:i.sampleRate)||mF.audio.sampleRate),channels:(null===(o=t.audio)||void 0===o?void 0:o.channels)||mF.audio.channels,profile:(null===(a=t.audio)||void 0===a?void 0:a.AACProfile)||mF.audio.AACProfile},video:{codec:(null===(s=t.video)||void 0===s?void 0:s.codec)||mF.video.codec,fps:(null===(u=t.video)||void 0===u?void 0:u.fps)||mF.video.fps,gop:(null===(c=t.video)||void 0===c?void 0:c.gop)||mF.video.gop,lowLatency:null!==(d=null===(l=t.video)||void 0===l?void 0:l.lowLatency)&&void 0!==d?d:mF.video.lowLatency,bitRate:1e3*((null===(h=t.video)||void 0===h?void 0:h.kBitRate)||mF.video.kBitRate),width:(null===(f=t.video)||void 0===f?void 0:f.width)||mF.video.width,height:(null===(p=t.video)||void 0===p?void 0:p.height)||mF.video.height},layout:{canvas:{bgnd:(null===(_=t.layout)||void 0===_?void 0:_.backgroundColor)||mF.layout.backgroundColor},regions:(null===(v=t.layout)||void 0===v||null===(m=v.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===(g=t.layout)||void 0===g?void 0:g.appData)||mF.layout.appData}}}}function _F(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)||H.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 vF,mF={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"}},gF={width:640,height:360,frameRate:30,maxKbps:600},yF={width:1920,height:1080,frameRate:15,maxKbps:3e3},SF=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}(SF||{}),bF=function(e){return e.PushLimitWarn="PushLimitWarn",e}(bF||{}),EF=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}(EF||{}),kF=function(e){return e.RSCP="RSCP",e}(kF||{}),RF=function(e){return e.ON_CONNECTION_STATE_CHANGE="onConnectionStateChange",e.ABNORMAL_DISCONNECTION="normalConnection",e}(RF||{}),TF=function(e){return e.userLeave="userLeave",e.connectionLost="connectionLost",e.userDuplicateLogin="userDuplicateLogin",e.kickedByAdmin="kickedByAdmin",e.roleChanged="roleChanged",e.onUserTokenDidExpire="onUserTokenDidExpire",e}(TF||{}),IF=function(e){return e[e.roomDismissByAdmin=2]="roomDismissByAdmin",e}(IF||{}),AF=function(e){return e[e.SEND=0]="SEND",e[e.FEEDBACK=1]="FEEDBACK",e}(AF||{}),wF=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}(wF||{}),CF=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}(CF||{}),OF=(l(vF={},0,[0,"success"]),l(vF,1,[cD.USER_MESSAGE_TIMEOUT,"timeout, failed to send."]),l(vF,2,[cD.USER_MESSAGE_BROKEN,"dataChannel broken, failed to send."]),l(vF,3,[cD.USER_MESSAGE_NO_RECEIVER,"cannot find the receiver."]),l(vF,4,[cD.USER_MESSAGE_NO_RELAYPATH,"cannot find relay path."]),l(vF,17,[cD.USER_MESSAGE_SEND_TO_SERVER_ERROR,"failed to send to business server."]),l(vF,18,[cD.USER_MESSAGE_SERVER_RESPONSE_ERROR,"business server response error."]),l(vF,100,[cD.USER_MESSAGE_NOT_JOIN,"not join room"]),l(vF,101,[cD.USER_MESSAGE_INIT,"not init."]),l(vF,102,[cD.USER_MESSAGE_NO_CONNECTION,"no connection."]),l(vF,105,[cD.USER_MESSAGE_NOT_LOGIN,"not login."]),l(vF,106,[cD.USER_MESSAGE_SERVER_PARAMS_NOTSET,"server param is not set."]),l(vF,1e3,[cD.USER_MESSAGE_UNKNOWN,"unknown."]),vF),xF=["msg"],NF=new lM("DataChannelSignaling",3),DF=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}(DF||{}),PF=6e4,MF=function(e){h(o,e);var t,r,n=g(o);function o(e){var t;return u(this,o),l(v(t=n.call(this)),"_singlingCache",new Map),l(v(t),"_p2pCache",new Map),l(v(t),"_rttIds",{}),l(v(t),"_p2pMessageId",0),l(v(t),"_clearDataChannelListener",void 0),t._dataChannel=e,t._clearDataChannelListener=t._handleHandler(),window.__rtc_mock_signaling__=t.emit.bind(v(t)),t}return d(o,[{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 GV.rtcSignaling(0,JSON.stringify(t),"call-".concat(e),"Send",mV.UP),new Promise((function(i,o){var a=n._genHeader(r);a.id=xP();var s=a.id.join("-"),u=setTimeout((function(){n._singlingCache.delete(s),o(new lD(cD.TIME_OUT,"".concat(e," message time out")))}),PF);n._singlingCache.set(s,{signalingType:e,success:function(e){clearTimeout(u),i(e)},error:function(e){clearTimeout(u),o(e)}}),NF.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=s(regeneratorRuntime.mark((function e(t,r){var n,o,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.msg,o=_(t,xF),a=n instanceof ArrayBuffer,e.t0=this,e.t1=i,e.t2=i({ver:1,id:this._p2pMessageId++,time:Date.now(),dir:AF.SEND,type:wF.P2P,err:CF.SUCCESS},o),e.t3={},e.t4=a,!a){e.next=13;break}return e.next=10,AP.ab2b64str(n);case 10:e.t5=e.sent,e.next=14;break;case 13:e.t5=n;case 14:return e.t6=e.t5,e.t7={binary:e.t4,msg:e.t6},e.t8=(0,e.t1)(e.t2,e.t3,e.t7),e.t9=r,e.abrupt("return",e.t0._sendP2PMessage.call(e.t0,e.t8,e.t9));case 19:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"_sendP2PMessage",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return DP(e.msg)?this._rttIds[e.id]=e.id:e.dir===AF.SEND&&NF.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:xP()}));if(e.dir===AF.SEND){var s=setTimeout((function(){t._p2pCache.delete(e.id),o(new lD(cD.TIME_OUT,"P2P message timeout"))}),PF);t._p2pCache.set(e.id,{success:function(e,t){clearTimeout(s),n(t)},error:function(e){clearTimeout(s);var t=b(OF[e.err]||[cD.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 lD(cD.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=AP.str2ab(JSON.stringify([e,r])),a=TP(Uint8Array,[n,i].concat(E(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){var r=this._genHeader({needAck:!0,direction:1,id:e.split("-").map((function(e){return+e}))});NF.print("Signal",">>>>>> [".concat(t,"-res][").concat(e,"]")),this._sendMessage("".concat(t,"-res"),r,"")}},{key:"_handleMessage",value:(t=s(regeneratorRuntime.mark((function e(t){var r,n,o,a,s,u,c,d,l,h,f,p,_,v,m,g,y,S,E,k,R,T,I,A,w,C,O,x,N,D,P;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:u=this._dispartData(t),c=u.data,(d=u.header).zip&&((l=new oV.Inflate).push(c,!0),c=l.result),h=AP.ab2str(c),f=[],e.prev=6,f=JSON.parse(h),e.next=14;break;case 10:return e.prev=10,e.t0=e.catch(6),e.t0 instanceof Error&&GV.rtcSignalingMsgError(-1,e.t0.message,vV.MESSAGE_PARSE_FAILED),e.abrupt("return");case 14:e.t1=d.functionType,e.next=0===e.t1?17:1===e.t1?34:2===e.t1?83:99;break;case 17:if(p=(null===(r=d.id)||void 0===r?void 0:r.join("-"))||"",1!==d.direction){e.next=22;break}this._handleAckMessage(p,f[0]||{},h),e.next=33;break;case 22:if(!Array.isArray(f)){e.next=33;break}if(_=f[0],f=f[1],NF.print("Signal","<<<<<< ".concat(_),f,p),this._feedbackSignaling(p,_),!f.binary||"string"!=typeof f.message){e.next=31;break}return e.next=30,AP.b64str2ab(f.message);case 30:f.message=e.sent;case 31:this.emit(_,i({},f)),GV.rtcSignaling(0,h,"on-".concat(_),"Recv",mV.DOWN);case 33:return e.abrupt("break",100);case 34:Array.isArray(f)&&(f=f[1]),v=null===(n=f)||void 0===n?void 0:n.id,this._rttIds[v]||(null===(o=f)||void 0===o?void 0:o.dir)===AF.FEEDBACK||DP(null===(a=f)||void 0===a?void 0:a.msg)?delete this._rttIds[v]:NF.print("Signal","<<<<<< p2p response",f),e.t2=f.dir,e.next=e.t2===AF.SEND?40:e.t2===AF.FEEDBACK?78:81;break;case 40:if(DP(null===(s=f)||void 0===s?void 0:s.msg)){e.next=76;break}if(g=(m=f).binary,y=m.msg,S=m.room,E=m.to,k=m.from,R=""===S?g?EF.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM:EF.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM:g?EF.USER_BINARY_MESSAGE_RECEIVED:EF.USER_MESSAGE_RECEIVED,E){e.next=60;break}if(e.t3=this,e.t4=EF.ON_CUSTOM_MESSAGE,e.t5=k,e.t6=g,!g){e.next=54;break}return e.next=51,AP.b64str2ab(y);case 51:e.t7=e.sent,e.next=55;break;case 54:e.t7=y;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=R,e.t12=i,e.t13=i({},f),e.t14={},!g){e.next=71;break}return e.next=68,AP.b64str2ab(y);case 68:e.t15=e.sent,e.next=72;break;case 71:e.t15=y;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({},f),{},{dir:AF.FEEDBACK,msg:""})),e.abrupt("break",82);case 78:return(T=this._p2pCache.get(f.id))&&(this._p2pCache.delete(f.id),f.err===CF.SUCCESS?T.success(f.id,f):T.error(f)),e.abrupt("break",82);case 81:return e.abrupt("break",82);case 82:return e.abrupt("break",100);case 83:if(1!==d.direction){e.next=88;break}A=(null===(I=d.id)||void 0===I?void 0:I.join("-"))||"",this._handleAckMessage(A,f[0]||{},h),e.next=98;break;case 88:if(w=b(f,2),C=w[0],O=w[1],x=void 0===O?{}:O,"RXMediaMsg"!==C){e.next=98;break}N=x.type,D=x.data,GV.rtcSignaling(0,h,"on-".concat(N),"Recv",mV.DOWN),e.t19=N,e.next="RSCP"===e.t19?95:97;break;case 95:try{P=JSON.parse(D),Array.isArray(P)&&this.emit(N,P)}catch(M){}return e.abrupt("break",98);case 97:return e.abrupt("break",98);case 98:case 99:return e.abrupt("break",100);case 100: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){NF.print("_handleHandler","dataChannel close",t),e.emit("close",t)},r=function(t){NF.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),NF.print("Signal","<<<<<< [".concat(n.signalingType,"-ack]"),t)),GV.rtcSignaling(0,r,null==n?void 0:n.signalingType,"Ack",mV.DOWN)}}]),o}(aM.exports.EventEmitter),UF=function(){function e(){u(this,e),l(this,"xhr",void 0),l(this,"isSending",void 0),l(this,"timeout",void 0),this.isSending=!1}return d(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=b(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})),0===a.status&&i({code:0,message:"Request abort"})},a.onerror=function(e){t.isSending=!1,i({code:-1,message:a.responseText||"unknown"})},t.timeout&&(a.timeout=t.timeout),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}(),LF=new lM("ICE Request",3),VF=function(){function e(){u(this,e),l(this,"_request",void 0),this._request=new UF}var t,r,n;return d(e,[{key:"getAccessNode",value:(n=s(regeneratorRuntime.mark((function e(t,r,n,i,o,a,s){var u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(u=aF.getAccessNode(t))){e.next=9;break}if(this.getAccessNodeFromServer(t,r,n,i,o,a,s),QV("es.R.node.cache",u),!Array.isArray(u)){e.next=8;break}return e.abrupt("return",Promise.resolve(u));case 8:return e.abrupt("return",Promise.resolve([u]));case 9:return e.abrupt("return",this.getAccessNodeFromServer(t,r,n,i,o,a,s));case 10:case"end":return e.stop()}}),e,this)}))),function(e,t,r,i,o,a,s){return n.apply(this,arguments)})},{key:"getAccessNodeFromServer",value:(r=s(regeneratorRuntime.mark((function e(t,r,n,i,o,a,s){var u,c,d,l,h=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return d=aF.getAccessUrls(),l=!0,QV("es.R.req.cache.urls",d),(null===(u=d)||void 0===u?void 0:u.length)>0||(d=lF.ICE_CONFIG_REQUEST_URLS,l=!1,QV("es.R.req.external.urls",d)),(null===(c=d)||void 0===c?void 0:c.length)>0||(d=lF.ICE_CONFIG_REQUEST_URLS_INTERNAL,l=!1,QV("es.R.req.internal.urls",d)),e.abrupt("return",this.getICEConfigFromServer(d,t,r,n,i,o,a,s).then((function(e){var r=e.nodes;return aF.setAccessNode(t,r,e.ttl||11200),e.dispatchDomains&&aF.setAccessUrls(e.dispatchDomains),r})).catch((function(e){if(l)return QV("es.R.req.fallback",""),aF.clearAccessUrls(),h.getAccessNodeFromServer(t,r,n,i,o,a,s);throw e})));case 6:case"end":return e.stop()}}),e,this)}))),function(e,t,n,i,o,a,s){return r.apply(this,arguments)})},{key:"getICEConfigFromServer",value:(t=s(regeneratorRuntime.mark((function e(t,r,n,i,o,a,u,c){var d,l,h,f,p=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return d={appID:r,userID:i,deviceID:o,connectSessionID:kP(),os:"web",sdkVersion:lF.VERSION,isOversea:lF.OVERSEA,expectedAddr:fF("EXPECTED_ADDR"),productPlatform:"BytePlus",enableCloudProxy:c},a&&u&&(d.feedbackInfo=[{feedbackIP:null===(l=u.publicIPs[0])||void 0===l?void 0:l.ip,feedbackReason:{type:"NODE_CHANGED",reason:a}}],delete d.expectedAddr),h=Date.now(),GV.rtcGetAccess(0,JSON.stringify(d),0,pV.REQUEST,t.join(","),d.connectSessionID),f=t.map(function(){var e=s(regeneratorRuntime.mark((function e(t,r){var n,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,p._request.post(t,d);case 3:n=e.sent,e.next=9;break;case 6:throw e.prev=6,e.t0=e.catch(0),new lD(cD.ICE_SERVER_WRONG,"get ICE config failed",e.t0);case 9:if(200===n.code){e.next=11;break}throw new lD(cD.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 lD(cD.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",UP(f).then((function(e){var r=e.result;e.firstNode;var n=e.index;return GV.rtcGetAccess(200,JSON.stringify(r),Date.now()-h,pV.RESPONSE,t[n],d.connectSessionID),r})).catch((function(e){var r,n,i=null===(r=e[0])||void 0===r?void 0:r.error;throw GV.rtcGetAccess(+((null==i?void 0:i.code)||(null==i?void 0:i.server_code)),null===(n=e[0])||void 0===n?void 0:n.message,Date.now()-h,pV.RESPONSE,t.join(","),d.connectSessionID,{error:JSON.stringify(i)}),e})));case 6:case"end":return e.stop()}}),e)}))),function(e,r,n,i,o,a,s,u){return t.apply(this,arguments)})},{key:"abort",value:function(){this._request.isSending&&(LF.print("abort","HTTP Request of [getICEConfigFromServer] abort"),this._request.abort())}}]),e}(),FF=function(){function e(){u(this,e),l(this,"_request",void 0),this._request=new UF}return d(e,[{key:"getH264BlackList",value:function(){var e=this,t={keys:["web_h264_black_list"],labelSelector:"",sdkVersion:"4.46.3",deviceType:"web"};this._request.timeout=800;var r=lF.CONFIG_REQUEST_DOMAINS.map((function(e){return"https://".concat(e,"/decision/v1/multi")}));GV.rtcGetConfig(0,JSON.stringify(t),0,r.join(","),cV.REQUEST,"",!1);var n=r.map(function(){var r=s(regeneratorRuntime.mark((function r(n,i){var o,a;return regeneratorRuntime.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:a=r.sent,r.next=9;break;case 6:throw r.prev=6,r.t0=r.catch(0),new lD(cD.ICE_SERVER_WRONG,"get config failed");case 9:if(Array.isArray(null===(o=a)||void 0===o?void 0:o.web_h264_black_list)){r.next=11;break}throw new lD(cD.ICE_SERVER_WRONG,"get config failed");case 11:return r.abrupt("return",{result:a,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){UP(n).then((function(t){var n=t.result,i=t.index;aF.setH264BlackList(n.web_h264_black_list),GV.rtcGetConfig(200,JSON.stringify(n),0,r[i],cV.RESPONSE,"",!1),e(n.web_h264_black_list)})).catch((function(t){GV.rtcGetConfig(500,t.message,0,"",cV.RESPONSE,"",!1),e(aF.getH264BlackList()||[])}))}))}},{key:"getAudioProfile",value:function(){var e=this,t={keys:["engine_BAC"],labelSelector:"",sdkVersion:"4.46.3",deviceType:"web"},r=lF.CONFIG_REQUEST_DOMAINS.map((function(e){return"https://".concat(e,"/decision/v1/multi")}));GV.rtcGetConfig(0,JSON.stringify(t),0,r.join(","),cV.REQUEST,"",!1);var n=r.map(function(){var r=s(regeneratorRuntime.mark((function r(n,i){var o,a;return regeneratorRuntime.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:a=r.sent,r.next=9;break;case 6:throw r.prev=6,r.t0=r.catch(0),new lD(cD.ICE_SERVER_WRONG,"get config failed");case 9:if(Array.isArray(null===(o=a)||void 0===o?void 0:o.engine_BAC)){r.next=11;break}throw new lD(cD.ICE_SERVER_WRONG,"get config failed");case 11:return r.abrupt("return",{result:a,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){UP(n).then((function(t){var n=t.result,i=t.index;aF.setAudioProfile(n.engine_BAC),GV.rtcGetConfig(200,JSON.stringify(n),0,r[i],cV.RESPONSE,"",!1),e(n.engine_BAC)})).catch((function(t){GV.rtcGetConfig(500,t.message,0,"",cV.RESPONSE,"",!1),e(aF.getAudioProfile()||[])}))}))}}]),e}();function BF(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 jF=[{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}],GF=[{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 HF={width:160,height:90,frameRate:15,maxkbps:100},zF={width:480,height:270,frameRate:15,maxkbps:400};function KF(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<jF.length;c++)if(jF[c].height<t.height){u=c;break}for(var d=e.shift(),l=u;l<jF.length;l++){var h,f=jF[l];if(d&&f.height<=(null===(h=d)||void 0===h?void 0:h.height)){var p,_=f.height===(null===(p=d)||void 0===p?void 0:p.height),v=i(i({},d),{},{video_index:++o,sub_index:n++});if(delete v.rid,s.push(v),d=e.shift(),_)continue}s.push(i(i({},f),{},{width:Math.floor(f.height*r),video_index:o,sub_index:n++}))}return s}var WF,XF,YF="chrome-stable"===CP(),qF=function(){function e(t){u(this,e),l(this,"peer",void 0),l(this,"stats",void 0),this.peer=t,this.stats=[]}var t,r;return d(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=s(regeneratorRuntime.mark((function e(t){var r=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e,n){if(!YF||void 0!==window.InstallTrigger)return e(r.stats);try{r.peer.getStats((function(n){n.result().forEach((function(e){if(!JF.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&&t&&t.id?t.id===n.googTrackId&&r.stats.push(n):r.stats.push(n)}})),e(r.stats)}))}catch(RY){n(RY)}})));case 1:case"end":return e.stop()}}),e)}))),function(e){return r.apply(this,arguments)})},{key:"getStats",value:(t=s(regeneratorRuntime.mark((function e(t,r){var n;return regeneratorRuntime.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,r){e.next=9;break}return e.next=9,this.getExtraStats(t);case 9:e.next=13;break;case 11:e.prev=11,e.t0=e.catch(5);case 13:e.next=17;break;case 15:e.prev=15,e.t1=e.catch(0);case 17:return e.abrupt("return",this.stats);case 18:case"end":return e.stop()}}),e,this,[[0,15],[5,11]])}))),function(e,r){return t.apply(this,arguments)})}]),e}(),JF=["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"],QF=function(){var e=s(regeneratorRuntime.mark((function e(t,r,n){var i,o;return regeneratorRuntime.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 o=new qF(t),e.next=6,o.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)}}(),ZF=function(){var e=s(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,!IP()&&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,$F();case 5:return t=e.sent,e.abrupt("return",null==t?void 0:t.includes("H264"));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)}}(),$F=function(){var e=s(regeneratorRuntime.mark((function e(){var t,r,n,i,o,a,s,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!WF){e.next=2;break}return e.abrupt("return",WF);case 2:return t=[],e.prev=3,e.next=6,MP();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,o=["heytapbrowser","mqqbrowser","miuibrowser"],a=new FF,e.next=16,a.getH264BlackList();case 16:for(s=e.sent,o.push.apply(o,E(s)),u=0;u<o.length;u++)n.includes(o[u])&&(i=!0);!i&&t.push("H264");case 20:return null!=r&&r.includes("VP8")&&t.push("vp8"),WF=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)}}(),eB=function(){var e=s(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,$F();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)}}(),tB=function(){return"undefined"!=typeof TransformStream&&"undefined"!=typeof RTCRtpSender&&"undefined"!=typeof RTCRtpReceiver&&void 0!==RTCRtpSender.prototype.createEncodedStreams&&void 0!==RTCRtpReceiver.prototype.createEncodedStreams},rB=new lM("BasicHandler",3),nB={iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan",encodedInsertableStreams:!!tB()||void 0};function iB(e){if(void 0===XF){var t=navigator.userAgent.toLowerCase();XF=t.includes("chrome")&&t.includes("mobile")}return XF?Math.ceil(e):e}var oB=function(e){h(c,e);var t,r,n,o,a=g(c);function c(e,t){var r;return u(this,c),l(v(r=a.call(this)),"_peerConnection",void 0),l(v(r),"_dataChannel",void 0),l(v(r),"_context",void 0),l(v(r),"monitor",void 0),l(v(r),"_offerIce",{}),l(v(r),"_answerIce",{}),l(v(r),"_initSctpEvents",!1),r.monitor=e,r._peerConnection=new RTCPeerConnection(nB),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;rB.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){rB.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,_V["".concat(t.toUpperCase())])},r}return d(c,[{key:"disconnect",value:function(){this._peerConnection.close(),this._dataChannel.close(),this._peerConnection.ontrack=null}},{key:"destroy",value:function(){rB.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<GF.length;n++)if(r>=GF[n].totalPixels){t=n;break}if(0===t)return GF[t].maxLayers;var i=GF[t-1].totalPixels;return(i-r)/(i-GF[t].totalPixels)<.1?GF[t-1].maxLayers:GF[t].maxLayers}(t);rB.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/HF.width,i=e.width/zF.width):(n=e.height/HF.height,i=e.height/zF.height),r.push({maxkbps:HF.maxkbps,scaleResolutionDownBy:n,frameRate:HF.frameRate,width:Math.floor(e.width/n),height:Math.floor(e.height/n)}),t<=2||n>2&&r.unshift({maxkbps:zF.maxkbps,scaleResolutionDownBy:i,frameRate:zF.frameRate,width:Math.floor(e.width/i),height:Math.floor(e.height/i)}),r}(r,s),rB.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},BF(r,e))})),rB.print("simulcast() ","simulcastLayers2: %o",a)),a.forEach((function(e,t){var r={maxBitrate:1e3*e.maxkbps,scaleResolutionDownBy:iB(e.scaleResolutionDownBy),rid:"".concat(t+1),maxFramerate:e.frameRate};n.sendEncodings&&n.sendEncodings.unshift(r),o.push({width:e.width,height:e.height,framerate:e.frameRate,maxkbps:e.maxkbps,rid:"".concat(t+1)})}))}},{key:"internalPublish",value:function(e,t){var r=e.stream,n=e.videoTrack,i=e.audioTrack,o=e.enableSimulcast,a=e.pubAudio,s=e.pubVideo,u={direction:"sendonly",streams:[r]},c={direction:"sendonly",streams:[r]},d=[],l=[];if(Array.isArray(null==e?void 0:e.videoEncodeConfig)&&e.videoEncodeConfig.length){var h=null==n?void 0:n.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 _=null==e?void 0:e.videoEncodeConfig[0],v=BF(f,_);e.prevScaleResolutionDownBy=v.scaleResolutionDownBy,e.videoInputConfig=f;var m={maxBitrate:1e3*_.maxKbps,scaleResolutionDownBy:iB(v.scaleResolutionDownBy),rid:"0",maxFramerate:_.frameRate||15};c.sendEncodings=[m],d.push({width:v.width,height:v.height,framerate:_.frameRate,maxkbps:_.maxKbps,rid:"0"}),o&&(this._simulcast(e,v,f,c,d),null!=t&&t.simulcastOnDemand&&(l=KF([].concat(d))),rB.print("subVideoDesc","desc: %o ",l))}rB.print("publish videoTransceiverInit videoDescriptions","",c,d);var g=null==i?void 0:i.getTrack();(null==i?void 0:i.mixType)!==$.PLAYOUT&&null!=i&&i.mixedAudioTrack&&(g=null==i?void 0:i.mixedAudioTrack),g=a&&g?g:"audio";var y=null==n?void 0:n.getTrack();return{semantics:"unified-plan",videoDescriptions:d,subVideoDescriptions:l,transceiverInit:{aTrack:g,vTrack:y=s&&y?y:"video",audioTransceiverInit:u,videoTransceiverInit:c}}}},{key:"updateScaleResolutionDownBy",value:(o=s(regeneratorRuntime.mark((function e(t){var r,n,i,o,a,s,u,c,d,l;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(rB.print("updateScaleResolutionDownBy()"),i=null===(r=t.videoTrack)||void 0===r?void 0:r.getTrack(),o=t.videoTransceiver,i&&t.pubVideo&&o){e.next=6;break}return rB.print("updateScaleResolutionDownBy()","no pub"),e.abrupt("return");case 6:a=null==i?void 0:i.getSettings(),s={width:Math.floor(a.width),height:Math.floor(a.height),frameRate:Math.floor(a.frameRate)},(u=BF(s,t.videoEncodeConfig[0])).scaleResolutionDownBy===t.prevScaleResolutionDownBy&&rB.print("updateScaleResolutionDownBy()","no change %o",t.prevScaleResolutionDownBy),(c=null===(n=o.sender)||void 0===n?void 0:n.getParameters())&&(l=u.scaleResolutionDownBy/t.prevScaleResolutionDownBy,c.encodings=null==c||null===(d=c.encodings)||void 0===d?void 0:d.map((function(e){var r;Math.max(e.scaleResolutionDownBy=(e.scaleResolutionDownBy||1)*l,1);var n=+e.rid||0;return e.maxFramerate=(null===(r=t.videoEncodeConfig[n])||void 0===r?void 0:r.frameRate)||e.maxFramerate,e})),t.prevScaleResolutionDownBy=u.scaleResolutionDownBy,t.videoInputConfig=s,null==o||o.sender.setParameters(c));case 12:case"end":return e.stop()}}),e)}))),function(e){return o.apply(this,arguments)})},{key:"getStats",value:function(e,t){return QF(this._peerConnection,e,t)}},{key:"setLocalDescription",value:(n=s(regeneratorRuntime.mark((function e(t,r){var n,i,o,a=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=RP(),e.prev=1,e.next=4,this._peerConnection.setLocalDescription(new RTCSessionDescription({type:"offer",sdp:t}));case 4:this.monitor.rtcSetDescription(0,t,SV.W_1,"local"===(null==r?void 0:r.streamUserId)?bV.UP:bV.DOWN,(null==r?void 0:r.streamId)||"",(null==r?void 0:r.streamUserId)||"",RP()-n,{type:"offer"}),this._initSctpEvents||(this._initSctpEvents=!0,(o=null===(i=this._peerConnection)||void 0===i?void 0:i.sctp)&&(o.onstatechange=function(){a.monitor.rtcInvokeStatus("sctp state change TO: ".concat(o.state),0,"sctp","",0)},o.transport&&(o.transport.onstatechange=function(){var e;a.monitor.rtcInvokeStatus("dtls state change TO: ".concat(null==o||null===(e=o.transport)||void 0===e?void 0:e.state),0,"dtls","",0)}))),e.next=12;break;case 8:e.prev=8,e.t0=e.catch(1),console.error("setLocal",e.t0),this.monitor.rtcSetDescription(-1,e.t0.message,SV.W_1,"local"===(null==r?void 0:r.streamUserId)?bV.UP:bV.DOWN,"","",RP()-n,{type:"offer"});case 12:case"end":return e.stop()}}),e,this,[[1,8]])}))),function(e,t){return n.apply(this,arguments)})},{key:"setRemoteDescription",value:(r=s(regeneratorRuntime.mark((function e(t,r){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=RP(),e.prev=1,e.next=4,this._peerConnection.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:t}));case 4:this.monitor.rtcSetDescription(0,t,SV.W_0,"local"===(null==r?void 0:r.streamUserId)?bV.UP:bV.DOWN,(null==r?void 0:r.streamId)||"",(null==r?void 0:r.streamUserId)||"",RP()-n,{type:"answer"}),e.next=11;break;case 7:e.prev=7,e.t0=e.catch(1),console.error("setRemote",e.t0),this.monitor.rtcSetDescription(-1,e.t0.message,SV.W_1,"local"===(null==r?void 0:r.streamUserId)?bV.UP:bV.DOWN,(null==r?void 0:r.streamId)||"",(null==r?void 0:r.streamUserId)||"",RP()-n,{type:"answer"});case 11:case"end":return e.stop()}}),e,this,[[1,7]])}))),function(e,t){return r.apply(this,arguments)})},{key:"setCurrentDescription",value:(t=s(regeneratorRuntime.mark((function e(){return regeneratorRuntime.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}}]),c}(aM.exports.EventEmitter),aB={},sB={},uB={exports:{}},cB=uB.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(cB).forEach((function(e){cB[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=uB.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}}))}))}}(sB);var dB=uB.exports,lB=/%[sdv%]/g,hB=function(e){var t=1,r=arguments,n=r.length;return e.replace(lB,(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""}}))},fB=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 hB.apply(null,n)},pB=["v","o","s","i","u","e","p","c","b","t","r","z","a"],_B=["i","c","b","a"],vB=sB,mB=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||pB,n=t.innerOrder||_B,i=[];return r.forEach((function(t){dB[t].forEach((function(r){r.name in e&&null!=e[r.name]?i.push(fB(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){i.push(fB(t,r,e))}))}))})),e.media.forEach((function(e){i.push(fB("m",dB.m[0],e)),n.forEach((function(t){dB[t].forEach((function(r){r.name in e&&null!=e[r.name]?i.push(fB(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){i.push(fB(t,r,e))}))}))}))})),i.join("\r\n")+"\r\n"};aB.write=mB,aB.parse=vB.parse,aB.parseParams=vB.parseParams,aB.parseFmtpConfig=vB.parseFmtpConfig,aB.parsePayloads=vB.parsePayloads,aB.parseRemoteCandidates=vB.parseRemoteCandidates,aB.parseImageAttributes=vB.parseImageAttributes,aB.parseSimulcastStreamList=vB.parseSimulcastStreamList;var gB=Math.pow(2,32),yB=function(){return Math.floor(Math.random()*gB+1e3)},SB=function(e,t,r){return r||(r=yB()),[{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)}]},bB=function(e,t){var r=yB(),n=yB();return{ssrcs:[r,n].reduce((function(r,n){return r.concat(SB(e,t,n))}),[]),ssrcGroups:[{semantics:"FID",ssrcs:"".concat(r," ").concat(n)}]}};function EB(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 kB=function(e,t,r){var n=i(i({},e),{},{invalid:[{value:"realx-exts:rscp"}],media:[t,r]});return delete n.groups,delete n.msidSemantic,aB.write(n)};function RB(e){return TB.apply(this,arguments)}function TB(){return(TB=s(regeneratorRuntime.mark((function e(t){var r,n,i,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r={},n=t.publicIPs,i=t.certFingerprint,o=t.iceParams,r.fingerprint={type:"sha-256",hash:i},r.icePwd=o.serverIcePwd,e.next=6,AB(o.serverIceUfrag);case 6:return r.iceUfrag=e.sent,KV.setStats({connection_id:r.iceUfrag}),r.candidates=IB(n),r.setup="active",r.iceOptions="renomination",e.abrupt("return",r);case 12:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function IB(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 AB=function(){var e=s(regeneratorRuntime.mark((function e(t){var r,n,i,o,a,s,u;return regeneratorRuntime.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,AP.b64str2ab(t);case 5:return e.t1=e.sent,i=new e.t0(e.t1),o=r.encode(Date.now().toString()).slice(-4),(a=new Uint8Array(2))[0]=0,a[1]=1,s=TP(Uint8Array,n,i,o,a),e.next=14,AP.ab2b64str(s.buffer);case 14:return u=e.sent,e.abrupt("return",u);case 16:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),wB=Te,CB=Hd,OB=wm.exports.getWeakData,xB=Pr,NB=He,DB=Qd,PB=xl,MB=Vt,UB=On.set,LB=On.getterFor,VB=Xa.find,FB=Xa.findIndex,BB=wB([].splice),jB=0,GB=function(e){return e.frozen||(e.frozen=new HB)},HB=function(){this.entries=[]},zB=function(e,t){return VB(e.entries,(function(e){return e[0]===t}))};HB.prototype={get:function(e){var t=zB(this,e);if(t)return t[1]},has:function(e){return!!zB(this,e)},set:function(e,t){var r=zB(this,e);r?r[1]=t:this.entries.push([e,t])},delete:function(e){var t=FB(this.entries,(function(t){return t[0]===e}));return~t&&BB(this.entries,t,1),!!~t}};var KB,WB={getConstructor:function(e,t,r,n){var i=e((function(e,i){DB(e,o),UB(e,{type:t,id:jB++,frozen:void 0}),null!=i&&PB(i,e[n],{that:e,AS_ENTRIES:r})})),o=i.prototype,a=LB(t),s=function(e,t,r){var n=a(e),i=OB(xB(t),!0);return!0===i?GB(n).set(t,r):i[n.id]=r,e};return CB(o,{delete:function(e){var t=a(this);if(!NB(e))return!1;var r=OB(e);return!0===r?GB(t).delete(e):r&&MB(r,t.id)&&delete r[t.id]},has:function(e){var t=a(this);if(!NB(e))return!1;var r=OB(e);return!0===r?GB(t).has(e):r&&MB(r,t.id)}}),CB(o,r?{get:function(e){var t=a(this);if(NB(e)){var r=OB(e);return!0===r?GB(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}},XB=oe,YB=Te,qB=Hd,JB=wm.exports,QB=hg,ZB=WB,$B=He,ej=Mm,tj=On.enforce,rj=sn,nj=!XB.ActiveXObject&&"ActiveXObject"in XB,ij=function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}},oj=QB("WeakMap",ij,ZB);if(rj&&nj){KB=ZB.getConstructor(ij,"WeakMap",!0),JB.enable();var aj=oj.prototype,sj=YB(aj.delete),uj=YB(aj.has),cj=YB(aj.get),dj=YB(aj.set);qB(aj,{delete:function(e){if($B(e)&&!ej(e)){var t=tj(this);return t.frozen||(t.frozen=new KB),sj(this,e)||t.frozen.delete(e)}return sj(this,e)},has:function(e){if($B(e)&&!ej(e)){var t=tj(this);return t.frozen||(t.frozen=new KB),uj(this,e)||t.frozen.has(e)}return uj(this,e)},get:function(e){if($B(e)&&!ej(e)){var t=tj(this);return t.frozen||(t.frozen=new KB),uj(this,e)?cj(this,e):t.frozen.get(e)}return cj(this,e)},set:function(e,t){if($B(e)&&!ej(e)){var r=tj(this);r.frozen||(r.frozen=new KB),uj(this,e)?dj(this,e,t):r.frozen.set(e,t)}else dj(this,e,t);return this}})}var lj=function(e){h(y,e);var t,r,n,i,o,a,c,f,p,_,m=g(y);function y(){var e;return u(this,y),l(v(e=m.call(this)),"_hasVideoPermission",!1),l(v(e),"_hasAudioPermission",!1),l(v(e),"inited",!1),l(v(e),"deviceMap",{audioinput:new Map,audiooutput:new Map,videoinput:new Map}),e._handleDeviceChange=e._handleDeviceChange.bind(v(e)),!IP()&&e.refreshDevices(),e}return d(y,[{key:"refreshDevices",value:(_=s(regeneratorRuntime.mark((function e(){var t,r,n=this;return regeneratorRuntime.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,!OP){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;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 _.apply(this,arguments)})},{key:"initListener",value:(p=s(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.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",this._handleDeviceChange);case 1:case"end":return e.stop()}}),e,this)}))),function(){return p.apply(this,arguments)})},{key:"_handleDeviceChange",value:(f=s(regeneratorRuntime.mark((function e(){var t,r,n,i=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=void 0,!OP){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(E(this.deviceMap.audioinput.values()),E(this.deviceMap.videoinput.values()),E(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(re.onVideoDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"active"}):e.kind.includes("audio")&&i.emit(re.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(re.onVideoDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"inactive"}):e.kind.includes("audio")&&i.emit(re.onAudioDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"inactive"}))}));case 12:case"end":return e.stop()}}),e,this)}))),function(){return f.apply(this,arguments)})},{key:"getVideoPermission",value:(c=s(regeneratorRuntime.mark((function e(){var t=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(navigator.mediaDevices&&navigator.mediaDevices.getUserMedia){e.next=4;break}throw new lD(cD.NOT_SUPPORTED,"GetUserMedia not supported");case 4:if(!this.hasVideoPermission){e.next=6;break}return e.abrupt("return",!0);case 6:return e.prev=6,e.next=9,navigator.mediaDevices.getUserMedia({audio:!1,video:!0}).then((function(e){e&&(e.getTracks().forEach((function(e){return e.stop()})),t.hasVideoPermission=!0,t.inited||t.refreshDevices())}));case 9:e.next=13;break;case 11:e.prev=11,e.t0=e.catch(6);case 13:return e.abrupt("return",this.hasVideoPermission);case 14:case"end":return e.stop()}}),e,this,[[6,11]])}))),function(){return c.apply(this,arguments)})},{key:"getAudioPermission",value:(a=s(regeneratorRuntime.mark((function e(){var t=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(navigator.mediaDevices&&navigator.mediaDevices.getUserMedia){e.next=4;break}throw new lD(cD.NOT_SUPPORTED,"GetUserMedia not supported");case 4:if(!this.hasAudioPermission){e.next=6;break}return e.abrupt("return",!0);case 6:return e.prev=6,e.next=9,navigator.mediaDevices.getUserMedia({audio:!0,video:!1}).then((function(e){e&&(e.getTracks().forEach((function(e){return e.stop()})),t.hasAudioPermission=!0,t.inited||t.refreshDevices())}));case 9:e.next=13;break;case 11:e.prev=11,e.t0=e.catch(6);case 13:return e.abrupt("return",this.hasAudioPermission);case 14:case"end":return e.stop()}}),e,this,[[6,11]])}))),function(){return a.apply(this,arguments)})},{key:"enumerateDevices",value:(o=s(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.getAudioPermission();case 3:e.next=7;break;case 5:e.prev=5,e.t0=e.catch(0);case 7:return e.prev=7,e.next=10,this.getVideoPermission();case 10:e.next=14;break;case 12:e.prev=12,e.t1=e.catch(7);case 14:return e.next=16,this.refreshDevices();case 16:return e.abrupt("return",Array.from([].concat(E(this.deviceMap.audioinput.values()),E(this.deviceMap.videoinput.values()),E(this.deviceMap.audiooutput.values()))));case 17:case"end":return e.stop()}}),e,this,[[0,5],[7,12]])}))),function(){return o.apply(this,arguments)})},{key:"enumerateAudioCaptureDevices",value:(i=s(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.refreshDevices();case 2:return e.abrupt("return",Array.from(this.deviceMap.audioinput.values()));case 3:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"enumerateVideoCaptureDevices",value:(n=s(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.refreshDevices();case 2:return e.abrupt("return",Array.from(this.deviceMap.videoinput.values()));case 3:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"enumerateAudioPlaybackDevices",value:(r=s(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.refreshDevices();case 2:return e.abrupt("return",Array.from(this.deviceMap.audiooutput.values()));case 3:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"getDeviceById",value:(t=s(regeneratorRuntime.mark((function e(t){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.enumerateDevices();case 2:return r=e.sent,e.abrupt("return",r.find((function(e){return e.deviceId===t})));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"hasAudioPermission",get:function(){return this._hasAudioPermission},set:function(e){if(!e)throw new lD(cD.NO_PERMISSION,"Cannot revoke audio permission");this.refreshDevices(),this._hasAudioPermission=!0}},{key:"hasVideoPermission",get:function(){return this._hasVideoPermission},set:function(e){if(!e)throw new lD(cD.NO_PERMISSION,"Cannot revoke Video permission");this.inited||this.refreshDevices(),this._hasVideoPermission=!0}}]),y}(fM),hj=new lj,fj=function(){function e(){u(this,e),l(this,"_audioContextInstance",void 0)}return d(e,[{key:"getAudioContextInstance",value:function(){if(!this._audioContextInstance){var e=window.AudioContext||window.webkitAudioContext;this._audioContextInstance=new e}return this._audioContextInstance}}]),e}(),pj=function(){function e(t){u(this,e),l(this,"_ctx",void 0),l(this,"_analyserNode",void 0),l(this,"_audioSource",void 0);var r=vj.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 d(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}(),_j=function(){function e(t){u(this,e),l(this,"_gainNode",void 0),l(this,"_audioDestination",void 0),l(this,"_audioSource",void 0);var r=vj.getAudioContextInstance();this._audioDestination=r.createMediaStreamDestination();var n=new MediaStream;n.addTrack(t),this._audioSource=r.createMediaStreamSource(n),this._gainNode=r.createGain(),this._audioSource.connect(this._gainNode).connect(this._audioDestination)}return d(e,[{key:"setVolumeGain",value:function(e){this._gainNode.gain.value=e}},{key:"getAudioTrack",value:function(){return this._audioDestination.stream.getAudioTracks()[0]}},{key:"destroy",value:function(){this._audioSource.disconnect(),this._gainNode.disconnect()}}]),e}(),vj=new fj,mj=new lM("VERTC",0),gj=new WeakMap,yj=function(e){return gj.get(e)},Sj=function(e){h(r,e);var t=g(r);function r(e,n){var i;return u(this,r),l(v(i=t.call(this)),"mediaType",void 0),l(v(i),"_trackId",void 0),i._trackId=e,i.mediaType=n,i}return d(r,[{key:"getId",value:function(){return this._trackId}}]),r}(fM),bj=function(e){h(r,e);var t=g(r);function r(e,n,i){var o;return u(this,r),l(v(o=t.call(this,n,i)),"_mediaTrack",void 0),o._mediaTrack=e,o._initListeners(),o}return d(r,[{key:"getTrack",value:function(){return this._mediaTrack}},{key:"setTrack",value:function(e){this._mediaTrack=e}},{key:"close",value:function(){var e;return null===(e=this._mediaTrack)||void 0===e?void 0:e.stop()}},{key:"_initListeners",value:function(){var e=this;this._mediaTrack instanceof MediaStreamTrack&&this._mediaTrack.addEventListener("ended",(function(){GV.rtcError("track-ended mediaType: ".concat(e._mediaTrack.kind),-1001),e.emit("track-ended",e)}))}}]),r}(Sj),Ej=function(e){h(r,e);var t=g(r);function r(e,n,i){var o;return u(this,r),l(v(o=t.call(this,n,i)),"_mediaTrack",void 0),o._mediaTrack=e,o}return d(r,[{key:"getTrack",value:function(){return this._mediaTrack}}]),r}(Sj),kj=function(e){h(n,e);var t,r=g(n);function n(e,t){var i;return u(this,n),l(v(i=r.call(this,e,t,"video")),"resolution",void 0),l(v(i),"videoCaptureConfig",void 0),l(v(i),"dummy",!1),i.resolution={width:0,height:0},i}return d(n,[{key:"updateVideoCaptureConfig",value:(t=s(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.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 mj.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}(bj),Rj=function(e){h(n,e);var t,r=g(n);function n(e,t){var i;return u(this,n),l(v(i=r.call(this,e,t,"audio")),"audioCaptureConfig",void 0),l(v(i),"_audioLevelFetcher",void 0),l(v(i),"mixedAudioTrack",void 0),l(v(i),"mixType",$.PLAYOUT_AND_PUBLISH),l(v(i),"_audioVolumeGain",void 0),l(v(i),"gainAudioTrack",void 0),i}return d(n,[{key:"getPublishTrack",value:function(){var e=null==this?void 0:this.getTrack();return(null==this?void 0:this.mixType)!==$.PLAYOUT&&null!=this&&this.mixedAudioTrack?e=null==this?void 0:this.mixedAudioTrack:null!=this&&this.gainAudioTrack&&(e=this.gainAudioTrack),e}},{key:"setCaptureVolume",value:function(e){this._audioVolumeGain||(this._audioVolumeGain=new _j(this.getTrack()),this.gainAudioTrack=this._audioVolumeGain.getAudioTrack()),this._audioVolumeGain.setVolumeGain(e/100)}},{key:"getAudioLevel",value:function(){return this._audioLevelFetcher||(this._audioLevelFetcher=new pj(this.getTrack())),this._audioLevelFetcher.getAudioLevel()}},{key:"updateAudioCaptureConfig",value:(t=s(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.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 mj.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}(bj),Tj=function(e){h(r,e);var t=g(r);function r(e,n){return u(this,r),t.call(this,e,n,"video")}return d(r)}(Ej),Ij=function(e){h(r,e);var t=g(r);function r(e,n){var i;return u(this,r),l(v(i=t.call(this,e,n,"audio")),"_audioLevelFetcher",void 0),i}return d(r,[{key:"getAudioLevel",value:function(){return this._audioLevelFetcher||(this._audioLevelFetcher=new pj(this.getTrack())),this._audioLevelFetcher.getAudioLevel()}}]),r}(Ej),Aj=function(e){h(r,e);var t=g(r);function r(){return u(this,r),t.apply(this,arguments)}return d(r)}(Rj),wj=function(e){h(r,e);var t=g(r);function r(){return u(this,r),t.apply(this,arguments)}return d(r)}(kj),Cj=function(e){h(r,e);var t=g(r);function r(){return u(this,r),t.apply(this,arguments)}return d(r)}(kj),Oj=function(e){h(r,e);var t=g(r);function r(){return u(this,r),t.apply(this,arguments)}return d(r)}(Rj),xj=function(e){h(r,e);var t=g(r);function r(){return u(this,r),t.apply(this,arguments)}return d(r)}(kj),Nj=function(e){h(r,e);var t=g(r);function r(){return u(this,r),t.apply(this,arguments)}return d(r)}(Rj);function Dj(e){return Pj.apply(this,arguments)}function Pj(){return(Pj=s(regeneratorRuntime.mark((function e(t){var r,n,i,o,a,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=(null==t||null===(r=t.deviceId)||void 0===r?void 0:r.exact)||"default",e.prev=1,mj.print("createCameraVideoTrack","constraints:",t),GV.rtcVideoCaptureEvent({event_type:VV.START,media_device_id:i}),o=RP(),e.next=7,navigator.mediaDevices.getUserMedia({video:t});case 7:n=e.sent,GV.rtcVideoCaptureEvent({event_type:VV.START_CAPTURE_RESULT,media_device_id:i,reason:FV.SUCCESS,elapse:RP()-o}),hj.hasVideoPermission=!0,e.next=16;break;case 12:throw e.prev=12,e.t0=e.catch(1),GV.rtcVideoCaptureEvent({event_type:VV.RUNNING_FAILED,media_device_id:i,error_code:e.t0.code,reason:e.t0.name+e.t0.message}),new lD(cD.GET_VIDEO_TRACK_FAILED,"throw error from getUserMedia",e.t0);case 16:return a=n.getVideoTracks()[0],gj.set(a,n),(s=new wj(a,kP())).videoCaptureConfig=t,e.abrupt("return",s);case 21:case"end":return e.stop()}}),e,null,[[1,12]])})))).apply(this,arguments)}function Mj(e,t){return Uj.apply(this,arguments)}function Uj(){return Uj=s(regeneratorRuntime.mark((function e(t,r){var n,i,o,a,s,u,c,d,l,h,f;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return mj.print("createCameraVideoTrack","constraints:",t),o=(null==t||null===(n=t.deviceId)||void 0===n?void 0:n.exact)||"default",s=(a=r||{}).sampleRate,u=a.channel,c=a.agc,d=a.ans,l=a.aec,void 0===t.sampleRate&&(t.sampleRate=s),void 0===t.channelCount&&(t.channelCount=u),void 0===t.autoGainControl&&(t.autoGainControl=c),void 0===t.noiseSuppression&&(t.noiseSuppression=d),void 0===t.echoCancellation&&(t.echoCancellation=l),e.prev=8,GV.rtcVideoCaptureEvent({event_type:VV.START,media_device_id:o}),h=RP(),e.next=13,navigator.mediaDevices.getUserMedia({audio:t});case 13:i=e.sent,GV.rtcVideoCaptureEvent({event_type:VV.START_CAPTURE_RESULT,media_device_id:o,reason:FV.SUCCESS,elapse:RP()-h}),hj.hasAudioPermission=!0,e.next=22;break;case 18:throw e.prev=18,e.t0=e.catch(8),GV.rtcVideoCaptureEvent({event_type:VV.RUNNING_FAILED,media_device_id:o,error_code:e.t0.code,reason:e.t0.name+e.t0.message}),new lD(cD.GET_AUDIO_TRACK_FAILED,"throw error from getUserMedia",e.t0);case 22:return f=i.getAudioTracks()[0],gj.set(f,i),e.abrupt("return",new Aj(f,kP()));case 25:case"end":return e.stop()}}),e,null,[[8,18]])}))),Uj.apply(this,arguments)}function Lj(){return Vj.apply(this,arguments)}function Vj(){return Vj=s(regeneratorRuntime.mark((function e(){var t,r,n,i,o=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=o.length>0&&void 0!==o[0]&&o[0],r=o.length>1?o[1]:void 0,mj.print("createScreenStream","withAudio:",t),e.prev=3,GV.rtcVideoCaptureEvent({event_type:VV.START,media_device_id:"screen"}),i=RP(),e.next=8,navigator.mediaDevices.getDisplayMedia({video:r||!0,audio:t});case 8:n=e.sent,GV.rtcVideoCaptureEvent({event_type:VV.START_CAPTURE_RESULT,media_device_id:"screen",reason:FV.SUCCESS,elapse:RP()-i}),e.next=16;break;case 12:throw e.prev=12,e.t0=e.catch(3),GV.rtcVideoCaptureEvent({event_type:VV.RUNNING_FAILED,media_device_id:"screen",error_code:e.t0.code,reason:e.t0.name+e.t0.message}),new lD(cD.GET_SCREEN_TRACK_FAILED,"throw error from getDisplayMedia",e.t0);case 16:return e.abrupt("return",n);case 17:case"end":return e.stop()}}),e,null,[[3,12]])}))),Vj.apply(this,arguments)}var Fj=function(e){return e[e.NONE=0]="NONE",e}(Fj||{}),Bj=function(){function e(){u(this,e)}return d(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}}},{key:"getAvcc",value:function(e,t){var r=new Uint8Array(e.byteLength+t.byteLength+11);r[0]=1,r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=255,r[5]=225;var n=6;return r.set(new Uint8Array([e.byteLength>>>8&255,255&e.byteLength]),n),n+=2,r.set(e,n),r[n+=e.byteLength]=1,n++,r.set(new Uint8Array([t.byteLength>>>8&255,255&t.byteLength]),n),n+=2,r.set(t,n),r}}]),e}(),jj=function(){function e(t){u(this,e),l(this,"_position",0),l(this,"_dataview",void 0),this._dataview=new DataView(t)}return d(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}(),Gj=function(e){return e[e.internal=0]="internal",e[e.external=1]="external",e[e.bypass=2]="bypass",e}(Gj||{}),Hj=new Uint8Array([109,167,53,190,103,90,72,1,170,89,63,164,194,199,19,85]),zj=new Uint8Array([109,167,53,190,103,90,72,1,170,89,63,164,194,199,19,84]),Kj=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 Wj(e){for(var t=[];e>=255;)e-=255,t.push(255);return t.push(e),new Uint8Array(t)}function Xj(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 Yj=function(){function e(){u(this,e)}return d(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?Hj:zj,a=Wj(e.byteLength+o.byteLength),s=Kj(e);return new Uint8Array([].concat(E(r),E(n),E(i),E(a),E(o),E(s),[128]))}},{key:"decodeSeiBody",value:function(e){var t=function(e){for(var t=[],r=0;r<e.length;r++)e[r]<=3&&0===e[r-1]&&0===e[r-2]||t.push(e[r]);return new Uint8Array(t)}(e=e.slice(0,e.length-1));if(!(t.byteLength<2)){var r=0;if(5===t[1]||100===t[1]){var n=b(Xj(t,r+=2),2),i=n[0],o=2,a=(r=n[1])+i;return t.byteLength>=zj.byteLength&&i>=zj.byteLength&&t.slice(r,r+zj.byteLength).toString()===zj.toString()?(r+=zj.byteLength,o=1):t.byteLength>=zj.byteLength&&i>=zj.byteLength&&t.slice(r,r+Hj.byteLength).toString()===Hj.toString()&&(r+=Hj.byteLength,o=0),{type:o,payload:t.slice(r,a)}}}}},{key:"parseInternalSEI",value:function(e){var t=new Map,r=0;if(0===e.type){for(;e.payload.byteLength-r>=2;){var n=b(Xj(e.payload,r),2),i=n[0];r=n[1];var o=b(Xj(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))}return t}}},{key:"makeInternalSei",value:function(e){var t,r=[],n=T(e);try{for(n.s();!(t=n.n()).done;){var i=b(t.value,2),o=i[0],a=i[1],s=Wj(o),u=Wj(a.byteLength);r.push(s,u,a)}}catch(LU){n.e(LU)}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}(),qj=function(){function e(t){u(this,e),l(this,"_stream",void 0),l(this,"_timer",void 0),l(this,"client",void 0),l(this,"handler",void 0),l(this,"monitor",void 0),this._stream=t}return d(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:"destroy",value:function(){this.delStatsEvtInterval()}}]),e}(),Jj=function(e){h(i,e);var t,r,n=g(i);function i(e){var t;return u(this,i),(t=n.call(this,e))._stream=e,t}return d(i,[{key:"setLocalStreamStatsEvtInterval",value:function(e,t,r){var n,i,o,a=this;if(!this._timer){this.setVar(e,t,r),e.once(RF.ABNORMAL_DISCONNECTION,(function(){a.destroy()}));var u={audio:{},video:{}},c=this._stream,d=null===(n=c.audioTrack)||void 0===n?void 0:n.getPublishTrack(),l=null===(i=c.videoTrack)||void 0===i?void 0:i.getTrack();this.getAudioStats(d,u,null===(o=c.audioTrack)||void 0===o?void 0:o.getAudioLevel()),this.getVideoStats(l,u),this.delStatsEvtInterval();var h=function(){var e=s(regeneratorRuntime.mark((function e(){var t,r,n,i,o,s,d;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=null===(t=c.audioTrack)||void 0===t?void 0:t.getPublishTrack(),o=null===(r=c.videoTrack)||void 0===r?void 0:r.getTrack(),e.next=4,a.getAudioStats(i,u,null===(n=c.audioTrack)||void 0===n?void 0:n.getAudioLevel());case 4:return s=e.sent,e.next=7,a.getVideoStats(o,u);case 7:return d=e.sent,e.abrupt("return",{audioStats:s,videoStats:d,isScreen:c.isScreen});case 9:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),f=function(){var e=s(regeneratorRuntime.mark((function e(){var t,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,h();case 2:r=e.sent,null===(t=a.client)||void 0===t||t.emit("onLocalStreamStats",r),a._timer=setTimeout(f,2e3);case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();this._timer=setTimeout(f,2e3)}}},{key:"unpublish",value:function(){this.delStatsEvtInterval()}},{key:"getAudioStats",value:(r=s(regeneratorRuntime.mark((function e(t,r,n){var i,o,a,s,u,c,d,l,h,f;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i={},o={timestamp:Date.now()},a=this._stream,s=a.streamId,u=a.audioMid,c=a.isScreen,d=a.pubAttributes,l={media_type:"audio",is_screen:!!c,direction:"up",stream_id:s,vid:u,connection_status:navigator.onLine,capture_state:d.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((h=e.sent).length){e.next=11;break}return e.abrupt("return",i);case 11:if(h.forEach((function(e){var t=e.type,r=e.packetsSent,n=e.packetsLost,a=e.bytesSent,s=e.clockRate,u=e.roundTripTime,c=e.channels,d=e.audioLevel,h=e.googRtt,f=e.mimeType,p=e.availableIncomingBitrate,_=e.availableOutgoingBitrate,v=e.bytesReceived,m=e.nominated,g=e.id,y=e.currentRoundTripTime,S=e.state,b=e.writable,E=e.requestsReceived,k=e.responsesReceived,R=e.requestsSent,T=e.consentRequestsSent,I=e.responsesSent,A=e.jitter,w=e.candidateType,C=e.ip,O=e.address,x=e.networkType,N=e.port,D=e.protocol,P=e.nackCount,M=e.retransmittedBytesSent,U=e.retransmittedPacketsSent,L=e.roundTripTimeMeasurements,V=e.audioInputLevel,F=e.ssrc,B=e.totalAudioEnergy,j=e.totalSamplesDuration,G=e.mediaType,H=e.fractionLost;"outbound-rtp"===t?(o.packetsSent=r,o.bytesSent=a,l.bytes=a,l.packetsSent=r,l.nackCount=P,l.ssrc=F,l.retransmitted_bytes_sent=M,l.retransmitted_packets_sent=U,o.retransmittedPacketsSent=U):"remote-inbound-rtp"===t?(o.packetsLost=n,l.packetsLost=n,l.jitter=1e3*A,i.rtt=1e3*u,l.rtt=i.rtt,l.round_trip_time_measurements=L,i._fractionLost=H||0):"codec"===t?(i.recordSampleRate=s,i.numChannels=c,l.codecName=f):"media-source"===t&&void 0!==d?(l.audio_level=d?-10*Math.log10(Math.pow(d,2)):d,l.volume=255*d,l.total_audio_energy=B,l.total_samples_duration=j):"ssrc"===t&&"audio"===G?(l.audio_network_elapse=h,l.send_level=V):"candidate-pair"===t?(l.ice_available_incoming_bitrate=p,l.ice_available_outgoing_bitrate=_,l.ice_bytes_received=v,l.ice_bytes_sent=a,l.ice_nominated=+m,l.ice_pair_id=g,l.ice_pair_rtt=y,l.ice_pair_state=S,l.ice_pair_writable=b,l.recv_ping_requests=E,l.recv_ping_responses=k,l.sent_ping_requests_before_first_response=R,l.sent_ping_requests_total=R+(T||0),l.sent_ping_responses=I):"local-candidate"===t?(l.local_candidate_type=w,l.local_ip=C||O,l.local_network_type=x,l.local_port=N,l.protocol=D):"remote-candidate"===t&&(l.remote_candidate_type=w,l.remote_ip=C||O,l.remote_port=N)})),void 0===l.volume&&void 0!==n&&(l.volume=n,l.audio_level=n?-10*Math.log10(Math.pow(n/255,2)):n),(f=r.audio).timestamp){e.next=17;break}return r.audio=o,e.abrupt("return",i);case 17:return void 0!==o.packetsLost&&(i.audioLossRate=(o.packetsLost-f.packetsLost)/(o.packetsSent-f.packetsSent),i.audioLossRate=Number.isNaN(i.audioLossRate)?0:i.audioLossRate,l.fraction_lost=i.audioLossRate),i.statsInterval=o.timestamp-f.timestamp,l.stats_interval=i.statsInterval,i.sendKBitrate=(o.bytesSent-f.bytesSent||0)/i.statsInterval*8,l.bitrate=Math.round(1e3*i.sendKBitrate),l.bandwidth=Math.round(l.bitrate/1024),r.audio=o,this.monitor.rtcMediaStatistics(l,{}),i._retransmittedRate=(o.retransmittedPacketsSent-f.retransmittedPacketsSent)/(o.packetsSent-f.packetsSent),i._fractionLost=Math.max(i._fractionLost,i.audioLossRate),e.abrupt("return",i);case 28:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return r.apply(this,arguments)})},{key:"getVideoStats",value:(t=s(regeneratorRuntime.mark((function e(t,r){var n,i,o,a,s,u,c,d,l,h,f,p,_,v;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n={},i={timestamp:Date.now(),simulcast:{}},o=this._stream,a=o.streamId,s=o.videoMid,u=o.isScreen,c=o.pubAttributes,d=o.enableSimulcast,l={media_type:"video",is_screen:!!u,direction:"up",stream_id:a,vid:s,connection_status:navigator.onLine,capture_state:c.localvideo?"capture_state_on":"capture_state_off"},t&&this.handler){e.next=6;break}return e.abrupt("return",n);case 6:return n.isScreen=u,e.next=9,this.handler.getStats(t);case 9:if((h=e.sent).length){e.next=12;break}return e.abrupt("return",n);case 12:if(f=0,h.forEach((function(e){var t=e.type,r=e.framesEncoded,o=e.packetsLost,a=e.bytesSent,s=e.framesSent,u=e.roundTripTime,c=e.mimeType,h=e.frameWidth,p=e.frameHeight,_=e.packetsSent,v=e.googActualEncBitrate,m=e.googAvailableReceiveBandwidth,g=e.googAvailableSendBandwidth,y=e.googAvgEncodeMs,S=e.googBucketDelay,b=e.googEncodeUsagePercent,E=e.googFrameRateInput,k=e.availableIncomingBitrate,R=e.availableOutgoingBitrate,T=e.bytesReceived,I=e.nominated,A=e.id,w=e.currentRoundTripTime,C=e.state,O=e.writable,x=e.candidateType,N=e.ip,D=e.address,P=e.networkType,M=e.port,U=e.nackCount,L=e.pliCount,V=e.protocol,F=e.qpSum,B=e.requestsReceived,j=e.responsesReceived,G=e.googRetransmitBitrate,H=e.requestsSent,z=e.consentRequestsSent,K=e.responsesSent,W=e.ssrc,X=e.googTargetEncBitrate,Y=e.googTransmitBitrate,q=e.googRtt,J=e.retransmittedPacketsSent,Q=e.encoderImplementation,Z=e.jitter,$=e.rid,ee=e.fractionLost;"outbound-rtp"===t?(d&&($?i.simulcast[$]=e:i.simulcast[f]=e,f++),i.framesEncoded=r,i.bytesSent=a,i.framesSent=s,l.bytes=a,i.packetsSent=_,l.packetsSent=_,l.nackCount=U,l.pli_count=L,l.qp_sum=F,l.ssrc=W,l.retransmitted_packets_sent=J,i.retransmittedPacketsSent=J,l.encoder_implementation=Q,void 0!==h&&(n.encodedFrameWidth=h,n.encodedFrameHeight=p,l.frame_size_height=p,l.frame_size_width=h)):"track"===t?(n.encodedFrameWidth=h,n.encodedFrameHeight=p,l.frame_size_height=p,l.frame_size_width=h):"remote-inbound-rtp"===t?(i.packetsLost=o,n.rtt=1e3*u,l.rtt=n.rtt,l.jitter=Z,l.packetsLost=o,n._fractionLost=ee||0):"codec"===t?(n.codecType=c,l.codecName=c):"candidate-pair"===t?(l.ice_available_incoming_bitrate=k,l.ice_available_outgoing_bitrate=R,l.ice_bytes_received=T,l.ice_bytes_sent=a,l.ice_nominated=+I,l.ice_pair_id=A,l.ice_pair_rtt=w,l.ice_pair_state=C,l.ice_pair_writable=O,l.recv_ping_requests=B,l.recv_ping_responses=j,l.sent_ping_requests_before_first_response=H,l.sent_ping_requests_total=H+z,l.sent_ping_responses=K):"local-candidate"===t?(l.local_candidate_type=x,l.local_ip=N||D,l.local_network_type=P,l.local_port=M,l.protocol=V):"remote-candidate"===t?(l.remote_candidate_type=x,l.remote_ip=N||D,l.remote_port=M):"VideoBwe"===t?(l.encBitratebps=v,l.available_receive_bandwidth=m,l.available_send_bandwidth=g,l.bucket_delay=S,l.retransmitBitratebps=G,l.targetEncBitratebps=X,l.transmit_bitrate=Y,n._sendBandWidth=+g):"ssrc"===t&&(l.video_network_elapse=q,l.avg_encode_ms=y,l.encodeUsage=b,l.frame_rate_input=E,l.orignal_input_Framerate=+E)})),(p=r.video).timestamp){e.next=18;break}return r.video=i,e.abrupt("return",n);case 18:return n.statsInterval=i.timestamp-p.timestamp,l.stats_interval=n.statsInterval,_=Object.keys(i.simulcast),d?(l.sim_enc_width=[],l.sim_enc_height=[],l.sim_enc_bps=[],l.sim_enc_framerate=[],l.sim_rids=[],l.sim_enc_bandwidth=[],l.sim_sent_framerate=[],l.sim_fraction_lost=[],v=!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,h=t.qualityLimitationReason,f=t.qualityLimitationDurations,_=t.qualityLimitationResolutionChanges,m=t.retransmittedPacketsSent;void 0!==h&&(l.sim_qualityLimitationReason||(l.sim_qualityLimitationReason=[],l.sim_qualityLimitationDurations=[],l.sim_qualityLimitationResolutionChanges=[]),l.sim_qualityLimitationReason.push(h),l.sim_qualityLimitationDurations.push(f),l.sim_qualityLimitationResolutionChanges.push(_));var g=p.simulcast[e];if(l.sim_enc_width.push(r||0),l.sim_enc_height.push(o||0),g){var y=(a-g.bytesSent||0)/n.statsInterval;l.sim_enc_bps.push(Math.round(8e3*y)),l.sim_enc_bandwidth.push(Math.round(8e3*y/1024));var S=1e3*(s-g.framesEncoded)/n.statsInterval;l.sim_enc_framerate.push(Math.round(S)),l.sim_rids.push(e);var b=void 0!==u?u-g.framesSent:s-g.framesEncoded,E=1e3*b/n.statsInterval;l.sim_sent_framerate.push(Math.round(E));var k=(c-g.packetsLost)/(d-g.packetsSent);n._retransmittedRate=(m-g.retransmittedPacketsSent)/(d-g.packetsSent),k=Number.isNaN(k)?0:k,l.sim_fraction_lost.push(k),r>0&&!v&&(n.sentKBitrate=8*y,n.encoderOutputFrameRate=S,n.encodedFrameCount=b,n.sentFrameRate=E,n.videoLossRate=k,v=!0)}})),this.monitor.rtcMediaStatistics(l,{})):(n.encodedFrameCount=void 0!==i.framesSent?i.framesSent-p.framesSent:i.framesEncoded-p.framesEncoded,n.sentKBitrate=(i.bytesSent-p.bytesSent||0)/n.statsInterval*8,l.bitrate=Math.round(1e3*n.sentKBitrate),l.bandwidth=Math.round(l.bitrate/1024),n.encoderOutputFrameRate=1e3*(i.framesEncoded-p.framesEncoded)/n.statsInterval,l.frame_rate_encoded=Math.round(n.encoderOutputFrameRate),n.sentFrameRate=1e3*n.encodedFrameCount/n.statsInterval,l.frame_rate_sent=Math.round(n.sentFrameRate),n.videoLossRate=(i.packetsLost-p.packetsLost)/(i.packetsSent-p.packetsSent),n.videoLossRate=Number.isNaN(n.videoLossRate)?0:n.videoLossRate,l.fraction_lost=n.videoLossRate,n._retransmittedRate=(i.retransmittedPacketsSent-p.retransmittedPacketsSent)/(i.packetsSent-p.packetsSent),this.monitor.rtcMediaStatistics(l,{})),r.video=i,n._fractionLost=Math.max(n._fractionLost,n.videoLossRate),e.abrupt("return",n);case 25:case"end":return e.stop()}}),e,this)}))),function(e,r){return t.apply(this,arguments)})}]),i}(qj),Qj=function(e){h(o,e);var t,r,n,i=g(o);function o(e){var t;return u(this,o),l(v(t=i.call(this,e)),"_audioStallCount",void 0),l(v(t),"_setAudioStallCount",void 0),l(v(t),"_audioStallTimer",void 0),l(v(t),"_audioStallInterval",void 0),l(v(t),"_audioStallRatio",void 0),l(v(t),"_videoInWaiting",void 0),t._videoInWaiting=!1,t}return d(o,[{key:"setRemoteStreamStatsEvtInterval",value:(n=s(regeneratorRuntime.mark((function e(t,r,n){var i,a,u,c,d,l,h,f,p,_,v,m,g,y,S=this;return regeneratorRuntime.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),t.once(RF.ABNORMAL_DISCONNECTION,(function(){S.destroy()})),this._audioStallInterval=o.audioStallInterval||100,this._audioStallRatio=o.audioStallRatio||.6,u={audio:{},video:{}},c=this._stream,d=null===(i=c.audioTrack)||void 0===i?void 0:i.getTrack(),l=null===(a=c.videoTrack)||void 0===a?void 0:a.getTrack(),this.getRemoteVideoStats(l,u),e.next=13,this.getRemoteAudioStats(d,u);case 13:this.delStatsEvtInterval(),h=0,f=0,_=[],v=0,m=RP(),this._setAudioStallCount=function(){if(S._audioStallInterval>0&&void 0!==u.audio.concealedSamples){var e=u.audio.concealedSamples,t=u.audio.totalSamplesReceived;m=RP();var r={isStall:!1,counted:!1,diff:0},n=.5*S._audioStallInterval;S._audioStallCount=s(regeneratorRuntime.mark((function i(){var o,a,s,u,d,l,p,g,y,b,E,k,R,T,I;return regeneratorRuntime.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(a=c.hasAudio,s=c.subAudio,a&&s){i.next=7;break}return r.isStall=!1,r.counted=!1,_.push({reason:"hasAudio: ".concat(a,", subAudio: ").concat(s)}),m=RP(),i.abrupt("return",{stall_count:h,stall_duration:f,stall_list:_,stats_count:v});case 7:return u=null===(o=c.audioTrack)||void 0===o?void 0:o.getTrack(),d=Date.now(),i.next=11,S.handler.getStats(u,!0);case 11:if(l=i.sent,p=Date.now(),g=RP(),!((y=g-m)<n)){i.next=18;break}return _.push({diff:y,start:m,end:g,get_stats_cost:p-d,get_stats_start:d,get_stats_end:p,reason:"diff(".concat(y,") < minInterval(").concat(n,")")}),i.abrupt("return",{stall_count:h,stall_duration:f,stall_list:_,stats_count:v});case 18:if(b=l.length,E=l.find((function(e){return"inbound-rtp"===e.type}))){i.next=23;break}return _.push({diff:y,start:m,end:g,get_stats_cost:p-d,get_stats_start:d,get_stats_end:p,reason:b?"no inbound-rtp":"no report"}),i.abrupt("return",{stall_count:h,stall_duration:f,stall_list:_,stats_count:v});case 23:return k=E.concealedSamples,R=E.totalSamplesReceived,I=R-t,(T=k-e)>=0&&I>=0&&T>=S._audioStallRatio*I?(_.push({concealed:T,received:I,diff:y,start:m,end:g,get_stats_cost:p-d,get_stats_start:d,get_stats_end:p,is_stall:!0}),r.isStall?(r.counted?f+=y:(f=f+r.diff+y,h++),r.counted=!0):y>=200?(f+=y,h++,r.counted=!0):(r.counted=!1,r.diff=y),r.isStall=!0):(_.push({concealed:T,received:I,diff:y,start:m,end:g,get_stats_cost:p-d,get_stats_start:d,get_stats_end:p}),r.isStall=!1,r.counted=!1),e=k,t=R,m=g,v++,i.abrupt("return",{stall_count:h,stall_duration:f,stall_list:_,stats_count:v});case 32:case"end":return i.stop()}}),i)}))),p=function(){var e=s(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!S._audioStallCount&&S._setAudioStallCount&&S._setAudioStallCount(),!S._audioStallCount){e.next=5;break}return e.next=4,S._audioStallCount();case 4:S._audioStallTimer=setTimeout(p,S._audioStallInterval);case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),S._audioStallTimer=setTimeout(p,S._audioStallInterval)}},this._setAudioStallCount(),g=function(){var e=s(regeneratorRuntime.mark((function e(){var t,r,n,i,o,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=null===(t=c.audioTrack)||void 0===t?void 0:t.getTrack(),i=null===(r=c.videoTrack)||void 0===r?void 0:r.getTrack(),e.next=4,S.getRemoteAudioStats(n,u);case 4:return o=e.sent,h=0,f=0,_=[],v=0,e.next=11,S.getRemoteVideoStats(i,u);case 11:return a=e.sent,e.abrupt("return",{audioStats:o,videoStats:a,isScreen:c.isScreen,userId:c.userId});case 13:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),y=function(){var e=s(regeneratorRuntime.mark((function e(){var t,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,g();case 2:r=e.sent,null===(t=S.client)||void 0===t||t.emit("onRemoteStreamStats",r),p&&(m=RP(),S._audioStallTimer=setTimeout(p,S._audioStallInterval)),S._timer=setTimeout(y,2e3);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),this._timer=setTimeout(y,2e3);case 24:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return n.apply(this,arguments)})},{key:"delStatsEvtInterval",value:function(){S(f(o.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=s(regeneratorRuntime.mark((function e(t,r){var n,i,o,a,s,u,c,d,l,h,f,p,_,v,m,g,y,S;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n={},i={},o=this._stream,a=o.streamId,s=o.userId,u=o.isScreen,c=o.audioMid,d=o.subMediaType,l=o._attributes,h={media_type:"audio",is_screen:!!u,direction:"down",stream_id:a,stream_user_id:s,vid:c,connection_status:navigator.onLine,mute_state:VP(d)?"mute_state_off":"mute_state_on",remote_user_capture_state:l.localaudio?"capture_state_on":"capture_state_off",remote_user_mute_state:l.localaudio&&l.audiostream?"mute_state_off":"mute_state_on"},t&&this.handler){e.next=6;break}return e.abrupt("return",n);case 6:return e.next=8,this.handler.getStats(t);case 8:if((f=e.sent).length){e.next=11;break}return e.abrupt("return",n);case 11:if(f.forEach((function(e){var t=e.type,r=e.packetsLost,o=e.packetsReceived,a=e.bytesReceived,s=e.jitterBufferDelay,u=e.jitterBufferEmittedCount,c=e.clockRate,d=e.channels,l=e.totalSamplesReceived,f=e.concealedSamples,p=e.silentConcealedSamples,_=e.concealmentEvents,v=e.totalRoundTripTime,m=e.state,g=e.currentRoundTripTime,y=e.audioLevel,S=e.totalAudioEnergy,b=e.totalSamplesDuration,E=e.mimeType,k=e.googDecodingNormal,R=e.fecPacketsReceived,T=e.availableIncomingBitrate,I=e.availableOutgoingBitrate,A=e.bytesSent,w=e.nominated,C=e.id,O=e.writable,x=e.jitter,N=e.candidateType,D=e.ip,P=e.address,M=e.networkType,U=e.port,L=e.protocol,V=e.audioOutputLevel,F=e.requestsReceived,B=e.responsesReceived,j=e.requestsSent,G=e.consentRequestsSent,H=e.responsesSent,z=e.ssrc;e.kind,"inbound-rtp"===t?(i.packetsLost=r,i.packetsReceived=o,h.packetsReceived=o,i.bytesReceived=a,h.bytes=a,void 0!==s&&(n.jitterBufferDelay=s/u*1e3,h.average_jitter_buffer_delay_ms=n.jitterBufferDelay),void 0!==l&&(i.totalSamplesReceived=l,n.concealedSamples=f,i.concealedSamples=f,i.silentConcealedSamples=p,h.concealedSamples=f,n.concealmentEvents=_,h.totalSamplesReceived=l),void 0!==R&&(h.fec_packets_received=R),h.jitter=1e3*x,h.ssrc=z):"codec"===t?(n.recordSampleRate=c,d&&(n.numChannels=d),h.codecName=E):"candidate-pair"===t?(h.ice_available_incoming_bitrate=T,h.ice_available_outgoing_bitrate=I,h.ice_bytes_received=a,h.ice_bytes_sent=A,h.ice_nominated=+w,h.ice_pair_id=C,h.ice_pair_rtt=g,h.rtt=1e3*g,h.ice_pair_state=m,h.ice_pair_writable=O,h.recv_ping_requests=F,h.recv_ping_responses=B,h.sent_ping_requests_before_first_response=j,h.sent_ping_requests_total=j+(G||0),h.sent_ping_responses=H,"succeeded"===m&&(n.rtt=1e3*g,n.total_rtt=1e3*v)):"track"===t&&void 0!==y?(h.audio_level=y?-10*Math.log10(Math.pow(y,2)):y,h.volume=255*y,h.total_audio_energy=S,h.totalAudioDuration=b):"ssrc"===t?(h.decodingNormal=k,h.recvAudioLevel=V):"local-candidate"===t?(h.local_candidate_type=N,h.local_ip=D||P,h.local_network_type=M,h.local_port=U,h.protocol=L):"remote-candidate"===t&&(h.remote_candidate_type=N,h.remote_ip=D||P,h.remote_port=U)})),(p=r.audio).timestamp){e.next=17;break}return i.timestamp=Date.now(),r.audio=i,e.abrupt("return",n);case 17:if(_={},void 0!==i.concealedSamples&&(h.interval_concealed_samples=i.concealedSamples-p.concealedSamples,h.interval_samples_received=i.totalSamplesReceived-p.totalSamplesReceived,h.interval_silent_concealed_samples=i.silentConcealedSamples-p.silentConcealedSamples),!(this._audioStallInterval>0&&void 0!==p.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:v=e.sent,m=v.stall_count,g=v.stall_duration,y=v.stall_list,S=v.stats_count,_.stall_list=y,_.stats_count=S,h.concealedSamples===h.interval_concealed_samples&&h.totalSamplesReceived===h.interval_samples_received?(h.stall_count=0,h.stall_duration=0):(h.stall_count=m,h.stall_duration=g),n.stallCount=h.stall_count,n.stallDuration=h.stall_duration;case 35:return i.timestamp=Date.now(),n.audioLossRate=(i.packetsLost-p.packetsLost)/(i.packetsReceived-p.packetsReceived+(i.packetsLost-p.packetsLost)),n.audioLossRate=Number.isNaN(n.audioLossRate)?0:n.audioLossRate,h.packetsLost=Math.round(i.packetsLost-p.packetsLost),h.fraction_lost=n.audioLossRate,h.packets_lost_rate=n.audioLossRate,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),void 0!==i.concealedSamples&&(n.receivedSampleRate=1e3*h.interval_samples_received/n.statsInterval),r.audio=i,this.monitor.rtcMediaStatistics(h,{},_),e.abrupt("return",n);case 50:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"getRemoteVideoStats",value:(t=s(regeneratorRuntime.mark((function e(t,r){var n,i,o,a,s,u,c,d,l,h,f;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n={},i={timestamp:Date.now()},o=this._stream,a=o.streamId,s=o.userId,u=o.isScreen,c=o.subMediaType,d=o._attributes,l={media_type:"video",is_screen:!!u,direction:"down",stream_id:a,stream_user_id:s,vid:this._stream.videoMid,connection_status:navigator.onLine,mute_state:FP(c)?"mute_state_off":"mute_state_on",remote_user_capture_state:d.localvideo?"capture_state_on":"capture_state_off",remote_user_mute_state:d.localvideo&&d.videostream?"mute_state_off":"mute_state_on"},t&&this.handler){e.next=6;break}return e.abrupt("return",n);case 6:return n.isScreen=u,e.next=9,this.handler.getStats(t);case 9:if((h=e.sent).length){e.next=12;break}return e.abrupt("return",n);case 12:if(h.forEach((function(e){var t=e.type,r=e.frameHeight,o=e.frameWidth,a=e.packetsLost,s=e.packetsReceived,u=e.bytesReceived,c=e.framesDecoded,d=e.jitterBufferDelay,h=e.jitterBufferEmittedCount,f=e.mimeType,p=e.firCount,_=e.availableIncomingBitrate,v=e.availableOutgoingBitrate,m=e.bytesSent,g=e.nominated,y=e.id,S=e.currentRoundTripTime,b=e.state,E=e.writable,k=e.candidateType,R=e.ip,T=e.address,I=e.networkType,A=e.port,w=e.nackCount,C=e.pliCount,O=e.protocol,x=e.requestsReceived,N=e.responsesReceived,D=e.requestsSent,P=e.consentRequestsSent,M=e.responsesSent,U=e.ssrc;e.kind;var L=e.jitter,V=e.framesReceived,F=e.keyFramesDecoded,B=e.totalDecodeTime,j=e.decoderImplementation,G=e.lastPacketReceivedTimestamp;"inbound-rtp"===t?(i.packetsLost=a,l.packetsLost=a,i.packetsReceived=s,l.packetsReceived=s,i.bytesReceived=u,l.bytes=u,i.framesDecoded=c,void 0!==d&&(i.jitterBufferDelay=d/h*1e3,l.average_jitter_buffer_delay_ms=i.jitterBufferDelay),l.fir_count=p,l.nackCount=w,i.nackCount=w,l.pli_count=C,l.ssrc=U,l.jitter=L,l.framesReceived=V,i.framesReceived=V,l.framesDecoded=c,l.key_frames_decoded=F,l.total_decode_time=B,l.decoder_name=j,l.last_packet_received_timestamp=G,void 0!==o&&(n.width=o,l.frame_size_width=o,n.height=r,l.frame_size_height=r)):"track"===t&&void 0!==o?(n.width=o,l.frame_size_width=o,n.height=r,l.frame_size_height=r,void 0!==V&&(l.framesReceived=V,i.framesReceived=V)):"codec"===t?l.codecName=f:"candidate-pair"===t?(l.ice_available_incoming_bitrate=_,l.ice_available_outgoing_bitrate=v,l.ice_bytes_received=u,l.ice_bytes_sent=m,l.ice_nominated=+g,l.ice_pair_id=y,l.ice_pair_rtt=S,l.rtt=1e3*S,n.rtt=l.rtt,l.ice_pair_state=b,l.ice_pair_writable=E,l.recv_ping_requests=x,l.recv_ping_responses=N,l.sent_ping_requests_before_first_response=D,l.sent_ping_requests_total=D+(P||0),l.sent_ping_responses=M):"local-candidate"===t?(l.local_candidate_type=k,l.local_ip=R||T,l.local_network_type=I,l.local_port=A,l.protocol=O):"remote-candidate"===t&&(l.remote_candidate_type=k,l.remote_ip=R||T,l.remote_port=A)})),(f=r.video).timestamp){e.next=17;break}return r.video=i,e.abrupt("return",n);case 17:return n.videoLossRate=(i.packetsLost-f.packetsLost)/(i.packetsReceived-f.packetsReceived+(i.packetsLost-f.packetsLost)),n._retransmittedRate=(i.nackCount-f.nackCount)/(i.packetsReceived-f.packetsReceived+(i.packetsLost-f.packetsLost)),n.videoLossRate=Number.isNaN(n.videoLossRate)?0:n.videoLossRate,l.fraction_lost=n.videoLossRate,l.packets_lost_rate=n.videoLossRate,n.statsInterval=i.timestamp-f.timestamp,l.stats_interval=n.statsInterval,n.receivedKBitrate=(i.bytesReceived-f.bytesReceived||0)/n.statsInterval*8,l.bitrate=Math.round(1e3*n.receivedKBitrate),l.bandwidth=Math.round(l.bitrate/1024),n.decoderOutputFrameRate=1e3*(i.framesDecoded-f.framesDecoded)/n.statsInterval,n.receivedFrameRate=1e3*(i.framesReceived-f.framesReceived)/n.statsInterval,l.frame_rate_decoded=Math.round(n.decoderOutputFrameRate),l.frame_rate_received=l.frame_rate_decoded,r.video=i,this.processStall(this._stream,l,n,u),this.monitor.rtcMediaStatistics(l,{}),e.abrupt("return",n);case 35:case"end":return e.stop()}}),e,this)}))),function(e,r){return t.apply(this,arguments)})},{key:"processStall",value:function(e,t,r,n){var i=0,o=0,a=0;if(e.recordedVideoFrames){e.recordedVideoFrames.forEach((function(e){e.isStall&&(i+=e.stallCount,o+=e.stallDuration),a=e.playTime})),e.recordedVideoFrames.length||(o=2e3,i=this._videoInWaiting?0:1,this._videoInWaiting=!0);var s=e.recordedVideoFrames.pop();s&&(s.isStall?this._videoInWaiting=!0:this._videoInWaiting=!1),e.recordedVideoFrames=[]}t.stall_count=i,n?(t.stuck_length=o,t.stall_duration=void 0):(t.stall_duration=o,t.stuck_length=void 0),t.play_time=a,r.stallCount=i,r.stallDuration=o}},{key:"destroy",value:function(){S(f(o.prototype),"destroy",this).call(this),this.delStatsEvtInterval(),this._videoInWaiting=!1}}],[{key:"audioStallConfig",set:function(e){o.audioStallInterval=((null==e?void 0:e.audio_stall_interval)||200)/2,o.audioStallRatio=null==e?void 0:e.audio_stall_ratio}}]),o}(qj);l(Qj,"audioStallInterval",void 0),l(Qj,"audioStallRatio",void 0);var Zj,$j,eG,tG=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}(tG||{}),rG=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}(rG||{}),nG=function(e){return e[e.PUB=0]="PUB",e[e.UNPUB=1]="UNPUB",e}(nG||{}),iG=function(e){return e[e.SUB=0]="SUB",e[e.UNSUB=1]="UNSUB",e}(iG||{}),oG=new lM("Stream",0),aG=function(e){return e[e.INIT=0]="INIT",e[e.SUB_ING=1]="SUB_ING",e[e.SUB_ED=2]="SUB_ED",e}(aG||{}),sG=function(){function e(){u(this,e),l(this,"isScreen",!1),l(this,"stream",void 0),l(this,"streamId",void 0),l(this,"audioMid",void 0),l(this,"videoMid",void 0),l(this,"seiList",[]),l(this,"videoTrack",void 0),l(this,"audioTrack",void 0),l(this,"videoTransceiver",void 0),l(this,"audioTransceiver",void 0),l(this,"videoInputConfig",void 0),l(this,"videoEncodeConfig",[gF]),l(this,"subVideoDescriptions",[]),l(this,"enableSimulcast",!1),l(this,"observer",void 0),l(this,"statsReport",void 0),l(this,"prevScaleResolutionDownBy",1),l(this,"pubAudio",!1),l(this,"pubVideo",!1),l(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 Jj(this)}return d(e,[{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(tB()){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=Yj.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 oG.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 oG.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}(),uG=function(e){h(r,e);var t=g(r);function r(e,n,i,o){var a,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:K.LOW;return u(this,r),l(v(a=t.call(this)),"streamId",void 0),l(v(a),"userId",void 0),l(v(a),"isScreen",void 0),l(v(a),"hasVideo",void 0),l(v(a),"hasAudio",void 0),l(v(a),"_attributes",void 0),l(v(a),"streamState",void 0),l(v(a),"observer",void 0),l(v(a),"statsReport",void 0),l(v(a),"subVideo",void 0),l(v(a),"subAudio",void 0),l(v(a),"subMediaType",void 0),l(v(a),"subLayer",void 0),l(v(a),"audioMid",void 0),l(v(a),"videoMid",void 0),l(v(a),"autosubAudioMid",void 0),l(v(a),"autosubVideoMid",void 0),l(v(a),"_sequenceId",void 0),l(v(a),"stream",void 0),l(v(a),"videoTrack",void 0),l(v(a),"audioTrack",void 0),l(v(a),"videoTransceiver",void 0),l(v(a),"audioTransceiver",void 0),l(v(a),"recordedVideoFrames",void 0),l(v(a),"stillExist",void 0),l(v(a),"_workaround_1_",void 0),l(v(a),"paused",void 0),l(v(a),"originalMediaType",void 0),l(v(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=Fj.NONE,a.subLayer={spatialLayer:0,spatialSubLayer:-1},a.streamState=0,a.statsReport=new Qj(v(a)),a}return d(r,[{key:"sequenceId",get:function(){return this._sequenceId||-1},set:function(e){"number"==typeof e&&(this._sequenceId=e)}},{key:"hasSubscribed",get:function(){return 2===this.streamState}},{key:"attributes",get:function(){return this._attributes},set:function(e){this.hasVideo=e.localvideo&&e.videostream,this.hasAudio=e.localaudio&&e.audiostream,this._attributes=e}},{key:"initVideoEncodedTransform",value:function(){var e=this;if(this.videoTransceiver&&this.videoTransceiver.receiver){var t=this.videoTransceiver.receiver.createEncodedStreams(),r=t.readable,n=t.writable;r.pipeThrough(new TransformStream({transform:function(t,r){var n=Bj.getNalunits(new jj(t.data)).find((function(e){return e.sei}));if(n){var i=Yj.decodeSeiBody(n.body);i&&i.type!==Gj.internal&&e.safeEmit("onSEIMessage",i.payload)}r.enqueue(t)}})).pipeTo(n)}else oG.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 oG.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;oG.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!==z.DISABLE&&this.subVideo){if(this.attributes.videoDescriptions.length-1>this.subLayer.spatialLayer)return[this.originalMediaType,iG.SUB,this._getSubLayerBySpatialLayer(this.subLayer.spatialLayer+1)];if(e===z.AUDIO_ONLY)return[U.VIDEO,iG.UNSUB]}return null}},{key:"getSubscribeRecoverParams",value:function(){if(this.originalMediaType&&FP(this.originalMediaType)){if(!1===this.subVideo)return[this.originalMediaType,iG.SUB,this.subLayer];if("number"==typeof this.originalStreamIndex&&this.subLayer.spatialLayer>this.originalStreamIndex)return[this.originalMediaType,iG.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=new Ij(e,kP()),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=new Tj(e,kP()),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}(fM),cG=new lM("queue",4),dG=function(e){return e[e.ADD=0]="ADD",e[e.CLOSE=1]="CLOSE",e}(dG||{}),lG=function(e){return e.publish="publish",e.unpublish="unpublish",e.subscribe="subscribe",e.unsubscribe="unsubscribe",e.pushtrack="pushtrack",e.removetrack="removetrack",e}(lG||{}),hG=(l(Zj={},"publish","unpublish"),l(Zj,"subscribe","unsubscribe"),l(Zj,"pushtrack","removetrack"),Zj),fG=(l($j={},"publish",0),l($j,"subscribe",0),l($j,"pushtrack",0),l($j,"unpublish",1),l($j,"unsubscribe",1),l($j,"removetrack",1),$j),pG=function(e){h(r,e);var t=g(r);function r(){var e;return u(this,r),l(v(e=t.call(this)),"_queue",void 0),e._queue=[],e}return d(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!==hG[t.action]||(r=t.streamId,cG.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=fG[this._queue[0].action],t=1;t<this._queue.length;t++)if(fG[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}(sM),_G=new lM("ChromeHandler",3),vG=tB(),mG=function(e){h(E,e);var r,n,o,a,c,p,_,m,y=g(E);function E(e,t){var r;return u(this,E),l(v(r=y.call(this,e,t)),"name","chrome"),l(v(r),"_queueBusy",!1),l(v(r),"_sdpQueue",void 0),l(v(r),"_aSendonlyOfferTpl",void 0),l(v(r),"_vSendonlyOfferTpl",void 0),l(v(r),"_aRecvonlyOfferTpl",void 0),l(v(r),"_vRecvonlyOfferTpl",void 0),l(v(r),"_mid",0),l(v(r),"_offerSession",void 0),l(v(r),"_answerSession",void 0),l(v(r),"_offerMlines",[]),l(v(r),"_answerMlines",[]),l(v(r),"_inactiveMlineIndex",[]),l(v(r),"_msidIndexMap",{}),l(v(r),"_mlinesCache",{}),r._sdpQueue=new pG,r._sdpQueue.on("start",(function(){r._queueBusy||"stable"!==r._peerConnection.signalingState||(_G.print("dequeue start"),r.dequeue())})),r}return d(E,[{key:"connect",value:(m=s(regeneratorRuntime.mark((function e(t){var r,n,o,a,s,u,c,d=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return _G.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,RB(t);case 4:return this._answerIce=e.sent,e.next=7,this._peerConnection.createOffer();case 7:return o=e.sent,a=aB.parse(o.sdp),s=b(a.media,1),u=s[0],this._offerIce.fingerprint=a.fingerprint||u.fingerprint,delete a.media,this._offerSession=i({},a),this._answerSession=i({},a),this._answerSession.fingerprint&&(this._answerSession.fingerprint=this._answerIce.fingerprint),c=this._mid++,this._offerMlines=[i(i(i({},u),this._offerIce),{},{mid:"".concat(c)})],this._answerMlines=[i(i(i({},u),this._answerIce),{},{sctpmap:{sctpmapNumber:5e3,app:"webrtc-datachannel",maxMessageSize:262144},mid:"".concat(c)})],this.setDescription(),e.next=21,new Promise((function(e,t){d._dataChannel.onopen=function(){_G.print("connect","dataChannel open"),QV("es.dc.open",""),e("")},d._dataChannel.onerror=function(e){GV.rtcSignalingMsgError(e.error.sdpLineNumber,e.error.errorDetail,vV.INVALID_DATA),QV("es.dc.error",""),t(e)},d._dataChannel.onclose=function(e){QV("es.dc.close",""),t(e)},d._peerConnection.addEventListener("connectionstatechange",(function(e){"failed"!==d._peerConnection.iceConnectionState&&"closed"!==d._peerConnection.iceConnectionState&&"failed"!==d._peerConnection.connectionState||t(e)}))}));case 21:return _G.print("connect","dataChannel establish success"),e.abrupt("return",this._dataChannel);case 23:case"end":return e.stop()}}),e,this)}))),function(e){return m.apply(this,arguments)})},{key:"disconnect",value:function(){this._peerConnection.close(),this._dataChannel.close(),this._peerConnection.ontrack=null}},{key:"destroy",value:function(){S(f(E.prototype),"destroy",this).call(this),this._mlinesCache={}}},{key:"publish",value:(_=s(regeneratorRuntime.mark((function e(t,r){var n,o,a,s,u,c,d,l,h,p,_,v,m,g,y,k,R,T,I,A;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.stream,o=t.enableSimulcast,a=S(f(E.prototype),"internalPublish",this).call(this,t,r),s=a.videoDescriptions,u=a.subVideoDescriptions,c=a.transceiverInit,d="".concat(this._mid++),l="".concat(this._mid++),h=i(i(i({},this._aSendonlyOfferTpl),this._offerIce),{},{mid:d,msid:"".concat(n.id," ").concat(n.id,"-audio"),ssrcs:SB(n,"audio")}),p=i(i(i({},this._vSendonlyOfferTpl),this._offerIce),{},{mid:l,msid:"".concat(n.id," ").concat(n.id,"-video")}),o?(_G.print("subVideoDesc","desc: %o ",u),delete p.ssrcGroups,delete p.ssrcs,_=[],p.rids=s.map((function(e){var t=e.rid;return _.unshift(t),{id:t,direction:"send"}})),p.simulcast={dir1:"send",list1:_.join(";")}):(v=bB(n,"video"),m=v.ssrcs,g=v.ssrcGroups,p.ssrcs=m,p.ssrcGroups=g),null!=r&&r.audioRed&&Array.isArray(h.rtp)&&-1!==(y=h.rtp.findIndex((function(e){return"red"===e.codec})))&&(k=h.rtp.splice(y,1),R=b(k,1),T=R[0],h.rtp.unshift(T)),(I=null==h?void 0:h.rtp.find((function(e){return"opus"===e.codec})))&&h.fmtp&&(A=h.fmtp.find((function(e){return e.payload===I.payload})))&&this._context&&(A.config+=this._context.audioProfileManager.getOpusConfigStr()),this._mlinesCache[t.stream.id]=[h,p],e.abrupt("return",{partialSdp:kB(this._offerSession,h,p),audioMid:d,videoMid:l,type:"incroffer",semantics:"unified-plan",videoDescriptions:s,subVideoDescriptions:u,transceiverInit:c});case 12:case"end":return e.stop()}}),e,this)}))),function(e,t){return _.apply(this,arguments)})},{key:"subscribe",value:(p=s(regeneratorRuntime.mark((function e(t,r){var n,o,a,s,u,c,d,l,h,f;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(_G.print("subscribe","mids: ",r),n="incroffer",o="unified-plan",this._aRecvonlyOfferTpl&&this._vRecvonlyOfferTpl){e.next=11;break}return e.next=6,MP(!0);case 6:if(a=e.sent){e.next=9;break}throw new lD(cD.NOT_SUPPORTED,"Get offer Error");case 9:return e.next=11,this.createAVMlineOfferTpl(a);case 11:if(!this._mlinesCache[t.streamId]){e.next=16;break}return s=b(this._mlinesCache[t.streamId],2),u=s[0],c=s[1],u.mid=t.audioMid,c.mid=t.videoMid,e.abrupt("return",{partialSdp:kB(this._offerSession,u,c),audioMid:u.mid,videoMid:c.mid,type:n,semantics:o});case 16:return d="".concat(this._mid++),l="".concat(this._mid++),h=i(i(i({},this._aRecvonlyOfferTpl),this._offerIce),{},{mid:d}),f=i(i(i({},this._vRecvonlyOfferTpl),this._offerIce),{},{mid:l}),this._mlinesCache[t.streamId]=[h,f],e.abrupt("return",{partialSdp:kB(this._offerSession,h,f),audioMid:d,videoMid:l,type:n,semantics:o,transceiverInit:{aTrack:"audio",vTrack:"video",audioTransceiverInit:{direction:"recvonly"},videoTransceiverInit:{direction:"recvonly"}}});case 22:case"end":return e.stop()}}),e,this)}))),function(e,t){return p.apply(this,arguments)})},{key:"handleAck",value:(c=s(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return _G.print("handleAck()","item: %o",t),e.abrupt("return",this._sdpQueue.enqueue(t));case 2:case"end":return e.stop()}}),e,this)}))),function(e){return c.apply(this,arguments)})},{key:"dequeue",value:(a=s(regeneratorRuntime.mark((function e(){var r,n,o,a,s,u,c,d,l,h,f,p=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._queueBusy=!0,r=this._sdpQueue.dequeue(),_G.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,o=r.sdpStrategy,a=[],s=[],o!==dG.ADD){e.next=14;break}return e.delegateYield(regeneratorRuntime.mark((function e(){var r,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:delete(r=i({},p._answerIce)).candidates,u=!1,c=!1,e.prev=4,o=regeneratorRuntime.mark((function e(){var t,n,o,u,c,d,l,f,_,v,m,g,y,S,E,k,R,T,I,A,w,C;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=h.value,n=t.action,o=t.transceiverInit,u=t.signalingAck,c=t.stream,!((d=c instanceof uG)&&(null==u?void 0:u.sequenceId)<c.sequenceId)){e.next=5;break}return e.abrupt("return","break");case 5:if(l={},f={},_=aB.parse(u.sdp),Array.isArray(_.media)&&(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?(l=e,_G.print("audioMsid",e.msid),e.msid&&(v=e.msid.replace("audio","video"))):(f=e,_G.print("videoMsid",v),v&&(f.msid=v,v=""))}))),m=c.streamId,n===lG.publish&&(m=null===(g=c.stream)||void 0===g?void 0:g.id),p._mlinesCache[m]){e.next=13;break}return e.abrupt("return","break");case 13:if(y=b(p._mlinesCache[m],2),S=y[0],E=y[1],!o){e.next=31;break}c.audioTransceiver=p._peerConnection.addTransceiver(o.aTrack,o.audioTransceiverInit),c.videoTransceiver=p._peerConnection.addTransceiver(o.vTrack,o.videoTransceiverInit),(k=p._inactiveMlineIndex.shift())||(k=p._offerMlines.length),p._offerMlines[k]=i(i({},S),{},{mid:l.mid}),p._answerMlines[k]=l,(R=p._inactiveMlineIndex.shift())||(R=p._offerMlines.length),p._offerMlines[R]=i(i({},E),{},{mid:f.mid}),p._answerMlines[R]=f,p._msidIndexMap[c.streamId]=[k,R],vG&&(c.initAudioEncodedTransform(),c.initVideoEncodedTransform()),a.push(c.streamId||""),s.push(d?c.userId:"local"),e.next=49;break;case 31:if(!d){e.next=49;break}if(T=p._msidIndexMap[c.streamId]||[],I=b(T,2),A=I[0],w=I[1],!A||!w){e.next=48;break}if((null===(C=p._offerMlines[A])||void 0===C?void 0:C.mid)===l.mid){e.next=44;break}return p._offerMlines[A]=EB(p._offerMlines[A]),p._offerMlines[w]=EB(p._offerMlines[w]),p._answerMlines[A]=EB(p._answerMlines[A]),p._answerMlines[w]=EB(p._answerMlines[w]),e.next=41,p.setDescription();case 41:p._offerMlines[A]=i(i({},p._aRecvonlyOfferTpl),{},{mid:l.mid}),p._offerMlines[w]=i(i({},p._vRecvonlyOfferTpl),{},{mid:f.mid}),_G.print("enqueue","hack: %o",c.streamId);case 44:p._answerMlines[A]=l,p._answerMlines[w]=f,e.next=49;break;case 48:_G.print("dequeue","pushtrack before subscribe: %o",c.userId);case 49:d&&(c.sequenceId=null==u?void 0:u.sequenceId);case 50:case"end":return e.stop()}}),e)})),l=t(n);case 7:return e.next=9,l.next();case 9:if(!(u=!(h=e.sent).done)){e.next=17;break}return e.delegateYield(o(),"t0",11);case 11:if("break"!==e.t0){e.next=14;break}return e.abrupt("break",17);case 14:u=!1,e.next=7;break;case 17:e.next=23;break;case 19:e.prev=19,e.t1=e.catch(4),c=!0,d=e.t1;case 23:if(e.prev=23,e.prev=24,!u||null==l.return){e.next=28;break}return e.next=28,l.return();case 28:if(e.prev=28,!c){e.next=31;break}throw d;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",12);case 12:e.next=19;break;case 14:f={},n.forEach((function(e){var t,r,n=e.audioMid,i=e.videoMid,o=e.stream;f[n]=n,f[i]=i,delete p._msidIndexMap[null===(t=e.stream)||void 0===t?void 0:t.streamId],o instanceof sG?delete p._mlinesCache[null==o||null===(r=o.stream)||void 0===r?void 0:r.id]:delete p._mlinesCache[null==o?void 0:o.streamId]})),this._offerMlines=this._offerMlines.map((function(e,t){return f[e.mid]&&(e=EB(e),p._inactiveMlineIndex.push(t)),e})),this._inactiveMlineIndex.sort((function(e,t){return e-t})),this._answerMlines=this._answerMlines.map((function(e){return f[e.mid]&&(e=EB(e)),e}));case 19:return e.next=21,this.setDescription(a.length?{streamId:a.join(","),streamUserId:s.join(",")}:void 0);case 21:_G.print("dequeue","loop"),e.next=27;break;case 24:e.prev=24,e.t1=e.catch(6),_G.print("dequeue","unknown error: %o",e.t1);case 27:return e.prev=27,this.dequeue(),e.finish(27);case 30:case"end":return e.stop()}}),e,this,[[6,24,27,30]])}))),function(){return a.apply(this,arguments)})},{key:"setDescription",value:(o=s(regeneratorRuntime.mark((function e(t){var r,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return _G.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=RP(),t&&GV.rtcBeginCreateOffer("local"===t.streamUserId?gV.UP:gV.DOWN,t.streamId,t.streamUserId),e.next=10,this._peerConnection.createOffer();case 10:return t&&GV.rtcCreateOffer(0,"local"===t.streamUserId?yV.UP:yV.DOWN,t.streamId,t.streamUserId,RP()-n),e.next=13,this.setLocalDescription(aB.write(this._offerSession),t);case 13:return e.next=15,this.setRemoteDescription(aB.write(this._answerSession),t);case 15:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"getDefaultSdp",value:(n=s(regeneratorRuntime.mark((function e(){var t,r,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,MP(!0);case 2:if(t=e.sent){e.next=5;break}throw new lD(cD.NOT_SUPPORTED,"Get offer Error");case 5:return this.createAVMlineOfferTpl(t),r=aB.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:aB.write(r),semantics:"unified-plan",type:"offer"});case 11:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"rollback",value:(r=s(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:delete this._mlinesCache[t];case 1:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"createAVMlineOfferTpl",value:function(e){var t=this;aB.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)}))}}]),E}(oB),gG=new lM("FirefoxHandler",3),yG=function(e){h(y,e);var t,r,n,o,a,c,p,_,m=g(y);function y(){var e;u(this,y);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return l(v(e=m.call.apply(m,[this].concat(r))),"name","firefox"),e}return d(y,[{key:"connect",value:(_=s(regeneratorRuntime.mark((function e(t){var r,n,o,a,s,u,c,d=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return gG.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,RB(t);case 4:return this._answerIce=e.sent,this._peerConnection.addTransceiver("audio",{direction:"recvonly"}),this._peerConnection.addTransceiver("video",{direction:"recvonly"}),e.next=9,this._peerConnection.createOffer();case 9:return o=e.sent,a=aB.parse(o.sdp),s=b(a.media,1),u=s[0],this._offerIce.fingerprint=a.fingerprint||u.fingerprint,a.media=a.media.map((function(e){return i(i({},e),d._offerIce)})),(c=i({},a)).fingerprint=this._answerIce.fingerprint,c.media=c.media.map((function(e){return delete(e=i(i({},e),d._answerIce)).bundleOnly,e.port=9,"application"===e.type?e.sctpmap={sctpmapNumber:5e3,app:"webrtc-datachannel",maxMessageSize:262144}:e.direction="sendonly",e})),e.next=19,this.setLocalDescription(aB.write(a));case 19:return e.next=21,this.setRemoteDescription(aB.write(c));case 21:return e.next=23,new Promise((function(e,t){d._dataChannel.onopen=function(){gG.print("connect","dataChannel open"),QV("es.dc.open",""),e("")},d._dataChannel.onerror=function(e){GV.rtcSignalingMsgError(e.error.sdpLineNumber,e.error.errorDetail,vV.INVALID_DATA),QV("es.dc.error",""),t(e)},d._dataChannel.onclose=function(e){QV("es.dc.close",""),t(e)},d._peerConnection.addEventListener("connectionstatechange",(function(e){"failed"!==d._peerConnection.iceConnectionState&&"closed"!==d._peerConnection.iceConnectionState&&"failed"!==d._peerConnection.connectionState||t(e)}))}));case 23:return gG.print("connect","dataChannel establish success"),e.abrupt("return",this._dataChannel);case 25:case"end":return e.stop()}}),e,this)}))),function(e){return _.apply(this,arguments)})},{key:"publish",value:(p=s(regeneratorRuntime.mark((function e(t,r){var n,o,a,s,u,c,d,l,h,p,_,v,m,g=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=S(f(y.prototype),"internalPublish",this).call(this,t,r),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=RP(),GV.rtcBeginCreateOffer(gV.UP,"",""),e.next=7,this._peerConnection.createOffer();case 7:return l=e.sent,GV.rtcCreateOffer(0,yV.UP,"","",RP()-d),(h=aB.parse(l.sdp)).media=null===(n=h.media)||void 0===n?void 0:n.map((function(e){return i(i({},e),g._offerIce)})),e.next=13,this.setLocalDescription(aB.write(h));case 13:return p=t.audioTransceiver.mid,_=t.videoTransceiver.mid,v=null,m=null,h.media=null===(o=h.media)||void 0===o?void 0:o.map((function(e){if("".concat(e.mid)===p){var t,r=null===(t=v=e)||void 0===t?void 0:t.rtp.find((function(e){return"opus"===e.codec}));if(r&&v.fmtp){var n=v.fmtp.find((function(e){return e.payload===r.payload}));n&&g._context&&(n.config+=g._context.audioProfileManager.getOpusConfigStr())}}else"".concat(e.mid)===_&&(m=e);return e})),e.next=20,this.setLocalDescription(aB.write(h));case 20:return e.abrupt("return",{partialSdp:kB(h,v,m),audioMid:p,videoMid:_,type:"incroffer",semantics:"unified-plan",videoDescriptions:s,subVideoDescriptions:u,transceiverInit:c});case 21:case"end":return e.stop()}}),e,this)}))),function(e,t){return p.apply(this,arguments)})},{key:"subscribe",value:(c=s(regeneratorRuntime.mark((function e(t){var r,n,o,a,s,u,c,d,l,h,f,p,_,v,m=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(gG.print("subscribe()"),!t.audioMid||!t.videoMid){e.next=11;break}return s=aB.parse(null===(o=this._peerConnection.localDescription)||void 0===o?void 0:o.sdp),u=null,c=null,s.media.forEach((function(e){"".concat(e.mid)===t.audioMid?(u=e,t.autosubAudioMid&&(u.mid=t.autosubAudioMid)):"".concat(e.mid)===t.videoMid&&(c=e,t.autosubVideoMid&&(c.mid=t.autosubVideoMid))})),e.next=8,this._peerConnection.createOffer();case 8:return e.next=10,this.setLocalDescription(null===(a=this._peerConnection.localDescription)||void 0===a?void 0:a.sdp,{streamId:t.streamId||"",streamUserId:t.userId});case 10:return e.abrupt("return",{partialSdp:kB(s,u,c),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"}),d=RP(),GV.rtcBeginCreateOffer(gV.UP,t.streamId,t.userId),e.next=17,this._peerConnection.createOffer();case 17:return l=e.sent,GV.rtcCreateOffer(0,yV.UP,t.streamId,t.userId,RP()-d),(h=aB.parse(l.sdp)).media=null===(r=h.media)||void 0===r?void 0:r.map((function(e){return i(i({},e),m._offerIce)})),e.next=23,this.setLocalDescription(aB.write(h),{streamId:t.streamId||"",streamUserId:t.userId});case 23:return f=t.audioTransceiver.mid,p=t.videoTransceiver.mid,_=null,v=null,null===(n=h.media)||void 0===n||n.forEach((function(e){"".concat(e.mid)===f?_=e:"".concat(e.mid)===p&&(v=e)})),e.abrupt("return",{partialSdp:kB(h,_,v),audioMid:f,videoMid:p,type:"incroffer",semantics:"unified-plan"});case 29:case"end":return e.stop()}}),e,this)}))),function(e){return c.apply(this,arguments)})},{key:"handleAck",value:(a=s(regeneratorRuntime.mark((function e(t){var r,n,o,a,s,u,c,d,l,h=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=t.signalingAck,a=t.stream,(s=t.action)!==lG.unpublish&&s!==lG.unsubscribe&&s!==lG.removetrack){e.next=5;break}return e.next=4,this.close(a.streamId,a);case 4:return e.abrupt("return",a.streamId);case 5:return u={},(c=aB.parse(null===(r=this._peerConnection.remoteDescription)||void 0===r?void 0:r.sdp)).media.forEach((function(e){u[e.mid]=e})),aB.parse(null==o?void 0:o.sdp).media.forEach((function(e){"audio"===(e=i(i({},e),h._answerIce)).type&&(a.audioMid?(e.mid=a.audioMid,u[a.audioMid]=e):u[e.mid]=e),"video"===e.type&&(a.videoMid?(e.mid=a.videoMid,u[a.videoMid]=e):u[e.mid]=e)})),d=[],(l=aB.parse(null===(n=this._peerConnection.localDescription)||void 0===n?void 0:n.sdp)).media.forEach((function(e){var t=u[e.mid];t||"inactive"!==e.direction||(t=e),d.push(t)})),c.groups=l.groups,c.media=d,this.setRemoteDescription(aB.write(c)),e.abrupt("return","");case 17:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"getDefaultSdp",value:(o=s(regeneratorRuntime.mark((function e(){var t,r,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=aB.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:aB.write(r),semantics:"unified-plan",type:"offer"});case 5:case"end":return e.stop()}}),e,this)}))),function(){return o.apply(this,arguments)})},{key:"rollback",value:(n=s(regeneratorRuntime.mark((function e(t,r){var n,i,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(gG.print("rollback()"),"have-local-offer"!==(null===(n=this._peerConnection)||void 0===n?void 0:n.signalingState)){e.next=7;break}return null===(i=r.audioTransceiver)||void 0===i||i.stop(),null===(o=r.videoTransceiver)||void 0===o||o.stop(),r.clean(),e.next=7,this._peerConnection.setLocalDescription({type:"rollback"});case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return n.apply(this,arguments)})},{key:"close",value:(r=s(regeneratorRuntime.mark((function e(t,r){var n,i,o,a,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(gG.print("close()"),!r.audioTransceiver||!r.videoTransceiver){e.next=16;break}return r.audioTransceiver.stop(),r.videoTransceiver.stop(),o=[],(a=aB.parse(null===(n=this._peerConnection.localDescription)||void 0===n?void 0:n.sdp)).media=a.media.map((function(e){return"".concat(e.mid)!==r.audioMid&&"".concat(e.mid)!==r.videoMid||(e=EB(e)),"inactive"!==e.direction&&o.push(e.mid),e})),(s=aB.parse(null===(i=this._peerConnection.remoteDescription)||void 0===i?void 0:i.sdp)).media=s.media.map((function(e){return"".concat(e.mid)!==r.audioMid&&"".concat(e.mid)!==r.videoMid||(e=EB(e)),e})),a.groups&&s.groups&&(a.groups[0].mids=o.join(" "),s.groups[0].mids=o.join(" ")),e.next=12,this._peerConnection.createOffer();case 12:return e.next=14,this.setLocalDescription(aB.write(a));case 14:return e.next=16,this.setRemoteDescription(aB.write(s));case 16:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"setCurrentDescription",value:(t=s(regeneratorRuntime.mark((function e(){return regeneratorRuntime.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)})}]),y}(oB),SG=function(e,t){return OP?new yG(e,t):new mG(e,t)},bG=new lM("Locker",2),EG=1,kG=function(){function e(t){u(this,e),l(this,"lockingPromise",Promise.resolve()),l(this,"locks",0),l(this,"name",""),l(this,"lockId",void 0),this.lockId=EG++,t&&(this.name=t),bG.print("[lock-".concat(this.name,"-").concat(this.lockId,"] is created."))}return d(e,[{key:"isLocked",get:function(){return this.locks>0}},{key:"lock",value:function(){var e,t=this;this.locks+=1,bG.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,bG.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}(),RG=(l(eG={},Y.communication,[0]),l(eG,Y.chat,[0]),l(eG,Y.chatRoom,[1,"IES_chatroom"]),l(eG,Y.coHost,[1,"IES_PK"]),l(eG,Y.meeting,[16]),l(eG,Y.classRoom,[0]),eG),TG=Object.defineProperty,IG=Object.getOwnPropertyDescriptor,AG=function(e,t,r,n){for(var i,o=n>1?void 0:n?IG(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&&TG(t,r,o),o},wG=new lM("MediaServerClient",2),CG=6e4,OG=function(e){return e.DISCONNECTED="disconnected",e.DISCONNECTING="disconnecting",e.CONNECTED="connected",e.CONNECTING="connecting",e}(OG||{}),xG=function(e,t){wG.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)},NG=function(e){h(C,e);var t,r,n,o,a,c,f,p,_,m,y,S,E,k,R,T,I,A,w=g(C);function C(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:GV;return u(this,C),l(v(t=w.call(this)),"_token",void 0),l(v(t),"_appId",void 0),l(v(t),"_roomId",void 0),l(v(t),"_roomAttributes",void 0),l(v(t),"_clientId",void 0),l(v(t),"_businessId",void 0),l(v(t),"_userInfo",void 0),l(v(t),"_useCloudProxy",void 0),l(v(t),"_authorization",void 0),l(v(t),"_sessionId",void 0),l(v(t),"_iceConfigRequestManager",void 0),l(v(t),"_ontrackCallbackMap",new Map),l(v(t),"_subResolves",{}),l(v(t),"supportConcurrent",!1),l(v(t),"_handler",void 0),l(v(t),"_pubSubLock",void 0),l(v(t),"_joinLeaveLock",void 0),l(v(t),"_state",void 0),l(v(t),"_dataChannelSignal",void 0),l(v(t),"_pubConfig",{}),l(v(t),"_subConfig",{}),l(v(t),"monitor",void 0),l(v(t),"_roomProfile",Y.communication),l(v(t),"_context",void 0),l(v(t),"_subStreamQueue",{}),t.monitor=r,t._pubSubLock=new kG("pubSubLock"),t._joinLeaveLock=new kG("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 d(C,[{key:"_addHandlerEvents",value:function(){var e,t=this;null===(e=this._handler)||void 0===e||e.once("disconnect",(function(){wG.print("emit ABNORMAL_DISCONNECTION ice"),t.safeEmit(RF.ABNORMAL_DISCONNECTION)}))}},{key:"_addSignalEventHandler",value:function(){var e,t=this;[EF.ON_ADD_STREAM,EF.ON_REMOVE_STREAM,EF.USER_CONNECTION,EF.USER_DISCONNECTION,EF.ON_UPDATE_STREAM_ATTRIBUTES,EF.ON_UPDATE_ROOM_ATTRIBUTES,EF.ON_PUSH_TRACK,EF.ON_REMOVE_TRACK,EF.NODE_CHANGE,EF.ON_CUSTOM_MESSAGE,EF.USER_MESSAGE_RECEIVED,EF.USER_BINARY_MESSAGE_RECEIVED,EF.POST_PROCESSING_MESSAGE,EF.ON_USER_TOKEN_WILL_EXPIRE,EF.STREAM_CONTROL_MESSAGE,EF.ON_SCENE_CONFIG,EF.ON_UPDATE_USER_ATTRIBUTES,kF.RSCP].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(){wG.print("emit ABNORMAL_DISCONNECTION datachannel"),t.safeEmit(RF.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(RF.ON_CONNECTION_STATE_CHANGE,{prev:this._state,next:e}),this._state=e)}},{key:"connect",value:(A=s(regeneratorRuntime.mark((function e(t){var r,n,i,o,a,s,u,c,d=this,l=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=l.length>1&&void 0!==l[1]?l[1]:"",n=l.length>2&&void 0!==l[2]?l[2]:"",i=l.length>3&&void 0!==l[3]?l[3]:{},this.connectionState="connecting",this._appId=t,this._handler&&(this._removeSignalEventHandler(),this._handler.destroy()),!i.node){e.next=11;break}o=[i.node],QV("es.join.nodeChange",i),e.next=20;break;case 11:return Promise.resolve().then((function(){return d.emit("onGetIceConfigHook")})),this._iceConfigRequestManager=new VF,e.next=15,null===(a=this._iceConfigRequestManager)||void 0===a?void 0:a.getAccessNode(t,r,n,aF.getDeviceId(),null==i?void 0:i.reason,null==i?void 0:i.feedbackNode,this._useCloudProxy);case 15:if(o=e.sent){e.next=19;break}throw QV("es.join.getNodeFailed",""),new lD(cD.ICE_SERVER_WRONG,"get ICE config failed");case 19:QV("es.join.getNodeSuccess",o);case 20:return this._addHandlerEvents(),Promise.resolve().then((function(){return d.emit("onEstablishConnectionHook")})),e.prev=22,u=!1,c=o.map((function(e){var t=SG(d.monitor,d._context);return t.connect(e).then((function(r){u?t.destroy():(u=!0,s=r,d.safeEmit("prevIceNode",e),d._handler=t,d.supportConcurrent="chrome"===t.name,d._addHandlerEvents())})).catch((function(){t.destroy()}))})),e.next=27,UP(c);case 27:wG.print("join","establish peerConnection success"),e.next=34;break;case 30:throw e.prev=30,e.t0=e.catch(22),this.connectionState="disconnected",new lD(cD.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed",e.t0);case 34:if(!s){e.next=40;break}this._dataChannelSignal=new MF(s),this._addSignalEventHandler(),this._dataChannelSignal.sendPingSignaling(),e.next=42;break;case 40:throw this.connectionState="disconnected",new lD(cD.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed");case 42:case"end":return e.stop()}}),e,this,[[22,30]])}))),function(e){return A.apply(this,arguments)})},{key:"join",value:(I=s(regeneratorRuntime.mark((function e(t){var r,n,i,o,a,s,u,c,d,l,h,f,p,_,v,m,g=this,y=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=y.length>1&&void 0!==y[1]?y[1]:{},i=y.length>2&&void 0!==y[2]&&y[2],o=y.length>3?y[3]:void 0,wG.print("join()","info: %o, params: %o, reconnect: %o, controlMessage: %o",t,n,i,o),this._appId=t.appId,this._token=t.token,this._roomId=t.roomId,this._clientId=t.userInfo.userId,this._businessId=t.userInfo.businessId,this._userInfo=t.userInfo,this._useCloudProxy=t.useCloudProxy,this._roomProfile=t.roomProfile,this._sessionId=n.sessionId,e.next=15,this.connect(this._appId,this._roomId,this._clientId,n);case 15:return e.t0=AP.token2auth(this._appId,this._roomId,this._clientId,this._token),e.t1=this._sessionId||"",e.t2=Date.now(),e.t3=o,e.t4={extra_info:this._userInfo.extraInfo,role:this._userInfo.role},e.next=22,null===(r=this._handler)||void 0===r?void 0:r.getDefaultSdp();case 22:return e.t5=e.sent,e.next=25,$F();case 25:return e.t6=e.sent,e.t7=window.navigator.userAgent,e.t8=lF.VERSION,e.t9=aF.getDeviceId(),e.t10=this._appId,e.t11=this._roomId,e.t12=this._clientId,e.t13=this._businessId,e.t14=this._useCloudProxy,e.t15=RG[this._roomProfile]?RG[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,enable_cloud_proxy:e.t14,channelProfile:e.t15},e.t17={supportTokenExpireCallBack:!0,enableSceneConfigV2:!0,enableUnBundleMode:!0},a={Authorization:e.t0,sessionId:e.t1,timestamp:e.t2,controlMessage:e.t3,userAttributes:e.t4,sdpInfo:e.t5,params:e.t16,options:e.t17},Promise.resolve().then((function(){return g.emit("onSendingJoinMessageHook")})),e.prev=39,v=i?"reconnected":"joinRoom",e.next=43,this._dataChannelSignal.sendSignaling(v,a);case 43:return m=e.sent,wG.print("join","send join message success"),this._authorization=a.Authorization,this.connectionState="connected",Qj.audioStallConfig=null===(s=m.config)||void 0===s?void 0:s.engine_WEB,this._pubConfig.audioRed=!(null===(u=m.config)||void 0===u||null===(c=u.engine_WEB)||void 0===c||!c.pub_audio_red),this._subConfig.muteReplaceUnsub=!(null===(d=m.config)||void 0===d||!d.mute_replace_unsub),this._pubConfig.simulcastOnDemand=!(!1===(null===(l=m.config)||void 0===l||null===(h=l.engine_VPM)||void 0===h||null===(f=h.ondemand)||void 0===f?void 0:f.enable)),null===(p=this._context)||void 0===p||p.audioProfileManager.updateEngineBAC(null===(_=m.config)||void 0===_?void 0:_.engine_BAC),e.abrupt("return",m);case 55:if(e.prev=55,e.t18=e.catch(39),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 lD(cD.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 lD(cD.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,[[39,55]])}))),function(e){return I.apply(this,arguments)})},{key:"publish",value:(T=s(regeneratorRuntime.mark((function e(t){var r,n,o,a,s,u,c,d,l,h,f,p,_,v,m,g,y,S;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return wG.print("publish()","localStream: %o",t),r=t.videoTrack,n=t.audioTrack,o=RP(),a="",s="",e.prev=6,e.next=9,null===(u=this._handler)||void 0===u?void 0:u.publish(t,this._pubConfig);case 9:if(m=e.sent){e.next=12;break}throw new lD(cD.ADD_TRANSCEIVER_FAILED,"add transceiver failed");case 12:return a=m.audioMid,s=m.videoMid,t.pubAttributes={localaudio:!!n,localvideo:!!r,videostream:t.pubVideo,audiostream:t.pubAudio,extvideo:!!(r instanceof xj),extaudio:!!(n instanceof Nj)},g={attributes:i({videoDescriptions:m.videoDescriptions},t.pubAttributes),audio:!0,video:!0,screen:t.isScreen,audioMid:a,videoMid:s,sdpInfo:{msid:t.stream.id,type:m.type,sdp:m.partialSdp,semantics:m.semantics}},t.enableSimulcast&&this._pubConfig.simulcastOnDemand&&(g.attributes.subVideoDescriptions=m.subVideoDescriptions),e.next=19,null===(c=this._dataChannelSignal)||void 0===c?void 0:c.sendSignaling("publish",g);case 19:if(200===(null==(y=e.sent)?void 0:y.code)){e.next=22;break}throw new lD(cD.PUBLISH_FAILED,(null==y?void 0:y.message)||"publish failed");case 22:return GV.rtcRecvAnswer(0,EV.INCRANSWER,(null==y||null===(d=y.relayMessage)||void 0===d?void 0:d.sequenceId)||0,null==y||null===(l=y.relayMessage)||void 0===l?void 0:l.sdp,kV.UP,"",""),e.next=25,null===(h=this._handler)||void 0===h?void 0:h.handleAck({action:lG.publish,streamId:y.streamId,audioMid:a,videoMid:s,transceiverInit:m.transceiverInit,signalingAck:{audioMid:null==y||null===(f=y.relayMessage)||void 0===f?void 0:f.audioMid,videoMid:null==y||null===(p=y.relayMessage)||void 0===p?void 0:p.videoMid,sdp:null==y||null===(_=y.relayMessage)||void 0===_?void 0:_.sdp,sequenceId:null==y||null===(v=y.relayMessage)||void 0===v?void 0:v.sequenceId},stream:t});case 25:return t.streamId=y.streamId,t.videoMid=s,t.audioMid=a,t.subVideoDescriptions=m.subVideoDescriptions,this.monitor.rtcPublishStat(RV.SUCCESS,TV.W_0,o,IV.UNKNOWN),t.statsReport.setLocalStreamStatsEvtInterval(this,this._handler,this.monitor),e.abrupt("return");case 34:return e.prev=34,e.t0=e.catch(6),e.t0 instanceof Error&&this.monitor.rtcPublishStat(RV.FAIL,TV.W_0,o,e.t0.message),e.next=39,null===(S=this._handler)||void 0===S?void 0:S.rollback(t.stream.id,t);case 39:throw e.t0;case 40:case"end":return e.stop()}}),e,this,[[6,34]])}))),function(e){return T.apply(this,arguments)})},{key:"updatePubTrack",value:(R=s(regeneratorRuntime.mark((function e(t){var r,n,i,o,a,s,u,c,d,l,h,f,p,_,v,m,g,y,S,E,k,R,T,I,A,w,C,O,x,N,D,P;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(wG.print("updatePubTrack()","localStream: %o",t),i=t.videoTrack,o=t.audioTrack,a=t.pubAudio,s=t.pubVideo,u=null==o?void 0:o.getTrack(),c=null==i?void 0:i.getTrack(),s&&c?null===(d=t.videoTransceiver)||void 0===d||d.sender.replaceTrack(c):null===(l=t.videoTransceiver)||void 0===l||l.sender.replaceTrack(null),null===(r=this._handler)||void 0===r||r.updateScaleResolutionDownBy(t),a&&u?(f=o.mixType,p=o.mixedAudioTrack,_=o.gainAudioTrack,p&&f!==$.PLAYOUT&&!0===u.enabled?u=p:_&&"safari"!==CP()&&(u=_),null===(h=t.audioTransceiver)||void 0===h||h.sender.replaceTrack(u)):null===(v=t.audioTransceiver)||void 0===v||v.sender.replaceTrack(null),m={localaudio:!!o,localvideo:!!i,videostream:s,audiostream:a,extvideo:!!(i instanceof xj),extaudio:!!(o instanceof Nj)},g={},y=0,S=Object.entries(m);y<S.length;y++)E=b(S[y],2),k=E[0],(R=E[1])!==Reflect.get(t.pubAttributes,k)&&Reflect.set(g,k,R);if(Object.keys(g).length){e.next=12;break}return e.abrupt("return");case 12:return t.observer&&(T=t.observer,I=g.audiostream,A=g.videostream,w=g.localaudio,C=g.localvideo,O=g.extaudio,x=g.extvideo,void 0!==C?void 0!==x?T.setPushVideo(x):T.setEnableVideo(C):void 0!==A&&T.setUnmuteVideo(A),void 0!==w?void 0!==O?T.setPushAudio(O):T.setEnableAudio(w):void 0!==I&&T.setUnmuteAudio(I)),t.pubAttributes=m,N={roomId:this._roomId,streamId:t.streamId,attributes:g},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 lD(cD.UPDATE_TRACK_FAILED,(null==D?void 0:D.message)||"update track failed");case 20:if(!OP){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 R.apply(this,arguments)})},{key:"updateToken",value:(k=s(regeneratorRuntime.mark((function e(t){var r,n,i,o,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(wG.print("updateToken()","newToken: %o",t),this._token=t,this._appId&&null!==(r=this._userInfo)&&void 0!==r&&r.userId&&this._roomId){e.next=4;break}return e.abrupt("return");case 4:return i={roomId:this._roomId,userId:null===(n=this._userInfo)||void 0===n?void 0:n.userId,appId:this._appId,token:"Bearer ".concat(t)},e.prev=5,e.next=8,null===(o=this._dataChannelSignal)||void 0===o?void 0:o.sendSignaling("updateToken",i);case 8:if(200===(null==(a=e.sent)?void 0:a.code)){e.next=11;break}throw new lD(cD.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 lD(cD.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 k.apply(this,arguments)})},{key:"unpublish",value:(E=s(regeneratorRuntime.mark((function e(t){var r,n,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return wG.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:lG.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 E.apply(this,arguments)})},{key:"subscribe",value:(S=s(regeneratorRuntime.mark((function e(t,r,n){var i=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise(function(){var e=s(regeneratorRuntime.mark((function e(o,a){var s,u,c,d,h,f,p,_,v,m,g,y,S,b,E,k,R,T,I,A,w,C,O,x,N,D,P,M,U,L,V,F,B,j,G,H,z,K;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.streamState!==aG.SUB_ED){e.next=2;break}return e.abrupt("return",i._updateSubTrack(t,r,iG.SUB,n).then(o,a));case 2:if(t.streamState!==aG.SUB_ING){e.next=7;break}return i._subStreamQueue[t.streamId]||(i._subStreamQueue[t.streamId]=[]),wG.print("_subStreamQueue","streamId: %o, enqueue",t.streamId),i._subStreamQueue[t.streamId].push({fn:i.subscribe,args:[t,r,n],resolve:o,reject:a}),e.abrupt("return");case 7:if(wG.print("subscribe()","mediaType: %o",r),xG("subscribe()",t),t.streamState=aG.SUB_ING,s=!1,u=!1,VP(r)&&(u=!0),FP(r)&&(s=!0),s||!i._multiChatMode()){e.next=17;break}return t.streamState=aG.INIT,i.emit("SUB_END",t.streamId),e.abrupt("return",o(null));case 17:if(c=RP(),d=t.audioMid,h=t.videoMid,p=t.paused,_=t.subVideo,e.prev=22,!d||!h){e.next=29;break}return e.next=26,null===(N=i._handler)||void 0===N?void 0:N.subscribe(t,{audioMid:d,videoMid:h});case 26:f=e.sent,e.next=36;break;case 29:return e.next=31,null===(D=i._handler)||void 0===D?void 0:D.subscribe(t);case 31:if(f=e.sent){e.next=34;break}throw new lD(cD.ADD_TRANSCEIVER_FAILED,"add transceiver failed");case 34:d=f.audioMid,h=f.videoMid;case 36:return t.paused=!s,t.subVideo=s,P={spatialLayer:(null==n?void 0:n.spatialLayer)||0,temporalLayer:0,spatialSubLayer:(null==n?void 0:n.spatialSubLayer)||-1},M={audio:!i._multiChatMode(),video:!0,data:!0,screen:t.isScreen,browser:"chrome-stable",videoMid:(null===(v=f)||void 0===v?void 0:v.autosubVideoMid)||h,audioMid:(null===(m=f)||void 0===m?void 0:m.autosubAudioMid)||d,sdpInfo:{sdp:null===(g=f)||void 0===g?void 0:g.partialSdp,semantics:null===(y=f)||void 0===y?void 0:y.semantics,type:null===(S=f)||void 0===S?void 0:S.type},streamUserId:t.userId,streamId:t.streamId,config:{enableMediaType:{audio:!!i._multiChatMode()||u,video:s},qualityLayer:P}},e.next=42,null===(b=i._dataChannelSignal)||void 0===b?void 0:b.sendSignaling("subscribe",M);case 42:if(200===(null==(U=e.sent)?void 0:U.code)){e.next=45;break}throw new lD(cD.SUBSCRIBE_FAILED,(null==U?void 0:U.message)||"subscribe failed");case 45:return L=[],V=!i._multiChatMode(),F=!t.videoTrack,i._subResolves[t.streamId]||(i._subResolves[t.streamId]=[]),F&&L.push(new Promise((function(e,r){i._subResolves[t.streamId].push(e);var n=setTimeout((function(){return r(new lD(cD.TIME_OUT,"wait video timeout for userId: ".concat(t.userId)))}),CG);t.on("ontrack",(function r(i){"video"===i.mediaType&&(wG.print("remoteStream ".concat(t.userId," received video track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),V&&L.push(new Promise((function(e,r){i._subResolves[t.streamId].push(e);var n=setTimeout((function(){return r(new lD(cD.TIME_OUT,"wait audio timeout for userId: ".concat(t.userId)))}),CG);t.on("ontrack",(function r(i){"audio"===i.mediaType&&(wG.print("remoteStream ".concat(t.userId," received audio track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),B=function(e){t.ontrack(e)},null===(E=i._handler)||void 0===E||E.on("ontrack",B),i._ontrackCallbackMap.set(t,B),j=null==U?void 0:U.relayMessage,G=j.audioMid,H=j.videoMid,l(k={},d,G),l(k,h,H),z=k,wG.print("sub midmap",t.userId,z),OP?(t.videoMid=h,t.audioMid=d):(t.videoMid=H,t.audioMid=G),t._workaround_1_=!1,t.subMediaType=r,t.streamState=aG.SUB_ED,t.subLayer=P,GV.rtcRecvAnswer(0,EV.INCRANSWER,(null==U||null===(R=U.relayMessage)||void 0===R?void 0:R.sequenceId)||0,null==U||null===(T=U.relayMessage)||void 0===T?void 0:T.sdp,kV.DOWN,t.streamId,t.userId),e.next=65,null===(I=i._handler)||void 0===I?void 0:I.handleAck({action:lG.subscribe,streamId:t.streamId,audioMid:d,videoMid:h,transceiverInit:null===(A=f)||void 0===A?void 0:A.transceiverInit,signalingAck:{audioMid:null==U||null===(w=U.relayMessage)||void 0===w?void 0:w.audioMid,videoMid:null==U||null===(C=U.relayMessage)||void 0===C?void 0:C.videoMid,sdp:null==U||null===(O=U.relayMessage)||void 0===O?void 0:O.sdp,sequenceId:null==U||null===(x=U.relayMessage)||void 0===x?void 0:x.sequenceId},stream:t});case 65:return e.next=67,Promise.all(L);case 67:i._multiChatMode()||(t.subAudio=u),i.monitor.rtcSubscribeStat(AV.SUCCESS,c,wV.UNKNOWN,t.userId),t.statsReport.setRemoteStreamStatsEvtInterval(i,i._handler,i.monitor),o(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(AV.FAIL,c,e.t0.message,t.userId),t.paused=p,t.subVideo=_,t.streamState=aG.INIT,e.next=82,null===(K=i._handler)||void 0===K?void 0:K.rollback(t.streamId,t);case 82:a(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 S.apply(this,arguments)})},{key:"_handleSubStreamQueue",value:function(e){var t,r=this;if(null!==(t=this._subStreamQueue[e])&&void 0!==t&&t.length){wG.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 wG.print("_subStreamQueue","streamId: %o, END",e)}},{key:"controlMessage",value:(y=s(regeneratorRuntime.mark((function e(t){var r,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return wG.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 y.apply(this,arguments)})},{key:"updateUserAttributes",value:(m=s(regeneratorRuntime.mark((function e(t){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return wG.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 m.apply(this,arguments)})},{key:"updateSubTrack",value:(_=s(regeneratorRuntime.mark((function e(t,r,n,i){return regeneratorRuntime.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:(p=s(regeneratorRuntime.mark((function e(t,r,n,i){var o,a,s,u,c,d,l,h,f;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return wG.print("updateSubTrack()","mediaType: %o, subLayer: %o",r,i),xG("updateSubTrack()",t),s=0,s=n===iG.SUB?t.subMediaType|r:t.subMediaType-(t.subMediaType&r),wG.print("updateSubTrack","prev: %o, direction: %o, mediaType: %o, newMediaType: %o",t.subMediaType,n,r,s),t.subMediaType===s&&wG.print("updateSubTrack","mediaType no change"),u=!1,c=!1,VP(s)&&(c=!0),FP(s)&&(u=!0),d=i||t.subLayer,l={roomId:this._roomId,streamList:[t.streamId],config:{enableMediaType:{video:u,audio:!!this._multiChatMode()||c},qualityLayer:d}},e.next=13,null===(o=this._dataChannelSignal)||void 0===o?void 0:o.sendSignaling("updateSubscribe",l);case 13:if(200===(null==(h=e.sent)?void 0:h.code)){e.next=16;break}throw new lD(cD.UPDATE_TRACK_FAILED,(null==h?void 0:h.message)||"update track failed");case 16:return t.paused=!u,this._multiChatMode()||(null===(f=t.observer)||void 0===f||f.setUnmuteAudio(c),t.subAudio=c),null===(a=t.observer)||void 0===a||a.setUnmuteVideo(u),t.subVideo=u,t.subMediaType=s,t.subLayer=d,e.abrupt("return",t);case 23:case"end":return e.stop()}}),e,this)}))),function(e,t,r,n){return p.apply(this,arguments)})},{key:"subscribe4pushTrack",value:(f=s(regeneratorRuntime.mark((function e(t,r){var n,i,o,a,s,u,c,d,h,f,p,_,v,m,g,y,S,b=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(wG.print("subscribe4pushTrack()","streamInfo: %o",r),xG("subscribe4pushTrack()",t),u=null==r?void 0:r.message,c=u.audioMid,d=u.videoMid,h=u.sequenceId,t.subAudio=!0,!(h<t.sequenceId)){e.next=7;break}return wG.print("subscribe4pushTrack","sequenceId return",h,t.sequenceId),e.abrupt("return");case 7:if(f=t.audioMid,p=t.videoMid,null===(n=t.observer)||void 0===n||n.setPushTrack(!0),!f||!p){e.next=16;break}return e.next=13,null===(v=this._handler)||void 0===v?void 0:v.subscribe(t,{audioMid:f,videoMid:p});case 13:_=e.sent,e.next=23;break;case 16:return e.next=18,null===(m=this._handler)||void 0===m?void 0:m.subscribe(t);case 18:if(_=e.sent){e.next=21;break}throw new lD(cD.ADD_TRANSCEIVER_FAILED,"add transceiver failed");case 21:f=_.audioMid,p=_.videoMid;case 23:return l(i={},f,c),l(i,p,d),g=i,wG.print("onpushtrack midmap",t.userId,g),OP?(t.audioMid=f,t.videoMid=p):(t.audioMid=c,t.videoMid=d),t.autosubAudioMid=c,t.autosubVideoMid=d,t.sequenceId=h,this._subResolves[t.streamId]||(this._subResolves[t.streamId]=[]),y=[],t.audioTrack||y.push(new Promise((function(e,r){b._subResolves[t.streamId].push(e);var n=setTimeout((function(){return r(new lD(cD.TIME_OUT,"wait audio timeout for userId: ".concat(t.userId)))}),CG);t.on("ontrack",(function r(i){"audio"===i.mediaType&&(wG.print("remoteStream ".concat(t.userId," received audio track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),S=function(e){t.ontrack(e)},null===(o=this._handler)||void 0===o||o.on("ontrack",S),this._ontrackCallbackMap.set(t,S),e.next=37,null===(a=this._handler)||void 0===a?void 0:a.handleAck({action:lG.pushtrack,streamId:t.streamId,audioMid:f,videoMid:p,stream:t,transceiverInit:null===(s=_)||void 0===s?void 0:s.transceiverInit,signalingAck:null==r?void 0:r.message});case 37:return e.next=39,Promise.all(y);case 39:t.statsReport.setRemoteStreamStatsEvtInterval(this,this._handler,this.monitor);case 40:case"end":return e.stop()}}),e,this)}))),function(e,t){return f.apply(this,arguments)})},{key:"unsubscribe4removeTrack",value:(c=s(regeneratorRuntime.mark((function e(t,r){var n,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(xG("unsubscribe4removeTrack()",t),wG.print("unsubscribe4removeTrack()","sequenceId: ",r.sequenceId),!(r.sequenceId<t.sequenceId)){e.next=5;break}return wG.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,wG.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:lG.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)})),wG.print("clean unsubscribe4removeTrack"),t.clean(),t.resetHasSubscribed(),t.statsReport.unsubscribe();case 18:case"end":return e.stop()}}),e,this)}))),function(e,t){return c.apply(this,arguments)})},{key:"unsubscribe",value:(a=s(regeneratorRuntime.mark((function e(t,r){var n,i,o,a,s,u,c,d,l=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=l.length>2&&void 0!==l[2]&&l[2],xG("unsubscribe()",t),a=t.subMediaType-(t.subMediaType&r),o||!this._subConfig.muteReplaceUnsub&&a===Fj.NONE){e.next=5;break}return e.abrupt("return",this._updateSubTrack(t,r,iG.UNSUB));case 5:if(s={roomId:this._roomId,streamId:t.streamId,userId:t.userId},null===(n=this._dataChannelSignal)||void 0===n||n.sendSignaling("unsubscribe",s),t.streamState=aG.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===(u=t.observer)||void 0===u||u.setSubscribeAudio(!1),e.next=17,null===(c=this._handler)||void 0===c?void 0:c.handleAck({action:lG.unsubscribe,streamId:t.streamId,audioMid:t.audioMid,videoMid:t.videoMid,stream:t});case 17:d=e.sent,this._subResolves[d]&&this._subResolves[d].forEach((function(e){return e(0)})),wG.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 a.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:(o=s(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(xG("handleRemoveStream()",t),t.subVideo=!1,r.message&&r.message!==SF.videoMuted?t._workaround_1_=!1:t._workaround_1_=!0,t.hasSubscribed){e.next=5;break}return e.abrupt("return");case 5:this.unsubscribe(t,U.AUDIO_AND_VIDEO,!0);case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return o.apply(this,arguments)})},{key:"leave",value:(n=s(regeneratorRuntime.mark((function e(){var t,r,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(wG.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 lD(cD.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=s(regeneratorRuntime.mark((function e(t){var r,n,i,o,a,s,u,c,d,l,h,f,p,_,v,m,g,y=this;return regeneratorRuntime.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(a=e.sent){e.next=5;break}throw new lD(cD.ADD_TRANSCEIVER_FAILED,"add transceiver failed");case 5:return s=RP(),u=a.audioMid,c=a.videoMid,d={appId:this._appId,streamId:t.streamId,audio:!0,video:!0,data:!0,audioMid:u,videoMid:c,sdpInfo:{sdp:null==a?void 0:a.partialSdp,semantics:null==a?void 0:a.semantics,type:null==a?void 0:a.type},config:{enableMediaType:{audio:!0,video:!0},qualityLayer:{spatialLayer:0,temporalLayer:0}}},e.next=11,null===(n=this._dataChannelSignal)||void 0===n?void 0:n.sendSignaling("startPullStream",d);case 11:return l=e.sent,h=[],this._subResolves[t.streamId]=[],h.push(new Promise((function(e,r){y._subResolves[t.streamId].push(e);var n=setTimeout((function(){return r(new lD(cD.TIME_OUT,"wait video timeout for streamId: ".concat(t.streamId)))}),CG);t.on("ontrack",(function r(i){"video"===i.mediaType&&(wG.print("remoteStream ".concat(t.userId," received video track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),h.push(new Promise((function(e,r){y._subResolves[t.streamId].push(e);var n=setTimeout((function(){return r(new lD(cD.TIME_OUT,"wait audio timeout for streamId: ".concat(t.streamId)))}),CG);t.on("ontrack",(function r(i){"audio"===i.mediaType&&(wG.print("remoteStream ".concat(t.userId," received audio track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),f=function(e){t.ontrack(e)},null===(i=this._handler)||void 0===i||i.on("ontrack",f),this._ontrackCallbackMap.set(t,f),p=null==l?void 0:l.relayMessage,_=p.audioMid,v=p.videoMid,m=p.sequenceId,g=p.sdp,t.videoMid=v,t.audioMid=_,t.sequenceId=m,t._workaround_1_=!1,t.paused=!1,t.streamState=aG.SUB_ED,t.subAudio=!0,t.subVideo=!0,e.next=30,null===(o=this._handler)||void 0===o?void 0:o.handleAck({action:lG.subscribe,streamId:t.streamId,audioMid:u,videoMid:c,transceiverInit:null==a?void 0:a.transceiverInit,signalingAck:{audioMid:_,videoMid:v,sdp:g,sequenceId:m},stream:t});case 30:return e.next=32,Promise.all(h);case 32:this.monitor.rtcSubscribeStat(AV.SUCCESS,s,wV.UNKNOWN,t.userId),t.statsReport.setRemoteStreamStatsEvtInterval(this,this._handler,this.monitor);case 34:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"unsubscribePublicStream",value:(t=s(regeneratorRuntime.mark((function e(t){var r,n,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return xG("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=aG.INIT,t.subVideo=!1,t.subAudio=!1,e.next=14,null===(r=this._handler)||void 0===r?void 0:r.handleAck({action:lG.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;wG.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}}]),C}(fM);function DG(e,t,r){var n=r.value;return r.value=s(regeneratorRuntime.mark((function e(){var r,i,o,a=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._handler||"connected"!==this._state){e.next=6;break}for(r=a.length,i=new Array(r),o=0;o<r;o++)i[o]=a[o];return e.next=4,n.apply(this,i);case 4:e.next=7;break;case 6:throw new lD(cD.NOT_CONNECTED_YET,"error in ".concat(t,": try again after joined"));case 7:case"end":return e.stop()}}),e,this)}))),r}function PG(e,t,r){var n=r.value;return r.value=s(regeneratorRuntime.mark((function e(){var t,r,i,o,a=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._pubSubLock.lock();case 2:for(t=e.sent,this.supportConcurrent&&t(),e.prev=4,r=a.length,i=new Array(r),o=0;o<r;o++)i[o]=a[o];return e.next=8,n.apply(this,i);case 8:return e.abrupt("return",e.sent);case 9:return e.prev=9,this.supportConcurrent||t(),e.finish(9);case 12:case"end":return e.stop()}}),e,this,[[4,,9,12]])}))),r}AG([function(e,t,r){var n=r.value;return r.value=s(regeneratorRuntime.mark((function e(){var t,r,i,o,a=this,u=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(t=u.length,r=new Array(t),i=0;i<t;i++)r[i]=u[i];return o=!1,e.abrupt("return",new Promise(function(){var e=s(regeneratorRuntime.mark((function e(t,i){var s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a.on("INTERRUPT",(function(){o=!0,i(new lD(cD.OPERATION_CANCEL,"operation not finish when leave"))})),e.prev=1,e.next=4,n.apply(a,r);case 4:s=e.sent,t(s),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(1),o||i(e.t0);case 11:case"end":return e.stop()}}),e,null,[[1,8]])})));return function(t,r){return e.apply(this,arguments)}}()));case 3:case"end":return e.stop()}}),e)}))),r}],NG.prototype,"join",1),AG([PG,DG],NG.prototype,"publish",1),AG([PG,DG],NG.prototype,"updatePubTrack",1),AG([PG,DG],NG.prototype,"unpublish",1),AG([PG,DG],NG.prototype,"subscribe",1),AG([DG],NG.prototype,"controlMessage",1),AG([DG],NG.prototype,"updateUserAttributes",1),AG([DG],NG.prototype,"updateSubTrack",1),AG([PG,DG],NG.prototype,"subscribe4pushTrack",1),AG([PG,DG],NG.prototype,"unsubscribe4removeTrack",1),AG([PG,DG],NG.prototype,"unsubscribe",1),AG([DG],NG.prototype,"handleRemoveStream",1),AG([PG],NG.prototype,"subscribePublicStream",1),AG([PG],NG.prototype,"unsubscribePublicStream",1);var MG,UG=function(){function e(t,r){u(this,e),l(this,"_audioEventSessionId",NP()),l(this,"_videoEventSessionId",NP()),l(this,"_handler",void 0),l(this,"_stream",void 0),l(this,"_firstAudioFrameTimer",void 0),l(this,"_firstVideoFrameTimer",void 0),l(this,"_transportDelayInterval",void 0),l(this,"_transportDelay",void 0),l(this,"_firstVideoFrameInterval",void 0),l(this,"_firstAudioFrameInterval",void 0),l(this,"_isScreen",!1),l(this,"_audioFirstFrameState",0),l(this,"_videoFirstFrameState",0),l(this,"_timeout",1e4),l(this,"_currentAudioRecv",{startTime:0,eventSessionId:0,type:NV.LOGIN}),l(this,"_currentVideoRecv",{startTime:0,eventSessionId:0,type:NV.LOGIN}),l(this,"_login",!1),l(this,"_unMuteAudio",!1),l(this,"_enableAudio",!1),l(this,"_unMuteVideo",!1),l(this,"_enableVideo",!1),l(this,"_remoteUnmuteAudio",!1),l(this,"_remoteUnmuteVideo",!1),l(this,"_audioExternal",!1),l(this,"_pushAudio",!1),l(this,"_videoExternal",!1),l(this,"_pushVideo",!1),l(this,"_autoSubscribeVideo",!1),l(this,"_autoSubscribeAudio",!1),l(this,"_autoSubscribe",!1),l(this,"_publishVideo",!1),l(this,"_publishAudio",!1),l(this,"_subscribeAudio",!1),l(this,"_subscribeVideo",!1),l(this,"_subscribe",!1),l(this,"_pushTrack",!1),l(this,"_multiChatMode",!1),this._stream=t,this._handler=r,this.getTransportDelay()}var t,r,n,i;return d(e,[{key:"beginRecvFrame",value:(i=s(regeneratorRuntime.mark((function e(t,r){var n,i,o,a,s,u,c,d,l,h,f,p,_,v=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getTransportDelay();case 2:n=this._transportDelay,i=!0,o=NV.LOGIN,a=NV.UNMUTE,s=NV.SUBSCRIBE,u=NV.PUSH_TRACK,[o,a,s,u].indexOf(r)>=0&&(n=0,i=!1),t===xV.AUDIO?(i||this._audioEventSessionId++,this._currentAudioRecv={startTime:Date.now(),eventSessionId:this._audioEventSessionId,type:r},l={media_type:t,event_type:OV.BEGIN_RECV,type:r,start:null===(c=this._currentAudioRecv)||void 0===c?void 0:c.startTime,event_session_id:this._audioEventSessionId,stream_user_id:null===(d=this._stream)||void 0===d?void 0:d.userId,transport_delay:n},this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),this._firstAudioFrameTimer=window.setTimeout((function(){v.stopRecvFrame(xV.AUDIO,DV.TIMEOUT),v._firstAudioFrameInterval&&window.clearInterval(v._firstAudioFrameInterval)}),this._timeout),GV.rtcFirstFrame(l),this._watchForFirstAudioFrameRecv(),this._audioFirstFrameState=1,this._login=!0,this._unMuteAudio=!0,this._enableAudio=!0,this._remoteUnmuteAudio=!0):t===xV.VIDEO&&(i||this._videoEventSessionId++,this._currentVideoRecv={startTime:Date.now(),eventSessionId:this._videoEventSessionId,type:r},_={media_type:null!==(h=this._stream)&&void 0!==h&&h.isScreen?xV.SCREEN_VIDEO:t,event_type:OV.BEGIN_RECV,type:r,start:null===(f=this._currentVideoRecv)||void 0===f?void 0:f.startTime,event_session_id:this._videoEventSessionId,stream_user_id:null===(p=this._stream)||void 0===p?void 0:p.userId,transport_delay:n},this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),this._firstVideoFrameTimer=window.setTimeout((function(){v.stopRecvFrame(xV.VIDEO,DV.TIMEOUT),v._firstVideoFrameInterval&&window.clearInterval(v._firstVideoFrameInterval)}),this._timeout),this._watchForFirstVideoFrameRecv(),GV.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===xV.AUDIO){var r,n,i;if(1!==this._audioFirstFrameState)return;var o={event_type:OV.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,GV.rtcFirstFrame(o),this._audioFirstFrameState=2}else if(e===xV.VIDEO){var a,s,u,c;if(1!==this._videoFirstFrameState)return;var d={event_type:OV.RECV_END,media_type:null!==(a=this._stream)&&void 0!==a&&a.isScreen?xV.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,GV.rtcFirstFrame(d),this._videoFirstFrameState=2}}},{key:"recvFrameFinish",value:(n=s(regeneratorRuntime.mark((function e(t){var r,n,i,o,a,s,u,c,d,l,h,f,p,_,v,m;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getTransportDelay();case 2:if(r=this._transportDelay,n=NV.LOGIN,i=NV.UNMUTE,o=NV.SUBSCRIBE,a=NV.PUSH_TRACK,t!==xV.AUDIO){e.next=18;break}if(1===this._audioFirstFrameState){e.next=7;break}return e.abrupt("return");case 7:if(this._currentAudioRecv){e.next=9;break}return e.abrupt("return");case 9:u=this._currentAudioRecv,c=u.type,d=u.startTime,[n,i,o,a].indexOf(c)>=0&&(r=0),l={event_type:OV.RECV_END,media_type:t,start:d,result:!0,stream_user_id:null===(s=this._stream)||void 0===s?void 0:s.userId,event_session_id:this._audioEventSessionId,type:c,transport_delay:r},delete this._currentAudioRecv,this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),GV.rtcFirstFrame(l),this._audioFirstFrameState=3,e.next=30;break;case 18:if(t!==xV.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:p=this._currentVideoRecv,_=p.type,v=p.startTime,[n,i,o,a].indexOf(_)>=0&&(r=0),m={event_type:OV.RECV_END,media_type:null!==(h=this._stream)&&void 0!==h&&h.isScreen?xV.SCREEN_VIDEO:t,start:v,result:!0,stream_user_id:null===(f=this._stream)||void 0===f?void 0:f.userId,event_session_id:this._videoEventSessionId,type:_,transport_delay:r},delete this._currentVideoRecv,this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),GV.rtcFirstFrame(m),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(xV.AUDIO,NV.LOGIN),e&&null!==(r=this._stream)&&void 0!==r&&r.hasVideo&&o.video&&this.beginRecvFrame(xV.VIDEO,NV.LOGIN),!e&&null!==(n=this._stream)&&void 0!==n&&n.hasAudio&&this.stopRecvFrame(xV.AUDIO,DV.LEAVE_ROOM),!e&&null!==(i=this._stream)&&void 0!==i&&i.hasVideo&&this.stopRecvFrame(xV.VIDEO,DV.LEAVE_ROOM))}},{key:"setUnmuteAudio",value:function(e){var t;this._unMuteAudio!==e&&(this._unMuteAudio=e,this._unMuteAudio?this.beginRecvFrame(xV.AUDIO,NV.UNMUTE):null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(xV.AUDIO,DV.MUTE))}},{key:"setRemoteUnmuteAudio",value:function(e){var t;this._remoteUnmuteAudio!==e&&(this._remoteUnmuteAudio=e,this._remoteUnmuteAudio?this.beginRecvFrame(xV.AUDIO,NV.REMOTE_UNMUTE):null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(xV.AUDIO,DV.REMOTE_MUTE))}},{key:"setEnableAudio",value:function(e){var t;this._enableAudio!==e&&(this._enableAudio=e,this._enableAudio?this.beginRecvFrame(xV.AUDIO,NV.ENABLE):null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(xV.AUDIO,DV.DISABLE))}},{key:"setUnmuteVideo",value:function(e){var t;this._unMuteVideo!==e&&(this._unMuteVideo=e,this._unMuteVideo?this.beginRecvFrame(xV.VIDEO,NV.UNMUTE):null!==(t=this._stream)&&void 0!==t&&t.hasVideo&&this.stopRecvFrame(xV.VIDEO,DV.MUTE))}},{key:"setRemoteUnmuteVideo",value:function(e){var t;this._remoteUnmuteVideo!==e&&(this._remoteUnmuteVideo=e,this._remoteUnmuteVideo?this.beginRecvFrame(xV.VIDEO,NV.REMOTE_UNMUTE):null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(xV.VIDEO,DV.REMOTE_MUTE))}},{key:"setEnableVideo",value:function(e){this._enableVideo!==e&&(this._enableVideo=e,this._enableVideo?this.beginRecvFrame(xV.VIDEO,NV.ENABLE):this.stopRecvFrame(xV.VIDEO,DV.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(xV.AUDIO,NV.PUSH),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.beginRecvFrame(xV.AUDIO,NV.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(xV.VIDEO,NV.PUSH),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasVideo&&this.beginRecvFrame(xV.VIDEO,NV.PUSH)}},{key:"setPublishVideo",value:function(e){var t;this._publishVideo!==e&&(this._publishVideo=e),this._publishVideo&&this.beginRecvFrame(xV.VIDEO,NV.PUBLISH),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasVideo&&this.stopRecvFrame(xV.VIDEO,DV.UNPUBLISH)}},{key:"setPublishAudio",value:function(e){var t;this._publishAudio!==e&&(this._publishAudio=e),this._publishAudio&&this.beginRecvFrame(xV.AUDIO,NV.PUBLISH),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(xV.AUDIO,DV.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(xV.AUDIO,NV.SUBSCRIBE));!e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(xV.AUDIO,DV.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(xV.VIDEO,NV.SUBSCRIBE));!e&&null!==(t=this._stream)&&void 0!==t&&t.hasVideo&&this.stopRecvFrame(xV.VIDEO,DV.UNSUBSCRIBE)}},{key:"setPushTrack",value:function(e){var t;this._pushTrack!==e&&(e&&!this._isScreen&&this.beginRecvFrame(xV.AUDIO,NV.PUSH_TRACK),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(xV.AUDIO,DV.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(s(regeneratorRuntime.mark((function n(){var i,o,a,s,u,c,d,l;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(null===(i=e._handler)||void 0===i||!i.pc||null===(o=e._stream)||void 0===o||null===(a=o.videoTrack)||void 0===a||!a.getTrack()){n.next=12;break}return n.next=3,QF(null===(s=e._handler)||void 0===s?void 0:s.pc,null===(u=e._stream)||void 0===u||null===(c=u.videoTrack)||void 0===c?void 0:c.getTrack());case 3:if(d=n.sent,!(l=d.find((function(e){return"inbound-rtp"===e.type})))||!(l.framesReceived>t||l.packetsReceived>r)){n.next=12;break}if(-1!==t||-1!==r){n.next=10;break}return t=l.framesReceived,r=l.packetsReceived,n.abrupt("return");case 10:e.recvFrameFinish(xV.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(s(regeneratorRuntime.mark((function n(){var i,o,a,s,u,c,d,l;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(null===(i=e._handler)||void 0===i||!i.pc||null===(o=e._stream)||void 0===o||null===(a=o.audioTrack)||void 0===a||!a.getTrack()){n.next=12;break}return n.next=3,QF(null===(s=e._handler)||void 0===s?void 0:s.pc,null===(u=e._stream)||void 0===u||null===(c=u.audioTrack)||void 0===c?void 0:c.getTrack());case 3:if(d=n.sent,!(l=d.find((function(e){return"inbound-rtp"===e.type})))||!(l.totalSamplesReceived>t||l.packetsReceived>r)){n.next=12;break}if(-1!==t||-1!==r){n.next=10;break}return t=l.totalSamplesReceived,r=l.packetsReceived,n.abrupt("return");case 10:e.recvFrameFinish(xV.AUDIO),window.clearInterval(e._firstAudioFrameInterval);case 12:case"end":return n.stop()}}),n)}))),200)}},{key:"getTransportDelay",value:(r=s(regeneratorRuntime.mark((function e(){var t=this;return regeneratorRuntime.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(s(regeneratorRuntime.mark((function e(){return regeneratorRuntime.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=s(regeneratorRuntime.mark((function e(){var t,r,n,i,o;return regeneratorRuntime.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,QF(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})),(o=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*o.currentRoundTripTime/2));case 7:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"reset",value:function(){this._currentAudioRecv={startTime:0,eventSessionId:0,type:NV.LOGIN},this._currentVideoRecv={startTime:0,eventSessionId:0,type:NV.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}(),LG=function(){function e(t,r){u(this,e),l(this,"_audioEventSessionId",NP()),l(this,"_videoEventSessionId",NP()),l(this,"_pcSessionId",void 0),l(this,"_handler",void 0),l(this,"_firstAudioFrameTimer",void 0),l(this,"_firstVideoFrameTimer",void 0),l(this,"_stream",void 0),l(this,"_firstVideoFrameInterval",void 0),l(this,"_firstAudioFrameInterval",void 0),l(this,"_currentAudioSend",{startTime:0,eventSessionId:0,type:NV.LOGIN}),l(this,"_currentVideoSend",{startTime:0,eventSessionId:0,type:NV.LOGIN}),l(this,"_login",!1),l(this,"_publisher",!1),l(this,"_unMuteAudio",!1),l(this,"_enableAudio",!1),l(this,"_unMuteVideo",!1),l(this,"_enableVideo",!1),l(this,"_audioExternal",!1),l(this,"_pushAudio",!1),l(this,"_videoExternal",!1),l(this,"_pushVideo",!1),l(this,"_autoPublish",!1),l(this,"_publish",!1),l(this,"_timeout",1e4),l(this,"_audioFirstFrameState",0),l(this,"_videoFirstFrameState",0),this._stream=t,this._handler=r}var t,r;return d(e,[{key:"beginSendFrame",value:function(e,t){var r=this;if(e===xV.AUDIO){var n;this._audioEventSessionId++,this._currentAudioSend={startTime:Date.now(),eventSessionId:this._audioEventSessionId,type:t};var i={media_type:e,event_type:OV.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(xV.AUDIO,DV.TIMEOUT),r._firstAudioFrameInterval&&window.clearInterval(r._firstAudioFrameInterval)}),this._timeout),GV.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===xV.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?xV.SCREEN_VIDEO:e,event_type:OV.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(xV.VIDEO,DV.TIMEOUT),r._firstVideoFrameInterval&&window.clearInterval(r._firstVideoFrameInterval)}),this._timeout),this._watchForFirstVideoFrameSend(),GV.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===xV.AUDIO){var r,n;if(1!==this._audioFirstFrameState)return;var i={event_type:OV.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,GV.rtcFirstFrame(i),this._audioFirstFrameState=2}else if(e===xV.VIDEO){var o,a,s;if(1!==this._videoFirstFrameState)return;var u={event_type:OV.SENT_END,media_type:null!==(o=this._stream)&&void 0!==o&&o.isScreen?xV.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,GV.rtcFirstFrame(u),this._videoFirstFrameState=2}}},{key:"sendFrameFinish",value:function(e){if(e===xV.AUDIO){if(1!==this._audioFirstFrameState)return;if(!this._currentAudioSend)return;var t=this._currentAudioSend,r=t.type,n=t.startTime,i={event_type:OV.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),GV.rtcFirstFrame(i),this._audioFirstFrameState=3}else if(e===xV.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:OV.SENT_END,media_type:null!==(o=this._stream)&&void 0!==o&&o.isScreen?xV.SCREEN_VIDEO:e,start:u,result:!0,event_session_id:this._videoEventSessionId,type:s};delete this._currentVideoSend,this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),GV.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(xV.VIDEO,NV.LOGIN),null!==(r=this._stream)&&void 0!==r&&r.audioTrack&&this.beginSendFrame(xV.AUDIO,NV.LOGIN);!e&&this._audioSending&&this.stopSendFrame(xV.AUDIO,DV.LEAVE_ROOM),!e&&this._videoSending&&this.stopSendFrame(xV.VIDEO,DV.LEAVE_ROOM)}}},{key:"setPublish",value:function(e){if(this._publish!==e){var t,r;if(this._publish=e,e)(null===(t=this._stream)||void 0===t?void 0:t.videoTrack)&&this.beginSendFrame(xV.VIDEO,NV.PUBLISH),(null===(r=this._stream)||void 0===r?void 0:r.audioTrack)&&this.beginSendFrame(xV.AUDIO,NV.PUBLISH);!e&&this._audioSending&&this.stopSendFrame(xV.AUDIO,DV.UNPUBLISH),!e&&this._videoSending&&this.stopSendFrame(xV.VIDEO,DV.UNPUBLISH)}}},{key:"setUnmuteAudio",value:function(e){this._unMuteAudio!==e&&(this._unMuteAudio=e,e&&this.beginSendFrame(xV.AUDIO,NV.UNMUTE),!e&&this._audioSending&&this.stopSendFrame(xV.AUDIO,DV.MUTE))}},{key:"setEnableAudio",value:function(e){this._enableAudio!==e&&(this._enableAudio=e,e&&this.beginSendFrame(xV.AUDIO,NV.ENABLE),!e&&this._audioSending&&this.stopSendFrame(xV.AUDIO,DV.DISABLE))}},{key:"setUnmuteVideo",value:function(e){this._unMuteVideo!==e&&(this._unMuteVideo=e,e&&this.beginSendFrame(xV.VIDEO,NV.UNMUTE),!e&&this._videoSending&&this.stopSendFrame(xV.VIDEO,DV.MUTE))}},{key:"setEnableVideo",value:function(e){this._enableVideo!==e&&(this._enableVideo=e,e&&this.beginSendFrame(xV.VIDEO,NV.ENABLE),!e&&this._videoSending&&this.stopSendFrame(xV.VIDEO,DV.DISABLE))}},{key:"setExternalAudioSource",value:function(e){this._audioExternal!==e&&(this._audioExternal=e,e&&(this._audioSending&&this.stopSendFrame(xV.AUDIO,DV.DISABLE),this._enableAudio=!1),e||(this._audioSending&&this.stopSendFrame(xV.AUDIO,DV.STOP_PUSH),this._pushAudio=!1))}},{key:"setPushAudio",value:function(e){this._pushAudio!==e&&(this._pushAudio=e,e&&this.beginSendFrame(xV.AUDIO,NV.PUSH),!e&&this._audioSending&&this.stopSendFrame(xV.AUDIO,DV.STOP_PUSH))}},{key:"setExternalVideoSource",value:function(e){this._videoExternal!==e&&(this._videoExternal=e,e&&(this._videoSending&&this.stopSendFrame(xV.VIDEO,DV.DISABLE),this._enableVideo=!1),e||(this._videoSending&&this.stopSendFrame(xV.VIDEO,DV.STOP_PUSH),this._pushVideo=!1))}},{key:"setPushVideo",value:function(e){this._pushVideo!==e&&(this._pushVideo=e,e&&this.beginSendFrame(xV.VIDEO,NV.PUSH),!e&&this._videoSending&&this.stopSendFrame(xV.VIDEO,DV.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(xV.AUDIO,DV.AUDIENCE),!e&&this._videoSending&&this.stopSendFrame(xV.VIDEO,DV.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=s(regeneratorRuntime.mark((function e(){var t,r,n,i,o,a,s,u;return regeneratorRuntime.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()){e.next=6;break}return e.next=3,QF(null===(i=this._handler)||void 0===i?void 0:i.pc,null===(o=this._stream)||void 0===o||null===(a=o.videoTrack)||void 0===a?void 0:a.getTrack());case 3:return s=e.sent,u=s.find((function(e){return"outbound-rtp"===e.type})),e.abrupt("return",u);case 6:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"_getFirstAudioFrameStats",value:(t=s(regeneratorRuntime.mark((function e(){var t,r,n,i,o,a,s,u;return regeneratorRuntime.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.getPublishTrack()){e.next=6;break}return e.next=3,QF(null===(i=this._handler)||void 0===i?void 0:i.pc,null===(o=this._stream)||void 0===o||null===(a=o.audioTrack)||void 0===a?void 0:a.getPublishTrack());case 3:return s=e.sent,u=s.find((function(e){return"outbound-rtp"===e.type})),e.abrupt("return",u);case 6:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"_watchForFirstVideoFrameSend",value:function(){var e=this,t=-1,r=-1;this._firstVideoFrameInterval=window.setInterval(s(regeneratorRuntime.mark((function n(){var i;return regeneratorRuntime.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(xV.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(s(regeneratorRuntime.mark((function r(){var n;return regeneratorRuntime.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(xV.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:NV.LOGIN},this._currentVideoSend={startTime:0,eventSessionId:0,type:NV.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}(),VG=(l(MG={},"audio",{delay:1200,stallRadio:.3}),l(MG,"video",{delay:1200,stallRadio:.6}),l(MG,"screen_audio",{delay:1600,stallRadio:.8}),l(MG,"screen_video",{delay:1600,stallRadio:.8}),MG),FG=function(){function e(){u(this,e),l(this,"_preUplinkStats",new Map),l(this,"_preDownlinkStats",new Map),l(this,"_timer",void 0),l(this,"_delayTimer",void 0),l(this,"_connectionState",OG.CONNECTED),l(this,"reportor",void 0)}return d(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(E(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 _=this._getQosLevel(h,l||0,p||0),v=this._preUplinkStats.get(d)||[_];this._preUplinkStats.set(d,[].concat(E(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&&s.rtt)if(0===s.receivedKBitrate)r=W.VBAD;else{var l=s.rtt,h=s.audioLossRate,f=s.stallDuration,p=s.statsInterval,_=s.e2eDelay,v=f/p,m=c?"screen_audio":"audio",g=this._getQosLevel(l,h||0,u._retransmittedRate||0),y=this._getDownlinkQoE(m,v,_);r=this._getNetworkQuality(g,y)}if(a)if(0===u.receivedKBitrate||0===u.rtt)n=W.VBAD;else{var S=u.rtt,b=u.videoLossRate,k=u.stallDuration,R=u.statsInterval,T=u.e2eDelay,I=u._retransmittedRate,A=k/R,w=c?"screen_video":"video",C=this._getQosLevel(S,b||0,I||0),O=this._getDownlinkQoE(w,A,T);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(E(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!==OG.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}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<=250&&t<=.15?1:e<=500&&t<=.3?2:e<=750&&t<=.45?3: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=VG[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,E(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&&VP(t)&&r.localaudio&&r.audiostream,videoActive:n&&FP(t)&&r.localvideo&&r.videostream}}}]),e}(),BG=function(){function e(t){u(this,e),l(this,"_timer",void 0),l(this,"_remoteVideoSizeCache",{}),l(this,"_remoteScreenSizeCache",{}),l(this,"onchange",void 0),this._room=t,this._start()}return d(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,_=void 0===p?0:p,v=f.height,m=void 0===v?0:v;h===m&&d===_||e.onchange&&e.onchange(i,n.isScreen,_,m),delete s[i],(n.isScreen?r:t)[i]={width:_,height:m}}}))})),Object.keys(e._remoteVideoSizeCache).forEach((function(t){e.onchange&&e.onchange(t,!1,0,0)})),Object.keys(e._remoteScreenSizeCache).forEach((function(t){e.onchange&&e.onchange(t,!0,0,0)})),e._remoteVideoSizeCache=t,e._remoteScreenSizeCache=r}),1e3))}}]),e}(),jG=new lM("SubscribeFallbackManager",2),GG=1e4,HG=function(){function e(t){u(this,e),l(this,"_preDownlinkNetworkQuality",[]),l(this,"_isSubscribeFallbackOrRecover",!1),l(this,"_inSubscribeRecoverChecking",!1),l(this,"_subRecoverCheckTimer",void 0),l(this,"_forbidSubRecover",!1),l(this,"_forbidSubRecoverTimer",void 0),l(this,"_forbidSubRecoverDuration",GG),l(this,"onSubscribeFallback",void 0),this._room=t}var t;return d(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=s(regeneratorRuntime.mark((function e(t){var r,n,i,o,a,s,u,c,d,l,h=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._isSubscribeFallbackOrRecover&&this._room.connectionState===OG.CONNECTED){e.next=2;break}return e.abrupt("return");case 2:if(this._room.subscribeFallbackOption!==z.AUDIO_ONLY&&this._room.subscribeFallbackOption!==z.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(h._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(jG.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)||[],o=b(i,1),!(a=o[0])){e.next=24;break}return s=a.stream,u=a.fallbackOrRecoverOption,this._isSubscribeFallbackOrRecover=!0,c=s.subLayer.spatialLayer,d=s.subVideo,jG.print("_subscribeFallbackOrRecover()","".concat(s.userId,"'s stream will be ").concat(t," to: MediaType=").concat(u[0]," subState=").concat(u[1]," subLayer=").concat(u[2])),e.prev=15,e.next=18,UP([(l=this._room).updateSubTrack.apply(l,[s].concat(E(u))).then((function(){"recover"===t?h._startSubscribeRecoverCheck():jG.print("_subscribeFallbackOrRecover()","fallback success."),h.onSubscribeFallback&&h.onSubscribeFallback({userId:s.userId,isScreen:s.isScreen,beforeEnable:d,beforeVideoIndex:c,afterEnable:s.subVideo,afterVideoIndex:s.subLayer.spatialLayer,reason:"fallback"===t?X.SubscribeFallbackByBandwidth:X.SubscribeRecoverByBandwidth})})),wP(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=GG,delete e._subRecoverCheckTimer,jG.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),jG.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}(),zG=new lM("Room",1),KG=function(e){h(P,e);var t,r,n,o,a,c,f,p,_,m,y,S,E,k,R,I,A,C,O,x,D=g(P);function P(e,t){var r;return u(this,P),l(v(r=D.call(this)),"_mediaServerClient",void 0),l(v(r),"_localStream",void 0),l(v(r),"_localScreenStream",void 0),l(v(r),"_remoteUsers",new Map),l(v(r),"_remoteStreams",new Map),l(v(r),"_joinResolveCallback",void 0),l(v(r),"_joinRejectCallback",void 0),l(v(r),"_getAccessNode",void 0),l(v(r),"_getAccessFeedback",void 0),l(v(r),"_getAccessFeedbackIceNode",void 0),l(v(r),"_reconnectTimer",void 0),l(v(r),"_isReconnecting",void 0),l(v(r),"_context",void 0),l(v(r),"_sessionId",void 0),l(v(r),"_reconnectRecord",void 0),l(v(r),"_connectionLostTimer",void 0),l(v(r),"_liveControlMessage",void 0),l(v(r),"_serverConfig",void 0),l(v(r),"_roomConfig",void 0),l(v(r),"_roomInfo",void 0),l(v(r),"_waitForNewToken",!1),l(v(r),"_userDuplicateLoginTimerMap",new Map),l(v(r),"_networkQualityManager",void 0),l(v(r),"userPriorityMap",void 0),l(v(r),"subscribeFallbackOption",void 0),l(v(r),"_videoSizeObserver",void 0),l(v(r),"_subFallbackManager",void 0),l(v(r),"_hasPublished",!1),r._roomConfig=e,r._mediaServerClient=new NG(t),r._reconnectRecord=new WG,r._addHandlerEventHandler(),r._isReconnecting=!1,r._networkQualityManager=new FG,r._networkQualityManager.reportor=r._reportNetworkQuality.bind(v(r)),r._videoSizeObserver=new BG(v(r)),r._videoSizeObserver.onchange=r._emitVideoSizeChange.bind(v(r)),r._subFallbackManager=new HG(v(r)),r._subFallbackManager.onSubscribeFallback=r._emitSubscribeFallback.bind(v(r)),r._context=t,r}return d(P,[{key:"hasScreenPublished",get:function(){var e;return null===(e=this._localScreenStream)||void 0===e?void 0:e.hasPublished}},{key:"hasPublished",get:function(){var e;return null===(e=this._localStream)||void 0===e?void 0:e.hasPublished}},{key:"connectionState",get:function(){return this._mediaServerClient.connectionState}},{key:"remoteUsers",get:function(){return this._remoteUsers}},{key:"remoteStreams",get:function(){return this._remoteStreams}},{key:"localStream",get:function(){return this._localStream}},{key:"localScreenStream",get:function(){return this._localScreenStream}},{key:"roomInfo",get:function(){return this._roomInfo}},{key:"_addHandlerEventHandler",value:function(){var e,t,r,n,i,o,a,s,u,c,d,l,h,f,p,_,v,m,g,y,S,b,E,k,R=this;null===(e=this._mediaServerClient)||void 0===e||e.on(EF.ON_ADD_STREAM,this._onAddStream.bind(this)),null===(t=this._mediaServerClient)||void 0===t||t.on(EF.ON_REMOVE_STREAM,this._onRemoveStream.bind(this)),null===(r=this._mediaServerClient)||void 0===r||r.on(EF.USER_CONNECTION,this._onUserConnection.bind(this)),null===(n=this._mediaServerClient)||void 0===n||n.on(EF.USER_DISCONNECTION,this._onUserDisconnection.bind(this)),null===(i=this._mediaServerClient)||void 0===i||i.on(EF.ON_UPDATE_ROOM_ATTRIBUTES,this._onUpdateRoomAttributes.bind(this)),null===(o=this._mediaServerClient)||void 0===o||o.on(EF.ON_UPDATE_USER_ATTRIBUTES,this._onUpdateUserAttributes.bind(this)),null===(a=this._mediaServerClient)||void 0===a||a.on(EF.ON_UPDATE_STREAM_ATTRIBUTES,this._onUpdateStreamAttributes.bind(this)),null===(s=this._mediaServerClient)||void 0===s||s.on(EF.ON_PUSH_TRACK,this._onPushTrack.bind(this)),null===(u=this._mediaServerClient)||void 0===u||u.on(EF.ON_REMOVE_TRACK,this._onRemoveTrack.bind(this)),null===(c=this._mediaServerClient)||void 0===c||c.on(EF.NODE_CHANGE,this._nodeChange.bind(this)),null===(d=this._mediaServerClient)||void 0===d||d.on(EF.ON_CUSTOM_MESSAGE,this._onCustomMessage.bind(this)),null===(l=this._mediaServerClient)||void 0===l||l.on(EF.USER_MESSAGE_RECEIVED,this._onUserMessageReceived.bind(this)),null===(h=this._mediaServerClient)||void 0===h||h.on(EF.USER_BINARY_MESSAGE_RECEIVED,this._onUserBinaryMessageReceived.bind(this)),null===(f=this._mediaServerClient)||void 0===f||f.on(EF.POST_PROCESSING_MESSAGE,this._onPostProcessingMessage.bind(this)),null===(p=this._mediaServerClient)||void 0===p||p.on(EF.ON_USER_TOKEN_WILL_EXPIRE,this._onUserTokenWillExpire.bind(this)),null===(_=this._mediaServerClient)||void 0===_||_.on(EF.STREAM_CONTROL_MESSAGE,this._onStreamControlMessage.bind(this)),null===(v=this._mediaServerClient)||void 0===v||v.on(EF.ON_SCENE_CONFIG,this._onSceneConfig.bind(this)),null===(m=this._mediaServerClient)||void 0===m||m.on(kF.RSCP,this._onPublishOnDemand.bind(this)),null===(g=this._mediaServerClient)||void 0===g||g.on(RF.ON_CONNECTION_STATE_CHANGE,this._onConnectionStateChange.bind(this)),null===(y=this._mediaServerClient)||void 0===y||y.on(RF.ABNORMAL_DISCONNECTION,this._handleAbnormalDisconnection.bind(this)),null===(S=this._mediaServerClient)||void 0===S||S.on("onRemoteStreamStats",(function(e){R._networkQualityManager.updateDownlinkStats(e,R._findRemoteStreamByScreen(e.userId,e.isScreen)),R.emit(tG.ON_REMOTE_STREAM_STATS,BP(e))})),null===(b=this._mediaServerClient)||void 0===b||b.on("onLocalStreamStats",(function(e){R._networkQualityManager.updateUplinkStats(e),R.emit(tG.ON_LOCAL_STREAM_STATS,BP(e))})),null===(E=this._mediaServerClient)||void 0===E||E.on("prevIceNode",(function(e){R._getAccessFeedbackIceNode=e})),null===(k=this._mediaServerClient)||void 0===k||k.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:(x=s(regeneratorRuntime.mark((function e(t,r,n,i,o,a){var s=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return KV.setStats({rtc_app_id:t,room_id:r,user_id:i.userId}),zG.print("join()"),e.abrupt("return",new Promise((function(e,u){var c;s._joinResolveCallback=function(t){var r;GV.joinRoom(MV.END,d,!0,"",{enable_cloud_proxy:null===(r=s._roomInfo)||void 0===r?void 0:r.useCloudProxy}),e(t)},s._joinRejectCallback=function(e){var t;GV.joinRoom(MV.END,d,!1,e.message,{enable_cloud_proxy:null===(t=s._roomInfo)||void 0===t?void 0:t.useCloudProxy}),u(e)},s._liveControlMessage=o,s._roomInfo={appId:t,roomId:r,token:n,userInfo:i,useCloudProxy:a,roomProfile:s._roomConfig.roomProfileType};var d=RP();s.setSessionId(),GV.joinRoom(MV.BEGIN,d,!1,"",{enable_cloud_proxy:null===(c=s._roomInfo)||void 0===c?void 0:c.useCloudProxy}),s._join(s._joinResolveCallback,s._joinRejectCallback,!1)})));case 3:case"end":return e.stop()}}),e)}))),function(e,t,r,n,i,o){return x.apply(this,arguments)})},{key:"_join",value:(O=s(regeneratorRuntime.mark((function e(t,r){var n,i,o,a=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=a.length>2&&void 0!==a[2]&&a[2],i=RP(),zG.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:o=e.sent,this._mediaServerClient.roomAttributes=o.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:o.clients,streams:o.streams}),this._isReconnecting=!1,GV.rtcJoinRoom(0,"web","web",RP()-i),this._onJoinSucc(o,n),e.next=23;break;case 19:if(e.prev=19,e.t0=e.catch(3),e.t0.code===cD.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 O.apply(this,arguments)})},{key:"publishScreen",value:(C=s(regeneratorRuntime.mark((function e(t,r,n,i,o){var a,s,u,c,d,l,h,f,p,_;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(zG.print("publishScreen()"),this._localScreenStream||(this._localScreenStream=new sG,this._localScreenStream.isScreen=!0,this._mediaServerClient.handler&&(this._localScreenStream.observer=new LG(this._localScreenStream,this._mediaServerClient.handler))),a=!1,s=!1,u=!1,c=!1,!this._localScreenStream.videoTrack&&r?(r instanceof xj&&(s=!0),a=!0):this._localScreenStream.videoTrack&&!r&&(a=!1),!this._localScreenStream.audioTrack&&n?(n instanceof Nj&&(c=!0),u=!0):this._localScreenStream.audioTrack&&!n&&(u=!1),this._localScreenStream.videoTrack=r,this._localScreenStream.audioTrack=n,this._localScreenStream.videoEncodeConfig=t,i&&(VP(i)&&(this._localScreenStream.pubAudio=o===nG.PUB),FP(i)&&(this._localScreenStream.pubVideo=o===nG.PUB),zG.print("publishScreen mediaType","pubAudio: %o, pubVideo: %o",this._localScreenStream.pubAudio,this._localScreenStream.pubVideo)),this._localScreenStream.pubAudio||this._localScreenStream.pubVideo){e.next=18;break}if(null===(d=this._localScreenStream)||void 0===d||!d.hasPublished){e.next=17;break}return e.abrupt("return",this.unpublishScreen());case 17:return e.abrupt("return");case 18:if(this._localScreenStream.hasPublished){e.next=24;break}return null===(l=this._localScreenStream.observer)||void 0===l||l.setPublish(!0),e.next=22,this._mediaServerClient.publish(this._localScreenStream);case 22:e.next=28;break;case 24:return s?null===(h=this._localScreenStream.observer)||void 0===h||h.setPushVideo(a):null===(f=this._localScreenStream.observer)||void 0===f||f.setEnableVideo(a),c?null===(p=this._localScreenStream.observer)||void 0===p||p.setPushAudio(u):null===(_=this._localScreenStream.observer)||void 0===_||_.setEnableAudio(u),e.next=28,this.updatePubScreenTrack();case 28:case"end":return e.stop()}}),e,this)}))),function(e,t,r,n,i){return C.apply(this,arguments)})},{key:"updatePubScreenTrack",value:(A=s(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(zG.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 A.apply(this,arguments)})},{key:"unpublishScreen",value:(I=s(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(zG.print("unpublish","Invoke unpublishScreen"),!this._localScreenStream){e.next=7;break}return null===(t=this._localScreenStream.observer)||void 0===t||t.setPublish(!1),e.next=5,this._mediaServerClient.unpublish(this._localScreenStream);case 5:this._localScreenStream.clean(),this._localScreenStream=void 0;case 7:case"end":return e.stop()}}),e,this)}))),function(){return I.apply(this,arguments)})},{key:"liveControlMessage",value:(R=s(regeneratorRuntime.mark((function e(t){var r,n=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return zG.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 R.apply(this,arguments)})},{key:"publicStreamControlMessage",value:(k=s(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"stopped"===t.action&&delete t.publicStreamMeta,e.next=3,this._mediaServerClient.controlMessage(t);case 3:case"end":return e.stop()}}),e,this)}))),function(e){return k.apply(this,arguments)})},{key:"updateUserAttributes",value:(E=s(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return zG.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 E.apply(this,arguments)})},{key:"publish",value:(S=s(regeneratorRuntime.mark((function e(t,r,n,i,o,a){var s,u,c,d,l,h,f,p,_,v,m,g,y=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s=y.length>6&&void 0!==y[6]&&y[6],zG.print("publish","Invoke publish"),u=!1,this._localStream||(this._localStream=new sG,this._mediaServerClient.handler&&(this._localStream.observer=new LG(this._localStream,this._mediaServerClient.handler)),u=!0),this._localStream.videoTrack=n,this._localStream.audioTrack=i,this._localStream.videoEncodeConfig=t,this._localStream.enableSimulcast=r,o&&(VP(o)&&(this._localStream.pubAudio=a===nG.PUB),FP(o)&&(this._localStream.pubVideo=a===nG.PUB),zG.print("publish mediaType","pubAudio: %o, pubVideo: %o",this._localStream.pubAudio,this._localStream.pubVideo)),this._localStream.hasPublished){e.next=26;break}if(this._localStream.pubAudio||this._localStream.pubVideo){e.next=12;break}return e.abrupt("return");case 12:return e.prev=12,s?null===(c=this._localStream.observer)||void 0===c||c.setLogin(!0):u&&(d=!!this._localStream.videoTrack,l=!!this._localStream.audioTrack,h=this._localStream.videoTrack instanceof xj,f=this._localStream.audioTrack instanceof Nj,this._roomConfig.isAutoPublish&&!this._hasPublished?(d&&(h?null===(p=this._localStream.observer)||void 0===p||p.setPushVideo(!0):null===(_=this._localStream.observer)||void 0===_||_.setEnableVideo(!0)),l&&(f?null===(v=this._localStream.observer)||void 0===v||v.setPushAudio(!0):null===(m=this._localStream.observer)||void 0===m||m.setEnableAudio(!0))):null===(g=this._localStream.observer)||void 0===g||g.setPublish(!0)),e.next=16,this._mediaServerClient.publish(this._localStream);case 16:this._hasPublished=!0,this.emit(tG.ON_PUBLISH_RESULT,{isScreen:!1,state:N.PUBLISH_SUCC}),e.next=24;break;case 20:throw e.prev=20,e.t0=e.catch(12),this.emit(tG.ON_PUBLISH_RESULT,{isScreen:!1,state:N.PUBLISH_FAIL}),e.t0;case 24:e.next=28;break;case 26:return e.next=28,this.updatePubTrack();case 28:case"end":return e.stop()}}),e,this,[[12,20]])}))),function(e,t,r,n,i,o){return S.apply(this,arguments)})},{key:"updatePubTrack",value:(y=s(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(zG.print("updatePubTrack","Invoke updatePubTrack"),!this._localStream){e.next=4;break}return e.next=4,this._mediaServerClient.updatePubTrack(this._localStream);case 4:case"end":return e.stop()}}),e,this)}))),function(){return y.apply(this,arguments)})},{key:"unpublish",value:(m=s(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(zG.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 m.apply(this,arguments)})},{key:"subscribe",value:(_=s(regeneratorRuntime.mark((function e(t,r,n){var i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return zG.print("subscribe","remoteStream %o",t),i=void 0,n&&(i=this._getSubLayer(n,t)),e.next=5,this._mediaServerClient.subscribe(t,r,i);case 5:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return _.apply(this,arguments)})},{key:"updateSubTrack",value:(p=s(regeneratorRuntime.mark((function e(t,r,n,i){var o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return zG.print("updateSubTrack","Invoke updateSubTrack"),e.abrupt("return",null===(o=this._mediaServerClient)||void 0===o?void 0:o.updateSubTrack(t,r,n,i));case 2:case"end":return e.stop()}}),e,this)}))),function(e,t,r,n){return p.apply(this,arguments)})},{key:"updateSubVideoConfig",value:(f=s(regeneratorRuntime.mark((function e(t,r){var n,i,o,a,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((a=this._findRemoteStreamByScreen(t,!1))&&a.hasSubscribed&&!((null==a||null===(n=a.attributes)||void 0===n||null===(i=n.videoDescriptions)||void 0===i?void 0:i.length)<=1)){e.next=3;break}return e.abrupt("return");case 3:return s=this._getSubLayer(r,a),a.originalStreamIndex=s.spatialLayer,e.abrupt("return",null===(o=this._mediaServerClient)||void 0===o?void 0:o.updateSubTrack(a,a.subMediaType,iG.SUB,s));case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return f.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,_;if(h>=(null===(p=d[f])||void 0===p?void 0:p.width)*(null===(_=d[f])||void 0===_?void 0:_.height)){l=f;break}}var v=d[0];if(-1===l)v=d[l=d.length-1];else if(0!==l){var m=d[l-1].width*d[l-1].height,g=(m-h)/(m-d[l].width*d[l].height);v=g<.1?d[l-1]:d[l],l=g<.1?l-1:l}return a=null!==(r=null===(n=v)||void 0===n?void 0:n.sub_index)&&void 0!==r?r:-1,{spatialLayer:null!==(i=null===(o=v)||void 0===o?void 0:o.video_index)&&void 0!==i?i:l,spatialSubLayer:a}}},{key:"unsubscribe",value:(c=s(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return zG.print("unsubscribe","Invoke unsubscribe"),e.next=3,this._mediaServerClient.unsubscribe(t,r);case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return c.apply(this,arguments)})},{key:"leave",value:(a=s(regeneratorRuntime.mark((function e(){var t,r,n,i,o,a,s=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=s.length>0&&void 0!==s[0]&&s[0],zG.print("leave","Invoke leave"),r=RP(),e.prev=3,clearTimeout(this._reconnectTimer),n=T(this._remoteStreams.values());try{for(n.s();!(i=n.n()).done;)o=i.value,Array.isArray(o)&&o.forEach((function(e){var t;null===(t=e.observer)||void 0===t||t.setLogin(!1)}))}catch(LU){n.e(LU)}finally{n.f()}return this._localStream&&(null===(a=this._localStream.observer)||void 0===a||a.setLogin(!1)),e.next=10,this._mediaServerClient.leave();case 10:this.destroy(),GV.rtcLeaveRoom(0,"",RP()-r),e.next=23;break;case 14:if(e.prev=14,e.t0=e.catch(3),e.t0 instanceof lD&&e.t0.code===cD.NOT_CONNECTED_YET&&this._joinRejectCallback&&this._joinRejectCallback(new Error(UV.LEAVE_ROOM)),!t){e.next=21;break}throw e.t0;case 21:this.destroy();case 22:e.t0 instanceof Error&&GV.rtcLeaveRoom(-1,e.t0.message,RP()-r);case 23:case"end":return e.stop()}}),e,this,[[3,14]])}))),function(){return a.apply(this,arguments)})},{key:"setRemoteUserPriority",value:function(e,t){var r,n;null===(r=this.remoteStreams.get(e))||void 0===r||r.forEach((function(e){return e.setRemoteUserPriority(t)})),null===(n=this.userPriorityMap)||void 0===n||n.set(e,t)}},{key:"destroy",value:function(){zG.print("destroy","Invoke destroy"),this._destroyAndInitMediaServerClient(),this._roomInfo=void 0,this._remoteUsers=new Map;var e,t,r,n=T(this._remoteStreams);try{for(n.s();!(e=n.n()).done;){var i=b(e.value,2)[1];Array.isArray(i)&&i.forEach((function(e){e&&e.clean()}))}}catch(LU){n.e(LU)}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 WG,this._removeHandlerEventHandler(),clearTimeout(this._connectionLostTimer),this._userDuplicateLoginTimerMap.forEach((function(e){clearTimeout(e)})),this._userDuplicateLoginTimerMap.clear(),this._networkQualityManager.destroy(),this._videoSizeObserver.destroy(),this._subFallbackManager.destroy()}},{key:"updateToken",value:(o=s(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return zG.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 o.apply(this,arguments)})},{key:"pauseAllSubscribedStream",value:(n=s(regeneratorRuntime.mark((function e(t){var r,n,i,o,a=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=[],n=T(this._remoteStreams.values());try{for(n.s();!(i=n.n()).done;)o=i.value,Array.isArray(o)&&o.forEach((function(e){if(e.hasSubscribed){var n=a.updateSubTrack(e,t,iG.UNSUB);n&&r.push(n)}}))}catch(LU){n.e(LU)}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:"resumeAllSubscribedStream",value:(r=s(regeneratorRuntime.mark((function e(t){var r,n,i,o,a=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=[],n=T(this._remoteStreams.values());try{for(n.s();!(i=n.n()).done;)o=i.value,Array.isArray(o)&&o.forEach((function(e){if(e.hasSubscribed&&e.hasSubscribed){var n=a.updateSubTrack(e,t,iG.SUB);n&&r.push(n)}}))}catch(LU){n.e(LU)}finally{n.f()}return e.abrupt("return",Promise.all(r));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return r.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(),KV.setStats({rtc_session_id:this._sessionId})}},{key:"sendRoomMessage",value:(t=s(regeneratorRuntime.mark((function e(t){var r,n,i,o,a=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=a.length>1&&void 0!==a[1]&&a[1],o={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,AP.ab2b64str(t);case 5:o.message=e.sent,e.next=9;break;case 8:o.message=t;case 9:return e.abrupt("return",null===(n=this._mediaServerClient)||void 0===n?void 0:n.sendRoomMessage(o));case 10:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"_destroyAndInitMediaServerClient",value:function(){zG.print("_destroyAndInitMediaServerClient()"),this._mediaServerClient&&(this._mediaServerClient.destroy(),this._removeHandlerEventHandler()),this._mediaServerClient=new NG(this._context),this._addHandlerEventHandler()}},{key:"_onJoinSucc",value:function(e,t){var r,n=this;zG.print("JoinSuccess()"),this._serverConfig=e.config;var i=[],o=[],a=[],s=[];null===(r=e.clientsDetail)||void 0===r||r.forEach((function(t){if(t.attributes&&(t.attributes.serverMuteVideo&&n.safeEmit(tG.ON_VIDEO_STREAM_BANNED,{uid:t.clientId,banned:1===t.attributes.serverMuteVideo}),t.attributes.serverMuteAudio&&n.safeEmit(tG.ON_AUDIO_STREAM_BANNED,{uid:t.clientId,banned:1===t.attributes.serverMuteAudio})),t.clientId!==e.clientId){var r=n._remoteUsers.get(t.clientId);r?r._stillExist=!0:i.push(t)}}));var u,c=T(this._remoteUsers.values());try{for(c.s();!(u=c.n()).done;){var d=u.value;d._stillExist||o.push({clientId:d.userId}),delete d._stillExist}}catch(LU){c.e(LU)}finally{c.f()}e.streams.forEach((function(e){var t=n._findRemoteStreamByScreen(e.clientId,e.screen);t?(t.stillExist=!0,t.streamId=e.streamId):s.push(e)}));var l,h=T(this._remoteStreams.values());try{for(h.s();!(l=h.n()).done;){var f=l.value;Array.isArray(f)&&f.forEach((function(e){e.stillExist?delete e.stillExist:a.push({clientId:e.userId,streamId:e.streamId,message:SF.clientDisconnected})}))}}catch(LU){h.e(LU)}finally{h.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)})),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=T(this._remoteStreams.values());try{for(r.s();!(t=r.n()).done;){var n=t.value;Array.isArray(n)&&n.forEach(function(){var t=s(regeneratorRuntime.mark((function t(r){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!r.hasSubscribed){t.next=15;break}return r.resetHasSubscribed(),t.prev=2,zG.print("start resubscribe ".concat(r.userId," with ").concat(r.subMediaType)),t.next=6,e._mediaServerClient.subscribe(r,r.subMediaType);case 6:zG.print("success resubscribe ".concat(r.userId," with ").concat(r.subMediaType)),e.safeEmit(tG.RESUBSCRIBE,{stream:r}),t.next=15;break;case 10:t.prev=10,t.t0=t.catch(2),zG.print("failed resubscribe ".concat(r.userId," with ").concat(r.subMediaType,", error:").concat(t.t0)),r.clean(),null==r||r.resetHasSubscribed();case 15:case"end":return t.stop()}}),t,null,[[2,10]])})));return function(e){return t.apply(this,arguments)}}())}}catch(LU){r.e(LU)}finally{r.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._findRemoteStream(e.clientId,e.streamId);if(!i){var o;i=new uG(e.clientId,e.streamId,e.screen,e.attributes,null===(o=this.userPriorityMap)||void 0===o?void 0:o.get(e.clientId)),this._initStreamListeners(i);var a=this._remoteStreams.get(e.clientId);a?a.push(i):this._remoteStreams.set(e.clientId,[i])}if(this._mediaServerClient.handler&&(i.observer=new UG(i,this._mediaServerClient.handler)),!i.isScreen){var s,u,c,d,l,h,f,p;if(n&&i.hasVideo)if(i.attributes.extvideo)null===(s=i.observer)||void 0===s||s.setExternalVideoSource(!0),null===(u=i.observer)||void 0===u||u.setPushVideo(!0);else null===(c=i.observer)||void 0===c||c.setExternalVideoSource(!1),null===(d=i.observer)||void 0===d||d.setPublishVideo(!0);if(n&&i.hasAudio&&!this._mediaServerClient.roomAttributes.multiChatMode)if(i.attributes.extaudio)null===(l=i.observer)||void 0===l||l.setExternalAudioSource(!0),null===(h=i.observer)||void 0===h||h.setPushAudio(!0);else null===(f=i.observer)||void 0===f||f.setExternalAudioSource(!1),null===(p=i.observer)||void 0===p||p.setPublishAudio(!0);if(!0===r&&!1===n){var _,v=this._roomConfig,m=v.isAutoSubscribeAudio,g=v.isAutoSubscribeVideo;null===(_=i.observer)||void 0===_||_.setLogin(!0,{audio:!!m,video:!!g})}}return r&&this.safeEmit(EF.ON_ADD_STREAM,{stream:i}),i}}},{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(EF.USER_CONNECTION,{userInfo:n}),e.attributes&&(e.attributes.serverMuteVideo&&this.safeEmit(tG.ON_VIDEO_STREAM_BANNED,{uid:e.clientId,banned:1===e.attributes.serverMuteVideo}),e.attributes.serverMuteAudio&&this.safeEmit(tG.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===TF.kickedByAdmin?a=cD.KICKED_OUT:i===TF.onUserTokenDidExpire?a=cD.TOKEN_EXPIRED:i===TF.userDuplicateLogin&&(a=cD.DUPLICATE_LOGIN),o===IF.roomDismissByAdmin&&(a=cD.ROOM_DISMISS),a&&this.safeEmit(tG.ON_ROOM_ERROR,{errorCode:a})}else{var s=w.DROPPED;i===TF.userLeave?s=w.QUIT:i===TF.kickedByAdmin?s=w.KICKED_BY_ADMIN:i===TF.roleChanged&&(s=w.SWITCH_TO_INVISIBLE);var u=function(){r._remoteUsers.delete(n),r.safeEmit(tG.ON_USER_LEAVE,{userInfo:{userId:n},reason:s})};if(i===TF.userDuplicateLogin){var c=this._userDuplicateLoginTimerMap.get(n);null!=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(EF.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(tG.ON_VIDEO_STREAM_BANNED,{uid:e.clientId,banned:1===e.attributes.serverMuteVideo}),e.attributes.serverMuteAudio&&this.safeEmit(tG.ON_AUDIO_STREAM_BANNED,{uid:e.clientId,banned:1===e.attributes.serverMuteAudio}))}},{key:"_onUpdateRoomAttributes",value:function(e){e.roomAttributes&&(this._mediaServerClient.roomAttributes=e.roomAttributes)}},{key:"_onUpdateStreamAttributes",value:function(e){var t=e.clientId,r=e.streamId,n=e.attributes,o=this._findRemoteStream(t,r);if(o){var a,s,u=o.attributes,c=i(i({},u),n),d=!1,l=c.localaudio!==u.localaudio,h=!1,f=!1,p=c.localvideo!==u.localvideo,_=!1,v=Fj.NONE,m=Fj.NONE;if(c.audiostream!==u.audiostream&&(d=c.localaudio,h=!!c.audiostream,c.audiostream?v|=U.AUDIO:m|=U.AUDIO),c.videostream!==u.videostream&&(f=c.localvideo,_=!!c.videostream,c.videostream?v|=U.VIDEO:m|=U.VIDEO),v&&this.safeEmit(tG.ON_USER_PUBLISH_STATE_CHANGE,{userId:t,mediaType:v,isScreen:o.isScreen,pubState:nG.PUB,remoteStream:o}),m&&this.safeEmit(tG.ON_USER_PUBLISH_STATE_CHANGE,{userId:t,mediaType:m,isScreen:o.isScreen,pubState:nG.UNPUB,remoteStream:o}),c.localaudio!==u.localaudio)if(c.localaudio){var g,y,S,b;if(c.extaudio)null===(g=o.observer)||void 0===g||g.setExternalAudioSource(!0),null===(y=o.observer)||void 0===y||y.setPushAudio(!0);else null===(S=o.observer)||void 0===S||S.setExternalAudioSource(!1),null===(b=o.observer)||void 0===b||b.setEnableAudio(!0);this.safeEmit(tG.ON_USER_START_AUDIO_CAPTURE,{userId:t})}else{var E,k,R,T;if(c.extaudio)null===(E=o.observer)||void 0===E||E.setExternalAudioSource(!0),null===(k=o.observer)||void 0===k||k.setPushAudio(!1);else null===(R=o.observer)||void 0===R||R.setExternalAudioSource(!1),null===(T=o.observer)||void 0===T||T.setEnableAudio(!1);!o.isScreen&&this.safeEmit(tG.ON_USER_STOP_AUDIO_CAPTURE,{userId:t})}if(c.localvideo!==u.localvideo)if(c.localvideo){var I,A,w,C;if(c.extvideo)null===(I=o.observer)||void 0===I||I.setExternalVideoSource(!0),null===(A=o.observer)||void 0===A||A.setPushVideo(!0);else null===(w=o.observer)||void 0===w||w.setExternalVideoSource(!1),null===(C=o.observer)||void 0===C||C.setEnableVideo(!0);this.safeEmit(tG.ON_USER_START_VIDEO_CAPTURE,{userId:t})}else{var O,x,N,D;if(c.extvideo)null===(O=o.observer)||void 0===O||O.setExternalVideoSource(!0),null===(x=o.observer)||void 0===x||x.setPushVideo(!1);else null===(N=o.observer)||void 0===N||N.setExternalVideoSource(!1),null===(D=o.observer)||void 0===D||D.setEnableVideo(!1);!o.isScreen&&this.safeEmit(tG.ON_USER_STOP_VIDEO_CAPTURE,{userId:t})}if(d&&!l)null===(a=o.observer)||void 0===a||a.setRemoteUnmuteAudio(h);if(f&&!p)null===(s=o.observer)||void 0===s||s.setRemoteUnmuteVideo(_);o.attributes=c}}},{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(tG.SUBSCRIBE_PUSH_TRACK,{stream:i})})).catch((function(e){zG.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(tG.REMOVE_PUSH_TRACK,{stream:o})})).catch((function(e){zG.print("remove push track failed: ".concat(e))}))}},{key:"_nodeChange",value:function(e){var t,r=e.nodes,n=e.reason;aF.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,GV.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=T(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(LU){r.e(LU)}finally{r.f()}GV.rtcReconnect(1002,dV.PEERCONNECTION_RECONNECTING,this._roomInfo.userInfo.userId,lV.PEERCONNECTION),this._join((function(){GV.rtcReconnected(hV.PEERCONNECTION_RECONNECTED,fV.PEERCONNECTION)}),(function(t){e._reconnectRecord.record(t),e._reconnectRecord.shouldReconnect?(zG.print("Reconnecting error, will reconnect after 3s",t),e._reconnectTimer=window.setTimeout(e._reconnect.bind(e),3e3)):(e.safeEmit(tG.RECONNECT_FAILED),e.destroy())}),!0)}},{key:"_handleAbnormalDisconnection",value:function(){zG.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===OG.DISCONNECTED)t=V.CONNECTION_STATE_DISCONNECTED;else if(e.next===OG.CONNECTED)clearTimeout(this._connectionLostTimer),t=this._isReconnecting?V.CONNECTION_STATE_RECONNECTED:V.CONNECTION_STATE_CONNECTED;else{if(e.next!==OG.CONNECTING)return;t=this._isReconnecting?V.CONNECTION_STATE_RECONNECTING:V.CONNECTION_STATE_CONNECTING}e.prev===OG.CONNECTED&&e.next===OG.DISCONNECTED&&(this._connectionLostTimer=window.setTimeout((function(){r.safeEmit(RF.ON_CONNECTION_STATE_CHANGE,{state:V.CONNECTION_STATE_LOST})}),1e4)),this._networkQualityManager.setConnectionState(e.next),this.safeEmit(RF.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(tG.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?M.STREAM_INDEX_SCREEN:M.STREAM_INDEX_MAIN}})}))}},{key:"_onCustomMessage",value:function(e){this.safeEmit(EF.ON_CUSTOM_MESSAGE,e)}},{key:"_onUserMessageReceived",value:function(e){this.safeEmit(EF.USER_MESSAGE_RECEIVED,{userId:e.from,message:e.msg})}},{key:"_onUserBinaryMessageReceived",value:function(e){this.safeEmit(EF.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=rG.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=rG.START_FAILED);break;case"TranscodeStateChanged":n=0!==t.error?rG.START_FAILED:rG.START_SUCCESS;break;case"TranscodeStopped":n=0!==t.error?rG.STOP_FAILED:rG.STOP_SUCCESS;break;case"TranscodeUpdated":n=0!==t.error?rG.UPDATE_FAILED:rG.UPDATE_SUCCESS}this.safeEmit(EF.POST_PROCESSING_MESSAGE,{code:r,protocol:t.protocol,error:t.error,eventType:n,message:i[r]})}this.safeEmit(EF.POST_PROCESSING_MESSAGE,{code:r,message:i[r],type:e.type})}}},{key:"_onUserTokenWillExpire",value:function(){this.safeEmit(EF.ON_USER_TOKEN_WILL_EXPIRE,null)}},{key:"_onSceneConfig",value:function(e){var t=e.multiSceneConfig,r=RG[this._roomConfig.roomProfileType][1];if(t){var n,i,o=t[r];if(o&&o.engine_BAC)null===(n=this._context)||void 0===n||n.audioProfileManager.updateEngineBAC(o.engine_BAC);if(o&&o.engine_ANM)null===(i=this._context)||void 0===i||i.audioProfileManager.updateEngineANM(o.engine_ANM)}}},{key:"_onStreamControlMessage",value:function(e){var t,r;e.type===bF.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,_={};zG.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;_[r]=r}}));var v={};null===(l=this._localStream)||void 0===l||null===(h=l.subVideoDescriptions)||void 0===h||h.forEach((function(e){void 0!==_[e.sub_index]&&(v[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,g=[];d.encodings=d.encodings.map((function(e){return e.rid&&(v[e.rid]?(e.active=!0,e.scaleResolutionDownBy=Math.max(m/v[e.rid].height,1),g.push({type:1,rid:e.rid,downBy:e.scaleResolutionDownBy})):(g.push({type:0,rid:e.rid}),e.active=!1)),e})),GV.rtcInvokeStatus(JSON.stringify(g),0,"rscp",u,0)}c.setParameters(d)}}},{key:"_reportNetworkQuality",value:function(e,t){this._subFallbackManager.updateNetworkQuality(e,t),this.emit(tG.ON_NETWORK_QUALITY,e,t)}},{key:"_emitVideoSizeChange",value:function(e,t,r,n){var i;this.emit(tG.ON_REMOTE_VIDEO_SIZE_CHANGED,{roomId:null===(i=this.roomInfo)||void 0===i?void 0:i.roomId,userId:e,streamIndex:t?M.STREAM_INDEX_SCREEN:M.STREAM_INDEX_MAIN},{width:r,height:n})}},{key:"_emitSubscribeFallback",value:function(e){this.emit(tG.ON_SIMULCAST_SUBSCRIBE_FALLBACK,e)}}]),P}(fM),WG=function(){function e(){u(this,e),l(this,"_all_201_count",void 0),l(this,"_has_4xx",void 0),this._all_201_count=0,this._has_4xx=!1}return d(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}(),XG=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=document.createElement(e);return t.id&&(r.id=t.id),t.classList&&t.classList.forEach((function(e){r.classList.add(e)})),t.style&&Object.assign(r.style,t.style),t.attributes&&Object.entries(t.attributes).forEach((function(e){var t=b(e,2),n=t[0],i=t[1];"muted"===n?r.muted=!0:r.setAttribute(n,i)})),r},YG=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=b(t,2),n=r[0],i=r[1];e.setAttribute(n,i)})),e},qG=new lM("Player",0),JG=["play","playing","pause","ended","error","seeking","seeked","waiting","canplay","canplaythrough","durationchange","volumechange","loadedmetadata","loadeddata","loadstart","timeupdate"],QG={playsinline:"","webkit-playsinline":""},ZG={playsinline:"","webkit-playsinline":"","x5-playsinline":"","x5-video-player-type":"h5","x-webkit-airplay":"allow",preload:"",muted:""},$G=new(function(){function e(){u(this,e),l(this,"videoCache",[]),l(this,"audioCache",[])}return d(e,[{key:"getOrCreate",value:function(e,t){var r="audio"===e?QG:ZG;if("video"===e&&this.videoCache.length>0){var n=this.videoCache.pop();if(n)return YG(n,{style:t,attributes:r}),n}else if("audio"===e&&this.audioCache.length>0){var i=this.audioCache.pop();if(i)return YG(i,{style:t,attributes:r}),i}return XG(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}()),eH=function(e){h(n,e);var t,r=g(n);function n(e){var t;u(this,n),l(v(t=r.call(this)),"_containerDom",void 0),l(v(t),"_videoDom",void 0),l(v(t),"__cumulativeTime",void 0),l(v(t),"userId",void 0),l(v(t),"renderMode",void 0),l(v(t),"mirrorType",F.MIRROR_TYPE_NONE),l(v(t),"isScreen",void 0),l(v(t),"played",!1),l(v(t),"_emitPlayFailed",!1),l(v(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)})),l(v(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,GV.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:P.RENDER_MODE_FIT;var a="string"==typeof i?document.getElementById(i):i;if(!a)throw new lD(cD.CANT_FIND_DOM,"can't find dom");return t._containerDom=a,t.userId=o,t.isScreen=!!e.isScreen,t._initVideo(),t}return d(n,[{key:"_initVideo",value:function(){this._videoDom||(this._videoDom=$G.getOrCreate("video",{width:"100%",height:"100%"}),this._videoDom.id="".concat(this.userId,"_").concat(kP()),this.renderMode===P.RENDER_MODE_FIT?this._videoDom.style.objectFit="contain":this._videoDom.style.objectFit="cover",this.mirror(this.mirrorType===F.MIRROR_TYPE_RENDER)),this._containerDom.appendChild(this._videoDom),this._initListeners()}},{key:"_initListeners",value:function(){var e=this;this._videoDom&&JG.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&&(JG.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(e.isScreen,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=s(regeneratorRuntime.mark((function e(t,r){var n,i,o,a,s=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=this._videoDom,qG.print("playVideo","play video track: ".concat(this.userId)),!(o&&o.srcObject instanceof MediaStream&&o.srcObject.getTrackById(null===(n=t.getTrack())||void 0===n?void 0:n.id))){e.next=4;break}return e.abrupt("return");case 4:o||(this._initVideo(),o=this._videoDom),qG.print("playVideo","play video by dom: ".concat(null===(i=o)||void 0===i?void 0:i.id)),(a=new MediaStream).addTrack(t.getTrack()),o.srcObject=a,o&&!this._containerDom.contains(o)&&this._containerDom.appendChild(o),o.addEventListener("canplay",this._internalPlay),o.addEventListener("loadeddata",this._internalPlay),setTimeout((function(){return s._internalPlay()})),r&&this._recordFrame(r),this.played=!0;case 15:case"end":return e.stop()}}),e,this)}))),function(e,r){return t.apply(this,arguments)})},{key:"updateSrcObject",value:function(e){var t=e.getTrack();if(t&&this._videoDom){var r=new MediaStream;r.addTrack(t),this._videoDom.srcObject=r}}},{key:"manuallyPlay",value:function(){if(qG.print("Invoke VideoPlayer.manuallyPlay"),this._emitPlayFailed=!1,!this._videoDom)throw new lD(cD.INVALID_PARAMS,"Player not found");return this._videoDom.play()}},{key:"mirror",value:function(e){qG.print("mirror","".concat(this.userId," set mirror: ").concat(e)),this.mirrorType=e?F.MIRROR_TYPE_RENDER:F.MIRROR_TYPE_NONE,this._videoDom&&(this._videoDom.style.transform=e?"rotateY(180deg)":"")}},{key:"stop",value:function(){var e=this._containerDom;qG.print("stop","stop video track: ".concat(this.userId)),this._videoDom&&(this._videoDom.srcObject=null,e&&e.contains(this._videoDom)&&e.removeChild(this._videoDom)),this.__cumulativeTime=void 0,this.played=!1}},{key:"destroy",value:function(){qG.print("destroy","video player: ".concat(this.userId)),this.stop(),S(f(n.prototype),"removeAllListeners",this).call(this),this._removeListeners(),this._videoDom&&($G.recycle(this._videoDom),delete this._videoDom)}},{key:"domElement",get:function(){return this._videoDom}}]),n}(aM.exports.EventEmitter),tH=function(e){h(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(u(this,i),l(v(t=n.call(this)),"_containerDom",void 0),l(v(t),"_audioDom",void 0),l(v(t),"_fakeAudioDom",void 0),l(v(t),"userId",void 0),l(v(t),"muted",!1),l(v(t),"_emitPlayFailed",!1),l(v(t),"played",!1),l(v(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)})),l(v(t),"_internalPlay",(function(){var e,r;if(QV("_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(){QV("_internalPlay successfully",{userId:t.userId})}))}catch(i){t._autoPlayError(i)}})),o){var s=document.getElementById(o);if(!s)throw new lD(cD.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 d(i,[{key:"_initAudio",value:function(){this._audioDom||(this._audioDom=$G.getOrCreate("audio",{display:"none"}),this._audioDom.volume=this.muted?0:1,this._audioDom.id="".concat(this.userId,"_").concat(kP()),this._containerDom.appendChild(this._audioDom)),this._initListeners()}},{key:"_initListeners",value:function(){var e=this;this._audioDom&&JG.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&&(JG.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=s(regeneratorRuntime.mark((function e(t){var r,n,i,o,a,s=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(qG.print("playAudio","play audio track: ".concat(this.userId)),!((o=this._audioDom)&&o.srcObject instanceof MediaStream&&o.srcObject.getTrackById(null===(r=t.getTrack())||void 0===r?void 0:r.id))){e.next=4;break}return e.abrupt("return");case 4:o||(this._initAudio(),o=this._audioDom),(a=new MediaStream).addTrack(t.getTrack()),o.srcObject=a,null===(n=o)||void 0===n||n.addEventListener("canplay",this._internalPlay),null===(i=o)||void 0===i||i.addEventListener("loadeddata",this._internalPlay),setTimeout((function(){return s._internalPlay()})),this.played=!0;case 12:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"_autoPlayError",value:function(e){var t,r;this._emitPlayFailed||(this._emitPlayFailed=!0,GV.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(qG.print("Invoke AudioPlayer.manuallyPlay"),this._emitPlayFailed=!1,!this._audioDom)throw new lD(cD.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=s(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return qG.print("setPlaybackDevice","setPlaybackDevice: ".concat(t)),e.next=3,hj.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;qG.print("stopAudio","stop audio track: ".concat(this.userId)),this._audioDom&&(this._audioDom.srcObject=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(){qG.print("destroy","audio player: ".concat(this.userId)),this.stop(),S(f(i.prototype),"removeAllListeners",this).call(this),this._removeListeners(),this._audioDom&&($G.recycle(this._audioDom),delete this._audioDom)}}]),i}(aM.exports.EventEmitter),rH=function(){function e(){u(this,e),l(this,"_timer",void 0),l(this,"userMessage",void 0),l(this,"roomMessage",void 0),this.userMessage={},this.roomMessage={},this._setTimer()}return d(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;GV.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,LV.P2P,t)}},{key:"recvP2PMessage",value:function(e){this._recvUserMessage(e,LV.P2P)}},{key:"sendP2PFail",value:function(e){this._sendUserFail(e,LV.P2P)}},{key:"sendP2PAck",value:function(e,t,r,n){this._sendUserAck(e,LV.P2P,t,r,n)}},{key:"sendP2POutRoomMessage",value:function(e,t){this._sendUserMessage(e,LV.P2P_OUTSIDE_ROOM,t)}},{key:"recvP2POutRoomMessage",value:function(e){this._recvUserMessage(e,LV.P2P_OUTSIDE_ROOM)}},{key:"sendP2POutRoomFail",value:function(e){this._sendUserFail(e,LV.P2P_OUTSIDE_ROOM)}},{key:"sendP2POutRoomAck",value:function(e,t,r,n){this._sendUserAck(e,LV.P2P_OUTSIDE_ROOM,t,r,n)}},{key:"sendP2serverMessage",value:function(e){this._sendUserMessage("",LV.P2SERVER,e)}},{key:"sendP2serverFail",value:function(){this._sendUserFail("",LV.P2SERVER)}},{key:"sendP2serveAck",value:function(e){this._sendUserAck("",LV.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}(),nH="object"==typeof global&&global&&global.Object===Object&&global,iH="object"==typeof self&&self&&self.Object===Object&&self,oH=nH||iH||Function("return this")(),aH=oH.Symbol,sH=Object.prototype,uH=sH.hasOwnProperty,cH=sH.toString,dH=aH?aH.toStringTag:void 0;var lH=Object.prototype.toString;var hH=aH?aH.toStringTag:void 0;function fH(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":hH&&hH in Object(e)?function(e){var t=uH.call(e,dH),r=e[dH];try{e[dH]=void 0;var n=!0}catch(o){}var i=cH.call(e);return n&&(t?e[dH]=r:delete e[dH]),i}(e):function(e){return lH.call(e)}(e)}function pH(e){return null!=e&&"object"==typeof e}var _H=Array.isArray;function vH(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function mH(e){return e}function gH(e){if(!vH(e))return!1;var t=fH(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}var yH=oH["__core-js_shared__"],SH=function(){var e=/[^.]+$/.exec(yH&&yH.keys&&yH.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();var bH=Function.prototype.toString;var EH=/^\[object .+?Constructor\]$/,kH=Function.prototype,RH=Object.prototype,TH=kH.toString,IH=RH.hasOwnProperty,AH=RegExp("^"+TH.call(IH).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function wH(e){return!(!vH(e)||(t=e,SH&&SH in t))&&(gH(e)?AH:EH).test(function(e){if(null!=e){try{return bH.call(e)}catch(t){}try{return e+""}catch(t){}}return""}(e));var t}function CH(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 OH=Date.now;var xH,NH,DH,PH=function(){try{var e=function(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return wH(r)?r:void 0}(Object,"defineProperty");return e({},"",{}),e}catch(t){}}(),MH=PH,UH=MH?function(e,t){return MH(e,"toString",{configurable:!0,enumerable:!1,value:(r=t,function(){return r}),writable:!0});var r}:mH,LH=(xH=UH,NH=0,DH=0,function(){var e=OH(),t=16-(e-DH);if(DH=e,t>0){if(++NH>=800)return arguments[0]}else NH=0;return xH.apply(void 0,arguments)}),VH=LH,FH=/^(?:0|[1-9]\d*)$/;function BH(e,t){var r=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==r||"symbol"!=r&&FH.test(e))&&e>-1&&e%1==0&&e<t}function jH(e,t,r){"__proto__"==t&&MH?MH(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function GH(e,t){return e===t||e!=e&&t!=t}var HH=Object.prototype.hasOwnProperty;function zH(e,t,r){var n=e[t];HH.call(e,t)&&GH(n,r)&&(void 0!==r||t in e)||jH(e,t,r)}var KH=Math.max;function WH(e,t){return VH(function(e,t,r){return t=KH(void 0===t?e.length-1:t,0),function(){for(var n=arguments,i=-1,o=KH(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),CH(e,this,s)}}(e,t,mH),e+"")}function XH(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function YH(e){return null!=e&&XH(e.length)&&!gH(e)}var qH=Object.prototype;function JH(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||qH)}function QH(e){return pH(e)&&"[object Arguments]"==fH(e)}var ZH=Object.prototype,$H=ZH.hasOwnProperty,ez=ZH.propertyIsEnumerable,tz=QH(function(){return arguments}())?QH:function(e){return pH(e)&&$H.call(e,"callee")&&!ez.call(e,"callee")},rz=tz;var nz="object"==typeof exports&&exports&&!exports.nodeType&&exports,iz=nz&&"object"==typeof module&&module&&!module.nodeType&&module,oz=iz&&iz.exports===nz?oH.Buffer:void 0,az=(oz?oz.isBuffer:void 0)||function(){return!1},sz={};sz["[object Float32Array]"]=sz["[object Float64Array]"]=sz["[object Int8Array]"]=sz["[object Int16Array]"]=sz["[object Int32Array]"]=sz["[object Uint8Array]"]=sz["[object Uint8ClampedArray]"]=sz["[object Uint16Array]"]=sz["[object Uint32Array]"]=!0,sz["[object Arguments]"]=sz["[object Array]"]=sz["[object ArrayBuffer]"]=sz["[object Boolean]"]=sz["[object DataView]"]=sz["[object Date]"]=sz["[object Error]"]=sz["[object Function]"]=sz["[object Map]"]=sz["[object Number]"]=sz["[object Object]"]=sz["[object RegExp]"]=sz["[object Set]"]=sz["[object String]"]=sz["[object WeakMap]"]=!1;var uz="object"==typeof exports&&exports&&!exports.nodeType&&exports,cz=uz&&"object"==typeof module&&module&&!module.nodeType&&module,dz=cz&&cz.exports===uz&&nH.process,lz=function(){try{var e=cz&&cz.require&&cz.require("util").types;return e||dz&&dz.binding&&dz.binding("util")}catch(t){}}(),hz=lz&&lz.isTypedArray,fz=hz?function(e){return function(t){return e(t)}}(hz):function(e){return pH(e)&&XH(e.length)&&!!sz[fH(e)]},pz=fz,_z=Object.prototype.hasOwnProperty;function vz(e,t){var r=_H(e),n=!r&&rz(e),i=!r&&!n&&az(e),o=!r&&!n&&!i&&pz(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&&!_z.call(e,c)||a&&("length"==c||i&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||BH(c,u))||s.push(c);return s}var mz=function(e,t){return function(r){return e(t(r))}}(Object.keys,Object),gz=mz,yz=Object.prototype.hasOwnProperty;function Sz(e){return YH(e)?vz(e):function(e){if(!JH(e))return gz(e);var t=[];for(var r in Object(e))yz.call(e,r)&&"constructor"!=r&&t.push(r);return t}(e)}var bz=Object.prototype.hasOwnProperty;function Ez(e){if(!vH(e))return function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t}(e);var t=JH(e),r=[];for(var n in e)("constructor"!=n||!t&&bz.call(e,n))&&r.push(n);return r}var kz,Rz=(kz=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?jH(r,s,u):zH(r,s,u)}}(t,function(e){return YH(e)?vz(e,!0):Ez(e)}(t),e)},WH((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=kz.length>3&&"function"==typeof i?(n--,i):void 0,o&&function(e,t,r){if(!vH(r))return!1;var n=typeof t;return!!("number"==n?YH(r)&&BH(t,r.length):"string"==n&&t in r)&&GH(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&&kz(e,a,r,i)}return e}))),Tz=Rz;function Iz(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 Az(e){return null==e?[]:Iz(e,Sz(e))}var wz=se,Cz=er("iterator"),Oz=!wz((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[Cz]||"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})),xz=Te,Nz=2147483647,Dz=/[^\0-\u007E]/,Pz=/[.\u3002\uFF0E\uFF61]/g,Mz="Overflow: input needs wider integers to process",Uz=oe.RangeError,Lz=xz(Pz.exec),Vz=Math.floor,Fz=String.fromCharCode,Bz=xz("".charCodeAt),jz=xz([].join),Gz=xz([].push),Hz=xz("".replace),zz=xz("".split),Kz=xz("".toLowerCase),Wz=function(e){return e+22+75*(e<26)},Xz=function(e,t,r){var n=0;for(e=r?Vz(e/700):e>>1,e+=Vz(e/t);e>455;)e=Vz(e/35),n+=36;return Vz(n+36*e/(e+38))},Yz=function(e){var t=[];e=function(e){for(var t=[],r=0,n=e.length;r<n;){var i=Bz(e,r++);if(i>=55296&&i<=56319&&r<n){var o=Bz(e,r++);56320==(64512&o)?Gz(t,((1023&i)<<10)+(1023&o)+65536):(Gz(t,i),r--)}else Gz(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&&Gz(t,Fz(n));var u=t.length,c=u;for(u&&Gz(t,"-");c<i;){var d=Nz;for(r=0;r<e.length;r++)(n=e[r])>=o&&n<d&&(d=n);var l=c+1;if(d-o>Vz((Nz-a)/l))throw Uz(Mz);for(a+=(d-o)*l,o=d,r=0;r<e.length;r++){if((n=e[r])<o&&++a>Nz)throw Uz(Mz);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 _=h-p,v=36-p;Gz(t,Fz(Wz(p+_%v))),h=Vz(_/v),f+=36}Gz(t,Fz(Wz(h))),s=Xz(a,l,c==u),a=0,c++}}a++,o++}return jz(t,"")},qz=Yi,Jz=oe,Qz=Xe,Zz=he,$z=Te,eK=Oz,tK=qr.exports,rK=Hd,nK=fa,iK=vc,oK=On,aK=Qd,sK=je,uK=Vt,cK=ma,dK=ho,lK=Pr,hK=He,fK=_o,pK=Fo,_K=ye,vK=fl,mK=al,gK=Jl,yK=CI,SK=er("iterator"),bK="URLSearchParams",EK="URLSearchParamsIterator",kK=oK.set,RK=oK.getterFor(bK),TK=oK.getterFor(EK),IK=Qz("fetch"),AK=Qz("Request"),wK=Qz("Headers"),CK=AK&&AK.prototype,OK=wK&&wK.prototype,xK=Jz.RegExp,NK=Jz.TypeError,DK=Jz.decodeURIComponent,PK=Jz.encodeURIComponent,MK=$z("".charAt),UK=$z([].join),LK=$z([].push),VK=$z("".replace),FK=$z([].shift),BK=$z([].splice),jK=$z("".split),GK=$z("".slice),HK=/\+/g,zK=Array(4),KK=function(e){return zK[e-1]||(zK[e-1]=xK("((?:%[\\da-f]{2}){"+e+"})","gi"))},WK=function(e){try{return DK(e)}catch(RY){return e}},XK=function(e){var t=VK(e,HK," "),r=4;try{return DK(t)}catch(RY){for(;r;)t=VK(t,KK(r--),WK);return t}},YK=/[!'()~]|%20/g,qK={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},JK=function(e){return qK[e]},QK=function(e){return VK(PK(e),YK,JK)},ZK=iK((function(e,t){kK(this,{type:EK,iterator:vK(RK(e).entries),kind:t})}),"Iterator",(function(){var e=TK(this),t=e.kind,r=e.iterator.next(),n=r.value;return r.done||(r.value="keys"===t?n.key:"values"===t?n.value:[n.key,n.value]),r}),!0),$K=function(e){this.entries=[],this.url=null,void 0!==e&&(hK(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===MK(e,0)?GK(e,1):e:fK(e)))};$K.prototype={type:bK,bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t,r,n,i,o,a,s,u=mK(e);if(u)for(r=(t=vK(e,u)).next;!(n=Zz(r,t)).done;){if(o=(i=vK(lK(n.value))).next,(a=Zz(o,i)).done||(s=Zz(o,i)).done||!Zz(o,i).done)throw NK("Expected sequence with length 2");LK(this.entries,{key:fK(a.value),value:fK(s.value)})}else for(var c in e)uK(e,c)&&LK(this.entries,{key:c,value:fK(e[c])})},parseQuery:function(e){if(e)for(var t,r,n=jK(e,"&"),i=0;i<n.length;)(t=n[i++]).length&&(r=jK(t,"="),LK(this.entries,{key:XK(FK(r)),value:XK(UK(r,"="))}))},serialize:function(){for(var e,t=this.entries,r=[],n=0;n<t.length;)e=t[n++],LK(r,QK(e.key)+"="+QK(e.value));return UK(r,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var eW=function(){aK(this,tW);var e=arguments.length>0?arguments[0]:void 0;kK(this,new $K(e))},tW=eW.prototype;if(rK(tW,{append:function(e,t){gK(arguments.length,2);var r=RK(this);LK(r.entries,{key:fK(e),value:fK(t)}),r.updateURL()},delete:function(e){gK(arguments.length,1);for(var t=RK(this),r=t.entries,n=fK(e),i=0;i<r.length;)r[i].key===n?BK(r,i,1):i++;t.updateURL()},get:function(e){gK(arguments.length,1);for(var t=RK(this).entries,r=fK(e),n=0;n<t.length;n++)if(t[n].key===r)return t[n].value;return null},getAll:function(e){gK(arguments.length,1);for(var t=RK(this).entries,r=fK(e),n=[],i=0;i<t.length;i++)t[i].key===r&&LK(n,t[i].value);return n},has:function(e){gK(arguments.length,1);for(var t=RK(this).entries,r=fK(e),n=0;n<t.length;)if(t[n++].key===r)return!0;return!1},set:function(e,t){gK(arguments.length,1);for(var r,n=RK(this),i=n.entries,o=!1,a=fK(e),s=fK(t),u=0;u<i.length;u++)(r=i[u]).key===a&&(o?BK(i,u--,1):(o=!0,r.value=s));o||LK(i,{key:a,value:s}),n.updateURL()},sort:function(){var e=RK(this);yK(e.entries,(function(e,t){return e.key>t.key?1:-1})),e.updateURL()},forEach:function(e){for(var t,r=RK(this).entries,n=cK(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 ZK(this,"keys")},values:function(){return new ZK(this,"values")},entries:function(){return new ZK(this,"entries")}},{enumerable:!0}),tK(tW,SK,tW.entries,{name:"entries"}),tK(tW,"toString",(function(){return RK(this).serialize()}),{enumerable:!0}),nK(eW,bK),qz({global:!0,forced:!eK},{URLSearchParams:eW}),!eK&&sK(wK)){var rW=$z(OK.has),nW=$z(OK.set),iW=function(e){if(hK(e)){var t,r=e.body;if(dK(r)===bK)return t=e.headers?new wK(e.headers):new wK,rW(t,"content-type")||nW(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),pK(e,{body:_K(0,fK(r)),headers:_K(0,t)})}return e};if(sK(IK)&&qz({global:!0,enumerable:!0,forced:!0},{fetch:function(e){return IK(e,arguments.length>1?iW(arguments[1]):{})}}),sK(AK)){var oW=function(e){return aK(this,CK),new AK(e,arguments.length>1?iW(arguments[1]):{})};CK.constructor=oW,oW.prototype=CK,qz({global:!0,forced:!0},{Request:oW})}}var aW,sW={URLSearchParams:eW,getState:RK},uW=Yi,cW=ue,dW=Oz,lW=oe,hW=ma,fW=Te,pW=vo.f,_W=qr.exports,vW=Qd,mW=Vt,gW=Jg,yW=JD,SW=Jo,bW=hd.codeAt,EW=function(e){var t,r,n=[],i=zz(Hz(Kz(e),Pz,"."),".");for(t=0;t<i.length;t++)r=i[t],Gz(n,Lz(Dz,r)?"xn--"+Yz(r):r);return jz(n,".")},kW=_o,RW=fa,TW=Jl,IW=sW,AW=On,wW=AW.set,CW=AW.getterFor("URL"),OW=IW.URLSearchParams,xW=IW.getState,NW=lW.URL,DW=lW.TypeError,PW=lW.parseInt,MW=Math.floor,UW=Math.pow,LW=fW("".charAt),VW=fW(/./.exec),FW=fW([].join),BW=fW(1..toString),jW=fW([].pop),GW=fW([].push),HW=fW("".replace),zW=fW([].shift),KW=fW("".split),WW=fW("".slice),XW=fW("".toLowerCase),YW=fW([].unshift),qW="Invalid scheme",JW="Invalid host",QW="Invalid port",ZW=/[a-z]/i,$W=/[\d+-.a-z]/i,eX=/\d/,tX=/^0x/i,rX=/^[0-7]+$/,nX=/^\d+$/,iX=/^[\da-f]+$/i,oX=/[\0\t\n\r #%/:<>?@[\\\]^|]/,aX=/[\0\t\n\r #/:<>?@[\\\]^|]/,sX=/^[\u0000-\u0020]+|[\u0000-\u0020]+$/g,uX=/[\t\n\r]/g,cX=function(e){var t,r,n,i;if("number"==typeof e){for(t=[],r=0;r<4;r++)YW(t,e%256),e=MW(e/256);return FW(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+=BW(e[r],16),r<7&&(t+=":")));return"["+t+"]"}return e},dX={},lX=gW({},dX,{" ":1,'"':1,"<":1,">":1,"`":1}),hX=gW({},lX,{"#":1,"?":1,"{":1,"}":1}),fX=gW({},hX,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),pX=function(e,t){var r=bW(e,0);return r>32&&r<127&&!mW(t,e)?e:encodeURIComponent(e)},_X={ftp:21,file:null,http:80,https:443,ws:80,wss:443},vX=function(e,t){var r;return 2==e.length&&VW(ZW,LW(e,0))&&(":"==(r=LW(e,1))||!t&&"|"==r)},mX=function(e){var t;return e.length>1&&vX(WW(e,0,2))&&(2==e.length||"/"===(t=LW(e,2))||"\\"===t||"?"===t||"#"===t)},gX=function(e){return"."===e||"%2e"===XW(e)},yX={},SX={},bX={},EX={},kX={},RX={},TX={},IX={},AX={},wX={},CX={},OX={},xX={},NX={},DX={},PX={},MX={},UX={},LX={},VX={},FX={},BX=function(e,t,r){var n,i,o,a=kW(e);if(t){if(i=this.parse(a))throw DW(i);this.searchParams=null}else{if(void 0!==r&&(n=new BX(r,!0)),i=this.parse(a,null,n))throw DW(i);(o=xW(new OW)).bindURL(this),this.searchParams=o}};BX.prototype={type:"URL",parse:function(e,t,r){var n,i,o,a,s,u=this,c=t||yX,d=0,l="",h=!1,f=!1,p=!1;for(e=kW(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=HW(e,sX,"")),e=HW(e,uX,""),n=yW(e);d<=n.length;){switch(i=n[d],c){case yX:if(!i||!VW(ZW,i)){if(t)return qW;c=bX;continue}l+=XW(i),c=SX;break;case SX:if(i&&(VW($W,i)||"+"==i||"-"==i||"."==i))l+=XW(i);else{if(":"!=i){if(t)return qW;l="",c=bX,d=0;continue}if(t&&(u.isSpecial()!=mW(_X,l)||"file"==l&&(u.includesCredentials()||null!==u.port)||"file"==u.scheme&&!u.host))return;if(u.scheme=l,t)return void(u.isSpecial()&&_X[u.scheme]==u.port&&(u.port=null));l="","file"==u.scheme?c=NX:u.isSpecial()&&r&&r.scheme==u.scheme?c=EX:u.isSpecial()?c=IX:"/"==n[d+1]?(c=kX,d++):(u.cannotBeABaseURL=!0,GW(u.path,""),c=LX)}break;case bX:if(!r||r.cannotBeABaseURL&&"#"!=i)return qW;if(r.cannotBeABaseURL&&"#"==i){u.scheme=r.scheme,u.path=SW(r.path),u.query=r.query,u.fragment="",u.cannotBeABaseURL=!0,c=FX;break}c="file"==r.scheme?NX:RX;continue;case EX:if("/"!=i||"/"!=n[d+1]){c=RX;continue}c=AX,d++;break;case kX:if("/"==i){c=wX;break}c=UX;continue;case RX:if(u.scheme=r.scheme,i==aW)u.username=r.username,u.password=r.password,u.host=r.host,u.port=r.port,u.path=SW(r.path),u.query=r.query;else if("/"==i||"\\"==i&&u.isSpecial())c=TX;else if("?"==i)u.username=r.username,u.password=r.password,u.host=r.host,u.port=r.port,u.path=SW(r.path),u.query="",c=VX;else{if("#"!=i){u.username=r.username,u.password=r.password,u.host=r.host,u.port=r.port,u.path=SW(r.path),u.path.length--,c=UX;continue}u.username=r.username,u.password=r.password,u.host=r.host,u.port=r.port,u.path=SW(r.path),u.query=r.query,u.fragment="",c=FX}break;case TX:if(!u.isSpecial()||"/"!=i&&"\\"!=i){if("/"!=i){u.username=r.username,u.password=r.password,u.host=r.host,u.port=r.port,c=UX;continue}c=wX}else c=AX;break;case IX:if(c=AX,"/"!=i||"/"!=LW(l,d+1))continue;d++;break;case AX:if("/"!=i&&"\\"!=i){c=wX;continue}break;case wX:if("@"==i){h&&(l="%40"+l),h=!0,o=yW(l);for(var _=0;_<o.length;_++){var v=o[_];if(":"!=v||p){var m=pX(v,fX);p?u.password+=m:u.username+=m}else p=!0}l=""}else if(i==aW||"/"==i||"?"==i||"#"==i||"\\"==i&&u.isSpecial()){if(h&&""==l)return"Invalid authority";d-=yW(l).length+1,l="",c=CX}else l+=i;break;case CX:case OX:if(t&&"file"==u.scheme){c=PX;continue}if(":"!=i||f){if(i==aW||"/"==i||"?"==i||"#"==i||"\\"==i&&u.isSpecial()){if(u.isSpecial()&&""==l)return JW;if(t&&""==l&&(u.includesCredentials()||null!==u.port))return;if(a=u.parseHost(l))return a;if(l="",c=MX,t)return;continue}"["==i?f=!0:"]"==i&&(f=!1),l+=i}else{if(""==l)return JW;if(a=u.parseHost(l))return a;if(l="",c=xX,t==OX)return}break;case xX:if(!VW(eX,i)){if(i==aW||"/"==i||"?"==i||"#"==i||"\\"==i&&u.isSpecial()||t){if(""!=l){var g=PW(l,10);if(g>65535)return QW;u.port=u.isSpecial()&&g===_X[u.scheme]?null:g,l=""}if(t)return;c=MX;continue}return QW}l+=i;break;case NX:if(u.scheme="file","/"==i||"\\"==i)c=DX;else{if(!r||"file"!=r.scheme){c=UX;continue}if(i==aW)u.host=r.host,u.path=SW(r.path),u.query=r.query;else if("?"==i)u.host=r.host,u.path=SW(r.path),u.query="",c=VX;else{if("#"!=i){mX(FW(SW(n,d),""))||(u.host=r.host,u.path=SW(r.path),u.shortenPath()),c=UX;continue}u.host=r.host,u.path=SW(r.path),u.query=r.query,u.fragment="",c=FX}}break;case DX:if("/"==i||"\\"==i){c=PX;break}r&&"file"==r.scheme&&!mX(FW(SW(n,d),""))&&(vX(r.path[0],!0)?GW(u.path,r.path[0]):u.host=r.host),c=UX;continue;case PX:if(i==aW||"/"==i||"\\"==i||"?"==i||"#"==i){if(!t&&vX(l))c=UX;else if(""==l){if(u.host="",t)return;c=MX}else{if(a=u.parseHost(l))return a;if("localhost"==u.host&&(u.host=""),t)return;l="",c=MX}continue}l+=i;break;case MX:if(u.isSpecial()){if(c=UX,"/"!=i&&"\\"!=i)continue}else if(t||"?"!=i)if(t||"#"!=i){if(i!=aW&&(c=UX,"/"!=i))continue}else u.fragment="",c=FX;else u.query="",c=VX;break;case UX:if(i==aW||"/"==i||"\\"==i&&u.isSpecial()||!t&&("?"==i||"#"==i)){if(".."===(s=XW(s=l))||"%2e."===s||".%2e"===s||"%2e%2e"===s?(u.shortenPath(),"/"==i||"\\"==i&&u.isSpecial()||GW(u.path,"")):gX(l)?"/"==i||"\\"==i&&u.isSpecial()||GW(u.path,""):("file"==u.scheme&&!u.path.length&&vX(l)&&(u.host&&(u.host=""),l=LW(l,0)+":"),GW(u.path,l)),l="","file"==u.scheme&&(i==aW||"?"==i||"#"==i))for(;u.path.length>1&&""===u.path[0];)zW(u.path);"?"==i?(u.query="",c=VX):"#"==i&&(u.fragment="",c=FX)}else l+=pX(i,hX);break;case LX:"?"==i?(u.query="",c=VX):"#"==i?(u.fragment="",c=FX):i!=aW&&(u.path[0]+=pX(i,dX));break;case VX:t||"#"!=i?i!=aW&&("'"==i&&u.isSpecial()?u.query+="%27":u.query+="#"==i?"%23":pX(i,dX)):(u.fragment="",c=FX);break;case FX:i!=aW&&(u.fragment+=pX(i,lX))}d++}},parseHost:function(e){var t,r,n;if("["==LW(e,0)){if("]"!=LW(e,e.length-1))return JW;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 LW(e,l)};if(":"==h()){if(":"!=LW(e,1))return;l+=2,d=++c}for(;h();){if(8==c)return;if(":"!=h()){for(t=r=0;r<4&&VW(iX,h());)t=16*t+PW(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(!VW(eX,h()))return;for(;VW(eX,h());){if(o=PW(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}(WW(e,1,-1)),!t)return JW;this.host=t}else if(this.isSpecial()){if(e=EW(e),VW(oX,e))return JW;if(t=function(e){var t,r,n,i,o,a,s,u=KW(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"==LW(i,0)&&(o=VW(tX,i)?16:8,i=WW(i,8==o?1:2)),""===i)a=0;else{if(!VW(10==o?nX:8==o?rX:iX,i))return e;a=PW(i,o)}GW(r,a)}for(n=0;n<t;n++)if(a=r[n],n==t-1){if(a>=UW(256,5-t))return null}else if(a>255)return null;for(s=jW(r),n=0;n<r.length;n++)s+=r[n]*UW(256,3-n);return s}(e),null===t)return JW;this.host=t}else{if(VW(aX,e))return JW;for(t="",r=yW(e),n=0;n<r.length;n++)t+=pX(r[n],dX);this.host=t}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||"file"==this.scheme},includesCredentials:function(){return""!=this.username||""!=this.password},isSpecial:function(){return mW(_X,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;!t||"file"==this.scheme&&1==t&&vX(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+=cX(i),null!==o&&(c+=":"+o)):"file"==t&&(c+="//"),c+=e.cannotBeABaseURL?a[0]:a.length?"/"+FW(a,"/"):"",null!==s&&(c+="?"+s),null!==u&&(c+="#"+u),c},setHref:function(e){var t=this.parse(e);if(t)throw DW(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if("blob"==e)try{return new jX(e.path[0]).origin}catch(RY){return"null"}return"file"!=e&&this.isSpecial()?e+"://"+cX(this.host)+(null!==t?":"+t:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse(kW(e)+":",yX)},getUsername:function(){return this.username},setUsername:function(e){var t=yW(kW(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var r=0;r<t.length;r++)this.username+=pX(t[r],fX)}},getPassword:function(){return this.password},setPassword:function(e){var t=yW(kW(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var r=0;r<t.length;r++)this.password+=pX(t[r],fX)}},getHost:function(){var e=this.host,t=this.port;return null===e?"":null===t?cX(e):cX(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,CX)},getHostname:function(){var e=this.host;return null===e?"":cX(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,OX)},getPort:function(){var e=this.port;return null===e?"":kW(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""==(e=kW(e))?this.port=null:this.parse(e,xX))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+FW(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,MX))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){""==(e=kW(e))?this.query=null:("?"==LW(e,0)&&(e=WW(e,1)),this.query="",this.parse(e,VX)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){""!=(e=kW(e))?("#"==LW(e,0)&&(e=WW(e,1)),this.fragment="",this.parse(e,FX)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var jX=function(e){var t=vW(this,GX),r=TW(arguments.length,1)>1?arguments[1]:void 0,n=wW(t,new BX(e,!1,r));cW||(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())},GX=jX.prototype,HX=function(e,t){return{get:function(){return CW(this)[e]()},set:t&&function(e){return CW(this)[t](e)},configurable:!0,enumerable:!0}};if(cW&&pW(GX,{href:HX("serialize","setHref"),origin:HX("getOrigin"),protocol:HX("getProtocol","setProtocol"),username:HX("getUsername","setUsername"),password:HX("getPassword","setPassword"),host:HX("getHost","setHost"),hostname:HX("getHostname","setHostname"),port:HX("getPort","setPort"),pathname:HX("getPathname","setPathname"),search:HX("getSearch","setSearch"),searchParams:HX("getSearchParams"),hash:HX("getHash","setHash")}),_W(GX,"toJSON",(function(){return CW(this).serialize()}),{enumerable:!0}),_W(GX,"toString",(function(){return CW(this).serialize()}),{enumerable:!0}),NW){var zX=NW.createObjectURL,KX=NW.revokeObjectURL;zX&&_W(jX,"createObjectURL",hW(zX,NW)),KX&&_W(jX,"revokeObjectURL",hW(KX,NW))}RW(jX,"URL"),uW({global:!0,forced:!dW,sham:!cW},{URL:jX});var WX=function(){var e=s(regeneratorRuntime.mark((function e(t,r){var n;return regeneratorRuntime.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)}}(),XX=Object.defineProperty,YX=Object.getOwnPropertyDescriptor,qX=function(e,t,r,n){for(var i,o=n>1?void 0:n?YX(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&&XX(t,r,o),o},JX=function(){function e(t){u(this,e),l(this,"_sharedAudioContext",new AudioContext),l(this,"_audioDestination",this._sharedAudioContext.createMediaStreamDestination()),l(this,"_localGainNode",this._sharedAudioContext.createGain()),l(this,"_bufferGainNode",this._sharedAudioContext.createGain()),l(this,"_audioBufferSource",void 0),l(this,"_localSource",void 0),l(this,"_context",void 0),l(this,"_failedAudioList",[]),l(this,"mixingMap",new Map),l(this,"resourcesCache",new Map),l(this,"volumeConfig",new Map),l(this,"cachedBuffer",[]),this._context=t,this._localGainNode.gain.value=1}var t,r,n;return d(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=s(regeneratorRuntime.mark((function e(t,r,n){var i,o,a,s,u,c,d,l,h,f,p,_,v,m=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=n.playCount,KP(o=n.type,"mixingType",Az($)),a=this._context.getLocalAudioTrack()){e.next=5;break}return e.abrupt("return");case 5:if(a.gainAudioTrack?(s=new MediaStream).addTrack(a.gainAudioTrack):s=yj(a.getTrack()),s&&this.mixMediaStream(s),(u=this.mixingMap.get(t))&&u.audioNode){u.audioNode.pause(),this._context.emitMessage({mixId:t,state:ee.AUDIO_MIXING_STATE_STOPPED,error:dD.AUDIO_MIXING_ERROR_OK});try{u.gainNode.disconnect(this._audioDestination),u.audioSource.disconnect(u.gainNode)}catch(g){}}if(!(d=this.resourcesCache.get(t))||d.filePath!==r){e.next=14;break}c=d.getAudioNode(),e.next=28;break;case 14:return e.next=16,fetch(r,{mode:"cors",credentials:"include"}).then((function(e){if(e.ok)return e.arrayBuffer();throw m._context.emitMessage({mixId:t,state:ee.AUDIO_MIXING_STATE_FAILED,error:dD.AUDIO_MIXING_ERROR_START_FAILED}),new lD(cD.LOAD_RESOURCES_FAILED,e.statusText)}));case 16:return l=e.sent,r.endsWith("mp3")?h={type:"audio/mpeg"}:r.endsWith("aac")&&(h={type:"audio/aac"}),e.next=20,WX(l,h);case 20:if(e.sent){e.next=25;break}throw this._context.emitMessage({mixId:t,state:ee.AUDIO_MIXING_STATE_FAILED,error:dD.AUDIO_MIXING_ERROR_START_FAILED}),new lD(cD.LOAD_RESOURCES_FAILED,"invalid audio resource");case 25:(c=new Audio).crossOrigin="anonymous",c.src=URL.createObjectURL(new Blob([l],h));case 28:return i<=0?c.loop=!0:i>0&&(f=i,c.onended=function(){--f>0?c.play():(m.mixingMap.delete(t),m._context.emitMessage({mixId:t,state:ee.AUDIO_MIXING_STATE_FINISHED,error:dD.AUDIO_MIXING_ERROR_OK}))}),e.prev=29,e.next=32,c.play();case 32:e.next=39;break;case 34:e.prev=34,e.t0=e.catch(29),console.error(e.t0),this._failedAudioList.push(c),this._context.onAutoPlayFailed();case 39:if(p=this._sharedAudioContext.createMediaElementSource(c),_=this._sharedAudioContext.createGain(),v=this.volumeConfig.get(t),_.gain.value=v?v/100:1,p.connect(_).connect(this._audioDestination),this.mixingMap.set(t,{audioSource:p,audioNode:c,gainNode:_,type:"file"}),o===$.PUBLISH)try{_.disconnect(this._sharedAudioContext.destination)}catch(g){}else _.connect(this._sharedAudioContext.destination);this._context.updateLocalAudioTrack(this._audioDestination.stream.getAudioTracks()[0],n.type),this._context.emitMessage({mixId:t,state:ee.AUDIO_MIXING_STATE_PLAYING,error:dD.AUDIO_MIXING_ERROR_OK});case 48:case"end":return e.stop()}}),e,this,[[29,34]])}))),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:ee.AUDIO_MIXING_STATE_STOPPED,error:dD.AUDIO_MIXING_ERROR_OK}))}},{key:"pauseAudioMixing",value:function(e){var t=this.mixingMap.get(e);t&&(this._context.emitMessage({mixId:e,state:ee.AUDIO_MIXING_STATE_PAUSED,error:dD.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:ee.AUDIO_MIXING_STATE_PLAYING,error:dD.AUDIO_MIXING_ERROR_OK}),t.audioNode.play())}},{key:"preloadAudioMixing",value:(r=s(regeneratorRuntime.mark((function e(t,r){var n,i=this;return regeneratorRuntime.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:ee.AUDIO_MIXING_STATE_FAILED,error:dD.AUDIO_MIXING_ERROR_PRELOAD_FAILED}),new lD(cD.LOAD_RESOURCES_FAILED,e.statusText)})).catch((function(e){throw i._context.emitMessage({mixId:t,state:ee.AUDIO_MIXING_STATE_FAILED,error:dD.AUDIO_MIXING_ERROR_PRELOAD_FAILED}),new lD(cD.LOAD_RESOURCES_FAILED,"Load resources failed",e)}));case 3:return n=e.sent,e.next=6,WX(n);case 6:if(e.sent){e.next=10;break}throw this._context.emitMessage({mixId:t,state:ee.AUDIO_MIXING_STATE_FAILED,error:dD.AUDIO_MIXING_ERROR_PRELOAD_FAILED}),new lD(cD.LOAD_RESOURCES_FAILED,"Load resources failed");case 10:this._context.emitMessage({mixId:t,state:ee.AUDIO_MIXING_STATE_PRELOADED,error:dD.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){KP(e,"type",Az($));var t=this._context.getLocalAudioTrack();if(t){var r=yj(t.getTrack());if(r&&this.mixMediaStream(r),e===$.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:ee.AUDIO_MIXING_STATE_PCM_ENABLED,error:dD.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:ee.AUDIO_MIXING_STATE_PCM_DISABLED,error:dD.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=s(regeneratorRuntime.mark((function e(){var t,r,n,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=[],r=T(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}();qX([qV("default","id","filePath","options")],JX.prototype,"startAudioMixing",1),qX([qV("default","id")],JX.prototype,"stopAudioMixing",1),qX([qV("default","id")],JX.prototype,"pauseAudioMixing",1),qX([qV("default","id")],JX.prototype,"resumeAudioMixing",1),qX([qV("default","id")],JX.prototype,"preloadAudioMixing",1),qX([qV("default","id")],JX.prototype,"unloadAudioMixing",1),qX([qV("default","id")],JX.prototype,"getAudioMixingVolume",1),qX([qV("default","id","volume")],JX.prototype,"setAudioMixingVolume",1),qX([qV("default","id")],JX.prototype,"getAudioMixingDuration",1),qX([qV("default","id")],JX.prototype,"getAudioMixingCurrentPosition",1),qX([qV("default","id","position")],JX.prototype,"setAudioMixingPosition",1),qX([qV("default","type")],JX.prototype,"enableAudioMixingBuffer",1),qX([qV()],JX.prototype,"disableAudioMixingBuffer",1),qX([qV("default","buffer")],JX.prototype,"pushAudioMixingBuffer",1);var QX=function(e){return e.NORMAL_USER="normalUser",e.SILENT_USER="silentUser",e}(QX||{}),ZX=new lM("RTMClient",1),$X=function(e){h(_,e);var t,r,n,i,o,a,c,p=g(_);function _(e){var t;return u(this,_),l(v(t=p.call(this)),"_dataChannelSignal",null),l(v(t),"_handler",null),l(v(t),"_dataChannelSignalState",OG.DISCONNECTED),l(v(t),"_loginSessionId",null),l(v(t),"_userId",null),l(v(t),"_token",null),l(v(t),"_isReconnecting",!1),l(v(t),"_reconnectTimer",null),l(v(t),"_loginResolveCallback",null),l(v(t),"_loginRejectCallback",null),l(v(t),"_iceConfigNode",null),l(v(t),"_wait_login_token",!1),t._appId=e,t}return d(_,[{key:"login",value:function(e,t){var r=this;return new Promise((function(n,i){if(ZX.print("login","invoke login, token: %o, userId: %o",e,t),r._loginSessionId)throw new lD(cD.ALREADY_LOGIN,"Already logined");if(r._loginResolveCallback)throw new lD(cD.LOGIN_FAILED,"Is logging in, please try again later.");r._userId=t,r._token=e,WV.setStats({rtc_app_id:r._appId,user_id:t}),r._loginResolveCallback=n,r._loginRejectCallback=i,r._dataChannelSignal?r._login():(ZX.print("login","init dataChannelSingling"),r._dataChannelSignalState=OG.CONNECTING,r._createDataChannelSignaling(t).then((function(e){r._dataChannelSignal=e,r._login()})).catch((function(){r._onDisconnect()})))}))}},{key:"logout",value:(c=s(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._loginSessionId&&this._userId){e.next=2;break}throw new lD(cD.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:DF.C2RTM}).catch((function(){}));case 4:this._closeDataChannelSignaling(),this._clearState();case 6:case"end":return e.stop()}}),e,this)}))),function(){return c.apply(this,arguments)})},{key:"updateLoginToken",value:(a=s(regeneratorRuntime.mark((function e(t){var r=this;return regeneratorRuntime.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 a.apply(this,arguments)})},{key:"getPeerOnlineStatus",value:(o=s(regeneratorRuntime.mark((function e(t){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._loginSessionId&&this._userId){e.next=2;break}throw new lD(cD.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:DF.C2RTM});case 5:return r=e.sent,e.abrupt("return",null==r?void 0:r.status);case 7:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"sendUserMessageOutsideRoom",value:(i=s(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._loginSessionId&&this._userId){e.next=2;break}throw new lD(cD.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=s(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._loginSessionId&&this._userId){e.next=2;break}throw new lD(cD.NOT_LOGIN,"login first");case 2:return this._checkDataChannelSignal(),e.next=5,this._dataChannelSignal.sendSignaling("setServerParams",{loginSessionId:this._loginSessionId,userId:this._userId,appId:this._appId,signature:t,url:r},{functionType:DF.C2RTM});case 5:case"end":return e.stop()}}),e,this)}))),function(e,t){return n.apply(this,arguments)})},{key:"sendServerMessage",value:(r=s(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._loginSessionId&&this._userId){e.next=2;break}throw new lD(cD.NOT_LOGIN,"login first");case 2:return this._checkDataChannelSignal(),e.abrupt("return",this._dataChannelSignal.sendP2PMessage({from:this._userId,app:this._appId,to:"",room:"",type:wF.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(),S(f(_.prototype),"removeAllListeners",this).call(this)}},{key:"_login",value:function(){var e=this;if(this._userId){var t=kP();this._checkDataChannelSignal(),this._dataChannelSignal.sendSignaling("login",{Token:AP.token2auth(this._appId,null,this._userId,this._token),timestamp:Date.now(),loginSessionId:t,params:{deviceType:"web",userAgent:window.navigator.userAgent,sdkVersion:lF.VERSION,deviceId:aF.getDeviceId(),appId:this._appId,userId:this._userId}},{functionType:DF.C2RTM}).then((function(){e._loginResolveCallback&&e._loginResolveCallback(),e._loginSessionId=t,e._wait_login_token=!1})).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=cD.INVALID_PARAMS,n="Invalid userId"):(r=cD.INVALID_TOKEN,n="Invalid token",e._wait_login_token=!0,e._loginRejectCallback||e.emit("onRTMTokenError")):(r=cD.LOGIN_FAILED,n="login failed"),e._loginRejectCallback&&e._loginRejectCallback(new lD(r,a||n))})).finally((function(){e._loginResolveCallback=null,e._loginRejectCallback=null}))}}},{key:"_createDataChannelSignaling",value:(t=s(regeneratorRuntime.mark((function e(t){var r,n,i,o,a,s,u,c=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=new VF,i=this._iceConfigNode){e.next=16;break}return e.prev=3,e.next=6,null==n?void 0:n.getAccessNode(this._appId,"",t,aF.getDeviceId(),"");case 6:if(o=e.sent,i=o[0]){e.next=10;break}throw new Error;case 10:e.next=16;break;case 12:throw e.prev=12,e.t0=e.catch(3),QV("rtm.login.getNodeFailed","",0,!0),new lD(cD.ICE_SERVER_WRONG,"get ICE config failed");case 16:return QV("rtm.login.getNodeSuccess",i,0,!0),ZX.print("_createDataChannelSignaling()","get node success",i),this._handler=SG(HV),null===(r=this._handler)||void 0===r||r.once("disconnect",(function(){ZX.print("_createDataChannelSignaling()","recv BasicHandler event: disconnect"),c._onDisconnect()})),e.prev=20,e.next=23,null===(s=this._handler)||void 0===s?void 0:s.connect(i);case 23:a=e.sent,ZX.print("_createDataChannelSignaling()","establish peerConnection success"),this._dataChannelSignalState=OG.CONNECTED,e.next=33;break;case 28:throw e.prev=28,e.t1=e.catch(20),this._iceConfigNode=null,this._dataChannelSignalState=OG.DISCONNECTED,new lD(cD.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed",e.t1);case 33:return u=new MF(a),ZX.print("_createDataChannelSignaling()","send ping"),u.sendPingSignaling(),u.once("close",(function(){ZX.print("_createDataChannelSignaling()","recv DataChannelSignaling event: close"),c._onDisconnect()})),u.on(EF.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM,(function(e){c.emit("onUserMessageReceivedOutsideRoom",{userId:e.from,message:e.msg})})),u.on(EF.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM,(function(e){c.emit("onUserBinaryMessageReceivedOutsideRoom",{userId:e.from,message:e.msg})})),u.on(EF.USER_DISCONNECTION,(function(){c.emit("onUserDisconnection"),c._clearState()})),u.on(EF.NODE_CHANGE,(function(e){QV("rtm.nodeChange",JSON.stringify(e),0,!0),Array.isArray(e.nodes)&&e.nodes.length&&(c._iceConfigNode=e.nodes[0]),c._loginResolveCallback&&c._loginRejectCallback?c._login():c._reconnect()})),e.abrupt("return",u);case 42:case"end":return e.stop()}}),e,this,[[3,12],[20,28]])}))),function(e){return t.apply(this,arguments)})},{key:"_closeDataChannelSignaling",value:function(){var e,t;null===(e=this._dataChannelSignal)||void 0===e||e.destroy(),this._dataChannelSignal=null,null===(t=this._handler)||void 0===t||t.destroy(),this._handler=null}},{key:"_checkDataChannelSignal",value:function(){if(!this._dataChannelSignal||this._dataChannelSignalState!==OG.CONNECTED)throw new lD(cD.NOT_CONNECTED_YET,"datachannel not connect")}},{key:"_onDisconnect",value:function(){this._dataChannelSignalState=OG.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&&(ZX.print("_reconnect()","start reconnect..."),this._isReconnecting=!0,this._createDataChannelSignaling(this._userId).then((function(t){ZX.print("_reconnect()","reconnect success!"),e._dataChannelSignal=t,e._login(),e._reconnectTimer=null})).catch((function(t){ZX.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)}}]),_}(aM.exports.EventEmitter),eY=function(e){h(o,e);var t,r,n,i=g(o);function o(e){var t;return u(this,o),l(v(t=i.call(this)),"_mediaServerClient",void 0),l(v(t),"_appId",void 0),l(v(t),"_reconnectTimer",void 0),l(v(t),"remoteStreams",void 0),t._appId=e,t.remoteStreams=new Map,t}return d(o,[{key:"connect",value:(n=s(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._mediaServerClient=new NG,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=s(regeneratorRuntime.mark((function e(t){var r,n=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.remoteStreams.get(t)){e.next=2;break}throw new lD(cD.REPEAT_PLAY,"repeat play public media stream");case 2:return(r=new uG(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=jP(e),i=0;i<t.seiCount;i++)n.emit(tG.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=s(regeneratorRuntime.mark((function e(){var t,r,n,i=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:clearTimeout(this._reconnectTimer),t=T(this.remoteStreams);try{for(n=function(){var e=b(r.value,1)[0];i.remoteStreams.delete(e),i.startPlayPublicStream(e).then((function(){var t=i.remoteStreams.get(e);i.safeEmit(tG.RESUBSCRIBE,{stream:t})}))},t.s();!(r=t.n()).done;)n()}catch(LU){t.e(LU)}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=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(RF.ABNORMAL_DISCONNECTION,this._reconnect.bind(this)),null===(t=this._mediaServerClient)||void 0===t||t.on("onRemoteStreamStats",(function(e){r.emit("onRemoteStreamStats",e)}))}}]),o}(fM),tY=new lM("AudioDeviceManager",1),rY=function(e){h(o,e);var t,r,n,i=g(o);function o(){var e;u(this,o);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return l(v(e=i.call.apply(i,[this].concat(r))),"_audioLevelFetcher",void 0),l(v(e),"_playbackDeviceTestTimer",void 0),l(v(e),"_audioElement",void 0),l(v(e),"_audioTrack",void 0),l(v(e),"_mediaRecorder",void 0),l(v(e),"_recoderTimer",void 0),l(v(e),"_isAudioPlaybackDeviceTesting",!1),l(v(e),"_isAudioDeviceRecordTesting",!1),l(v(e),"_audioCaptureAndRecoderResolve",void 0),e}return d(o,[{key:"startAudioPlaybackDeviceTest",value:(n=s(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._isAudioPlaybackDeviceTesting&&!this._isAudioDeviceRecordTesting){e.next=2;break}throw new lD(cD.REPEAT_DEVICE_TEST,"device test cannot be called repeatedly at the same time.");case 2:return this._isAudioPlaybackDeviceTesting=!0,tY.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&&(tY.print("stopAudioPlaybackDeviceTest()","Invoke"),this._isAudioPlaybackDeviceTesting=!1,this._stopEmitAudioPlaybackDeviceTestVolume(),this._destroyAudioElement())}},{key:"startAudioDeviceRecordTest",value:(r=s(regeneratorRuntime.mark((function e(t){var r=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._isAudioDeviceRecordTesting){e.next=2;break}throw new lD(cD.REPEAT_DEVICE_TEST,"device test cannot be called repeatedly at the same time.");case 2:return this._isAudioDeviceRecordTesting=!0,tY.print("startAudioDeviceRecordTest()","Invoke"),this._recoderTimer=window.setTimeout((function(){tY.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(){tY.print("stopAudioDeviceRecordAndPlayTest()","Invoke"),void 0!==this._recoderTimer&&(clearTimeout(this._recoderTimer),delete this._recoderTimer),this._stopAudioCaptureAndRecoder()}},{key:"stopAudioDevicePlayTest",value:function(){this._isAudioDeviceRecordTesting&&(tY.print("stopAudioDevicePlayTest()","Invoke"),this._isAudioDeviceRecordTesting=!1,this.stopAudioDeviceRecordAndPlayTest(),this._stopEmitAudioPlaybackDeviceTestVolume(),this._destroyAudioElement())}},{key:"getRecordTrack",value:function(){return this._audioTrack}},{key:"destroy",value:function(){tY.print("destroy()","Invoke"),S(f(o.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=XG("audio",{attributes:{src:e,crossOrigin:"",autoplay:"true"}}),r._audioElement.loop=t.loop,tY.print("_playAudioFile()","url=".concat(e,";loop=").concat(t.loop)),r._audioElement.oncanplay=function(){tY.print("_playAudioFile()","oncanplay"),n()},r._audioElement.onerror=function(e){var t,n;i(new lD(cD.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&&(tY.print("_destroyAudioElement()","Invoke"),this._audioElement.src="",delete this._audioElement,this._audioCaptureAndRecoderResolve&&this._audioCaptureAndRecoderResolve())}},{key:"_startEmitAudioPlaybackDeviceTestVolume",value:function(e){var t=this;e=Math.max(e,100),this._audioElement&&(tY.print("_startEmitAudioPlaybackDeviceTestVolume()","start timer(".concat(e,"ms)")),this._audioLevelFetcher=new pj(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&&(tY.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=s(regeneratorRuntime.mark((function e(t){var r,n=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Mj({});case 2:return this._audioTrack=e.sent,r=yj(this._audioTrack.getTrack()),tY.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=s(regeneratorRuntime.mark((function r(o){var a,s;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!n._isAudioDeviceRecordTesting){r.next=16;break}return tY.print("startAudioDeviceRecordTest()","get recorded file."),s=new Blob([o.data]),r.prev=3,r.next=6,n._playAudioFile(URL.createObjectURL(s),{loop:!1});case 6:r.next=11;break;case 8:return r.prev=8,r.t0=r.catch(3),r.abrupt("return",i(r.t0));case 11:n._startEmitAudioPlaybackDeviceTestVolume(t),null===(a=n._audioElement)||void 0===a||a.addEventListener("ended",(function(){n.stopAudioDevicePlayTest(),e()})),n._audioCaptureAndRecoderResolve=e,r.next=17;break;case 16:e();case 17:case"end":return r.stop()}}),r,null,[[3,8]])})));return function(e){return r.apply(this,arguments)}}(),n._mediaRecorder.onerror=function(e){i(new lD(cD.AUDIO_DEVICE_TEST_FAILED,e.message||"mediaRecorder error"))},n._mediaRecorder.start()})));case 6:case"end":return e.stop()}}),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}}]),o}(aM.exports.EventEmitter),nY=function(){function e(){u(this,e),l(this,"engineBAC",{adm:{},agc:{},ans:{}}),l(this,"engineANM",{}),l(this,"bitrate",void 0),l(this,"sampleRate",void 0),l(this,"channel",void 0),l(this,"aec",void 0),l(this,"agc",void 0),l(this,"ans",void 0),this._init()}var t;return d(e,[{key:"_init",value:(t=s(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=new FF,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:this.engineBAC.codec,adm:i(i({},this.engineBAC.adm),e.adm)},this.setAEC(!!e.aec),this.setAGC(!!e.agc))}},{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.sampleRate&&(e+="sprop-maxcapturerate=".concat(t.sampleRate,";")),t.playbackRate&&(e+="maxplaybackrate=".concat(t.playbackRate,";")),t.channel&&t.channel>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;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,channel:this.channel||(null===(n=this.engineBAC.adm)||void 0===n||null===(i=n.record)||void 0===i?void 0:i.chn)||(null===(o=this.engineANM)||void 0===o||null===(a=o.enc_param)||void 0===a?void 0:a.chn),aec:this.aec,agc:this.agc,ans:this.ans,sampleRate:this.sampleRate||(null===(s=this.engineBAC.adm)||void 0===s||null===(u=s.record)||void 0===u?void 0:u.sr)||(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),playbackRate:null===(l=this.engineBAC.adm)||void 0===l||null===(h=l.play)||void 0===h?void 0:h.sr}}}]),e}(),iY=new lM("VideoSnapshot",1),oY=function(e){var t=null==e?void 0:e.domElement;if(t&&!t.paused&&4===t.readyState)return t},aY=function(){var e=s(regeneratorRuntime.mark((function e(t,r,n){var i,o,a,s,u,c,d,l;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=document.createElement("canvas"),o=i.getContext("2d")){e.next=4;break}throw new Error("canvas.getContext error");case 4:if(a=function(e,t,n){return t=t||e.width,n=n||e.height,i.width=t,i.height=n,r?o.setTransform(-1,0,0,1,t,0):o.setTransform(1,0,0,1,0,0),o.drawImage(e,0,0,t,n),o.getImageData(0,0,t,n)},s=Date.now(),!(u=oY(n))){e.next=16;break}return iY.print("takeSnapshot","VideoPlayer already set."),e.next=11,a(u,u.videoWidth,u.videoHeight);case 11:return c=e.sent,iY.print("takeSnapshot","success, cost ".concat(Date.now()-s,"ms")),e.abrupt("return",c);case 16:if(!window.ImageCapture){e.next=29;break}if("live"!==(d=new window.ImageCapture(t)).track.readyState||!d.track.enabled||d.track.muted){e.next=29;break}return iY.print("takeSnapshot","use ImageCapture"),e.t0=a,e.next=23,d.grabFrame();case 23:return e.t1=e.sent,e.next=26,(0,e.t0)(e.t1);case 26:return l=e.sent,iY.print("takeSnapshot","success, cost ".concat(Date.now()-s,"ms")),e.abrupt("return",l);case 29:return iY.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=a(i,i.videoWidth,i.videoHeight);iY.print("takeSnapshot","success, cost ".concat(Date.now()-s,"ms")),e(r),n.removeTrack(t),i.srcObject=null,i.load()},i.onerror=r,i.srcObject=n,i.play()})));case 31:case"end":return e.stop()}}),e)})));return function(t,r,n){return e.apply(this,arguments)}}(),sY=Object.defineProperty,uY=Object.getOwnPropertyDescriptor,cY=function(e,t,r,n){for(var i,o=n>1?void 0:n?uY(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&&sY(t,r,o),o},dY=new lM("Engine",0),lY=function(e){h(Ue,e);var t,r,n,o,a,c,p,_,m,y,b,E,k,R,T,w,C,O,D,P,B,j,G,H,W,X,q,Q,Z,ee,te,ne,ie,oe,ae,se,ue,ce,de,le,he,fe,pe,_e,ve,me,ge,ye,Se,be,Ee,ke,Re,Te,Ie,Ae,we,Ce,Oe,xe,Ne,De,Pe,Me=g(Ue);function Ue(e,t){var r;return u(this,Ue),l(v(r=Me.call(this)),"_room",void 0),l(v(r),"_outsideRoom",void 0),l(v(r),"_appId",void 0),l(v(r),"_businessId",void 0),l(v(r),"_visibility",!0),l(v(r),"_localVideoTrack",void 0),l(v(r),"_localAudioTrack",void 0),l(v(r),"_localImgVideoTrack",void 0),l(v(r),"_localImgScreenTrack",void 0),l(v(r),"_localScreenVideoTrack",void 0),l(v(r),"_localScreenAudioTrack",void 0),l(v(r),"_tempMixingAudioTrack",void 0),l(v(r),"_localAudioTrackVolume",void 0),l(v(r),"_localScreenAudioTrackVolume",void 0),l(v(r),"_remoteAudioTrackVolumeMap",new Map),l(v(r),"_remoteScreenAudioTrackVolumeMap",new Map),l(v(r),"_remotePublicAudioTrackVolumeMap",new Map),l(v(r),"_audioPlaybackDeviceId",void 0),l(v(r),"_videoPlayer",void 0),l(v(r),"_screenPlayer",void 0),l(v(r),"_remoteVideoPlayer",new Map),l(v(r),"_remoteScreenPlayer",new Map),l(v(r),"_remoteAudioPlayer",new Map),l(v(r),"_publicStreamAudioPlayer",new Map),l(v(r),"_publicStreamVideoPlayer",new Map),l(v(r),"_publicStreamIds",new Map),l(v(r),"_roomConfig",void 0),l(v(r),"_videoStreamConstraints",{}),l(v(r),"_audioStreamConstraints",{}),l(v(r),"_enableSimulcast",!1),l(v(r),"_videoStreamEncodeConfig",[gF]),l(v(r),"_screenStreamEncodeConfig",[yF]),l(v(r),"_trackSourceType",void 0),l(v(r),"_liveTranscodeConfig",void 0),l(v(r),"_useCloudProxy",void 0),l(v(r),"_startCloudProxyTimestamp",void 0),l(v(r),"_localVideoDeviceId",void 0),l(v(r),"_localAudioDeviceId",void 0),l(v(r),"_pauseAllSubscribeState",{audio:!1,video:!1}),l(v(r),"_audioVolumeIndicationTimer",void 0),l(v(r),"_dummyTimer",void 0),l(v(r),"_audioPropertiesReportTimer",null),l(v(r),"_mirrorType",F.MIRROR_TYPE_RENDER),l(v(r),"_audioMixingManager",void 0),l(v(r),"_pubLock",void 0),l(v(r),"_rtmClient",void 0),l(v(r),"_messageStatisticsObserver",void 0),l(v(r),"_tempRoomConfig",void 0),l(v(r),"_originIceConfigRequestUrls",void 0),l(v(r),"_originConfigServerUrls",void 0),l(v(r),"_originLogServerUrl",void 0),l(v(r),"_audioDeviceManager",new rY),l(v(r),"_audioProfileManager",new nY),l(v(r),"_remoteVideoConfig",new Map),l(v(r),"_userPriorityMap",new Map),l(v(r),"_subscribeFallbackOption",z.DISABLE),l(v(r),"_config",void 0),l(v(r),"_updateMixAudioTrack",function(){var e=s(regeneratorRuntime.mark((function e(t){var n,i,o=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=o.length>1&&void 0!==o[1]?o[1]:$.PLAYOUT_AND_PUBLISH,dY.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)}}()),l(v(r),"_onAudioMixingMessage",(function(e){r.safeEmit(re.onAudioMixingStateChanged,e)})),l(v(r),"_onAudioMixingAutoplayFailed",(function(){r.safeEmit(re.onAutoplayFailed,{})})),r._appId=e,r._pubLock=new kG("pubLock"),r._addDeviceEventHandler(),r._audioMixingManager=new JX({getLocalAudioTrack:function(){return r._localAudioTrack},updateLocalAudioTrack:r._updateMixAudioTrack,emitMessage:r._onAudioMixingMessage,onAutoPlayFailed:r._onAudioMixingAutoplayFailed}),window.__rtc_engine__=v(r),window["__rtc_engine__".concat(Math.floor(100*Math.random()+1))]=v(r),r._trackSourceType={video:I.VIDEO_SOURCE_TYPE_INTERNAL,screenVideo:I.VIDEO_SOURCE_TYPE_INTERNAL,audio:A.AUDIO_SOURCE_TYPE_INTERNAL,screenAudio:A.AUDIO_SOURCE_TYPE_INTERNAL},r._config=t,r._rtmClient=new $X(e),r._handleRTMClient(r._rtmClient),r._useCloudProxy=!1,r._handleAudioDeviceManager(),r._messageStatisticsObserver=new rH,r}return d(Ue,[{key:"appId",get:function(){return this._appId},set:function(e){this._appId=e}},{key:"updateToken",value:(Pe=s(regeneratorRuntime.mark((function e(t){var r,n,i,o,a,s,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(dY.print("updateToken()","token: %s",t),zP(t,"token"),!(this.waitForNewToken&&null!==(r=this._room)&&void 0!==r&&r._roomInfo&&this._tempRoomConfig)){e.next=9;break}return o=null===(i=this._room)||void 0===i?void 0:i._roomInfo,a=o.roomId,s=o.userInfo,u=this._tempRoomConfig,delete this._tempRoomConfig,e.next=8,this.joinRoom(t,a,s,u);case 8:return e.abrupt("return",e.sent);case 9:if(this._room){e.next=11;break}throw new lD(cD.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 Pe.apply(this,arguments)})},{key:"setVideoCaptureDevice",value:(De=s(regeneratorRuntime.mark((function e(t){var r,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(dY.print("setVideoCaptureDevice()","deviceId: %s",t),zP(t,"deviceId"),this._localVideoDeviceId=t,this._localVideoTrack){e.next=5;break}return e.abrupt("return");case 5:return r=this._videoStreamConstraints,"user"===t||"environment"===t||"left"===t||"right"===t?(delete r.deviceId,r.facingMode=t):r.deviceId={exact:t},this._videoStreamConstraints=r,e.next=10,Dj(r);case 10:if(n=e.sent,this._initLocalTrackEvents(n),this._localVideoTrack.close(),this._localVideoTrack=n,this._videoPlayer&&this._videoPlayer.played&&(this._videoPlayer.stop(),this._videoPlayer.playVideo(n),this._videoPlayer.mirror(!!this._mirrorType)),this._room){e.next=17;break}return e.abrupt("return");case 17:if(!this._room.hasPublished){e.next=20;break}return e.next=20,this._updatePublish();case 20:case"end":return e.stop()}}),e,this)}))),function(e){return De.apply(this,arguments)})},{key:"setAudioCaptureDevice",value:(Ne=s(regeneratorRuntime.mark((function e(t){var r,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(dY.print("setAudioCaptureDevice()","deviceId: %s",t),zP(t,"deviceId"),this._localAudioDeviceId=t,this._localAudioTrack){e.next=5;break}return e.abrupt("return");case 5:return(r=this._audioStreamConstraints).deviceId={exact:t},this._audioStreamConstraints=r,e.next=10,Mj(r,this._audioProfileManager);case 10:if(n=e.sent,void 0!==this._localAudioTrackVolume&&n.setCaptureVolume(this._localAudioTrackVolume),this._initLocalTrackEvents(n),this._localAudioTrack.close(),this._localAudioTrack=n,this._room){e.next=17;break}return e.abrupt("return");case 17:if(!this._room.hasPublished){e.next=20;break}return e.next=20,this._updatePublish();case 20:case"end":return e.stop()}}),e,this)}))),function(e){return Ne.apply(this,arguments)})},{key:"_addDeviceEventHandler",value:function(){hj.on(re.onVideoDeviceStateChanged,this._onVideoDeviceStateChange.bind(this)),hj.on(re.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,g,y,S,b,E,k,R,T,I,A,w,C,O=this;null===(e=this._room)||void 0===e||e.on(EF.ON_ADD_STREAM,this._onAddStream.bind(this)),null===(t=this._room)||void 0===t||t.on(EF.ON_REMOVE_STREAM,this._onRemoveStream.bind(this)),null===(r=this._room)||void 0===r||r.on(EF.USER_CONNECTION,this._onUserConnection.bind(this)),null===(n=this._room)||void 0===n||n.on(tG.ON_USER_LEAVE,this._onUserLeave.bind(this)),null===(i=this._room)||void 0===i||i.on(tG.ON_ROOM_ERROR,this._onRoomError.bind(this)),null===(o=this._room)||void 0===o||o.on(tG.ON_NETWORK_QUALITY,this._onNetworkQuality.bind(this)),null===(a=this._room)||void 0===a||a.on(EF.ON_CUSTOM_MESSAGE,this._onCustomMessage.bind(this)),null===(s=this._room)||void 0===s||s.on(EF.USER_MESSAGE_RECEIVED,this._onUserMessageReceived.bind(this)),null===(u=this._room)||void 0===u||u.on(EF.USER_BINARY_MESSAGE_RECEIVED,this._onUserBinaryMessageReceived.bind(this)),null===(c=this._room)||void 0===c||c.on(EF.ON_USER_TOKEN_WILL_EXPIRE,this._onUserTokenWillExpire.bind(this)),null===(d=this._room)||void 0===d||d.on(EF.POST_PROCESSING_MESSAGE,(function(e){"2.0"===e.protocol?O._onStreamMixingEvent({error:e.error,event:e.eventType,message:e.message}):"publicStreamCallback"===e.type?O._onPushPublicStreamResult(e):"transcodeStatusCallback"===e.type&&O._onLiveTranscodingResult(e)})),null===(l=this._room)||void 0===l||l.on(RF.ON_CONNECTION_STATE_CHANGE,this._onConnectionStateChange.bind(this)),null===(h=this._room)||void 0===h||h.on(tG.RESUBSCRIBE,this._onResubscribe.bind(this)),null===(f=this._room)||void 0===f||f.on(tG.SUBSCRIBE_PUSH_TRACK,this._onSubscribePushTrack.bind(this)),null===(p=this._room)||void 0===p||p.on(tG.REMOVE_PUSH_TRACK,this._onRemovePushTrack.bind(this)),null===(_=this._room)||void 0===_||_.on(tG.VIDEO_FIRST_FRAME,this._onVideoFirstFrameDecoded.bind(this)),null===(v=this._room)||void 0===v||v.on(tG.ON_PUBLISH_RESULT,(function(e){var t;null!==(t=O._room)&&void 0!==t&&t._roomConfig.isAutoPublish&&O.safeEmit(re.onAutoPublishResult,e)})),null===(m=this._room)||void 0===m||m.on(tG.ON_REMOTE_STREAM_STATS,(function(e){O.safeEmit(re.onRemoteStreamStats,e)})),null===(g=this._room)||void 0===g||g.on(tG.ON_LOCAL_STREAM_STATS,(function(e){O.safeEmit(re.onLocalStreamStats,e)})),null===(y=this._room)||void 0===y||y.on(tG.ON_USER_PUBLISH_STATE_CHANGE,this._onUserPublishStateChange.bind(this)),null===(S=this._room)||void 0===S||S.on(tG.ON_USER_START_AUDIO_CAPTURE,(function(e){var t=e.userId;O.safeEmit(re.onUserStartAudioCapture,{userId:t})})),null===(b=this._room)||void 0===b||b.on(tG.ON_USER_STOP_AUDIO_CAPTURE,(function(e){var t=e.userId;O.safeEmit(re.onUserStopAudioCapture,{userId:t})})),null===(E=this._room)||void 0===E||E.on(tG.ON_USER_START_VIDEO_CAPTURE,(function(e){var t=e.userId;O.safeEmit(re.onUserStartVideoCapture,{userId:t})})),null===(k=this._room)||void 0===k||k.on(tG.ON_USER_STOP_VIDEO_CAPTURE,(function(e){var t=e.userId;O.safeEmit(re.onUserStopVideoCapture,{userId:t})})),null===(R=this._room)||void 0===R||R.on(tG.ON_SEI_MESSAGED_RECEIVED,(function(e){O.safeEmit(re.onSEIMessageReceived,e)})),null===(T=this._room)||void 0===T||T.on(tG.ON_REMOTE_VIDEO_SIZE_CHANGED,(function(e,t){O.safeEmit(re.onRemoteVideoSizeChanged,e,t)})),null===(I=this._room)||void 0===I||I.on(tG.ON_SIMULCAST_SUBSCRIBE_FALLBACK,(function(e){return O.safeEmit(re.onSimulcastSubscribeFallback,e)})),null===(A=this._room)||void 0===A||A.on(tG.RECONNECT_FAILED,(function(){O.safeEmit(re.onError,{errorCode:cD.RECONNECT_FAILED})})),null===(w=this._room)||void 0===w||w.on(tG.ON_VIDEO_STREAM_BANNED,(function(e){O.safeEmit(re.onVideoStreamBanned,{uid:e.uid,banned:e.banned})})),null===(C=this._room)||void 0===C||C.on(tG.ON_AUDIO_STREAM_BANNED,(function(e){O.safeEmit(re.onAudioStreamBanned,{uid:e.uid,banned:e.banned})}))}},{key:"safeEmit",value:function(e){for(var t,r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return iM(e)&&JV(e,PP(n)),(t=S(f(Ue.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:(xe=s(regeneratorRuntime.mark((function e(t,r,n,o){var a,s,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(dY.print("joinRoom()","token: %o roomId: %o, userInfo: %o, roomConfig: %o",t,r,n,o),JP(t)||zP(t,"token"),QP(r),eM(n),a={isAutoPublish:!0,isAutoSubscribeAudio:!0,isAutoSubscribeVideo:!0,roomProfileType:Y.communication},Tz(a,o),tM(a),!this._room||this._room.connectionState===OG.DISCONNECTED){e.next=11;break}throw new lD(cD.REPEAT_JOIN,"Already joined");case 11:return this._room=new KG(o,{audioProfileManager:this._audioProfileManager}),this._room.userPriorityMap=this._userPriorityMap,this._room.subscribeFallbackOption=this._subscribeFallbackOption,this._addHandlerEventHandler(),s=this._liveTranscodeConfig&&pF("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?QX.NORMAL_USER:QX.SILENT_USER}),s,this._useCloudProxy);case 20:return u=e.sent,this._roomConfig=o,this._tempRoomConfig&&delete this._tempRoomConfig,null!=o&&o.isAutoPublish&&(this._visibility?this._updatePublish({invokeByJoinRoom:!0,mediaType:U.AUDIO_AND_VIDEO}):this.safeEmit(re.onAutoPublishResult,{isScreen:!1,state:N.PUBLISH_FAIL})),e.abrupt("return",u);case 27:throw e.prev=27,e.t0=e.catch(16),e.t0.code===cD.INVALID_TOKEN&&(this._tempRoomConfig=o),e.t0;case 31:case"end":return e.stop()}}),e,this,[[16,27]])}))),function(e,t,r,n){return xe.apply(this,arguments)})},{key:"leaveRoom",value:(Oe=s(regeneratorRuntime.mark((function e(){var t,r,n,i=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=i.length>0&&void 0!==i[0]&&i[0],dY.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 Oe.apply(this,arguments)})},{key:"destroy",value:function(){var e,t,r,n,i,o;dY.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=[gF],this._screenStreamEncodeConfig=[yF],this._pauseAllSubscribeState={audio:!1,video:!1},this._messageStatisticsObserver.destroy(),clearInterval(this._audioVolumeIndicationTimer),clearInterval(this._dummyTimer),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._localAudioTrackVolume=100,this._localScreenAudioTrackVolume=100,null===(n=this._remoteAudioTrackVolumeMap)||void 0===n||n.clear(),null===(i=this._remoteScreenAudioTrackVolumeMap)||void 0===i||i.clear(),null===(o=this._remotePublicAudioTrackVolumeMap)||void 0===o||o.clear()}},{key:"publishStream",value:(Ce=s(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return dY.print("publishStream()","mediaType: %o",t),this._checkMediaType(t),this._assertNotInRoom(),FP(t)&&!this._localVideoTrack&&this._localImgVideoTrack&&(this._localVideoTrack=(r=this._localImgVideoTrack,new wj(r,kP())),this._localVideoTrack.dummy=!0),e.next=6,this._updatePublish({mediaType:t});case 6:case"end":return e.stop()}var r}),e,this)}))),function(e){return Ce.apply(this,arguments)})},{key:"unpublishStream",value:(we=s(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(dY.print("unpublishStream()","mediaType: %o",t),this._checkMediaType(t),this._assertNotInRoom(),!r){e.next=5;break}return e.abrupt("return",this._room.unpublish());case 5:return e.next=7,this._updatePublish({mediaType:t,pubState:nG.UNPUB});case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return we.apply(this,arguments)})},{key:"publishScreen",value:(Ae=s(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return dY.print("publishScreen()","mediaType: %o",t),this._checkMediaType(t),this._assertNotInRoom(),e.prev=3,FP(t)&&!this._localScreenVideoTrack&&this._localImgScreenTrack&&(this._localScreenVideoTrack=(r=this._localImgScreenTrack,new Cj(r,kP())),this._localScreenVideoTrack.dummy=!0),e.next=7,this._updateScreenPublish({mediaType:t,pubState:nG.PUB});case 7:e.next=16;break;case 9:if(e.prev=9,e.t0=e.catch(3),!(e.t0 instanceof lD)){e.next=15;break}throw e.t0;case 15:throw new lD(cD.UNEXPECTED_ERROR,"unexpected error",e.t0);case 16:case"end":return e.stop()}var r}),e,this,[[3,9]])}))),function(e){return Ae.apply(this,arguments)})},{key:"unpublishScreen",value:(Ie=s(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return dY.print("unpublishScreen()","mediaType: %o",t),this._checkMediaType(t),this._assertNotInRoom(),e.next=5,this._updateScreenPublish({mediaType:t,pubState:nG.UNPUB});case 5:case"end":return e.stop()}}),e,this)}))),function(e){return Ie.apply(this,arguments)})},{key:"subscribeStream",value:(Te=s(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return dY.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 Te.apply(this,arguments)})},{key:"_subscribe",value:(Re=s(regeneratorRuntime.mark((function e(t,r,n){var i,o,a,s,u,c,d,l,h,f;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._checkMediaType(n),this._assertNotInRoom(),s=this._room.remoteStreams.get(r),u=null==s?void 0:s.find((function(e){return e.isScreen===t}))){e.next=6;break}throw new lD(cD.STREAM_NOT_EXIST,"stream not exist");case 6:return this._pauseAllSubscribeState.audio&&(n-=n&U.AUDIO),this._pauseAllSubscribeState.video&&(n-=n&U.VIDEO),dY.print("subscribeStream()","due to pauseAll mediaType: %o",n),c=u.hasSubscribed,d=this._remoteVideoConfig.get(r)||(null===(i=this._roomConfig)||void 0===i?void 0:i.remoteVideoConfig),u.originalMediaType=n,e.next=14,this._room.subscribe(u,n,d);case 14:VP(n)&&this._updateAudioPlayerState(u),FP(n)&&this._updateVideoPlayerState(u),!t&&(null!==(o=this._roomConfig)&&void 0!==o&&o.isAutoSubscribeAudio||null!==(a=this._roomConfig)&&void 0!==a&&a.isAutoSubscribeVideo)&&(u.audioTrack||u.videoTrack)&&(l={userId:r,isScreen:!1,state:x.SUBSCRIBE_SUCC},this.safeEmit(re.onAutoSubscribeResult,l)),!c&&VP(n)&&u.hasAudio&&(null===(h=u.observer)||void 0===h||h.setSubscribeAudio(!0)),!c&&FP(n)&&u.hasVideo&&(null===(f=u.observer)||void 0===f||f.setSubscribeVideo(!0));case 19:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return Re.apply(this,arguments)})},{key:"unsubscribeStream",value:(ke=s(regeneratorRuntime.mark((function e(t,r){var n,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(dY.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 lD(cD.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 ke.apply(this,arguments)})},{key:"subscribeScreen",value:(Ee=s(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return dY.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 Ee.apply(this,arguments)})},{key:"unsubscribeScreen",value:(be=s(regeneratorRuntime.mark((function e(t,r){var n,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(dY.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 lD(cD.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 be.apply(this,arguments)})},{key:"setRemoteVideoConfig",value:(Se=s(regeneratorRuntime.mark((function e(t,r){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return dY.print("setRemoteVideoConfig() userId: %o, remoteVideoConfig: %o",t,r),ZP(t),oM(r),this._remoteVideoConfig.set(t,r),e.abrupt("return",null===(n=this._room)||void 0===n?void 0:n.updateSubVideoConfig(t,r).then((function(){})));case 5:case"end":return e.stop()}}),e,this)}))),function(e,t){return Se.apply(this,arguments)})},{key:"startVideoCapture",value:(ye=s(regeneratorRuntime.mark((function e(t){var r,n,i,o,a,s,u,c,d,l=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(dY.print("startVideoCapture()","deviceId: %s",t),JP(t)||zP(t,"deviceId"),t=t||this._localVideoDeviceId,this._localVideoDeviceId=t,!this._localVideoTrack||this._localVideoTrack.dummy){e.next=6;break}throw new lD(cD.REPEAT_CAPTURE,"Has already capture");case 6:return o=this._videoStreamConstraints,t&&("user"===t||"environment"===t||"left"===t||"right"===t?o.facingMode=t:o.deviceId={exact:t},this._videoStreamConstraints=o),e.next=10,Dj(o);case 10:if(a=e.sent,this._initLocalTrackEvents(a),this._localVideoTrack=a,null===(r=this._videoPlayer)||void 0===r||r.playVideo(a),s={},(u=null==a?void 0:a.getTrack())&&(s=u.getSettings(),c={width:s.width,height:s.height},this._localVideoTrack.resolution=c,setTimeout((function(){return l.safeEmit(re.onLocalVideoSizeChanged,{streamIndex:M.STREAM_INDEX_MAIN,info:c})}))),this._room){e.next=19;break}return e.abrupt("return",s);case 19:return d=this._room._roomConfig.isAutoPublish,(this._room.hasPublished||d)&&(this._visibility?this._updatePublish():this.safeEmit(re.onAutoPublishResult,{isScreen:!1,state:N.PUBLISH_FAIL})),null===(n=this._room.localStream)||void 0===n||null===(i=n.observer)||void 0===i||i.setEnableVideo(!0),e.abrupt("return",s);case 23:case"end":return e.stop()}}),e,this)}))),function(e){return ye.apply(this,arguments)})},{key:"stopVideoCapture",value:(ge=s(regeneratorRuntime.mark((function e(){var t,r,n,i,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(dY.print("stopVideoCapture()"),this._trackSourceType.video!==I.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=3;break}throw new lD(cD.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as internal first");case 3:if(null===(t=this._videoPlayer)||void 0===t||t.stop(),null===(r=this._localVideoTrack)||void 0===r||r.close(),this._localImgVideoTrack&&this._localVideoTrack?(null===(o=this._localVideoTrack)||void 0===o||o.setTrack(this._localImgVideoTrack),this._localVideoTrack.dummy=!0):this._localVideoTrack=void 0,this._room){e.next=8;break}return e.abrupt("return");case 8:if(!this._room.hasPublished){e.next=11;break}return e.next=11,this._updatePublish();case 11:null===(n=this._room.localStream)||void 0===n||null===(i=n.observer)||void 0===i||i.setEnableVideo(!1);case 12:case"end":return e.stop()}}),e,this)}))),function(){return ge.apply(this,arguments)})},{key:"startAudioCapture",value:(me=s(regeneratorRuntime.mark((function e(t){var r,n,i,o,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(dY.print("startAudioCapture()","deviceId: $o",t),JP(t)||zP(t,"deviceId"),t=t||this._localAudioDeviceId,this._localAudioDeviceId=t,!this._localAudioTrack){e.next=6;break}throw new lD(cD.REPEAT_CAPTURE,"Has already capture");case 6:return i=this._audioStreamConstraints,t&&(i.deviceId={exact:t},this._audioStreamConstraints=i),e.next=10,Mj(i,this._audioProfileManager);case 10:if(o=e.sent,this._initLocalTrackEvents(o),this._localAudioTrack=o,this._tempMixingAudioTrack&&(this._localAudioTrack.mixType=this._tempMixingAudioTrack.type,this._localAudioTrack.mixedAudioTrack=this._tempMixingAudioTrack.track,delete this._tempMixingAudioTrack),void 0!==this._localAudioTrackVolume&&this._localAudioTrack.setCaptureVolume(this._localAudioTrackVolume),this._room){e.next=17;break}return e.abrupt("return");case 17:a=this._room._roomConfig.isAutoPublish,(this._room.hasPublished||a)&&(this._visibility?this._updatePublish():this.safeEmit(re.onAutoPublishResult,{isScreen:!1,state:N.PUBLISH_FAIL})),null===(r=this._room.localStream)||void 0===r||null===(n=r.observer)||void 0===n||n.setEnableAudio(!0);case 20:case"end":return e.stop()}}),e,this)}))),function(e){return me.apply(this,arguments)})},{key:"stopAudioCapture",value:(ve=s(regeneratorRuntime.mark((function e(){var t,r,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(dY.print("stopAudioCapture()"),null===(t=this._localAudioTrack)||void 0===t||t.close(),this._localAudioTrack=void 0,this._audioMixingManager.stopAll(),this._trackSourceType.audio!==A.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=6;break}throw new lD(cD.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");case 6:if(this._room){e.next=8;break}return e.abrupt("return");case 8:if(!this._room.hasPublished){e.next=11;break}return e.next=11,this._updatePublish();case 11:null===(r=this._room.localStream)||void 0===r||null===(n=r.observer)||void 0===n||n.setEnableAudio(!1);case 12:case"end":return e.stop()}}),e,this)}))),function(){return ve.apply(this,arguments)})},{key:"getAudioMixingManager",value:function(){return dY.print("getAudioMixingManager()"),this._audioMixingManager}},{key:"startScreenCapture",value:(_e=s(regeneratorRuntime.mark((function e(){var t,r,n,i,o,a,s,u,c,d,l,h,f,p,_,v=this,m=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=m.length>0&&void 0!==m[0]?m[0]:{},dY.print("startScreenCapture()","config: %o",a),null!==(t=this._localScreenVideoTrack)&&void 0!==t&&t.dummy||null===(s=this._localScreenVideoTrack)||void 0===s||s.close(),this._localScreenVideoTrack=void 0,u=a.enableAudio,c=void 0!==u&&u,this._trackSourceType.screenVideo!==I.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=7;break}throw new lD(cD.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as internal first");case 7:if(this._trackSourceType.screenAudio!==A.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=9;break}throw new lD(cD.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");case 9:return e.next=11,Lj(c,this._screenStreamEncodeConfig[0]);case 11:if(d=e.sent,this._localScreenVideoTrack=new Cj(d.getVideoTracks()[0],kP()),null!==(r=this._screenStreamEncodeConfig[0])&&void 0!==r&&r.contentHint&&this._localScreenVideoTrack.setContentHint(null===(l=this._screenStreamEncodeConfig[0])||void 0===l?void 0:l.contentHint),(h=null===(n=this._localScreenVideoTrack)||void 0===n?void 0:n.getTrack())&&(f=h.getSettings(),p={width:f.width,height:f.height},this._localScreenVideoTrack.resolution=p,setTimeout((function(){return v.safeEmit(re.onLocalVideoSizeChanged,{streamIndex:M.STREAM_INDEX_SCREEN,info:{width:f.width,height:f.height}})}))),(_=d.getAudioTracks()).length&&(this._localScreenAudioTrack=new Oj(_[0],kP()),this._initLocalTrackEvents(this._localScreenAudioTrack),void 0!==this._localScreenAudioTrackVolume&&this._localScreenAudioTrack.setCaptureVolume(this._localScreenAudioTrackVolume)),null===(i=this._screenPlayer)||void 0===i||i.playVideo(this._localScreenVideoTrack),this._initLocalTrackEvents(this._localScreenVideoTrack,!0),null===(o=this._room)||void 0===o||!o.hasScreenPublished){e.next=23;break}return e.next=23,this._updateScreenPublish();case 23:case"end":return e.stop()}}),e,this)}))),function(){return _e.apply(this,arguments)})},{key:"stopScreenCapture",value:(pe=s(regeneratorRuntime.mark((function e(){var t,r,n,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(dY.print("stopScreenCapture()"),null===(t=this._screenPlayer)||void 0===t||t.stop(),null===(r=this._localScreenVideoTrack)||void 0===r||r.close(),this._localImgScreenTrack&&this._localScreenVideoTrack?(this._localScreenVideoTrack.setTrack(this._localImgScreenTrack),this._localScreenVideoTrack.dummy=!0):this._localScreenVideoTrack=void 0,null===(n=this._localScreenAudioTrack)||void 0===n||n.close(),this._localScreenAudioTrack=void 0,null===(i=this._room)||void 0===i||!i.hasScreenPublished){e.next=9;break}return e.next=9,this._updateScreenPublish();case 9:case"end":return e.stop()}}),e,this)}))),function(){return pe.apply(this,arguments)})},{key:"setLocalVideoPlayer",value:function(e,t){if(dY.print("setLocalVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",e,t),KP(e,"streamIndex",[M.STREAM_INDEX_MAIN,M.STREAM_INDEX_SCREEN]),t&&t.renderDom){var r,n,o=i({userId:this._getUserId()},t);if(rM(o),e===M.STREAM_INDEX_MAIN&&!this._videoPlayer)return this._videoPlayer=new eH(o),this._initPlayerEvents(this._videoPlayer),this._videoPlayer.mirror(!!this._mirrorType),this._localVideoTrack&&!this._localVideoTrack.dummy&&(null===(r=this._config)||void 0===r?void 0:r.autoPlayPolicy)!==J.PLAY_MANUALLY&&this._videoPlayer.playVideo(this._localVideoTrack),this._videoPlayer.domElement;if(e===M.STREAM_INDEX_SCREEN&&!this._screenPlayer)return this._screenPlayer=new eH(i(i({},o),{},{isScreen:!0})),this._initPlayerEvents(this._screenPlayer),this._localScreenVideoTrack&&!this._localScreenVideoTrack.dummy&&(null===(n=this._config)||void 0===n?void 0:n.autoPlayPolicy)!==J.PLAY_MANUALLY&&this._screenPlayer.playVideo(this._localScreenVideoTrack),this._screenPlayer.domElement}else{var a,s;e===M.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:(fe=s(regeneratorRuntime.mark((function e(t){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return dY.print("startLiveTranscoding()","transcode: %o",t),zP(t.url,"liveTranscode.url"),this._liveTranscodeConfig=t,e.prev=3,this.safeEmit(re.onStreamMixingEvent,{event:rG.START,error:0,message:""}),e.next=7,null===(r=this._room)||void 0===r?void 0:r.liveControlMessage(pF("started",this._liveTranscodeConfig));case 7:e.next=16;break;case 9:if(e.prev=9,e.t0=e.catch(3),!(e.t0 instanceof lD)){e.next=15;break}throw e.t0;case 15:throw new lD(cD.UNEXPECTED_ERROR,"unexpected error",e.t0);case 16:case"end":return e.stop()}}),e,this,[[3,9]])}))),function(e){return fe.apply(this,arguments)})},{key:"updateLiveTranscoding",value:(he=s(regeneratorRuntime.mark((function e(t){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(dY.print("updateLiveTranscoding()","transcode: %o",t),this._liveTranscodeConfig){e.next=3;break}return e.abrupt("return");case 3:return this._liveTranscodeConfig=Tz(this._liveTranscodeConfig,t),e.prev=4,this.safeEmit(re.onStreamMixingEvent,{event:rG.UPDATE,error:0,message:""}),e.next=8,null===(r=this._room)||void 0===r?void 0:r.liveControlMessage(pF("layoutChanged",this._liveTranscodeConfig));case 8:e.next=17;break;case 10:if(e.prev=10,e.t0=e.catch(4),!(e.t0 instanceof lD)){e.next=16;break}throw e.t0;case 16:throw new lD(cD.UNEXPECTED_ERROR,"unexpected error",e.t0);case 17:case"end":return e.stop()}}),e,this,[[4,10]])}))),function(e){return he.apply(this,arguments)})},{key:"stopLiveTranscoding",value:(le=s(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(dY.print("stopLiveTranscoding()"),this._liveTranscodeConfig){e.next=3;break}return e.abrupt("return");case 3:return delete this._liveTranscodeConfig,e.prev=4,this.safeEmit(re.onStreamMixingEvent,{event:rG.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 lD)){e.next=16;break}throw e.t0;case 16:throw new lD(cD.UNEXPECTED_ERROR,"unexpected error",e.t0);case 17:case"end":return e.stop()}}),e,this,[[4,10]])}))),function(){return le.apply(this,arguments)})},{key:"setBusinessId",value:function(e){return dY.print("setBusinessId()","businessId: %s",e),!function(e){return"string"!=typeof e}(e)&&!this._room&&(KV.setStats({rtc_business_id:e}),this._businessId=e,!0)}},{key:"setUserVisibility",value:(de=s(regeneratorRuntime.mark((function e(t){var r,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(dY.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===OG.CONNECTED){e.next=9;break}throw new lD(cD.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?QX.NORMAL_USER:QX.SILENT_USER});case 16:this._visibility=t,t&&null!==(r=this._roomConfig)&&void 0!==r&&r.isAutoPublish&&this._updatePublish({mediaType:U.AUDIO_AND_VIDEO});case 18:case"end":return e.stop()}}),e,this)}))),function(e){return de.apply(this,arguments)})},{key:"_initPlayerEvents",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];e.on("playback_event",(function(n){switch(n.eventName){case"timeupdate":return;case"loadeddata":if("audio"===n.type)r?t.safeEmit(re.onFirstPublicStreamAudioFrameDecoded,{publicStreamId:e.userId}):t.safeEmit(re.onAudioFirstFrameDecoded,{userId:e.userId}),GV.firstRemoteAudioRender("",n.userId||"");else{var i,o,a={userId:e.userId,height:(null===(i=e.domElement)||void 0===i?void 0:i.videoHeight)||0,width:(null===(o=e.domElement)||void 0===o?void 0:o.videoWidth)||0};r?(a.publicStreamId=a.userId,delete a.userId,t.safeEmit(re.onFirstPublicStreamVideoFrameDecoded,a),t.safeEmit(re.onFirstPublicStreamVideoFrameRendered,a)):(t.safeEmit(re.onVideoFirstFrameDecoded,a),t.safeEmit(re.onVideoFirstFrameRendered,a)),GV.firstRemoteVideoRender("",n.userId||"")}break;case"autoplay-error":return r&&(n.publicStreamId=n.userId),void t.safeEmit(re.onAutoplayFailed,{userId:n.userId||n.publicStreamId,kind:e instanceof eH?"video":"audio"})}t.safeEmit(re.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(re.onTrackEnded,{kind:e.getTrack().kind,isScreen:r})})),e.on("resolution-change",(function(e){t.safeEmit(re.onLocalVideoSizeChanged,{streamIndex:r?M.STREAM_INDEX_SCREEN:M.STREAM_INDEX_MAIN,info:e})}))}},{key:"setRemoteVideoPlayer",value:function(e,t){dY.print("setRemoteVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",e,t),KP(e,"streamIndex",[M.STREAM_INDEX_MAIN,M.STREAM_INDEX_SCREEN]),rM(t);var r,n,o,a=t.userId;if(e===M.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 eH(t);this._initPlayerEvents(d),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 eH(i(i({},t),{},{isScreen:!0}));this._remoteScreenPlayer.set(a,h),this._initPlayerEvents(h);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){dY.print("setLocalVideoMirrorType()","mirrorType: %o",e),KP(e,"mirrorType",[F.MIRROR_TYPE_NONE,F.MIRROR_TYPE_RENDER]),this._mirrorType=e,this._videoPlayer&&this._videoPlayer.mirror(!!e)}},{key:"setAudioPlaybackDevice",value:(ce=s(regeneratorRuntime.mark((function e(t){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(dY.print("setAudioPlaybackDevice()","deviceId: %s",t),zP(t,"deviceId"),void 0!==HTMLAudioElement.prototype.setSinkId){e.next=5;break}return dY.print("setAudioPlaybackDevice failed","setSinkId not supported by current browser"),e.abrupt("return");case 5:return e.next=7,hj.getDeviceById(t);case 7:if(r=e.sent){e.next=10;break}throw new lD(cD.INVALID_DEVICE_ID,"audio playback device id ".concat(t," is invalid"));case 10:this._remoteAudioPlayer.forEach((function(e){e.setPlaybackDevice(t)})),this._audioPlaybackDeviceId=t,r&&this.safeEmit(re.onAudioPlaybackDeviceChanged,r),GV.rtcAudioDevice(CV.PLAYOUT_DEVICE_SWITCH,t,0);case 14:case"end":return e.stop()}}),e,this)}))),function(e){return ce.apply(this,arguments)})},{key:"play",value:(ue=s(regeneratorRuntime.mark((function e(t){var r,n,i,o,a,s,u,c,d;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(dY.print("play()","userId | publicStreamId: %s",t),a=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||""),o=this._remoteVideoPlayer.get(t||""),i||(i=this._publicStreamAudioPlayer.get(t||"")),o||(o=this._publicStreamVideoPlayer.get(t||"")),!t&&this._videoPlayer&&(o=this._videoPlayer),o&&(o.played?o.manuallyPlay():a&&a.videoTrack?o.playVideo(a.videoTrack,a):!t&&this._localVideoTrack&&(o.mirror(!!this._mirrorType),o.playVideo(this._localVideoTrack))),i&&(i.played?i.manuallyPlay():null!=a&&a.audioTrack&&(i.playAudio(a.audioTrack),(u=null==a||null===(s=a.audioTrack._audioLevelFetcher)||void 0===s?void 0:s._ctx)&&u.resume())),null!=a&&a.audioTrack&&(d=null==a||null===(c=a.audioTrack._audioLevelFetcher)||void 0===c?void 0:c._ctx)&&"suspended"===d.state&&d.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 ue.apply(this,arguments)})},{key:"pauseAllSubscribedStream",value:(se=s(regeneratorRuntime.mark((function e(t){var r,n=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(dY.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(){VP(t)&&(n._pauseAllSubscribeState.audio=!0),FP(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 se.apply(this,arguments)})},{key:"resumeAllSubscribedStream",value:(ae=s(regeneratorRuntime.mark((function e(t){var r,n=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(dY.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(){VP(t)&&(n._pauseAllSubscribeState.audio=!1),FP(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 ae.apply(this,arguments)})},{key:"sendUserMessage",value:(oe=s(regeneratorRuntime.mark((function e(t,r){var n,i,o=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(ZP(t),nM(r),this._room&&this._room.connectionState===OG.CONNECTED){e.next=4;break}throw new lD(cD.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 o._messageStatisticsObserver.countP2PMessage(!0,t,!1,i,e),e.id})).catch((function(e){throw o._messageStatisticsObserver.countP2PMessage(!1,t,!1,i),e})));case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return oe.apply(this,arguments)})},{key:"sendUserBinaryMessage",value:(ie=s(regeneratorRuntime.mark((function e(t,r){var n,i,o=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(ZP(t),XP(r,"message"),nM(r),this._room&&this._room.connectionState===OG.CONNECTED){e.next=5;break}throw new lD(cD.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 o._messageStatisticsObserver.countP2PMessage(!0,t,!0,i,e),e.id})).catch((function(e){throw o._messageStatisticsObserver.countP2PMessage(!1,t,!0,i),e})));case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return ie.apply(this,arguments)})},{key:"sendRoomMessage",value:(ne=s(regeneratorRuntime.mark((function e(t){var r,n=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(nM(t),this._room&&this._room.connectionState===OG.CONNECTED){e.next=3;break}throw new lD(cD.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 ne.apply(this,arguments)})},{key:"sendRoomBinaryMessage",value:(te=s(regeneratorRuntime.mark((function e(t){var r,n=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(nM(t),this._room&&this._room.connectionState===OG.CONNECTED){e.next=3;break}throw new lD(cD.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 te.apply(this,arguments)})},{key:"setAudioCaptureConfig",value:(ee=s(regeneratorRuntime.mark((function e(){var t,r,n,i=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=i.length>0&&void 0!==i[0]?i[0]:{},dY.print("setAudioCaptureConfig()","config: %o",t),delete t.deviceId,YP(t),r=this._audioStreamConstraints.deviceId,this._audioStreamConstraints=t,r&&(this._audioStreamConstraints.deviceId=r),!this._localAudioTrack){e.next=11;break}return this._localAudioTrack.audioCaptureConfig=this._audioStreamConstraints,e.next=11,null===(n=this._localAudioTrack)||void 0===n?void 0:n.updateAudioCaptureConfig();case 11:case"end":return e.stop()}}),e,this)}))),function(){return ee.apply(this,arguments)})},{key:"setVideoCaptureConfig",value:(Z=s(regeneratorRuntime.mark((function e(){var t,r,n,i=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=i.length>0&&void 0!==i[0]?i[0]:{},dY.print("setVideoCaptureConfig()","config: %o",t),delete t.deviceId,YP(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 Z.apply(this,arguments)})},{key:"enableSimulcastMode",value:function(e){return dY.print("enableSimulcastMode()","enabled: %o",e),this._enableSimulcast=e,!0}},{key:"setVideoEncoderConfig",value:(Q=s(regeneratorRuntime.mark((function e(t){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:dY.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 Q.apply(this,arguments)})},{key:"setScreenEncoderConfig",value:(q=s(regeneratorRuntime.mark((function e(t){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:dY.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 q.apply(this,arguments)})},{key:"sendSEIMessage",value:function(e,t,r){dY.print("sendSEIMessage()","streamIdex: %o, message: %o, repeatCount: %o",e,t,r),KP(e,"streamIndex",[M.STREAM_INDEX_MAIN,M.STREAM_INDEX_SCREEN]),HP(r,"repeatCount",0,30);var n="string"==typeof t?new Uint8Array(AP.str2ab(t)):t;if(t.length){var i;if(e===M.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)dY.print("sei size must not bigger than 4KB");else{var l=kP();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 dY.print("sei message must not be empty")}},{key:"setAudioVolumeIndicationInterval",value:function(e){var t=this;dY.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(re.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>-60){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(re.onActiveSpeaker,{userId:o.userId,extraInfo:o.extraInfo})}}}},{key:"enableAudioPropertiesReport",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};dY.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:M.STREAM_INDEX_MAIN,audioPropertiesInfo:{linearVolume:i,nonlinearVolume:LP(i)}})}if(e._localScreenAudioTrack){var o=e._localScreenAudioTrack.getAudioLevel();t.push({streamIndex:M.STREAM_INDEX_SCREEN,audioPropertiesInfo:{linearVolume:o,nonlinearVolume:LP(o)}})}if(e.safeEmit(re.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?M.STREAM_INDEX_SCREEN:M.STREAM_INDEX_MAIN,roomId:null===(n=e._room)||void 0===n||null===(i=n.roomInfo)||void 0===i?void 0:i.roomId},audioPropertiesInfo:{linearVolume:o,nonlinearVolume:LP(o)}})}}))})),e._sendActiveSpeaker(t,a.filter((function(e){return e.streamKey.streamIndex!==M.STREAM_INDEX_SCREEN}))),e.safeEmit(re.onRemoteAudioPropertiesReport,a)}}}),o))}},{key:"setVideoSourceType",value:(X=s(regeneratorRuntime.mark((function e(t,r){var n,i,o,a,s,u,c,d,l,h,f,p,_,v,m,g,y,S,b,E,k;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(dY.print("setVideoSourceType()","index: %o, videoSourceType: %o",t,r),KP(t,"streamIndex",[M.STREAM_INDEX_MAIN,M.STREAM_INDEX_SCREEN]),KP(r,"VideoSourceType",[I.VIDEO_SOURCE_TYPE_EXTERNAL,I.VIDEO_SOURCE_TYPE_INTERNAL]),n=t===M.STREAM_INDEX_MAIN?"video":"screenVideo",this._trackSourceType[n]===r){e.next=26;break}if(this._trackSourceType[n]=r,dY.print("setVideoSourceType","set ".concat(n," source type to ").concat(r)),!this._localVideoTrack||t!==M.STREAM_INDEX_MAIN){e.next=17;break}if(s=!1,r===I.VIDEO_SOURCE_TYPE_EXTERNAL&&(s=!0,this._localVideoTrack.close()),null===(i=this._videoPlayer)||void 0===i||i.stop(),this._localVideoTrack=void 0,u=null===(o=this._room)||void 0===o?void 0:o._roomConfig.isAutoPublish,s?null===(c=this._room)||void 0===c||null===(d=c.localStream)||void 0===d||null===(l=d.observer)||void 0===l||l.setEnableVideo(!1):null===(h=this._room)||void 0===h||null===(f=h.localStream)||void 0===f||null===(p=f.observer)||void 0===p||p.setPushVideo(!1),!(null!==(a=this._room)&&void 0!==a&&a.hasPublished||u)){e.next=17;break}return e.next=17,this._updatePublish();case 17:if(!this._localScreenVideoTrack||t!==M.STREAM_INDEX_SCREEN){e.next=26;break}if(m=!1,r===I.VIDEO_SOURCE_TYPE_EXTERNAL&&(m=!0,this._localScreenVideoTrack.close()),null===(_=this._screenPlayer)||void 0===_||_.stop(),this._localScreenVideoTrack=void 0,m?null===(g=this._room)||void 0===g||null===(y=g.localScreenStream)||void 0===y||null===(S=y.observer)||void 0===S||S.setEnableVideo(!1):null===(b=this._room)||void 0===b||null===(E=b.localScreenStream)||void 0===E||null===(k=E.observer)||void 0===k||k.setPushVideo(!1),null===(v=this._room)||void 0===v||!v.hasScreenPublished){e.next=26;break}return e.next=26,this._updateScreenPublish();case 26:case"end":return e.stop()}}),e,this)}))),function(e,t){return X.apply(this,arguments)})},{key:"setExternalVideoTrack",value:(W=s(regeneratorRuntime.mark((function e(t,r){var n,i,o,a,s,u,c,d,l;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(dY.print("setExternalVideoTrack()","index: %o, track: %o",t,r),KP(t,"streamIndex",[M.STREAM_INDEX_MAIN,M.STREAM_INDEX_SCREEN]),t!==M.STREAM_INDEX_MAIN){e.next=12;break}if(this._trackSourceType.video===I.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=5;break}throw new lD(cD.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as external first");case 5:if(this._localVideoTrack=new xj(r,kP()),this._initLocalTrackEvents(this._localVideoTrack),null===(n=this._videoPlayer)||void 0===n||n.playVideo(this._localVideoTrack),a=null===(i=this._room)||void 0===i?void 0:i._roomConfig.isAutoPublish,!(null!==(o=this._room)&&void 0!==o&&o.hasPublished||a)){e.next=12;break}return e.next=12,this._updatePublish();case 12:if(t!==M.STREAM_INDEX_SCREEN){e.next=22;break}if(this._trackSourceType.screenVideo===I.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=15;break}throw new lD(cD.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as external first");case 15:if(this._localScreenVideoTrack=new xj(r,kP()),this._initLocalTrackEvents(this._localScreenVideoTrack,!0),null===(s=this._screenPlayer)||void 0===s||s.playVideo(this._localScreenVideoTrack),null===(u=this._room)||void 0===u||null===(c=u.localScreenStream)||void 0===c||null===(d=c.observer)||void 0===d||d.setPushVideo(!0),null===(l=this._room)||void 0===l||!l.hasScreenPublished){e.next=22;break}return e.next=22,this._updateScreenPublish();case 22:case"end":return e.stop()}}),e,this)}))),function(e,t){return W.apply(this,arguments)})},{key:"setAudioSourceType",value:(H=s(regeneratorRuntime.mark((function e(t,r){var n,i,o,a,s,u,c,d,l,h,f,p,_,v,m,g,y,S,b;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(dY.print("setAudioSourceType()","index: %o, audioSourceType: %o",t,r),KP(t,"streamIndex",[M.STREAM_INDEX_MAIN,M.STREAM_INDEX_SCREEN]),KP(r,"audioSourceType",[A.AUDIO_SOURCE_TYPE_EXTERNAL,A.AUDIO_SOURCE_TYPE_INTERNAL]),n=t===M.STREAM_INDEX_MAIN?"audio":"screenAudio",this._trackSourceType[n]===r){e.next=24;break}if(this._trackSourceType[n]=r,dY.print("setVideoSourceType","set ".concat(n," source type to ").concat(r)),!this._localAudioTrack||t!==M.STREAM_INDEX_MAIN){e.next=16;break}if(a=!1,this._trackSourceType.audio===A.AUDIO_SOURCE_TYPE_EXTERNAL&&(a=!0,this._localAudioTrack.close()),this._localAudioTrack=void 0,s=null===(i=this._room)||void 0===i?void 0:i._roomConfig.isAutoPublish,a?null===(u=this._room)||void 0===u||null===(c=u.localStream)||void 0===c||null===(d=c.observer)||void 0===d||d.setEnableAudio(!1):null===(l=this._room)||void 0===l||null===(h=l.localStream)||void 0===h||null===(f=h.observer)||void 0===f||f.setPushAudio(!1),!(null!==(o=this._room)&&void 0!==o&&o.hasPublished||s)){e.next=16;break}return e.next=16,this._updatePublish();case 16:if(!this._localScreenAudioTrack||t!==M.STREAM_INDEX_SCREEN){e.next=24;break}if(_=!1,this._trackSourceType.audio===A.AUDIO_SOURCE_TYPE_EXTERNAL&&(_=!0,this._localScreenAudioTrack.close()),this._localScreenAudioTrack=void 0,_?null===(v=this._room)||void 0===v||null===(m=v.localScreenStream)||void 0===m||null===(g=m.observer)||void 0===g||g.setEnableAudio(!1):null===(y=this._room)||void 0===y||null===(S=y.localScreenStream)||void 0===S||null===(b=S.observer)||void 0===b||b.setPushAudio(!1),null===(p=this._room)||void 0===p||!p.hasScreenPublished){e.next=24;break}return e.next=24,this._updateScreenPublish();case 24:case"end":return e.stop()}}),e,this)}))),function(e,t){return H.apply(this,arguments)})},{key:"setExternalAudioTrack",value:(G=s(regeneratorRuntime.mark((function e(t,r){var n,i,o,a,s,u,c,d,l,h;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(dY.print("setExternalAudioTrack()","index: %o, track: %o",t,r),KP(t,"streamIndex",[M.STREAM_INDEX_MAIN,M.STREAM_INDEX_SCREEN]),t!==M.STREAM_INDEX_MAIN){e.next=12;break}if(this._trackSourceType.audio===A.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=5;break}throw new lD(cD.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as external first");case 5:if(this._localAudioTrack=new Nj(r,kP()),this._initLocalTrackEvents(this._localAudioTrack),u=null===(n=this._room)||void 0===n?void 0:n._roomConfig.isAutoPublish,null===(i=this._room)||void 0===i||null===(o=i.localStream)||void 0===o||null===(a=o.observer)||void 0===a||a.setPushAudio(!0),!(null!==(s=this._room)&&void 0!==s&&s.hasPublished||u)){e.next=12;break}return e.next=12,this._updatePublish();case 12:if(t!==M.STREAM_INDEX_SCREEN){e.next=21;break}if(this._trackSourceType.screenAudio===A.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=15;break}throw new lD(cD.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as external first");case 15:if(this._localScreenAudioTrack=new Nj(r,kP()),this._initLocalTrackEvents(this._localScreenAudioTrack),null===(c=this._room)||void 0===c||null===(d=c.localScreenStream)||void 0===d||null===(l=d.observer)||void 0===l||l.setPushAudio(!0),null===(h=this._room)||void 0===h||!h.hasScreenPublished){e.next=21;break}return e.next=21,this._updateScreenPublish();case 21:case"end":return e.stop()}}),e,this)}))),function(e,t){return G.apply(this,arguments)})},{key:"login",value:(j=s(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return dY.print("login()","token: %o, userInfo: %o",t,r),JP(t)||zP(t,"token"),ZP(r),e.abrupt("return",this._rtmClient.login(t,r));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return j.apply(this,arguments)})},{key:"logout",value:(B=s(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return dY.print("logout()"),e.abrupt("return",this._rtmClient.logout());case 2:case"end":return e.stop()}}),e,this)}))),function(){return B.apply(this,arguments)})},{key:"updateLoginToken",value:(P=s(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return dY.print("updateLoginToken()","token: %o",t),JP(t)||zP(t,"token"),e.abrupt("return",this._rtmClient.updateLoginToken(t));case 3:case"end":return e.stop()}}),e,this)}))),function(e){return P.apply(this,arguments)})},{key:"getPeerOnlineStatus",value:(D=s(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return dY.print("getPeerOnlineStatus()","userId: %o",t),ZP(t),e.abrupt("return",this._rtmClient.getPeerOnlineStatus(t));case 3:case"end":return e.stop()}}),e,this)}))),function(e){return D.apply(this,arguments)})},{key:"sendUserMessageOutsideRoom",value:(O=s(regeneratorRuntime.mark((function e(t,r){var n,i=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return ZP(t),nM(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 O.apply(this,arguments)})},{key:"sendUserBinaryMessageOutsideRoom",value:(C=s(regeneratorRuntime.mark((function e(t,r){var n,i=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return ZP(t),XP(r,"message"),nM(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 C.apply(this,arguments)})},{key:"setServerParams",value:(w=s(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return dY.print("setServerParams()","signature: %o, url: %0",t,r),zP(t,"signature"),zP(r,"url"),e.abrupt("return",this._rtmClient.setServerParams(t,r));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return w.apply(this,arguments)})},{key:"sendServerMessage",value:(T=s(regeneratorRuntime.mark((function e(t){var r,n=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return zP(t,"message"),nM(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 T.apply(this,arguments)})},{key:"sendServerBinaryMessage",value:(R=s(regeneratorRuntime.mark((function e(t){var r,n=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return XP(t,"message"),nM(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 R.apply(this,arguments)})},{key:"startCloudProxy",value:function(e){if(this._room)throw new lD(cD.START_CLOUD_PROXY_AFTER_JOIN,"[startCloudProxy] should be invoke before join room ");dY.print("startCloudProxy()",e),zP(e.logProxy,"logProxy"),zP(e.accessProxy,"accessProxy"),zP(e.configProxy,"configProxy"),this._originIceConfigRequestUrls=fF("ICE_CONFIG_REQUEST_URLS"),this._originLogServerUrl=fF("LOG_SERVER_URL"),this._originConfigServerUrls=fF("CONFIG_REQUEST_DOMAINS"),hF("ICE_CONFIG_REQUEST_URLS",e.accessProxy),hF("LOG_SERVER_URL",function(){return"https://".concat(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"","/video/v1/webrtc_log/")}(e.logProxy)),hF("CONFIG_REQUEST_DOMAINS",[e.configProxy]),this._useCloudProxy=!0}},{key:"stopCloudProxy",value:function(){if(this._room)throw new lD(cD.STOP_CLOUD_PROXY_BEFORE_LEAVE,"[stopCloudProxy] should be invoke after leave room ");dY.print("stopCloudProxy()"),hF("ICE_CONFIG_REQUEST_URLS",[]),hF("LOG_SERVER_URL",this._originLogServerUrl),hF("CONFIG_REQUEST_DOMAINS",this._originConfigServerUrls),this._useCloudProxy=!1,this._startCloudProxyTimestamp=void 0}},{key:"startPushPublicStream",value:(k=s(regeneratorRuntime.mark((function e(t,r){var n,i=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(dY.print("startPushPublicStream()","publicStreamId: %o, publicStreamParam: %o",t,r),$P(t),this._room&&this._room.connectionState===OG.CONNECTED){e.next=4;break}throw new lD(cD.START_PUBLIC_STREAM_BEFORE_JOIN,"join first");case 4:if(!this._publicStreamIds.get(t)){e.next=6;break}throw new lD(cD.REPEAT_PUSH,"repeat push public media stream");case 6:return n=_F(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 k.apply(this,arguments)})},{key:"updatePublicStreamParam",value:(E=s(regeneratorRuntime.mark((function e(t,r){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(dY.print("startPushPublicStream()","publicStreamId: %o, publicStreamParam: %o",t,r),$P(t),this._room&&this._room.connectionState===OG.CONNECTED){e.next=4;break}throw new lD(cD.START_PUBLIC_STREAM_BEFORE_JOIN,"join first");case 4:return n=_F(t,"layoutChanged",r),e.abrupt("return",this._room.publicStreamControlMessage(n));case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return E.apply(this,arguments)})},{key:"stopPushPublicStream",value:(b=s(regeneratorRuntime.mark((function e(t){var r=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(dY.print("startPushPublicStream()","publicStreamId: %o",t),$P(t),this._room&&this._room.connectionState===OG.CONNECTED){e.next=4;break}throw new lD(cD.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 b.apply(this,arguments)})},{key:"startPlayPublicStream",value:(y=s(regeneratorRuntime.mark((function e(t){var r,n,i,o,a,s,u=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if($P(t),this._outsideRoom){e.next=8;break}return this._outsideRoom=new eY(this._appId),this._outsideRoom.on(tG.RESUBSCRIBE,(function(e){var t=e.stream;if(t){var r,n=u._publicStreamAudioPlayer.get(t.streamId);n&&t.audioTrack&&(n.stop(),n.playAudio(null===(r=e.stream)||void 0===r?void 0:r.audioTrack));var i,o=u._publicStreamVideoPlayer.get(t.streamId);o&&t.videoTrack&&o.playVideo(null===(i=e.stream)||void 0===i?void 0:i.videoTrack)}})),null===(r=this._outsideRoom)||void 0===r||r.on("onRemoteStreamStats",(function(e){e.publicStreamId=e.userId,delete e.userId,delete e.isScreen,u.safeEmit(re.onPublicStreamStats,e)})),null===(n=this._outsideRoom)||void 0===n||n.on(tG.ON_SEI_MESSAGED_RECEIVED,(function(e){u.safeEmit(re.onPublicStreamSEIMessageReceived,e)})),e.next=8,this._outsideRoom.connect();case 8:return e.next=10,this._outsideRoom.startPlayPublicStream(t);case 10:i=e.sent,(o=this._publicStreamVideoPlayer.get(t))&&null!=i&&i.videoTrack&&o.playVideo(i.videoTrack,i),!(a=this._publicStreamAudioPlayer.get(t))&&null!=i&&i.audioTrack&&(a=new tH(t,{muted:(null===(s=this._config)||void 0===s?void 0:s.autoPlayPolicy)===J.VIDEO_ONLY}),this._initPlayerEvents(a,!0),a.playAudio(i.audioTrack),this._publicStreamAudioPlayer.set(t,a));case 15:case"end":return e.stop()}}),e,this)}))),function(e){return y.apply(this,arguments)})},{key:"stopPlayPublicStream",value:(m=s(regeneratorRuntime.mark((function e(t){var r;return regeneratorRuntime.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 m.apply(this,arguments)})},{key:"setAudioProfile",value:(_=s(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.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 _.apply(this,arguments)})},{key:"setPublicStreamVideoPlayer",value:function(e,t){var r,n,o,a;dY.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 eH(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)!==J.PLAY_MANUALLY&&s.playVideo(u.videoTrack,u)}else this._publicStreamVideoPlayer.delete(e)}},{key:"setDummyCaptureImagePath",value:(p=s(regeneratorRuntime.mark((function e(t,r){var n=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e,i){zP(r,"filePath");var o=new Image;o.crossOrigin="anonymous",o.src=r,o.onload=function(){try{var r=document.createElement("canvas"),a=r.getContext("2d");if(!a)return i(new lD(cD.UNEXPECTED_ERROR,"Not support canvas"));r.width=o.width,r.height=o.height,a.drawImage(o,0,0,o.width,o.height),clearInterval(n._dummyTimer),n._dummyTimer=window.setInterval((function(){a.drawImage(o,0,0,o.width,o.height)}),200);var s=r.captureStream(5).getVideoTracks()[0];t===M.STREAM_INDEX_MAIN?n._localImgVideoTrack=s:n._localImgScreenTrack=s,e()}catch(u){i(new lD(cD.UNEXPECTED_ERROR,u.message))}},o.onerror=function(){i(new lD(cD.UNEXPECTED_ERROR,"Load image error"))}})));case 1:case"end":return e.stop()}}),e)}))),function(e,t){return p.apply(this,arguments)})},{key:"defaultTranscoding",value:function(){return JSON.parse(JSON.stringify(mF))}},{key:"_updatePublish",value:(c=s(regeneratorRuntime.mark((function e(){var t,r,n,o=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=o.length>0&&void 0!==o[0]?o[0]:{},dY.print("_updatePublish()","config: %o",t),r={mediaType:void 0,invokeByJoinRoom:!1,pubState:nG.PUB},t=i(i({},r),t),this._visibility){e.next=6;break}throw new lD(cD.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===OG.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 lD)){e.next=23;break}throw e.t0;case 23:throw new lD(cD.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 c.apply(this,arguments)})},{key:"startAudioPlaybackDeviceTest",value:(a=s(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return dY.print("startAudioPlaybackDeviceTest()","filePath: %o, indicationInterval: %o",t,r),zP(t,"filePath"),HP(r,"indicationInterval"),e.next=5,this._audioDeviceManager.startAudioPlaybackDeviceTest(t,r);case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return a.apply(this,arguments)})},{key:"stopAudioPlaybackDeviceTest",value:function(){dY.print("stopAudioPlaybackDeviceTest()"),this._audioDeviceManager.stopAudioPlaybackDeviceTest()}},{key:"startAudioDeviceRecordTest",value:(o=s(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return dY.print("startAudioDeviceRecordTest()","indicationInterval: %o",t),HP(t,"indicationInterval"),e.next=4,this._audioDeviceManager.startAudioDeviceRecordTest(t);case 4:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"stopAudioDeviceRecordAndPlayTest",value:function(){dY.print("stopAudioDeviceRecordAndPlayTest()"),this._audioDeviceManager.stopAudioDeviceRecordAndPlayTest()}},{key:"stopAudioDevicePlayTest",value:function(){dY.print("stopAudioDevicePlayTest()"),this._audioDeviceManager.stopAudioDevicePlayTest()}},{key:"setRemoteUserPriority",value:function(e,t){var r;dY.print("setRemoteUserPriority()","userId: %o, priority: %o",e,t);try{ZP(e),KP(t,"priority",[K.HIGH,K.MEDIUM,K.LOW])}catch(n){return console.warn(n),!1}return this._userPriorityMap.set(e,t),null===(r=this._room)||void 0===r||r.setRemoteUserPriority(e,t),!0}},{key:"takeLocalSnapshot",value:(n=s(regeneratorRuntime.mark((function e(t){var r,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(dY.print("takeLocalSnapshot()","streamIndex: %o",t),KP(t,"streamIndex",[M.STREAM_INDEX_MAIN,M.STREAM_INDEX_SCREEN]),r=t===M.STREAM_INDEX_MAIN?this.localVideoTrack:this.localScreenVideoTrack){e.next=5;break}throw new lD(cD.INVOKED_BEFORE_CAPTURE,"capture first");case 5:return n=t===M.STREAM_INDEX_MAIN?this._videoPlayer:this._screenPlayer,e.abrupt("return",aY(r.getTrack(),(null==n?void 0:n.mirrorType)===F.MIRROR_TYPE_RENDER,n));case 7:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"takeRemoteSnapshot",value:(r=s(regeneratorRuntime.mark((function e(t,r){var n,i,o,a,s,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(dY.print("takeRemoteSnapshot()","id: %o, streamIndex: %o",t,r),zP(t,"id"),KP(r,"streamIndex",[M.STREAM_INDEX_MAIN,M.STREAM_INDEX_SCREEN]),u=(null===(n=this._room)||void 0===n||null===(i=n.remoteStreams.get(t))||void 0===i||null===(o=i.find((function(e){return e.isScreen===(r===M.STREAM_INDEX_SCREEN)})))||void 0===o?void 0:o.videoTrack)||(null===(a=this._outsideRoom)||void 0===a||null===(s=a.remoteStreams.get(t))||void 0===s?void 0:s.videoTrack)){e.next=6;break}throw new lD(cD.STREAM_NOT_EXIST,"stream not exist");case 6:return e.abrupt("return",aY(u.getTrack(),!1,r===M.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){dY.print("setSubscribeFallbackOption()","option: %o",e);try{KP(e,"option",[z.DISABLE,z.VIDEO_STREAM_LOW,z.AUDIO_ONLY])}catch(t){return console.warn(t),!1}return!this._room&&(this._subscribeFallbackOption=e,!0)}},{key:"_updateScreenPublish",value:(t=s(regeneratorRuntime.mark((function e(){var t,r,n,o=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=o.length>0&&void 0!==o[0]?o[0]:{},dY.print("_updateScreenPublish()"),r={mediaType:void 0,pubState:nG.PUB},t=i(i({},r),t),e.next=6,this._pubLock.lock();case 6:if(n=e.sent,this._room&&this._room.connectionState===OG.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 lD)){e.next=21;break}throw e.t0;case 21:throw new lD(cD.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:"_setCaptureVolume",value:function(e,t){var r;0===t&&dY.print("setCaptureVolume: ",t),KP(e,"streamType",[M.STREAM_INDEX_MAIN,M.STREAM_INDEX_SCREEN]),HP(t,"volume",0,400);var n=!1;e===M.STREAM_INDEX_MAIN?(this._localAudioTrack&&(n=!!this._localAudioTrack.gainAudioTrack,this._localAudioTrack.setCaptureVolume(t)),this._localAudioTrackVolume=t):e===M.STREAM_INDEX_SCREEN&&(this._localScreenAudioTrack&&(n=!!this._localScreenAudioTrack.gainAudioTrack,this._localScreenAudioTrack.setCaptureVolume(t)),this._localScreenAudioTrackVolume=t),null!==(r=this._room)&&void 0!==r&&r.hasPublished&&!n&&this._updatePublish()}},{key:"_updateAudioPlayerState",value:function(e){dY.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){var i;if(!t){var o,a=n?"".concat(r,"_screen"):r;t=new tH(a,{muted:(null===(o=this._config)||void 0===o?void 0:o.autoPlayPolicy)===J.VIDEO_ONLY}),this._initPlayerEvents(t),this._remoteAudioPlayer.set(a,t),this._audioPlaybackDeviceId&&t.setPlaybackDevice(this._audioPlaybackDeviceId)}(null===(i=this._config)||void 0===i?void 0:i.autoPlayPolicy)!==J.PLAY_MANUALLY&&t.playAudio(e.audioTrack)}else{var s;null===(s=t)||void 0===s||s.stop()}}},{key:"_updateVideoPlayerState",value:function(e){var t;dY.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)!==J.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=Fj.NONE;if(i&&(s|=U.AUDIO),a&&(s|=U.VIDEO),s){var u;if(null!=t&&t.isScreen)this.safeEmit(re.onUserPublishScreen,{userId:t.userId,mediaType:s});else this.safeEmit(re.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(re.onUserStartAudioCapture,{userId:t.userId}),o&&this.safeEmit(re.onUserStartVideoCapture,{userId:t.userId}))}}},{key:"_handleAutoSubscribe",value:function(e,t){var r,n,i=Fj.NONE;if(null!==(r=this._roomConfig)&&void 0!==r&&r.isAutoSubscribeAudio&&(i|=U.AUDIO),null!==(n=this._roomConfig)&&void 0!==n&&n.isAutoSubscribeVideo&&(i|=U.VIDEO),dY.print("_onAddStream","autoSubType: ".concat(i)),i){var o,a;if(t&&VP(i))null===(o=e.observer)||void 0===o||o.setAutoSubscribeAudio(!0);if(t&&FP(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=hY[e.reason])&&void 0!==t?t:L.STREAM_REMOVE_REASON_OTHER,o=n.isScreen?re.onUserUnpublishScreen:re.onUserUnpublishStream,a=Fj.NONE;n.attributes.audiostream&&(a|=U.AUDIO),n.attributes.videostream&&(a|=U.VIDEO),null!=n&&n._workaround_1_&&(a=U.VIDEO),a!==Fj.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(re.onUserJoined,e)}},{key:"_onUserLeave",value:function(e){this.safeEmit(re.onUserLeave,e)}},{key:"_onRoomError",value:function(e){var t;this.safeEmit(re.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,[re.onNetworkQuality].concat(t))}},{key:"_onConnectionStateChange",value:function(e){void 0!==this._startCloudProxyTimestamp&&this._useCloudProxy&&e.state===V.CONNECTION_STATE_CONNECTED&&this.safeEmit(re.onCloudProxyConnected,{interval:Date.now()-this._startCloudProxyTimestamp}),this.safeEmit(re.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:"_onVideoFirstFrameDecoded",value:function(e){this.safeEmit(re.onVideoFirstFrameDecoded,e)}},{key:"_onVideoDeviceStateChange",value:function(e){this.safeEmit(re.onVideoDeviceStateChanged,e)}},{key:"_onAudioDeviceStateChange",value:function(e){this.safeEmit(re.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===nG.PUB?this.safeEmit(re.onUserPublishScreen,u):this.safeEmit(re.onUserUnpublishScreen,i(i({},u),{},{reason:L.STREAM_REMOVE_REASON_UNPUBLISH})):a===nG.PUB?(u.videoStreamDescriptions=null==s||null===(t=s.attributes)||void 0===t?void 0:t.videoDescriptions,this.safeEmit(re.onUserPublishStream,u),this._handleAutoSubscribe(s,!0)):this.safeEmit(re.onUserUnpublishStream,i(i({},u),{},{reason:L.STREAM_REMOVE_REASON_UNPUBLISH}))}},{key:"_onCustomMessage",value:function(e){var t=e.message;e.binary?this.safeEmit(re.onRoomBinaryMessageReceived,{userId:e.clientId,message:t}):this.safeEmit(re.onRoomMessageReceived,{userId:e.clientId,message:t})}},{key:"_onUserMessageReceived",value:function(e){this._messageStatisticsObserver.recvP2PMessage(e.userId),this.safeEmit(re.onUserMessageReceived,e)}},{key:"_onUserBinaryMessageReceived",value:function(e){this._messageStatisticsObserver.recvP2PMessage(e.userId),this.safeEmit(re.onUserBinaryMessageReceived,e)}},{key:"_onLiveTranscodingResult",value:function(e){this.safeEmit(re.onLiveTranscodingResult,e)}},{key:"_onStreamMixingEvent",value:function(e){this.safeEmit(re.onStreamMixingEvent,e)}},{key:"_onUserTokenWillExpire",value:function(){this.safeEmit(re.onTokenWillExpire)}},{key:"_onPushPublicStreamResult",value:function(e){this.safeEmit(re.onPushPublicStreamResult,e)}},{key:"_handleRTMClient",value:function(e){var t=this;e.on("onUserMessageReceivedOutsideRoom",(function(e){t._messageStatisticsObserver.recvP2POutRoomMessage(e.userId),t.safeEmit(re.onUserMessageReceivedOutsideRoom,e)})),e.on("onUserBinaryMessageReceivedOutsideRoom",(function(e){t._messageStatisticsObserver.recvP2POutRoomMessage(e.userId),t.safeEmit(re.onUserBinaryMessageReceivedOutsideRoom,e)})),e.on("onUserDisconnection",(function(){t.safeEmit(re.onError,{errorCode:cD.RTM_DUPLICATE_LOGIN})})),e.on("onRTMTokenError",(function(){t.safeEmit(re.onError,{errorCode:cD.RTM_TOKEN_ERROR})}))}},{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:"_handleAudioDeviceManager",value:function(){var e=this;this._audioDeviceManager.on("onAudioPlaybackDeviceTestVolume",(function(t){e.safeEmit(re.onAudioPlaybackDeviceTestVolume,t)}))}},{key:"_assertNotInRoom",value:function(){if(!this._room||this._room.connectionState!==OG.CONNECTED)throw new lD(cD.INVOKED_BEFORE_JOIN_ROOM,"join first")}},{key:"_checkMediaType",value:function(e){KP(e,"mediaType",[U.AUDIO,U.VIDEO,U.AUDIO_AND_VIDEO])}},{key:"_getUserId",value:function(){var e,t;return(null===(e=this._room)||void 0===e||null===(t=e.roomInfo)||void 0===t?void 0:t.userInfo.userId)||"local_user"}}]),Ue}(fM);cY([qV()],lY.prototype,"updateToken",1),cY([qV()],lY.prototype,"setVideoCaptureDevice",1),cY([qV()],lY.prototype,"setAudioCaptureDevice",1),cY([qV()],lY.prototype,"joinRoom",1),cY([qV()],lY.prototype,"leaveRoom",1),cY([qV()],lY.prototype,"destroy",1),cY([qV()],lY.prototype,"publishStream",1),cY([qV()],lY.prototype,"unpublishStream",1),cY([qV()],lY.prototype,"publishScreen",1),cY([qV()],lY.prototype,"unpublishScreen",1),cY([qV()],lY.prototype,"subscribeStream",1),cY([qV()],lY.prototype,"unsubscribeStream",1),cY([qV()],lY.prototype,"subscribeScreen",1),cY([qV()],lY.prototype,"unsubscribeScreen",1),cY([qV()],lY.prototype,"setRemoteVideoConfig",1),cY([qV()],lY.prototype,"startVideoCapture",1),cY([qV()],lY.prototype,"stopVideoCapture",1),cY([qV()],lY.prototype,"startAudioCapture",1),cY([qV()],lY.prototype,"stopAudioCapture",1),cY([qV()],lY.prototype,"getAudioMixingManager",1),cY([qV()],lY.prototype,"startScreenCapture",1),cY([qV()],lY.prototype,"stopScreenCapture",1),cY([qV()],lY.prototype,"setLocalVideoPlayer",1),cY([qV()],lY.prototype,"startLiveTranscoding",1),cY([qV()],lY.prototype,"updateLiveTranscoding",1),cY([qV()],lY.prototype,"stopLiveTranscoding",1),cY([qV()],lY.prototype,"setBusinessId",1),cY([qV()],lY.prototype,"setUserVisibility",1),cY([qV()],lY.prototype,"setRemoteVideoPlayer",1),cY([qV()],lY.prototype,"setLocalVideoMirrorType",1),cY([qV()],lY.prototype,"setAudioPlaybackDevice",1),cY([qV()],lY.prototype,"play",1),cY([qV()],lY.prototype,"pauseAllSubscribedStream",1),cY([qV()],lY.prototype,"resumeAllSubscribedStream",1),cY([qV()],lY.prototype,"sendUserMessage",1),cY([qV()],lY.prototype,"sendUserBinaryMessage",1),cY([qV()],lY.prototype,"sendRoomMessage",1),cY([qV()],lY.prototype,"sendRoomBinaryMessage",1),cY([qV()],lY.prototype,"setAudioCaptureConfig",1),cY([qV()],lY.prototype,"setVideoCaptureConfig",1),cY([qV()],lY.prototype,"enableSimulcastMode",1),cY([qV()],lY.prototype,"setVideoEncoderConfig",1),cY([qV()],lY.prototype,"setScreenEncoderConfig",1),cY([qV()],lY.prototype,"sendSEIMessage",1),cY([qV()],lY.prototype,"setAudioVolumeIndicationInterval",1),cY([qV()],lY.prototype,"enableAudioPropertiesReport",1),cY([qV()],lY.prototype,"setVideoSourceType",1),cY([qV()],lY.prototype,"setExternalVideoTrack",1),cY([qV()],lY.prototype,"setAudioSourceType",1),cY([qV()],lY.prototype,"setExternalAudioTrack",1),cY([qV("rtm")],lY.prototype,"login",1),cY([qV("rtm")],lY.prototype,"logout",1),cY([qV("rtm")],lY.prototype,"updateLoginToken",1),cY([qV("rtm")],lY.prototype,"getPeerOnlineStatus",1),cY([qV("rtm")],lY.prototype,"sendUserMessageOutsideRoom",1),cY([qV("rtm")],lY.prototype,"sendUserBinaryMessageOutsideRoom",1),cY([qV("rtm")],lY.prototype,"setServerParams",1),cY([qV("rtm")],lY.prototype,"sendServerMessage",1),cY([qV("rtm")],lY.prototype,"sendServerBinaryMessage",1),cY([qV()],lY.prototype,"startCloudProxy",1),cY([qV()],lY.prototype,"stopCloudProxy",1),cY([qV()],lY.prototype,"startPushPublicStream",1),cY([qV()],lY.prototype,"updatePublicStreamParam",1),cY([qV()],lY.prototype,"stopPushPublicStream",1),cY([qV("outsideRoom")],lY.prototype,"startPlayPublicStream",1),cY([qV("outsideRoom")],lY.prototype,"stopPlayPublicStream",1),cY([qV()],lY.prototype,"setAudioProfile",1),cY([qV("outsideRoom")],lY.prototype,"setPublicStreamVideoPlayer",1),cY([qV()],lY.prototype,"setDummyCaptureImagePath",1),cY([qV()],lY.prototype,"startAudioPlaybackDeviceTest",1),cY([qV()],lY.prototype,"stopAudioPlaybackDeviceTest",1),cY([qV()],lY.prototype,"startAudioDeviceRecordTest",1),cY([qV()],lY.prototype,"stopAudioDeviceRecordAndPlayTest",1),cY([qV()],lY.prototype,"stopAudioDevicePlayTest",1),cY([qV()],lY.prototype,"setRemoteUserPriority",1),cY([qV()],lY.prototype,"takeLocalSnapshot",1),cY([qV()],lY.prototype,"takeRemoteSnapshot",1),cY([qV()],lY.prototype,"setSubscribeFallbackOption",1),cY([qV()],lY.prototype,"_setCaptureVolume",1);var hY={"client unpublished":L.STREAM_REMOVE_REASON_UNPUBLISH,"publish failed":L.STREAM_REMOVE_REASON_PUBLISH_FAILED,"stream removed":L.STREAM_REMOVE_REASON_KEEP_LIVE_FAILED,"client disconnected":L.STREAM_REMOVE_REASON_CLIENT_DISCONNECTED,"client republish":L.STREAM_REMOVE_REASON_REPUBLISH},fY=new lM("VERTC",0);[KV,WV,XV].forEach((function(e){var t;return e.setStats({rtc_sdk_version:lF.VERSION,product_line:aV.RTC,report_version:sV.W_5,os:uV.WEB,device_id:aF.getDeviceId(),user_agent:IP()?"":null===(t=navigator)||void 0===t?void 0:t.userAgent})}));var pY=function(e,t){return fY.print("createEngine","Invoke VERTC.createEngine"),zP(e,"appId"),[KV,WV,XV].forEach((function(r){return r.setStats({rtc_app_id:e,auto_play_policy:null==t?void 0:t.autoPlayPolicy})})),GV.sdkInitEngine(Date.now(),PV.BEGIN),new lY(e,t)},_Y=function(e){if(fY.print("destroyEngine","Invoke VERTC.destroyEngine"),!(e instanceof lY))throw new lD(cD.INVALID_ENGINE,"Invalid engine object");e.destroy(),GV.sdkInitEngine(Date.now(),PV.END)},vY=function(){var e=s(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",hj.enumerateDevices());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),mY=function(){var e=s(regeneratorRuntime.mark((function e(){var t,r,n,i,o=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=o.length>0&&void 0!==o[0]?o[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,hj.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,hj.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)}}(),gY=function(){var e=s(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",hj.enumerateAudioCaptureDevices());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),yY=function(){var e=s(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",hj.enumerateVideoCaptureDevices());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),SY=function(){var e=s(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",hj.enumerateAudioPlaybackDevices());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),bY=function(){return lF.VERSION},EY=function(){return GV.rtcSdkApiCall("isSupported",0,""),ZF()},kY=function(){return GV.rtcSdkApiCall("getSupportedCodecs",0,""),eB()};return!IP()&&location.search.includes("_rtc_autotest_"),i(i(i(i({},new(d((function e(){u(this,e),l(this,"getSdkVersion",bY),l(this,"createEngine",pY),l(this,"destroyEngine",_Y),l(this,"enumerateDevices",vY),l(this,"enableDevices",mY),l(this,"enumerateAudioCaptureDevices",gY),l(this,"enumerateVideoCaptureDevices",yY),l(this,"enumerateAudioPlaybackDevices",SY),l(this,"getParameter",fF),l(this,"setParameter",hF),l(this,"isSupported",EY),l(this,"getSupportedCodecs",kY),l(this,"events",re),l(this,"ErrorCode",cD),l(this,"platform","".concat({}.PRODUCT_PLATFORM)),l(this,"_monitor",GV)})))),Q),te),{},{events:re})}));
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){l(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(e){return(o="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 a(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 s(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function s(e){a(o,n,i,s,u,"next",e)}function u(e){a(o,n,i,s,u,"throw",e)}s(void 0)}))}}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function d(e,t,r){return t&&c(e.prototype,t),r&&c(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function l(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function h(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&&p(e,t)}function f(e){return(f=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function p(e,t){return(p=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function v(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 _(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function m(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 _(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=f(e);if(t){var i=f(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return m(this,r)}}function y(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=f(e)););return e}function S(){return S="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=y(e,t);if(n){var i=Object.getOwnPropertyDescriptor(n,t);return i.get?i.get.call(arguments.length<3?e:r):i.value}},S.apply(this,arguments)}function b(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var n,i,o=[],a=!0,s=!1;try{for(r=r.call(e);!(a=(n=r.next()).done)&&(o.push(n.value),!t||o.length!==t);a=!0);}catch(u){s=!0,i=u}finally{try{a||null==r.return||r.return()}finally{if(s)throw i}}return o}(e,t)||R(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 E(e){return function(e){if(Array.isArray(e))return k(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||R(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 R(e,t){if(e){if("string"==typeof e)return k(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)?k(e,t):void 0}}function k(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 T(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=R(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}var I=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}(I||{}),A=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}(A||{}),w=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}(w||{}),C=function(e){return e[e.CHANNEL_PROFILE_COMMUNICATION=0]="CHANNEL_PROFILE_COMMUNICATION",e[e.CHANNEL_PROFILE_LIVE_BROADCASTING=1]="CHANNEL_PROFILE_LIVE_BROADCASTING",e}(C||{}),O=function(e){return e[e.AUTO_SUBSCRIBE_MODE=0]="AUTO_SUBSCRIBE_MODE",e[e.MANUAL_SUBSCRIBE_MODE=1]="MANUAL_SUBSCRIBE_MODE",e}(O||{}),x=function(e){return e[e.SUBSCRIBE_SUCC=0]="SUBSCRIBE_SUCC",e[e.SUBSCRIBE_FAIL=1]="SUBSCRIBE_FAIL",e}(x||{}),N=function(e){return e[e.PUBLISH_SUCC=0]="PUBLISH_SUCC",e[e.PUBLISH_FAIL=1]="PUBLISH_FAIL",e}(N||{}),D=function(e){return e[e.MIRROR_MODE_OFF=0]="MIRROR_MODE_OFF",e[e.MIRROR_MODE_ON=1]="MIRROR_MODE_ON",e}(D||{}),P=function(e){return e[e.RENDER_MODE_HIDDEN=0]="RENDER_MODE_HIDDEN",e[e.RENDER_MODE_FIT=1]="RENDER_MODE_FIT",e}(P||{}),M=function(e){return e[e.STREAM_INDEX_MAIN=0]="STREAM_INDEX_MAIN",e[e.STREAM_INDEX_SCREEN=1]="STREAM_INDEX_SCREEN",e}(M||{}),L=function(e){return e[e.AUDIO=1]="AUDIO",e[e.VIDEO=2]="VIDEO",e[e.AUDIO_AND_VIDEO=3]="AUDIO_AND_VIDEO",e}(L||{}),U=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}(U||{}),V=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}(V||{}),F=function(e){return e[e.MIRROR_TYPE_NONE=0]="MIRROR_TYPE_NONE",e[e.MIRROR_TYPE_RENDER=1]="MIRROR_TYPE_RENDER",e}(F||{}),B=function(e){return e[e.domestic=0]="domestic",e[e.overseas=1]="overseas",e}(B||{}),j=function(e){return e[e.OFFLINE=0]="OFFLINE",e[e.ONLINE=1]="ONLINE",e[e.UNREACHABLE=2]="UNREACHABLE",e}(j||{}),G=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}(G||{}),H=function(e){return e[e.PREV_FRAME=0]="PREV_FRAME",e[e.OTHER_FRAME=1]="OTHER_FRAME",e}(H||{}),z=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}(z||{}),q=function(e){return e[e.LOW=0]="LOW",e[e.MEDIUM=100]="MEDIUM",e[e.HIGH=200]="HIGH",e}(q||{}),X=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}(X||{}),K=function(e){return e[e.Unknown=-1]="Unknown",e[e.SubscribeFallbackByBandwidth=0]="SubscribeFallbackByBandwidth",e[e.SubscribeRecoverByBandwidth=2]="SubscribeRecoverByBandwidth",e}(K||{}),W=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}(W||{}),Y=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}(Y||{}),J=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}(J||{}),Q=Object.freeze(Object.defineProperty({__proto__:null,VideoSourceType:I,AudioSourceType:A,UserOfflineReason:w,ChannelProfile:C,SubscribeMode:O,SubscribeState:x,PublishState:N,MirrorMode:D,VideoRenderMode:P,StreamIndex:M,MediaType:L,StreamRemoveReason:U,ConnectionState:V,MirrorType:F,LogChannel:B,USER_ONLINE_STATUS:j,PublicStreamType:G,PublicInterpolationMode:H,SubscribeFallbackOption:z,RemoteUserPriority:q,NetworkQuality:X,FallbackOrRecoverReason:K,RoomProfileType:W,AudioProfileType:Y,RTCAutoPlayPolicy:J},Symbol.toStringTag,{value:"Module"})),Z=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}(Z||{}),$=function(e){return e[e.PLAYOUT=0]="PLAYOUT",e[e.PUBLISH=1]="PUBLISH",e[e.PLAYOUT_AND_PUBLISH=2]="PLAYOUT_AND_PUBLISH",e}($||{}),ee=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}(ee||{}),te=Object.freeze(Object.defineProperty({__proto__:null,AudioMixingDualMonoMode:Z,AudioMixingType:$,AudioMixingState:ee},Symbol.toStringTag,{value:"Module"})),re=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}(re||{}),ne="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},ie=function(e){return e&&e.Math==Math&&e},oe=ie("object"==typeof globalThis&&globalThis)||ie("object"==typeof window&&window)||ie("object"==typeof self&&self)||ie("object"==typeof ne&&ne)||function(){return this}()||Function("return this")(),ae={},se=function(e){try{return!!e()}catch(t){return!0}},ue=!se((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),ce=!se((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),de=ce,le=Function.prototype.call,he=de?le.bind(le):function(){return le.apply(le,arguments)},fe={},pe={}.propertyIsEnumerable,ve=Object.getOwnPropertyDescriptor,_e=ve&&!pe.call({1:2},1);fe.f=_e?function(e){var t=ve(this,e);return!!t&&t.enumerable}:pe;var me,ge,ye=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},Se=ce,be=Function.prototype,Ee=be.bind,Re=be.call,ke=Se&&Ee.bind(Re,Re),Te=Se?function(e){return e&&ke(e)}:function(e){return e&&function(){return Re.apply(e,arguments)}},Ie=Te,Ae=Ie({}.toString),we=Ie("".slice),Ce=function(e){return we(Ae(e),8,-1)},Oe=Te,xe=se,Ne=Ce,De=oe.Object,Pe=Oe("".split),Me=xe((function(){return!De("z").propertyIsEnumerable(0)}))?function(e){return"String"==Ne(e)?Pe(e,""):De(e)}:De,Le=oe.TypeError,Ue=function(e){if(null==e)throw Le("Can't call method on "+e);return e},Ve=Me,Fe=Ue,Be=function(e){return Ve(Fe(e))},je=function(e){return"function"==typeof e},Ge=je,He=function(e){return"object"==typeof e?null!==e:Ge(e)},ze=oe,qe=je,Xe=function(e){return qe(e)?e:void 0},Ke=function(e,t){return arguments.length<2?Xe(ze[e]):ze[e]&&ze[e][t]},We=Te({}.isPrototypeOf),Ye=Ke("navigator","userAgent")||"",Je=oe,Qe=Ye,Ze=Je.process,$e=Je.Deno,et=Ze&&Ze.versions||$e&&$e.version,tt=et&&et.v8;tt&&(ge=(me=tt.split("."))[0]>0&&me[0]<4?1:+(me[0]+me[1])),!ge&&Qe&&(!(me=Qe.match(/Edge\/(\d+)/))||me[1]>=74)&&(me=Qe.match(/Chrome\/(\d+)/))&&(ge=+me[1]);var rt=ge,nt=rt,it=se,ot=!!Object.getOwnPropertySymbols&&!it((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&nt&&nt<41})),at=ot&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,st=Ke,ut=je,ct=We,dt=at,lt=oe.Object,ht=dt?function(e){return"symbol"==typeof e}:function(e){var t=st("Symbol");return ut(t)&&ct(t.prototype,lt(e))},ft=oe.String,pt=function(e){try{return ft(e)}catch(t){return"Object"}},vt=je,_t=pt,mt=oe.TypeError,gt=function(e){if(vt(e))return e;throw mt(_t(e)+" is not a function")},yt=gt,St=function(e,t){var r=e[t];return null==r?void 0:yt(r)},bt=he,Et=je,Rt=He,kt=oe.TypeError,Tt={exports:{}},It=oe,At=Object.defineProperty,wt=function(e,t){try{At(It,e,{value:t,configurable:!0,writable:!0})}catch(r){It[e]=t}return t},Ct=wt,Ot="__core-js_shared__",xt=oe[Ot]||Ct(Ot,{}),Nt=xt;(Tt.exports=function(e,t){return Nt[e]||(Nt[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.21.0",mode:"global",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.21.0/LICENSE",source:"https://github.com/zloirock/core-js"});var Dt=Ue,Pt=oe.Object,Mt=function(e){return Pt(Dt(e))},Lt=Mt,Ut=Te({}.hasOwnProperty),Vt=Object.hasOwn||function(e,t){return Ut(Lt(e),t)},Ft=Te,Bt=0,jt=Math.random(),Gt=Ft(1..toString),Ht=function(e){return"Symbol("+(void 0===e?"":e)+")_"+Gt(++Bt+jt,36)},zt=oe,qt=Tt.exports,Xt=Vt,Kt=Ht,Wt=ot,Yt=at,Jt=qt("wks"),Qt=zt.Symbol,Zt=Qt&&Qt.for,$t=Yt?Qt:Qt&&Qt.withoutSetter||Kt,er=function(e){if(!Xt(Jt,e)||!Wt&&"string"!=typeof Jt[e]){var t="Symbol."+e;Wt&&Xt(Qt,e)?Jt[e]=Qt[e]:Jt[e]=Yt&&Zt?Zt(t):$t(t)}return Jt[e]},tr=he,rr=He,nr=ht,ir=St,or=function(e,t){var r,n;if("string"===t&&Et(r=e.toString)&&!Rt(n=bt(r,e)))return n;if(Et(r=e.valueOf)&&!Rt(n=bt(r,e)))return n;if("string"!==t&&Et(r=e.toString)&&!Rt(n=bt(r,e)))return n;throw kt("Can't convert object to primitive value")},ar=er,sr=oe.TypeError,ur=ar("toPrimitive"),cr=function(e,t){if(!rr(e)||nr(e))return e;var r,n=ir(e,ur);if(n){if(void 0===t&&(t="default"),r=tr(n,e,t),!rr(r)||nr(r))return r;throw sr("Can't convert object to primitive value")}return void 0===t&&(t="number"),or(e,t)},dr=cr,lr=ht,hr=function(e){var t=dr(e,"string");return lr(t)?t:t+""},fr=He,pr=oe.document,vr=fr(pr)&&fr(pr.createElement),_r=function(e){return vr?pr.createElement(e):{}},mr=_r,gr=!ue&&!se((function(){return 7!=Object.defineProperty(mr("div"),"a",{get:function(){return 7}}).a})),yr=ue,Sr=he,br=fe,Er=ye,Rr=Be,kr=hr,Tr=Vt,Ir=gr,Ar=Object.getOwnPropertyDescriptor;ae.f=yr?Ar:function(e,t){if(e=Rr(e),t=kr(t),Ir)try{return Ar(e,t)}catch(r){}if(Tr(e,t))return Er(!Sr(br.f,e,t),e[t])};var wr={},Cr=ue&&se((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Or=oe,xr=He,Nr=Or.String,Dr=Or.TypeError,Pr=function(e){if(xr(e))return e;throw Dr(Nr(e)+" is not an object")},Mr=ue,Lr=gr,Ur=Cr,Vr=Pr,Fr=hr,Br=oe.TypeError,jr=Object.defineProperty,Gr=Object.getOwnPropertyDescriptor,Hr="enumerable",zr="configurable",qr="writable";wr.f=Mr?Ur?function(e,t,r){if(Vr(e),t=Fr(t),Vr(r),"function"==typeof e&&"prototype"===t&&"value"in r&&qr in r&&!r.writable){var n=Gr(e,t);n&&n.writable&&(e[t]=r.value,r={configurable:zr in r?r.configurable:n.configurable,enumerable:Hr in r?r.enumerable:n.enumerable,writable:!1})}return jr(e,t,r)}:jr:function(e,t,r){if(Vr(e),t=Fr(t),Vr(r),Lr)try{return jr(e,t,r)}catch(n){}if("get"in r||"set"in r)throw Br("Accessors not supported");return"value"in r&&(e[t]=r.value),e};var Xr=wr,Kr=ye,Wr=ue?function(e,t,r){return Xr.f(e,t,Kr(1,r))}:function(e,t,r){return e[t]=r,e},Yr={exports:{}},Jr=je,Qr=xt,Zr=Te(Function.toString);Jr(Qr.inspectSource)||(Qr.inspectSource=function(e){return Zr(e)});var $r,en,tn,rn=Qr.inspectSource,nn=je,on=rn,an=oe.WeakMap,sn=nn(an)&&/native code/.test(on(an)),un=Tt.exports,cn=Ht,dn=un("keys"),ln=function(e){return dn[e]||(dn[e]=cn(e))},hn={},fn=sn,pn=oe,vn=Te,_n=He,mn=Wr,gn=Vt,yn=xt,Sn=ln,bn=hn,En="Object already initialized",Rn=pn.TypeError,kn=pn.WeakMap;if(fn||yn.state){var Tn=yn.state||(yn.state=new kn),In=vn(Tn.get),An=vn(Tn.has),wn=vn(Tn.set);$r=function(e,t){if(An(Tn,e))throw new Rn(En);return t.facade=e,wn(Tn,e,t),t},en=function(e){return In(Tn,e)||{}},tn=function(e){return An(Tn,e)}}else{var Cn=Sn("state");bn[Cn]=!0,$r=function(e,t){if(gn(e,Cn))throw new Rn(En);return t.facade=e,mn(e,Cn,t),t},en=function(e){return gn(e,Cn)?e[Cn]:{}},tn=function(e){return gn(e,Cn)}}var On={set:$r,get:en,has:tn,enforce:function(e){return tn(e)?en(e):$r(e,{})},getterFor:function(e){return function(t){var r;if(!_n(t)||(r=en(t)).type!==e)throw Rn("Incompatible receiver, "+e+" required");return r}}},xn=ue,Nn=Vt,Dn=Function.prototype,Pn=xn&&Object.getOwnPropertyDescriptor,Mn=Nn(Dn,"name"),Ln={EXISTS:Mn,PROPER:Mn&&"something"===function(){}.name,CONFIGURABLE:Mn&&(!xn||xn&&Pn(Dn,"name").configurable)},Un=oe,Vn=je,Fn=Vt,Bn=Wr,jn=wt,Gn=rn,Hn=Ln.CONFIGURABLE,zn=On.get,qn=On.enforce,Xn=String(String).split("String");(Yr.exports=function(e,t,r,n){var i,o=!!n&&!!n.unsafe,a=!!n&&!!n.enumerable,s=!!n&&!!n.noTargetGet,u=n&&void 0!==n.name?n.name:t;Vn(r)&&("Symbol("===String(u).slice(0,7)&&(u="["+String(u).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),(!Fn(r,"name")||Hn&&r.name!==u)&&Bn(r,"name",u),(i=qn(r)).source||(i.source=Xn.join("string"==typeof u?u:""))),e!==Un?(o?!s&&e[t]&&(a=!0):delete e[t],a?e[t]=r:Bn(e,t,r)):a?e[t]=r:jn(t,r)})(Function.prototype,"toString",(function(){return Vn(this)&&zn(this).source||Gn(this)}));var Kn={},Wn=Math.ceil,Yn=Math.floor,Jn=function(e){var t=+e;return t!=t||0===t?0:(t>0?Yn:Wn)(t)},Qn=Jn,Zn=Math.max,$n=Math.min,ei=function(e,t){var r=Qn(e);return r<0?Zn(r+t,0):$n(r,t)},ti=Jn,ri=Math.min,ni=function(e){return e>0?ri(ti(e),9007199254740991):0},ii=ni,oi=function(e){return ii(e.length)},ai=Be,si=ei,ui=oi,ci=function(e){return function(t,r,n){var i,o=ai(t),a=ui(o),s=si(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}},di={includes:ci(!0),indexOf:ci(!1)},li=Vt,hi=Be,fi=di.indexOf,pi=hn,vi=Te([].push),_i=function(e,t){var r,n=hi(e),i=0,o=[];for(r in n)!li(pi,r)&&li(n,r)&&vi(o,r);for(;t.length>i;)li(n,r=t[i++])&&(~fi(o,r)||vi(o,r));return o},mi=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],gi=_i,yi=mi.concat("length","prototype");Kn.f=Object.getOwnPropertyNames||function(e){return gi(e,yi)};var Si={};Si.f=Object.getOwnPropertySymbols;var bi=Ke,Ei=Kn,Ri=Si,ki=Pr,Ti=Te([].concat),Ii=bi("Reflect","ownKeys")||function(e){var t=Ei.f(ki(e)),r=Ri.f;return r?Ti(t,r(e)):t},Ai=Vt,wi=Ii,Ci=ae,Oi=wr,xi=function(e,t,r){for(var n=wi(t),i=Oi.f,o=Ci.f,a=0;a<n.length;a++){var s=n[a];Ai(e,s)||r&&Ai(r,s)||i(e,s,o(t,s))}},Ni=se,Di=je,Pi=/#|\.prototype\./,Mi=function(e,t){var r=Ui[Li(e)];return r==Fi||r!=Vi&&(Di(t)?Ni(t):!!t)},Li=Mi.normalize=function(e){return String(e).replace(Pi,".").toLowerCase()},Ui=Mi.data={},Vi=Mi.NATIVE="N",Fi=Mi.POLYFILL="P",Bi=Mi,ji=oe,Gi=ae.f,Hi=Wr,zi=Yr.exports,qi=wt,Xi=xi,Ki=Bi,Wi=function(e,t){var r,n,i,o,a,s=e.target,u=e.global,c=e.stat;if(r=u?ji:c?ji[s]||qi(s,{}):(ji[s]||{}).prototype)for(n in t){if(o=t[n],i=e.noTargetGet?(a=Gi(r,n))&&a.value:r[n],!Ki(u?n:s+(c?".":"#")+n,e.forced)&&void 0!==i){if(typeof o==typeof i)continue;Xi(o,i)}(e.sham||i&&i.sham)&&Hi(o,"sham",!0),zi(r,n,o,e)}},Yi=ce,Ji=Function.prototype,Qi=Ji.apply,Zi=Ji.call,$i="object"==typeof Reflect&&Reflect.apply||(Yi?Zi.bind(Qi):function(){return Zi.apply(Qi,arguments)}),eo=Ce,to=Array.isArray||function(e){return"Array"==eo(e)},ro={};ro[er("toStringTag")]="z";var no="[object z]"===String(ro),io=oe,oo=no,ao=je,so=Ce,uo=er("toStringTag"),co=io.Object,lo="Arguments"==so(function(){return arguments}()),ho=oo?so: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=co(e),uo))?r:lo?so(t):"Object"==(n=so(t))&&ao(t.callee)?"Arguments":n},fo=ho,po=oe.String,vo=function(e){if("Symbol"===fo(e))throw TypeError("Cannot convert a Symbol value to a string");return po(e)},_o={},mo=_i,go=mi,yo=Object.keys||function(e){return mo(e,go)},So=ue,bo=Cr,Eo=wr,Ro=Pr,ko=Be,To=yo;_o.f=So&&!bo?Object.defineProperties:function(e,t){Ro(e);for(var r,n=ko(t),i=To(t),o=i.length,a=0;o>a;)Eo.f(e,r=i[a++],n[r]);return e};var Io,Ao=Ke("document","documentElement"),wo=Pr,Co=_o,Oo=mi,xo=hn,No=Ao,Do=_r,Po=ln("IE_PROTO"),Mo=function(){},Lo=function(e){return"<script>"+e+"</"+"script>"},Uo=function(e){e.write(Lo("")),e.close();var t=e.parentWindow.Object;return e=null,t},Vo=function(){try{Io=new ActiveXObject("htmlfile")}catch(n){}var e,t;Vo="undefined"!=typeof document?document.domain&&Io?Uo(Io):((t=Do("iframe")).style.display="none",No.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(Lo("document.F=Object")),e.close(),e.F):Uo(Io);for(var r=Oo.length;r--;)delete Vo.prototype[Oo[r]];return Vo()};xo[Po]=!0;var Fo=Object.create||function(e,t){var r;return null!==e?(Mo.prototype=wo(e),r=new Mo,Mo.prototype=null,r[Po]=e):r=Vo(),void 0===t?r:Co.f(r,t)},Bo={},jo=hr,Go=wr,Ho=ye,zo=function(e,t,r){var n=jo(t);n in e?Go.f(e,n,Ho(0,r)):e[n]=r},qo=ei,Xo=oi,Ko=zo,Wo=oe.Array,Yo=Math.max,Jo=function(e,t,r){for(var n=Xo(e),i=qo(t,n),o=qo(void 0===r?n:r,n),a=Wo(Yo(o-i,0)),s=0;i<o;i++,s++)Ko(a,s,e[i]);return a.length=s,a},Qo=Ce,Zo=Be,$o=Kn.f,ea=Jo,ta="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];Bo.f=function(e){return ta&&"Window"==Qo(e)?function(e){try{return $o(e)}catch(t){return ea(ta)}}(e):$o(Zo(e))};var ra=Te([].slice),na={},ia=er;na.f=ia;var oa=oe,aa=Vt,sa=na,ua=wr.f,ca=function(e){var t=oa.Symbol||(oa.Symbol={});aa(t,e)||ua(t,e,{value:sa.f(e)})},da=wr.f,la=Vt,ha=er("toStringTag"),fa=function(e,t,r){e&&!r&&(e=e.prototype),e&&!la(e,ha)&&da(e,ha,{configurable:!0,value:t})},pa=gt,va=ce,_a=Te(Te.bind),ma=function(e,t){return pa(e),void 0===t?e:va?_a(e,t):function(){return e.apply(t,arguments)}},ga=Te,ya=se,Sa=je,ba=ho,Ea=rn,Ra=function(){},ka=[],Ta=Ke("Reflect","construct"),Ia=/^\s*(?:class|function)\b/,Aa=ga(Ia.exec),wa=!Ia.exec(Ra),Ca=function(e){if(!Sa(e))return!1;try{return Ta(Ra,ka,e),!0}catch(t){return!1}},Oa=function(e){if(!Sa(e))return!1;switch(ba(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return wa||!!Aa(Ia,Ea(e))}catch(t){return!0}};Oa.sham=!0;var xa=!Ta||ya((function(){var e;return Ca(Ca.call)||!Ca(Object)||!Ca((function(){e=!0}))||e}))?Oa:Ca,Na=oe,Da=to,Pa=xa,Ma=He,La=er("species"),Ua=Na.Array,Va=function(e){var t;return Da(e)&&(t=e.constructor,(Pa(t)&&(t===Ua||Da(t.prototype))||Ma(t)&&null===(t=t[La]))&&(t=void 0)),void 0===t?Ua:t},Fa=function(e,t){return new(Va(e))(0===t?0:t)},Ba=ma,ja=Me,Ga=Mt,Ha=oi,za=Fa,qa=Te([].push),Xa=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=Ga(u),v=ja(p),_=Ba(c,d),m=Ha(v),g=0,y=l||za,S=t?y(u,m):r||a?y(u,0):void 0;m>g;g++)if((s||g in v)&&(f=_(h=v[g],g,p),e))if(t)S[g]=f;else if(f)switch(e){case 3:return!0;case 5:return h;case 6:return g;case 2:qa(S,h)}else switch(e){case 4:return!1;case 7:qa(S,h)}return o?-1:n||i?i:S}},Ka={forEach:Xa(0),map:Xa(1),filter:Xa(2),some:Xa(3),every:Xa(4),find:Xa(5),findIndex:Xa(6),filterReject:Xa(7)},Wa=Wi,Ya=oe,Ja=Ke,Qa=$i,Za=he,$a=Te,es=ue,ts=ot,rs=se,ns=Vt,is=to,os=je,as=He,ss=We,us=ht,cs=Pr,ds=Mt,ls=Be,hs=hr,fs=vo,ps=ye,vs=Fo,_s=yo,ms=Kn,gs=Bo,ys=Si,Ss=ae,bs=wr,Es=_o,Rs=fe,ks=ra,Ts=Yr.exports,Is=Tt.exports,As=hn,ws=Ht,Cs=er,Os=na,xs=ca,Ns=fa,Ds=On,Ps=Ka.forEach,Ms=ln("hidden"),Ls="Symbol",Us=Cs("toPrimitive"),Vs=Ds.set,Fs=Ds.getterFor(Ls),Bs=Object.prototype,js=Ya.Symbol,Gs=js&&js.prototype,Hs=Ya.TypeError,zs=Ya.QObject,qs=Ja("JSON","stringify"),Xs=Ss.f,Ks=bs.f,Ws=gs.f,Ys=Rs.f,Js=$a([].push),Qs=Is("symbols"),Zs=Is("op-symbols"),$s=Is("string-to-symbol-registry"),eu=Is("symbol-to-string-registry"),tu=Is("wks"),ru=!zs||!zs.prototype||!zs.prototype.findChild,nu=es&&rs((function(){return 7!=vs(Ks({},"a",{get:function(){return Ks(this,"a",{value:7}).a}})).a}))?function(e,t,r){var n=Xs(Bs,t);n&&delete Bs[t],Ks(e,t,r),n&&e!==Bs&&Ks(Bs,t,n)}:Ks,iu=function(e,t){var r=Qs[e]=vs(Gs);return Vs(r,{type:Ls,tag:e,description:t}),es||(r.description=t),r},ou=function(e,t,r){e===Bs&&ou(Zs,t,r),cs(e);var n=hs(t);return cs(r),ns(Qs,n)?(r.enumerable?(ns(e,Ms)&&e[Ms][n]&&(e[Ms][n]=!1),r=vs(r,{enumerable:ps(0,!1)})):(ns(e,Ms)||Ks(e,Ms,ps(1,{})),e[Ms][n]=!0),nu(e,n,r)):Ks(e,n,r)},au=function(e,t){cs(e);var r=ls(t),n=_s(r).concat(du(r));return Ps(n,(function(t){es&&!Za(su,r,t)||ou(e,t,r[t])})),e},su=function(e){var t=hs(e),r=Za(Ys,this,t);return!(this===Bs&&ns(Qs,t)&&!ns(Zs,t))&&(!(r||!ns(this,t)||!ns(Qs,t)||ns(this,Ms)&&this[Ms][t])||r)},uu=function(e,t){var r=ls(e),n=hs(t);if(r!==Bs||!ns(Qs,n)||ns(Zs,n)){var i=Xs(r,n);return!i||!ns(Qs,n)||ns(r,Ms)&&r[Ms][n]||(i.enumerable=!0),i}},cu=function(e){var t=Ws(ls(e)),r=[];return Ps(t,(function(e){ns(Qs,e)||ns(As,e)||Js(r,e)})),r},du=function(e){var t=e===Bs,r=Ws(t?Zs:ls(e)),n=[];return Ps(r,(function(e){!ns(Qs,e)||t&&!ns(Bs,e)||Js(n,Qs[e])})),n};(ts||(js=function(){if(ss(Gs,this))throw Hs("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?fs(arguments[0]):void 0,t=ws(e),r=function(e){this===Bs&&Za(r,Zs,e),ns(this,Ms)&&ns(this[Ms],t)&&(this[Ms][t]=!1),nu(this,t,ps(1,e))};return es&&ru&&nu(Bs,t,{configurable:!0,set:r}),iu(t,e)},Ts(Gs=js.prototype,"toString",(function(){return Fs(this).tag})),Ts(js,"withoutSetter",(function(e){return iu(ws(e),e)})),Rs.f=su,bs.f=ou,Es.f=au,Ss.f=uu,ms.f=gs.f=cu,ys.f=du,Os.f=function(e){return iu(Cs(e),e)},es&&(Ks(Gs,"description",{configurable:!0,get:function(){return Fs(this).description}}),Ts(Bs,"propertyIsEnumerable",su,{unsafe:!0}))),Wa({global:!0,wrap:!0,forced:!ts,sham:!ts},{Symbol:js}),Ps(_s(tu),(function(e){xs(e)})),Wa({target:Ls,stat:!0,forced:!ts},{for:function(e){var t=fs(e);if(ns($s,t))return $s[t];var r=js(t);return $s[t]=r,eu[r]=t,r},keyFor:function(e){if(!us(e))throw Hs(e+" is not a symbol");if(ns(eu,e))return eu[e]},useSetter:function(){ru=!0},useSimple:function(){ru=!1}}),Wa({target:"Object",stat:!0,forced:!ts,sham:!es},{create:function(e,t){return void 0===t?vs(e):au(vs(e),t)},defineProperty:ou,defineProperties:au,getOwnPropertyDescriptor:uu}),Wa({target:"Object",stat:!0,forced:!ts},{getOwnPropertyNames:cu,getOwnPropertySymbols:du}),Wa({target:"Object",stat:!0,forced:rs((function(){ys.f(1)}))},{getOwnPropertySymbols:function(e){return ys.f(ds(e))}}),qs)&&Wa({target:"JSON",stat:!0,forced:!ts||rs((function(){var e=js();return"[null]"!=qs([e])||"{}"!=qs({a:e})||"{}"!=qs(Object(e))}))},{stringify:function(e,t,r){var n=ks(arguments),i=t;if((as(t)||void 0!==e)&&!us(e))return is(t)||(t=function(e,t){if(os(i)&&(t=Za(i,this,e,t)),!us(t))return t}),n[1]=t,Qa(qs,null,n)}});if(!Gs[Us]){var lu=Gs.valueOf;Ts(Gs,Us,(function(e){return Za(lu,this)}))}Ns(js,Ls),As[Ms]=!0;var hu=Wi,fu=ue,pu=oe,vu=Te,_u=Vt,mu=je,gu=We,yu=vo,Su=wr.f,bu=xi,Eu=pu.Symbol,Ru=Eu&&Eu.prototype;if(fu&&mu(Eu)&&(!("description"in Ru)||void 0!==Eu().description)){var ku={},Tu=function(){var e=arguments.length<1||void 0===arguments[0]?void 0:yu(arguments[0]),t=gu(Ru,this)?new Eu(e):void 0===e?Eu():Eu(e);return""===e&&(ku[t]=!0),t};bu(Tu,Eu),Tu.prototype=Ru,Ru.constructor=Tu;var Iu="Symbol(test)"==String(Eu("test")),Au=vu(Ru.toString),wu=vu(Ru.valueOf),Cu=/^Symbol\((.*)\)[^)]+$/,Ou=vu("".replace),xu=vu("".slice);Su(Ru,"description",{configurable:!0,get:function(){var e=wu(this),t=Au(e);if(_u(ku,e))return"";var r=Iu?xu(t,7,-1):Ou(t,Cu,"$1");return""===r?void 0:r}}),hu({global:!0,forced:!0},{Symbol:Tu})}var Nu=ho,Du=no?{}.toString:function(){return"[object "+Nu(this)+"]"},Pu=no,Mu=Yr.exports,Lu=Du;Pu||Mu(Object.prototype,"toString",Lu,{unsafe:!0}),ca("iterator");var Uu=Fo,Vu=wr,Fu=er("unscopables"),Bu=Array.prototype;null==Bu[Fu]&&Vu.f(Bu,Fu,{configurable:!0,value:Uu(null)});var ju,Gu,Hu,zu=function(e){Bu[Fu][e]=!0},qu={},Xu=!se((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),Ku=oe,Wu=Vt,Yu=je,Ju=Mt,Qu=Xu,Zu=ln("IE_PROTO"),$u=Ku.Object,ec=$u.prototype,tc=Qu?$u.getPrototypeOf:function(e){var t=Ju(e);if(Wu(t,Zu))return t[Zu];var r=t.constructor;return Yu(r)&&t instanceof r?r.prototype:t instanceof $u?ec:null},rc=se,nc=je,ic=tc,oc=Yr.exports,ac=er("iterator"),sc=!1;[].keys&&("next"in(Hu=[].keys())?(Gu=ic(ic(Hu)))!==Object.prototype&&(ju=Gu):sc=!0),(null==ju||rc((function(){var e={};return ju[ac].call(e)!==e})))&&(ju={}),nc(ju[ac])||oc(ju,ac,(function(){return this}));var uc={IteratorPrototype:ju,BUGGY_SAFARI_ITERATORS:sc},cc=uc.IteratorPrototype,dc=Fo,lc=ye,hc=fa,fc=qu,pc=function(){return this},vc=function(e,t,r,n){var i=t+" Iterator";return e.prototype=dc(cc,{next:lc(+!n,r)}),hc(e,i,!1),fc[i]=pc,e},_c=oe,mc=je,gc=_c.String,yc=_c.TypeError,Sc=Te,bc=Pr,Ec=function(e){if("object"==typeof e||mc(e))return e;throw yc("Can't set "+gc(e)+" as a prototype")},Rc=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=Sc(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(r,[]),t=r instanceof Array}catch(n){}return function(r,n){return bc(r),Ec(n),t?e(r,n):r.__proto__=n,r}}():void 0),kc=Wi,Tc=he,Ic=Ln,Ac=je,wc=vc,Cc=tc,Oc=Rc,xc=fa,Nc=Wr,Dc=Yr.exports,Pc=qu,Mc=Ic.PROPER,Lc=Ic.CONFIGURABLE,Uc=uc.IteratorPrototype,Vc=uc.BUGGY_SAFARI_ITERATORS,Fc=er("iterator"),Bc="keys",jc="values",Gc="entries",Hc=function(){return this},zc=function(e,t,r,n,i,o,a){wc(r,t,n);var s,u,c,d=function(e){if(e===i&&v)return v;if(!Vc&&e in f)return f[e];switch(e){case Bc:case jc:case Gc:return function(){return new r(this,e)}}return function(){return new r(this)}},l=t+" Iterator",h=!1,f=e.prototype,p=f[Fc]||f["@@iterator"]||i&&f[i],v=!Vc&&p||d(i),_="Array"==t&&f.entries||p;if(_&&(s=Cc(_.call(new e)))!==Object.prototype&&s.next&&(Cc(s)!==Uc&&(Oc?Oc(s,Uc):Ac(s[Fc])||Dc(s,Fc,Hc)),xc(s,l,!0)),Mc&&i==jc&&p&&p.name!==jc&&(Lc?Nc(f,"name",jc):(h=!0,v=function(){return Tc(p,this)})),i)if(u={values:d(jc),keys:o?v:d(Bc),entries:d(Gc)},a)for(c in u)(Vc||h||!(c in f))&&Dc(f,c,u[c]);else kc({target:t,proto:!0,forced:Vc||h},u);return f[Fc]!==v&&Dc(f,Fc,v,{name:i}),Pc[t]=v,u},qc=Be,Xc=zu,Kc=qu,Wc=On,Yc=wr.f,Jc=zc,Qc=ue,Zc="Array Iterator",$c=Wc.set,ed=Wc.getterFor(Zc),td=Jc(Array,"Array",(function(e,t){$c(this,{type:Zc,target:qc(e),index:0,kind:t})}),(function(){var e=ed(this),t=e.target,r=e.kind,n=e.index++;return!t||n>=t.length?(e.target=void 0,{value:void 0,done:!0}):"keys"==r?{value:n,done:!1}:"values"==r?{value:t[n],done:!1}:{value:[n,t[n]],done:!1}}),"values"),rd=Kc.Arguments=Kc.Array;if(Xc("keys"),Xc("values"),Xc("entries"),Qc&&"values"!==rd.name)try{Yc(rd,"name",{value:"values"})}catch(VZ){}var nd=Te,id=Jn,od=vo,ad=Ue,sd=nd("".charAt),ud=nd("".charCodeAt),cd=nd("".slice),dd=function(e){return function(t,r){var n,i,o=od(ad(t)),a=id(r),s=o.length;return a<0||a>=s?e?"":void 0:(n=ud(o,a))<55296||n>56319||a+1===s||(i=ud(o,a+1))<56320||i>57343?e?sd(o,a):n:e?cd(o,a,a+2):i-56320+(n-55296<<10)+65536}},ld={codeAt:dd(!1),charAt:dd(!0)},hd=ld.charAt,fd=vo,pd=On,vd=zc,_d="String Iterator",md=pd.set,gd=pd.getterFor(_d);vd(String,"String",(function(e){md(this,{type:_d,string:fd(e),index:0})}),(function(){var e,t=gd(this),r=t.string,n=t.index;return n>=r.length?{value:void 0,done:!0}:(e=hd(r,n),t.index+=e.length,{value:e,done:!1})}));var yd={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},Sd=_r("span").classList,bd=Sd&&Sd.constructor&&Sd.constructor.prototype,Ed=bd===Object.prototype?void 0:bd,Rd=oe,kd=yd,Td=Ed,Id=td,Ad=Wr,wd=er,Cd=wd("iterator"),Od=wd("toStringTag"),xd=Id.values,Nd=function(e,t){if(e){if(e[Cd]!==xd)try{Ad(e,Cd,xd)}catch(VZ){e[Cd]=xd}if(e[Od]||Ad(e,Od,t),kd[t])for(var r in Id)if(e[r]!==Id[r])try{Ad(e,r,Id[r])}catch(VZ){e[r]=Id[r]}}};for(var Dd in kd)Nd(Rd[Dd]&&Rd[Dd].prototype,Dd);Nd(Td,"DOMTokenList"),ca("asyncIterator"),ca("toStringTag"),fa(oe.JSON,"JSON",!0),fa(Math,"Math",!0);var Pd=Wi,Md=ue,Ld=wr.f;Pd({target:"Object",stat:!0,forced:Object.defineProperty!==Ld,sham:!Md},{defineProperty:Ld});var Ud=Mt,Vd=tc,Fd=Xu;Wi({target:"Object",stat:!0,forced:se((function(){Vd(1)})),sham:!Fd},{getPrototypeOf:function(e){return Vd(Ud(e))}}),Wi({target:"Object",stat:!0},{setPrototypeOf:Rc});var Bd=oe.Promise,jd=Yr.exports,Gd=function(e,t,r){for(var n in t)jd(e,n,t[n],r);return e},Hd=Ke,zd=wr,qd=ue,Xd=er("species"),Kd=function(e){var t=Hd(e),r=zd.f;qd&&t&&!t[Xd]&&r(t,Xd,{configurable:!0,get:function(){return this}})},Wd=We,Yd=oe.TypeError,Jd=function(e,t){if(Wd(t,e))return e;throw Yd("Incorrect invocation")},Qd=qu,Zd=er("iterator"),$d=Array.prototype,el=function(e){return void 0!==e&&(Qd.Array===e||$d[Zd]===e)},tl=ho,rl=St,nl=qu,il=er("iterator"),ol=function(e){if(null!=e)return rl(e,il)||rl(e,"@@iterator")||nl[tl(e)]},al=he,sl=gt,ul=Pr,cl=pt,dl=ol,ll=oe.TypeError,hl=function(e,t){var r=arguments.length<2?dl(e):t;if(sl(r))return ul(al(r,e));throw ll(cl(e)+" is not iterable")},fl=he,pl=Pr,vl=St,_l=function(e,t,r){var n,i;pl(e);try{if(!(n=vl(e,"return"))){if("throw"===t)throw r;return r}n=fl(n,e)}catch(VZ){i=!0,n=VZ}if("throw"===t)throw r;if(i)throw n;return pl(n),r},ml=ma,gl=he,yl=Pr,Sl=pt,bl=el,El=oi,Rl=We,kl=hl,Tl=ol,Il=_l,Al=oe.TypeError,wl=function(e,t){this.stopped=e,this.result=t},Cl=wl.prototype,Ol=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_ITERATOR),f=!(!r||!r.INTERRUPTED),p=ml(t,d),v=function(e){return n&&Il(n,"normal",e),new wl(!0,e)},_=function(e){return l?(yl(e),f?p(e[0],e[1],v):p(e[0],e[1])):f?p(e,v):p(e)};if(h)n=e;else{if(!(i=Tl(e)))throw Al(Sl(e)+" is not iterable");if(bl(i)){for(o=0,a=El(e);a>o;o++)if((s=_(e[o]))&&Rl(Cl,s))return s;return new wl(!1)}n=kl(e,i)}for(u=n.next;!(c=gl(u,n)).done;){try{s=_(c.value)}catch(VZ){Il(n,"throw",VZ)}if("object"==typeof s&&s&&Rl(Cl,s))return s}return new wl(!1)},xl=er("iterator"),Nl=!1;try{var Dl=0,Pl={next:function(){return{done:!!Dl++}},return:function(){Nl=!0}};Pl[xl]=function(){return this},Array.from(Pl,(function(){throw 2}))}catch(VZ){}var Ml,Ll,Ul,Vl,Fl=function(e,t){if(!t&&!Nl)return!1;var r=!1;try{var n={};n[xl]=function(){return{next:function(){return{done:r=!0}}}},e(n)}catch(VZ){}return r},Bl=xa,jl=pt,Gl=oe.TypeError,Hl=function(e){if(Bl(e))return e;throw Gl(jl(e)+" is not a constructor")},zl=Pr,ql=Hl,Xl=er("species"),Kl=function(e,t){var r,n=zl(e).constructor;return void 0===n||null==(r=zl(n)[Xl])?t:ql(r)},Wl=oe.TypeError,Yl=function(e,t){if(e<t)throw Wl("Not enough arguments");return e},Jl=/(?:ipad|iphone|ipod).*applewebkit/i.test(Ye),Ql="process"==Ce(oe.process),Zl=oe,$l=$i,eh=ma,th=je,rh=Vt,nh=se,ih=Ao,oh=ra,ah=_r,sh=Yl,uh=Jl,ch=Ql,dh=Zl.setImmediate,lh=Zl.clearImmediate,hh=Zl.process,fh=Zl.Dispatch,ph=Zl.Function,vh=Zl.MessageChannel,_h=Zl.String,mh=0,gh={},yh="onreadystatechange";try{Ml=Zl.location}catch(VZ){}var Sh=function(e){if(rh(gh,e)){var t=gh[e];delete gh[e],t()}},bh=function(e){return function(){Sh(e)}},Eh=function(e){Sh(e.data)},Rh=function(e){Zl.postMessage(_h(e),Ml.protocol+"//"+Ml.host)};dh&&lh||(dh=function(e){sh(arguments.length,1);var t=th(e)?e:ph(e),r=oh(arguments,1);return gh[++mh]=function(){$l(t,void 0,r)},Ll(mh),mh},lh=function(e){delete gh[e]},ch?Ll=function(e){hh.nextTick(bh(e))}:fh&&fh.now?Ll=function(e){fh.now(bh(e))}:vh&&!uh?(Vl=(Ul=new vh).port2,Ul.port1.onmessage=Eh,Ll=eh(Vl.postMessage,Vl)):Zl.addEventListener&&th(Zl.postMessage)&&!Zl.importScripts&&Ml&&"file:"!==Ml.protocol&&!nh(Rh)?(Ll=Rh,Zl.addEventListener("message",Eh,!1)):Ll=yh in ah("script")?function(e){ih.appendChild(ah("script")).onreadystatechange=function(){ih.removeChild(this),Sh(e)}}:function(e){setTimeout(bh(e),0)});var kh,Th,Ih,Ah,wh,Ch,Oh,xh,Nh={set:dh,clear:lh},Dh=oe,Ph=/ipad|iphone|ipod/i.test(Ye)&&void 0!==Dh.Pebble,Mh=/web0s(?!.*chrome)/i.test(Ye),Lh=oe,Uh=ma,Vh=ae.f,Fh=Nh.set,Bh=Jl,jh=Ph,Gh=Mh,Hh=Ql,zh=Lh.MutationObserver||Lh.WebKitMutationObserver,qh=Lh.document,Xh=Lh.process,Kh=Lh.Promise,Wh=Vh(Lh,"queueMicrotask"),Yh=Wh&&Wh.value;Yh||(kh=function(){var e,t;for(Hh&&(e=Xh.domain)&&e.exit();Th;){t=Th.fn,Th=Th.next;try{t()}catch(VZ){throw Th?Ah():Ih=void 0,VZ}}Ih=void 0,e&&e.enter()},Bh||Hh||Gh||!zh||!qh?!jh&&Kh&&Kh.resolve?((Oh=Kh.resolve(void 0)).constructor=Kh,xh=Uh(Oh.then,Oh),Ah=function(){xh(kh)}):Hh?Ah=function(){Xh.nextTick(kh)}:(Fh=Uh(Fh,Lh),Ah=function(){Fh(kh)}):(wh=!0,Ch=qh.createTextNode(""),new zh(kh).observe(Ch,{characterData:!0}),Ah=function(){Ch.data=wh=!wh}));var Jh=Yh||function(e){var t={fn:e,next:void 0};Ih&&(Ih.next=t),Th||(Th=t,Ah()),Ih=t},Qh={},Zh=gt,$h=function(e){var t,r;this.promise=new e((function(e,n){if(void 0!==t||void 0!==r)throw TypeError("Bad Promise constructor");t=e,r=n})),this.resolve=Zh(t),this.reject=Zh(r)};Qh.f=function(e){return new $h(e)};var ef=Pr,tf=He,rf=Qh,nf=function(e,t){if(ef(e),tf(t)&&t.constructor===e)return t;var r=rf.f(e);return(0,r.resolve)(t),r.promise},of=oe,af=function(){this.head=null,this.tail=null};af.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 sf,uf,cf,df,lf=af,hf="object"==typeof window,ff=Wi,pf=oe,vf=Ke,_f=he,mf=Bd,gf=Yr.exports,yf=Gd,Sf=Rc,bf=fa,Ef=Kd,Rf=gt,kf=je,Tf=He,If=Jd,Af=rn,wf=Ol,Cf=Fl,Of=Kl,xf=Nh.set,Nf=Jh,Df=nf,Pf=function(e,t){var r=of.console;r&&r.error&&(1==arguments.length?r.error(e):r.error(e,t))},Mf=Qh,Lf=function(e){try{return{error:!1,value:e()}}catch(VZ){return{error:!0,value:VZ}}},Uf=lf,Vf=On,Ff=Bi,Bf=hf,jf=Ql,Gf=rt,Hf=er("species"),zf="Promise",qf=Vf.getterFor(zf),Xf=Vf.set,Kf=Vf.getterFor(zf),Wf=mf&&mf.prototype,Yf=mf,Jf=Wf,Qf=pf.TypeError,Zf=pf.document,$f=pf.process,ep=Mf.f,tp=ep,rp=!!(Zf&&Zf.createEvent&&pf.dispatchEvent),np=kf(pf.PromiseRejectionEvent),ip="unhandledrejection",op=!1,ap=Ff(zf,(function(){var e=Af(Yf),t=e!==String(Yf);if(!t&&66===Gf)return!0;if(Gf>=51&&/native code/.test(e))return!1;var r=new Yf((function(e){e(1)})),n=function(e){e((function(){}),(function(){}))};return(r.constructor={})[Hf]=n,!(op=r.then((function(){}))instanceof n)||!t&&Bf&&!np})),sp=ap||!Cf((function(e){Yf.all(e).catch((function(){}))})),up=function(e){var t;return!(!Tf(e)||!kf(t=e.then))&&t},cp=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&&pp(t),t.rejection=1),!0===s?r=o:(d&&d.enter(),r=s(o),d&&(d.exit(),i=!0)),r===e.promise?c(Qf("Promise-chain cycle")):(n=up(r))?_f(n,r,u,c):u(r)):c(o)}catch(VZ){d&&!i&&d.exit(),c(VZ)}},dp=function(e,t){e.notified||(e.notified=!0,Nf((function(){for(var r,n=e.reactions;r=n.get();)cp(r,e);e.notified=!1,t&&!e.rejection&&hp(e)})))},lp=function(e,t,r){var n,i;rp?((n=Zf.createEvent("Event")).promise=t,n.reason=r,n.initEvent(e,!1,!0),pf.dispatchEvent(n)):n={promise:t,reason:r},!np&&(i=pf["on"+e])?i(n):e===ip&&Pf("Unhandled promise rejection",r)},hp=function(e){_f(xf,pf,(function(){var t,r=e.facade,n=e.value;if(fp(e)&&(t=Lf((function(){jf?$f.emit("unhandledRejection",n,r):lp(ip,r,n)})),e.rejection=jf||fp(e)?2:1,t.error))throw t.value}))},fp=function(e){return 1!==e.rejection&&!e.parent},pp=function(e){_f(xf,pf,(function(){var t=e.facade;jf?$f.emit("rejectionHandled",t):lp("rejectionhandled",t,e.value)}))},vp=function(e,t,r){return function(n){e(t,n,r)}},_p=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=2,dp(e,!0))},mp=function(e,t,r){if(!e.done){e.done=!0,r&&(e=r);try{if(e.facade===t)throw Qf("Promise can't be resolved itself");var n=up(t);n?Nf((function(){var r={done:!1};try{_f(n,t,vp(mp,r,e),vp(_p,r,e))}catch(VZ){_p(r,VZ,e)}})):(e.value=t,e.state=1,dp(e,!1))}catch(VZ){_p({done:!1},VZ,e)}}};if(ap&&(Jf=(Yf=function(e){If(this,Jf),Rf(e),_f(sf,this);var t=qf(this);try{e(vp(mp,t),vp(_p,t))}catch(VZ){_p(t,VZ)}}).prototype,(sf=function(e){Xf(this,{type:zf,done:!1,notified:!1,parent:!1,reactions:new Uf,rejection:!1,state:0,value:void 0})}).prototype=yf(Jf,{then:function(e,t){var r=Kf(this),n=ep(Of(this,Yf));return r.parent=!0,n.ok=!kf(e)||e,n.fail=kf(t)&&t,n.domain=jf?$f.domain:void 0,0==r.state?r.reactions.add(n):Nf((function(){cp(n,r)})),n.promise},catch:function(e){return this.then(void 0,e)}}),uf=function(){var e=new sf,t=qf(e);this.promise=e,this.resolve=vp(mp,t),this.reject=vp(_p,t)},Mf.f=ep=function(e){return e===Yf||e===cf?new uf(e):tp(e)},kf(mf)&&Wf!==Object.prototype)){df=Wf.then,op||(gf(Wf,"then",(function(e,t){var r=this;return new Yf((function(e,t){_f(df,r,e,t)})).then(e,t)}),{unsafe:!0}),gf(Wf,"catch",Jf.catch,{unsafe:!0}));try{delete Wf.constructor}catch(VZ){}Sf&&Sf(Wf,Jf)}ff({global:!0,wrap:!0,forced:ap},{Promise:Yf}),bf(Yf,zf,!1),Ef(zf),cf=vf(zf),ff({target:zf,stat:!0,forced:ap},{reject:function(e){var t=ep(this);return _f(t.reject,void 0,e),t.promise}}),ff({target:zf,stat:!0,forced:ap},{resolve:function(e){return Df(this,e)}}),ff({target:zf,stat:!0,forced:sp},{all:function(e){var t=this,r=ep(t),n=r.resolve,i=r.reject,o=Lf((function(){var r=Rf(t.resolve),o=[],a=0,s=1;wf(e,(function(e){var u=a++,c=!1;s++,_f(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},race:function(e){var t=this,r=ep(t),n=r.reject,i=Lf((function(){var i=Rf(t.resolve);wf(e,(function(e){_f(i,t,e).then(r.resolve,n)}))}));return i.error&&n(i.value),r.promise}});var gp=je,yp=He,Sp=Rc,bp=function(e,t,r){var n,i;return Sp&&gp(n=t.constructor)&&n!==r&&yp(i=n.prototype)&&i!==r.prototype&&Sp(e,i),e},Ep=vo,Rp=function(e,t){return void 0===e?arguments.length<2?"":t:Ep(e)},kp=He,Tp=Wr,Ip=Te("".replace),Ap=String(Error("zxcasd").stack),wp=/\n\s*at [^:]*:[^\n]*/,Cp=wp.test(Ap),Op=function(e,t){if(Cp&&"string"==typeof e)for(;t--;)e=Ip(e,wp,"");return e},xp=ye,Np=!se((function(){var e=Error("a");return!("stack"in e)||(Object.defineProperty(e,"stack",xp(1,7)),7!==e.stack)})),Dp=Ke,Pp=Vt,Mp=Wr,Lp=We,Up=Rc,Vp=xi,Fp=bp,Bp=Rp,jp=function(e,t){kp(t)&&"cause"in t&&Tp(e,"cause",t.cause)},Gp=Op,Hp=Np,zp=Wi,qp=$i,Xp=function(e,t,r,n){var i=n?2:1,o=e.split("."),a=o[o.length-1],s=Dp.apply(null,o);if(s){var u=s.prototype;if(Pp(u,"cause")&&delete u.cause,!r)return s;var c=Dp("Error"),d=t((function(e,t){var r=Bp(n?t:e,void 0),o=n?new s(e):new s;return void 0!==r&&Mp(o,"message",r),Hp&&Mp(o,"stack",Gp(o.stack,2)),this&&Lp(u,this)&&Fp(o,this,d),arguments.length>i&&jp(o,arguments[i]),o}));d.prototype=u,"Error"!==a&&(Up?Up(d,c):Vp(d,c,{name:!0})),Vp(d,s);try{u.name!==a&&Mp(u,"name",a),u.constructor=d}catch(VZ){}return d}},Kp="WebAssembly",Wp=oe.WebAssembly,Yp=7!==Error("e",{cause:7}).cause,Jp=function(e,t){var r={};r[e]=Xp(e,t,Yp),zp({global:!0,forced:Yp},r)},Qp=function(e,t){if(Wp&&Wp[e]){var r={};r[e]=Xp("WebAssembly."+e,t,Yp),zp({target:Kp,stat:!0,forced:Yp},r)}};Jp("Error",(function(e){return function(t){return qp(e,this,arguments)}})),Jp("EvalError",(function(e){return function(t){return qp(e,this,arguments)}})),Jp("RangeError",(function(e){return function(t){return qp(e,this,arguments)}})),Jp("ReferenceError",(function(e){return function(t){return qp(e,this,arguments)}})),Jp("SyntaxError",(function(e){return function(t){return qp(e,this,arguments)}})),Jp("TypeError",(function(e){return function(t){return qp(e,this,arguments)}})),Jp("URIError",(function(e){return function(t){return qp(e,this,arguments)}})),Qp("CompileError",(function(e){return function(t){return qp(e,this,arguments)}})),Qp("LinkError",(function(e){return function(t){return qp(e,this,arguments)}})),Qp("RuntimeError",(function(e){return function(t){return qp(e,this,arguments)}}));var Zp=se,$p=function(e,t){var r=[][e];return!!r&&Zp((function(){r.call(null,t||function(){throw 1},1)}))},ev=Ka.forEach,tv=$p("forEach")?[].forEach:function(e){return ev(this,e,arguments.length>1?arguments[1]:void 0)},rv=oe,nv=yd,iv=Ed,ov=tv,av=Wr,sv=function(e){if(e&&e.forEach!==ov)try{av(e,"forEach",ov)}catch(VZ){e.forEach=ov}};for(var uv in nv)nv[uv]&&sv(rv[uv]&&rv[uv].prototype);sv(iv);var cv=se,dv=rt,lv=er("species"),hv=function(e){return dv>=51||!cv((function(){var t=[];return(t.constructor={})[lv]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},fv=Wi,pv=oe,vv=to,_v=xa,mv=He,gv=ei,yv=oi,Sv=Be,bv=zo,Ev=er,Rv=ra,kv=hv("slice"),Tv=Ev("species"),Iv=pv.Array,Av=Math.max;fv({target:"Array",proto:!0,forced:!kv},{slice:function(e,t){var r,n,i,o=Sv(this),a=yv(o),s=gv(e,a),u=gv(void 0===t?a:t,a);if(vv(o)&&(r=o.constructor,(_v(r)&&(r===Iv||vv(r.prototype))||mv(r)&&null===(r=r[Tv]))&&(r=void 0),r===Iv||void 0===r))return Rv(o,s,u);for(n=new(void 0===r?Iv:r)(Av(u-s,0)),i=0;s<u;s++,i++)s in o&&bv(n,i,o[s]);return n.length=i,n}}),Wi({global:!0},{globalThis:oe});!function(e){var t=function(e){var t,r=Object.prototype,n=r.hasOwnProperty,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(N){c=function(e,t,r){return e[t]=r}}function d(e,t,r,n){var i=t&&t.prototype instanceof m?t:m,o=Object.create(i.prototype),a=new C(n||[]);return o._invoke=function(e,t,r){var n=h;return function(i,o){if(n===p)throw new Error("Generator is already running");if(n===v){if("throw"===i)throw o;return x()}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var s=I(a,r);if(s){if(s===_)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===h)throw n=v,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=p;var u=l(e,t,r);if("normal"===u.type){if(n=r.done?v:f,u.arg===_)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n=v,r.method="throw",r.arg=u.arg)}}}(e,r,a),o}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(N){return{type:"throw",arg:N}}}e.wrap=d;var h="suspendedStart",f="suspendedYield",p="executing",v="completed",_={};function m(){}function g(){}function y(){}var S={};c(S,a,(function(){return this}));var b=Object.getPrototypeOf,E=b&&b(b(O([])));E&&E!==r&&n.call(E,a)&&(S=E);var R=y.prototype=m.prototype=Object.create(S);function k(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function T(e,t){function r(i,a,s,u){var c=l(e[i],e,a);if("throw"!==c.type){var d=c.arg,h=d.value;return h&&"object"===o(h)&&n.call(h,"__await")?t.resolve(h.__await).then((function(e){r("next",e,s,u)}),(function(e){r("throw",e,s,u)})):t.resolve(h).then((function(e){d.value=e,s(d)}),(function(e){return r("throw",e,s,u)}))}u(c.arg)}var i;this._invoke=function(e,n){function o(){return new t((function(t,i){r(e,n,t,i)}))}return i=i?i.then(o,o):o()}}function I(e,r){var n=e.iterator[r.method];if(n===t){if(r.delegate=null,"throw"===r.method){if(e.iterator.return&&(r.method="return",r.arg=t,I(e,r),"throw"===r.method))return _;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return _}var i=l(n,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,_;var o=i.arg;return o?o.done?(r[e.resultName]=o.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,_):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,_)}function A(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 w(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function C(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(A,this),this.reset(!0)}function O(e){if(e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,o=function r(){for(;++i<e.length;)if(n.call(e,i))return r.value=e[i],r.done=!1,r;return r.value=t,r.done=!0,r};return o.next=o}}return{next:x}}function x(){return{value:t,done:!0}}return g.prototype=y,c(R,"constructor",y),c(y,"constructor",g),g.displayName=c(y,u,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,y):(e.__proto__=y,c(e,u,"GeneratorFunction")),e.prototype=Object.create(R),e},e.awrap=function(e){return{__await:e}},k(T.prototype),c(T.prototype,s,(function(){return this})),e.AsyncIterator=T,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var a=new T(d(t,r,n,i),o);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},k(R),c(R,u,"Generator"),c(R,a,(function(){return this})),c(R,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=O,C.prototype={constructor:C,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(w),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},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 r=this;function i(n,i){return s.type="throw",s.arg=e,r.next=n,i&&(r.method="next",r.arg=t),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),c=n.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var 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,_):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),_},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),w(r),_}},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;w(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:O(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),_}},e}(e.exports);try{regeneratorRuntime=t}catch(r){"object"===("undefined"==typeof globalThis?"undefined":o(globalThis))?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}}({exports:{}});var wv=di.includes,Cv=zu;Wi({target:"Array",proto:!0},{includes:function(e){return wv(this,e,arguments.length>1?arguments[1]:void 0)}}),Cv("includes");var Ov=He,xv=Ce,Nv=er("match"),Dv=function(e){var t;return Ov(e)&&(void 0!==(t=e[Nv])?!!t:"RegExp"==xv(e))},Pv=Dv,Mv=oe.TypeError,Lv=function(e){if(Pv(e))throw Mv("The method doesn't accept regular expressions");return e},Uv=er("match"),Vv=function(e){var t=/./;try{"/./"[e](t)}catch(r){try{return t[Uv]=!1,"/./"[e](t)}catch(VZ){}}return!1},Fv=Wi,Bv=Lv,jv=Ue,Gv=vo,Hv=Vv,zv=Te("".indexOf);Fv({target:"String",proto:!0,forced:!Hv("includes")},{includes:function(e){return!!~zv(Gv(jv(this)),Gv(Bv(e)),arguments.length>1?arguments[1]:void 0)}});var qv,Xv,Kv=Pr,Wv=function(){var e=Kv(this),t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.sticky&&(t+="y"),t},Yv=se,Jv=oe.RegExp,Qv=Yv((function(){var e=Jv("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),Zv=Qv||Yv((function(){return!Jv("a","y").sticky})),$v=Qv||Yv((function(){var e=Jv("^r","gy");return e.lastIndex=2,null!=e.exec("str")})),e_={BROKEN_CARET:$v,MISSED_STICKY:Zv,UNSUPPORTED_Y:Qv},t_=se,r_=oe.RegExp,n_=t_((function(){var e=r_(".","s");return!(e.dotAll&&e.exec("\n")&&"s"===e.flags)})),i_=se,o_=oe.RegExp,a_=i_((function(){var e=o_("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")})),s_=he,u_=Te,c_=vo,d_=Wv,l_=e_,h_=Tt.exports,f_=Fo,p_=On.get,v_=n_,__=a_,m_=h_("native-string-replace",String.prototype.replace),g_=RegExp.prototype.exec,y_=g_,S_=u_("".charAt),b_=u_("".indexOf),E_=u_("".replace),R_=u_("".slice),k_=(Xv=/b*/g,s_(g_,qv=/a/,"a"),s_(g_,Xv,"a"),0!==qv.lastIndex||0!==Xv.lastIndex),T_=l_.BROKEN_CARET,I_=void 0!==/()??/.exec("")[1];(k_||I_||T_||v_||__)&&(y_=function(e){var t,r,n,i,o,a,s,u=this,c=p_(u),d=c_(e),l=c.raw;if(l)return l.lastIndex=u.lastIndex,t=s_(y_,l,d),u.lastIndex=l.lastIndex,t;var h=c.groups,f=T_&&u.sticky,p=s_(d_,u),v=u.source,_=0,m=d;if(f&&(p=E_(p,"y",""),-1===b_(p,"g")&&(p+="g"),m=R_(d,u.lastIndex),u.lastIndex>0&&(!u.multiline||u.multiline&&"\n"!==S_(d,u.lastIndex-1))&&(v="(?: "+v+")",m=" "+m,_++),r=new RegExp("^(?:"+v+")",p)),I_&&(r=new RegExp("^"+v+"$(?!\\s)",p)),k_&&(n=u.lastIndex),i=s_(g_,f?r:u,m),f?i?(i.input=R_(i.input,_),i[0]=R_(i[0],_),i.index=u.lastIndex,u.lastIndex+=i[0].length):u.lastIndex=0:k_&&i&&(u.lastIndex=u.global?i.index+i[0].length:n),I_&&i&&i.length>1&&s_(m_,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=f_(null),o=0;o<h.length;o++)a[(s=h[o])[0]]=i[s[1]];return i});var A_=y_;Wi({target:"RegExp",proto:!0,forced:/./.exec!==A_},{exec:A_});var w_=Te,C_=Yr.exports,O_=A_,x_=se,N_=er,D_=Wr,P_=N_("species"),M_=RegExp.prototype,L_=function(e,t,r,n){var i=N_(e),o=!x_((function(){var t={};return t[i]=function(){return 7},7!=""[e](t)})),a=o&&!x_((function(){var t=!1,r=/a/;return"split"===e&&((r={}).constructor={},r.constructor[P_]=function(){return r},r.flags="",r[i]=/./[i]),r.exec=function(){return t=!0,null},r[i](""),!t}));if(!o||!a||r){var s=w_(/./[i]),u=t(i,""[e],(function(e,t,r,n,i){var a=w_(e),u=t.exec;return u===O_||u===M_.exec?o&&!i?{done:!0,value:s(t,r,n)}:{done:!0,value:a(r,t,n)}:{done:!1}}));C_(String.prototype,e,u[0]),C_(M_,i,u[1])}n&&D_(M_[i],"sham",!0)},U_=Object.is||function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t},V_=he,F_=Pr,B_=je,j_=Ce,G_=A_,H_=oe.TypeError,z_=function(e,t){var r=e.exec;if(B_(r)){var n=V_(r,e,t);return null!==n&&F_(n),n}if("RegExp"===j_(e))return V_(G_,e,t);throw H_("RegExp#exec called on incompatible receiver")},q_=he,X_=Pr,K_=Ue,W_=U_,Y_=vo,J_=St,Q_=z_;L_("search",(function(e,t,r){return[function(t){var r=K_(this),n=null==t?void 0:J_(t,e);return n?q_(n,t,r):new RegExp(t)[e](Y_(r))},function(e){var n=X_(this),i=Y_(e),o=r(t,n,i);if(o.done)return o.value;var a=n.lastIndex;W_(a,0)||(n.lastIndex=0);var s=Q_(n,i);return W_(n.lastIndex,a)||(n.lastIndex=a),null===s?-1:s.index}]}));var Z_=ld.charAt,$_=function(e,t,r){return t+(r?Z_(e,t).length:1)},em=he,tm=Pr,rm=ni,nm=vo,im=Ue,om=St,am=$_,sm=z_;L_("match",(function(e,t,r){return[function(t){var r=im(this),n=null==t?void 0:om(t,e);return n?em(n,t,r):new RegExp(t)[e](nm(r))},function(e){var n=tm(this),i=nm(e),o=r(t,n,i);if(o.done)return o.value;if(!n.global)return sm(n,i);var a=n.unicode;n.lastIndex=0;for(var s,u=[],c=0;null!==(s=sm(n,i));){var d=nm(s[0]);u[c]=d,""===d&&(n.lastIndex=am(i,rm(n.lastIndex),a)),c++}return 0===c?null:u}]}));var um="\t\n\v\f\r                 \u2028\u2029\ufeff",cm=Ue,dm=vo,lm=Te("".replace),hm="[\t\n\v\f\r                 \u2028\u2029\ufeff]",fm=RegExp("^"+hm+hm+"*"),pm=RegExp(hm+hm+"*$"),vm=function(e){return function(t){var r=dm(cm(t));return 1&e&&(r=lm(r,fm,"")),2&e&&(r=lm(r,pm,"")),r}},_m={start:vm(1),end:vm(2),trim:vm(3)},mm=oe,gm=se,ym=Te,Sm=vo,bm=_m.trim,Em=um,Rm=mm.parseInt,km=mm.Symbol,Tm=km&&km.iterator,Im=/^[+-]?0x/i,Am=ym(Im.exec),wm=8!==Rm(Em+"08")||22!==Rm(Em+"0x16")||Tm&&!gm((function(){Rm(Object(Tm))}))?function(e,t){var r=bm(Sm(e));return Rm(r,t>>>0||(Am(Im,r)?16:10))}:Rm;Wi({global:!0,forced:parseInt!=wm},{parseInt:wm});var Cm={exports:{}},Om=se((function(){if("function"==typeof ArrayBuffer){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}})),xm=se,Nm=He,Dm=Ce,Pm=Om,Mm=Object.isExtensible,Lm=xm((function(){Mm(1)}))||Pm?function(e){return!!Nm(e)&&((!Pm||"ArrayBuffer"!=Dm(e))&&(!Mm||Mm(e)))}:Mm,Um=!se((function(){return Object.isExtensible(Object.preventExtensions({}))})),Vm=Wi,Fm=Te,Bm=hn,jm=He,Gm=Vt,Hm=wr.f,zm=Kn,qm=Bo,Xm=Lm,Km=Um,Wm=!1,Ym=Ht("meta"),Jm=0,Qm=function(e){Hm(e,Ym,{value:{objectID:"O"+Jm++,weakData:{}}})},Zm=Cm.exports={enable:function(){Zm.enable=function(){},Wm=!0;var e=zm.f,t=Fm([].splice),r={};r[Ym]=1,e(r).length&&(zm.f=function(r){for(var n=e(r),i=0,o=n.length;i<o;i++)if(n[i]===Ym){t(n,i,1);break}return n},Vm({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:qm.f}))},fastKey:function(e,t){if(!jm(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!Gm(e,Ym)){if(!Xm(e))return"F";if(!t)return"E";Qm(e)}return e[Ym].objectID},getWeakData:function(e,t){if(!Gm(e,Ym)){if(!Xm(e))return!0;if(!t)return!1;Qm(e)}return e[Ym].weakData},onFreeze:function(e){return Km&&Wm&&Xm(e)&&!Gm(e,Ym)&&Qm(e),e}};Bm[Ym]=!0;var $m=Wi,eg=oe,tg=Te,rg=Bi,ng=Yr.exports,ig=Cm.exports,og=Ol,ag=Jd,sg=je,ug=He,cg=se,dg=Fl,lg=fa,hg=bp,fg=function(e,t,r){var n=-1!==e.indexOf("Map"),i=-1!==e.indexOf("Weak"),o=n?"set":"add",a=eg[e],s=a&&a.prototype,u=a,c={},d=function(e){var t=tg(s[e]);ng(s,e,"add"==e?function(e){return t(this,0===e?0:e),this}:"delete"==e?function(e){return!(i&&!ug(e))&&t(this,0===e?0:e)}:"get"==e?function(e){return i&&!ug(e)?void 0:t(this,0===e?0:e)}:"has"==e?function(e){return!(i&&!ug(e))&&t(this,0===e?0:e)}:function(e,r){return t(this,0===e?0:e,r),this})};if(rg(e,!sg(a)||!(i||s.forEach&&!cg((function(){(new a).entries().next()})))))u=r.getConstructor(t,e,n,o),ig.enable();else if(rg(e,!0)){var l=new u,h=l[o](i?{}:-0,1)!=l,f=cg((function(){l.has(1)})),p=dg((function(e){new a(e)})),v=!i&&cg((function(){for(var e=new a,t=5;t--;)e[o](t,t);return!e.has(-0)}));p||((u=t((function(e,t){ag(e,s);var r=hg(new a,e,u);return null!=t&&og(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,$m({global:!0,forced:u!=a},c),lg(u,e),i||r.setStrong(u,e,n),u},pg=wr.f,vg=Fo,_g=Gd,mg=ma,gg=Jd,yg=Ol,Sg=zc,bg=Kd,Eg=ue,Rg=Cm.exports.fastKey,kg=On.set,Tg=On.getterFor,Ig={getConstructor:function(e,t,r,n){var i=e((function(e,i){gg(e,o),kg(e,{type:t,index:vg(null),first:void 0,last:void 0,size:0}),Eg||(e.size=0),null!=i&&yg(i,e[n],{that:e,AS_ENTRIES:r})})),o=i.prototype,a=Tg(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=Rg(t,!0),key:t,value:r,previous:n=o.last,next:void 0,removed:!1},o.first||(o.first=s),n&&(n.next=s),Eg?o.size++:e.size++,"F"!==i&&(o.index[i]=s)),e},u=function(e,t){var r,n=a(e),i=Rg(t);if("F"!==i)return n.index[i];for(r=n.first;r;r=r.next)if(r.key==t)return r};return _g(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,Eg?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),Eg?r.size--:t.size--}return!!n},forEach:function(e){for(var t,r=a(this),n=mg(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)}}),_g(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)}}),Eg&&pg(o,"size",{get:function(){return a(this).size}}),i},setStrong:function(e,t,r){var n=t+" Iterator",i=Tg(t),o=Tg(n);Sg(e,t,(function(e,t){kg(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)?"keys"==t?{value:r.key,done:!1}:"values"==t?{value:r.value,done:!1}:{value:[r.key,r.value],done:!1}:(e.target=void 0,{value:void 0,done:!0})}),r?"entries":"values",!r,!0),bg(t)}};fg("Map",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),Ig);var Ag=Mt,wg=yo;Wi({target:"Object",stat:!0,forced:se((function(){wg(1)}))},{keys:function(e){return wg(Ag(e))}});var Cg=gt,Og=Mt,xg=Me,Ng=oi,Dg=oe.TypeError,Pg=function(e){return function(t,r,n,i){Cg(r);var o=Og(t),a=xg(o),s=Ng(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 Dg("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}},Mg={left:Pg(!1),right:Pg(!0)},Lg=Mg.left,Ug=rt,Vg=Ql;Wi({target:"Array",proto:!0,forced:!$p("reduce")||!Vg&&Ug>79&&Ug<83},{reduce:function(e){var t=arguments.length;return Lg(this,e,t,t>1?arguments[1]:void 0)}});var Fg=ue,Bg=Te,jg=he,Gg=se,Hg=yo,zg=Si,qg=fe,Xg=Mt,Kg=Me,Wg=Object.assign,Yg=Object.defineProperty,Jg=Bg([].concat),Qg=!Wg||Gg((function(){if(Fg&&1!==Wg({b:1},Wg(Yg({},"a",{enumerable:!0,get:function(){Yg(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!=Wg({},e)[r]||Hg(Wg({},t)).join("")!=n}))?function(e,t){for(var r=Xg(e),n=arguments.length,i=1,o=zg.f,a=qg.f;n>i;)for(var s,u=Kg(arguments[i++]),c=o?Jg(Hg(u),o(u)):Hg(u),d=c.length,l=0;d>l;)s=c[l++],Fg&&!jg(a,u,s)||(r[s]=u[s]);return r}:Wg,Zg=Qg;Wi({target:"Object",stat:!0,forced:Object.assign!==Zg},{assign:Zg});var $g,ey=Wi,ty=Te,ry=ae.f,ny=ni,iy=vo,oy=Lv,ay=Ue,sy=Vv,uy=ty("".endsWith),cy=ty("".slice),dy=Math.min,ly=sy("endsWith");ey({target:"String",proto:!0,forced:!!(ly||($g=ry(String.prototype,"endsWith"),!$g||$g.writable))&&!ly},{endsWith:function(e){var t=iy(ay(this));oy(e);var r=arguments.length>1?arguments[1]:void 0,n=t.length,i=void 0===r?n:dy(ny(r),n),o=iy(e);return uy?uy(t,o,i):cy(t,i-o.length,i)===o}});var hy=!0,fy=!0;function py(e,t,r){var n=e.match(t);return n&&n.length>=r&&parseInt(n[r],10)}function vy(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 _y(e){return"boolean"!=typeof e?new Error("Argument type: "+o(e)+". Please use a boolean."):(hy=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function my(e){return"boolean"!=typeof e?new Error("Argument type: "+o(e)+". Please use a boolean."):(fy=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function gy(){if("object"===("undefined"==typeof window?"undefined":o(window))){if(hy)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function yy(e,t){fy&&console.warn(e+" is deprecated, please use "+t+" instead.")}function Sy(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=py(r.userAgent,/Firefox\/(\d+)\./,1);else if(r.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection&&!e.RTCIceGatherer)t.browser="chrome",t.version=py(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=py(r.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return t}function by(e){return"[object Object]"===Object.prototype.toString.call(e)}function Ey(e){return by(e)?Object.keys(e).reduce((function(t,r){var n=by(e[r]),i=n?Ey(e[r]):e[r],o=n&&!Object.keys(i).length;return void 0===i||o?t:Object.assign(t,l({},r,i))}),{}):e}function Ry(e,t,r){t&&!r.has(t.id)&&(r.set(t.id,t),Object.keys(t).forEach((function(n){n.endsWith("Id")?Ry(e,e.get(t[n]),r):n.endsWith("Ids")&&t[n].forEach((function(t){Ry(e,e.get(t),r)}))})))}function ky(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&&Ry(e,r,i)}))})),i}var Ty=Wi,Iy=Ka.find,Ay=zu,wy="find",Cy=!0;wy in[]&&Array(1).find((function(){Cy=!1})),Ty({target:"Array",proto:!0,forced:Cy},{find:function(e){return Iy(this,e,arguments.length>1?arguments[1]:void 0)}}),Ay(wy);var Oy=Wi,xy=di.indexOf,Ny=$p,Dy=Te([].indexOf),Py=!!Dy&&1/Dy([1],1,-0)<0,My=Ny("indexOf");Oy({target:"Array",proto:!0,forced:Py||!My},{indexOf:function(e){var t=arguments.length>1?arguments[1]:void 0;return Py?Dy(this,e,t)||0:xy(this,e,t)}});var Ly=Wi,Uy=oe,Vy=ei,Fy=Jn,By=oi,jy=Mt,Gy=Fa,Hy=zo,zy=hv("splice"),qy=Uy.TypeError,Xy=Math.max,Ky=Math.min,Wy=9007199254740991,Yy="Maximum allowed length exceeded";Ly({target:"Array",proto:!0,forced:!zy},{splice:function(e,t){var r,n,i,o,a,s,u=jy(this),c=By(u),d=Vy(e,c),l=arguments.length;if(0===l?r=n=0:1===l?(r=0,n=c-d):(r=l-2,n=Ky(Xy(Fy(t),0),c-d)),c+r-n>Wy)throw qy(Yy);for(i=Gy(u,n),o=0;o<n;o++)(a=d+o)in u&&Hy(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]:delete u[s];for(o=c;o>c-n+r;o--)delete 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]:delete u[s];for(o=0;o<r;o++)u[o+d]=arguments[o+2];return u.length=c-n+r,i}});var Jy=Ka.map;Wi({target:"Array",proto:!0,forced:!hv("map")},{map:function(e){return Jy(this,e,arguments.length>1?arguments[1]:void 0)}});var Qy=Ql,Zy=ue,$y=se,eS=Pr,tS=Fo,rS=Rp,nS=Error.prototype.toString,iS=$y((function(){if(Zy){var e=tS(Object.defineProperty({},"name",{get:function(){return this===e}}));if("true"!==nS.call(e))return!0}return"2: 1"!==nS.call({message:1,name:2})||"Error"!==nS.call({})}))?function(){var e=eS(this),t=rS(e.name,"Error"),r=rS(e.message);return t?r?t+": "+r:t:r}:nS,oS={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}},aS=Wi,sS=function(e){try{if(Qy)return Function('return require("'+e+'")')()}catch(VZ){}},uS=Ke,cS=se,dS=Fo,lS=ye,hS=wr.f,fS=_o.f,pS=Yr.exports,vS=Vt,_S=Jd,mS=Pr,gS=iS,yS=Rp,SS=oS,bS=Op,ES=On,RS=ue,kS="DOMException",TS="DATA_CLONE_ERR",IS=uS("Error"),AS=uS(kS)||function(){try{(new(uS("MessageChannel")||sS("worker_threads").MessageChannel)).port1.postMessage(new WeakMap)}catch(VZ){if(VZ.name==TS&&25==VZ.code)return VZ.constructor}}(),wS=AS&&AS.prototype,CS=IS.prototype,OS=ES.set,xS=ES.getterFor(kS),NS="stack"in IS(kS),DS=function(e){return vS(SS,e)&&SS[e].m?SS[e].c:0},PS=function(){_S(this,MS);var e=arguments.length,t=yS(e<1?void 0:arguments[0]),r=yS(e<2?void 0:arguments[1],"Error"),n=DS(r);if(OS(this,{type:kS,name:r,message:t,code:n}),RS||(this.name=r,this.message=t,this.code=n),NS){var i=IS(t);i.name=kS,hS(this,"stack",lS(1,bS(i.stack,1)))}},MS=PS.prototype=dS(CS),LS=function(e){return{enumerable:!0,configurable:!0,get:e}},US=function(e){return LS((function(){return xS(this)[e]}))};RS&&fS(MS,{name:US("name"),message:US("message"),code:US("code")}),hS(MS,"constructor",lS(1,PS));var VS=cS((function(){return!(new AS instanceof IS)})),FS=VS||cS((function(){return CS.toString!==gS||"2: 1"!==String(new AS(1,2))})),BS=VS||cS((function(){return 25!==new AS(1,"DataCloneError").code}));VS||25!==AS.DATA_CLONE_ERR||wS.DATA_CLONE_ERR;aS({global:!0,forced:VS},{DOMException:VS?PS:AS});var jS=uS(kS),GS=jS.prototype;for(var HS in FS&&AS===jS&&pS(GS,"toString",gS),BS&&RS&&AS===jS&&hS(GS,"code",LS((function(){return DS(mS(this).name)}))),SS)if(vS(SS,HS)){var zS=SS[HS],qS=zS.s,XS=lS(6,zS.c);vS(jS,qS)||hS(jS,qS,XS),vS(GS,qS)||hS(GS,qS,XS)}var KS=Wi,WS=Ke,YS=ye,JS=wr.f,QS=Vt,ZS=Jd,$S=bp,eb=Rp,tb=oS,rb=Op,nb="DOMException",ib=WS("Error"),ob=WS(nb),ab=function(){ZS(this,sb);var e=arguments.length,t=eb(e<1?void 0:arguments[0]),r=eb(e<2?void 0:arguments[1],"Error"),n=new ob(t,r),i=ib(t);return i.name=nb,JS(n,"stack",YS(1,rb(i.stack,1))),$S(n,this,ab),n},sb=ab.prototype=ob.prototype,ub="stack"in ib(nb),cb="stack"in new ob(1,2),db=ub&&!cb;KS({global:!0,forced:db},{DOMException:db?ab:ob});var lb=WS(nb),hb=lb.prototype;if(hb.constructor!==lb)for(var fb in JS(hb,"constructor",YS(1,lb)),tb)if(QS(tb,fb)){var pb=tb[fb],vb=pb.s;QS(lb,vb)||JS(lb,vb,YS(6,pb.c))}var _b="DOMException";fa(Ke(_b),_b);var mb=Ka.filter;Wi({target:"Array",proto:!0,forced:!hv("filter")},{filter:function(e){return mb(this,e,arguments.length>1?arguments[1]:void 0)}});var gb=Wi,yb=oe,Sb=se,bb=to,Eb=He,Rb=Mt,kb=oi,Tb=zo,Ib=Fa,Ab=hv,wb=rt,Cb=er("isConcatSpreadable"),Ob=9007199254740991,xb="Maximum allowed index exceeded",Nb=yb.TypeError,Db=wb>=51||!Sb((function(){var e=[];return e[Cb]=!1,e.concat()[0]!==e})),Pb=Ab("concat"),Mb=function(e){if(!Eb(e))return!1;var t=e[Cb];return void 0!==t?!!t:bb(e)};gb({target:"Array",proto:!0,forced:!Db||!Pb},{concat:function(e){var t,r,n,i,o,a=Rb(this),s=Ib(a,0),u=0;for(t=-1,n=arguments.length;t<n;t++)if(Mb(o=-1===t?a:arguments[t])){if(u+(i=kb(o))>Ob)throw Nb(xb);for(r=0;r<i;r++,u++)r in o&&Tb(s,u,o[r])}else{if(u>=Ob)throw Nb(xb);Tb(s,u++,o)}return s.length=u,s}});var Lb=Te,Ub=Mt,Vb=Math.floor,Fb=Lb("".charAt),Bb=Lb("".replace),jb=Lb("".slice),Gb=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,Hb=/\$([$&'`]|\d{1,2})/g,zb=$i,qb=he,Xb=Te,Kb=L_,Wb=se,Yb=Pr,Jb=je,Qb=Jn,Zb=ni,$b=vo,eE=Ue,tE=$_,rE=St,nE=function(e,t,r,n,i,o){var a=r+e.length,s=n.length,u=Hb;return void 0!==i&&(i=Ub(i),u=Gb),Bb(o,u,(function(o,u){var c;switch(Fb(u,0)){case"$":return"$";case"&":return e;case"`":return jb(t,0,r);case"'":return jb(t,a);case"<":c=i[jb(u,1,-1)];break;default:var d=+u;if(0===d)return o;if(d>s){var l=Vb(d/10);return 0===l?o:l<=s?void 0===n[l-1]?Fb(u,1):n[l-1]+Fb(u,1):o}c=n[d-1]}return void 0===c?"":c}))},iE=z_,oE=er("replace"),aE=Math.max,sE=Math.min,uE=Xb([].concat),cE=Xb([].push),dE=Xb("".indexOf),lE=Xb("".slice),hE="$0"==="a".replace(/./,"$0"),fE=!!/./[oE]&&""===/./[oE]("a","$0"),pE=!Wb((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")}));Kb("replace",(function(e,t,r){var n=fE?"$":"$0";return[function(e,r){var n=eE(this),i=null==e?void 0:rE(e,oE);return i?qb(i,e,n,r):qb(t,$b(n),e,r)},function(e,i){var o=Yb(this),a=$b(e);if("string"==typeof i&&-1===dE(i,n)&&-1===dE(i,"$<")){var s=r(t,o,a,i);if(s.done)return s.value}var u=Jb(i);u||(i=$b(i));var c=o.global;if(c){var d=o.unicode;o.lastIndex=0}for(var l=[];;){var h=iE(o,a);if(null===h)break;if(cE(l,h),!c)break;""===$b(h[0])&&(o.lastIndex=tE(a,Zb(o.lastIndex),d))}for(var f,p="",v=0,_=0;_<l.length;_++){for(var m=$b((h=l[_])[0]),g=aE(sE(Qb(h.index),a.length),0),y=[],S=1;S<h.length;S++)cE(y,void 0===(f=h[S])?f:String(f));var b=h.groups;if(u){var E=uE([m],y,g,a);void 0!==b&&cE(E,b);var R=$b(zb(i,void 0,E))}else R=nE(m,a,g,y,b,i);g>=v&&(p+=lE(a,v,g)+R,v=g+m.length)}return p+lE(a,v)}]}),!pE||!hE||fE);var vE=ue,_E=oe,mE=Te,gE=Bi,yE=bp,SE=Wr,bE=wr.f,EE=Kn.f,RE=We,kE=Dv,TE=vo,IE=Wv,AE=e_,wE=Yr.exports,CE=se,OE=Vt,xE=On.enforce,NE=Kd,DE=n_,PE=a_,ME=er("match"),LE=_E.RegExp,UE=LE.prototype,VE=_E.SyntaxError,FE=mE(IE),BE=mE(UE.exec),jE=mE("".charAt),GE=mE("".replace),HE=mE("".indexOf),zE=mE("".slice),qE=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,XE=/a/g,KE=/a/g,WE=new LE(XE)!==XE,YE=AE.MISSED_STICKY,JE=AE.UNSUPPORTED_Y,QE=vE&&(!WE||YE||DE||PE||CE((function(){return KE[ME]=!1,LE(XE)!=XE||LE(KE)==KE||"/a/i"!=LE(XE,"i")})));if(gE("RegExp",QE)){for(var ZE=function(e,t){var r,n,i,o,a,s,u=RE(UE,this),c=kE(e),d=void 0===t,l=[],h=e;if(!u&&c&&d&&e.constructor===ZE)return e;if((c||RE(UE,e))&&(e=e.source,d&&(t="flags"in h?h.flags:FE(h))),e=void 0===e?"":TE(e),t=void 0===t?"":TE(t),h=e,DE&&"dotAll"in XE&&(n=!!t&&HE(t,"s")>-1)&&(t=GE(t,/s/g,"")),r=t,YE&&"sticky"in XE&&(i=!!t&&HE(t,"y")>-1)&&JE&&(t=GE(t,/y/g,"")),PE&&(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=jE(e,n)))t+=jE(e,++n);else if("]"===t)s=!1;else if(!s)switch(!0){case"["===t:s=!0;break;case"("===t:BE(qE,zE(e,n+1))&&(n+=2,u=!0),i+=t,c++;continue;case">"===t&&u:if(""===d||OE(a,d))throw new VE("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=yE(LE(e,t),u?this:UE,ZE),(n||i||l.length)&&(s=xE(a),n&&(s.dotAll=!0,s.raw=ZE(function(e){for(var t,r=e.length,n=0,i="",o=!1;n<=r;n++)"\\"!==(t=jE(e,n))?o||"."!==t?("["===t?o=!0:"]"===t&&(o=!1),i+=t):i+="[\\s\\S]":i+=t+jE(e,++n);return i}(e),r)),i&&(s.sticky=!0),l.length&&(s.groups=l)),e!==h)try{SE(a,"source",""===h?"(?:)":h)}catch(VZ){}return a},$E=function(e){e in ZE||bE(ZE,e,{configurable:!0,get:function(){return LE[e]},set:function(t){LE[e]=t}})},eR=EE(LE),tR=0;eR.length>tR;)$E(eR[tR++]);UE.constructor=ZE,ZE.prototype=UE,wE(_E,"RegExp",ZE)}NE("RegExp");var rR=oe,nR=ue,iR=n_,oR=Ce,aR=wr.f,sR=On.get,uR=RegExp.prototype,cR=rR.TypeError;nR&&iR&&aR(uR,"dotAll",{configurable:!0,get:function(){if(this!==uR){if("RegExp"===oR(this))return!!sR(this).dotAll;throw cR("Incompatible receiver, RegExp required")}}});var dR=oe,lR=ue,hR=e_.MISSED_STICKY,fR=Ce,pR=wr.f,vR=On.get,_R=RegExp.prototype,mR=dR.TypeError;lR&&hR&&pR(_R,"sticky",{configurable:!0,get:function(){if(this!==_R){if("RegExp"===fR(this))return!!vR(this).sticky;throw mR("Incompatible receiver, RegExp required")}}});var gR=Te,yR=Ln.PROPER,SR=Yr.exports,bR=Pr,ER=We,RR=vo,kR=se,TR=Wv,IR="toString",AR=RegExp.prototype,wR=AR.toString,CR=gR(TR),OR=kR((function(){return"/a/b"!=wR.call({source:"a",flags:"b"})})),xR=yR&&wR.name!=IR;(OR||xR)&&SR(RegExp.prototype,IR,(function(){var e=bR(this),t=RR(e.source),r=e.flags;return"/"+t+"/"+RR(void 0===r&&ER(AR,e)&&!("flags"in AR)?CR(e):r)}),{unsafe:!0});var NR=Wi,DR=se,PR=Be,MR=ae.f,LR=ue,UR=DR((function(){MR(1)}));NR({target:"Object",stat:!0,forced:!LR||UR,sham:!LR},{getOwnPropertyDescriptor:function(e,t){return MR(PR(e),t)}});var VR=Wi,FR=Ke,BR=$i,jR=Te,GR=se,HR=oe.Array,zR=FR("JSON","stringify"),qR=jR(/./.exec),XR=jR("".charAt),KR=jR("".charCodeAt),WR=jR("".replace),YR=jR(1..toString),JR=/[\uD800-\uDFFF]/g,QR=/^[\uD800-\uDBFF]$/,ZR=/^[\uDC00-\uDFFF]$/,$R=function(e,t,r){var n=XR(r,t-1),i=XR(r,t+1);return qR(QR,e)&&!qR(ZR,i)||qR(ZR,e)&&!qR(QR,n)?"\\u"+YR(KR(e,0),16):e},ek=GR((function(){return'"\\udf06\\ud834"'!==zR("\udf06\ud834")||'"\\udead"'!==zR("\udead")}));zR&&VR({target:"JSON",stat:!0,forced:ek},{stringify:function(e,t,r){for(var n=0,i=arguments.length,o=HR(i);n<i;n++)o[n]=arguments[n];var a=BR(zR,null,o);return"string"==typeof a?WR(a,JR,$R):a}});var tk=gy;function rk(e,t){var r=e&&e.navigator;if(r.mediaDevices){var n=function(e){if("object"!==o(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"===o(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 a={};"number"==typeof n.ideal?(a[i("min",r)]=n.ideal,t.optional.push(a),(a={})[i("max",r)]=n.ideal,t.optional.push(a)):(a[i("",r)]=n.ideal,t.optional.push(a))}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"===o(e.audio)){var a=function(e,t,r){t in e&&!(r in e)&&(e[r]=e[t],delete e[t])};a((e=JSON.parse(JSON.stringify(e))).audio,"autoGainControl","googAutoGainControl"),a(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=n(e.audio)}if(e&&"object"===o(e.video)){var s=e.video.facingMode;s=s&&("object"===o(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),tk("chrome: "+JSON.stringify(e)),i(e)}));e.video=n(e.video)}return tk("chrome: "+JSON.stringify(e)),i(e)},a=function(e){return t.version>=64?e:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[e.name]||e.name,message:e.message,constraint:e.constraint||e.constraintName,toString: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(a(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(a(e))}))}))}}}}function nk(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function ik(e){if("object"===o(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 vy(e,"track",(function(e){return e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e}))}function ok(e){if("object"===o(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 a=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;this._senders=this._senders||[],a.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"===o(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 ak(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 sk(e){if("object"===o(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 ky(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}),vy(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 ky(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 uk(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 ck(e,t){if(e.RTCPeerConnection){if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return uk(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=l({},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 dk(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=l({},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){vy(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 hk,fk,pk=Object.freeze(Object.defineProperty({__proto__:null,shimMediaStream:nk,shimOnTrack:ik,shimGetSendersWithDtmf:ok,shimGetStats:ak,shimSenderReceiverGetStats:sk,shimAddTrackRemoveTrackWithNative:uk,shimAddTrackRemoveTrack:ck,shimPeerConnection:dk,fixNegotiationNeeded:lk,shimGetUserMedia:rk,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"})),vk=Wi,_k=oe,mk=he,gk=Te,yk=je,Sk=He,bk=(hk=!1,(fk=/[ac]/).exec=function(){return hk=!0,/./.exec.apply(this,arguments)},!0===fk.test("abc")&&hk),Ek=_k.Error,Rk=gk(/./.test);vk({target:"RegExp",proto:!0,forced:!bk},{test:function(e){var t=this.exec;if(!yk(t))return Rk(this,e);var r=mk(t,this,e);if(null!==r&&!Sk(r))throw new Ek("RegExp exec method returned something other than an Object or null");return!!r}});var kk=oe,Tk=se,Ik=vo,Ak=_m.trim,wk=Te("".charAt),Ck=kk.parseFloat,Ok=kk.Symbol,xk=Ok&&Ok.iterator,Nk=1/Ck("\t\n\v\f\r                 \u2028\u2029\ufeff-0")!=-1/0||xk&&!Tk((function(){Ck(Object(xk))}))?function(e){var t=Ak(Ik(e)),r=Ck(t);return 0===r&&"-"==wk(t,0)?-0:r}:Ck;Wi({global:!0,forced:parseFloat!=Nk},{parseFloat:Nk});var Dk=Wi,Pk=Bd,Mk=se,Lk=Ke,Uk=je,Vk=Kl,Fk=nf,Bk=Yr.exports;if(Dk({target:"Promise",proto:!0,real:!0,forced:!!Pk&&Mk((function(){Pk.prototype.finally.call({then:function(){}},(function(){}))}))},{finally:function(e){var t=Vk(this,Lk("Promise")),r=Uk(e);return this.then(r?function(r){return Fk(t,e()).then((function(){return r}))}:e,r?function(r){return Fk(t,e()).then((function(){throw r}))}:e)}}),Uk(Pk)){var jk=Lk("Promise").prototype.finally;Pk.prototype.finally!==jk&&Bk(Pk.prototype,"finally",jk,{unsafe:!0})}function Gk(e,t){var r=e&&e.navigator,n=e&&e.MediaStreamTrack;if(r.getUserMedia=function(e,t,n){yy("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])},a=r.mediaDevices.getUserMedia.bind(r.mediaDevices);if(r.mediaDevices.getUserMedia=function(e){return"object"===o(e)&&"object"===o(e.audio)&&(e=JSON.parse(JSON.stringify(e)),i(e.audio,"autoGainControl","mozAutoGainControl"),i(e.audio,"noiseSuppression","mozNoiseSuppression")),a(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"===o(e)&&(e=JSON.parse(JSON.stringify(e)),i(e,"autoGainControl","mozAutoGainControl"),i(e,"noiseSuppression","mozNoiseSuppression")),u.apply(this,[e])}}}}function Hk(e){"object"===o(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 zk(e,t){if("object"===o(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=l({},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 qk(e){if("object"===o(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 Xk(e){if("object"===o(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}),vy(e,"track",(function(e){return e.receiver._pc=e.srcElement,e})),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}}function Kk(e){e.RTCPeerConnection&&!("removeStream"in e.RTCPeerConnection.prototype)&&(e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;yy("removeStream","removeTrack"),this.getSenders().forEach((function(r){r.track&&e.getTracks().includes(r.track)&&t.removeTrack(r)}))})}function Wk(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function Yk(e){if("object"===o(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.addTransceiver;t&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];var e=arguments[1],r=e&&"sendEncodings"in e;r&&e.sendEncodings.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.sendEncodings,i.sendEncodings=e.sendEncodings,this.setParametersPromises.push(i.setParameters(o).then((function(){delete i.sendEncodings})).catch((function(){delete i.sendEncodings}))))}return n})}}function Jk(e){if("object"===o(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 Qk(e){if("object"===o(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 Zk(e){if("object"===o(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 $k=Object.freeze(Object.defineProperty({__proto__:null,shimOnTrack:Hk,shimPeerConnection:zk,shimSenderGetStats:qk,shimReceiverGetStats:Xk,shimRemoveStream:Kk,shimRTCDataChannel:Wk,shimAddTransceiver:Yk,shimGetParameters:Jk,shimCreateOffer:Qk,shimCreateAnswer:Zk,shimGetUserMedia:Gk,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 eT(e){if("object"===o(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 tT(e){if("object"===o(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"===o(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype,r=t.createOffer,n=t.createAnswer,i=t.setLocalDescription,a=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=a.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 nT(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(iT(e))}}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,r,n){t.mediaDevices.getUserMedia(e).then(r,n)}.bind(t))}function iT(e){return e&&void 0!==e.video?Object.assign({},e,{video:Ey(e.video)}):e}function oT(e){if(e.RTCPeerConnection){var t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,r){if(e&&e.iceServers){for(var n=[],i=0;i<e.iceServers.length;i++){var o=e.iceServers[i];!o.hasOwnProperty("urls")&&o.hasOwnProperty("url")?(yy("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 aT(e){"object"===o(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 sT(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 uT(e){"object"!==o(e)||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var cT=Object.freeze(Object.defineProperty({__proto__:null,shimLocalStreamsAPI:eT,shimRemoteStreamsAPI:tT,shimCallbacksAPI:rT,shimGetUserMedia:nT,shimConstraints:iT,shimRTCIceServerUrls:oT,shimTrackEventTransceiver:aT,shimCreateOfferLegacy:sT,shimAudioContext:uT},Symbol.toStringTag,{value:"Module"})),dT=he;Wi({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return dT(URL.prototype.toString,this)}});var lT=Te(1..valueOf),hT=ue,fT=oe,pT=Te,vT=Bi,_T=Yr.exports,mT=Vt,gT=bp,yT=We,ST=ht,bT=cr,ET=se,RT=Kn.f,kT=ae.f,TT=wr.f,IT=lT,AT=_m.trim,wT="Number",CT=fT.Number,OT=CT.prototype,xT=fT.TypeError,NT=pT("".slice),DT=pT("".charCodeAt),PT=function(e){var t=bT(e,"number");return"bigint"==typeof t?t:MT(t)},MT=function(e){var t,r,n,i,o,a,s,u,c=bT(e,"number");if(ST(c))throw xT("Cannot convert a Symbol value to a number");if("string"==typeof c&&c.length>2)if(c=AT(c),43===(t=DT(c,0))||45===t){if(88===(r=DT(c,2))||120===r)return NaN}else if(48===t){switch(DT(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=NT(c,2)).length,s=0;s<a;s++)if((u=DT(o,s))<48||u>i)return NaN;return parseInt(o,n)}return+c};if(vT(wT,!CT(" 0o1")||!CT("0b1")||CT("+0x1"))){for(var LT,UT=function(e){var t=arguments.length<1?0:CT(PT(e)),r=this;return yT(OT,r)&&ET((function(){IT(r)}))?gT(Object(t),r,UT):t},VT=hT?RT(CT):"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(","),FT=0;VT.length>FT;FT++)mT(CT,LT=VT[FT])&&!mT(UT,LT)&&TT(UT,LT,kT(CT,LT));UT.prototype=OT,OT.constructor=UT,_T(fT,wT,UT)}var BT=$i,jT=he,GT=Te,HT=L_,zT=Dv,qT=Pr,XT=Ue,KT=Kl,WT=$_,YT=ni,JT=vo,QT=St,ZT=Jo,$T=z_,eI=A_,tI=se,rI=e_.UNSUPPORTED_Y,nI=4294967295,iI=Math.min,oI=[].push,aI=GT(/./.exec),sI=GT(oI),uI=GT("".slice),cI=!tI((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]}));HT("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=JT(XT(this)),i=void 0===r?nI:r>>>0;if(0===i)return[];if(void 0===e)return[n];if(!zT(e))return jT(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=jT(eI,l,n))&&!((a=l.lastIndex)>d&&(sI(u,uI(n,d,o.index)),o.length>1&&o.index<n.length&&BT(oI,u,ZT(o,1)),s=o[0].length,d=a,u.length>=i));)l.lastIndex===o.index&&l.lastIndex++;return d===n.length?!s&&aI(l,"")||sI(u,""):sI(u,uI(n,d)),u.length>i?ZT(u,0,i):u}:"0".split(void 0,0).length?function(e,r){return void 0===e&&0===r?[]:jT(t,this,e,r)}:t,[function(t,r){var i=XT(this),o=null==t?void 0:QT(t,e);return o?jT(o,t,i,r):jT(n,JT(i),t,r)},function(e,i){var o=qT(this),a=JT(e),s=r(n,o,a,i,n!==t);if(s.done)return s.value;var u=KT(o,RegExp),c=o.unicode,d=(o.ignoreCase?"i":"")+(o.multiline?"m":"")+(o.unicode?"u":"")+(rI?"g":"y"),l=new u(rI?"^(?:"+o.source+")":o,d),h=void 0===i?nI:i>>>0;if(0===h)return[];if(0===a.length)return null===$T(l,a)?[a]:[];for(var f=0,p=0,v=[];p<a.length;){l.lastIndex=rI?0:p;var _,m=$T(l,rI?uI(a,p):a);if(null===m||(_=iI(YT(l.lastIndex+(rI?p:0)),a.length))===f)p=WT(a,p,c);else{if(sI(v,uI(a,f,p)),v.length===h)return v;for(var g=1;g<=m.length-1;g++)if(sI(v,m[g]),v.length===h)return v;p=f=_}}return sI(v,uI(a,f)),v}]}),!cI,rI);var dI=Ln.PROPER,lI=se,hI=um,fI=_m.trim;Wi({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"===o(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,gI=e({__proto__:null,default:mI},[_I.exports]);function yI(e){if(!(!e.RTCIceCandidate||e.RTCIceCandidate&&"foundation"in e.RTCIceCandidate.prototype)){var t=e.RTCIceCandidate;e.RTCIceCandidate=function(e){if("object"===o(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,vy(e,"icecandidate",(function(t){return t.candidate&&Object.defineProperty(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t}))}}function SI(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 bI(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},vy(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 EI(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 RI(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 kI(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 TI(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"!==o(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 II=Object.freeze(Object.defineProperty({__proto__:null,shimRTCIceCandidate:yI,shimMaxMessageSize:SI,shimSendThrowTypeError:bI,shimConnectionState:EI,removeExtmapAllowMixed:RI,shimAddIceCandidateNullOrEmpty:kI,shimParameterlessSetLocalDescription:TI},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=gy,i=Sy(t),o={browserDetails:i,commonShim:II,extractVersion:py,disableLog:_y,disableWarnings:my,sdp:gI};switch(i.browser){case"chrome":if(!pk||!dk||!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=pk,kI(t,i),TI(t),rk(t,i),nk(t),dk(t,i),ik(t),ck(t,i),ok(t),ak(t),sk(t),lk(t,i),yI(t),EI(t),SI(t,i),bI(t),RI(t,i);break;case"firefox":if(!$k||!zk||!r.shimFirefox)return n("Firefox shim is not included in this adapter release."),o;n("adapter.js shimming firefox."),o.browserShim=$k,kI(t,i),TI(t),Gk(t,i),zk(t,i),Hk(t),Kk(t),qk(t),Xk(t),Wk(t),Yk(t),Jk(t),Qk(t),Zk(t),yI(t),EI(t),SI(t,i),bI(t);break;case"safari":if(!cT||!r.shimSafari)return n("Safari shim is not included in this adapter release."),o;n("adapter.js shimming safari."),o.browserShim=cT,kI(t,i),TI(t),oT(t),sT(t),rT(t),eT(t),tT(t),aT(t),nT(t),uT(t),yI(t),SI(t,i),bI(t),RI(t,i);break;default:n("Unsupported browser!")}}({window:"undefined"==typeof window?void 0:window});var AI=Jo,wI=Math.floor,CI=function(e,t){var r=e.length,n=wI(r/2);return r<8?OI(e,t):xI(e,CI(AI(e,0,n),t),CI(AI(e,n),t),t)},OI=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},xI=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},NI=CI,DI=Ye.match(/firefox\/(\d+)/i),PI=!!DI&&+DI[1],MI=/MSIE|Trident/.test(Ye),LI=Ye.match(/AppleWebKit\/(\d+)\./),UI=!!LI&&+LI[1],VI=Wi,FI=Te,BI=gt,jI=Mt,GI=oi,HI=vo,zI=se,qI=NI,XI=$p,KI=PI,WI=MI,YI=rt,JI=UI,QI=[],ZI=FI(QI.sort),$I=FI(QI.push),eA=zI((function(){QI.sort(void 0)})),tA=zI((function(){QI.sort(null)})),rA=XI("sort"),nA=!zI((function(){if(YI)return YI<70;if(!(KI&&KI>3)){if(WI)return!0;if(JI)return JI<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++)QI.push({k:t+n,v:r})}for(QI.sort((function(e,t){return t.v-e.v})),n=0;n<QI.length;n++)t=QI[n].k.charAt(0),i.charAt(i.length-1)!==t&&(i+=t);return"DGBEFHACIJK"!==i}}));VI({target:"Array",proto:!0,forced:eA||!tA||!rA||!nA},{sort:function(e){void 0!==e&&BI(e);var t=jI(this);if(nA)return void 0===e?ZI(t):ZI(t,e);var r,n,i=[],o=GI(t);for(n=0;n<o;n++)n in t&&$I(i,t[n]);for(qI(i,function(e){return function(t,r){return void 0===r?-1:void 0===t?1:void 0!==e?+e(t,r)||0:HI(t)>HI(r)?1:-1}}(e)),r=i.length,n=0;n<r;)t[n]=i[n++];for(;n<o;)delete t[n++];return t}});var iA,oA,aA,sA={exports:{}},uA="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView,cA=uA,dA=ue,lA=oe,hA=je,fA=He,pA=Vt,vA=ho,_A=pt,mA=Wr,gA=Yr.exports,yA=wr.f,SA=We,bA=tc,EA=Rc,RA=er,kA=Ht,TA=lA.Int8Array,IA=TA&&TA.prototype,AA=lA.Uint8ClampedArray,wA=AA&&AA.prototype,CA=TA&&bA(TA),OA=IA&&bA(IA),xA=Object.prototype,NA=lA.TypeError,DA=RA("toStringTag"),PA=kA("TYPED_ARRAY_TAG"),MA=kA("TYPED_ARRAY_CONSTRUCTOR"),LA=cA&&!!EA&&"Opera"!==vA(lA.opera),UA=!1,VA={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},FA={BigInt64Array:8,BigUint64Array:8},BA=function(e){if(!fA(e))return!1;var t=vA(e);return pA(VA,t)||pA(FA,t)};for(iA in VA)(aA=(oA=lA[iA])&&oA.prototype)?mA(aA,MA,oA):LA=!1;for(iA in FA)(aA=(oA=lA[iA])&&oA.prototype)&&mA(aA,MA,oA);if((!LA||!hA(CA)||CA===Function.prototype)&&(CA=function(){throw NA("Incorrect invocation")},LA))for(iA in VA)lA[iA]&&EA(lA[iA],CA);if((!LA||!OA||OA===xA)&&(OA=CA.prototype,LA))for(iA in VA)lA[iA]&&EA(lA[iA].prototype,OA);if(LA&&bA(wA)!==OA&&EA(wA,OA),dA&&!pA(OA,DA))for(iA in UA=!0,yA(OA,DA,{get:function(){return fA(this)?this[PA]:void 0}}),VA)lA[iA]&&mA(lA[iA],PA,iA);var jA={NATIVE_ARRAY_BUFFER_VIEWS:LA,TYPED_ARRAY_CONSTRUCTOR:MA,TYPED_ARRAY_TAG:UA&&PA,aTypedArray:function(e){if(BA(e))return e;throw NA("Target is not a typed array")},aTypedArrayConstructor:function(e){if(hA(e)&&(!EA||SA(CA,e)))return e;throw NA(_A(e)+" is not a typed array constructor")},exportTypedArrayMethod:function(e,t,r,n){if(dA){if(r)for(var i in VA){var o=lA[i];if(o&&pA(o.prototype,e))try{delete o.prototype[e]}catch(VZ){try{o.prototype[e]=t}catch(a){}}}OA[e]&&!r||gA(OA,e,r?t:LA&&IA[e]||t,n)}},exportTypedArrayStaticMethod:function(e,t,r){var n,i;if(dA){if(EA){if(r)for(n in VA)if((i=lA[n])&&pA(i,e))try{delete i[e]}catch(VZ){}if(CA[e]&&!r)return;try{return gA(CA,e,r?t:LA&&CA[e]||t)}catch(VZ){}}for(n in VA)!(i=lA[n])||i[e]&&!r||gA(i,e,t)}},isView:function(e){if(!fA(e))return!1;var t=vA(e);return"DataView"===t||pA(VA,t)||pA(FA,t)},isTypedArray:BA,TypedArray:CA,TypedArrayPrototype:OA},GA=oe,HA=se,zA=Fl,qA=jA.NATIVE_ARRAY_BUFFER_VIEWS,XA=GA.ArrayBuffer,KA=GA.Int8Array,WA=!qA||!HA((function(){KA(1)}))||!HA((function(){new KA(-1)}))||!zA((function(e){new KA,new KA(null),new KA(1.5),new KA(e)}),!0)||HA((function(){return 1!==new KA(new XA(2),1,void 0).length})),YA=Jn,JA=ni,QA=oe.RangeError,ZA=function(e){if(void 0===e)return 0;var t=YA(e),r=JA(t);if(t!==r)throw QA("Wrong length or index");return r},$A=oe.Array,ew=Math.abs,tw=Math.pow,rw=Math.floor,nw=Math.log,iw=Math.LN2,ow=Mt,aw=ei,sw=oi,uw=function(e){for(var t=ow(this),r=sw(t),n=arguments.length,i=aw(n>1?arguments[1]:void 0,r),o=n>2?arguments[2]:void 0,a=void 0===o?r:aw(o,r);a>i;)t[i++]=e;return t},cw=oe,dw=Te,lw=ue,hw=uA,fw=Ln,pw=Wr,vw=Gd,_w=se,mw=Jd,gw=Jn,yw=ni,Sw=ZA,bw={pack:function(e,t,r){var n,i,o,a=$A(r),s=8*r-t-1,u=(1<<s)-1,c=u>>1,d=23===t?tw(2,-24)-tw(2,-77):0,l=e<0||0===e&&1/e<0?1:0,h=0;for((e=ew(e))!=e||e===1/0?(i=e!=e?1:0,n=u):(n=rw(nw(e)/iw),e*(o=tw(2,-n))<1&&(n--,o*=2),(e+=n+c>=1?d/o:d*tw(2,1-c))*o>=2&&(n++,o/=2),n+c>=u?(i=0,n=u):n+c>=1?(i=(e*o-1)*tw(2,t),n+=c):(i=e*tw(2,c-1)*tw(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+=tw(2,t),d-=a}return(c?-1:1)*r*tw(2,d-t)}},Ew=tc,Rw=Rc,kw=Kn.f,Tw=wr.f,Iw=uw,Aw=Jo,ww=fa,Cw=fw.PROPER,Ow=fw.CONFIGURABLE,xw=On.get,Nw=On.set,Dw="ArrayBuffer",Pw="DataView",Mw="Wrong index",Lw=cw.ArrayBuffer,Uw=Lw,Vw=Uw&&Uw.prototype,Fw=cw.DataView,Bw=Fw&&Fw.prototype,jw=Object.prototype,Gw=cw.Array,Hw=cw.RangeError,zw=dw(Iw),qw=dw([].reverse),Xw=bw.pack,Kw=bw.unpack,Ww=function(e){return[255&e]},Yw=function(e){return[255&e,e>>8&255]},Jw=function(e){return[255&e,e>>8&255,e>>16&255,e>>24&255]},Qw=function(e){return e[3]<<24|e[2]<<16|e[1]<<8|e[0]},Zw=function(e){return Xw(e,23,4)},$w=function(e){return Xw(e,52,8)},eC=function(e,t){Tw(e.prototype,t,{get:function(){return xw(this)[t]}})},tC=function(e,t,r,n){var i=Sw(r),o=xw(e);if(i+t>o.byteLength)throw Hw(Mw);var a=xw(o.buffer).bytes,s=i+o.byteOffset,u=Aw(a,s,s+t);return n?u:qw(u)},rC=function(e,t,r,n,i,o){var a=Sw(r),s=xw(e);if(a+t>s.byteLength)throw Hw(Mw);for(var u=xw(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(hw){var nC=Cw&&Lw.name!==Dw;if(_w((function(){Lw(1)}))&&_w((function(){new Lw(-1)}))&&!_w((function(){return new Lw,new Lw(1.5),new Lw(NaN),nC&&!Ow})))nC&&Ow&&pw(Lw,"name",Dw);else{(Uw=function(e){return mw(this,Vw),new Lw(Sw(e))}).prototype=Vw;for(var iC,oC=kw(Lw),aC=0;oC.length>aC;)(iC=oC[aC++])in Uw||pw(Uw,iC,Lw[iC]);Vw.constructor=Uw}Rw&&Ew(Bw)!==jw&&Rw(Bw,jw);var sC=new Fw(new Uw(2)),uC=dw(Bw.setInt8);sC.setInt8(0,2147483648),sC.setInt8(1,2147483649),!sC.getInt8(0)&&sC.getInt8(1)||vw(Bw,{setInt8:function(e,t){uC(this,e,t<<24>>24)},setUint8:function(e,t){uC(this,e,t<<24>>24)}},{unsafe:!0})}else Vw=(Uw=function(e){mw(this,Vw);var t=Sw(e);Nw(this,{bytes:zw(Gw(t),0),byteLength:t}),lw||(this.byteLength=t)}).prototype,Bw=(Fw=function(e,t,r){mw(this,Bw),mw(e,Vw);var n=xw(e).byteLength,i=gw(t);if(i<0||i>n)throw Hw("Wrong offset");if(i+(r=void 0===r?n-i:yw(r))>n)throw Hw("Wrong length");Nw(this,{buffer:e,byteLength:r,byteOffset:i}),lw||(this.buffer=e,this.byteLength=r,this.byteOffset=i)}).prototype,lw&&(eC(Uw,"byteLength"),eC(Fw,"buffer"),eC(Fw,"byteLength"),eC(Fw,"byteOffset")),vw(Bw,{getInt8:function(e){return tC(this,1,e)[0]<<24>>24},getUint8:function(e){return tC(this,1,e)[0]},getInt16:function(e){var t=tC(this,2,e,arguments.length>1?arguments[1]:void 0);return(t[1]<<8|t[0])<<16>>16},getUint16:function(e){var t=tC(this,2,e,arguments.length>1?arguments[1]:void 0);return t[1]<<8|t[0]},getInt32:function(e){return Qw(tC(this,4,e,arguments.length>1?arguments[1]:void 0))},getUint32:function(e){return Qw(tC(this,4,e,arguments.length>1?arguments[1]:void 0))>>>0},getFloat32:function(e){return Kw(tC(this,4,e,arguments.length>1?arguments[1]:void 0),23)},getFloat64:function(e){return Kw(tC(this,8,e,arguments.length>1?arguments[1]:void 0),52)},setInt8:function(e,t){rC(this,1,e,Ww,t)},setUint8:function(e,t){rC(this,1,e,Ww,t)},setInt16:function(e,t){rC(this,2,e,Yw,t,arguments.length>2?arguments[2]:void 0)},setUint16:function(e,t){rC(this,2,e,Yw,t,arguments.length>2?arguments[2]:void 0)},setInt32:function(e,t){rC(this,4,e,Jw,t,arguments.length>2?arguments[2]:void 0)},setUint32:function(e,t){rC(this,4,e,Jw,t,arguments.length>2?arguments[2]:void 0)},setFloat32:function(e,t){rC(this,4,e,Zw,t,arguments.length>2?arguments[2]:void 0)},setFloat64:function(e,t){rC(this,8,e,$w,t,arguments.length>2?arguments[2]:void 0)}});ww(Uw,Dw),ww(Fw,Pw);var cC={ArrayBuffer:Uw,DataView:Fw},dC=He,lC=Math.floor,hC=Number.isInteger||function(e){return!dC(e)&&isFinite(e)&&lC(e)===e},fC=Jn,pC=oe.RangeError,vC=function(e){var t=fC(e);if(t<0)throw pC("The argument can't be less than 0");return t},_C=oe.RangeError,mC=function(e,t){var r=vC(e);if(r%t)throw _C("Wrong offset");return r},gC=ma,yC=he,SC=Hl,bC=Mt,EC=oi,RC=hl,kC=ol,TC=el,IC=jA.aTypedArrayConstructor,AC=Wi,wC=oe,CC=he,OC=ue,xC=WA,NC=jA,DC=cC,PC=Jd,MC=ye,LC=Wr,UC=hC,VC=ni,FC=ZA,BC=mC,jC=hr,GC=Vt,HC=ho,zC=He,qC=ht,XC=Fo,KC=We,WC=Rc,YC=Kn.f,JC=function(e){var t,r,n,i,o,a,s=SC(this),u=bC(e),c=arguments.length,d=c>1?arguments[1]:void 0,l=void 0!==d,h=kC(u);if(h&&!TC(h))for(a=(o=RC(u,h)).next,u=[];!(i=yC(a,o)).done;)u.push(i.value);for(l&&c>2&&(d=gC(d,arguments[2])),r=EC(u),n=new(IC(s))(r),t=0;r>t;t++)n[t]=l?d(u[t],t):u[t];return n},QC=Ka.forEach,ZC=Kd,$C=wr,eO=ae,tO=bp,rO=On.get,nO=On.set,iO=$C.f,oO=eO.f,aO=Math.round,sO=wC.RangeError,uO=DC.ArrayBuffer,cO=uO.prototype,dO=DC.DataView,lO=NC.NATIVE_ARRAY_BUFFER_VIEWS,hO=NC.TYPED_ARRAY_CONSTRUCTOR,fO=NC.TYPED_ARRAY_TAG,pO=NC.TypedArray,vO=NC.TypedArrayPrototype,_O=NC.aTypedArrayConstructor,mO=NC.isTypedArray,gO="BYTES_PER_ELEMENT",yO="Wrong length",SO=function(e,t){_O(e);for(var r=0,n=t.length,i=new e(n);n>r;)i[r]=t[r++];return i},bO=function(e,t){iO(e,t,{get:function(){return rO(this)[t]}})},EO=function(e){var t;return KC(cO,e)||"ArrayBuffer"==(t=HC(e))||"SharedArrayBuffer"==t},RO=function(e,t){return mO(e)&&!qC(t)&&t in e&&UC(+t)&&t>=0},kO=function(e,t){return t=jC(t),RO(e,t)?MC(2,e[t]):oO(e,t)},TO=function(e,t,r){return t=jC(t),!(RO(e,t)&&zC(r)&&GC(r,"value"))||GC(r,"get")||GC(r,"set")||r.configurable||GC(r,"writable")&&!r.writable||GC(r,"enumerable")&&!r.enumerable?iO(e,t,r):(e[t]=r.value,e)};OC?(lO||(eO.f=kO,$C.f=TO,bO(vO,"buffer"),bO(vO,"byteOffset"),bO(vO,"byteLength"),bO(vO,"length")),AC({target:"Object",stat:!0,forced:!lO},{getOwnPropertyDescriptor:kO,defineProperty:TO}),sA.exports=function(e,t,r){var n=e.match(/\d+$/)[0]/8,i=e+(r?"Clamped":"")+"Array",o="get"+e,a="set"+e,s=wC[i],u=s,c=u&&u.prototype,d={},l=function(e,t){iO(e,t,{get:function(){return function(e,t){var r=rO(e);return r.view[o](t*n+r.byteOffset,!0)}(this,t)},set:function(e){return function(e,t,i){var o=rO(e);r&&(i=(i=aO(i))<0?0:i>255?255:255&i),o.view[a](t*n+o.byteOffset,i,!0)}(this,t,e)},enumerable:!0})};lO?xC&&(u=t((function(e,t,r,i){return PC(e,c),tO(zC(t)?EO(t)?void 0!==i?new s(t,BC(r,n),i):void 0!==r?new s(t,BC(r,n)):new s(t):mO(t)?SO(u,t):CC(JC,u,t):new s(FC(t)),e,u)})),WC&&WC(u,pO),QC(YC(s),(function(e){e in u||LC(u,e,s[e])})),u.prototype=c):(u=t((function(e,t,r,i){PC(e,c);var o,a,s,d=0,h=0;if(zC(t)){if(!EO(t))return mO(t)?SO(u,t):CC(JC,u,t);o=t,h=BC(r,n);var f=t.byteLength;if(void 0===i){if(f%n)throw sO(yO);if((a=f-h)<0)throw sO(yO)}else if((a=VC(i)*n)+h>f)throw sO(yO);s=a/n}else s=FC(t),o=new uO(a=s*n);for(nO(e,{buffer:o,byteOffset:h,byteLength:a,length:s,view:new dO(o)});d<s;)l(e,d++)})),WC&&WC(u,pO),c=u.prototype=XC(vO)),c.constructor!==u&&LC(c,"constructor",u),LC(c,hO,u),fO&&LC(c,fO,i),d[i]=u,AC({global:!0,forced:u!=s,sham:!lO},d),gO in u||LC(u,gO,n),gO in c||LC(c,gO,n),ZC(i)}):sA.exports=function(){},(0,sA.exports)("Uint8",(function(e){return function(t,r,n){return e(this,t,r,n)}}));var IO=oi,AO=Jn,wO=jA.aTypedArray;(0,jA.exportTypedArrayMethod)("at",(function(e){var t=wO(this),r=IO(t),n=AO(e),i=n>=0?n:r+n;return i<0||i>=r?void 0:t[i]}));var CO=Mt,OO=ei,xO=oi,NO=Math.min,DO=[].copyWithin||function(e,t){var r=CO(this),n=xO(r),i=OO(e,n),o=OO(t,n),a=arguments.length>2?arguments[2]:void 0,s=NO((void 0===a?n:OO(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]:delete r[i],i+=u,o+=u;return r},PO=jA,MO=Te(DO),LO=PO.aTypedArray;(0,PO.exportTypedArrayMethod)("copyWithin",(function(e,t){return MO(LO(this),e,t,arguments.length>2?arguments[2]:void 0)}));var UO=Ka.every,VO=jA.aTypedArray;(0,jA.exportTypedArrayMethod)("every",(function(e){return UO(VO(this),e,arguments.length>1?arguments[1]:void 0)}));var FO=he,BO=uw,jO=jA.aTypedArray;(0,jA.exportTypedArrayMethod)("fill",(function(e){var t=arguments.length;return FO(BO,jO(this),e,t>1?arguments[1]:void 0,t>2?arguments[2]:void 0)}));var GO=oi,HO=Kl,zO=jA.TYPED_ARRAY_CONSTRUCTOR,qO=jA.aTypedArrayConstructor,XO=function(e){return qO(HO(e,e[zO]))},KO=function(e,t){for(var r=0,n=GO(t),i=new e(n);n>r;)i[r]=t[r++];return i},WO=XO,YO=Ka.filter,JO=function(e,t){return KO(WO(e),t)},QO=jA.aTypedArray;(0,jA.exportTypedArrayMethod)("filter",(function(e){var t=YO(QO(this),e,arguments.length>1?arguments[1]:void 0);return JO(this,t)}));var ZO=Ka.find,$O=jA.aTypedArray;(0,jA.exportTypedArrayMethod)("find",(function(e){return ZO($O(this),e,arguments.length>1?arguments[1]:void 0)}));var ex=Ka.findIndex,tx=jA.aTypedArray;(0,jA.exportTypedArrayMethod)("findIndex",(function(e){return ex(tx(this),e,arguments.length>1?arguments[1]:void 0)}));var rx=Ka.forEach,nx=jA.aTypedArray;(0,jA.exportTypedArrayMethod)("forEach",(function(e){rx(nx(this),e,arguments.length>1?arguments[1]:void 0)}));var ix=di.includes,ox=jA.aTypedArray;(0,jA.exportTypedArrayMethod)("includes",(function(e){return ix(ox(this),e,arguments.length>1?arguments[1]:void 0)}));var ax=di.indexOf,sx=jA.aTypedArray;(0,jA.exportTypedArrayMethod)("indexOf",(function(e){return ax(sx(this),e,arguments.length>1?arguments[1]:void 0)}));var ux=oe,cx=se,dx=Te,lx=jA,hx=td,fx=er("iterator"),px=ux.Uint8Array,vx=dx(hx.values),_x=dx(hx.keys),mx=dx(hx.entries),gx=lx.aTypedArray,yx=lx.exportTypedArrayMethod,Sx=px&&px.prototype,bx=!cx((function(){Sx[fx].call([1])})),Ex=!!Sx&&Sx.values&&Sx[fx]===Sx.values&&"values"===Sx.values.name,Rx=function(){return vx(gx(this))};yx("entries",(function(){return mx(gx(this))}),bx),yx("keys",(function(){return _x(gx(this))}),bx),yx("values",Rx,bx||!Ex,{name:"values"}),yx(fx,Rx,bx||!Ex,{name:"values"});var kx=jA.aTypedArray,Tx=jA.exportTypedArrayMethod,Ix=Te([].join);Tx("join",(function(e){return Ix(kx(this),e)}));var Ax=$i,wx=Be,Cx=Jn,Ox=oi,xx=$p,Nx=Math.min,Dx=[].lastIndexOf,Px=!!Dx&&1/[1].lastIndexOf(1,-0)<0,Mx=xx("lastIndexOf"),Lx=Px||!Mx?function(e){if(Px)return Ax(Dx,this,arguments)||0;var t=wx(this),r=Ox(t),n=r-1;for(arguments.length>1&&(n=Nx(n,Cx(arguments[1]))),n<0&&(n=r+n);n>=0;n--)if(n in t&&t[n]===e)return n||0;return-1}:Dx,Ux=$i,Vx=Lx,Fx=jA.aTypedArray;(0,jA.exportTypedArrayMethod)("lastIndexOf",(function(e){var t=arguments.length;return Ux(Vx,Fx(this),t>1?[e,arguments[1]]:[e])}));var Bx=Ka.map,jx=XO,Gx=jA.aTypedArray;(0,jA.exportTypedArrayMethod)("map",(function(e){return Bx(Gx(this),e,arguments.length>1?arguments[1]:void 0,(function(e,t){return new(jx(e))(t)}))}));var Hx=Mg.left,zx=jA.aTypedArray;(0,jA.exportTypedArrayMethod)("reduce",(function(e){var t=arguments.length;return Hx(zx(this),e,t,t>1?arguments[1]:void 0)}));var qx=Mg.right,Xx=jA.aTypedArray;(0,jA.exportTypedArrayMethod)("reduceRight",(function(e){var t=arguments.length;return qx(Xx(this),e,t,t>1?arguments[1]:void 0)}));var Kx=jA.aTypedArray,Wx=jA.exportTypedArrayMethod,Yx=Math.floor;Wx("reverse",(function(){for(var e,t=this,r=Kx(t).length,n=Yx(r/2),i=0;i<n;)e=t[i],t[i++]=t[--r],t[r]=e;return t}));var Jx=oe,Qx=he,Zx=jA,$x=oi,eN=mC,tN=Mt,rN=se,nN=Jx.RangeError,iN=Jx.Int8Array,oN=iN&&iN.prototype,aN=oN&&oN.set,sN=Zx.aTypedArray,uN=Zx.exportTypedArrayMethod,cN=!rN((function(){var e=new Uint8ClampedArray(2);return Qx(aN,e,{length:1,0:3},1),3!==e[1]})),dN=cN&&Zx.NATIVE_ARRAY_BUFFER_VIEWS&&rN((function(){var e=new iN(2);return e.set(1),e.set("2",1),0!==e[0]||2!==e[1]}));uN("set",(function(e){sN(this);var t=eN(arguments.length>1?arguments[1]:void 0,1),r=tN(e);if(cN)return Qx(aN,this,r,t);var n=this.length,i=$x(r),o=0;if(i+t>n)throw nN("Wrong length");for(;o<i;)this[t+o]=r[o++]}),!cN||dN);var lN=XO,hN=ra,fN=jA.aTypedArray;(0,jA.exportTypedArrayMethod)("slice",(function(e,t){for(var r=hN(fN(this),e,t),n=lN(this),i=0,o=r.length,a=new n(o);o>i;)a[i]=r[i++];return a}),se((function(){new Int8Array(1).slice()})));var pN=Ka.some,vN=jA.aTypedArray;(0,jA.exportTypedArrayMethod)("some",(function(e){return pN(vN(this),e,arguments.length>1?arguments[1]:void 0)}));var _N=oe,mN=Te,gN=se,yN=gt,SN=NI,bN=jA,EN=PI,RN=MI,kN=rt,TN=UI,IN=_N.Array,AN=bN.aTypedArray,wN=bN.exportTypedArrayMethod,CN=_N.Uint16Array,ON=CN&&mN(CN.prototype.sort),xN=!(!ON||gN((function(){ON(new CN(2),null)}))&&gN((function(){ON(new CN(2),{})}))),NN=!!ON&&!gN((function(){if(kN)return kN<74;if(EN)return EN<67;if(RN)return!0;if(TN)return TN<602;var e,t,r=new CN(516),n=IN(516);for(e=0;e<516;e++)t=e%4,r[e]=515-e,n[e]=e-2*t+3;for(ON(r,(function(e,t){return(e/4|0)-(t/4|0)})),e=0;e<516;e++)if(r[e]!==n[e])return!0}));wN("sort",(function(e){return void 0!==e&&yN(e),NN?ON(this,e):SN(AN(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))}),!NN||xN);var DN=$i,PN=jA,MN=se,LN=ra,UN=oe.Int8Array,VN=PN.aTypedArray,FN=PN.exportTypedArrayMethod,BN=[].toLocaleString,jN=!!UN&&MN((function(){BN.call(new UN(1))}));FN("toLocaleString",(function(){return DN(BN,jN?LN(VN(this)):VN(this),LN(arguments))}),MN((function(){return[1,2].toLocaleString()!=new UN([1,2]).toLocaleString()}))||!MN((function(){UN.prototype.toLocaleString.call([1,2])})));var GN=jA.exportTypedArrayMethod,HN=se,zN=Te,qN=oe.Uint8Array,XN=qN&&qN.prototype||{},KN=[].toString,WN=zN([].join);HN((function(){KN.call({})}))&&(KN=function(){return WN(this)});var YN=XN.toString!=KN;GN("toString",KN,YN);var JN=ma,QN=Me,ZN=Mt,$N=oi,eD=function(e){var t=1==e;return function(r,n,i){for(var o,a=ZN(r),s=QN(a),u=JN(n,i),c=$N(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}},tD={findLast:eD(0),findLastIndex:eD(1)},rD=tD.findLast,nD=jA.aTypedArray;(0,jA.exportTypedArrayMethod)("findLast",(function(e){return rD(nD(this),e,arguments.length>1?arguments[1]:void 0)}));var iD=tD.findLastIndex,oD=jA.aTypedArray;(0,jA.exportTypedArrayMethod)("findLastIndex",(function(e){return iD(oD(this),e,arguments.length>1?arguments[1]:void 0)}));var aD=Wi,sD=Ka.findIndex,uD=zu,cD="findIndex",dD=!0;cD in[]&&Array(1).findIndex((function(){dD=!1})),aD({target:"Array",proto:!0,forced:dD},{findIndex:function(e){return sD(this,e,arguments.length>1?arguments[1]:void 0)}}),uD(cD);var lD=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.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}(lD||{}),hD=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}(hD||{}),fD=d((function e(t,r,n){u(this,e),l(this,"code",void 0),l(this,"message",void 0),l(this,"error",void 0),this.code=t,this.message=r,this.error=n})),pD=ue,vD=Te,_D=yo,mD=Be,gD=vD(fe.f),yD=vD([].push),SD=function(e){return function(t){for(var r,n=mD(t),i=_D(n),o=i.length,a=0,s=[];o>a;)r=i[a++],pD&&!gD(n,r)||yD(s,e?[r,n[r]]:n[r]);return s}},bD={entries:SD(!0),values:SD(!1)}.entries;Wi({target:"Object",stat:!0},{entries:function(e){return bD(e)}});var ED=Jn,RD=vo,kD=Ue,TD=oe.RangeError,ID=Te,AD=ni,wD=vo,CD=function(e){var t=RD(kD(this)),r="",n=ED(e);if(n<0||n==1/0)throw TD("Wrong number of repetitions");for(;n>0;(n>>>=1)&&(t+=t))1&n&&(r+=t);return r},OD=Ue,xD=ID(CD),ND=ID("".slice),DD=Math.ceil,PD=function(e){return function(t,r,n){var i,o,a=wD(OD(t)),s=AD(r),u=a.length,c=void 0===n?" ":wD(n);return s<=u||""==c?a:((o=xD(c,DD((i=s-u)/c.length))).length>i&&(o=ND(o,0,i)),e?a+o:o+a)}},MD={start:PD(!1),end:PD(!0)},LD=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(Ye),UD=MD.end;Wi({target:"String",proto:!0,forced:LD},{padEnd:function(e){return UD(this,e,arguments.length>1?arguments[1]:void 0)}});var VD=wm;Wi({target:"Number",stat:!0,forced:Number.parseInt!=VD},{parseInt:VD});var FD=Pr,BD=_l,jD=ma,GD=he,HD=Mt,zD=function(e,t,r,n){try{return n?t(FD(r)[0],r[1]):t(r)}catch(VZ){BD(e,"throw",VZ)}},qD=el,XD=xa,KD=oi,WD=zo,YD=hl,JD=ol,QD=oe.Array,ZD=function(e){var t=HD(e),r=XD(this),n=arguments.length,i=n>1?arguments[1]:void 0,o=void 0!==i;o&&(i=jD(i,n>2?arguments[2]:void 0));var a,s,u,c,d,l,h=JD(t),f=0;if(!h||this==QD&&qD(h))for(a=KD(t),s=r?new this(a):QD(a);a>f;f++)l=o?i(t[f],f):t[f],WD(s,f,l);else for(d=(c=YD(t,h)).next,s=r?new this:[];!(u=GD(d,c)).done;f++)l=o?zD(c,i,[u.value,f],!0):u.value,WD(s,f,l);return s.length=f,s},$D=ZD;Wi({target:"Array",stat:!0,forced:!Fl((function(e){Array.from(e)}))},{from:$D});var eP=Math.log,tP=Math.LOG10E;Wi({target:"Math",stat:!0},{log10:Math.log10||function(e){return eP(e)*tP}});var rP,nP=Wi,iP=Te,oP=ae.f,aP=ni,sP=vo,uP=Lv,cP=Ue,dP=Vv,lP=iP("".startsWith),hP=iP("".slice),fP=Math.min,pP=dP("startsWith"),vP=!pP&&!!function(){var e=oP(String.prototype,"startsWith");return e&&!e.writable}();nP({target:"String",proto:!0,forced:!vP&&!pP},{startsWith:function(e){var t=sP(cP(this));uP(e);var r=aP(fP(arguments.length>1?arguments[1]:void 0,t.length)),n=sP(e);return lP?lP(t,n,r):hP(t,r,r+n.length)===n}});var _P=new Uint8Array(16);function mP(){if(!rP&&!(rP="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 rP(_P)}var gP=/^(?:[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 yP(e){return"string"==typeof e&&gP.test(e)}for(var SP=[],bP=0;bP<256;++bP)SP.push((bP+256).toString(16).substr(1));function EP(e,t,r){var n=(e=e||{}).random||(e.rng||mP)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){r=r||0;for(var i=0;i<16;++i)t[r+i]=n[i];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=(SP[e[t+0]]+SP[e[t+1]]+SP[e[t+2]]+SP[e[t+3]]+"-"+SP[e[t+4]]+SP[e[t+5]]+"-"+SP[e[t+6]]+SP[e[t+7]]+"-"+SP[e[t+8]]+SP[e[t+9]]+"-"+SP[e[t+10]]+SP[e[t+11]]+SP[e[t+12]]+SP[e[t+13]]+SP[e[t+14]]+SP[e[t+15]]).toLowerCase();if(!yP(r))throw TypeError("Stringified UUID is invalid");return r}(n)}var RP=new TextDecoder,kP=new TextEncoder,TP=function(){return EP()},IP=function(){return Date.now()};function AP(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 wP=function(){return"undefined"==typeof window},CP=function(){function e(){u(this,e)}var t,r;return d(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 a=b(i[n],2),s=a[0],u=a[1];null!==u&&"object"===o(u)?e.merge(t[s],r[s]):void 0!==r[s]&&(t[s]=r[s])}}},{key:"ab2str",value:function(e){return RP.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 kP.encode(e).buffer}},{key:"ab2b64str",value:(r=s(regeneratorRuntime.mark((function e(t){var r;return regeneratorRuntime.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=s(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.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 OP(e){return new Promise((function(t){window.setTimeout(t,e)}))}function xP(){var e="none";return wP()||(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 NP="mozilla"===xP();function DP(){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 PP=function(){return Math.floor(65535*Math.random())};function MP(e){return"string"==typeof e&&e.indexOf("__web__rtc__rtt__")>-1}function LP(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(E(a),["..."],E(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 UP=function(){var e=s(regeneratorRuntime.mark((function e(){var t,r,n,i=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=i.length>0&&void 0!==i[0]&&i[0],e.prev=1,(r=new RTCPeerConnection({iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan"})).createDataChannel("default"),r.addTransceiver("audio",{direction:"recvonly"}),r.addTransceiver("video",{direction:"recvonly"}),t&&(r.addTransceiver("audio",{direction:"sendonly"}),r.addTransceiver("video",{direction:"sendonly"})),e.next=9,r.createOffer();case 9:return n=e.sent,r.close(),e.abrupt("return",n.sdp);case 14:e.prev=14,e.t0=e.catch(1);case 16:case"end":return e.stop()}}),e,null,[[1,14]])})));return function(){return e.apply(this,arguments)}}(),VP=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 FP(e){return+Math.max(-127,10*Math.log10(Math.pow(e/255,2))).toFixed(2)}function BP(e){return(e&L.AUDIO)===L.AUDIO}function jP(e){return(e&L.VIDEO)===L.VIDEO}function GP(e){var t={};return Object.keys(e).forEach((function(r){"object"===o(e[r])?t[r]=GP(e[r]):r.startsWith("_")||(t[r]=e[r])})),t}function HP(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 zP(e,t){if("boolean"!=typeof e)throw new fD(lD.INVALID_PARAMS,"Invalid ".concat(t,": The value should be boolean type."))}function qP(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 fD(lD.INVALID_PARAMS,"Invalid ".concat(t,": the value range is [").concat(r,", ").concat(n,"]. integer only"));throw i}}function XP(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 fD(lD.INVALID_PARAMS,"".concat(t," cannot be empty"));if(!ZP(e,r,n))throw new fD(lD.INVALID_PARAMS,"Invalid ".concat(t,": The value should be string type. Length of the string: [").concat(r,",").concat(n,"]"))}function KP(e,t,r){if(!r.includes(e))throw new fD(lD.INVALID_PARAMS,"Invalid ".concat(t,": The value can only be set as ").concat(JSON.stringify(r)))}function WP(e){if(!(e instanceof MediaStreamTrack))throw new fD(lD.INVALID_PARAMS,"Invalid track, The value should be MediaStreamTrack type.")}function YP(e,t){if($P(e))throw new fD(lD.INVALID_PARAMS,"Invalid ".concat(t,", should not be empty"))}function JP(e,t){if(!(e instanceof ArrayBuffer))throw new fD(lD.INVALID_PARAMS,"Invalid ".concat(t,", should be ArrayBuffer"))}function QP(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 ZP(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 $P(e){return null==e}function eM(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new fD(lD.INVALID_PARAMS,"The RoomId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function tM(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new fD(lD.INVALID_PARAMS,"The userId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function rM(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new fD(lD.INVALID_PARAMS,"The publicStreamId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function nM(e){YP(e,"userInfo"),tM(e.userId),$P(e.extraInfo)||XP(e.extraInfo,"userInfo.extraInfo",1,200)}function iM(e){YP(e,"roomConfig"),zP(e.isAutoPublish,"roomConfig.isAutoPublish"),zP(e.isAutoSubscribeAudio,"roomConfig.isAutoSubscribeAudio"),zP(e.isAutoSubscribeVideo,"roomConfig.isAutoSubscribeVideo")}function oM(e){YP(e,"videoPlayerOption")}function aM(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 fD(lD.INVALID_PARAMS,"The message cannot be empty");if((null===(t=e instanceof ArrayBuffer?e:CP.str2ab(JSON.stringify(e)))||void 0===t?void 0:t.byteLength)>1e3*r)throw new fD(lD.INVALID_PARAMS,"The message length must be less than ".concat(r,"K"))}function sM(e){return![re.onRemoteStreamStats,re.onLocalStreamStats,re.onAudioVolumeIndication,re.onLocalAudioPropertiesReport,re.onRemoteAudioPropertiesReport].includes(e)}function uM(e){if("number"!=typeof(null==e?void 0:e.width)||"number"!=typeof(null==e?void 0:e.height))throw new fD(lD.INVALID_PARAMS,"remoteVideoConfig must contain width, height, frameRate")}var cM={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}(cM);var dM=cM.exports,lM="[VERTC]",hM=["#0050b3","#0050b3","#0050b3","#0050b3","#0050b3"],fM=!wP()&&window.location.search.includes("_rtc_debug_"),pM=function(){function e(t,r,n){u(this,e),l(this,"_indent",void 0),l(this,"_module",void 0),l(this,"_id",void 0),this._module=t,this._indent=r}return d(e,[{key:"print",value:function(e){var t;if(fM){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(lM).concat(r,"[").concat(this._module,".").concat(e,"] ").concat(o.shift()),"color:".concat(hM[this._indent],";")].concat(o))}}}]),e}(),vM=new pM("VERTC",0),_M=function(e){h(n,e);var t,r=g(n);function n(){return u(this,n),r.apply(this,arguments)}return d(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=S(f(n.prototype),"emit",this)).call.apply(r,[this,e].concat(o))}catch(VZ){return vM.print("safaEmit","safeEmit() | event listener threw an error [event:%s]:%o",e,VZ),Boolean(t)}}},{key:"safeEmitAsPromise",value:(t=s(regeneratorRuntime.mark((function e(t){var r,n,i,o=this,a=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(r=a.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=a[i];return e.abrupt("return",new Promise((function(e,r){try{o.emit.apply(o,[t].concat(n,[e,r]))}catch(VZ){vM.print("safeEmitAsPromise","safeEmitAsPromise() | event listener threw an error [event:%s]:%o",t,VZ),r(VZ)}})));case 2:case"end":return e.stop()}}),e)}))),function(e){return t.apply(this,arguments)})}]),n}(cM.exports.EventEmitter),mM=Vt,gM=function(e){return void 0!==e&&(mM(e,"value")||mM(e,"writable"))},yM=he,SM=He,bM=Pr,EM=gM,RM=ae,kM=tc;Wi({target:"Reflect",stat:!0},{get:function e(t,r){var n,i,o=arguments.length<3?t:arguments[2];return bM(t)===o?t[r]:(n=RM.f(t,r))?EM(n)?n.value:void 0===n.get?void 0:yM(n.get,o):SM(i=kM(t))?e(i,r,o):void 0}});var TM=oe,IM=fa;Wi({global:!0},{Reflect:{}}),IM(TM.Reflect,"Reflect",!0);var AM=he,wM=Pr,CM=He,OM=gM,xM=wr,NM=ae,DM=tc,PM=ye;Wi({target:"Reflect",stat:!0,forced:se((function(){var e=function(){},t=xM.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=NM.f(wM(t),r);if(!u){if(CM(o=DM(t)))return e(o,r,n,s);u=PM(0)}if(OM(u)){if(!1===u.writable||!CM(s))return!1;if(i=NM.f(s,r)){if(i.get||i.set||!1===i.writable)return!1;i.value=n,xM.f(s,r,i)}else xM.f(s,r,PM(0,n))}else{if(void 0===(a=u.set))return!1;AM(a,s,n)}return!0}}),(0,sA.exports)("Uint16",(function(e){return function(t,r,n){return e(this,t,r,n)}})),(0,sA.exports)("Int32",(function(e){return function(t,r,n){return e(this,t,r,n)}}));var MM={};!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"!==o(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)}(MM);var LM={},UM={},VM={},FM=MM;function BM(e){for(var t=e.length;--t>=0;)e[t]=0}var jM=256,GM=286,HM=30,zM=15,qM=[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],XM=[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],KM=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],WM=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],YM=new Array(576);BM(YM);var JM=new Array(60);BM(JM);var QM=new Array(512);BM(QM);var ZM=new Array(256);BM(ZM);var $M=new Array(29);BM($M);var eL,tL,rL,nL=new Array(HM);function iL(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 oL(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function aL(e){return e<256?QM[e]:QM[256+(e>>>7)]}function sL(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function uL(e,t,r){e.bi_valid>16-r?(e.bi_buf|=t<<e.bi_valid&65535,sL(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 cL(e,t,r){uL(e,r[2*t],r[2*t+1])}function dL(e,t){var r=0;do{r|=1&e,e>>>=1,r<<=1}while(--t>0);return r>>>1}function lL(e,t,r){var n,i,o=new Array(16),a=0;for(n=1;n<=zM;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]=dL(o[s]++,s))}}function hL(e){var t;for(t=0;t<GM;t++)e.dyn_ltree[2*t]=0;for(t=0;t<HM;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 fL(e){e.bi_valid>8?sL(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 pL(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 vL(e,t,r){for(var n=e.heap[r],i=r<<1;i<=e.heap_len&&(i<e.heap_len&&pL(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!pL(t,n,e.heap[i],e.depth));)e.heap[r]=e.heap[i],r=i,i<<=1;e.heap[r]=n}function _L(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?cL(e,i,t):(cL(e,(o=ZM[i])+jM+1,t),0!==(a=qM[o])&&uL(e,i-=$M[o],a),cL(e,o=aL(--n),r),0!==(a=XM[o])&&uL(e,n-=nL[o],a))}while(s<e.last_lit);cL(e,256,t)}function mL(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--)vL(e,o,r);i=u;do{r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],vL(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++,vL(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<=zM;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),lL(o,c,e.bl_count)}function gL(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 yL(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{cL(e,i,e.bl_tree)}while(0!=--s);else 0!==i?(i!==o&&(cL(e,i,e.bl_tree),s--),cL(e,16,e.bl_tree),uL(e,s-3,2)):s<=10?(cL(e,17,e.bl_tree),uL(e,s-3,3)):(cL(e,18,e.bl_tree),uL(e,s-11,7));s=0,o=i,0===a?(u=138,c=3):i===a?(u=6,c=3):(u=7,c=4)}}BM(nL);var SL=!1;function bL(e,t,r,n){uL(e,0+(n?1:0),3),function(e,t,r,n){fL(e),n&&(sL(e,r),sL(e,~r)),FM.arraySet(e.pending_buf,e.window,t,r,e.pending),e.pending+=r}(e,t,r,!0)}VM._tr_init=function(e){SL||(!function(){var e,t,r,n,i,o=new Array(16);for(r=0,n=0;n<28;n++)for($M[n]=r,e=0;e<1<<qM[n];e++)ZM[r++]=n;for(ZM[r-1]=n,i=0,n=0;n<16;n++)for(nL[n]=i,e=0;e<1<<XM[n];e++)QM[i++]=n;for(i>>=7;n<HM;n++)for(nL[n]=i<<7,e=0;e<1<<XM[n]-7;e++)QM[256+i++]=n;for(t=0;t<=zM;t++)o[t]=0;for(e=0;e<=143;)YM[2*e+1]=8,e++,o[8]++;for(;e<=255;)YM[2*e+1]=9,e++,o[9]++;for(;e<=279;)YM[2*e+1]=7,e++,o[7]++;for(;e<=287;)YM[2*e+1]=8,e++,o[8]++;for(lL(YM,287,o),e=0;e<HM;e++)JM[2*e+1]=5,JM[2*e]=dL(e,5);eL=new iL(YM,qM,257,GM,zM),tL=new iL(JM,XM,0,HM,zM),rL=new iL(new Array(0),KM,0,19,7)}(),SL=!0),e.l_desc=new oL(e.dyn_ltree,eL),e.d_desc=new oL(e.dyn_dtree,tL),e.bl_desc=new oL(e.bl_tree,rL),e.bi_buf=0,e.bi_valid=0,hL(e)},VM._tr_stored_block=bL,VM._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<jM;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0}(e)),mL(e,e.l_desc),mL(e,e.d_desc),a=function(e){var t;for(gL(e,e.dyn_ltree,e.l_desc.max_code),gL(e,e.dyn_dtree,e.d_desc.max_code),mL(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*WM[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?bL(e,t,r,n):4===e.strategy||o===i?(uL(e,2+(n?1:0),3),_L(e,YM,JM)):(uL(e,4+(n?1:0),3),function(e,t,r,n){var i;for(uL(e,t-257,5),uL(e,r-1,5),uL(e,n-4,4),i=0;i<n;i++)uL(e,e.bl_tree[2*WM[i]+1],3);yL(e,e.dyn_ltree,t-1),yL(e,e.dyn_dtree,r-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),_L(e,e.dyn_ltree,e.dyn_dtree)),hL(e),n&&fL(e)},VM._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*(ZM[r]+jM+1)]++,e.dyn_dtree[2*aL(t)]++),e.last_lit===e.lit_bufsize-1},VM._tr_align=function(e){uL(e,2,3),cL(e,256,YM),function(e){16===e.bi_valid?(sL(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 EL=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 RL=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 kL,TL=function(e,t,r,n){var i=RL,o=n+r;e^=-1;for(var a=n;a<o;a++)e=e>>>8^i[255&(e^t[a])];return-1^e},IL={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"},AL=MM,wL=VM,CL=EL,OL=TL,xL=IL,NL=-2,DL=258,PL=262,ML=103,LL=113,UL=666;function VL(e,t){return e.msg=xL[t],t}function FL(e){return(e<<1)-(e>4?9:0)}function BL(e){for(var t=e.length;--t>=0;)e[t]=0}function jL(e){var t=e.state,r=t.pending;r>e.avail_out&&(r=e.avail_out),0!==r&&(AL.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 GL(e,t){wL._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,jL(e.strm)}function HL(e,t){e.pending_buf[e.pending++]=t}function zL(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function qL(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-PL?e.strstart-(e.w_size-PL):0,c=e.window,d=e.w_mask,l=e.prev,h=e.strstart+DL,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=DL-(h-o),o=h-DL,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 XL(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-PL)){AL.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,AL.arraySet(s,a.input,a.next_in,d,u),1===a.state.wrap?a.adler=CL(a.adler,s,d,u):2===a.state.wrap&&(a.adler=OL(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<PL&&0!==e.strm.avail_in)}function KL(e,t){for(var r,n;;){if(e.lookahead<PL){if(XL(e),e.lookahead<PL&&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-PL&&(e.match_length=qL(e,r)),e.match_length>=3)if(n=wL._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=wL._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(n&&(GL(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,4===t?(GL(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(GL(e,!1),0===e.strm.avail_out)?1:2}function WL(e,t){for(var r,n,i;;){if(e.lookahead<PL){if(XL(e),e.lookahead<PL&&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-PL&&(e.match_length=qL(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=wL._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&&(GL(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if((n=wL._tr_tally(e,0,e.window[e.strstart-1]))&&GL(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=wL._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,4===t?(GL(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(GL(e,!1),0===e.strm.avail_out)?1:2}function YL(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 JL(){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 AL.Buf16(1146),this.dyn_dtree=new AL.Buf16(122),this.bl_tree=new AL.Buf16(78),BL(this.dyn_ltree),BL(this.dyn_dtree),BL(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new AL.Buf16(16),this.heap=new AL.Buf16(573),BL(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new AL.Buf16(573),BL(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 QL(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:LL,e.adler=2===t.wrap?0:1,t.last_flush=0,wL._tr_init(t),0):VL(e,NL)}function ZL(e){var t,r=QL(e);return 0===r&&((t=e.state).window_size=2*t.w_size,BL(t.head),t.max_lazy_match=kL[t.level].max_lazy,t.good_match=kL[t.level].good_length,t.nice_match=kL[t.level].nice_length,t.max_chain_length=kL[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 $L(e,t,r,n,i,o){if(!e)return NL;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 VL(e,NL);8===n&&(n=9);var s=new JL;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 AL.Buf8(2*s.w_size),s.head=new AL.Buf16(s.hash_size),s.prev=new AL.Buf16(s.w_size),s.lit_bufsize=1<<i+6,s.pending_buf_size=4*s.lit_bufsize,s.pending_buf=new AL.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,ZL(e)}kL=[new YL(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(XL(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,GL(e,!1),0===e.strm.avail_out))return 1;if(e.strstart-e.block_start>=e.w_size-PL&&(GL(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(GL(e,!0),0===e.strm.avail_out?3:4):(e.strstart>e.block_start&&(GL(e,!1),e.strm.avail_out),1)})),new YL(4,4,8,4,KL),new YL(4,5,16,8,KL),new YL(4,6,32,32,KL),new YL(4,4,16,16,WL),new YL(8,16,32,32,WL),new YL(8,16,128,128,WL),new YL(8,32,128,256,WL),new YL(32,128,258,1024,WL),new YL(32,258,258,4096,WL)],UM.deflateInit=function(e,t){return $L(e,t,8,15,8,0)},UM.deflateInit2=$L,UM.deflateReset=ZL,UM.deflateResetKeep=QL,UM.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?NL:(e.state.gzhead=t,0):NL},UM.deflate=function(e,t){var r,n,i,o;if(!e||!e.state||t>5||t<0)return e?VL(e,NL):NL;if(n=e.state,!e.output||!e.input&&0!==e.avail_in||n.status===UL&&4!==t)return VL(e,0===e.avail_out?-5:NL);if(n.strm=e,r=n.last_flush,n.last_flush=t,42===n.status)if(2===n.wrap)e.adler=0,HL(n,31),HL(n,139),HL(n,8),n.gzhead?(HL(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)),HL(n,255&n.gzhead.time),HL(n,n.gzhead.time>>8&255),HL(n,n.gzhead.time>>16&255),HL(n,n.gzhead.time>>24&255),HL(n,9===n.level?2:n.strategy>=2||n.level<2?4:0),HL(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(HL(n,255&n.gzhead.extra.length),HL(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=OL(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(HL(n,0),HL(n,0),HL(n,0),HL(n,0),HL(n,0),HL(n,9===n.level?2:n.strategy>=2||n.level<2?4:0),HL(n,3),n.status=LL);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=LL,zL(n,a),0!==n.strstart&&(zL(n,e.adler>>>16),zL(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=OL(e.adler,n.pending_buf,n.pending-i,i)),jL(e),i=n.pending,n.pending!==n.pending_buf_size));)HL(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(e.adler=OL(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=OL(e.adler,n.pending_buf,n.pending-i,i)),jL(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,HL(n,o)}while(0!==o);n.gzhead.hcrc&&n.pending>i&&(e.adler=OL(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=OL(e.adler,n.pending_buf,n.pending-i,i)),jL(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,HL(n,o)}while(0!==o);n.gzhead.hcrc&&n.pending>i&&(e.adler=OL(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.status=ML)}else n.status=ML;if(n.status===ML&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&jL(e),n.pending+2<=n.pending_buf_size&&(HL(n,255&e.adler),HL(n,e.adler>>8&255),e.adler=0,n.status=LL)):n.status=LL),0!==n.pending){if(jL(e),0===e.avail_out)return n.last_flush=-1,0}else if(0===e.avail_in&&FL(t)<=FL(r)&&4!==t)return VL(e,-5);if(n.status===UL&&0!==e.avail_in)return VL(e,-5);if(0!==e.avail_in||0!==n.lookahead||0!==t&&n.status!==UL){var s=2===n.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(XL(e),0===e.lookahead)){if(0===t)return 1;break}if(e.match_length=0,r=wL._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(GL(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(GL(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(GL(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<=DL){if(XL(e),e.lookahead<=DL&&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+DL;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=DL-(o-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(r=wL._tr_tally(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=wL._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(GL(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(GL(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(GL(e,!1),0===e.strm.avail_out)?1:2}(n,t):kL[n.level].func(n,t);if(3!==s&&4!==s||(n.status=UL),1===s||3===s)return 0===e.avail_out&&(n.last_flush=-1),0;if(2===s&&(1===t?wL._tr_align(n):5!==t&&(wL._tr_stored_block(n,0,0,!1),3===t&&(BL(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),jL(e),0===e.avail_out))return n.last_flush=-1,0}return 4!==t?0:n.wrap<=0?1:(2===n.wrap?(HL(n,255&e.adler),HL(n,e.adler>>8&255),HL(n,e.adler>>16&255),HL(n,e.adler>>24&255),HL(n,255&e.total_in),HL(n,e.total_in>>8&255),HL(n,e.total_in>>16&255),HL(n,e.total_in>>24&255)):(zL(n,e.adler>>>16),zL(n,65535&e.adler)),jL(e),n.wrap>0&&(n.wrap=-n.wrap),0!==n.pending?0:1)},UM.deflateEnd=function(e){var t;return e&&e.state?42!==(t=e.state.status)&&69!==t&&73!==t&&91!==t&&t!==ML&&t!==LL&&t!==UL?VL(e,NL):(e.state=null,t===LL?VL(e,-3):0):NL},UM.deflateSetDictionary=function(e,t){var r,n,i,o,a,s,u,c,d=t.length;if(!e||!e.state)return NL;if(2===(o=(r=e.state).wrap)||1===o&&42!==r.status||r.lookahead)return NL;for(1===o&&(e.adler=CL(e.adler,t,d,0)),r.wrap=0,d>=r.w_size&&(0===o&&(BL(r.head),r.strstart=0,r.block_start=0,r.insert=0),c=new AL.Buf8(r.w_size),AL.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,XL(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,XL(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},UM.deflateInfo="pako deflate (from Nodeca project)";var eU={},tU=MM,rU=!0,nU=!0;try{String.fromCharCode.apply(null,[0])}catch(FZ){rU=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(FZ){nU=!1}for(var iU=new tU.Buf8(256),oU=0;oU<256;oU++)iU[oU]=oU>=252?6:oU>=248?5:oU>=240?4:oU>=224?3:oU>=192?2:1;function aU(e,t){if(t<65534&&(e.subarray&&nU||!e.subarray&&rU))return String.fromCharCode.apply(null,tU.shrinkBuf(e,t));for(var r="",n=0;n<t;n++)r+=String.fromCharCode(e[n]);return r}iU[254]=iU[254]=1,eU.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 tU.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},eU.buf2binstring=function(e){return aU(e,e.length)},eU.binstring2buf=function(e){for(var t=new tU.Buf8(e.length),r=0,n=t.length;r<n;r++)t[r]=e.charCodeAt(r);return t},eU.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=iU[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 aU(s,n)},eU.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+iU[e[r]]>t?r:t};var sU=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},uU=UM,cU=MM,dU=eU,lU=IL,hU=sU,fU=Object.prototype.toString;function pU(e){if(!(this instanceof pU))return new pU(e);this.options=cU.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 hU,this.strm.avail_out=0;var r=uU.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(0!==r)throw new Error(lU[r]);if(t.header&&uU.deflateSetHeader(this.strm,t.header),t.dictionary){var n;if(n="string"==typeof t.dictionary?dU.string2buf(t.dictionary):"[object ArrayBuffer]"===fU.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,0!==(r=uU.deflateSetDictionary(this.strm,n)))throw new Error(lU[r]);this._dict_set=!0}}function vU(e,t){var r=new pU(t);if(r.push(e,!0),r.err)throw r.msg||lU[r.err];return r.result}pU.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=dU.string2buf(e):"[object ArrayBuffer]"===fU.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 cU.Buf8(o),i.next_out=0,i.avail_out=o),1!==(r=uU.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(dU.buf2binstring(cU.shrinkBuf(i.output,i.next_out))):this.onData(cU.shrinkBuf(i.output,i.next_out)))}while((i.avail_in>0||0===i.avail_out)&&1!==r);return 4===n?(r=uU.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,0===r):2!==n||(this.onEnd(0),i.avail_out=0,!0)},pU.prototype.onData=function(e){this.chunks.push(e)},pU.prototype.onEnd=function(e){0===e&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=cU.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},LM.Deflate=pU,LM.deflate=vU,LM.deflateRaw=function(e,t){return(t=t||{}).raw=!0,vU(e,t)},LM.gzip=function(e,t){return(t=t||{}).gzip=!0,vU(e,t)};var _U={},mU=ue,gU=wr,yU=Wv,SU=se,bU=RegExp.prototype;mU&&SU((function(){return"sy"!==Object.getOwnPropertyDescriptor(bU,"flags").get.call({dotAll:!0,sticky:!0})}))&&gU.f(bU,"flags",{configurable:!0,get:yU});var EU={},RU=MM,kU=15,TU=[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],IU=[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],AU=[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],wU=[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],CU=MM,OU=EL,xU=TL,NU=function(e,t){var r,n,i,o,a,s,u,c,d,l,h,f,p,v,_,m,g,y,S,b,E,R,k,T,I;r=e.state,n=e.next_in,T=e.input,i=n+(e.avail_in-5),o=e.next_out,I=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,g=(1<<r.distbits)-1;e:do{p<15&&(f+=T[n++]<<p,p+=8,f+=T[n++]<<p,p+=8),y=v[f&m];t:for(;;){if(f>>>=S=y>>>24,p-=S,0===(S=y>>>16&255))I[o++]=65535&y;else{if(!(16&S)){if(0==(64&S)){y=v[(65535&y)+(f&(1<<S)-1)];continue t}if(32&S){r.mode=12;break e}e.msg="invalid literal/length code",r.mode=30;break e}b=65535&y,(S&=15)&&(p<S&&(f+=T[n++]<<p,p+=8),b+=f&(1<<S)-1,f>>>=S,p-=S),p<15&&(f+=T[n++]<<p,p+=8,f+=T[n++]<<p,p+=8),y=_[f&g];r:for(;;){if(f>>>=S=y>>>24,p-=S,!(16&(S=y>>>16&255))){if(0==(64&S)){y=_[(65535&y)+(f&(1<<S)-1)];continue r}e.msg="invalid distance code",r.mode=30;break e}if(E=65535&y,p<(S&=15)&&(f+=T[n++]<<p,(p+=8)<S&&(f+=T[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(R=0,k=h,0===l){if(R+=c-S,S<b){b-=S;do{I[o++]=h[R++]}while(--S);R=o-E,k=I}}else if(l<S){if(R+=c+l-S,(S-=l)<b){b-=S;do{I[o++]=h[R++]}while(--S);if(R=0,l<b){b-=S=l;do{I[o++]=h[R++]}while(--S);R=o-E,k=I}}}else if(R+=l-S,S<b){b-=S;do{I[o++]=h[R++]}while(--S);R=o-E,k=I}for(;b>2;)I[o++]=k[R++],I[o++]=k[R++],I[o++]=k[R++],b-=3;b&&(I[o++]=k[R++],b>1&&(I[o++]=k[R++]))}else{R=o-E;do{I[o++]=I[R++],I[o++]=I[R++],I[o++]=I[R++],b-=3}while(b>2);b&&(I[o++]=I[R++],b>1&&(I[o++]=I[R++]))}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},DU=function(e,t,r,n,i,o,a,s){var u,c,d,l,h,f,p,v,_,m=s.bits,g=0,y=0,S=0,b=0,E=0,R=0,k=0,T=0,I=0,A=0,w=null,C=0,O=new RU.Buf16(16),x=new RU.Buf16(16),N=null,D=0;for(g=0;g<=kU;g++)O[g]=0;for(y=0;y<n;y++)O[t[r+y]]++;for(E=m,b=kU;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),T=1,g=1;g<=kU;g++)if(T<<=1,(T-=O[g])<0)return-1;if(T>0&&(0===e||1!==b))return-1;for(x[1]=0,g=1;g<kU;g++)x[g+1]=x[g]+O[g];for(y=0;y<n;y++)0!==t[r+y]&&(a[x[t[r+y]]++]=y);if(0===e?(w=N=a,f=19):1===e?(w=TU,C-=257,N=IU,D-=257,f=256):(w=AU,N=wU,f=-1),A=0,y=0,g=S,h=o,R=E,k=0,d=-1,l=(I=1<<E)-1,1===e&&I>852||2===e&&I>592)return 1;for(;;){p=g-k,a[y]<f?(v=0,_=a[y]):a[y]>f?(v=N[D+a[y]],_=w[C+a[y]]):(v=96,_=0),u=1<<g-k,S=c=1<<R;do{i[h+(A>>k)+(c-=u)]=p<<24|v<<16|_|0}while(0!==c);for(u=1<<g-1;A&u;)u>>=1;if(0!==u?(A&=u-1,A+=u):A=0,y++,0==--O[g]){if(g===b)break;g=t[r+a[y]]}if(g>E&&(A&l)!==d){for(0===k&&(k=E),h+=S,T=1<<(R=g-k);R+k<b&&!((T-=O[R+k])<=0);)R++,T<<=1;if(I+=1<<R,1===e&&I>852||2===e&&I>592)return 1;i[d=A&l]=E<<24|R<<16|h-o|0}}return 0!==A&&(i[h+A]=g-k<<24|64<<16|0),s.bits=E,0},PU=-2,MU=12,LU=30;function UU(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function VU(){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 CU.Buf16(320),this.work=new CU.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function FU(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 CU.Buf32(852),t.distcode=t.distdyn=new CU.Buf32(592),t.sane=1,t.back=-1,0):PU}function BU(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,FU(e)):PU}function jU(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)?PU:(null!==n.window&&n.wbits!==t&&(n.window=null),n.wrap=r,n.wbits=t,BU(e))):PU}function GU(e,t){var r,n;return e?(n=new VU,e.state=n,n.window=null,0!==(r=jU(e,t))&&(e.state=null),r):PU}var HU,zU,qU=!0;function XU(e){if(qU){var t;for(HU=new CU.Buf32(512),zU=new CU.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(DU(1,e.lens,0,288,HU,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;DU(2,e.lens,0,32,zU,0,e.work,{bits:5}),qU=!1}e.lencode=HU,e.lenbits=9,e.distcode=zU,e.distbits=5}function KU(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 CU.Buf8(o.wsize)),n>=o.wsize?(CU.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),CU.arraySet(o.window,t,r-n,i,o.wnext),(n-=i)?(CU.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}EU.inflateReset=BU,EU.inflateReset2=jU,EU.inflateResetKeep=FU,EU.inflateInit=function(e){return GU(e,15)},EU.inflateInit2=GU,EU.inflate=function(e,t){var r,n,i,o,a,s,u,c,d,l,h,f,p,v,_,m,g,y,S,b,E,R,k,T,I=0,A=new CU.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 PU;(r=e.state).mode===MU&&(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,R=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=xU(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=LU;break}if(8!=(15&c)){e.msg="unknown compression method",r.mode=LU;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=LU;break}r.dmax=1<<E,e.adler=r.check=1,r.mode=512&c?10:MU,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=LU;break}if(57344&r.flags){e.msg="unknown header flags set",r.mode=LU;break}r.head&&(r.head.text=c>>8&1),512&r.flags&&(A[0]=255&c,A[1]=c>>>8&255,r.check=xU(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=xU(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=xU(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=xU(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)),CU.arraySet(r.head.extra,n,o,f,E)),512&r.flags&&(r.check=xU(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=xU(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=xU(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=LU;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=MU;break;case 10:for(;d<32;){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}e.adler=r.check=UU(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=MU;case MU: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(XU(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=LU}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=LU;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;CU.arraySet(i,n,o,f,a),s-=f,o+=f,u-=f,a+=f,r.length-=f;break}r.mode=MU;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=LU;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,k={bits:r.lenbits},R=DU(0,r.lens,0,19,r.lencode,0,r.work,k),r.lenbits=k.bits,R){e.msg="invalid code lengths set",r.mode=LU;break}r.have=0,r.mode=19;case 19:for(;r.have<r.nlen+r.ndist;){for(;m=(I=r.lencode[c&(1<<r.lenbits)-1])>>>16&255,g=65535&I,!((_=I>>>24)<=d);){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}if(g<16)c>>>=_,d-=_,r.lens[r.have++]=g;else{if(16===g){for(T=_+2;d<T;){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=LU;break}E=r.lens[r.have-1],f=3+(3&c),c>>>=2,d-=2}else if(17===g){for(T=_+3;d<T;){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(T=_+7;d<T;){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=LU;break}for(;f--;)r.lens[r.have++]=E}}if(r.mode===LU)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=LU;break}if(r.lenbits=9,k={bits:r.lenbits},R=DU(1,r.lens,0,r.nlen,r.lencode,0,r.work,k),r.lenbits=k.bits,R){e.msg="invalid literal/lengths set",r.mode=LU;break}if(r.distbits=6,r.distcode=r.distdyn,k={bits:r.distbits},R=DU(2,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,k),r.distbits=k.bits,R){e.msg="invalid distances set",r.mode=LU;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,NU(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===MU&&(r.back=-1);break}for(r.back=0;m=(I=r.lencode[c&(1<<r.lenbits)-1])>>>16&255,g=65535&I,!((_=I>>>24)<=d);){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}if(m&&0==(240&m)){for(y=_,S=m,b=g;m=(I=r.lencode[b+((c&(1<<y+S)-1)>>y)])>>>16&255,g=65535&I,!(y+(_=I>>>24)<=d);){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}c>>>=y,d-=y,r.back+=y}if(c>>>=_,d-=_,r.back+=_,r.length=g,0===m){r.mode=26;break}if(32&m){r.back=-1,r.mode=MU;break}if(64&m){e.msg="invalid literal/length code",r.mode=LU;break}r.extra=15&m,r.mode=22;case 22:if(r.extra){for(T=r.extra;d<T;){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=(I=r.distcode[c&(1<<r.distbits)-1])>>>16&255,g=65535&I,!((_=I>>>24)<=d);){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}if(0==(240&m)){for(y=_,S=m,b=g;m=(I=r.distcode[b+((c&(1<<y+S)-1)>>y)])>>>16&255,g=65535&I,!(y+(_=I>>>24)<=d);){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}c>>>=y,d-=y,r.back+=y}if(c>>>=_,d-=_,r.back+=_,64&m){e.msg="invalid distance code",r.mode=LU;break}r.offset=g,r.extra=15&m,r.mode=24;case 24:if(r.extra){for(T=r.extra;d<T;){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=LU;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=LU;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?xU(r.check,i,h,a-h):OU(r.check,i,h,a-h)),h=u,(r.flags?c:UU(c))!==r.check){e.msg="incorrect data check",r.mode=LU;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=LU;break}c=0,d=0}r.mode=29;case 29:R=1;break e;case LU:R=-3;break e;case 31:return-4;default:return PU}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<LU&&(r.mode<27||4!==t))&&KU(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?xU(r.check,i,h,e.next_out-h):OU(r.check,i,h,e.next_out-h)),e.data_type=r.bits+(r.last?64:0)+(r.mode===MU?128:0)+(20===r.mode||15===r.mode?256:0),(0===l&&0===h||4===t)&&0===R&&(R=-5),R},EU.inflateEnd=function(e){if(!e||!e.state)return PU;var t=e.state;return t.window&&(t.window=null),e.state=null,0},EU.inflateGetHeader=function(e,t){var r;return e&&e.state?0==(2&(r=e.state).wrap)?PU:(r.head=t,t.done=!1,0):PU},EU.inflateSetDictionary=function(e,t){var r,n=t.length;return e&&e.state?0!==(r=e.state).wrap&&11!==r.mode?PU:11===r.mode&&OU(1,t,n,0)!==r.check?-3:KU(e,t,n,n)?(r.mode=31,-4):(r.havedict=1,0):PU},EU.inflateInfo="pako inflate (from Nodeca project)";var WU={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 YU=EU,JU=MM,QU=eU,ZU=WU,$U=IL,eV=sU,tV=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},rV=Object.prototype.toString;function nV(e){if(!(this instanceof nV))return new nV(e);this.options=JU.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 eV,this.strm.avail_out=0;var r=YU.inflateInit2(this.strm,t.windowBits);if(r!==ZU.Z_OK)throw new Error($U[r]);if(this.header=new tV,YU.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=QU.string2buf(t.dictionary):"[object ArrayBuffer]"===rV.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(r=YU.inflateSetDictionary(this.strm,t.dictionary))!==ZU.Z_OK))throw new Error($U[r])}function iV(e,t){var r=new nV(t);if(r.push(e,!0),r.err)throw r.msg||$U[r.err];return r.result}nV.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?ZU.Z_FINISH:ZU.Z_NO_FLUSH,"string"==typeof e?s.input=QU.binstring2buf(e):"[object ArrayBuffer]"===rV.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 JU.Buf8(u),s.next_out=0,s.avail_out=u),(r=YU.inflate(s,ZU.Z_NO_FLUSH))===ZU.Z_NEED_DICT&&c&&(r=YU.inflateSetDictionary(this.strm,c)),r===ZU.Z_BUF_ERROR&&!0===d&&(r=ZU.Z_OK,d=!1),r!==ZU.Z_STREAM_END&&r!==ZU.Z_OK)return this.onEnd(r),this.ended=!0,!1;s.next_out&&(0!==s.avail_out&&r!==ZU.Z_STREAM_END&&(0!==s.avail_in||n!==ZU.Z_FINISH&&n!==ZU.Z_SYNC_FLUSH)||("string"===this.options.to?(i=QU.utf8border(s.output,s.next_out),o=s.next_out-i,a=QU.buf2string(s.output,i),s.next_out=o,s.avail_out=u-o,o&&JU.arraySet(s.output,s.output,i,o,0),this.onData(a)):this.onData(JU.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!==ZU.Z_STREAM_END);return r===ZU.Z_STREAM_END&&(n=ZU.Z_FINISH),n===ZU.Z_FINISH?(r=YU.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===ZU.Z_OK):n!==ZU.Z_SYNC_FLUSH||(this.onEnd(ZU.Z_OK),s.avail_out=0,!0)},nV.prototype.onData=function(e){this.chunks.push(e)},nV.prototype.onEnd=function(e){e===ZU.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=JU.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},_U.Inflate=nV,_U.inflate=iV,_U.inflateRaw=function(e,t){return(t=t||{}).raw=!0,iV(e,t)},_U.ungzip=iV;var oV={};(0,MM.assign)(oV,LM,_U,WU);var aV=oV,sV=function(e){return e.RTC="rtc",e}(sV||{}),uV=function(e){return e.W_5="5",e}(uV||{}),cV=function(e){return e.IOS="ios",e.ANDROID="android",e.WEB="web",e.WINDOWS="windows",e.MAC="mac",e.LINUX="linux",e}(cV||{}),dV=function(e){return e.REQUEST="request",e.RESPONSE="response",e}(dV||{}),lV=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}(lV||{}),hV=function(e){return e.WEBSOCKET="websocket",e.NETWORKCHANGED="networkChanged",e.PEERCONNECTION="peerconnection",e}(hV||{}),fV=function(e){return e.WEBSOCKET_RECONNECTED="websocket reconnected",e.PEERCONNECTION_RECONNECTED="peerconnection reconnected",e}(fV||{}),pV=function(e){return e.WEBSOCKET="websocket",e.NETWORKCHANGED="networkChanged",e.PEERCONNECTION="peerconnection",e}(pV||{}),vV=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}(vV||{}),_V=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}(_V||{}),mV=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}(mV||{}),gV=function(e){return e.UP="up",e.DOWN="down",e.DIRECT="direct",e}(gV||{}),yV=function(e){return e.UP="up",e.DOWN="down",e.PRE="pre",e}(yV||{}),SV=function(e){return e.UP="up",e.DOWN="down",e.PRE="pre",e}(SV||{}),bV=function(e){return e.W_0="0",e.W_1="1",e}(bV||{}),EV=function(e){return e.UP="up",e.DOWN="down",e}(EV||{}),RV=function(e){return e.ANSWER="answer",e.INCRANSWER="incranswer",e}(RV||{}),kV=function(e){return e.UP="up",e.DOWN="down",e}(kV||{}),TV=function(e){return e.SUCCESS="success",e.FAIL="fail",e}(TV||{}),IV=function(e){return e.W_0="0",e.W_1="1",e}(IV||{}),AV=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}(AV||{}),wV=function(e){return e.SUCCESS="success",e.FAIL="fail",e.IGNORE="ignore",e}(wV||{}),CV=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}(CV||{}),OV=function(e){return e.PLAYOUT_DEVICE_SWITCH="playout_device_switch",e.RECORD_DEVICE_SWITCH="record_device_switch",e.UNKNOWN="unknown",e}(OV||{}),xV=function(e){return e.BEGIN_SEND="begin_send",e.SENT_END="sent_end",e.BEGIN_RECV="begin_recv",e.RECV_END="recv_end",e}(xV||{}),NV=function(e){return e.AUDIO="audio",e.VIDEO="video",e.SCREEN_VIDEO="screen_video",e.SCREEN_AUDIO="screen_audio",e}(NV||{}),DV=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}(DV||{}),PV=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}(PV||{}),MV=function(e){return e.BEGIN="begin",e.END="end",e}(MV||{}),LV=function(e){return e.BEGIN="begin",e.END="end",e}(LV||{}),UV=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}(UV||{}),VV=function(e){return e.P2P="p2p",e.P2P_OUTSIDE_ROOM="p2p_outside_room",e.P2SERVER="p2server",e}(VV||{}),FV=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}(FV||{}),BV=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}(BV||{}),jV=function(){function e(t){u(this,e),l(this,"_event_key",void 0),l(this,"_device_id",void 0),l(this,"_rtc_app_id",void 0),l(this,"_product_line",void 0),l(this,"_report_version",void 0),l(this,"_os",void 0),l(this,"_rtc_sdk_version",void 0),l(this,"_rtc_timestamp",void 0),l(this,"_rtc_sdk_git_commit",void 0),l(this,"_report_id",void 0),l(this,"_connection_id",void 0),l(this,"_rtc_sid",void 0),l(this,"_engine_session_id",void 0),l(this,"_rtc_business_id",void 0),l(this,"_project_key",void 0),l(this,"_network_type",void 0),l(this,"_app_version",void 0),l(this,"_aid",void 0),l(this,"_device_model",void 0),l(this,"_device_brand",void 0),l(this,"_common_extra_info",void 0),l(this,"_had_selected_p2p",void 0),l(this,"_rtc_env_type",void 0),l(this,"_room_id",void 0),l(this,"_user_id",void 0),l(this,"_rtc_session_id",void 0),l(this,"_user_agent",void 0),l(this,"_auto_play_policy",void 0),l(this,"_platform",void 0),l(this,"_product",void 0),this.monitor=t}return d(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}(),GV=function(e){h(r,e);var t=g(r);function r(){var e;return u(this,r),l(_(e=t.call(this)),"report_id",void 0),l(_(e),"report_common",void 0),l(_(e),"modify_ids",void 0),l(_(e),"dataBuffer",void 0),l(_(e),"posting",void 0),l(_(e),"sucSendTimer",void 0),l(_(e),"preSucTime",void 0),l(_(e),"errSendTimer",void 0),l(_(e),"errSendDelay",void 0),l(_(e),"commonStats",void 0),e.report_id=0,e.dataBuffer=[],e.posting=!1,e.report_common={},e.modify_ids={},e.preSucTime=0,e.errSendDelay=100,e.commonStats=new jV(_(e)),wP()||window.addEventListener("beforeunload",(function(){clearTimeout(e.errSendTimer),clearTimeout(e.sucSendTimer),e.send(null,!0)})),e}return d(r,[{key:"push",value:function(e,t){t?this.send(e):(this.dataBuffer.push(e),!this.posting&&!this.errSendTimer&&Date.now()-this.preSucTime>2e3&&(clearTimeout(this.sucSendTimer),this.send()))}},{key:"unshift",value:function(e){this.dataBuffer=e.concat(this.dataBuffer)}},{key:"send",value:function(e,t){var r=this;if(e||this.dataBuffer.length){var n={data:e||this.dataBuffer.splice(0,4e3),header:this.report_common,from:"web",os:"web",version:"1"},i=new XMLHttpRequest;i.timeout=1e4,i.onreadystatechange=function(){if(4===i.readyState){var o;if(e||(r.posting=!1),200===i.status||304===i.status)try{o=JSON.parse(i.responseText)}catch(VZ){}o&&0===o.StatusCode?e||t||r.sucSend():e?r.send(e):(r.unshift(n.data),t?r.send():r.errSend())}};var o=hF.LOG_SERVER_URL;if(i.open("POST",o,!0),e||(this.posting=!0),!wP()&&location.search.includes("_rtc_autotest_"))this.safeEmit("report_event",n),0!==this.dataBuffer.length?this.sucSend():this.posting=!1;else if(!wP()&&location.search.includes("_rtc_debug_"))i.send(JSON.stringify(n));else{var a=aV.gzip(JSON.stringify(n));i.setRequestHeader("Content-Encoding","gzip"),i.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"),i.send(a)}}}},{key:"sucSend",value:function(){this.errSendDelay=100,this.preSucTime=Date.now(),this.sucSendTimer=setTimeout(this.send.bind(this),2e3)}},{key:"errSend",value:function(){var e=this;this.errSendTimer=setTimeout((function(){e.send(),e.errSendTimer=null}),this.errSendDelay),this.errSendDelay*=2}},{key:"StartUp",value:function(){var e=this.report_common,t=this.commonStats,r=t.event_key,n=t.device_id,i=t.rtc_app_id,o=t.product_line,a=t.report_version,s=t.os,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,g=t.aid,y=t.device_model,S=t.device_brand,b=t.common_extra_info,E=t.had_selected_p2p,R=t.rtc_env_type,k=t.user_agent,T=t.auto_play_policy,I=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:g,device_model:y,device_brand:S,common_extra_info:b,had_selected_p2p:E,rtc_env_type:R,user_agent:k,auto_play_policy:T,platform:I,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)});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){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i({event_key:"rtc_pre_ice_state",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,ice_state:t},this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}},{key:"rtcNodeChange",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=i(i({event_key:"rtc_node_change",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,reason:r},this.modify_ids),{},{common_extra_info:JSON.stringify(n)});this.push(o)}},{key:"rtcSignalingMsgError",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=i(i({event_key:"rtc_signaling_msg_error",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,reason:r},this.modify_ids),{},{common_extra_info:JSON.stringify(n)});this.push(o)}},{key:"rtcSignaling",value:function(e,t,r,n,o){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){var u=arguments.length>7&&void 0!==arguments[7]?arguments[7]:{},c=i(i({event_key:"rtc_set_description",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,is_local:r,direction:n,stream_id:o,stream_user_id:a,elapse:s},this.modify_ids),{},{common_extra_info:JSON.stringify(u)});this.push(c)}},{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=i(i({event_key:"rtc_invoke_status",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,error_code:t,sdk_api_name:r,stream_id:n,elapse:o},this.modify_ids),{},{common_extra_info:JSON.stringify(a),direction:a.direction});this.push(s)}},{key:"rtcFirstFrame",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=i(i(i({event_key:"rtc_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),this.modify_ids),{},{common_extra_info:JSON.stringify(t)});this.push(r)}},{key:"rtcMuteRemote",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i({event_key:"rtc_mute_remote",report_id:this.report_id++,rtc_timestamp:Date.now(),mute_info:e,media_type:t},this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}},{key:"sdkInitEngine",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i({event_key:"sdk_init_engine",report_id:this.report_id++,rtc_timestamp:Date.now(),start:e,type:t},this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}},{key:"joinRoom",value:function(e,t,r,n){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},a=i(i({event_key:"join_room",report_id:this.report_id++,rtc_timestamp:Date.now(),type:e,start:t,result:r,reason:n},this.modify_ids),{},{common_extra_info:JSON.stringify(o)});this.push(a)}},{key:"p2pConnectionStatus",value:function(e,t,r,n,o){var a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},s=i(i({event_key:"p2p_connection_status",report_id:this.report_id++,rtc_timestamp:Date.now(),room_id:e,user_id:t,peer_user_id:r,status:n,elapse:o},this.modify_ids),{},{common_extra_info:JSON.stringify(a)});this.push(s)}},{key:"p2pConnectClosed",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=i(i({event_key:"p2p_connect_closed",report_id:this.report_id++,rtc_timestamp:Date.now(),p2p_selected:e},this.modify_ids),{},{common_extra_info:JSON.stringify(t)});this.push(r)}},{key:"rtcDeviceError",value:function(e,t,r,n,o,a,s,u,c,d,l,h,f,p,v,_){var m=arguments.length>16&&void 0!==arguments[16]?arguments[16]:{},g=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(g)}},{key:"rtcVideoDevice",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i({event_key:"rtc_video_device",report_id:this.report_id++,rtc_timestamp:Date.now(),media_device_id:e,media_device_name:t},this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}},{key:"rtcVideoCaptureEvent",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=i(i(i({event_key:"rtc_video_capture_event",report_id:this.report_id++,rtc_timestamp:Date.now()},e),this.modify_ids),{},{common_extra_info:JSON.stringify(t)});this.push(r)}},{key:"rtcEncodeFirstFrame",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i(i(i({event_key:"rtc_encode_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}},{key:"rtcFirstFrameEncoded",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i(i(i({event_key:"rtc_first_frame_encoded",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}},{key:"rtcSendFirstPacket",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i(i(i({event_key:"rtc_send_first_packet",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}},{key:"rtcRecvFirstPacket",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i(i(i({event_key:"rtc_recv_first_packet",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}},{key:"rtcRecvFirstFrame",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i(i(i({event_key:"rtc_recv_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}},{key:"rtcDecodeFirstFrame",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i(i(i({event_key:"rtc_decode_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}}]),r}(_M),HV=new GV,zV=new GV,qV=new GV,XV=HV.commonStats,KV=zV.commonStats,WV=qV.commonStats,YV={default:HV,rtm:zV,outsideRoom:qV};function JV(){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&&XV.setStats({room_id:i[1]}),YV[e].rtcSdkApiCall(n,0,JSON.stringify(LP(i)),s);var u=o.apply(this,i);return"function"==typeof(null==u?void 0:u.then)?u.then((function(t){return YV[e].rtcSdkCallback(n,0,JSON.stringify(LP([t||{}]))),t})).catch((function(t){throw YV[e].rtcSdkCallback(n,t.code,JSON.stringify(t.message)),t})):(YV[e].rtcSdkCallback(n,0,JSON.stringify(LP([u||{}]))),u)}}}}function QV(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=e===re.onUserMessageReceivedOutsideRoom||e===re.onUserBinaryMessageReceivedOutsideRoom;(n?zV:HV).rtcSdkCallback(e,r,JSON.stringify(t))}function ZV(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];(n?zV:HV).rtcInvokeStatus(JSON.stringify(t),r,e,"",0)}var $V="BytePlus",eF="RTC_DEVICE_ID",tF="RTC_ACCESS_NODE",rF="RTC_ACCESS_URLS",nF="RTC_H264_BLACK_LIST",iF="engine_BAC",oF=function(){function e(){u(this,e)}return d(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}(),aF=function(e){h(r,e);var t=g(r);function r(){return u(this,r),t.apply(this,arguments)}return d(r,[{key:"getDeviceId",value:function(){if(wP())return"";var e=this.get(eF);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[XV,KV,WV].forEach((function(t){return t.setStats({device_id:e})})),this.set(eF,e),e}},{key:"getAccessNode",value:function(e){return this.get("".concat(tF,"_").concat(e,"-").concat($V))}},{key:"setAccessNode",value:function(e,t,r){return this.set("".concat(tF,"_").concat(e,"-").concat($V),t,1e3*r)}},{key:"clearAccessNode",value:function(e){this.delete("".concat(tF,"_").concat(e,"-").concat($V))}},{key:"getAccessUrls",value:function(){return this.get("".concat(rF,"-").concat($V))}},{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(rF,"-").concat($V),t)}},{key:"clearAccessUrls",value:function(){this.delete("".concat(rF,"-").concat($V))}},{key:"getH264BlackList",value:function(){return this.get(nF)}},{key:"setH264BlackList",value:function(e){return this.set(nF,e)}},{key:"getAudioProfile",value:function(){return this.get(iF)}},{key:"setAudioProfile",value:function(e){return this.set(iF,e)}}]),r}(oF),sF=new aF,uF="rtc-access.rtcplus.com,rtc-access-sg.rtcplus.com,rtc-access-va.rtcplus.com,rtc-access-fr.rtcplus.com".split(",");function cF(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return"https://".concat(e,"/dispatch/v1/AccessInfo?Action=GetAccessInfo")}var dF="https://web-log-report.rtcplus.com/video/v1/webrtc_log/",lF="rtc.rtcplus.com".split(","),hF={VERSION:"4.47.0",ICE_CONFIG_REQUEST_URLS_INTERNAL:uF.map(cF),ICE_CONFIG_REQUEST_URLS:[],EXPECTED_ADDR:"",LOG_SERVER_URL:dF,CONFIG_REQUEST_DOMAINS:lF,DEVICE_ID:"",OVERSEA:!1,PLATFORM:"",PRODUCT:""};function fF(e,t){if(HV.rtcSdkApiCall("setParameter",0,"key: ".concat(e,", value: ").concat(t)),"VERSION"!==e)return"ICE_CONFIG_REQUEST_URLS"===e?("string"==typeof t&&(t=[t]),void(hF.ICE_CONFIG_REQUEST_URLS=t.map(cF))):void("PLATFORM"!==e||"string"!=typeof t?"PRODUCT"!==e||"string"!=typeof t?"LOG_SERVER_URL"!==e||t!==B.overseas?"LOG_SERVER_URL"!==e||t!==B.domestic?"LOG_SERVER_URL"!==e||"string"!=typeof t?"OVERSEA"!==e?("DEVICE_ID"===e&&sF.setDeviceId(t),hF[e]=t):hF.OVERSEA=t:hF.LOG_SERVER_URL=t:hF.LOG_SERVER_URL=dF:hF.LOG_SERVER_URL="https://web-log-report.rtcplus.com/video/v1/webrtc_log/":XV.setStats({product:t}):XV.setStats({platform:t}))}function pF(e){return"DEVICE_ID"===e?sF.getDeviceId():hF[e]}function vF(e,t){var r,n,i,o,a,s,u,c,d,l,h,f,p,v,_,m,g;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)||gF.audio.codec,bitRate:1e3*((null===(n=t.audio)||void 0===n?void 0:n.kBitRate)||gF.audio.kBitRate),sampleRate:1e3*((null===(i=t.audio)||void 0===i?void 0:i.sampleRate)||gF.audio.sampleRate),channels:(null===(o=t.audio)||void 0===o?void 0:o.channels)||gF.audio.channels,profile:(null===(a=t.audio)||void 0===a?void 0:a.AACProfile)||gF.audio.AACProfile},video:{codec:(null===(s=t.video)||void 0===s?void 0:s.codec)||gF.video.codec,fps:(null===(u=t.video)||void 0===u?void 0:u.fps)||gF.video.fps,gop:(null===(c=t.video)||void 0===c?void 0:c.gop)||gF.video.gop,lowLatency:null!==(d=null===(l=t.video)||void 0===l?void 0:l.lowLatency)&&void 0!==d?d:gF.video.lowLatency,bitRate:1e3*((null===(h=t.video)||void 0===h?void 0:h.kBitRate)||gF.video.kBitRate),width:(null===(f=t.video)||void 0===f?void 0:f.width)||gF.video.width,height:(null===(p=t.video)||void 0===p?void 0:p.height)||gF.video.height},layout:{canvas:{bgnd:(null===(v=t.layout)||void 0===v?void 0:v.backgroundColor)||gF.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===(g=t.layout)||void 0===g?void 0:g.appData)||gF.layout.appData}}}}function _F(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)||H.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 mF,gF={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"}},yF={width:640,height:360,frameRate:30,maxKbps:600},SF={width:1920,height:1080,frameRate:15,maxKbps:3e3},bF=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}(bF||{}),EF=function(e){return e.PushLimitWarn="PushLimitWarn",e}(EF||{}),RF=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}(RF||{}),kF=function(e){return e.RSCP="RSCP",e.RTT="RTT",e}(kF||{}),TF=function(e){return e.ON_CONNECTION_STATE_CHANGE="onConnectionStateChange",e.ABNORMAL_DISCONNECTION="normalConnection",e}(TF||{}),IF=function(e){return e.userLeave="userLeave",e.connectionLost="connectionLost",e.userDuplicateLogin="userDuplicateLogin",e.kickedByAdmin="kickedByAdmin",e.roleChanged="roleChanged",e.onUserTokenDidExpire="onUserTokenDidExpire",e}(IF||{}),AF=function(e){return e[e.roomDismissByAdmin=2]="roomDismissByAdmin",e}(AF||{}),wF=function(e){return e[e.SEND=0]="SEND",e[e.FEEDBACK=1]="FEEDBACK",e}(wF||{}),CF=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}(CF||{}),OF=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}(OF||{}),xF=(l(mF={},0,[0,"success"]),l(mF,1,[lD.USER_MESSAGE_TIMEOUT,"timeout, failed to send."]),l(mF,2,[lD.USER_MESSAGE_BROKEN,"dataChannel broken, failed to send."]),l(mF,3,[lD.USER_MESSAGE_NO_RECEIVER,"cannot find the receiver."]),l(mF,4,[lD.USER_MESSAGE_NO_RELAYPATH,"cannot find relay path."]),l(mF,17,[lD.USER_MESSAGE_SEND_TO_SERVER_ERROR,"failed to send to business server."]),l(mF,18,[lD.USER_MESSAGE_SERVER_RESPONSE_ERROR,"business server response error."]),l(mF,100,[lD.USER_MESSAGE_NOT_JOIN,"not join room"]),l(mF,101,[lD.USER_MESSAGE_INIT,"not init."]),l(mF,102,[lD.USER_MESSAGE_NO_CONNECTION,"no connection."]),l(mF,105,[lD.USER_MESSAGE_NOT_LOGIN,"not login."]),l(mF,106,[lD.USER_MESSAGE_SERVER_PARAMS_NOTSET,"server param is not set."]),l(mF,1e3,[lD.USER_MESSAGE_UNKNOWN,"unknown."]),mF),NF=["msg"],DF=new pM("DataChannelSignaling",3),PF=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}(PF||{}),MF=6e4,LF=function(e){h(o,e);var t,r,n=g(o);function o(e){var t;return u(this,o),l(_(t=n.call(this)),"_singlingCache",new Map),l(_(t),"_p2pCache",new Map),l(_(t),"_rttIds",{}),l(_(t),"_p2pMessageId",0),l(_(t),"_clearDataChannelListener",void 0),t._dataChannel=e,t._clearDataChannelListener=t._handleHandler(),window.__rtc_mock_signaling__=t.emit.bind(_(t)),t}return d(o,[{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 HV.rtcSignaling(0,JSON.stringify(t),"call-".concat(e),"Send",gV.UP),new Promise((function(i,o){var a=n._genHeader(r);a.id=DP();var s=a.id.join("-"),u=setTimeout((function(){n._singlingCache.delete(s),o(new fD(lD.TIME_OUT,"".concat(e," message time out")))}),MF);n._singlingCache.set(s,{signalingType:e,success:function(e){clearTimeout(u),i(e)},error:function(e){clearTimeout(u),o(e)}}),DF.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=s(regeneratorRuntime.mark((function e(t,r){var n,o,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.msg,o=v(t,NF),a=n instanceof ArrayBuffer,e.t0=this,e.t1=i,e.t2=i({ver:1,id:this._p2pMessageId++,time:Date.now(),dir:wF.SEND,type:CF.P2P,err:OF.SUCCESS},o),e.t3={},e.t4=a,!a){e.next=13;break}return e.next=10,CP.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 MP(e.msg)?this._rttIds[e.id]=e.id:e.dir===wF.SEND&&DF.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:DP()}));if(e.dir===wF.SEND){var s=setTimeout((function(){t._p2pCache.delete(e.id),o(new fD(lD.TIME_OUT,"P2P message timeout"))}),MF);t._p2pCache.set(e.id,{success:function(e,t){clearTimeout(s),n(t)},error:function(e){clearTimeout(s);var t=b(xF[e.err]||[lD.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 fD(lD.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=CP.str2ab(JSON.stringify([e,r])),a=AP(Uint8Array,[n,i].concat(E(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){var r=this._genHeader({needAck:!0,direction:1,id:e.split("-").map((function(e){return+e}))});DF.print("Signal",">>>>>> [".concat(t,"-res][").concat(e,"]")),this._sendMessage("".concat(t,"-res"),r,"")}},{key:"_handleMessage",value:(t=s(regeneratorRuntime.mark((function e(t){var r,n,o,a,s,u,c,d,l,h,f,p,v,_,m,g,y,S,E,R,k,T,I,A,w,C,O,x,N,D,P,M;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:u=this._dispartData(t),c=u.data,(d=u.header).zip&&((l=new aV.Inflate).push(c,!0),c=l.result),h=CP.ab2str(c),f=[],e.prev=6,f=JSON.parse(h),e.next=14;break;case 10:return e.prev=10,e.t0=e.catch(6),e.t0 instanceof Error&&HV.rtcSignalingMsgError(-1,e.t0.message,mV.MESSAGE_PARSE_FAILED),e.abrupt("return");case 14:e.t1=d.functionType,e.next=0===e.t1?17:1===e.t1?34:2===e.t1?83:101;break;case 17:if(p=(null===(r=d.id)||void 0===r?void 0:r.join("-"))||"",1!==d.direction){e.next=22;break}this._handleAckMessage(p,f[0]||{},h),e.next=33;break;case 22:if(!Array.isArray(f)){e.next=33;break}if(v=f[0],f=f[1],DF.print("Signal","<<<<<< ".concat(v),f,p),this._feedbackSignaling(p,v),!f.binary||"string"!=typeof f.message){e.next=31;break}return e.next=30,CP.b64str2ab(f.message);case 30:f.message=e.sent;case 31:this.emit(v,i({},f)),HV.rtcSignaling(0,h,"on-".concat(v),"Recv",gV.DOWN);case 33:return e.abrupt("break",102);case 34:Array.isArray(f)&&(f=f[1]),_=null===(n=f)||void 0===n?void 0:n.id,this._rttIds[_]||(null===(o=f)||void 0===o?void 0:o.dir)===wF.FEEDBACK||MP(null===(a=f)||void 0===a?void 0:a.msg)?delete this._rttIds[_]:DF.print("Signal","<<<<<< p2p response",f),e.t2=f.dir,e.next=e.t2===wF.SEND?40:e.t2===wF.FEEDBACK?78:81;break;case 40:if(MP(null===(s=f)||void 0===s?void 0:s.msg)){e.next=76;break}if(g=(m=f).binary,y=m.msg,S=m.room,E=m.to,R=m.from,k=""===S?g?RF.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM:RF.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM:g?RF.USER_BINARY_MESSAGE_RECEIVED:RF.USER_MESSAGE_RECEIVED,E){e.next=60;break}if(e.t3=this,e.t4=RF.ON_CUSTOM_MESSAGE,e.t5=R,e.t6=g,!g){e.next=54;break}return e.next=51,CP.b64str2ab(y);case 51:e.t7=e.sent,e.next=55;break;case 54:e.t7=y;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=k,e.t12=i,e.t13=i({},f),e.t14={},!g){e.next=71;break}return e.next=68,CP.b64str2ab(y);case 68:e.t15=e.sent,e.next=72;break;case 71:e.t15=y;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({},f),{},{dir:wF.FEEDBACK,msg:""})),e.abrupt("break",82);case 78:return(T=this._p2pCache.get(f.id))&&(this._p2pCache.delete(f.id),f.err===OF.SUCCESS?T.success(f.id,f):T.error(f)),e.abrupt("break",82);case 81:return e.abrupt("break",82);case 82:return e.abrupt("break",102);case 83:if(1!==d.direction){e.next=88;break}A=(null===(I=d.id)||void 0===I?void 0:I.join("-"))||"",this._handleAckMessage(A,f[0]||{},h),e.next=100;break;case 88:if(w=b(f,2),C=w[0],O=w[1],x=void 0===O?{}:O,"RXMediaMsg"!==C){e.next=100;break}N=x.type,D=x.data,HV.rtcSignaling(0,h,"on-".concat(N),"Recv",gV.DOWN),e.t19=N,e.next="RSCP"===e.t19?95:"RTT"===e.t19?97:99;break;case 95:try{P=JSON.parse(D),Array.isArray(P)&&this.emit(N,P)}catch(L){}return e.abrupt("break",100);case 97:try{(M=JSON.parse(D)).length&&this.emit(N,M[0])}catch(L){}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){DF.print("_handleHandler","dataChannel close",t),e.emit("close",t)},r=function(t){DF.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),DF.print("Signal","<<<<<< [".concat(n.signalingType,"-ack]"),t)),HV.rtcSignaling(0,r,null==n?void 0:n.signalingType,"Ack",gV.DOWN)}}]),o}(cM.exports.EventEmitter),UF=function(){function e(){u(this,e),l(this,"xhr",void 0),l(this,"isSending",void 0),l(this,"timeout",void 0),this.isSending=!1}return d(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=b(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})),0===a.status&&i({code:0,message:"Request abort"})},a.onerror=function(e){t.isSending=!1,i({code:-1,message:a.responseText||"unknown"})},t.timeout&&(a.timeout=t.timeout),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}(),VF=new pM("ICE Request",3),FF=function(){function e(){u(this,e),l(this,"_request",void 0),this._request=new UF}var t,r,n;return d(e,[{key:"getAccessNode",value:(n=s(regeneratorRuntime.mark((function e(t,r,n,i,o,a,s,u){var c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(c=sF.getAccessNode(t))){e.next=9;break}if(this.getAccessNodeFromServer(t,r,n,i,o,a,s,u),ZV("es.R.node.cache",c),!Array.isArray(c)){e.next=8;break}return e.abrupt("return",Promise.resolve(c));case 8:return e.abrupt("return",Promise.resolve([c]));case 9:return e.abrupt("return",this.getAccessNodeFromServer(t,r,n,i,o,a,s,u));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=s(regeneratorRuntime.mark((function e(t,r,n,i,o,a,s,u){var c,d,l,h,f=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return l=sF.getAccessUrls(),h=!0,ZV("es.R.req.cache.urls",l),(null===(c=l)||void 0===c?void 0:c.length)>0||(l=hF.ICE_CONFIG_REQUEST_URLS,h=!1,ZV("es.R.req.external.urls",l)),(null===(d=l)||void 0===d?void 0:d.length)>0||(l=hF.ICE_CONFIG_REQUEST_URLS_INTERNAL,h=!1,ZV("es.R.req.internal.urls",l)),e.abrupt("return",this.getICEConfigFromServer(l,t,r,n,i,o,a,s,u).then((function(e){var r=e.nodes;return sF.setAccessNode(t,r,e.ttl||11200),e.dispatchDomains&&sF.setAccessUrls(e.dispatchDomains),r})).catch((function(e){if(h)return ZV("es.R.req.fallback",""),sF.clearAccessUrls(),f.getAccessNodeFromServer(t,r,n,i,o,a,s);throw e})));case 6:case"end":return e.stop()}}),e,this)}))),function(e,t,n,i,o,a,s,u){return r.apply(this,arguments)})},{key:"getICEConfigFromServer",value:(t=s(regeneratorRuntime.mark((function e(t,r,n,i,o,a,u,c,d){var l,h,f,p,v=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return l={appID:r,userID:i,deviceID:o,connectSessionID:TP(),os:"web",sdkVersion:hF.VERSION,isOversea:hF.OVERSEA,expectedAddr:pF("EXPECTED_ADDR"),productPlatform:"BytePlus",enableCloudProxy:c,expectedIDC:d},a&&u&&(l.feedbackInfo=[{feedbackIP:null===(h=u.publicIPs[0])||void 0===h?void 0:h.ip,feedbackReason:{type:"NODE_CHANGED",reason:a}}],delete l.expectedAddr),f=Date.now(),HV.rtcGetAccess(0,JSON.stringify(l),0,vV.REQUEST,t.join(","),l.connectSessionID),p=t.map(function(){var e=s(regeneratorRuntime.mark((function e(t,r){var n,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,v._request.post(t,l);case 3:n=e.sent,e.next=9;break;case 6:throw e.prev=6,e.t0=e.catch(0),new fD(lD.ICE_SERVER_WRONG,"get ICE config failed",e.t0);case 9:if(200===n.code){e.next=11;break}throw new fD(lD.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 fD(lD.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",VP(p).then((function(e){var r=e.result;e.firstNode;var n=e.index;return HV.rtcGetAccess(200,JSON.stringify(r),Date.now()-f,vV.RESPONSE,t[n],l.connectSessionID),r})).catch((function(e){var r,n,i=null===(r=e[0])||void 0===r?void 0:r.error;throw HV.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()-f,vV.RESPONSE,t.join(","),l.connectSessionID,{error:JSON.stringify(i)}),e})));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&&(VF.print("abort","HTTP Request of [getICEConfigFromServer] abort"),this._request.abort())}}]),e}(),BF=function(){function e(){u(this,e),l(this,"_request",void 0),this._request=new UF}return d(e,[{key:"getH264BlackList",value:function(){var e=this,t={keys:["web_h264_black_list"],labelSelector:"",sdkVersion:"4.47.0",deviceType:"web"};this._request.timeout=800;var r=hF.CONFIG_REQUEST_DOMAINS.map((function(e){return"https://".concat(e,"/decision/v1/multi")}));HV.rtcGetConfig(0,JSON.stringify(t),0,r.join(","),dV.REQUEST,"",!1);var n=r.map(function(){var r=s(regeneratorRuntime.mark((function r(n,i){var o,a;return regeneratorRuntime.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:a=r.sent,r.next=9;break;case 6:throw r.prev=6,r.t0=r.catch(0),new fD(lD.ICE_SERVER_WRONG,"get config failed");case 9:if(Array.isArray(null===(o=a)||void 0===o?void 0:o.web_h264_black_list)){r.next=11;break}throw new fD(lD.ICE_SERVER_WRONG,"get config failed");case 11:return r.abrupt("return",{result:a,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){VP(n).then((function(t){var n=t.result,i=t.index;sF.setH264BlackList(n.web_h264_black_list),HV.rtcGetConfig(200,JSON.stringify(n),0,r[i],dV.RESPONSE,"",!1),e(n.web_h264_black_list)})).catch((function(t){HV.rtcGetConfig(500,t.message,0,"",dV.RESPONSE,"",!1),e(sF.getH264BlackList()||[])}))}))}},{key:"getAudioProfile",value:function(){var e=this,t={keys:["engine_BAC"],labelSelector:"",sdkVersion:"4.47.0",deviceType:"web"},r=hF.CONFIG_REQUEST_DOMAINS.map((function(e){return"https://".concat(e,"/decision/v1/multi")}));HV.rtcGetConfig(0,JSON.stringify(t),0,r.join(","),dV.REQUEST,"",!1);var n=r.map(function(){var r=s(regeneratorRuntime.mark((function r(n,i){var o,a;return regeneratorRuntime.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:a=r.sent,r.next=9;break;case 6:throw r.prev=6,r.t0=r.catch(0),new fD(lD.ICE_SERVER_WRONG,"get config failed");case 9:if(Array.isArray(null===(o=a)||void 0===o?void 0:o.engine_BAC)){r.next=11;break}throw new fD(lD.ICE_SERVER_WRONG,"get config failed");case 11:return r.abrupt("return",{result:a,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){VP(n).then((function(t){var n=t.result,i=t.index;sF.setAudioProfile(n.engine_BAC),HV.rtcGetConfig(200,JSON.stringify(n),0,r[i],dV.RESPONSE,"",!1),e(n.engine_BAC)})).catch((function(t){HV.rtcGetConfig(500,t.message,0,"",dV.RESPONSE,"",!1),e(sF.getAudioProfile()||[])}))}))}}]),e}();function jF(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 GF=[{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}],HF=[{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 zF={width:160,height:90,frameRate:15,maxkbps:100},qF={width:480,height:270,frameRate:15,maxkbps:400};var XF,KF,WF="chrome-stable"===xP(),YF=function(){function e(t){u(this,e),l(this,"peer",void 0),l(this,"stats",void 0),this.peer=t,this.stats=[]}var t,r;return d(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=s(regeneratorRuntime.mark((function e(t){var r=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e,n){if(!WF||void 0!==window.InstallTrigger)return e(r.stats);try{r.peer.getStats((function(n){n.result().forEach((function(e){if(!JF.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(VZ){n(VZ)}})));case 1:case"end":return e.stop()}}),e)}))),function(e){return r.apply(this,arguments)})},{key:"getStats",value:(t=s(regeneratorRuntime.mark((function e(t,r){var n;return regeneratorRuntime.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,r){e.next=9;break}return e.next=9,this.getExtraStats(t);case 9:e.next=13;break;case 11:e.prev=11,e.t0=e.catch(5);case 13:e.next=17;break;case 15:e.prev=15,e.t1=e.catch(0);case 17:return e.abrupt("return",this.stats);case 18:case"end":return e.stop()}}),e,this,[[0,15],[5,11]])}))),function(e,r){return t.apply(this,arguments)})}]),e}(),JF=["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"],QF=function(){var e=s(regeneratorRuntime.mark((function e(t,r,n){var i,o;return regeneratorRuntime.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 o=new YF(t),e.next=6,o.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)}}(),ZF=function(){var e=s(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,!wP()&&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,$F();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)}}(),$F=function(){var e=s(regeneratorRuntime.mark((function e(){var t,r,n,i,o,a,s,u,c,d;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!XF){e.next=2;break}return e.abrupt("return",XF);case 2:return t=[],e.prev=3,e.next=6,UP();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,o=["heytapbrowser","mqqbrowser","miuibrowser"],a=new BF,e.next=16,a.getH264BlackList();case 16:for(s=e.sent,o.push.apply(o,E(s)),u=0,c=o;u<c.length;u++)d=c[u],n.includes(d)&&(i=!0);!i&&t.push("H264");case 20:return null!=r&&r.includes("VP8")&&t.push("vp8"),XF=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)}}(),eB=function(){var e=s(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,$F();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)}}(),tB=function(){return"undefined"!=typeof TransformStream&&"undefined"!=typeof RTCRtpSender&&"undefined"!=typeof RTCRtpReceiver&&void 0!==RTCRtpSender.prototype.createEncodedStreams&&void 0!==RTCRtpReceiver.prototype.createEncodedStreams},rB=new pM("BasicHandler",3),nB={iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan",encodedInsertableStreams:!!tB()||void 0};function iB(e){if(void 0===KF){var t=navigator.userAgent.toLowerCase();KF=t.includes("chrome")&&t.includes("mobile")}return KF?Math.ceil(e):e}var oB=function(e){h(c,e);var t,r,n,o,a=g(c);function c(e,t){var r;return u(this,c),l(_(r=a.call(this)),"_peerConnection",void 0),l(_(r),"_dataChannel",void 0),l(_(r),"_context",void 0),l(_(r),"monitor",void 0),l(_(r),"_offerIce",{}),l(_(r),"_answerIce",{}),l(_(r),"_initSctpEvents",!1),r.monitor=e,r._peerConnection=new RTCPeerConnection(nB),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;rB.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){rB.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,_V["".concat(t.toUpperCase())])},r}return d(c,[{key:"disconnect",value:function(){this._peerConnection.close(),this._dataChannel.close(),this._peerConnection.ontrack=null}},{key:"destroy",value:function(){rB.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<HF.length;n++)if(r>=HF[n].totalPixels){t=n;break}if(0===t)return HF[t].maxLayers;var i=HF[t-1].totalPixels;return(i-r)/(i-HF[t].totalPixels)<.1?HF[t-1].maxLayers:HF[t].maxLayers}(t);rB.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/zF.width,i=e.width/qF.width):(n=e.height/zF.height,i=e.height/qF.height),r.push({maxkbps:zF.maxkbps,scaleResolutionDownBy:n,frameRate:zF.frameRate,width:Math.floor(e.width/n),height:Math.floor(e.height/n)}),t<=2||n>2&&r.unshift({maxkbps:qF.maxkbps,scaleResolutionDownBy:i,frameRate:qF.frameRate,width:Math.floor(e.width/i),height:Math.floor(e.height/i)}),r}(r,s),rB.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},jF(r,e))})),rB.print("simulcast() ","simulcastLayers2: %o",a)),a.forEach((function(e,t){var r,i={maxBitrate:1e3*e.maxkbps,scaleResolutionDownBy:iB(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],_=jF(f,v);e.prevScaleResolutionDownBy=_.scaleResolutionDownBy,e.videoInputConfig=f;var m,g,y={maxBitrate:1e3*v.maxKbps,scaleResolutionDownBy:iB(_.scaleResolutionDownBy),rid:"0",maxFramerate:v.frameRate||15};if(c.sendEncodings=[y],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!==(g=m.serverConfig)&&void 0!==g&&g.simulcastOnDemand&&(l=function(e){if(!e.length)return[];var t=e.shift(),r=t.width/t.height,n=0,o=0,a=i(i({},t),{},{video_index:o,sub_index:n++});delete a.rid;for(var s=[a],u=0,c=0;c<GF.length;c++)if(GF[c].height<t.height){u=c;break}for(var d=e.shift(),l=u;l<GF.length;l++){var h,f=GF[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))),rB.print("subVideoDesc","desc: %o ",l)}rB.print("publish videoTransceiverInit videoDescriptions","",c,d);var S=null==n?void 0:n.getTrack("preprocessing");(null==n?void 0:n.mixType)!==$.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:(o=s(regeneratorRuntime.mark((function e(t){var r,n,i,o,a,s,u,c,d,l;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(rB.print("updateScaleResolutionDownBy()"),i=null===(r=t.videoTrack)||void 0===r?void 0:r.getTrack(),o=t.videoTransceiver,i&&t.pubVideo&&o){e.next=6;break}return rB.print("updateScaleResolutionDownBy()","no pub"),e.abrupt("return");case 6:a=null==i?void 0:i.getSettings(),s={width:Math.floor(a.width),height:Math.floor(a.height),frameRate:Math.floor(a.frameRate)},(u=jF(s,t.videoEncodeConfig[0])).scaleResolutionDownBy===t.prevScaleResolutionDownBy&&rB.print("updateScaleResolutionDownBy()","no change %o",t.prevScaleResolutionDownBy),(c=null===(n=o.sender)||void 0===n?void 0:n.getParameters())&&(l=u.scaleResolutionDownBy/t.prevScaleResolutionDownBy,c.encodings=null==c||null===(d=c.encodings)||void 0===d?void 0:d.map((function(e){var r;Math.max(e.scaleResolutionDownBy=(e.scaleResolutionDownBy||1)*l,1);var n=+e.rid||0;return e.maxFramerate=(null===(r=t.videoEncodeConfig[n])||void 0===r?void 0:r.frameRate)||e.maxFramerate,e})),t.prevScaleResolutionDownBy=u.scaleResolutionDownBy,t.videoInputConfig=s,null==o||o.sender.setParameters(c));case 12:case"end":return e.stop()}}),e)}))),function(e){return o.apply(this,arguments)})},{key:"getStats",value:function(e,t){return QF(this._peerConnection,e,t)}},{key:"setLocalDescription",value:(n=s(regeneratorRuntime.mark((function e(t,r){var n,i,o,a=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=IP(),e.prev=1,e.next=4,this._peerConnection.setLocalDescription(new RTCSessionDescription({type:"offer",sdp:t}));case 4:this.monitor.rtcSetDescription(0,t,bV.W_1,"local"===(null==r?void 0:r.streamUserId)?EV.UP:EV.DOWN,(null==r?void 0:r.streamId)||"",(null==r?void 0:r.streamUserId)||"",IP()-n,{type:"offer"}),this._initSctpEvents||(this._initSctpEvents=!0,(o=null===(i=this._peerConnection)||void 0===i?void 0:i.sctp)&&(o.onstatechange=function(){a.monitor.rtcInvokeStatus("sctp state change TO: ".concat(o.state),0,"sctp","",0)},o.transport&&(o.transport.onstatechange=function(){var e;a.monitor.rtcInvokeStatus("dtls state change TO: ".concat(null==o||null===(e=o.transport)||void 0===e?void 0:e.state),0,"dtls","",0)}))),e.next=12;break;case 8:e.prev=8,e.t0=e.catch(1),console.error("setLocal",e.t0),this.monitor.rtcSetDescription(-1,e.t0.message+t,bV.W_1,"local"===(null==r?void 0:r.streamUserId)?EV.UP:EV.DOWN,"","",IP()-n,{type:"offer"});case 12:case"end":return e.stop()}}),e,this,[[1,8]])}))),function(e,t){return n.apply(this,arguments)})},{key:"setRemoteDescription",value:(r=s(regeneratorRuntime.mark((function e(t,r){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=IP(),e.prev=1,e.next=4,this._peerConnection.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:t}));case 4:this.monitor.rtcSetDescription(0,t,bV.W_0,"local"===(null==r?void 0:r.streamUserId)?EV.UP:EV.DOWN,(null==r?void 0:r.streamId)||"",(null==r?void 0:r.streamUserId)||"",IP()-n,{type:"answer"}),e.next=11;break;case 7:e.prev=7,e.t0=e.catch(1),console.error("setRemote",e.t0),this.monitor.rtcSetDescription(-1,e.t0.message+t,bV.W_1,"local"===(null==r?void 0:r.streamUserId)?EV.UP:EV.DOWN,(null==r?void 0:r.streamId)||"",(null==r?void 0:r.streamUserId)||"",IP()-n,{type:"answer"});case 11:case"end":return e.stop()}}),e,this,[[1,7]])}))),function(e,t){return r.apply(this,arguments)})},{key:"setCurrentDescription",value:(t=s(regeneratorRuntime.mark((function e(){return regeneratorRuntime.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}}]),c}(cM.exports.EventEmitter),aB={},sB={},uB={exports:{}},cB=uB.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(cB).forEach((function(e){cB[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=uB.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}}))}))}}(sB);var dB=uB.exports,lB=/%[sdv%]/g,hB=function(e){var t=1,r=arguments,n=r.length;return e.replace(lB,(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""}}))},fB=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 hB.apply(null,n)},pB=["v","o","s","i","u","e","p","c","b","t","r","z","a"],vB=["i","c","b","a"],_B=sB,mB=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||pB,n=t.innerOrder||vB,i=[];return r.forEach((function(t){dB[t].forEach((function(r){r.name in e&&null!=e[r.name]?i.push(fB(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){i.push(fB(t,r,e))}))}))})),e.media.forEach((function(e){i.push(fB("m",dB.m[0],e)),n.forEach((function(t){dB[t].forEach((function(r){r.name in e&&null!=e[r.name]?i.push(fB(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){i.push(fB(t,r,e))}))}))}))})),i.join("\r\n")+"\r\n"};aB.write=mB,aB.parse=_B.parse,aB.parseParams=_B.parseParams,aB.parseFmtpConfig=_B.parseFmtpConfig,aB.parsePayloads=_B.parsePayloads,aB.parseRemoteCandidates=_B.parseRemoteCandidates,aB.parseImageAttributes=_B.parseImageAttributes,aB.parseSimulcastStreamList=_B.parseSimulcastStreamList;var gB=Math.pow(2,32),yB=function(){return Math.floor(Math.random()*gB+1e3)},SB=function(e,t,r){return r||(r=yB()),[{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)}]},bB=function(e,t){var r=yB(),n=yB();return{ssrcs:[r,n].reduce((function(r,n){return r.concat(SB(e,t,n))}),[]),ssrcGroups:[{semantics:"FID",ssrcs:"".concat(r," ").concat(n)}]}};function EB(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 RB=function(e,t,r){var n=i(i({},e),{},{invalid:[{value:"realx-exts:rscp"}],media:[t,r]});return delete n.groups,delete n.msidSemantic,aB.write(n)};function kB(e){return TB.apply(this,arguments)}function TB(){return(TB=s(regeneratorRuntime.mark((function e(t){var r,n,i,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r={},n=t.publicIPs,i=t.certFingerprint,o=t.iceParams,r.fingerprint={type:"sha-256",hash:i},r.icePwd=o.serverIcePwd,e.next=6,AB(o.serverIceUfrag);case 6:return r.iceUfrag=e.sent,XV.setStats({connection_id:r.iceUfrag}),r.candidates=IB(n),r.setup="active",r.iceOptions="renomination",e.abrupt("return",r);case 12:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function IB(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 AB=function(){var e=s(regeneratorRuntime.mark((function e(t){var r,n,i,o,a,s,u;return regeneratorRuntime.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,CP.b64str2ab(t);case 5:return e.t1=e.sent,i=new e.t0(e.t1),o=r.encode(Date.now().toString()).slice(-4),(a=new Uint8Array(2))[0]=0,a[1]=1,s=AP(Uint8Array,n,i,o,a),e.next=14,CP.ab2b64str(s.buffer);case 14:return u=e.sent,e.abrupt("return",u);case 16:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),wB=function(e,t){var r=0;if(Array.isArray(e.fmtp)&&Array.isArray(e.rtp)){var n,i=T(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(" ")}},CB=Te,OB=Gd,xB=Cm.exports.getWeakData,NB=Pr,DB=He,PB=Jd,MB=Ol,LB=Vt,UB=On.set,VB=On.getterFor,FB=Ka.find,BB=Ka.findIndex,jB=CB([].splice),GB=0,HB=function(e){return e.frozen||(e.frozen=new zB)},zB=function(){this.entries=[]},qB=function(e,t){return FB(e.entries,(function(e){return e[0]===t}))};zB.prototype={get:function(e){var t=qB(this,e);if(t)return t[1]},has:function(e){return!!qB(this,e)},set:function(e,t){var r=qB(this,e);r?r[1]=t:this.entries.push([e,t])},delete:function(e){var t=BB(this.entries,(function(t){return t[0]===e}));return~t&&jB(this.entries,t,1),!!~t}};var XB,KB={getConstructor:function(e,t,r,n){var i=e((function(e,i){PB(e,o),UB(e,{type:t,id:GB++,frozen:void 0}),null!=i&&MB(i,e[n],{that:e,AS_ENTRIES:r})})),o=i.prototype,a=VB(t),s=function(e,t,r){var n=a(e),i=xB(NB(t),!0);return!0===i?HB(n).set(t,r):i[n.id]=r,e};return OB(o,{delete:function(e){var t=a(this);if(!DB(e))return!1;var r=xB(e);return!0===r?HB(t).delete(e):r&&LB(r,t.id)&&delete r[t.id]},has:function(e){var t=a(this);if(!DB(e))return!1;var r=xB(e);return!0===r?HB(t).has(e):r&&LB(r,t.id)}}),OB(o,r?{get:function(e){var t=a(this);if(DB(e)){var r=xB(e);return!0===r?HB(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}},WB=oe,YB=Te,JB=Gd,QB=Cm.exports,ZB=fg,$B=KB,ej=He,tj=Lm,rj=On.enforce,nj=sn,ij=!WB.ActiveXObject&&"ActiveXObject"in WB,oj=function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}},aj=ZB("WeakMap",oj,$B);if(nj&&ij){XB=$B.getConstructor(oj,"WeakMap",!0),QB.enable();var sj=aj.prototype,uj=YB(sj.delete),cj=YB(sj.has),dj=YB(sj.get),lj=YB(sj.set);JB(sj,{delete:function(e){if(ej(e)&&!tj(e)){var t=rj(this);return t.frozen||(t.frozen=new XB),uj(this,e)||t.frozen.delete(e)}return uj(this,e)},has:function(e){if(ej(e)&&!tj(e)){var t=rj(this);return t.frozen||(t.frozen=new XB),cj(this,e)||t.frozen.has(e)}return cj(this,e)},get:function(e){if(ej(e)&&!tj(e)){var t=rj(this);return t.frozen||(t.frozen=new XB),cj(this,e)?dj(this,e):t.frozen.get(e)}return dj(this,e)},set:function(e,t){if(ej(e)&&!tj(e)){var r=rj(this);r.frozen||(r.frozen=new XB),cj(this,e)?lj(this,e,t):r.frozen.set(e,t)}else lj(this,e,t);return this}})}var hj=function(e){h(y,e);var t,r,n,i,o,a,c,f,p,v,m=g(y);function y(){var e;return u(this,y),l(_(e=m.call(this)),"_hasVideoPermission",!1),l(_(e),"_hasAudioPermission",!1),l(_(e),"inited",!1),l(_(e),"deviceMap",{audioinput:new Map,audiooutput:new Map,videoinput:new Map}),e._handleDeviceChange=e._handleDeviceChange.bind(_(e)),!wP()&&e.refreshDevices(),e}return d(y,[{key:"refreshDevices",value:(v=s(regeneratorRuntime.mark((function e(){var t,r,n=this;return regeneratorRuntime.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,!NP){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;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 v.apply(this,arguments)})},{key:"initListener",value:(p=s(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.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",this._handleDeviceChange);case 1:case"end":return e.stop()}}),e,this)}))),function(){return p.apply(this,arguments)})},{key:"_handleDeviceChange",value:(f=s(regeneratorRuntime.mark((function e(){var t,r,n,i=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=void 0,!NP){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(E(this.deviceMap.audioinput.values()),E(this.deviceMap.videoinput.values()),E(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(re.onVideoDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"active"}):e.kind.includes("audio")&&i.emit(re.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(re.onVideoDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"inactive"}):e.kind.includes("audio")&&i.emit(re.onAudioDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"inactive"}))}));case 12:case"end":return e.stop()}}),e,this)}))),function(){return f.apply(this,arguments)})},{key:"getVideoPermission",value:(c=s(regeneratorRuntime.mark((function e(){var t=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(navigator.mediaDevices&&navigator.mediaDevices.getUserMedia){e.next=4;break}throw new fD(lD.NOT_SUPPORTED,"GetUserMedia not supported");case 4:if(!this.hasVideoPermission){e.next=6;break}return e.abrupt("return",!0);case 6:return e.prev=6,e.next=9,navigator.mediaDevices.getUserMedia({audio:!1,video:!0}).then((function(e){e&&(e.getTracks().forEach((function(e){return e.stop()})),t.hasVideoPermission=!0,t.inited||t.refreshDevices())}));case 9:e.next=13;break;case 11:e.prev=11,e.t0=e.catch(6);case 13:return e.abrupt("return",this.hasVideoPermission);case 14:case"end":return e.stop()}}),e,this,[[6,11]])}))),function(){return c.apply(this,arguments)})},{key:"getAudioPermission",value:(a=s(regeneratorRuntime.mark((function e(){var t=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(navigator.mediaDevices&&navigator.mediaDevices.getUserMedia){e.next=4;break}throw new fD(lD.NOT_SUPPORTED,"GetUserMedia not supported");case 4:if(!this.hasAudioPermission){e.next=6;break}return e.abrupt("return",!0);case 6:return e.prev=6,e.next=9,navigator.mediaDevices.getUserMedia({audio:!0,video:!1}).then((function(e){e&&(e.getTracks().forEach((function(e){return e.stop()})),t.hasAudioPermission=!0,t.inited||t.refreshDevices())}));case 9:e.next=13;break;case 11:e.prev=11,e.t0=e.catch(6);case 13:return e.abrupt("return",this.hasAudioPermission);case 14:case"end":return e.stop()}}),e,this,[[6,11]])}))),function(){return a.apply(this,arguments)})},{key:"enumerateDevices",value:(o=s(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.getAudioPermission();case 3:e.next=7;break;case 5:e.prev=5,e.t0=e.catch(0);case 7:return e.prev=7,e.next=10,this.getVideoPermission();case 10:e.next=14;break;case 12:e.prev=12,e.t1=e.catch(7);case 14:return e.next=16,this.refreshDevices();case 16:return e.abrupt("return",Array.from([].concat(E(this.deviceMap.audioinput.values()),E(this.deviceMap.videoinput.values()),E(this.deviceMap.audiooutput.values()))));case 17:case"end":return e.stop()}}),e,this,[[0,5],[7,12]])}))),function(){return o.apply(this,arguments)})},{key:"enumerateAudioCaptureDevices",value:(i=s(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.getAudioPermission();case 3:e.next=7;break;case 5:e.prev=5,e.t0=e.catch(0);case 7:return e.next=9,this.refreshDevices();case 9:return e.abrupt("return",Array.from(this.deviceMap.audioinput.values()));case 10:case"end":return e.stop()}}),e,this,[[0,5]])}))),function(){return i.apply(this,arguments)})},{key:"enumerateVideoCaptureDevices",value:(n=s(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.getVideoPermission();case 3:e.next=7;break;case 5:e.prev=5,e.t0=e.catch(0);case 7:return e.next=9,this.refreshDevices();case 9:return e.abrupt("return",Array.from(this.deviceMap.videoinput.values()));case 10:case"end":return e.stop()}}),e,this,[[0,5]])}))),function(){return n.apply(this,arguments)})},{key:"enumerateAudioPlaybackDevices",value:(r=s(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.getAudioPermission();case 3:e.next=7;break;case 5:e.prev=5,e.t0=e.catch(0);case 7:return e.next=9,this.refreshDevices();case 9:return e.abrupt("return",Array.from(this.deviceMap.audiooutput.values()));case 10:case"end":return e.stop()}}),e,this,[[0,5]])}))),function(){return r.apply(this,arguments)})},{key:"getDeviceById",value:(t=s(regeneratorRuntime.mark((function e(t){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.enumerateDevices();case 2:return r=e.sent,e.abrupt("return",r.find((function(e){return e.deviceId===t})));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"hasAudioPermission",get:function(){return this._hasAudioPermission},set:function(e){if(!e)throw new fD(lD.NO_PERMISSION,"Cannot revoke audio permission");this.refreshDevices(),this._hasAudioPermission=!0}},{key:"hasVideoPermission",get:function(){return this._hasVideoPermission},set:function(e){if(!e)throw new fD(lD.NO_PERMISSION,"Cannot revoke Video permission");this.inited||this.refreshDevices(),this._hasVideoPermission=!0}}]),y}(_M),fj=new hj,pj=function(){function e(){u(this,e),l(this,"_audioContextInstance",void 0)}return d(e,[{key:"getAudioContextInstance",value:function(){if(!this._audioContextInstance){var e=window.AudioContext||window.webkitAudioContext;this._audioContextInstance=new e}return this._audioContextInstance}}]),e}(),vj=function(){function e(t){u(this,e),l(this,"_ctx",void 0),l(this,"_analyserNode",void 0),l(this,"_audioSource",void 0);var r=_j.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 d(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}(),_j=new pj,mj=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}(mj||{}),gj=function(){function e(){u(this,e),l(this,"_plugins",new Map),l(this,"_monitor",void 0)}var t;return d(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=s(regeneratorRuntime.mark((function e(t){var r,n,i,o,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=this._plugins.get(1)||[],n=t.getTrack(),i=T(r),e.prev=3,i.s();case 5:if((o=i.n()).done){e.next=12;break}return a=o.value,e.next=9,a.effect(t,n);case 9:n=e.sent;case 10:e.next=5;break;case 12:e.next=17;break;case 14:e.prev=14,e.t0=e.catch(3),i.e(e.t0);case 17:return e.prev=17,i.f(),e.finish(17);case 20:return e.abrupt("return",n);case 21:case"end":return e.stop()}}),e,this,[[3,14,17,20]])}))),function(e){return t.apply(this,arguments)})},{key:"destroy",value:function(){this._plugins.forEach((function(e){e.forEach((function(e){return e.destroy()}))})),this._plugins.clear()}}]),e}(),yj=new pM("VERTC",0),Sj=new WeakMap,bj=function(e){h(r,e);var t=g(r);function r(e,n){var i;return u(this,r),l(_(i=t.call(this)),"sourceType",1),l(_(i),"mediaType",void 0),l(_(i),"_trackId",void 0),i._trackId=e,i.mediaType=n,i}return d(r,[{key:"getId",value:function(){return this._trackId}}]),r}(_M),Ej=function(e){h(n,e);var t,r=g(n);function n(e,t,i){var o;return u(this,n),l(_(o=r.call(this,t,i)),"_mediaTrack",void 0),l(_(o),"_preProcessingTrack",void 0),o._mediaTrack=e,o._initListeners(),o}return d(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=s(regeneratorRuntime.mark((function e(t){var r;return regeneratorRuntime.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(){HV.rtcError("track-ended mediaType: ".concat(e._mediaTrack.kind),-1001),e.emit("track-ended",e)}))}}]),n}(bj),Rj=function(e){h(r,e);var t=g(r);function r(e,n,i){var o;return u(this,r),l(_(o=t.call(this,n,i)),"_mediaTrack",void 0),o._mediaTrack=e,o}return d(r,[{key:"getTrack",value:function(){return this._mediaTrack}}]),r}(bj),kj=function(e){h(n,e);var t,r=g(n);function n(e,t){var i;return u(this,n),l(_(i=r.call(this,e,t,"video")),"resolution",void 0),l(_(i),"videoCaptureConfig",void 0),l(_(i),"dummy",!1),i.resolution={width:0,height:0},i}return d(n,[{key:"updateVideoCaptureConfig",value:(t=s(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.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 yj.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}(Ej),Tj=function(e){h(n,e);var t,r=g(n);function n(e,t){var i;return u(this,n),l(_(i=r.call(this,e,t,"audio")),"audioCaptureConfig",void 0),l(_(i),"_audioLevelFetcher",void 0),l(_(i),"mixedAudioTrack",void 0),l(_(i),"mixType",$.PLAYOUT_AND_PUBLISH),i}return d(n,[{key:"getAudioLevel",value:function(){return this._audioLevelFetcher||(this._audioLevelFetcher=new vj(this.getTrack("preprocessing"))),this._audioLevelFetcher.getAudioLevel()}},{key:"updateAudioCaptureConfig",value:(t=s(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.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 yj.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}(Ej),Ij=function(e){h(r,e);var t=g(r);function r(e,n){return u(this,r),t.call(this,e,n,"video")}return d(r)}(Rj),Aj=function(e){h(r,e);var t=g(r);function r(e,n){var i;return u(this,r),l(_(i=t.call(this,e,n,"audio")),"_audioLevelFetcher",void 0),i}return d(r,[{key:"getAudioLevel",value:function(){return this._audioLevelFetcher||(this._audioLevelFetcher=new vj(this.getTrack())),this._audioLevelFetcher.getAudioLevel()}}]),r}(Rj),wj=function(e){h(r,e);var t=g(r);function r(){var e;u(this,r);for(var n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];return l(_(e=t.call.apply(t,[this].concat(i))),"streamIndex",M.STREAM_INDEX_MAIN),e}return d(r)}(Tj),Cj=function(e){h(r,e);var t=g(r);function r(){var e;u(this,r);for(var n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];return l(_(e=t.call.apply(t,[this].concat(i))),"streamIndex",M.STREAM_INDEX_MAIN),e}return d(r)}(kj),Oj=function(e){h(r,e);var t=g(r);function r(){var e;u(this,r);for(var n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];return l(_(e=t.call.apply(t,[this].concat(i))),"streamIndex",M.STREAM_INDEX_MAIN),l(_(e),"sourceType",0),e}return d(r)}(kj),xj=function(e){h(r,e);var t=g(r);function r(){var e;u(this,r);for(var n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];return l(_(e=t.call.apply(t,[this].concat(i))),"streamIndex",M.STREAM_INDEX_MAIN),l(_(e),"sourceType",0),e}return d(r)}(Tj),Nj=function(e){h(r,e);var t=g(r);function r(){var e;u(this,r);for(var n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];return l(_(e=t.call.apply(t,[this].concat(i))),"streamIndex",M.STREAM_INDEX_SCREEN),e}return d(r)}(kj),Dj=function(e){h(r,e);var t=g(r);function r(){var e;u(this,r);for(var n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];return l(_(e=t.call.apply(t,[this].concat(i))),"streamIndex",M.STREAM_INDEX_SCREEN),e}return d(r)}(Tj),Pj=function(e){h(r,e);var t=g(r);function r(){var e;u(this,r);for(var n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];return l(_(e=t.call.apply(t,[this].concat(i))),"streamIndex",M.STREAM_INDEX_SCREEN),l(_(e),"sourceType",0),e}return d(r)}(kj),Mj=function(e){h(r,e);var t=g(r);function r(){var e;u(this,r);for(var n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];return l(_(e=t.call.apply(t,[this].concat(i))),"streamIndex",M.STREAM_INDEX_SCREEN),l(_(e),"sourceType",0),e}return d(r)}(Tj);function Lj(e,t){return Uj.apply(this,arguments)}function Uj(){return(Uj=s(regeneratorRuntime.mark((function e(t,r){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=new Cj(t,TP())).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 Vj(e,t){return Fj.apply(this,arguments)}function Fj(){return(Fj=s(regeneratorRuntime.mark((function e(t,r){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=new Nj(t,TP())).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 Bj(e,t){return jj.apply(this,arguments)}function jj(){return(jj=s(regeneratorRuntime.mark((function e(t,r){var n,i,o,a,s,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=(null==t||null===(n=t.deviceId)||void 0===n?void 0:n.exact)||"default",e.prev=1,yj.print("createCameraVideoTrack","constraints:",t),HV.rtcVideoCaptureEvent({event_type:FV.START,media_device_id:o}),a=IP(),e.next=7,navigator.mediaDevices.getUserMedia({video:t});case 7:i=e.sent,HV.rtcVideoCaptureEvent({event_type:FV.START_CAPTURE_RESULT,media_device_id:o,reason:BV.SUCCESS,elapse:IP()-a}),fj.hasVideoPermission=!0,e.next=16;break;case 12:throw e.prev=12,e.t0=e.catch(1),HV.rtcVideoCaptureEvent({event_type:FV.RUNNING_FAILED,media_device_id:o,error_code:e.t0.code,reason:e.t0.name+e.t0.message}),new fD(lD.GET_VIDEO_TRACK_FAILED,"throw error from getUserMedia",e.t0);case 16:return s=i.getVideoTracks()[0],Sj.set(s,i),(u=new Cj(s,TP())).videoCaptureConfig=t,e.next=22,u.generatePreProcessingTrack(r);case 22:return e.abrupt("return",u);case 23:case"end":return e.stop()}}),e,null,[[1,12]])})))).apply(this,arguments)}function Gj(e,t,r){return Hj.apply(this,arguments)}function Hj(){return(Hj=s(regeneratorRuntime.mark((function e(t,r,n){var i,o,a,s,u,c,d,l,h,f,p,v;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return yj.print("createCameraVideoTrack","constraints:",t),a=(null==t||null===(i=t.deviceId)||void 0===i?void 0:i.exact)||"default",s=(null==n?void 0:n.config)||{},u=s.sampleRate,c=s.channel,d=s.agc,l=s.ans,h=s.aec,void 0===t.sampleRate&&(t.sampleRate=u),void 0===t.channelCount&&(t.channelCount=c),void 0===t.autoGainControl&&(t.autoGainControl=d),void 0===t.noiseSuppression&&(t.noiseSuppression=l),void 0===t.echoCancellation&&(t.echoCancellation=h),e.prev=8,HV.rtcVideoCaptureEvent({event_type:FV.START,media_device_id:a}),f=IP(),r.getPluginByName(mj.PRE_PROCESSING,"RTCAIAnsExtension")&&(t.autoGainControl=!0,t.noiseSuppression=!1),e.next=14,navigator.mediaDevices.getUserMedia({audio:t});case 14:o=e.sent,HV.rtcVideoCaptureEvent({event_type:FV.START_CAPTURE_RESULT,media_device_id:a,reason:BV.SUCCESS,elapse:IP()-f}),fj.hasAudioPermission=!0,e.next=23;break;case 19:throw e.prev=19,e.t0=e.catch(8),HV.rtcVideoCaptureEvent({event_type:FV.RUNNING_FAILED,media_device_id:a,error_code:e.t0.code,reason:e.t0.name+e.t0.message}),new fD(lD.GET_AUDIO_TRACK_FAILED,"throw error from getUserMedia",e.t0);case 23:return p=o.getAudioTracks()[0],Sj.set(p,o),v=new wj(p,TP()),e.next=28,v.generatePreProcessingTrack(r);case 28:return e.abrupt("return",v);case 29:case"end":return e.stop()}}),e,null,[[8,19]])})))).apply(this,arguments)}function zj(){return qj.apply(this,arguments)}function qj(){return qj=s(regeneratorRuntime.mark((function e(){var t,r,n,i,o,a,s,u,c,d=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=d.length>0&&void 0!==d[0]&&d[0],r=d.length>1?d[1]:void 0,n=d.length>2?d[2]:void 0,yj.print("createScreenTracks","withAudio:",t),e.prev=4,HV.rtcVideoCaptureEvent({event_type:FV.START,media_device_id:"screen"}),o=IP(),e.next=9,navigator.mediaDevices.getDisplayMedia({video:n||!0,audio:t});case 9:i=e.sent,HV.rtcVideoCaptureEvent({event_type:FV.START_CAPTURE_RESULT,media_device_id:"screen",reason:BV.SUCCESS,elapse:IP()-o}),e.next=17;break;case 13:throw e.prev=13,e.t0=e.catch(4),HV.rtcVideoCaptureEvent({event_type:FV.RUNNING_FAILED,media_device_id:"screen",error_code:e.t0.code,reason:e.t0.name+e.t0.message}),new fD(lD.GET_SCREEN_TRACK_FAILED,"throw error from getDisplayMedia",e.t0);case 17:return a=i.getVideoTracks()[0],s=new Nj(a,TP()),e.next=21,s.generatePreProcessingTrack(r);case 21:if(!(u=i.getAudioTracks()[0])){e.next=27;break}return c=new Dj(u,TP()),e.next=26,c.generatePreProcessingTrack(r);case 26:return e.abrupt("return",[s,c]);case 27:return e.abrupt("return",[s,void 0]);case 28:case"end":return e.stop()}}),e,null,[[4,13]])}))),qj.apply(this,arguments)}function Xj(e,t){return Kj.apply(this,arguments)}function Kj(){return(Kj=s(regeneratorRuntime.mark((function e(t,r){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new Oj(t,TP()),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 Wj(e,t){return Yj.apply(this,arguments)}function Yj(){return(Yj=s(regeneratorRuntime.mark((function e(t,r){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new xj(t,TP()),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 Jj(e,t){return Qj.apply(this,arguments)}function Qj(){return(Qj=s(regeneratorRuntime.mark((function e(t,r){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new Pj(t,TP()),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 Zj(e,t){return $j.apply(this,arguments)}function $j(){return($j=s(regeneratorRuntime.mark((function e(t,r){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new Mj(t,TP()),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 eG=Tj,tG=function(e){return e[e.NONE=0]="NONE",e}(tG||{}),rG=function(){function e(){u(this,e)}return d(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}(),nG=function(){function e(t){u(this,e),l(this,"_position",0),l(this,"_dataview",void 0),this._dataview=new DataView(t)}return d(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}(),iG=function(e){return e[e.internal=0]="internal",e[e.external=1]="external",e[e.bypass=2]="bypass",e}(iG||{}),oG=new Uint8Array([109,167,53,190,103,90,72,1,170,89,63,164,194,199,19,85]),aG=new Uint8Array([109,167,53,190,103,90,72,1,170,89,63,164,194,199,19,84]),sG=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 uG(e){for(var t=[];e>=255;)e-=255,t.push(255);return t.push(e),new Uint8Array(t)}function cG(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 dG=function(){function e(){u(this,e)}return d(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?oG:aG,a=uG(e.byteLength+o.byteLength),s=sG(e);return new Uint8Array([].concat(E(r),E(n),E(i),E(a),E(o),E(s),[128]))}},{key:"decodeSeiBody",value:function(e){var t=function(e){for(var t=[],r=0;r<e.length;r++)e[r]<=3&&0===e[r-1]&&0===e[r-2]||t.push(e[r]);return new Uint8Array(t)}(e=e.slice(0,e.length-1));if(!(t.byteLength<2)){var r=0;if(5===t[1]||100===t[1]){var n=b(cG(t,r+=2),2),i=n[0],o=2,a=(r=n[1])+i;return t.byteLength>=aG.byteLength&&i>=aG.byteLength&&t.slice(r,r+aG.byteLength).toString()===aG.toString()?(r+=aG.byteLength,o=1):t.byteLength>=aG.byteLength&&i>=aG.byteLength&&t.slice(r,r+oG.byteLength).toString()===oG.toString()&&(r+=oG.byteLength,o=0),{type:o,payload:t.slice(r,a)}}}}},{key:"parseInternalSEI",value:function(e){var t=new Map,r=0;if(0===e.type){for(;e.payload.byteLength-r>=2;){var n=b(cG(e.payload,r),2),i=n[0];r=n[1];var o=b(cG(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=T(e);try{for(n.s();!(t=n.n()).done;){var i=b(t.value,2),o=i[0],a=i[1],s=uG(o),u=uG(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}(),lG=function(){function e(t){u(this,e),l(this,"_stream",void 0),l(this,"_timer",void 0),l(this,"client",void 0),l(this,"handler",void 0),l(this,"monitor",void 0),this._stream=t}return d(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}(),hG=function(e){h(i,e);var t,r,n=g(i);function i(e){var t;return u(this,i),(t=n.call(this,e))._stream=e,t}return d(i,[{key:"setLocalStreamStatsEvtInterval",value:function(e,t,r){var n,i,o,a=this;if(!this._timer){this.setVar(e,t,r),e.once(TF.ABNORMAL_DISCONNECTION,(function(){a.destroy()}));var u={audio:{},video:{}},c=this._stream,d=null===(n=c.audioTrack)||void 0===n?void 0:n.getTrack("preprocessing"),l=null===(i=c.videoTrack)||void 0===i?void 0:i.getTrack("preprocessing");this.getAudioStats(d,u,null===(o=c.audioTrack)||void 0===o?void 0:o.getAudioLevel()),this.getVideoStats(l,u),this.delStatsEvtInterval();var h=function(){var e=s(regeneratorRuntime.mark((function e(){var t,r,n,i,o,s,d;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=null===(t=c.audioTrack)||void 0===t?void 0:t.getTrack("preprocessing"),o=null===(r=c.videoTrack)||void 0===r?void 0:r.getTrack("preprocessing"),e.next=4,a.getAudioStats(i,u,null===(n=c.audioTrack)||void 0===n?void 0:n.getAudioLevel());case 4:return s=e.sent,e.next=7,a.getVideoStats(o,u);case 7:return d=e.sent,e.abrupt("return",{audioStats:s,videoStats:d,isScreen:c.isScreen});case 9:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),f=function(){var e=s(regeneratorRuntime.mark((function e(){var t,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,h();case 2:r=e.sent,null===(t=a.client)||void 0===t||t.emit("onLocalStreamStats",r),a._timer=setTimeout(f,2e3);case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();this._timer=setTimeout(f,2e3)}}},{key:"unpublish",value:function(){this.delStatsEvtInterval()}},{key:"getAudioStats",value:(r=s(regeneratorRuntime.mark((function e(t,r,n){var i,o,a,s,u,c,d,l,h,f;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i={},o={timestamp:Date.now()},a=this._stream,s=a.streamId,u=a.audioMid,c=a.isScreen,d=a.pubAttributes,l={media_type:"audio",is_screen:!!c,direction:"up",stream_id:s,vid:u,connection_status:navigator.onLine,capture_state:d.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((h=e.sent).length){e.next=11;break}return e.abrupt("return",i);case 11:if(h.forEach((function(e){var t=e.type,r=e.packetsSent,n=e.packetsLost,a=e.bytesSent,s=e.clockRate,u=e.roundTripTime,c=e.channels,d=e.audioLevel;e.googRtt;var h=e.mimeType,f=e.availableIncomingBitrate,p=e.availableOutgoingBitrate,v=e.bytesReceived,_=e.nominated,m=e.id,g=e.currentRoundTripTime,y=e.state,S=e.writable,b=e.requestsReceived,E=e.responsesReceived,R=e.requestsSent,k=e.consentRequestsSent,T=e.responsesSent,I=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?(o.packetsSent=r,o.bytesSent=a,l.bytes=a,l.packetsSent=r,l.nackCount=D,l.ssrc=U,l.retransmitted_bytes_sent=P,l.retransmitted_packets_sent=M,o.retransmittedBytesSent=P,o.retransmittedPacketsSent=M):"remote-inbound-rtp"===t?(o.packetsLost=n,l.packetsLost=n,l.net_jitter=1e3*I,i.rtt=1e3*u,l.rtt=i.rtt,i._fractionLost=j||0):"codec"===t?(i.recordSampleRate=s,i.numChannels=c,l.codecName=h):"media-source"===t&&void 0!==d?(l.audio_level=d?-10*Math.log10(Math.pow(d,2)):d,l.volume=255*d,l.total_audio_energy=V,l.totalInputDuration=F):"ssrc"===t&&"audio"===B?l.send_level=L:"candidate-pair"===t?(l.ice_available_incoming_bitrate=f,l.ice_available_outgoing_bitrate=p,l.ice_bytes_received=v,l.ice_bytes_sent=a,l.ice_nominated=+_,l.ice_pair_id=m,l.ice_pair_rtt=g,l.ice_pair_state=y,l.ice_pair_writable=S,l.recv_ping_requests=b,l.recv_ping_responses=E,l.sent_ping_requests_before_first_response=R,l.sent_ping_requests_total=R+(k||0),l.sent_ping_responses=T):"local-candidate"===t?(l.local_candidate_type=A,l.local_ip=w||C,l.local_network_type=O,l.local_port=x,l.protocol=N):"remote-candidate"===t&&(l.remote_candidate_type=A,l.remote_ip=w||C,l.remote_port=x)})),void 0===l.volume&&void 0!==n&&(l.volume=n,l.audio_level=n?-10*Math.log10(Math.pow(n/255,2)):n),(f=r.audio).timestamp){e.next=17;break}return r.audio=o,e.abrupt("return",this.filterIllegal(i));case 17:return void 0!==o.packetsLost&&(i.audioLossRate=(o.packetsLost-f.packetsLost)/(o.packetsSent-f.packetsSent),i.audioLossRate=Number.isNaN(i.audioLossRate)?0:i.audioLossRate,l.fraction_lost=i.audioLossRate),i.statsInterval=o.timestamp-f.timestamp,l.stats_interval=i.statsInterval,i.sendKBitrate=(o.bytesSent-f.bytesSent||0)/i.statsInterval*8,l.mediaBitratebps=Math.round(1e3*i.sendKBitrate),l.bandwidth=Math.round(l.mediaBitratebps/1024),void 0!==o.retransmittedBytesSent&&(l.retransmitBitratebps=(o.retransmittedBytesSent-f.retransmittedBytesSent||0)/i.statsInterval),r.audio=o,this.monitor.rtcMediaStatistics(l,{}),i._retransmittedRate=(o.retransmittedPacketsSent-f.retransmittedPacketsSent)/(o.packetsSent-f.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=s(regeneratorRuntime.mark((function e(t,r){var n,i,o,a,s,u,c,d,l,h,f,p,v,_;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n={},i={timestamp:Date.now(),simulcast:{}},o=this._stream,a=o.streamId,s=o.videoMid,u=o.isScreen,c=o.pubAttributes,d=o.enableSimulcast,l={media_type:"video",is_screen:!!u,direction:"up",stream_id:a,vid:s,connection_status:navigator.onLine,capture_state:c.localvideo?"capture_state_on":"capture_state_off"},t&&this.handler){e.next=6;break}return e.abrupt("return",n);case 6:return n.isScreen=u,e.next=9,this.handler.getStats(t);case 9:if((h=e.sent).length){e.next=12;break}return e.abrupt("return",n);case 12:if(f=0,h.forEach((function(e){var t=e.type,r=e.framesEncoded,o=e.packetsLost,a=e.bytesSent,s=e.framesSent,u=e.roundTripTime,c=e.mimeType,h=e.frameWidth,p=e.frameHeight,v=e.packetsSent,_=e.googActualEncBitrate,m=e.googAvailableReceiveBandwidth,g=e.googAvailableSendBandwidth,y=e.googAvgEncodeMs,S=e.googBucketDelay,b=e.googEncodeUsagePercent,E=e.googFrameRateInput,R=e.availableIncomingBitrate,k=e.availableOutgoingBitrate,T=e.bytesReceived,I=e.nominated,A=e.id,w=e.currentRoundTripTime,C=e.state,O=e.writable,x=e.candidateType,N=e.ip,D=e.address,P=e.networkType,M=e.port,L=e.nackCount,U=e.pliCount,V=e.protocol,F=e.qpSum,B=e.requestsReceived,j=e.responsesReceived,G=e.googRetransmitBitrate,H=e.requestsSent,z=e.consentRequestsSent,q=e.responsesSent,X=e.ssrc,K=e.googTargetEncBitrate,W=e.googTransmitBitrate,Y=e.retransmittedPacketsSent,J=e.encoderImplementation,Q=e.jitter,Z=e.rid,$=e.fractionLost,ee=e.googAdaptationChanges,te=e.googBandwidthLimitedResolution,re=e.googCpuLimitedResolution,ne=e.googFirsReceived,ie=e.googFrameRateSent;"outbound-rtp"===t?(d&&(Z?i.simulcast[Z]=e:i.simulcast[f]=e,f++),i.framesEncoded=r,i.bytesSent=a,i.framesSent=s,l.bytes=a,i.packetsSent=v,l.packetsSent=v,l.nackCount=L,l.pli_count=U,l.qp_sum=F,l.ssrc=X,l.retransmitted_packets_sent=Y,i.retransmittedPacketsSent=Y,l.encoder_implementation=J,void 0!==h&&(n.encodedFrameWidth=h,n.encodedFrameHeight=p,l.frame_size_height=p,l.frame_size_width=h)):"track"===t?(n.encodedFrameWidth=h,n.encodedFrameHeight=p,l.frame_size_height=p,l.frame_size_width=h):"remote-inbound-rtp"===t?(i.packetsLost=o,n.rtt=1e3*u,l.rtt=n.rtt,l.jitter=Q,l.packetsLost=o,n._fractionLost=$||0):"codec"===t?(n.codecType=c,l.codecName=c):"candidate-pair"===t?(l.ice_available_incoming_bitrate=R,l.ice_available_outgoing_bitrate=k,l.ice_bytes_received=T,l.ice_bytes_sent=a,l.ice_nominated=+I,l.ice_pair_id=A,l.ice_pair_rtt=w,l.ice_pair_state=C,l.ice_pair_writable=O,l.recv_ping_requests=B,l.recv_ping_responses=j,l.sent_ping_requests_before_first_response=H,l.sent_ping_requests_total=H+z,l.sent_ping_responses=q):"local-candidate"===t?(l.local_candidate_type=x,l.local_ip=N||D,l.local_network_type=P,l.local_port=M,l.protocol=V):"remote-candidate"===t?(l.remote_candidate_type=x,l.remote_ip=N||D,l.remote_port=M):"VideoBwe"===t?(l.encBitratebps=_,l.available_receive_bandwidth=m,l.available_send_bandwidth=g,l.bucket_delay=S,l.retransmitBitratebps=G,l.targetEncBitratebps=K,l.transmit_bitrate=W,n._sendBandWidth=+g):"ssrc"===t&&(l.avg_encode_ms=y,l.encodeUsage=b,l.frame_rate_input=E,l.orignal_input_Framerate=+E,l.ddaptationChanges=ee,l.qualityLimitationReason=te,l.qualityLimitationDurations=re,l.firsReceived=ne,l.frameRateSent=ie)})),(p=r.video).timestamp){e.next=18;break}return r.video=i,e.abrupt("return",this.filterIllegal(n));case 18:return n.statsInterval=i.timestamp-p.timestamp,l.stats_interval=n.statsInterval,v=Object.keys(i.simulcast),d?(l.sim_enc_width=[],l.sim_enc_height=[],l.sim_enc_bps=[],l.sim_enc_framerate=[],l.sim_rids=[],l.sim_enc_bandwidth=[],l.sim_sent_framerate=[],l.sim_fraction_lost=[],l.sim_keyencoded=[],l.active_sim_streams=[],l.sim_retransmittedRate=[],_=!1,v.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,h=t.qualityLimitationReason,f=t.qualityLimitationDurations,v=t.qualityLimitationResolutionChanges,m=t.retransmittedPacketsSent,g=t.pliCount;void 0!==h&&(l.sim_qualityLimitationReason||(l.sim_qualityLimitationReason=[],l.sim_qualityLimitationDurations=[],l.sim_qualityLimitationResolutionChanges=[]),l.sim_qualityLimitationReason.push(h),l.sim_qualityLimitationDurations.push(f),l.sim_qualityLimitationResolutionChanges.push(v));var y=p.simulcast[e];if(l.sim_enc_width.push(r||0),l.sim_enc_height.push(o||0),y){var S=(a-y.bytesSent||0)/n.statsInterval;l.sim_enc_bps.push(Math.round(8e3*S)),l.sim_enc_bandwidth.push(Math.round(8e3*S/1024));var b=1e3*(s-y.framesEncoded)/n.statsInterval;l.sim_enc_framerate.push(Math.round(b)),l.sim_rids.push(e);var E=void 0!==u?u-y.framesSent:s-y.framesEncoded,R=1e3*E/n.statsInterval;l.sim_sent_framerate.push(Math.round(R));var k=(c-y.packetsLost)/(d-y.packetsSent);n._retransmittedRate=(m-y.retransmittedPacketsSent)/(d-y.packetsSent),k=Number.isNaN(k)?0:k,l.sim_fraction_lost.push(k),l.sim_keyencoded.push(g-y.pliCount>0),l.active_sim_streams.push(S>=0),l.sim_retransmittedRate.push(n._retransmittedRate),r>0&&!_&&(n.sentKBitrate=8*S,n.encoderOutputFrameRate=b,n.encodedFrameCount=E,n.sentFrameRate=R,n.videoLossRate=k,_=!0)}})),this.monitor.rtcMediaStatistics(l,{})):(n.encodedFrameCount=void 0!==i.framesSent?i.framesSent-p.framesSent:i.framesEncoded-p.framesEncoded,n.sentKBitrate=(i.bytesSent-p.bytesSent||0)/n.statsInterval*8,l.bitrate=Math.round(1e3*n.sentKBitrate),l.bandwidth=Math.round(l.bitrate/1024),n.encoderOutputFrameRate=1e3*(i.framesEncoded-p.framesEncoded)/n.statsInterval,l.frame_rate_encoded=Math.round(n.encoderOutputFrameRate),n.sentFrameRate=1e3*n.encodedFrameCount/n.statsInterval,l.frame_rate_sent=Math.round(n.sentFrameRate),n.videoLossRate=(i.packetsLost-p.packetsLost)/(i.packetsSent-p.packetsSent),n.videoLossRate=Number.isNaN(n.videoLossRate)?0:n.videoLossRate,l.fraction_lost=n.videoLossRate,n._retransmittedRate=(i.retransmittedPacketsSent-p.retransmittedPacketsSent)/(i.packetsSent-p.packetsSent),this.monitor.rtcMediaStatistics(l,{})),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}(lG),fG=function(e){h(o,e);var t,r,n,i=g(o);function o(e){var t;return u(this,o),l(_(t=i.call(this,e)),"_audioStallCount",void 0),l(_(t),"_setAudioStallCount",void 0),l(_(t),"_audioStallTimer",void 0),l(_(t),"_audioStallInterval",void 0),l(_(t),"_audioStallRatio",void 0),l(_(t),"_videoInWaiting",void 0),l(_(t),"_context",void 0),t._videoInWaiting=!1,t}return d(o,[{key:"setRemoteStreamStatsEvtInterval",value:(n=s(regeneratorRuntime.mark((function e(t,r,n,i){var a,u,c,d,l,h,f,p,v,_,m,g,y,S,b=this;return regeneratorRuntime.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(TF.ABNORMAL_DISCONNECTION,(function(){b.destroy()})),this._audioStallInterval=o.audioStallInterval||100,this._audioStallRatio=o.audioStallRatio||.6,c={audio:{},video:{}},d=this._stream,l=null===(a=d.audioTrack)||void 0===a?void 0:a.getTrack(),h=null===(u=d.videoTrack)||void 0===u?void 0:u.getTrack(),this.getRemoteVideoStats(h,c),e.next=14,this.getRemoteAudioStats(l,c);case 14:this.delStatsEvtInterval(),f=0,p=0,_=[],m=0,g=IP(),this._setAudioStallCount=function(){if(b._audioStallInterval>0&&void 0!==c.audio.concealedSamples){var e=c.audio.concealedSamples,t=c.audio.totalSamplesReceived;g=IP();var r={isStall:!1,counted:!1,diff:0},n=.5*b._audioStallInterval;b._audioStallCount=s(regeneratorRuntime.mark((function i(){var o,a,s,u,c,l,h,v,y,S,E,R,k,T,I;return regeneratorRuntime.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(a=d.hasAudio,s=d.subAudio,a&&s){i.next=7;break}return r.isStall=!1,r.counted=!1,_.push({reason:"hasAudio: ".concat(a,", subAudio: ").concat(s)}),g=IP(),i.abrupt("return",{stall_count:f,stall_duration:p,stall_list:_,stats_count:m});case 7:return u=null===(o=d.audioTrack)||void 0===o?void 0:o.getTrack(),c=Date.now(),i.next=11,b.handler.getStats(u,!0);case 11:if(l=i.sent,h=Date.now(),v=IP(),!((y=v-g)<n)){i.next=18;break}return _.push({diff:y,start:g,end:v,get_stats_cost:h-c,get_stats_start:c,get_stats_end:h,reason:"diff(".concat(y,") < minInterval(").concat(n,")")}),i.abrupt("return",{stall_count:f,stall_duration:p,stall_list:_,stats_count:m});case 18:if(S=l.length,E=l.find((function(e){return"inbound-rtp"===e.type}))){i.next=23;break}return _.push({diff:y,start:g,end:v,get_stats_cost:h-c,get_stats_start:c,get_stats_end:h,reason:S?"no inbound-rtp":"no report"}),i.abrupt("return",{stall_count:f,stall_duration:p,stall_list:_,stats_count:m});case 23:return R=E.concealedSamples,k=E.totalSamplesReceived,I=k-t,(T=R-e)>=0&&I>=0&&T>=b._audioStallRatio*I?(_.push({concealed:T,received:I,diff:y,start:g,end:v,get_stats_cost:h-c,get_stats_start:c,get_stats_end:h,is_stall:!0}),r.isStall?(r.counted?p+=y:(p=p+r.diff+y,f++),r.counted=!0):y>=200?(p+=y,f++,r.counted=!0):(r.counted=!1,r.diff=y),r.isStall=!0):(_.push({concealed:T,received:I,diff:y,start:g,end:v,get_stats_cost:h-c,get_stats_start:c,get_stats_end:h}),r.isStall=!1,r.counted=!1),e=R,t=k,g=v,m++,i.abrupt("return",{stall_count:f,stall_duration:p,stall_list:_,stats_count:m});case 32:case"end":return i.stop()}}),i)}))),v=function(){var e=s(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!b._audioStallCount&&b._setAudioStallCount&&b._setAudioStallCount(),!b._audioStallCount){e.next=5;break}return e.next=4,b._audioStallCount();case 4:b._audioStallTimer=setTimeout(v,b._audioStallInterval);case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),clearTimeout(b._audioStallTimer),b._audioStallTimer=setTimeout(v,b._audioStallInterval)}},this._setAudioStallCount(),y=function(){var e=s(regeneratorRuntime.mark((function e(){var t,r,n,i,o,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=null===(t=d.audioTrack)||void 0===t?void 0:t.getTrack(),i=null===(r=d.videoTrack)||void 0===r?void 0:r.getTrack(),e.next=4,b.getRemoteAudioStats(n,c);case 4:return o=e.sent,f=0,p=0,_=[],m=0,e.next=11,b.getRemoteVideoStats(i,c);case 11:return a=e.sent,e.abrupt("return",{audioStats:o,videoStats:a,isScreen:d.isScreen,userId:d.userId});case 13:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),S=function(){var e=s(regeneratorRuntime.mark((function e(){var t,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,y();case 2:r=e.sent,null===(t=b.client)||void 0===t||t.emit("onRemoteStreamStats",r),v&&(g=IP(),clearTimeout(b._audioStallTimer),b._audioStallTimer=setTimeout(v,b._audioStallInterval)),b._timer=setTimeout(S,2e3);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),this._timer=setTimeout(S,2e3);case 25:case"end":return e.stop()}}),e,this)}))),function(e,t,r,i){return n.apply(this,arguments)})},{key:"delStatsEvtInterval",value:function(){S(f(o.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=s(regeneratorRuntime.mark((function e(t,r){var n,i,o,a,s,u,c,d,l,h,f,p,v,_,m,g,y,S,b=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n={},i={},o=this._stream,a=o.streamId,s=o.userId,u=o.isScreen,c=o.audioMid,d=o.subMediaType,l=o._attributes,h={media_type:"audio",is_screen:!!u,direction:"down",stream_id:a,stream_user_id:s,vid:c,connection_status:navigator.onLine,mute_state:BP(d)?"mute_state_off":"mute_state_on",remote_user_capture_state:l.localaudio?"capture_state_on":"capture_state_off",remote_user_mute_state:l.localaudio&&l.audiostream?"mute_state_off":"mute_state_on"},t&&this.handler){e.next=6;break}return e.abrupt("return",n);case 6:return e.next=8,this.handler.getStats(t);case 8:if((f=e.sent).length){e.next=11;break}return e.abrupt("return",n);case 11:if(f.forEach((function(e){var t=e.type,r=e.packetsLost,o=e.packetsReceived,s=e.bytesReceived,u=e.jitterBufferDelay,c=e.jitterBufferEmittedCount,d=e.clockRate,l=e.channels,f=e.totalSamplesReceived,p=e.concealedSamples,v=e.silentConcealedSamples,_=e.concealmentEvents,m=e.totalRoundTripTime,g=e.packetsDiscarded,y=e.state,S=e.currentRoundTripTime,E=e.audioLevel,R=e.totalAudioEnergy,k=e.totalSamplesDuration,T=e.mimeType,I=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,X=e.ssrc;e.kind;var K=e.nackCount,W=e.lastPacketReceivedTimestamp,Y=e.concealmentevents,J=e.fecPacketsReceived;if("inbound-rtp"===t)i.packetsLost=r,i.packetsReceived=o,h.packetsReceived=o,h.packetsDiscarded=g,h.nackCount=K,h.lastPacketReceivedTimestamp=W,h.concealmentevents=Y,i.bytesReceived=s,void 0!==u&&(n.jitterBufferDelay=u/c*1e3,h.average_jitter_buffer_delay_ms=n.jitterBufferDelay),void 0!==f&&(i.totalSamplesReceived=f,n.concealedSamples=p,i.concealedSamples=p,i.silentConcealedSamples=v,h.concealedSamples=p,n.concealmentEvents=_,h.totalSamplesReceived=f),void 0!==J&&(h.fec_packets_received=J,i.fecPacketsReceived=J),h.jitter=1e3*D,h.ssrc=X;else if("codec"===t)n.recordSampleRate=d,l&&(n.numChannels=l),h.codecName=T;else if("candidate-pair"===t){var Q,Z,$;h.ice_available_incoming_bitrate=A,h.ice_available_outgoing_bitrate=w,h.ice_bytes_received=s,h.ice_bytes_sent=C,h.ice_nominated=+O,h.ice_pair_id=x,h.ice_pair_rtt=S,h.rtt=1e3*S,h.rtt&&null!==(Q=b._context)&&void 0!==Q&&null!==(Z=Q.streamRTT)&&void 0!==Z&&null!==($=Z[a])&&void 0!==$&&$.audio&&(h.total_rtt_ms=h.rtt+b._context.streamRTT[a].audio),h.ice_pair_state=y,h.ice_pair_writable=N,h.recv_ping_requests=j,h.recv_ping_responses=G,h.sent_ping_requests_before_first_response=H,h.sent_ping_requests_total=H+(z||0),h.sent_ping_responses=q,"succeeded"===y&&(n.rtt=1e3*S,n.total_rtt=1e3*m)}else"track"===t&&void 0!==E?(h.audio_level=E?-10*Math.log10(Math.pow(E,2)):E,h.volume=255*E,h.total_audio_energy=R,h.totalAudioDuration=k):"ssrc"===t?(h.decodingNormal=I,h.recvAudioLevel=B):"local-candidate"===t?(h.local_candidate_type=P,h.local_ip=M||L,h.local_network_type=U,h.local_port=V,h.protocol=F):"remote-candidate"===t&&(h.remote_candidate_type=P,h.remote_ip=M||L,h.remote_port=V)})),(p=r.audio).timestamp){e.next=17;break}return i.timestamp=Date.now(),r.audio=i,e.abrupt("return",this.filterIllegal(n));case 17:if(v={},void 0!==i.concealedSamples&&(h.interval_concealed_samples=i.concealedSamples-p.concealedSamples,h.interval_samples_received=i.totalSamplesReceived-p.totalSamplesReceived,h.interval_silent_concealed_samples=i.silentConcealedSamples-p.silentConcealedSamples),!(this._audioStallInterval>0&&void 0!==p.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:_=e.sent,m=_.stall_count,g=_.stall_duration,y=_.stall_list,S=_.stats_count,v.stall_list=y,v.stats_count=S,h.concealedSamples===h.interval_concealed_samples&&h.totalSamplesReceived===h.interval_samples_received?(h.stall_count=0,h.stall_duration=0):(h.stall_count=m,h.stall_duration=g),n.stallCount=h.stall_count,n.stallDuration=h.stall_duration;case 35:return i.timestamp=Date.now(),n.audioLossRate=(i.packetsLost-p.packetsLost)/(i.packetsReceived-p.packetsReceived+(i.packetsLost-p.packetsLost)),n.audioLossRate=Number.isNaN(n.audioLossRate)?0:n.audioLossRate,h.packetsLost=Math.round(i.packetsLost-p.packetsLost),h.fraction_lost=n.audioLossRate,n.statsInterval=i.timestamp-p.timestamp,h.stats_interval=n.statsInterval,n.receivedKBitrate=(i.bytesReceived-p.bytesReceived||0)/n.statsInterval*8,h.bandwidth=Math.round(1e3*n.receivedKBitrate/1024),void 0!==i.concealedSamples&&(n.receivedSampleRate=1e3*h.interval_samples_received/n.statsInterval),void 0!==i.fecPacketsReceived&&(h.fecBitratebps=(i.fecPacketsReceived-p.fecPacketsReceived||0)/n.statsInterval),r.audio=i,this.monitor.rtcMediaStatistics(h,{},v),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=s(regeneratorRuntime.mark((function e(t,r){var n,i,o,a,s,u,c,d,l,h,f,p=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n={},i={timestamp:Date.now()},o=this._stream,a=o.streamId,s=o.userId,u=o.isScreen,c=o.subMediaType,d=o._attributes,l={media_type:"video",is_screen:!!u,direction:"down",stream_id:a,stream_user_id:s,vid:this._stream.videoMid,connection_status:navigator.onLine,mute_state:jP(c)?"mute_state_off":"mute_state_on",remote_user_capture_state:d.localvideo?"capture_state_on":"capture_state_off",remote_user_mute_state:d.localvideo&&d.videostream?"mute_state_off":"mute_state_on"},t&&this.handler){e.next=6;break}return e.abrupt("return",n);case 6:return n.isScreen=u,e.next=9,this.handler.getStats(t);case 9:if((h=e.sent).length){e.next=12;break}return e.abrupt("return",n);case 12:if(h.forEach((function(e){var t=e.type,r=e.frameHeight,o=e.frameWidth,s=e.packetsLost,u=e.packetsReceived,c=e.bytesReceived,d=e.framesDecoded,h=e.jitterBufferDelay,f=e.jitterBufferEmittedCount,v=e.mimeType,_=e.firCount,m=e.availableIncomingBitrate,g=e.availableOutgoingBitrate,y=e.bytesSent,S=e.nominated,b=e.id,E=e.currentRoundTripTime,R=e.state,k=e.writable,T=e.candidateType,I=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=s,l.packetsLost=s,i.packetsReceived=u,l.packetsReceived=u,i.bytesReceived=c,l.bytes=c,i.framesDecoded=d,void 0!==h&&(i.jitterBufferDelay=h/f*1e3,l.average_jitter_buffer_delay_ms=i.jitterBufferDelay),l.fir_count=_,l.nackCount=O,i.nackCount=O,l.pli_count=x,l.ssrc=V,l.jitter=F,l.framesReceived=B,i.framesReceived=B,l.framesDecoded=d,l.key_frames_decoded=j,l.decoder_name=G,l.last_packet_received_timestamp=H,void 0!==o&&(n.width=o,l.frame_size_width=o,n.height=r,l.frame_size_height=r);else if("track"===t&&void 0!==o)n.width=o,l.frame_size_width=o,n.height=r,l.frame_size_height=r,void 0!==B&&(l.framesReceived=B,i.framesReceived=B);else if("codec"===t)l.codecName=v;else if("candidate-pair"===t){var z,q,X;l.ice_available_incoming_bitrate=m,l.ice_available_outgoing_bitrate=g,l.ice_bytes_received=c,l.ice_bytes_sent=y,l.ice_nominated=+S,l.ice_pair_id=b,l.ice_pair_rtt=E,l.rtt=1e3*E,l.rtt&&null!==(z=p._context)&&void 0!==z&&null!==(q=z.streamRTT)&&void 0!==q&&null!==(X=q[a])&&void 0!==X&&X.video&&(l.total_rtt_ms=l.rtt+p._context.streamRTT[a].video),n.rtt=l.rtt,l.ice_pair_state=R,l.ice_pair_writable=k,l.recv_ping_requests=D,l.recv_ping_responses=P,l.sent_ping_requests_before_first_response=M,l.sent_ping_requests_total=M+(L||0),l.sent_ping_responses=U}else"local-candidate"===t?(l.local_candidate_type=T,l.local_ip=I||A,l.local_network_type=w,l.local_port=C,l.protocol=N):"remote-candidate"===t&&(l.remote_candidate_type=T,l.remote_ip=I||A,l.remote_port=C)})),(f=r.video).timestamp){e.next=17;break}return r.video=i,e.abrupt("return",this.filterIllegal(n));case 17:return n.videoLossRate=(i.packetsLost-f.packetsLost)/(i.packetsReceived-f.packetsReceived+(i.packetsLost-f.packetsLost)),n._retransmittedRate=(i.nackCount-f.nackCount)/(i.packetsReceived-f.packetsReceived+(i.packetsLost-f.packetsLost)),n.videoLossRate=Number.isNaN(n.videoLossRate)?0:n.videoLossRate,l.fraction_lost=n.videoLossRate,n.statsInterval=i.timestamp-f.timestamp,l.stats_interval=n.statsInterval,n.receivedKBitrate=(i.bytesReceived-f.bytesReceived||0)/n.statsInterval*8,l.bitrate=Math.round(1e3*n.receivedKBitrate),l.bandwidth=Math.round(l.bitrate/1024),n.decoderOutputFrameRate=1e3*(i.framesDecoded-f.framesDecoded)/n.statsInterval,n.receivedFrameRate=1e3*(i.framesReceived-f.framesReceived)/n.statsInterval,l.frame_rate_decoded=Math.round(n.decoderOutputFrameRate),l.frame_rate_received=l.frame_rate_decoded,r.video=i,this.processStall(this._stream,l,n,u),this.monitor.rtcMediaStatistics(l,{}),e.abrupt("return",this.filterIllegal(n));case 34:case"end":return e.stop()}}),e,this)}))),function(e,r){return t.apply(this,arguments)})},{key:"processStall",value:function(e,t,r,n){var i=0,o=0,a=0;if(e.recordedVideoFrames){e.recordedVideoFrames.forEach((function(e){e.isStall&&(i+=e.stallCount,o+=e.stallDuration),a=e.playTime})),e.recordedVideoFrames.length||(o=2e3,i=this._videoInWaiting?0:1,this._videoInWaiting=!0);var s=e.recordedVideoFrames.pop();s&&(s.isStall?this._videoInWaiting=!0:this._videoInWaiting=!1),e.recordedVideoFrames=[]}t.stall_count=i,n?(t.stuck_length=o,t.stall_duration=void 0):(t.stall_duration=o,t.stuck_length=void 0),t.play_time=a,r.stallCount=i,r.stallDuration=o}},{key:"destroy",value:function(){S(f(o.prototype),"destroy",this).call(this),this.delStatsEvtInterval(),this._videoInWaiting=!1}}],[{key:"audioStallConfig",set:function(e){o.audioStallInterval=((null==e?void 0:e.audio_stall_interval)||200)/2,o.audioStallRatio=null==e?void 0:e.audio_stall_ratio}}]),o}(lG);l(fG,"audioStallInterval",void 0),l(fG,"audioStallRatio",void 0);var pG,vG,_G,mG=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}(mG||{}),gG=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}(gG||{}),yG=function(e){return e[e.PUB=0]="PUB",e[e.UNPUB=1]="UNPUB",e}(yG||{}),SG=function(e){return e[e.SUB=0]="SUB",e[e.UNSUB=1]="UNSUB",e}(SG||{}),bG=new pM("Stream",0),EG=function(e){return e[e.INIT=0]="INIT",e[e.SUB_ING=1]="SUB_ING",e[e.SUB_ED=2]="SUB_ED",e}(EG||{}),RG=function(){function e(){u(this,e),l(this,"isScreen",!1),l(this,"stream",void 0),l(this,"streamId",void 0),l(this,"audioMid",void 0),l(this,"videoMid",void 0),l(this,"seiList",[]),l(this,"videoTrack",void 0),l(this,"audioTrack",void 0),l(this,"videoTransceiver",void 0),l(this,"audioTransceiver",void 0),l(this,"videoInputConfig",void 0),l(this,"videoEncodeConfig",[yF]),l(this,"subVideoDescriptions",[]),l(this,"enableSimulcast",!1),l(this,"observer",void 0),l(this,"statsReport",void 0),l(this,"prevScaleResolutionDownBy",1),l(this,"pubAudio",!1),l(this,"pubVideo",!1),l(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 hG(this)}return d(e,[{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(tB()){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=dG.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 bG.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 bG.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}(),kG=function(e){h(r,e);var t=g(r);function r(e,n,i,o){var a,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:q.LOW;return u(this,r),l(_(a=t.call(this)),"streamId",void 0),l(_(a),"userId",void 0),l(_(a),"isScreen",void 0),l(_(a),"hasVideo",void 0),l(_(a),"hasAudio",void 0),l(_(a),"_attributes",void 0),l(_(a),"streamState",void 0),l(_(a),"observer",void 0),l(_(a),"statsReport",void 0),l(_(a),"subVideo",void 0),l(_(a),"subAudio",void 0),l(_(a),"subMediaType",void 0),l(_(a),"subLayer",void 0),l(_(a),"audioMid",void 0),l(_(a),"videoMid",void 0),l(_(a),"autosubAudioMid",void 0),l(_(a),"autosubVideoMid",void 0),l(_(a),"_sequenceId",void 0),l(_(a),"stream",void 0),l(_(a),"videoTrack",void 0),l(_(a),"audioTrack",void 0),l(_(a),"videoTransceiver",void 0),l(_(a),"audioTransceiver",void 0),l(_(a),"recordedVideoFrames",void 0),l(_(a),"stillExist",void 0),l(_(a),"_workaround_1_",void 0),l(_(a),"paused",void 0),l(_(a),"originalMediaType",void 0),l(_(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=tG.NONE,a.subLayer={spatialLayer:0,spatialSubLayer:-1},a.streamState=0,a.statsReport=new fG(_(a)),a}return d(r,[{key:"sequenceId",get:function(){return this._sequenceId||-1},set:function(e){"number"==typeof e&&(this._sequenceId=e)}},{key:"hasSubscribed",get:function(){return 2===this.streamState}},{key:"attributes",get:function(){return this._attributes},set:function(e){this.hasVideo=e.localvideo&&e.videostream,this.hasAudio=e.localaudio&&e.audiostream,this._attributes=e}},{key:"initVideoEncodedTransform",value:function(){var e=this;if(this.videoTransceiver&&this.videoTransceiver.receiver){var t=this.videoTransceiver.receiver.createEncodedStreams(),r=t.readable,n=t.writable;r.pipeThrough(new TransformStream({transform:function(t,r){var n=rG.getNalunits(new nG(t.data)).find((function(e){return e.sei}));if(n){var i=dG.decodeSeiBody(n.body);i&&i.type!==iG.internal&&e.safeEmit("onSEIMessage",i.payload)}r.enqueue(t)}})).pipeTo(n)}else bG.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 bG.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;bG.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!==z.DISABLE&&this.subVideo){if(this.attributes.videoDescriptions.length-1>this.subLayer.spatialLayer)return[this.originalMediaType,SG.SUB,this._getSubLayerBySpatialLayer(this.subLayer.spatialLayer+1)];if(e===z.AUDIO_ONLY)return[L.VIDEO,SG.UNSUB]}return null}},{key:"getSubscribeRecoverParams",value:function(){if(this.originalMediaType&&jP(this.originalMediaType)){if(!1===this.subVideo)return[this.originalMediaType,SG.SUB,this.subLayer];if("number"==typeof this.originalStreamIndex&&this.subLayer.spatialLayer>this.originalStreamIndex)return[this.originalMediaType,SG.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]:TP();return new Aj(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]:TP();return new Ij(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}(_M),TG=new pM("queue",4),IG=function(e){return e[e.ADD=0]="ADD",e[e.CLOSE=1]="CLOSE",e}(IG||{}),AG=function(e){return e.publish="publish",e.unpublish="unpublish",e.subscribe="subscribe",e.unsubscribe="unsubscribe",e.pushtrack="pushtrack",e.removetrack="removetrack",e}(AG||{}),wG=(l(pG={},"publish","unpublish"),l(pG,"subscribe","unsubscribe"),l(pG,"pushtrack","removetrack"),pG),CG=(l(vG={},"publish",0),l(vG,"subscribe",0),l(vG,"pushtrack",0),l(vG,"unpublish",1),l(vG,"unsubscribe",1),l(vG,"removetrack",1),vG),OG=function(e){h(r,e);var t=g(r);function r(){var e;return u(this,r),l(_(e=t.call(this)),"_queue",void 0),e._queue=[],e}return d(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!==wG[t.action]||(r=t.streamId,TG.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=CG[this._queue[0].action],t=1;t<this._queue.length;t++)if(CG[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}(dM),xG=new pM("ChromeHandler",3),NG=tB(),DG=function(e){h(E,e);var r,n,o,a,c,p,v,m,y=g(E);function E(e,t){var r;return u(this,E),l(_(r=y.call(this,e,t)),"name","chrome"),l(_(r),"_queueBusy",!1),l(_(r),"_sdpQueue",void 0),l(_(r),"_aSendonlyOfferTpl",void 0),l(_(r),"_vSendonlyOfferTpl",void 0),l(_(r),"_aRecvonlyOfferTpl",void 0),l(_(r),"_vRecvonlyOfferTpl",void 0),l(_(r),"_mid",0),l(_(r),"_offerSession",void 0),l(_(r),"_answerSession",void 0),l(_(r),"_offerMlines",[]),l(_(r),"_answerMlines",[]),l(_(r),"_inactiveMlineIndex",[]),l(_(r),"_msidIndexMap",{}),l(_(r),"_mlinesCache",{}),r._sdpQueue=new OG,r._sdpQueue.on("start",(function(){r._queueBusy||"stable"!==r._peerConnection.signalingState||(xG.print("dequeue start"),r.dequeue())})),r}return d(E,[{key:"connect",value:(m=s(regeneratorRuntime.mark((function e(t){var r,n,o,a,s,u,c,d=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return xG.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,kB(t);case 4:return this._answerIce=e.sent,e.next=7,this._peerConnection.createOffer();case 7:return o=e.sent,a=aB.parse(o.sdp),s=b(a.media,1),u=s[0],this._offerIce.fingerprint=a.fingerprint||u.fingerprint,delete a.media,this._offerSession=i({},a),this._answerSession=i({},a),this._answerSession.fingerprint&&(this._answerSession.fingerprint=this._answerIce.fingerprint),c=this._mid++,this._offerMlines=[i(i(i({},u),this._offerIce),{},{mid:"".concat(c)})],this._answerMlines=[i(i(i({},u),this._answerIce),{},{sctpmap:{sctpmapNumber:5e3,app:"webrtc-datachannel",maxMessageSize:262144},mid:"".concat(c)})],this.setDescription(),e.next=21,new Promise((function(e,t){d._dataChannel.onopen=function(){xG.print("connect","dataChannel open"),ZV("es.dc.open",""),e("")},d._dataChannel.onerror=function(e){HV.rtcSignalingMsgError(e.error.sdpLineNumber,e.error.errorDetail,mV.INVALID_DATA),ZV("es.dc.error",""),t(e)},d._dataChannel.onclose=function(e){ZV("es.dc.close",""),t(e)},d._peerConnection.addEventListener("connectionstatechange",(function(e){"failed"!==d._peerConnection.iceConnectionState&&"closed"!==d._peerConnection.iceConnectionState&&"failed"!==d._peerConnection.connectionState||t(e)}))}));case 21:return xG.print("connect","dataChannel establish success"),e.abrupt("return",this._dataChannel);case 23:case"end":return e.stop()}}),e,this)}))),function(e){return m.apply(this,arguments)})},{key:"disconnect",value:function(){this._peerConnection.close(),this._dataChannel.close(),this._peerConnection.ontrack=null}},{key:"destroy",value:function(){S(f(E.prototype),"destroy",this).call(this),this._mlinesCache={}}},{key:"publish",value:(v=s(regeneratorRuntime.mark((function e(t){var r,n,o,a,s,u,c,d,l,h,p,v,_,m,g,y,R,k,T,I,A,w,C,O,x,N,D;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=t.stream,u=t.enableSimulcast,c=S(f(E.prototype),"internalPublish",this).call(this,t),d=c.videoDescriptions,l=c.subVideoDescriptions,h=c.transceiverInit,p="".concat(this._mid++),v="".concat(this._mid++),_=i(i(i({},this._aSendonlyOfferTpl),this._offerIce),{},{mid:p,msid:"".concat(s.id," ").concat(s.id,"-audio"),ssrcs:SB(s,"audio")}),m=i(i(i({},this._vSendonlyOfferTpl),this._offerIce),{},{mid:v,msid:"".concat(s.id," ").concat(s.id,"-video")}),u?(xG.print("subVideoDesc","desc: %o ",l),delete m.ssrcGroups,delete m.ssrcs,g=[],m.rids=d.map((function(e){var t=e.rid;return g.unshift(t),{id:t,direction:"send"}})),m.simulcast={dir1:"send",list1:g.join(";")}):(y=bB(s,"video"),R=y.ssrcs,k=y.ssrcGroups,m.ssrcs=R,m.ssrcGroups=k),null!==(r=this._context)&&void 0!==r&&null!==(n=r.serverConfig)&&void 0!==n&&n.audioRed&&Array.isArray(_.rtp)&&-1!==(T=_.rtp.findIndex((function(e){return"red"===e.codec})))&&(I=_.rtp.splice(T,1),A=b(I,1),w=A[0],_.rtp.unshift(w)),null!==(o=this._context)&&void 0!==o&&null!==(a=o.serverConfig)&&void 0!==a&&a.videoCodec&&wB(m,null===(C=this._context)||void 0===C||null===(O=C.serverConfig)||void 0===O?void 0:O.videoCodec),(x=null==_?void 0:_.rtp.find((function(e){return"opus"===e.codec})))&&_.fmtp&&(D=_.fmtp.find((function(e){return e.payload===x.payload})))&&null!==(N=this._context)&&void 0!==N&&N.audioProfileManager&&(D.config+=this._context.audioProfileManager.getOpusConfigStr()),this._mlinesCache[t.stream.id]=[_,m],e.abrupt("return",{partialSdp:RB(this._offerSession,_,m),audioMid:p,videoMid:v,type:"incroffer",semantics:"unified-plan",videoDescriptions:d,subVideoDescriptions:l,transceiverInit:h});case 13:case"end":return e.stop()}}),e,this)}))),function(e){return v.apply(this,arguments)})},{key:"subscribe",value:(p=s(regeneratorRuntime.mark((function e(t,r){var n,o,a,s,u,c,d,l,h,f;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(xG.print("subscribe","mids: ",r),n="incroffer",o="unified-plan",this._aRecvonlyOfferTpl&&this._vRecvonlyOfferTpl){e.next=11;break}return e.next=6,UP(!0);case 6:if(a=e.sent){e.next=9;break}throw new fD(lD.NOT_SUPPORTED,"Get offer Error");case 9:return e.next=11,this.createAVMlineOfferTpl(a);case 11:if(!this._mlinesCache[t.streamId]){e.next=16;break}return s=b(this._mlinesCache[t.streamId],2),u=s[0],c=s[1],u.mid=t.audioMid,c.mid=t.videoMid,e.abrupt("return",{partialSdp:RB(this._offerSession,u,c),audioMid:u.mid,videoMid:c.mid,type:n,semantics:o});case 16:return d="".concat(this._mid++),l="".concat(this._mid++),h=i(i(i({},this._aRecvonlyOfferTpl),this._offerIce),{},{mid:d}),f=i(i(i({},this._vRecvonlyOfferTpl),this._offerIce),{},{mid:l}),this._mlinesCache[t.streamId]=[h,f],e.abrupt("return",{partialSdp:RB(this._offerSession,h,f),audioMid:d,videoMid:l,type:n,semantics:o,transceiverInit:{aTrack:"audio",vTrack:"video",audioTransceiverInit:{direction:"recvonly"},videoTransceiverInit:{direction:"recvonly"}}});case 22:case"end":return e.stop()}}),e,this)}))),function(e,t){return p.apply(this,arguments)})},{key:"handleAck",value:(c=s(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return xG.print("handleAck()","item: %o",t),e.abrupt("return",this._sdpQueue.enqueue(t));case 2:case"end":return e.stop()}}),e,this)}))),function(e){return c.apply(this,arguments)})},{key:"dequeue",value:(a=s(regeneratorRuntime.mark((function e(){var r,n,o,a,s,u,c,d,l,h,f,p=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._queueBusy=!0,r=this._sdpQueue.dequeue(),xG.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,o=r.sdpStrategy,a=[],s=[],o!==IG.ADD){e.next=14;break}return e.delegateYield(regeneratorRuntime.mark((function e(){var r,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:delete(r=i({},p._answerIce)).candidates,u=!1,c=!1,e.prev=4,o=regeneratorRuntime.mark((function e(){var t,n,o,u,c,d,l,f,v,_,m,g,y,S,E,R,k,T,I,A,w,C;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=h.value,n=t.action,o=t.transceiverInit,u=t.signalingAck,c=t.stream,!((d=c instanceof kG)&&(null==u?void 0:u.sequenceId)<c.sequenceId)){e.next=5;break}return e.abrupt("return","break");case 5:if(l={},f={},v=aB.parse(u.sdp),Array.isArray(v.media)&&(_="",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?(l=e,xG.print("audioMsid",e.msid),e.msid&&(_=e.msid.replace("audio","video"))):(f=e,xG.print("videoMsid",_),_&&(f.msid=_,_=""))}))),m=c.streamId,n===AG.publish&&(m=null===(g=c.stream)||void 0===g?void 0:g.id),p._mlinesCache[m]){e.next=13;break}return e.abrupt("return","break");case 13:if(y=b(p._mlinesCache[m],2),S=y[0],E=y[1],!o){e.next=31;break}c.audioTransceiver=p._peerConnection.addTransceiver(o.aTrack,o.audioTransceiverInit),c.videoTransceiver=p._peerConnection.addTransceiver(o.vTrack,o.videoTransceiverInit),(R=p._inactiveMlineIndex.shift())||(R=p._offerMlines.length),p._offerMlines[R]=i(i({},S),{},{mid:l.mid}),p._answerMlines[R]=l,(k=p._inactiveMlineIndex.shift())||(k=p._offerMlines.length),p._offerMlines[k]=i(i({},E),{},{mid:f.mid}),p._answerMlines[k]=f,p._msidIndexMap[c.streamId]=[R,k],NG&&(c.initAudioEncodedTransform(),c.initVideoEncodedTransform()),a.push(c.streamId||""),s.push(d?c.userId:"local"),e.next=49;break;case 31:if(!d){e.next=49;break}if(T=p._msidIndexMap[c.streamId]||[],I=b(T,2),A=I[0],w=I[1],!A||!w){e.next=48;break}if((null===(C=p._offerMlines[A])||void 0===C?void 0:C.mid)===l.mid){e.next=44;break}return p._offerMlines[A]=EB(p._offerMlines[A]),p._offerMlines[w]=EB(p._offerMlines[w]),p._answerMlines[A]=EB(p._answerMlines[A]),p._answerMlines[w]=EB(p._answerMlines[w]),e.next=41,p.setDescription();case 41:p._offerMlines[A]=i(i({},p._aRecvonlyOfferTpl),{},{mid:l.mid}),p._offerMlines[w]=i(i({},p._vRecvonlyOfferTpl),{},{mid:f.mid}),xG.print("enqueue","hack: %o",c.streamId);case 44:p._answerMlines[A]=l,p._answerMlines[w]=f,e.next=49;break;case 48:xG.print("dequeue","pushtrack before subscribe: %o",c.userId);case 49:d&&(c.sequenceId=null==u?void 0:u.sequenceId);case 50:case"end":return e.stop()}}),e)})),l=t(n);case 7:return e.next=9,l.next();case 9:if(!(u=!(h=e.sent).done)){e.next=17;break}return e.delegateYield(o(),"t0",11);case 11:if("break"!==e.t0){e.next=14;break}return e.abrupt("break",17);case 14:u=!1,e.next=7;break;case 17:e.next=23;break;case 19:e.prev=19,e.t1=e.catch(4),c=!0,d=e.t1;case 23:if(e.prev=23,e.prev=24,!u||null==l.return){e.next=28;break}return e.next=28,l.return();case 28:if(e.prev=28,!c){e.next=31;break}throw d;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",12);case 12:e.next=19;break;case 14:f={},n.forEach((function(e){var t,r,n=e.audioMid,i=e.videoMid,o=e.stream;f[n]=n,f[i]=i,delete p._msidIndexMap[null===(t=e.stream)||void 0===t?void 0:t.streamId],o instanceof RG?delete p._mlinesCache[null==o||null===(r=o.stream)||void 0===r?void 0:r.id]:delete p._mlinesCache[null==o?void 0:o.streamId]})),this._offerMlines=this._offerMlines.map((function(e,t){return f[e.mid]&&(e=EB(e),p._inactiveMlineIndex.push(t)),e})),this._inactiveMlineIndex.sort((function(e,t){return e-t})),this._answerMlines=this._answerMlines.map((function(e){return f[e.mid]&&(e=EB(e)),e}));case 19:return e.next=21,this.setDescription(a.length?{streamId:a.join(","),streamUserId:s.join(",")}:void 0);case 21:xG.print("dequeue","loop"),e.next=27;break;case 24:e.prev=24,e.t1=e.catch(6),xG.print("dequeue","unknown error: %o",e.t1);case 27:return e.prev=27,this.dequeue(),e.finish(27);case 30:case"end":return e.stop()}}),e,this,[[6,24,27,30]])}))),function(){return a.apply(this,arguments)})},{key:"setDescription",value:(o=s(regeneratorRuntime.mark((function e(t){var r,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return xG.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=IP(),t&&HV.rtcBeginCreateOffer("local"===t.streamUserId?yV.UP:yV.DOWN,t.streamId,t.streamUserId),e.next=10,this._peerConnection.createOffer();case 10:return t&&HV.rtcCreateOffer(0,"local"===t.streamUserId?SV.UP:SV.DOWN,t.streamId,t.streamUserId,IP()-n),e.next=13,this.setLocalDescription(aB.write(this._offerSession),t);case 13:return e.next=15,this.setRemoteDescription(aB.write(this._answerSession),t);case 15:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"getDefaultSdp",value:(n=s(regeneratorRuntime.mark((function e(){var t,r,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,UP(!0);case 2:if(t=e.sent){e.next=5;break}throw new fD(lD.NOT_SUPPORTED,"Get offer Error");case 5:return this.createAVMlineOfferTpl(t),r=aB.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:aB.write(r),semantics:"unified-plan",type:"offer"});case 11:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"rollback",value:(r=s(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:delete this._mlinesCache[t];case 1:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"createAVMlineOfferTpl",value:function(e){var t=this;aB.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)}))}}]),E}(oB),PG=new pM("FirefoxHandler",3),MG=function(e){h(y,e);var t,r,n,o,a,c,p,v,m=g(y);function y(){var e;u(this,y);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return l(_(e=m.call.apply(m,[this].concat(r))),"name","firefox"),e}return d(y,[{key:"connect",value:(v=s(regeneratorRuntime.mark((function e(t){var r,n,o,a,s,u,c,d=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return PG.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,kB(t);case 4:return this._answerIce=e.sent,this._peerConnection.addTransceiver("audio",{direction:"recvonly"}),this._peerConnection.addTransceiver("video",{direction:"recvonly"}),e.next=9,this._peerConnection.createOffer();case 9:return o=e.sent,a=aB.parse(o.sdp),s=b(a.media,1),u=s[0],this._offerIce.fingerprint=a.fingerprint||u.fingerprint,a.media=a.media.map((function(e){return i(i({},e),d._offerIce)})),(c=i({},a)).fingerprint=this._answerIce.fingerprint,c.media=c.media.map((function(e){return delete(e=i(i({},e),d._answerIce)).bundleOnly,e.port=9,"application"===e.type?e.sctpmap={sctpmapNumber:5e3,app:"webrtc-datachannel",maxMessageSize:262144}:e.direction="sendonly",e})),e.next=19,this.setLocalDescription(aB.write(a));case 19:return e.next=21,this.setRemoteDescription(aB.write(c));case 21:return e.next=23,new Promise((function(e,t){d._dataChannel.onopen=function(){PG.print("connect","dataChannel open"),ZV("es.dc.open",""),e("")},d._dataChannel.onerror=function(e){HV.rtcSignalingMsgError(e.error.sdpLineNumber,e.error.errorDetail,mV.INVALID_DATA),ZV("es.dc.error",""),t(e)},d._dataChannel.onclose=function(e){ZV("es.dc.close",""),t(e)},d._peerConnection.addEventListener("connectionstatechange",(function(e){"failed"!==d._peerConnection.iceConnectionState&&"closed"!==d._peerConnection.iceConnectionState&&"failed"!==d._peerConnection.connectionState||t(e)}))}));case 23:return PG.print("connect","dataChannel establish success"),e.abrupt("return",this._dataChannel);case 25:case"end":return e.stop()}}),e,this)}))),function(e){return v.apply(this,arguments)})},{key:"publish",value:(p=s(regeneratorRuntime.mark((function e(t){var r,n,o,a,s,u,c,d,l,h,p,v,_,m=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=S(f(y.prototype),"internalPublish",this).call(this,t),a=o.videoDescriptions,s=o.subVideoDescriptions,u=o.transceiverInit,t.audioTransceiver=this._peerConnection.addTransceiver(u.aTrack,u.audioTransceiverInit),t.videoTransceiver=this._peerConnection.addTransceiver(u.vTrack,u.videoTransceiverInit),c=IP(),HV.rtcBeginCreateOffer(yV.UP,"",""),e.next=7,this._peerConnection.createOffer();case 7:return d=e.sent,HV.rtcCreateOffer(0,SV.UP,"","",IP()-c),(l=aB.parse(d.sdp)).media=null===(r=l.media)||void 0===r?void 0:r.map((function(e){return i(i({},e),m._offerIce)})),e.next=13,this.setLocalDescription(aB.write(l));case 13:return h=t.audioTransceiver.mid,p=t.videoTransceiver.mid,v=null,_=null,l.media=null===(n=l.media)||void 0===n?void 0:n.map((function(e){if("".concat(e.mid)===h){var t,r=null===(t=v=e)||void 0===t?void 0:t.rtp.find((function(e){return"opus"===e.codec}));if(r&&v.fmtp){var n,i=v.fmtp.find((function(e){return e.payload===r.payload}));i&&null!==(n=m._context)&&void 0!==n&&n.audioProfileManager&&(i.config+=m._context.audioProfileManager.getOpusConfigStr())}}else if("".concat(e.mid)===p){var o,a,s,u;null!==(o=m._context)&&void 0!==o&&null!==(a=o.serverConfig)&&void 0!==a&&a.videoCodec&&wB(e,null===(s=m._context)||void 0===s||null===(u=s.serverConfig)||void 0===u?void 0:u.videoCodec),_=e}return e})),e.next=20,this.setLocalDescription(aB.write(l));case 20:return e.abrupt("return",{partialSdp:RB(l,v,_),audioMid:h,videoMid:p,type:"incroffer",semantics:"unified-plan",videoDescriptions:a,subVideoDescriptions:s,transceiverInit:u});case 21:case"end":return e.stop()}}),e,this)}))),function(e){return p.apply(this,arguments)})},{key:"subscribe",value:(c=s(regeneratorRuntime.mark((function e(t){var r,n,o,a,s,u,c,d,l,h,f,p,v,_,m=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(PG.print("subscribe()"),!t.audioMid||!t.videoMid){e.next=11;break}return s=aB.parse(null===(o=this._peerConnection.localDescription)||void 0===o?void 0:o.sdp),u=null,c=null,s.media.forEach((function(e){"".concat(e.mid)===t.audioMid?(u=e,t.autosubAudioMid&&(u.mid=t.autosubAudioMid)):"".concat(e.mid)===t.videoMid&&(c=e,t.autosubVideoMid&&(c.mid=t.autosubVideoMid))})),e.next=8,this._peerConnection.createOffer();case 8:return e.next=10,this.setLocalDescription(null===(a=this._peerConnection.localDescription)||void 0===a?void 0:a.sdp,{streamId:t.streamId||"",streamUserId:t.userId});case 10:return e.abrupt("return",{partialSdp:RB(s,u,c),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"}),d=IP(),HV.rtcBeginCreateOffer(yV.UP,t.streamId,t.userId),e.next=17,this._peerConnection.createOffer();case 17:return l=e.sent,HV.rtcCreateOffer(0,SV.UP,t.streamId,t.userId,IP()-d),(h=aB.parse(l.sdp)).media=null===(r=h.media)||void 0===r?void 0:r.map((function(e){return i(i({},e),m._offerIce)})),e.next=23,this.setLocalDescription(aB.write(h),{streamId:t.streamId||"",streamUserId:t.userId});case 23:return f=t.audioTransceiver.mid,p=t.videoTransceiver.mid,v=null,_=null,null===(n=h.media)||void 0===n||n.forEach((function(e){"".concat(e.mid)===f?v=e:"".concat(e.mid)===p&&(_=e)})),e.abrupt("return",{partialSdp:RB(h,v,_),audioMid:f,videoMid:p,type:"incroffer",semantics:"unified-plan"});case 29:case"end":return e.stop()}}),e,this)}))),function(e){return c.apply(this,arguments)})},{key:"handleAck",value:(a=s(regeneratorRuntime.mark((function e(t){var r,n,o,a,s,u,c,d,l,h=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=t.signalingAck,a=t.stream,(s=t.action)!==AG.unpublish&&s!==AG.unsubscribe&&s!==AG.removetrack){e.next=5;break}return e.next=4,this.close(a);case 4:return e.abrupt("return",a.streamId||"");case 5:return u={},(c=aB.parse(null===(r=this._peerConnection.remoteDescription)||void 0===r?void 0:r.sdp)).media.forEach((function(e){void 0!==e.mid&&(u[e.mid]=e)})),aB.parse(null==o?void 0:o.sdp).media.forEach((function(e){"audio"===(e=i(i({},e),h._answerIce)).type&&(a.audioMid?(e.mid=a.audioMid,u[a.audioMid]=e):u[e.mid]=e),"video"===e.type&&(a.videoMid?(e.mid=a.videoMid,u[a.videoMid]=e):u[e.mid]=e)})),d=aB.parse(null===(n=this._peerConnection.localDescription)||void 0===n?void 0:n.sdp),l=d.media.map((function(e){var t=u[e.mid];return"inactive"===e.direction?e:t})),c.groups=d.groups,c.media=l,this.setRemoteDescription(aB.write(c)),e.abrupt("return","");case 16:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"getDefaultSdp",value:(o=s(regeneratorRuntime.mark((function e(){var t,r,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=aB.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:aB.write(r),semantics:"unified-plan",type:"offer"});case 5:case"end":return e.stop()}}),e,this)}))),function(){return o.apply(this,arguments)})},{key:"rollback",value:(n=s(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.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=s(regeneratorRuntime.mark((function e(t){var r,n,o,a,s,u,c=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(PG.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 o=e.sent,(a=aB.parse(null==o?void 0:o.sdp)).media=a.media.map((function(e){return"".concat(e.mid)!==t.audioMid&&"".concat(e.mid)!==t.videoMid||(e=EB(e)),"inactive"!==e.direction&&n.push(e.mid),i(i({},e),c._offerIce)})),s=aB.parse(null===(r=this._peerConnection.remoteDescription)||void 0===r?void 0:r.sdp),u={},s.media.forEach((function(e){u[e.mid]=e})),s.media=a.media.map((function(e){return"inactive"===e.direction?e:u[e.mid]})),a.groups&&s.groups&&(a.groups[0].mids=n.join(" "),s.groups[0].mids=n.join(" ")),e.next=17,this.setLocalDescription(aB.write(a));case 17:return e.next=19,this.setRemoteDescription(aB.write(s));case 19:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"setCurrentDescription",value:(t=s(regeneratorRuntime.mark((function e(){return regeneratorRuntime.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)})}]),y}(oB),LG=function(e,t){return NP?new MG(e,t):new DG(e,t)},UG=new pM("Locker",2),VG=1,FG=function(){function e(t){u(this,e),l(this,"lockingPromise",Promise.resolve()),l(this,"locks",0),l(this,"name",""),l(this,"lockId",void 0),this.lockId=VG++,t&&(this.name=t),UG.print("[lock-".concat(this.name,"-").concat(this.lockId,"] is created."))}return d(e,[{key:"isLocked",get:function(){return this.locks>0}},{key:"lock",value:function(){var e,t=this;this.locks+=1,UG.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,UG.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}(),BG=(l(_G={},W.communication,[0]),l(_G,W.chat,[0]),l(_G,W.chatRoom,[1,"IES_chatroom"]),l(_G,W.coHost,[1,"IES_PK"]),l(_G,W.meeting,[16]),l(_G,W.classRoom,[0]),_G),jG=Object.defineProperty,GG=Object.getOwnPropertyDescriptor,HG=function(e,t,r,n){for(var i,o=n>1?void 0:n?GG(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&&jG(t,r,o),o},zG=new pM("MediaServerClient",2),qG=6e4,XG=function(e){return e.DISCONNECTED="disconnected",e.DISCONNECTING="disconnecting",e.CONNECTED="connected",e.CONNECTING="connecting",e}(XG||{}),KG=function(e,t){zG.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)},WG=function(e){h(C,e);var t,r,n,o,a,c,f,p,v,m,y,S,E,R,k,T,I,A,w=g(C);function C(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:HV;return u(this,C),l(_(t=w.call(this)),"_token",void 0),l(_(t),"_appId",void 0),l(_(t),"_roomId",void 0),l(_(t),"_roomAttributes",void 0),l(_(t),"_clientId",void 0),l(_(t),"_businessId",void 0),l(_(t),"_userInfo",void 0),l(_(t),"_useCloudProxy",void 0),l(_(t),"_expectedIDC",void 0),l(_(t),"_authorization",void 0),l(_(t),"_sessionId",void 0),l(_(t),"_iceConfigRequestManager",void 0),l(_(t),"_ontrackCallbackMap",new Map),l(_(t),"_subResolves",{}),l(_(t),"supportConcurrent",!1),l(_(t),"_handler",void 0),l(_(t),"_pubSubLock",void 0),l(_(t),"_joinLeaveLock",void 0),l(_(t),"_state",void 0),l(_(t),"_dataChannelSignal",void 0),l(_(t),"_subConfig",{}),l(_(t),"monitor",void 0),l(_(t),"_roomProfile",W.communication),l(_(t),"_context",void 0),l(_(t),"_subStreamQueue",{}),t.monitor=r,t._pubSubLock=new FG("pubSubLock"),t._joinLeaveLock=new FG("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 d(C,[{key:"_addHandlerEvents",value:function(){var e,t=this;null===(e=this._handler)||void 0===e||e.once("disconnect",(function(){zG.print("emit ABNORMAL_DISCONNECTION ice"),t.safeEmit(TF.ABNORMAL_DISCONNECTION)}))}},{key:"_addSignalEventHandler",value:function(){var e,t=this;[RF.ON_ADD_STREAM,RF.ON_REMOVE_STREAM,RF.USER_CONNECTION,RF.USER_DISCONNECTION,RF.ON_UPDATE_STREAM_ATTRIBUTES,RF.ON_UPDATE_ROOM_ATTRIBUTES,RF.ON_PUSH_TRACK,RF.ON_REMOVE_TRACK,RF.NODE_CHANGE,RF.ON_CUSTOM_MESSAGE,RF.USER_MESSAGE_RECEIVED,RF.USER_BINARY_MESSAGE_RECEIVED,RF.POST_PROCESSING_MESSAGE,RF.ON_USER_TOKEN_WILL_EXPIRE,RF.STREAM_CONTROL_MESSAGE,RF.ON_SCENE_CONFIG,RF.ON_UPDATE_USER_ATTRIBUTES,kF.RSCP,kF.RTT].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(){zG.print("emit ABNORMAL_DISCONNECTION datachannel"),t.safeEmit(TF.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(TF.ON_CONNECTION_STATE_CHANGE,{prev:this._state,next:e}),this._state=e)}},{key:"connect",value:(A=s(regeneratorRuntime.mark((function e(t){var r,n,i,o,a,s,u,c,d=this,l=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=l.length>1&&void 0!==l[1]?l[1]:"",n=l.length>2&&void 0!==l[2]?l[2]:"",i=l.length>3&&void 0!==l[3]?l[3]:{},this.connectionState="connecting",this._appId=t,this._handler&&(this._removeSignalEventHandler(),this._handler.destroy()),!i.node){e.next=11;break}o=[i.node],ZV("es.join.nodeChange",i),e.next=20;break;case 11:return Promise.resolve().then((function(){return d.emit("onGetIceConfigHook")})),this._iceConfigRequestManager=new FF,e.next=15,null===(a=this._iceConfigRequestManager)||void 0===a?void 0:a.getAccessNode(t,r,n,sF.getDeviceId(),null==i?void 0:i.reason,null==i?void 0:i.feedbackNode,this._useCloudProxy,this._expectedIDC);case 15:if(o=e.sent){e.next=19;break}throw ZV("es.join.getNodeFailed",""),new fD(lD.ICE_SERVER_WRONG,"get ICE config failed");case 19:ZV("es.join.getNodeSuccess",o);case 20:return this._addHandlerEvents(),Promise.resolve().then((function(){return d.emit("onEstablishConnectionHook")})),e.prev=22,u=!1,c=o.map((function(e){var t=LG(d.monitor,d._context);return t.connect(e).then((function(r){u?t.destroy():(u=!0,s=r,d.safeEmit("prevIceNode",e),d._handler=t,d.supportConcurrent="chrome"===t.name,d._addHandlerEvents())})).catch((function(){t.destroy()}))})),e.next=27,VP(c);case 27:zG.print("join","establish peerConnection success"),e.next=34;break;case 30:throw e.prev=30,e.t0=e.catch(22),this.connectionState="disconnected",new fD(lD.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed",e.t0);case 34:if(!s){e.next=40;break}this._dataChannelSignal=new LF(s),this._addSignalEventHandler(),this._dataChannelSignal.sendPingSignaling(),e.next=42;break;case 40:throw this.connectionState="disconnected",new fD(lD.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed");case 42:case"end":return e.stop()}}),e,this,[[22,30]])}))),function(e){return A.apply(this,arguments)})},{key:"join",value:(I=s(regeneratorRuntime.mark((function e(t){var r,n,i,o,a,s,u,c,d,l,h,f,p,v,_,m,g,y,S,b,E,R,k=this,T=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=T.length>1&&void 0!==T[1]?T[1]:{},i=T.length>2&&void 0!==T[2]&&T[2],o=T.length>3?T[3]:void 0,zG.print("join()","info: %o, params: %o, reconnect: %o, controlMessage: %o",t,n,i,o),this._appId=t.appId,this._token=t.token,this._roomId=t.roomId,this._clientId=t.userInfo.userId,this._businessId=t.userInfo.businessId,this._userInfo=t.userInfo,this._useCloudProxy=t.useCloudProxy,this._expectedIDC=t.expectedIDC,this._roomProfile=t.roomProfile,this._sessionId=n.sessionId,e.next=16,this.connect(this._appId,this._roomId,this._clientId,n);case 16:return e.t0=CP.token2auth(this._appId,this._roomId,this._clientId,this._token),e.t1=this._sessionId||"",e.t2=Date.now(),e.t3=o,e.t4={extra_info:this._userInfo.extraInfo,role:this._userInfo.role},e.next=23,null===(r=this._handler)||void 0===r?void 0:r.getDefaultSdp();case 23:return e.t5=e.sent,e.next=26,$F();case 26:return e.t6=e.sent,e.t7=window.navigator.userAgent,e.t8=hF.VERSION,e.t9=sF.getDeviceId(),e.t10=this._appId,e.t11=this._roomId,e.t12=this._clientId,e.t13=this._businessId,e.t14=this._useCloudProxy,e.t15=BG[this._roomProfile]?BG[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,enable_cloud_proxy:e.t14,channelProfile:e.t15},e.t17={supportTokenExpireCallBack:!0,enableSceneConfigV2:!0,enableUnBundleMode:!0},a={Authorization:e.t0,sessionId:e.t1,timestamp:e.t2,controlMessage:e.t3,userAttributes:e.t4,sdpInfo:e.t5,params:e.t16,options:e.t17},Promise.resolve().then((function(){return k.emit("onSendingJoinMessageHook")})),e.prev=40,p=i?"reconnected":"joinRoom",e.next=44,this._dataChannelSignal.sendSignaling(p,a);case 44:return v=e.sent,zG.print("join","send join message success"),this._authorization=a.Authorization,this.connectionState="connected",this._context&&(this._context.serverConfig={videoCodec:null===(_=v.config)||void 0===_||null===(m=_.engine_WEB)||void 0===m?void 0:m.video_codec,audioRed:!(null===(g=v.config)||void 0===g||null===(y=g.engine_WEB)||void 0===y||!y.pub_audio_red),muteReplaceUnsub:!(null===(S=v.config)||void 0===S||!S.mute_replace_unsub),simulcastOnDemand:!(!1===(null===(b=v.config)||void 0===b||null===(E=b.engine_VPM)||void 0===E||null===(R=E.ondemand)||void 0===R?void 0:R.enable))}),fG.audioStallConfig=null===(s=v.config)||void 0===s?void 0:s.engine_WEB,null===(u=this._context)||void 0===u||null===(c=u.audioProfileManager)||void 0===c||c.updateEngineBAC(null===(d=v.config)||void 0===d?void 0:d.engine_BAC),null===(l=this._context)||void 0===l||null===(h=l.audioProfileManager)||void 0===h||h.updateEngineANM(null===(f=v.config)||void 0===f?void 0:f.engine_ANM),e.abrupt("return",v);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 fD(lD.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 fD(lD.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 I.apply(this,arguments)})},{key:"publish",value:(T=s(regeneratorRuntime.mark((function e(t){var r,n,o,a,s,u,c,d,l,h,f,p,v,_,m,g,y,S,b,E;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return zG.print("publish()","localStream: %o",t),r=t.videoTrack,n=t.audioTrack,o=IP(),a="",s="",e.prev=6,e.next=9,null===(u=this._handler)||void 0===u?void 0:u.publish(t);case 9:if(y=e.sent){e.next=12;break}throw new fD(lD.ADD_TRANSCEIVER_FAILED,"add transceiver failed");case 12:return a=y.audioMid,s=y.videoMid,t.pubAttributes={localaudio:!!n,localvideo:!!r,videostream:t.pubVideo,audiostream:t.pubAudio,extvideo:!!(r instanceof Oj),extaudio:!!(n instanceof xj)},S={attributes:i({videoDescriptions:y.videoDescriptions},t.pubAttributes),audio:!0,video:!0,screen:t.isScreen,audioMid:a,videoMid:s,sdpInfo:{msid:t.stream.id,type:y.type,sdp:y.partialSdp,semantics:y.semantics}},t.enableSimulcast&&null!==(c=this._context)&&void 0!==c&&null!==(d=c.serverConfig)&&void 0!==d&&d.simulcastOnDemand&&(S.attributes.subVideoDescriptions=y.subVideoDescriptions),e.next=19,null===(l=this._dataChannelSignal)||void 0===l?void 0:l.sendSignaling("publish",S);case 19:if(200===(null==(b=e.sent)?void 0:b.code)){e.next=22;break}throw new fD(lD.PUBLISH_FAILED,(null==b?void 0:b.message)||"publish failed");case 22:return HV.rtcRecvAnswer(0,RV.INCRANSWER,(null==b||null===(h=b.relayMessage)||void 0===h?void 0:h.sequenceId)||0,null==b||null===(f=b.relayMessage)||void 0===f?void 0:f.sdp,kV.UP,"",""),e.next=25,null===(p=this._handler)||void 0===p?void 0:p.handleAck({action:AG.publish,streamId:b.streamId,audioMid:a,videoMid:s,transceiverInit:y.transceiverInit,signalingAck:{audioMid:null==b||null===(v=b.relayMessage)||void 0===v?void 0:v.audioMid,videoMid:null==b||null===(_=b.relayMessage)||void 0===_?void 0:_.videoMid,sdp:null==b||null===(m=b.relayMessage)||void 0===m?void 0:m.sdp,sequenceId:null==b||null===(g=b.relayMessage)||void 0===g?void 0:g.sequenceId},stream:t});case 25:return t.streamId=b.streamId,t.videoMid=s,t.audioMid=a,t.subVideoDescriptions=y.subVideoDescriptions,this.monitor.rtcPublishStat(TV.SUCCESS,IV.W_0,o,AV.UNKNOWN),t.statsReport.setLocalStreamStatsEvtInterval(this,this._handler,this.monitor),e.abrupt("return");case 34:return e.prev=34,e.t0=e.catch(6),e.t0 instanceof Error&&this.monitor.rtcPublishStat(TV.FAIL,IV.W_0,o,e.t0.message),e.next=39,null===(E=this._handler)||void 0===E?void 0:E.rollback(t.stream.id,t);case 39:throw e.t0;case 40:case"end":return e.stop()}}),e,this,[[6,34]])}))),function(e){return T.apply(this,arguments)})},{key:"updatePubTrack",value:(k=s(regeneratorRuntime.mark((function e(t){var r,n,i,o,a,s,u,c,d,l,h,f,p,v,_,m,g,y,S,E,R,k,T,I,A,w,C,O,x,N,D;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(zG.print("updatePubTrack()","localStream: %o",t),i=t.videoTrack,o=t.audioTrack,a=t.pubAudio,s=t.pubVideo,u=null==o?void 0:o.getTrack("preprocessing"),c=null==i?void 0:i.getTrack("preprocessing"),s&&c?null===(d=t.videoTransceiver)||void 0===d||d.sender.replaceTrack(c):null===(l=t.videoTransceiver)||void 0===l||l.sender.replaceTrack(null),null===(r=this._handler)||void 0===r||r.updateScaleResolutionDownBy(t),a&&u?(f=o.mixType,(p=o.mixedAudioTrack)&&f!==$.PLAYOUT&&!0===u.enabled&&(u=p),null===(h=t.audioTransceiver)||void 0===h||h.sender.replaceTrack(u)):null===(v=t.audioTransceiver)||void 0===v||v.sender.replaceTrack(null),_={localaudio:!!o,localvideo:!!i,videostream:s,audiostream:a,extvideo:!!(i instanceof Oj),extaudio:!!(o instanceof xj)},m={},g=0,y=Object.entries(_);g<y.length;g++)S=b(y[g],2),E=S[0],(R=S[1])!==Reflect.get(t.pubAttributes,E)&&Reflect.set(m,E,R);if(Object.keys(m).length){e.next=12;break}return e.abrupt("return");case 12:return t.observer&&(k=t.observer,T=m.audiostream,I=m.videostream,A=m.localaudio,w=m.localvideo,C=m.extaudio,O=m.extvideo,void 0!==w?void 0!==O?k.setPushVideo(O):k.setEnableVideo(w):void 0!==I&&k.setUnmuteVideo(I),void 0!==A?void 0!==C?k.setPushAudio(C):k.setEnableAudio(A):void 0!==T&&k.setUnmuteAudio(T)),t.pubAttributes=_,x={roomId:this._roomId,streamId:t.streamId,attributes:m},e.next=17,null===(n=this._dataChannelSignal)||void 0===n?void 0:n.sendSignaling("updateStreamAttributes",x);case 17:if(200===(null==(N=e.sent)?void 0:N.code)){e.next=20;break}throw new fD(lD.UPDATE_TRACK_FAILED,(null==N?void 0:N.message)||"update track failed");case 20:if(!NP){e.next=23;break}return e.next=23,null===(D=this._handler)||void 0===D?void 0:D.setCurrentDescription();case 23:case"end":return e.stop()}}),e,this)}))),function(e){return k.apply(this,arguments)})},{key:"updateToken",value:(R=s(regeneratorRuntime.mark((function e(t){var r,n,i,o,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(zG.print("updateToken()","newToken: %o",t),this._token=t,this._appId&&null!==(r=this._userInfo)&&void 0!==r&&r.userId&&this._roomId){e.next=4;break}return e.abrupt("return");case 4:return i={roomId:this._roomId,userId:null===(n=this._userInfo)||void 0===n?void 0:n.userId,appId:this._appId,token:"Bearer ".concat(t)},e.prev=5,e.next=8,null===(o=this._dataChannelSignal)||void 0===o?void 0:o.sendSignaling("updateToken",i);case 8:if(200===(null==(a=e.sent)?void 0:a.code)){e.next=11;break}throw new fD(lD.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 fD(lD.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 R.apply(this,arguments)})},{key:"unpublish",value:(E=s(regeneratorRuntime.mark((function e(t){var r,n,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return zG.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:AG.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 E.apply(this,arguments)})},{key:"subscribe",value:(S=s(regeneratorRuntime.mark((function e(t,r,n){var i=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise(function(){var e=s(regeneratorRuntime.mark((function e(o,a){var s,u,c,d,h,f,p,v,_,m,g,y,S,b,E,R,k,T,I,A,w,C,O,x,N,D,P,M,L,U,V,F,B,j,G,H,z,q;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.streamState!==EG.SUB_ED){e.next=2;break}return e.abrupt("return",i._updateSubTrack(t,r,SG.SUB,n).then(o,a));case 2:if(t.streamState!==EG.SUB_ING){e.next=7;break}return i._subStreamQueue[t.streamId]||(i._subStreamQueue[t.streamId]=[]),zG.print("_subStreamQueue","streamId: %o, enqueue",t.streamId),i._subStreamQueue[t.streamId].push({fn:i.subscribe,args:[t,r,n],resolve:o,reject:a}),e.abrupt("return");case 7:if(zG.print("subscribe()","mediaType: %o",r),KG("subscribe()",t),t.streamState=EG.SUB_ING,s=!1,u=!1,BP(r)&&(u=!0),jP(r)&&(s=!0),s||!i._multiChatMode()){e.next=17;break}return t.streamState=EG.INIT,i.emit("SUB_END",t.streamId),e.abrupt("return",o(null));case 17:if(c=IP(),d=t.audioMid,h=t.videoMid,p=t.paused,v=t.subVideo,e.prev=22,!d||!h){e.next=29;break}return e.next=26,null===(N=i._handler)||void 0===N?void 0:N.subscribe(t,{audioMid:d,videoMid:h});case 26:f=e.sent,e.next=36;break;case 29:return e.next=31,null===(D=i._handler)||void 0===D?void 0:D.subscribe(t);case 31:if(f=e.sent){e.next=34;break}throw new fD(lD.ADD_TRANSCEIVER_FAILED,"add transceiver failed");case 34:d=f.audioMid,h=f.videoMid;case 36:return t.paused=!s,t.subVideo=s,P={spatialLayer:(null==n?void 0:n.spatialLayer)||0,temporalLayer:0,spatialSubLayer:(null==n?void 0:n.spatialSubLayer)||-1},M={audio:!i._multiChatMode(),video:!0,data:!0,screen:t.isScreen,browser:"chrome-stable",videoMid:(null===(_=f)||void 0===_?void 0:_.autosubVideoMid)||h,audioMid:(null===(m=f)||void 0===m?void 0:m.autosubAudioMid)||d,sdpInfo:{sdp:null===(g=f)||void 0===g?void 0:g.partialSdp,semantics:null===(y=f)||void 0===y?void 0:y.semantics,type:null===(S=f)||void 0===S?void 0:S.type},streamUserId:t.userId,streamId:t.streamId,config:{enableMediaType:{audio:!!i._multiChatMode()||u,video:s},qualityLayer:P},extra:{enableSendRTT:!0}},e.next=42,null===(b=i._dataChannelSignal)||void 0===b?void 0:b.sendSignaling("subscribe",M);case 42:if(200===(null==(L=e.sent)?void 0:L.code)){e.next=45;break}throw new fD(lD.SUBSCRIBE_FAILED,(null==L?void 0:L.message)||"subscribe failed");case 45:return U=[],V=!i._multiChatMode(),F=!t.videoTrack,i._subResolves[t.streamId]||(i._subResolves[t.streamId]=[]),F&&U.push(new Promise((function(e,r){i._subResolves[t.streamId].push(e);var n=setTimeout((function(){return r(new fD(lD.TIME_OUT,"wait video timeout for userId: ".concat(t.userId)))}),qG);t.on("ontrack",(function r(i){"video"===i.mediaType&&(zG.print("remoteStream ".concat(t.userId," received video track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),V&&U.push(new Promise((function(e,r){i._subResolves[t.streamId].push(e);var n=setTimeout((function(){return r(new fD(lD.TIME_OUT,"wait audio timeout for userId: ".concat(t.userId)))}),qG);t.on("ontrack",(function r(i){"audio"===i.mediaType&&(zG.print("remoteStream ".concat(t.userId," received audio track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),B=function(e){t.ontrack(e)},null===(E=i._handler)||void 0===E||E.on("ontrack",B),i._ontrackCallbackMap.set(t,B),j=null==L?void 0:L.relayMessage,G=j.audioMid,H=j.videoMid,l(R={},d,G),l(R,h,H),z=R,zG.print("sub midmap",t.userId,z),NP?(t.videoMid=h,t.audioMid=d):(t.videoMid=H,t.audioMid=G),t._workaround_1_=!1,t.subMediaType=r,t.streamState=EG.SUB_ED,t.subLayer=P,HV.rtcRecvAnswer(0,RV.INCRANSWER,(null==L||null===(k=L.relayMessage)||void 0===k?void 0:k.sequenceId)||0,null==L||null===(T=L.relayMessage)||void 0===T?void 0:T.sdp,kV.DOWN,t.streamId,t.userId),e.next=65,null===(I=i._handler)||void 0===I?void 0:I.handleAck({action:AG.subscribe,streamId:t.streamId,audioMid:d,videoMid:h,transceiverInit:null===(A=f)||void 0===A?void 0:A.transceiverInit,signalingAck:{audioMid:null==L||null===(w=L.relayMessage)||void 0===w?void 0:w.audioMid,videoMid:null==L||null===(C=L.relayMessage)||void 0===C?void 0:C.videoMid,sdp:null==L||null===(O=L.relayMessage)||void 0===O?void 0:O.sdp,sequenceId:null==L||null===(x=L.relayMessage)||void 0===x?void 0:x.sequenceId},stream:t});case 65:return e.next=67,Promise.all(U);case 67:i._multiChatMode()||(t.subAudio=u),i.monitor.rtcSubscribeStat(wV.SUCCESS,c,CV.UNKNOWN,t.userId),i._context&&t.statsReport.setRemoteStreamStatsEvtInterval(i,i._handler,i.monitor,i._context),o(null),i.emit("SUB_END",t.streamId),e.next=84;break;case 74:return e.prev=74,e.t0=e.catch(22),e.t0 instanceof Error&&i.monitor.rtcSubscribeStat(wV.FAIL,c,e.t0.message,t.userId),t.paused=p,t.subVideo=v,t.streamState=EG.INIT,e.next=82,null===(q=i._handler)||void 0===q?void 0:q.rollback(t.streamId,t);case 82:a(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 S.apply(this,arguments)})},{key:"_handleSubStreamQueue",value:function(e){var t,r=this;if(null!==(t=this._subStreamQueue[e])&&void 0!==t&&t.length){zG.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 zG.print("_subStreamQueue","streamId: %o, END",e)}},{key:"controlMessage",value:(y=s(regeneratorRuntime.mark((function e(t){var r,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return zG.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 y.apply(this,arguments)})},{key:"updateUserAttributes",value:(m=s(regeneratorRuntime.mark((function e(t){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return zG.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 m.apply(this,arguments)})},{key:"updateSubTrack",value:(v=s(regeneratorRuntime.mark((function e(t,r,n,i){return regeneratorRuntime.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 v.apply(this,arguments)})},{key:"_updateSubTrack",value:(p=s(regeneratorRuntime.mark((function e(t,r,n,i){var o,a,s,u,c,d,l,h,f;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return zG.print("updateSubTrack()","mediaType: %o, subLayer: %o",r,i),KG("updateSubTrack()",t),s=0,s=n===SG.SUB?t.subMediaType|r:t.subMediaType-(t.subMediaType&r),zG.print("updateSubTrack","prev: %o, direction: %o, mediaType: %o, newMediaType: %o",t.subMediaType,n,r,s),t.subMediaType===s&&zG.print("updateSubTrack","mediaType no change"),u=!1,c=!1,BP(s)&&(c=!0),jP(s)&&(u=!0),d=i||t.subLayer,l={roomId:this._roomId,streamList:[t.streamId],config:{enableMediaType:{video:u,audio:!!this._multiChatMode()||c},qualityLayer:d}},e.next=13,null===(o=this._dataChannelSignal)||void 0===o?void 0:o.sendSignaling("updateSubscribe",l);case 13:if(200===(null==(h=e.sent)?void 0:h.code)){e.next=16;break}throw new fD(lD.UPDATE_TRACK_FAILED,(null==h?void 0:h.message)||"update track failed");case 16:return t.paused=!u,this._multiChatMode()||(null===(f=t.observer)||void 0===f||f.setUnmuteAudio(c),t.subAudio=c),null===(a=t.observer)||void 0===a||a.setUnmuteVideo(u),t.subVideo=u,t.subMediaType=s,t.subLayer=d,e.abrupt("return",t);case 23:case"end":return e.stop()}}),e,this)}))),function(e,t,r,n){return p.apply(this,arguments)})},{key:"subscribe4pushTrack",value:(f=s(regeneratorRuntime.mark((function e(t,r){var n,i,o,a,s,u,c,d,h,f,p,v,_,m,g,y,S,b=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(zG.print("subscribe4pushTrack()","streamInfo: %o",r),KG("subscribe4pushTrack()",t),u=null==r?void 0:r.message,c=u.audioMid,d=u.videoMid,h=u.sequenceId,t.subAudio=!0,!(h<t.sequenceId)){e.next=7;break}return zG.print("subscribe4pushTrack","sequenceId return",h,t.sequenceId),e.abrupt("return");case 7:if(f=t.audioMid,p=t.videoMid,null===(n=t.observer)||void 0===n||n.setPushTrack(!0),!f||!p){e.next=16;break}return e.next=13,null===(_=this._handler)||void 0===_?void 0:_.subscribe(t,{audioMid:f,videoMid:p});case 13:v=e.sent,e.next=23;break;case 16:return e.next=18,null===(m=this._handler)||void 0===m?void 0:m.subscribe(t);case 18:if(v=e.sent){e.next=21;break}throw new fD(lD.ADD_TRANSCEIVER_FAILED,"add transceiver failed");case 21:f=v.audioMid,p=v.videoMid;case 23:return l(i={},f,c),l(i,p,d),g=i,zG.print("onpushtrack midmap",t.userId,g),NP?(t.audioMid=f,t.videoMid=p):(t.audioMid=c,t.videoMid=d),t.autosubAudioMid=c,t.autosubVideoMid=d,t.sequenceId=h,this._subResolves[t.streamId]||(this._subResolves[t.streamId]=[]),y=[],t.audioTrack||y.push(new Promise((function(e,r){b._subResolves[t.streamId].push(e);var n=setTimeout((function(){return r(new fD(lD.TIME_OUT,"wait audio timeout for userId: ".concat(t.userId)))}),qG);t.on("ontrack",(function r(i){"audio"===i.mediaType&&(zG.print("remoteStream ".concat(t.userId," received audio track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),S=function(e){t.ontrack(e)},null===(o=this._handler)||void 0===o||o.on("ontrack",S),this._ontrackCallbackMap.set(t,S),e.next=37,null===(a=this._handler)||void 0===a?void 0:a.handleAck({action:AG.pushtrack,streamId:t.streamId,audioMid:f,videoMid:p,stream:t,transceiverInit:null===(s=v)||void 0===s?void 0:s.transceiverInit,signalingAck:null==r?void 0:r.message});case 37:return e.next=39,Promise.all(y);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 f.apply(this,arguments)})},{key:"unsubscribe4removeTrack",value:(c=s(regeneratorRuntime.mark((function e(t,r){var n,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(KG("unsubscribe4removeTrack()",t),zG.print("unsubscribe4removeTrack()","sequenceId: ",r.sequenceId),!(r.sequenceId<t.sequenceId)){e.next=5;break}return zG.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,zG.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:AG.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)})),zG.print("clean unsubscribe4removeTrack"),t.clean(),t.resetHasSubscribed(),t.statsReport.unsubscribe();case 18:case"end":return e.stop()}}),e,this)}))),function(e,t){return c.apply(this,arguments)})},{key:"unsubscribe",value:(a=s(regeneratorRuntime.mark((function e(t,r){var n,i,o,a,s,u,c,d,l=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=l.length>2&&void 0!==l[2]&&l[2],KG("unsubscribe()",t),a=t.subMediaType-(t.subMediaType&r),o||!this._subConfig.muteReplaceUnsub&&a===tG.NONE){e.next=5;break}return e.abrupt("return",this._updateSubTrack(t,r,SG.UNSUB));case 5:if(s={roomId:this._roomId,streamId:t.streamId,userId:t.userId},null===(n=this._dataChannelSignal)||void 0===n||n.sendSignaling("unsubscribe",s),t.streamState=EG.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===(u=t.observer)||void 0===u||u.setSubscribeAudio(!1),e.next=17,null===(c=this._handler)||void 0===c?void 0:c.handleAck({action:AG.unsubscribe,streamId:t.streamId,audioMid:t.audioMid,videoMid:t.videoMid,stream:t});case 17:d=e.sent,this._subResolves[d]&&this._subResolves[d].forEach((function(e){return e(0)})),zG.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 a.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:(o=s(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(KG("handleRemoveStream()",t),t.subVideo=!1,r.message&&r.message!==bF.videoMuted?t._workaround_1_=!1:t._workaround_1_=!0,t.hasSubscribed){e.next=5;break}return e.abrupt("return");case 5:this.unsubscribe(t,L.AUDIO_AND_VIDEO,!0);case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return o.apply(this,arguments)})},{key:"leave",value:(n=s(regeneratorRuntime.mark((function e(){var t,r,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(zG.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 fD(lD.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=s(regeneratorRuntime.mark((function e(t){var r,n,i,o,a,s,u,c,d,l,h,f,p,v,_,m,g,y=this;return regeneratorRuntime.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(a=e.sent){e.next=5;break}throw new fD(lD.ADD_TRANSCEIVER_FAILED,"add transceiver failed");case 5:return s=IP(),u=a.audioMid,c=a.videoMid,d={appId:this._appId,streamId:t.streamId,audio:!0,video:!0,data:!0,audioMid:u,videoMid:c,sdpInfo:{sdp:null==a?void 0:a.partialSdp,semantics:null==a?void 0:a.semantics,type:null==a?void 0:a.type},config:{enableMediaType:{audio:!0,video:!0},qualityLayer:{spatialLayer:0,temporalLayer:0}}},e.next=11,null===(n=this._dataChannelSignal)||void 0===n?void 0:n.sendSignaling("startPullStream",d);case 11:return l=e.sent,h=[],this._subResolves[t.streamId]=[],h.push(new Promise((function(e,r){y._subResolves[t.streamId].push(e);var n=setTimeout((function(){return r(new fD(lD.TIME_OUT,"wait video timeout for streamId: ".concat(t.streamId)))}),qG);t.on("ontrack",(function r(i){"video"===i.mediaType&&(zG.print("remoteStream ".concat(t.userId," received video track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),h.push(new Promise((function(e,r){y._subResolves[t.streamId].push(e);var n=setTimeout((function(){return r(new fD(lD.TIME_OUT,"wait audio timeout for streamId: ".concat(t.streamId)))}),qG);t.on("ontrack",(function r(i){"audio"===i.mediaType&&(zG.print("remoteStream ".concat(t.userId," received audio track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),f=function(e){t.ontrack(e)},null===(i=this._handler)||void 0===i||i.on("ontrack",f),this._ontrackCallbackMap.set(t,f),p=null==l?void 0:l.relayMessage,v=p.audioMid,_=p.videoMid,m=p.sequenceId,g=p.sdp,t.videoMid=_,t.audioMid=v,t.sequenceId=m,t._workaround_1_=!1,t.paused=!1,t.streamState=EG.SUB_ED,t.subAudio=!0,t.subVideo=!0,e.next=30,null===(o=this._handler)||void 0===o?void 0:o.handleAck({action:AG.subscribe,streamId:t.streamId,audioMid:u,videoMid:c,transceiverInit:null==a?void 0:a.transceiverInit,signalingAck:{audioMid:v,videoMid:_,sdp:g,sequenceId:m},stream:t});case 30:return e.next=32,Promise.all(h);case 32:this.monitor.rtcSubscribeStat(wV.SUCCESS,s,CV.UNKNOWN,t.userId),this._context&&t.statsReport.setRemoteStreamStatsEvtInterval(this,this._handler,this.monitor,this._context);case 34:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"unsubscribePublicStream",value:(t=s(regeneratorRuntime.mark((function e(t){var r,n,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return KG("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=EG.INIT,t.subVideo=!1,t.subAudio=!1,e.next=14,null===(r=this._handler)||void 0===r?void 0:r.handleAck({action:AG.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;zG.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}}]),C}(_M);function YG(e,t,r){var n=r.value;return r.value=s(regeneratorRuntime.mark((function e(){var r,i,o,a=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._handler||"connected"!==this._state){e.next=6;break}for(r=a.length,i=new Array(r),o=0;o<r;o++)i[o]=a[o];return e.next=4,n.apply(this,i);case 4:e.next=7;break;case 6:throw new fD(lD.NOT_CONNECTED_YET,"error in ".concat(t,": try again after joined"));case 7:case"end":return e.stop()}}),e,this)}))),r}function JG(e,t,r){var n=r.value;return r.value=s(regeneratorRuntime.mark((function e(){var t,r,i,o,a=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._pubSubLock.lock();case 2:for(t=e.sent,this.supportConcurrent&&t(),e.prev=4,r=a.length,i=new Array(r),o=0;o<r;o++)i[o]=a[o];return e.next=8,n.apply(this,i);case 8:return e.abrupt("return",e.sent);case 9:return e.prev=9,this.supportConcurrent||t(),e.finish(9);case 12:case"end":return e.stop()}}),e,this,[[4,,9,12]])}))),r}HG([function(e,t,r){var n=r.value;return r.value=s(regeneratorRuntime.mark((function e(){var t,r,i,o,a=this,u=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(t=u.length,r=new Array(t),i=0;i<t;i++)r[i]=u[i];return o=!1,e.abrupt("return",new Promise(function(){var e=s(regeneratorRuntime.mark((function e(t,i){var s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a.on("INTERRUPT",(function(){o=!0,i(new fD(lD.OPERATION_CANCEL,"operation not finish when leave"))})),e.prev=1,e.next=4,n.apply(a,r);case 4:s=e.sent,t(s),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(1),o||i(e.t0);case 11:case"end":return e.stop()}}),e,null,[[1,8]])})));return function(t,r){return e.apply(this,arguments)}}()));case 3:case"end":return e.stop()}}),e)}))),r}],WG.prototype,"join",1),HG([JG,YG],WG.prototype,"publish",1),HG([JG,YG],WG.prototype,"updatePubTrack",1),HG([JG,YG],WG.prototype,"unpublish",1),HG([JG,YG],WG.prototype,"subscribe",1),HG([YG],WG.prototype,"controlMessage",1),HG([YG],WG.prototype,"updateUserAttributes",1),HG([YG],WG.prototype,"updateSubTrack",1),HG([JG,YG],WG.prototype,"subscribe4pushTrack",1),HG([JG,YG],WG.prototype,"unsubscribe4removeTrack",1),HG([JG,YG],WG.prototype,"unsubscribe",1),HG([YG],WG.prototype,"handleRemoveStream",1),HG([JG],WG.prototype,"subscribePublicStream",1),HG([JG],WG.prototype,"unsubscribePublicStream",1);var QG=function(){return QG=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},QG.apply(this,arguments)};function ZG(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||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(VZ){i={error:VZ}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a}function $G(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)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}var eH=function(){return{}};function tH(e){return"object"===o(e)&&null!==e}var rH=Object.prototype;function nH(e){return"function"==typeof e}function iH(e){return"string"==typeof e}function oH(e){return t=e,"[object Array]"!==rH.toString.call(t)?null:e.length?function(e){for(var t=[],r=e.length,n=0;n<r;n++){var i=e[n];iH(i)?t.push(i.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")):i&&i.source&&t.push(i.source)}return new RegExp(t.join("|"),"i")}(e):null;var t}function aH(e){try{return iH(e)?e:JSON.stringify(e)}catch(t){return"[FAILED_TO_STRINGIFY]:"+String(t)}}var sH=function(e,t,r){return function(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];if(!e)return eH;var o=e[t],a=r.apply(void 0,$G([o],ZG(n),!1)),s=a;return nH(s)&&(s=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];try{return a.apply(this,e)}catch(r){return nH(o)&&o.apply(this,e)}}),e[t]=s,function(r){r||(s===e[t]?e[t]=o:a=o)}}},uH=function(e,t,r){return function(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];e[t]=r.apply(void 0,$G([e[t]],ZG(n),!1))}},cH=MD.start;Wi({target:"String",proto:!0,forced:LD},{padStart:function(e){return cH(this,e,arguments.length>1?arguments[1]:void 0)}});var dH=0,lH=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];console.log.apply(console,$G(["[SDK]",Date.now(),(""+dH++).padStart(8," ")],ZG(e),!1))};function hH(){if("object"===("undefined"==typeof window?"undefined":o(window))&&tH(window))return window}function fH(){if("object"===("undefined"==typeof document?"undefined":o(document))&&tH(document))return document}var pH=function(e){if(e)return e.__SLARDAR_REGISTRY__||(e.__SLARDAR_REGISTRY__={Slardar:{plugins:[],errors:[]}}),e.__SLARDAR_REGISTRY__.Slardar},vH=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=pH(hH());r&&(r.errors||(r.errors=[]),r.errors.push(e))},_H=function(e,t,r,n){void 0===t&&(t={}),void 0===n&&(n=[]);try{var i=e.apply(void 0,$G([],ZG(n),!1));return i&&i(t,r)||[]}catch(o){return vH(o),[]}};function mH(e){var t=fH();if(!t||!e)return{url:e,protocol:"",domain:"",query:"",path:"",hash:""};var r=t.createElement("a");r.href=e;var n=r.pathname||"/";return"/"!==n[0]&&(n="/"+n),{url:r.href,protocol:r.protocol.slice(0,-1),domain:r.hostname,query:r.search.substring(1),path:n,hash:r.hash}}var gH=function(e,t){return tH(e)?QG(QG({},t),e):!!e&&t};function yH(e,t,r){var n,i=null===(n=e.config())||void 0===n?void 0:n.plugins[t];return gH(i,r)}var SH=["name","message","stack","filename","lineno","colno"],bH=function(e){var t,r,n,i;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)?(function(e){if(tH(e)){if("function"==typeof Object.getPrototypeOf){var t=Object.getPrototypeOf(e);return t===rH||null===t}return"[object Object]"===rH.toString.call(e)}return!1}(e)||(i=e,"undefined"!=typeof Event&&function(e,t){try{return e instanceof t}catch(r){return!1}}(i,Event))||iH(e))&&(t={message:aH(e)}):(n=SH,t=(r=e)&&tH(r)?n.reduce((function(e,t){return e[t]=r[t],e}),{}):r),t},EH=function(e){return bH(e.error)},RH=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=bH(r);return QG(QG({},n),{name:null!==(t=n&&n.name)&&void 0!==t?t:"UnhandledRejection"})}}catch(i){}},kH=function(e){return t=e,"[object ErrorEvent]"===Object.prototype.toString.call(t)?EH(e):function(e){return"[object PromiseRejectionEvent]"===Object.prototype.toString.call(e)}(e)?RH(e):bH(e);var t},TH=["EventTarget","Window","Node","ApplicationCache","ChannelMergerNode","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","MessagePort","Notification","SVGElementInstance","Screen","TextTrack","TextTrackCue","TextTrackList","WebSocket","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],IH=["setTimeout","setInterval","requestAnimationFrame","requestIdleCallback"],AH=["onload","onerror","onprogress","onreadystatechange"],wH="addEventListener",CH=function(e,t){return e&&t&&e===t},OH=function(){var e;return function(t){try{if(function(e,t){return!(!e||!t||!CH(e.message,t.message)&&!CH(e.stack,t.stack))}(t,e))return void(e=t)}catch(r){vH(r)}return e=t,t}},xH=function(e){if(void 0===e&&(e=hH()),e)return function(t,r){var n=t.ignoreErrors,i=t.onerror,o=t.onunhandledrejection,a=t.dedupe,s=t.captureGlobalAsync,u=oH(n),c=[],d=OH(),l=function(e,t,n){var i=a?d(e):e;if(r&&i){if(u&&u.test(i.message))return;r({ev_type:"js_error",payload:{error:i,breadcrumbs:[],extra:t,react:n}})}};if(i){var h=function(e){return l(EH(e))};e.addEventListener("error",h),c.push((function(){return e.removeEventListener("error",h)}))}if(o){var f=function(e){return l(RH(e))};e.addEventListener("unhandledrejection",f),c.push((function(){return e.removeEventListener("unhandledrejection",f)}))}s&&c.push(function(e){var t=!0,r=function r(n){return nH(n)?n._w_||(n._w_=function(){try{return(n.handleEvent||n).apply(this,[].map.call(arguments,r))}catch(i){throw t&&e(bH(i)),i}}):n};return IH.forEach((function(e){return window[e]&&uH(window,e,(function(e){return function(t){for(var n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];return e&&e.call.apply(e,$G([this,r(t)],ZG(n),!1))}}))()})),uH(XMLHttpRequest.prototype,"send",(function(e){return function(){for(var t=this,n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];return AH.forEach((function(e){return t[e]&&uH(t,e,r)()})),e.apply(this,n)}}))(),TH.forEach((function(e){var t=window[e]&&window[e].prototype;t&&t.addEventListener&&(uH(t,wH,(function(e){return function(t,n,i){try{var o=n.handleEvent;nH(o)&&(n.handleEvent=r(o))}catch(a){}return e&&e.call(this,t,r(n),i)}}))(),uH(t,"removeEventListener",(function(e){return function(t,r,n){return(null==r?void 0:r._w_)&&e.call(this,t,r._w_,n),e.call(this,t,r,n)}}))())})),function(){return t=!1}}(l));return[function(e,t,r){return l(kH(e),t,r)},function(){c.forEach((function(e){return e()}))}]}},NH="jsError",DH={ignoreErrors:[],onerror:!0,onunhandledrejection:!0,captureGlobalAsync:!1,dedupe:!0};var PH=function(e,t,r){if(void 0===e&&(e=hH()),void 0===t&&(t=hH()&&window.location),void 0===r&&(r=hH()&&window.history),e&&t)return function(n,i){lH("[PageviewMonitor] props",n);var o,a,s=n.sendInit,u=n.initPid,c=n.routeMode,d=n.extractPid,l=n.onPidUpdate,h=[],f="manual"===c?function(){return""}:function(e){return function(t){var r;return"hash"===e?(null===(r=mH(t).hash)||void 0===r?void 0:r.replace(/^#/,""))||"/":mH(t).path}}(c),p=d||function(){},v=ZG(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){i&&i({ev_type:"pageview",payload:{pid:t,source:e}})}),u||(o=t.href,null!==(a=p(o))&&void 0!==a?a:f(o)),f(t.href),l),2),_=v[0],m=v[1],g=_.bind(null,"user_set");if("manual"!==c){var y=ZG(function(e,t){var r=t;return[function(t,n){n!==r&&e(t,r=n)}]}((function(e,t){return _(e,f(t),p(t))}),""),1),S=y[0],b=function(){return S("history",t.href)};if(r){var E=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{e.apply(r,t)}finally{b()}}};h.push(sH(r,"pushState",E)(),sH(r,"replaceState",E)())}if("hash"===c){var R=function(){return S("hash",t.href)};e.addEventListener("hashchange",R,!0),h.push((function(){return e.removeEventListener("hashchange",R,!0)}))}else e.addEventListener("popstate",b,!0),h.push((function(){return e.removeEventListener("popstate",b,!0)}))}return s&&(lH("[PageviewMonitor] send init pid",u||t.href),m()),[g,function(){h.forEach((function(e){return e()}))}]}},MH="pageview",LH={sendInit:!0,routeMode:"history"};var UH=Mg.right,VH=rt,FH=Ql;Wi({target:"Array",proto:!0,forced:!$p("reduceRight")||!FH&&VH>79&&VH<83},{reduceRight:function(e){return UH(this,e,arguments.length,arguments.length>1?arguments[1]:void 0)}});var BH=["SCRIPT","STYLE","META","HEAD"],jH=["js_error","http","resource_error"],GH=function(e){return e.requestIdleCallback||function(t){return e.setTimeout(t,1)}},HH=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=BH),!t||o.indexOf(t.tagName)>-1||n>=i||r>4)return n;var a=function(){if(!r)return 0;var e=t.getBoundingClientRect(),n=e.top,i=e.height;return n>innerHeight||i<=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)},zH=function(e,t,r,n){var i;if(function(){if(hH()&&"Promise"in window)return Promise}()&&r&&n){if(r.html2canvas)return a();var o=n.createElement("script");o.src=t,null===(i=n.head)||void 0===i||i.appendChild(o),o.onload=a}function a(){GH(r)((function(){r.html2canvas&&r.html2canvas(n.body,{scale:360/r.innerWidth}).then((function(t){e(t.toDataURL("image/jpeg",.1))}))}))}},qH=function(e,t,r,n,i){if(void 0===e&&(e=hH()),void 0===t&&(t=fH()),void 0===r&&(r=function(){if(hH()&&nH(window.PerformanceObserver))return window.PerformanceObserver}()),void 0===n&&(n=function(){if(hH()&&nH(window.MutationObserver))return window.MutationObserver}()),void 0===i&&(i=function(){if(hH()&&tH(window.performance))return window.performance}()),t&&e)return function(o,a){var s,u,c,d,l,h,f,p=o.threshold,v=o.screenshot,_=o.rootSelector,m=o.autoDetect,g=o.ssUrl,y=GH(e),S=ZG(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 nH(r)&&r.call(e,t)||[]},function(){var t=(e||{}).clearResourceTimings;nH(t)&&t.call(e)},function(t){var r=(e||{}).getEntriesByName;return nH(r)&&r.call(e,t)||[]}]}(i),2),b=S[1],E=0,R=!1,k=function(e){u&&a&&a({ev_type:"blank_screen",payload:{timestamp:u[0],score:u[1],screenshot:e,error:c}})},T=(l=function(){u&&!R&&(R=!0,O(),v?zH(k,g,e,t):k())},function(){h||(f=Date.now(),h=e.setTimeout((function(){h=0,E>f||l()}),b()>1e4?2e3:8e3))});!function(e){var t=ZG(function(e){var t=!1;return[function(r){t||(t=!0,e&&e(r))}]}(e),1),r=t[0];["unload","beforeunload","pagehide"].forEach((function(e){addEventListener(e,r)}))}((function(){!R&&k()}));var I,A,w,C=function(){d&&clearTimeout(d),d=e.setTimeout((function(){y((function(){e.requestAnimationFrame((function(){var e=_?t.querySelector(_):t.body;if(e){var r=HH(e,0,0,p);r<p?(u=[Date.now(),r],T()):u=void 0}}))}))}),1e3)},O=function(){clearTimeout(d),D&&D(),L&&L()},x=ZG((A=C,w=(I=n)&&new I(A),[function(e,t){w&&e&&w.observe(e,t)},function(){return w&&w.disconnect()}]),2),N=x[0],D=x[1],P=ZG(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){e.supportedEntryTypes.indexOf(t)>-1&&i.observe({type:t,buffered:!1})}))}catch(a){try{i.observe({entryTypes:t})}catch(o){return n&&n()}}},function(){return i&&i.disconnect()}]}(r,(function(e,t,r){return d&&r.length>1&&C()})),2),M=P[0],L=P[1];return m&&(N(null===(s=fH())||void 0===s?void 0:s.body,{subtree:!0,childList:!0}),M("longtask","resource"),C()),[O,function(e){R||(E=Date.now(),c&&E-c.timestamp>1e4&&(c=void 0),c=function(e,t){if(-1===jH.indexOf(t.ev_type))return e;if("http"===t.ev_type&&t.payload.response.status<400)return e;if(e&&jH.indexOf(e.type)<jH.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:Date.now()}}(c,e))},C]}},XH="blankScreen";var KH={autoDetect:!0,threshold:1.5,screenshot:!0,ssUrl:"https://unpkg.byted-static.com/html2canvas/1.0.0-rc.7/dist/html2canvas.min.js"};function WH(e,t){!function(e,t,r){e.on("init",(function(){var n=yH(e,XH,t)||gH(r,t);if(n){var i=ZG(_H(qH,n,e.report.bind(e)),3),o=i[0],a=i[1],s=i[2],u=function(e){return a(e),e};e.on("report",u),e.on("beforeDestroy",(function(){o(),e.off("report",u)})),e.provide("detectBlankScreen",s)}}))}(e,KH,t)}var YH;"object"===("undefined"==typeof document?"undefined":o(document))&&("currentScript"in(YH=document)||Object.defineProperty(YH,"currentScript",{get:function(){try{throw new Error}catch(c){var e=0,t=/.*at [^(]*\((.*):(.+):(.+)\)$/gi.exec(c.stack),r=t&&t[1]||!1,n=t&&t[2]||0,i=YH.location.href.replace(YH.location.hash,""),o="",a=YH.getElementsByTagName("script");if(r===i){var s=YH.documentElement.outerHTML,u=new RegExp("(?:[^\\n]+?\\n){0,"+(n-2)+"}[^<]*<script>([\\d\\D]*?)<\\/script>[\\d\\D]*","i");o=s.replace(u,"$1").trim()}for(;e<a.length;e++){if("interactive"===a[e].readyState)return a[e];if(a[e].src===r)return a[e];if(r===i&&a[e].innerHTML&&a[e].innerHTML.trim()===o)return a[e]}return null}}}));var JH=function(){return JH=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},JH.apply(this,arguments)};function QH(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||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(VZ){i={error:VZ}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a}function ZH(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)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}var $H=function(e){return JSON.stringify({ev_type:"batch",list:e})};var ez=["init","start","config","beforeDestroy","provide","beforeReport","report","beforeBuild","build","beforeSend","send","beforeConfig"],tz=function(){return{}};function rz(e){return e}function nz(e){return"object"===o(e)&&null!==e}var iz=Object.prototype;function oz(e){if(nz(e)){if("function"==typeof Object.getPrototypeOf){var t=Object.getPrototypeOf(e);return t===iz||null===t}return"[object Object]"===iz.toString.call(e)}return!1}function az(e){return"[object Array]"===iz.toString.call(e)}function sz(e){return"function"==typeof e}function uz(e){return"number"==typeof e}function cz(e){return"string"==typeof e}function dz(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function lz(e,t){var r=JH({},e);for(var n in t)dz(t,n)&&void 0!==t[n]&&(nz(t[n])&&oz(t[n])?r[n]=lz(nz(e[n])?e[n]:{},t[n]):az(t[n])&&az(e[n])?r[n]=hz(e[n],t[n]):r[n]=t[n]);return r}function hz(e,t){var r=az(e)?e:[],n=az(t)?t:[];return Array.prototype.concat.call(r,n).map((function(e){return e instanceof RegExp?e:nz(e)&&oz(e)?lz({},e):az(e)?hz([],e):e}))}function fz(e,t){if(!az(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 pz=function(e,t,r){for(var n,i=QH(t.split(".")),o=i[0],a=i.slice(1);e&&a.length>0;)e=e[o],o=(n=QH(a))[0],a=n.slice(1);if(e)return r(e,o)},vz=function(e,t,r){return pz(e,t,(function(e,t){if(e&&t in e&&sz(e[t]))try{return e[t].apply(e,r)}catch(n){return}}))};function _z(e){return az(e)&&e.length?function(e){for(var t=[],r=e.length,n=0;n<r;n++){var i=e[n];cz(i)?t.push(i.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")):i&&i.source&&t.push(i.source)}return new RegExp(t.join("|"),"i")}(e):null}function mz(e){try{return cz(e)?e:JSON.stringify(e)}catch(t){return"[FAILED_TO_STRINGIFY]:"+String(t)}}var gz=function(e,t,r){return function(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];if(!e)return tz;var o=e[t],a=r.apply(void 0,ZH([o],QH(n),!1)),s=a;return sz(s)&&(s=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];try{return a.apply(this,e)}catch(r){return sz(o)&&o.apply(this,e)}}),e[t]=s,function(r){r||(s===e[t]?e[t]=o:a=o)}}},yz=function(e,t,r){return function(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];e[t]=r.apply(void 0,ZH([e[t]],QH(n),!1))}},Sz=0,bz=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];console.error.apply(console,ZH(["[SDK]",Date.now(),(""+Sz++).padStart(8," ")],QH(e),!1))},Ez=0,Rz=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];console.warn.apply(console,ZH(["[SDK]",Date.now(),(""+Ez++).padStart(8," ")],QH(e),!1))},kz=function(e){return Math.random()<Number(e)},Tz=function(e,t){return e<Number(t)},Iz=function(e){return function(t){for(var r=t,n=0;n<e.length&&r;n++)try{r=e[n](r)}catch(i){bz(i)}return r}};function Az(){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[n++]],i[e[n++]]].join("")}(e)}function wz(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={};ez.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)Rz("already inited");else{if(!(e&&nz(e)&&c(e)))throw new Error("invalid InitConfig, init failed");var n=o(e);if(!n)throw new Error("defaultConfig missing");var s=u(e);if((r=a(n)).setConfig(s),r.onChange((function(){m("config")})),!(t=i(r.getConfig())))throw new Error("sender missing");l=!0,m("init",!0)}},set:function(e){l&&e&&nz(e)&&(m("beforeConfig",!1,e),null==r||r.setConfig(e))},config:function(e){if(l)return e&&nz(e)&&(m("beforeConfig",!1,e),null==r||r.setConfig(s(e))),null==r?void 0:r.getConfig()},provide:function(e,t){fz(v,e)?Rz("cannot provide "+e+", reserved"):(_[e]=t,m("provide",!1,e))},start:function(){var e=this;l&&(h||null==r||r.onReady((function(){h=!0,m("start",!0),p.forEach((function(t){return e.build(t)})),p=[]})))},report:function(e){if(e){var t=Iz(d.beforeReport)(e);if(t){var r=Iz(d.report)(t);r&&(h?this.build(r):p.push(r))}}},build:function(e){if(h){var t=Iz(d.beforeBuild)(e);if(t){var r=n.build(t);if(r){var i=Iz(d.build)(r);i&&this.send(i)}}}},send:function(e){if(h){var r=Iz(d.beforeSend)(e);r&&(t.send(r),m("send",!1,r))}},destroy:function(){f=!0,m("beforeDestroy",!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]=function(e,t){if(!az(e))return e;var r=e.indexOf(t);if(r>=0){var n=e.slice();return n.splice(r,1),n}return e}(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,ZH([],QH(r),!1))}catch(t){}})),t&&(d[e].length=0)}}var Cz=function(e){var t=function(){var e={},t={},r={set:function(n,i){return e[n]=i,t[n]=mz(i),r},merge:function(n){return e=JH(JH({},e),n),Object.keys(n).forEach((function(e){t[e]=mz(n[e])})),r},delete:function(n){return delete e[n],delete t[n],r},clear:function(){return e={},t={},r},get:function(e){return t[e]},toString:function(){return JH({},t)}};return r}();e.provide("context",t),e.on("report",(function(e){return e.extra||(e.extra={}),e.extra.context=t.toString(),e}))};function Oz(){if("object"===("undefined"==typeof window?"undefined":o(window))&&nz(window))return window}function xz(){if("object"===("undefined"==typeof document?"undefined":o(document))&&nz(document))return document}function Nz(){return Oz()&&window.location}function Dz(){if(Oz()&&nz(window.performance))return window.performance}function Pz(){if("function"==typeof XMLHttpRequest&&sz(XMLHttpRequest))return XMLHttpRequest}function Mz(){try{return new Headers,new Request(""),new Response,window.fetch}catch(e){}}function Lz(){if(Oz()&&sz(window.MutationObserver))return window.MutationObserver}function Uz(){if(Oz()&&sz(window.PerformanceObserver))return window.PerformanceObserver}function Vz(){var e=function(){if(Oz()&&"navigator"in window)return window.navigator}();if(e)return e.connection||e.mozConnection||e.webkitConnection}var Fz=function(e){if(e)return e.__SLARDAR_REGISTRY__||(e.__SLARDAR_REGISTRY__={Slardar:{plugins:[],errors:[]}}),e.__SLARDAR_REGISTRY__.Slardar},Bz=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=Fz(Oz());r&&(r.errors||(r.errors=[]),r.errors.push(e))},jz=function(e,t){var r=e&&new e(t);return[function(e,t){r&&e&&r.observe(e,t)},function(){return r&&r.disconnect()}]},Gz=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 sz(r)&&r.call(e,t)||[]},function(){var t=(e||{}).clearResourceTimings;sz(t)&&t.call(e)},function(t){var r=(e||{}).getEntriesByName;return sz(r)&&r.call(e,t)||[]}]},Hz=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){e.supportedEntryTypes.indexOf(t)>-1&&i.observe({type:t,buffered:!1})}))}catch(o){try{i.observe({entryTypes:t})}catch(a){return n&&n()}}},function(){return i&&i.disconnect()}]},zz=function(e,t,r,n){void 0===t&&(t={}),void 0===n&&(n=[]);try{var i=e.apply(void 0,ZH([],QH(n),!1));return i&&i(t,r)||[]}catch(o){return Bz(o),[]}};function qz(e){var t=xz();if(!t||!e)return"";var r=t.createElement("a");return r.href=e,r.href}function Xz(e){var t=xz();if(!t||!e)return{url:e,protocol:"",domain:"",query:"",path:"",hash:""};var r=t.createElement("a");r.href=e;var n=r.pathname||"/";return"/"!==n[0]&&(n="/"+n),{url:r.href,protocol:r.protocol.slice(0,-1),domain:r.hostname,query:r.search.substring(1),path:n,hash:r.hash}}function Kz(){var e=Oz()&&Nz();return null==e?void 0:e.href}var Wz=function(e){var t={url:Kz(),timestamp:Date.now()},r=e.config();return(null==r?void 0:r.pid)&&(t.pid=r.pid),(null==e?void 0:e.context)&&(t.context=e.context.toString()),t},Yz=function(e,t){return function(r){var n=function(e){return e.overrides=t,e};e.on("report",n),r(),e.off("report",n)}},Jz=function(e){var t=xz();try{if(null==t?void 0:t.cookie)return function(e,t){if(!e||!t)return"";return function(e){for(var t=e.split(";"),r={},n=0;n<t.length;n++){var i=t[n].split("="),o=cz(i[0])&&i[0].trim();o&&cz(i[1])&&(r[o]=i[1].trim())}return r}(e)[t]||""}(t.cookie,e)}catch(r){}return""};function Qz(e){var t=Oz(),r=xz();t&&r&&("complete"!==r.readyState?t.addEventListener("load",(function(){setTimeout((function(){e()}),0)}),!1):e())}var Zz=function(e){var t=!1;return[function(r){t||(t=!0,e&&e(r))}]},$z=function(e){var t=QH(Zz(e),1)[0];["unload","beforeunload","pagehide"].forEach((function(e){addEventListener(e,t)}))},eq=function(e,t){var r,n=xz();if(n){var i=n.createElement("script");i.src=e,i.crossOrigin="anonymous",i.onload=t,null===(r=n.head)||void 0===r||r.appendChild(i)}},tq=function(e,t){return nz(e)?JH(JH({},t),e):!!e&&t},rq=function(e){try{var t=localStorage.getItem(e),r=t;return t&&"string"==typeof t&&(r=JSON.parse(t)),r}catch(n){return}},nq=new RegExp("(cookie|auth|jwt|token|key|ticket|secret|credential|session|password)","i"),iq=new RegExp("(bearer|session)","i"),oq=function(e,t){return!(!e||!t)&&(nq.test(e)||iq.test(t))};var aq=function(e,t,r){var n,i=e._method,o=e._reqHeaders,a=e._url,s=e._start,u=e._data,c={api:"xhr",request:{url:qz(a),method:(i||"").toLowerCase(),headers:o,timestamp:s},response:{status:e.status||0,is_custom_error:!1,timing:r(e.responseURL),timestamp:Date.now()},duration:Date.now()-s};"function"==typeof e.getAllResponseHeaders&&(c.response.headers=cz(n=e.getAllResponseHeaders())&&n?n.split("\r\n").reduce((function(e,t){if(cz(t)){var r=QH(t.split(": "),2),n=r[0],i=r[1];!oq(n,i)&&(e[n.toLowerCase()]=i)}return e}),{}):{});var d=c.response.status,l=t.collectBodyOnError,h=t.extraExtractor;try{var f=null==h?void 0:h(e.response,c);f&&(c.extra=f),f&&(c.response.is_custom_error=!0),l&&d>=400&&(c.request.body=u?""+u:void 0,c.response.body=e.response?""+e.response:void 0)}catch(p){}return c},sq=function(e,t){var r=_z(e||[]);return!!r&&r.test(t)},uq=function(e){var t=QH(Gz(e),5)[4];return function(e){return t(e).pop()}},cq=function(e){return function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];this._reqHeaders=this._reqHeaders||{};var n=QH(t,2),i=n[0],o=n[1];return!oq(i,o)&&(this._reqHeaders[i.toLowerCase()]=o),e&&e.apply(this,t)}},dq=function(e,t){return yz(e,"onreadystatechange",(function(r,n,i){return function(){for(var o=[],a=0;a<arguments.length;a++)o[a]=arguments[a];try{4===this.readyState&&!sq(n.ignoreUrls,e._url)&&i&&i({ev_type:"http",payload:aq(e,n,t)})}catch(s){Bz(s)}return r&&r.apply(this,o)}}))},lq=function(e,t,r,n){return function(){for(var i=this,o=[],a=0;a<arguments.length;a++)o[a]=arguments[a];return dq(this,n)(t,t.hookCbAtReq(r)),t.setTraceHeader&&t.setTraceHeader(this._url,(function(e,t){return i.setRequestHeader(e,t)})),this._start=Date.now(),this._data=null==o?void 0:o[0],e.apply(this,o)}},hq=function(e){return function(){for(var t,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return t=QH(r,2),this._method=t[0],this._url=t[1],e.apply(this,r)}},fq=function(e,t,r,n){yz(e,"open",hq)(),yz(e,"setRequestHeader",cq)(),yz(e,"send",lq)(t,r,n)},pq=function(e,t){if(void 0===e&&(e=Pz()&&Oz()),void 0===t&&(t=Dz()),e){var r=uq(t);return function(e,t){if(e.autoWrap){var n=XMLHttpRequest&&XMLHttpRequest.prototype;n&&fq(n,e,t,r)}return[function(n,i,o){return void 0===i&&(i=e),void 0===o&&(o=t),function(e,t,r,n){function i(){var i=new e;return fq(i,t,r,n),i}return i.prototype=new e,["DONE","HEADERS_RECIEVED","LOADING","OPENED","UNSENT"].forEach((function(t){i[t]=e[t]})),i}(n,i,o,r)}]}}},vq={sampleRate:1,origins:[]},_q=function(){var e=window.crypto||window.msCrypto;if(void 0!==e&&e.getRandomValues){var t=new Uint16Array(8);e.getRandomValues(t);var r=function(e){for(var t=e.toString(16);t.length<4;)t="0"+t;return t};return r(t[0])+r(t[1])+r(t[2])+r(t[3])+r(t[4])+r(t[5])+r(t[6])+r(t[7])}return"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx".replace(/[x]/g,(function(){return(16*Math.random()|0).toString(16)}))},mq=function(e){var t=tq(e,vq);if(t&&kz(t.sampleRate))return function(e,r){var n=t.origins;n.length&&Boolean(e.match(new RegExp(n.join("|"))))&&r("traceparent","03-"+_q()+"-"+_q().substring(16)+"-01")}};function gq(e,t,r){var n,i=null===(n=e.config())||void 0===n?void 0:n.plugins[t];return tq(i,r)}var yq=function(e,t){var r=e.config(),n={url:Kz(),pid:r.pid,view_id:r.viewId};return function(r){e.report(JH(JH({},r),{overrides:JH(JH({},n),t&&t(r)||{})}))}},Sq="ajax",bq={autoWrap:!0,hookCbAtReq:rz,ignoreUrls:[],collectBodyOnError:!1},Eq=function(e){return function(t){if(!t)return t;var r=e.config(),n={url:Kz(),pid:r.pid,view_id:r.viewId};return function(e){t(JH(JH({},e),{overrides:JH(JH({},n),{timestamp:e.payload.request.timestamp})}))}}};function Rq(e,t){return e instanceof t}function kq(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return t.reduce((function(t,r){return new e(r).forEach((function(e,r){return!oq(r,e)&&(t[r]=e)})),t}),{})}var Tq=function(e,t,r){var n=t&&t.method||"get";return Rq(e,r)&&(n=e.method||n),n.toLowerCase()},Iq=function(e,t,r){return Rq(e,r)?e.body:null==t?void 0:t.body},Aq=function(e,t,r,n){return{method:Tq(t,r,n),timestamp:Date.now(),url:qz(e)}},wq=function(e,t,r,n,i,o){return function(a,s){void 0===s&&(s={});var u=function(e,t,r){void 0===t&&(t=!1);var n="";return n=Rq(e,r)?e.url:e,t||(n=cz(n)?n.split("?")[0]:n),n}(a,!1,i);if(!function(e){if(!cz(e))return!1;var t=QH(e.split(":"),2),r=t[0];return!t[1]||"http"===r||"https"===r}(u)||sq(t.ignoreUrls,u))return e(a,s);var c=t.hookCbAtReq(r),d={api:"fetch",request:Aq(a instanceof i?a.url:a,a,s,i),response:{is_custom_error:!1},duration:0};t.setTraceHeader&&t.setTraceHeader(d.request.url,(function(e,t){return function(e,t,r,n,i,o){var a;Rq(r,i)?r.headers.set(e,t):n.headers instanceof o?n.headers.set(e,t):n.headers=JH(JH({},n.headers),((a={})[e]=t,a))}(e,t,a,s,i,n)}));var l=e(a,s);try{d.request.headers=kq(n,a.headers,s.headers)}catch(f){Bz(f)}var h=function(){c&&c({ev_type:"http",payload:d})};return l.then((function(e){var r;try{d.response.status=e.status||0,d.response.headers=kq(n,e.headers),d.response.timestamp=Date.now(),d.duration=d.response.timestamp-d.request.timestamp;var u=t.collectBodyOnError,c=t.extraExtractor;try{c&&e.clone().json().then((function(e){var t=c(e,d);t&&(d.extra=t,d.response.is_custom_error=!0)}))}catch(l){}u&&e.status>=400&&(d.request.body=null===(r=Iq(a,s,i))||void 0===r?void 0:r.toString());setTimeout((function(){d.response.timing=o(e.url),h()}),100)}catch(f){Bz(f)}}),(function(){var e;try{d.response.status=0,d.response.timestamp=Date.now(),d.duration=d.response.timestamp-d.request.timestamp,t.collectBodyOnError&&(d.request.body=null===(e=Iq(a,s,i))||void 0===e?void 0:e.toString())}catch(f){Bz(f)}h()})),l}},Cq=function(e,t,r,n){if(void 0===e&&(e=Mz()&&Oz()),void 0===t&&(t=window.Headers),void 0===r&&(r=window.Request),void 0===n&&(n=Dz()),e&&t&&r){var i=uq(n);return function(n,o){n.autoWrap&&yz(e,"fetch",wq)(n,o,t,r,i);return[function(e,a,s){return void 0===a&&(a=n),void 0===s&&(s=o),wq(e,a,s,t,r,i)}]}}},Oq="fetch",xq={autoWrap:!0,hookCbAtReq:rz,ignoreUrls:[],collectBodyOnError:!1};var Nq=["name","message","stack","filename","lineno","colno"],Dq=function(e){var t,r,n,i;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)?(oz(e)||(i=e,"undefined"!=typeof Event&&function(e,t){try{return e instanceof t}catch(r){return!1}}(i,Event))||cz(e))&&(t={message:mz(e)}):(n=Nq,t=(r=e)&&nz(r)?n.reduce((function(e,t){return e[t]=r[t],e}),{}):r),t},Pq=function(e){return t=e,"[object ErrorEvent]"===Object.prototype.toString.call(t)?Dq(e.error):function(e){return"[object PromiseRejectionEvent]"===Object.prototype.toString.call(e)}(e)?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=Dq(r);return JH(JH({},n),{name:null!==(t=n&&n.name)&&void 0!==t?t:"UnhandledRejection"})}}catch(i){}}(e):Dq(e);var t},Mq=function(e,t,r){if(void 0===e&&(e=Oz()),void 0===t&&(t=Nz()),void 0===r&&(r=Oz()&&window.history),e&&t)return function(n,i){var o,a,s=n.sendInit,u=n.initPid,c=n.routeMode,d=n.extractPid,l=n.onPidUpdate,h=[],f="manual"===c?function(){return""}:function(e){return function(t){var r;return"hash"===e?(null===(r=Xz(t).hash)||void 0===r?void 0:r.replace(/^#/,""))||"/":Xz(t).path}}(c),p=d||function(){},v=QH(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){i&&i({ev_type:"pageview",payload:{pid:t,source:e}})}),u||(o=t.href,null!==(a=p(o))&&void 0!==a?a:f(o)),f(t.href),l),2),_=v[0],m=v[1],g=_.bind(null,"user_set");if("manual"!==c){var y=QH(function(e,t){var r=t;return[function(t,n){n!==r&&e(t,r=n)}]}((function(e,t){return _(e,f(t),p(t))}),""),1),S=y[0],b=function(){return S("history",t.href)};if(r){var E=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{e.apply(r,t)}finally{b()}}};h.push(gz(r,"pushState",E)(),gz(r,"replaceState",E)())}if("hash"===c){var R=function(){return S("hash",t.href)};e.addEventListener("hashchange",R,!0),h.push((function(){return e.removeEventListener("hashchange",R,!0)}))}else e.addEventListener("popstate",b,!0),h.push((function(){return e.removeEventListener("popstate",b,!0)}))}return s&&m(),[g,function(){h.forEach((function(e){return e()}))}]}},Lq="pageview",Uq={sendInit:!0,routeMode:"history"};var Vq={isSupport:!0,isPolyfill:!1,isBounced:!1,isCustom:!1,type:"perf"},Fq=function(e,t){return JH({name:e,value:t},Vq)},Bq=function(e){return{ev_type:"performance",payload:e}},jq=function(e,t){return void 0===e&&(e=Uz()),void 0===t&&(t=Dz()),function(r,n){var i=r.metricName,o=r.entryName,a=Fq(i,0),s=QH(Zz(n),1)[0];if(!t||!e)return a.isSupport=!1,void s(a);var u=function(e){var t=e.startTime;a.value=t,s(a)},c=(0,QH(Gz(t),5)[4])(o)[0];if(c)u(c);else{var d=QH(Hz(e,(function(e){e.name===o&&(u(e),h())})),2),l=d[0],h=d[1];l("paint");!function(e){"hidden"!==document.visibilityState?addEventListener("visibilitychange",(function t(){"hidden"===document.visibilityState&&(e(),removeEventListener("visibilitychange",t,!0))}),!0):e()}((function(){a.isSupport=!1,s(a),h()}));$z((function(){a.isBounced=!0,s(a),h()}))}}},Gq={entries:[],observer:void 0},Hq=function(e){var t=e||{},r=t.domContentLoadedEventEnd,n=t.navigationStart;return r?r-(void 0===n?0:n):null},zq=function(e){return function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return this._method=t[0],e.apply(this,t)}},qq=function(e,t,r){var n=0;return function(){for(var i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];if("GET"!==this._method)return e.apply(this,i);var a=n+=2;return t(a,Date.now()),gz(this,"onreadystatechange",(function(e){return function(t){e&&e.call(this,t),4===this.readyState&&r(a)}}))(),e.apply(this,i)}},Xq=function(e,t,r){var n=1;return function(){for(var i,o,a=[],s=0;s<arguments.length;s++)a[s]=arguments[s];var u=(null===(i=a[0])||void 0===i?void 0:i.method)||(null===(o=a[1])||void 0===o?void 0:o.method)||"GET";return"GET"!==u?e.apply(void 0,ZH([],QH(a),!1)):new Promise((function(i,o){var s=n+=2;t(s,Date.now()),e.apply(void 0,ZH([],QH(a),!1)).then((function(e){r(s),i(e)}),(function(e){r(s,e),o(e)}))}))}},Kq=function(e,t,r,n){return function(i,o,a){var s=QH(function(){var e=[],t=[];return[e,t,function(r,n){return function(i){var o=i,a=o.startTime,s=o.duration,u=o.fetchStart,c=o.responseEnd,d=o.entryType;"longtask"===d?(i.start=a,i.end=a+s,e.push(i),r&&r(i)):"resource"===d&&(t.push({start:u,end:c}),n&&n(i))}}]}(),3),u=s[0],c=s[1],d=s[2],l=QH(function(e,t){var r,n=QH([r={},function(e,t){return r[e]=t},function(e){return delete r[e]}],3),i=n[0],o=n[1],a=n[2],s=t&&gz(t.prototype,"open",zq)(),u=t&&gz(t.prototype,"send",qq)(o,a),c=e&&gz(e,"fetch",Xq)(o,a);return[i,function(){s&&s(!0),u&&u(!0),c&&c(!0)}]}(e,t),2),h=l[0],f=l[1],p=QH(n&&function(e,t){var r=["img","script","iframe","link","audio","video","source"];function n(e,t){for(var r=0;r<e.length;r++)if(fz(t,e[r].nodeName.toLowerCase())||e[r].children&&n(e[r].children,t))return!0;return!1}var i=QH(jz(e,(function(e){for(var i=0;i<e.length;i++)("childList"===e[i].type&&n(e[i].addedNodes,r)||"attributes"===e[i].type&&fz(r,e[i].target.nodeName.toLowerCase()))&&t(e[i])})),2),o=i[0];return[function(){return o(document,{attributes:!0,childList:!0,subtree:!0,attributeFilter:["href","src"]})},i[1]]}(n,(function(){return o(a()+5e3)}))||[],2),v=p[0],_=p[1];v&&v();var m=function(){return function(e,t,r){if(e.length>2)return r();for(var n=[],i=0;i<t.length;i++)n.push([t[i].start,0],[t[i].end,1]);for(i=0;i<e.length;i++)n.push([e[i],0]);n.sort((function(e,t){return e[0]-t[0]}));var o=e.length;for(i=n.length-1;i>=0;i--){var a=QH(n[i],2),s=a[0];switch(a[1]){case 0:o--;break;case 1:if(++o>2)return s}}return 0}(function(e){for(var t=Object.keys(e),r=[],n=0;n<t.length;n++){var i=e[t[n]];"number"==typeof i&&r.push(i)}return r}(h),c,a)},g=QH(Hz(r,d((function(e){var t=e.startTime,r=e.duration;return o(t+r+5e3)}),(function(){return o(m()+5e3)})),!1,(function(){return u.notSupport=!0})),2),y=g[0],S=g[1];return y("longtask","resource"),i.forEach(d()),[u,function(){f(),S(),_&&_()},m]}},Wq=function(e,t,r,n,i){return void 0===e&&(e=Pz()),void 0===t&&(t=Mz()&&Oz()),void 0===r&&(r=Uz()),void 0===n&&(n=Lz()),void 0===i&&(i=Dz()),function(o,a,s,u){var c=Fq("tti",0),d=QH(Zz((function(e){var t=Bq(e);a&&a(t)})),1)[0];if(!(e&&t&&r&&i))return c.isSupport=!1,d(c),[function(){return 0}];var l=o.precollect,h=o.isAsync,f=void 0===h?0:h,p=o.minValue,v=void 0===p?null:p,_=l||{},m=_.entries,g=void 0===m?[]:m,y=_.observer,S=QH(Gz(i),5),b=S[0],E=S[1],R=S[4],k=QH(function(e){var t,r=-1/0,n=void 0,i=function(){return window.clearTimeout(n)},o=function(o){r>o||!t||(i(),n=window.setTimeout(t,o-e()),r=o)};return[function(e,r){t=e,o(r)},function(){i(),t=void 0},o]}(E),3),T=k[0],I=k[1],A=k[2],w=QH(Kq(t,e,r,n)(f?[]:g,A,E),3),C=w[0],O=w[1],x=w[2],N=function(){I(),O(),s&&s(),y&&y.disconnect(),g.length=0},D=function(e){var t=R("first-contentful-paint")[0],r=function(e,t,r,n,i){if(n-r<5e3)return null;var o=0===i.length?e:i[i.length-1].end;return n-o<5e3?null:Math.max(o,t)}((t?t.startTime:Hq(b))||0,v||Hq(b)||0,x(),E()+(e?0:5e3),C);return e?r?(N(),void e(r)):A(E()+1e3):(N(),r)};if(u&&u(C,A,c),C.notSupport)return c.isSupport=!1,d(c),[function(){return 0}];var P=function(e){c.value=e,d(c)},M=C[C.length-1];T((function(){return D(P)}),Math.max(x()+5e3,M?M.end:0));return[function(){return D()||0}]}};var Yq=["SCRIPT","STYLE","META","HEAD"],Jq=function e(t,r,n,i){if(!t||i.indexOf(t.tagName)>-1)return 0;var o=t.children,a=void 0===o?[]:o,s=[].slice.call(a).reduceRight((function(t,n){return t+e(n,r+1,t>0,i)}),0);if(s<=0&&!n){if(!sz(t.getBoundingClientRect))return 0;var u=t.getBoundingClientRect()||{},c=u.top,d=u.height;if(c>window.innerHeight||d<=0)return 0}return s+1+.5*r},Qq=function(e,t,r,n,i){var o;return void 0===e&&(e=xz()),void 0===t&&(t=Lz()),void 0===r&&(r=null===(o=function(){var e=Dz();if(e&&nz(e.timing))return e.timing}())||void 0===o?void 0:o.navigationStart),void 0===n&&(n=function(){if(Oz()&&"requestAnimationFrame"in window)return window.requestAnimationFrame}()),void 0===i&&(i=function(){if(Oz()&&"cancelAnimationFrame"in window)return window.cancelAnimationFrame}()),function(o,a){var s=o.renderType,u=Fq("fmp",0),c=function(e){var t=Bq(e);a&&a(t)};if("SSR"===s)return zz(jq,{metricName:"fmp",entryName:"first-contentful-paint"},c),[tz];var d=QH(Zz(c),1)[0];if(!e||!t||!r)return u.isSupport=!1,d(u),[tz];var l=Date.now(),h=[],f=function(){return h.push({time:Date.now()-l,score:Jq(e&&e.body,1,!1,Yq)})},p=QH(function(e,t,r,n){var i,o=!sz(t)||n&&e&&e.hidden?function(e){return e(0),0}:t,a=sz(r)?r:tz;return[function(e){i&&a(i),i=o(e)},o,a]}(e,n,i,!0),1),v=p[0],_=QH(jz(t,(function(){return v(f)})),2),m=_[0],g=_[1],y=l-(r||0);return m(e,{subtree:!0,childList:!0}),[function(e){void 0===e&&(e=0),g();var t=function(e){var t=QH(void 0===e?[]:e),r=t[0],n=t.slice(1);return n&&n.reduce((function(e,t){var r=QH(e,2),n=r[0],i=r[1],o=t.score-n.score;return[t,t.time>=n.time&&i.rate<o?{time:t.time,rate:o}:i]}),[r,{time:null==r?void 0:r.time,rate:0}])[1].time||0}(h);u.value=t?t+e:0,d(u)}.bind(null,y)]}},Zq={renderType:"CSR"};var $q="custom",eX=function(e){e.provide("sendEvent",(function(t){var r=function(e){if(e&&nz(e)&&e.name&&cz(e.name)){var t={name:e.name,type:"event"};if("metrics"in e&&nz(e.metrics)){var r=e.metrics,n={};for(var i in r)uz(r[i])&&(n[i]=r[i]);t.metrics=n}if("categories"in e&&nz(e.categories)){var o=e.categories,a={};for(var i in o)a[i]=mz(o[i]);t.categories=a}return t}}(t);r&&e.report({ev_type:$q,payload:r,extra:{timestamp:Date.now()}})})),e.provide("sendLog",(function(t){var r=function(e){if(e&&nz(e)&&e.content&&cz(e.content)){var t={content:mz(e.content),type:"log",level:"info"};if("level"in e&&(t.level=e.level),"extra"in e&&nz(e.extra)){var r=e.extra,n={},i={};for(var o in r)uz(r[o])?n[o]=r[o]:i[o]=mz(r[o]);t.metrics=n,t.categories=i}return t}}(t);r&&e.report({ev_type:$q,payload:r,extra:{timestamp:Date.now()}})}))};function tX(e){return(null==e?void 0:e.effectiveType)||(null==e?void 0:e.type)||""}var rX=function(e,t){var r=e.common||{};return r.sample_rate=t,e.common=r,e},nX=function(e,t,r,n,i){return e?(o=i(n,t),function(){return o}):function(){return r(t)};var o},iX=function(e,t,r,n){var i=pz(e,t,(function(e,t){return e[t]}));return void 0!==i&&function(e,t,r){switch(r){case"eq":return fz(t,e);case"neq":return!fz(t,e);case"gt":return e>t[0];case"gte":return e>=t[0];case"lt":return e<t[0];case"lte":return e<=t[0];case"regex":return Boolean(e.match(new RegExp(t.join("|"))));case"not_regex":return!e.match(new RegExp(t.join("|")));default:return!1}}(i,function(e,t){return e.map((function(e){switch(t){case"number":return Number(e);case"boolean":return"1"===e;default:return String(e)}}))}(n,"boolean"==typeof i?"bool":uz(i)?"number":"string"),r)},oX=function e(t,r){try{return"rule"===r.type?iX(t,r.field,r.op,r.values):"and"===r.type?r.children.every((function(r){return e(t,r)})):r.children.some((function(r){return e(t,r)}))}catch(n){return Bz(n),!1}},aX=function(e,t,r,n){if(!t)return rz;var i=t.sample_rate,o=t.include_users,a=t.sample_granularity,s=t.rules,u=t.r,c=void 0===u?Math.random():u;if(fz(o,e))return function(e){return rX(e,1)};var d="session"===a,l=nX(d,i,r,c,n),h=function(e,t,r,n,i,o){var a={};return Object.keys(e).forEach((function(s){var u=e[s],c=u.enable,d=u.sample_rate,l=u.conditional_sample_rules;c?(a[s]={enable:c,sample_rate:d,effectiveSampleRate:d*r,hit:nX(t,d,n,i,o)},l&&(a[s].conditional_hit_rules=l.map((function(e){var a=e.sample_rate,s=e.filter;return{sample_rate:a,hit:nX(t,a,n,i,o),effectiveSampleRate:a*r,filter:s}})))):a[s]={enable:c,hit:function(){return!1},sample_rate:0,effectiveSampleRate:0}})),a}(s,d,i,r,c,n);return function(e){var t;if(!l())return!1;if(!(e.ev_type in h))return rX(e,i);if(!h[e.ev_type].enable)return!1;if(null===(t=e.common)||void 0===t?void 0:t.sample_rate)return e;var r=h[e.ev_type],n=r.conditional_hit_rules;if(n)for(var o=0;o<n.length;o++)if(oX(e,n[o].filter))return!!n[o].hit()&&rX(e,n[o].effectiveSampleRate);return!!r.hit()&&rX(e,r.effectiveSampleRate)}},sX=function(e,t,r){var n=t.url,i=t.data,o=t.success,a=void 0===o?tz:o,s=t.fail,u=void 0===s?tz:s,c=t.getResponseText,d=void 0===c?tz:c,l=t.withCredentials,h=void 0!==l&&l,f=new r;f.withCredentials=h,f.open(e,n,!0),f.setRequestHeader("Content-Type","application/json"),f.onload=function(){null==d||d(this.responseText);try{if(this.responseText){var e=JSON.parse(this.responseText);a(e)}else a({})}catch(t){u(t)}},f.onerror=function(){u(new Error("Network request failed"))},f.onabort=function(){u(new Error("Network request aborted"))},f.send(i)},uX=function(){var e=Pz();return e?{get:function(t){sX("GET",t,e)},post:function(t){sX("POST",t,e)}}:{get:tz,post:tz}};function cX(e){var t,r=function(e){var t=e.transport,r=e.endpoint,n=e.size,i=void 0===n?10:n,o=e.wait,a=void 0===o?1e3:o,s=[],u=0;function c(){s.length&&(t.post({url:r,data:this.getBatchData()}),s=[])}return{getSize:function(){return i},getWait:function(){return a},setSize:function(e){i=e},setWait:function(e){a=e},getEndpoint:function(){return r},setEndpoint:function(e){r=e},send:function(e){s.push(e),s.length>=i&&c.call(this),clearTimeout(u),u=setTimeout(c.bind(this),a)},flush:function(){clearTimeout(u),c.call(this)},getBatchData:function(){return s.length?$H(s):""},clear:function(){clearTimeout(u),s=[]}}}(e),n=(t=Oz())&&t.navigator.sendBeacon?{get:function(){},post:function(e,r){t.navigator.sendBeacon(e,r)}}:{get:tz,post:tz},i=function(e){n.post(r.getEndpoint(),$H([e]))};return $z((function(){var e=r.getBatchData();e&&(n.post(r.getEndpoint(),e),r.clear()),r.send=i})),r}var dX="1.1.3",lX="/monitor_web/settings/browser-settings",hX="/monitor_browser/collect/batch/",fX=["/log/sentry/",hX,lX],pX="session",vX={sample_rate:1,include_users:[],sample_granularity:pX,rules:{}};function _X(e){var t=e.plugins||{};for(var r in t)t[r]&&!nz(t[r])&&(t[r]={});return JH(JH({},e),{plugins:t})}function mX(e){return nz(e)&&"bid"in e}function gX(e){return JH({},e)}var yX=function(e,t){return void 0===t&&(t=lX),(e&&e.indexOf("//")>=0?"":"https://")+e+t},SX=function(e){return"SLARDAR"+e},bX=function(e){var t=e.bid,r=e.userId,n=e.deviceId;!function(e,t){try{var r="string"==typeof t?t:JSON.stringify(t);localStorage.setItem(e,r)}catch(n){}}(SX(t),{userId:r,deviceId:n})},EX={get:function(){return this.__SLARDAR__REPALCE__HOLDER__}},RX=function(e){var t,r,n=e,i={},o=EX.get(),a=tz,s=tz;return{getConfig:function(){return n},setConfig:function(e){var s,d,l;return i=JH(JH({},i),e||{}),u(),t||(t=e,n.useLocalConfig||!n.bid?(r={},a()):o?c():(s=n.domain,d=n.bid,l=function(e){o=e,c()},uX().get({withCredentials:!0,url:yX(s)+"?bid="+d+"&store=1",success:function(e){l(e.data||{})},fail:function(){l({sample:{sample_rate:.001}})}}))),n},onChange:function(e){s=e},onReady:function(e){a=function(){bX(n),e()},r&&a()}};function u(){var t=JH(JH(JH({},e),r||{}),i);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=lz(r,e[n++]);return r}(e.plugins,(null==r?void 0:r.plugins)||{},i.plugins||{}),t.sample=kX(kX(e.sample,null==r?void 0:r.sample),i.sample),n=t,s()}function c(){r=function(e){var t;if(!e)return{};var r=e.sample,n=e.user_id,i=e.plugins,o=e.timestamp,a=e.quota_rate,s=void 0===a?1:a;if(!r)return{userId:n};var u=r.sample_rate,c=r.sample_granularity,d=void 0===c?pX:c,l=r.include_users,h=r.rules;return{userId:n,sample:{include_users:l,sample_rate:u*s,sample_granularity:d,rules:(void 0===h?[]:h).reduce((function(e,t){var r=t.name,n=t.enable,i=t.sample_rate,o=t.conditional_sample_rules;return e[r]={enable:n,sample_rate:i,conditional_sample_rules:o},e}),{})},plugins:{heatmap:null!==(t=null==i?void 0:i.heatmap)&&void 0!==t&&t},serverTimestamp:o}}(o),function(e){void 0===e&&(e="");var t=SX(e);return!!rq(t)}(n.bid)&&(r.userId=e.userId),u(),a()}};function kX(e,t){if(!e||!t)return e||t;var r=JH(JH({},e),t);return r.include_users=ZH(ZH([],QH(e.include_users||[]),!1),QH(t.include_users||[]),!1),r.rules=ZH(ZH([],QH(Object.keys(e.rules||{})),!1),QH(Object.keys(t.rules||{})),!1).reduce((function(r,n){var i,o;return n in r||(n in(e.rules||{})&&n in(t.rules||{})?(r[n]=JH(JH({},e.rules[n]),t.rules[n]),r[n].conditional_sample_rules=ZH(ZH([],QH(e.rules[n].conditional_sample_rules||[]),!1),QH(t.rules[n].conditional_sample_rules||[]),!1)):r[n]=(null===(i=e.rules)||void 0===i?void 0:i[n])||(null===(o=t.rules)||void 0===o?void 0:o[n])),r}),{}),r}var TX={build:function(e){return{ev_type:e.ev_type,payload:e.payload,common:JH(JH({},e.extra||{}),e.overrides||{})}}};function IX(e,t,r){void 0===r&&(r=AX);var n=e.config(),i=n.plugins,o=n.pluginBundle;Object.keys(i).forEach((function(n){i[n]&&(o&&fz(o.plugins,n)?r(e,o,t):r(e,{name:n,config:i[n]},t))}))}function AX(e,t,r,n){var i=t.name,o=t.plugins,a=t.config;if(void 0===n&&(n=eq),!function(e,t){return fz(e.loaded,t)||fz(e.loading,t)}(e,i)){e.loading.push(i);var s=function(e,t,r){var n;return null!==(n=null==r?void 0:r.path)&&void 0!==n?n:e.config().pluginPathPrefix+"/"+(i=t,i.replace(/([a-z])([A-Z])/g,(function(e,t,r){return t+"-"+r.toLowerCase()}))+".")+"1.1.3.js";var i}(e,i,a);n(s,(function(){fz(e.loaded,i)||(o?o.forEach((function(t){fz(e.loaded,t)||wX(e,t,r)})):wX(e,i,r))}))}}function wX(e,t,r){if(void 0===r&&(r=Fz(Oz())),r){var n=function(e,t){return e.plugins.filter((function(e){return e.name===t&&e.version===dX}))[0]}(r,t);if(n)try{n.apply(e),e.loaded.push(t)}catch(i){Bz(i),Rz("[loader].applyPlugin failed",t,i)}else Rz("[loader].applyPlugin not found",t)}}var CX=function(e){e.on("report",(function(e){return function(e){var t={url:Kz(),timestamp:Date.now(),sdk_version:dX,sdk_name:"SDK_SLARDAR_WEB"};return JH(JH({},e),{extra:JH(JH({},t),e.extra||{})})}(e)}))},OX={sri:"reportSri",st:"reportResourceError",err:"captureException"},xX=function(e,t){var r;void 0===t&&(t=OX);var n,i=function(e){return Object.keys(e).reduce((function(e,t){return e[t]=[],e}),{})}(t),o=(n=t,Object.keys(n).reduce((function(e,t){return e[n[t]]=t,e}),{})),a=function(e,t,r){return function(n,i,o,a){var s;void 0===o&&(o=Date.now()),void 0===a&&(a=location.href);var u=JH(JH({},Wz(e)),{url:a,timestamp:o});t[n]&&(e[r[n]]?Yz(e,u)((function(){e[r[n]](i)})):null===(s=t[n])||void 0===s||s.push([i,u]))}}(e,i,t);(null===(r=e.p)||void 0===r?void 0:r.a)&&"observe"in e.p.a&&e.p.a.observe((function(e){var t=QH(e,5);t[0];var r=t[1],n=t[2],i=t[3],o=t[4];a(r,n,i,o)})),e.on("init",(function(){var t;null===(t=e.p)||void 0===t||t.a.forEach((function(e){var t=QH(e,5);t[0];var r=t[1],n=t[2],i=t[3],o=t[4];a(r,n,i,o)})),e.p&&e.p.a&&(e.p.a.length=0)})),e.provide("precollect",a),e.on("provide",function(e,t,r){return function(n){var i;n in r&&(null===(i=t[r[n]])||void 0===i||i.forEach((function(t){var r=QH(t,2),i=r[0],o=r[1];Yz(e,o)((function(){e[n](i)}))})),t[r[n]]=null)}}(e,i,o))},NX=function(e){var t=QH(e,2),r=t[0],n=t[1];return{ev_type:"js_error",payload:{error:Pq(r),breadcrumbs:[],extra:n||{}},extra:{bid:"slardar_sdk"}}},DX=function(e,t){void 0===t&&(t=.001);var r,n,i=Fz(Oz());i&&(i.errors||(i.errors=[]),"observe"in i.errors||kz(t)&&(i.errors=(r=i.errors,n=[],r.observe=function(e){n.push(e)},r.push=function(){for(var e,t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];return t.forEach((function(e){n.forEach((function(t){return t(e)}))})),(e=[].push).call.apply(e,ZH([r],QH(t),!1))},r),i.errors.forEach((function(t){e.report(NX(t))})),i.errors.observe((function(t){e.report(NX(t))}))))},PX=function(e){e.on("beforeBuild",(function(t){return function(e,t){var r={};return r.bid=t.bid,r.pid=t.pid,r.view_id=t.viewId,r.user_id=t.userId,r.device_id=t.deviceId,r.session_id=t.sessionId,r.release=t.release,r.env=t.env,JH(JH({},e),{extra:JH(JH({},r),e.extra||{})})}(t,e.config())}))},MX=function(e){var t,r=function(e){void 0===e&&(e="");var t=SX(e);return rq(t)||{userId:Jz("MONITOR_WEB_ID")||Az(),deviceId:Jz("MONITOR_DEVICE_ID")||Az()}}(e.bid);return{bid:"",pid:"",viewId:(t="_",t+"_"+Date.now()),userId:r.userId,deviceId:r.deviceId,sessionId:Az(),domain:"mon.zijieapi.com",pluginBundle:{name:"commonMonitors",plugins:["breadcrumb","jsError","performance","resourceError","resource"]},pluginPathPrefix:"https://lf3-short.ibytedapm.com/slardar/fe/sdk-web/plugins",plugins:{ajax:{ignoreUrls:fX},fetch:{ignoreUrls:fX},breadcrumb:{},pageview:{},jsError:{},resource:{},resourceError:{},performance:{},tti:{},fmp:{},blankScreen:!1,heatmap:!1},release:"",env:"production",sample:vX}},LX=function(e){var t=void 0===e?{}:e,r=t.createSender,n=void 0===r?function(e){return cX({size:20,endpoint:(t=e.domain,void 0===r&&(r=hX),(t&&t.indexOf("//")>=0?"":"https://")+t+r),transport:uX()});var t,r}:r,i=t.builder,o=void 0===i?TX:i,a=t.createDefaultConfig,s=wz({validateInitConfig:mX,initConfigNormalizer:_X,userConfigNormalizer:gX,createSender:n,builder:o,createDefaultConfig:void 0===a?MX:a,createConfigManager:RX});s.loaded=[],s.loading=[],DX(s),Cz(s),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;if(!(isNaN(i)||Number(i)<=0||r)){r=!0;var o=(new Date).getTime();if(o-t<700&&i){var a=i-(o+t)/2;!isNaN(a)&&(a>0||a<-6e5)&&e.on("beforeBuild",(function(e){var t;return JH(JH({},e),{extra:JH(JH({},null!==(t=e.extra)&&void 0!==t?t:{}),{sdk_offset:null!=a?a:0})})}))}}}))}))}(s),PX(s),CX(s),function(e){var t=Vz(),r=tX(t);t&&(t.onchange=function(){r=tX(t)}),e.on("report",(function(e){return JH(JH({},e),{extra:JH(JH({},e.extra||{}),{network_type:r})})}))}(s),function(e){e.on("start",(function(){var t=e.config().bid,r=e.getSender();r.setEndpoint(r.getEndpoint()+"?biz_id="+t)}))}(s);var u=function(e,t,r){var n={},i=function r(){for(var i,o=[],a=0;a<arguments.length;a++)o[a]=arguments[a];var s=o[0];if(s){var u=s.split(".")[0];if(!(u in r)){var c=n[u]||[],d=null!==(i=null==t?void 0:t(e))&&void 0!==i?i:{};return c.push(ZH([d],QH(o),!1)),void(n[u]=c)}return vz(r,s,[].slice.call(o,1))}};for(var o in gz(e,"provide",(function(t){return function(r,n){i[r]=n,t.call(e,r,n)}}))(),e)Object.prototype.hasOwnProperty.call(e,o)&&(i[o]=e[o]);return e.on("provide",(function(t){n[t]&&(n[t].forEach((function(t){var n=QH(t),i=n[0],o=n.slice(1);null==r||r(e,i,o)})),n[t]=null)})),i}(s,Wz,(function(e,t,r){return Yz(e,t)((function(){var e=QH(r),t=e[0],n=e.slice(1);s[t].apply(s,ZH([],QH(n),!1))}))}));return function(e){e.on("init",(function(){var t=[],r=e.config();r&&r.integrations&&r.integrations.forEach((function(r){fz(t,r.name)||(t.push(r.name),r.setup(e),r.tearDown&&e.on("beforeDestroy",r.tearDown))}))}))}(u),u},UX="precollect",VX=3e5;var FX,BX,jX=function(e){void 0===e&&(e={});var t=LX(e);return t.loaded.push("heatmap"),function(e,t,r){void 0===r&&(r=IX),Qz((function(){e.on("init",(function(){r(e,t)}))}))}(t),function(e){e.on("start",(function(){var t=e.config(),r=t.userId,n=t.sample;n&&0===n.sample_rate&&e.destroy();var i=aX(r,n,kz,Tz);e.on("build",i)}))}(t),xX(t),eX(t),function(e){e.on("init",(function(){var t,r=gq(e,Lq,Uq);if(r){var n=QH(zz(Mq,JH(JH({},r),{initPid:null===(t=e.config())||void 0===t?void 0:t.pid,onPidUpdate:function(t){e.set({pid:t,viewId:t+"_"+Date.now(),actionId:void 0})}}),e.report.bind(e)),2),i=n[0],o=n[1];e.on("config",(function(){i(e.config().pid)})),e.on("beforeDestroy",o),e.provide("sendPageview",i)}}))}(t),t.loaded.push(Lq),function(e){e.on("init",(function(){var t=gq(e,Sq,bq);if(t){var r=!1,n=QH(zz(pq,JH(JH({},t),{hookCbAtReq:Eq(e),setTraceHeader:mq(t.trace)}),(function(t){return!r&&e.report(t)})),1)[0];e.on("beforeDestroy",(function(){r=!0})),e.provide("wrapXhr",n)}}))}(t),t.loaded.push(Sq),function(e){e.on("init",(function(){var t=gq(e,Oq,xq);if(t){var r=!1,n=QH(zz(Cq,JH(JH({},t),{hookCbAtReq:Eq(e),setTraceHeader:mq(t.trace)}),(function(t){return!r&&e.report(t)})),1)[0];e.on("beforeDestroy",(function(){r=!0})),e.provide("wrapFetch",n)}}))}(t),t.loaded.push(Oq),function(e){e.on("init",(function(){var t=gq(e,"tti",{});if(t){var r=e.pp||Gq;zz(Wq,JH(JH({},t),{precollect:r}),yq(e))}}))}(t),t.loaded.push("tti"),function(e){e.on("init",(function(){var t=gq(e,"fmp",Zq);if(t){var r=QH(zz(Qq,t,yq(e)),1)[0];Qz((function(){return setTimeout(r,200)}))}}))}(t),t.loaded.push("fmp"),t}(),GX=Oz();GX&&(BX=jX,"addEventListener"in(FX=GX)&&(BX.pcErr=function(e){var t=(e=e||FX.event).target||e.srcElement||{};t instanceof Element||t instanceof HTMLElement?BX(UX,"st",{tagName:t.tagName,url:t.getAttribute("href")||t.getAttribute("src")}):BX(UX,"err",e.error||e.message)},BX.pcRej=function(e){e=e||FX.event,BX(UX,"err",e.reason||e.detail&&e.detail.reason)},FX.addEventListener("error",BX.pcErr,!0),FX.addEventListener("unhandledrejection",BX.pcRej,!0),setTimeout((function(){FX.removeEventListener("error",BX.pcErr,!0),FX.removeEventListener("unhandledrejection",BX.pcRej,!0)}),VX)),"PerformanceObserver"in FX&&"PerformanceLongTaskTiming"in FX&&(BX.pp={entries:[]},BX.pp.observer=new PerformanceObserver((function(e){BX.pp.entries=BX.pp.entries.concat(e.getEntries())})),BX.pp.observer.observe({entryTypes:["longtask","largest-contentful-paint","layout-shift"]}),setTimeout((function(){BX.pp.observer.disconnect()}),VX)));var HX,zX;wP()||window.__rtc_slardar__||((HX=LX())("init",{bid:"webrtc",integrations:[{name:MH,setup:function(e){!function(e){e.on("init",(function(){var t,r=yH(e,MH,LH);if(r){var n=ZG(_H(PH,QG(QG({},r),{initPid:null===(t=e.config())||void 0===t?void 0:t.pid,onPidUpdate:function(t){e.set({pid:t,viewId:t+"_"+Date.now(),actionId:void 0})}}),e.report.bind(e)),2),i=n[0],o=n[1];e.on("config",(function(){i(e.config().pid)})),e.on("beforeDestroy",o),e.provide("sendPageview",i)}}))}(e)}},{name:NH,setup:function(e){!function(e){e.on("init",(function(){window.removeEventListener("error",e.pcErr,!0),window.removeEventListener("unhandledrejection",e.pcRej,!0);var t=yH(e,NH,DH);if(t){var r=ZG(_H(xH,t,(function(t){e.getBreadcrumbs&&(t.payload.breadcrumbs=e.getBreadcrumbs()),e.report(t)})),2),n=r[0],i=r[1];e.on("beforeDestroy",i),e.provide("captureException",n)}}))}(e)}},(zX={screenshot:!0},{name:XH,setup:function(e){WH(e,zX)}})]}),HX("start"),window.__rtc_slardar__=HX);var qX,XX=new(function(){function e(){u(this,e)}return d(e,[{key:"setStats",value:function(e){!wP()&&HX&&Object.keys(e).forEach((function(t){HX("context.set",t,e[t])}))}}]),e}()),KX=function(){function e(t,r){u(this,e),l(this,"_audioEventSessionId",PP()),l(this,"_videoEventSessionId",PP()),l(this,"_handler",void 0),l(this,"_stream",void 0),l(this,"_firstAudioFrameTimer",void 0),l(this,"_firstVideoFrameTimer",void 0),l(this,"_transportDelayInterval",void 0),l(this,"_transportDelay",void 0),l(this,"_firstVideoFrameInterval",void 0),l(this,"_firstAudioFrameInterval",void 0),l(this,"_isScreen",!1),l(this,"_audioFirstFrameState",0),l(this,"_videoFirstFrameState",0),l(this,"_timeout",1e4),l(this,"_currentAudioRecv",{startTime:0,eventSessionId:0,type:DV.LOGIN}),l(this,"_currentVideoRecv",{startTime:0,eventSessionId:0,type:DV.LOGIN}),l(this,"_login",!1),l(this,"_unMuteAudio",!1),l(this,"_enableAudio",!1),l(this,"_unMuteVideo",!1),l(this,"_enableVideo",!1),l(this,"_remoteUnmuteAudio",!1),l(this,"_remoteUnmuteVideo",!1),l(this,"_audioExternal",!1),l(this,"_pushAudio",!1),l(this,"_videoExternal",!1),l(this,"_pushVideo",!1),l(this,"_autoSubscribeVideo",!1),l(this,"_autoSubscribeAudio",!1),l(this,"_autoSubscribe",!1),l(this,"_publishVideo",!1),l(this,"_publishAudio",!1),l(this,"_subscribeAudio",!1),l(this,"_subscribeVideo",!1),l(this,"_subscribe",!1),l(this,"_pushTrack",!1),l(this,"_multiChatMode",!1),this._stream=t,this._handler=r,this.getTransportDelay()}var t,r,n,i;return d(e,[{key:"beginRecvFrame",value:(i=s(regeneratorRuntime.mark((function e(t,r){var n,i,o,a,s,u,c,d,l,h,f,p,v,_=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getTransportDelay();case 2:n=this._transportDelay,i=!0,o=DV.LOGIN,a=DV.UNMUTE,s=DV.SUBSCRIBE,u=DV.PUSH_TRACK,[o,a,s,u].indexOf(r)>=0&&(n=0,i=!1),t===NV.AUDIO?(i||this._audioEventSessionId++,this._currentAudioRecv={startTime:Date.now(),eventSessionId:this._audioEventSessionId,type:r},l={media_type:t,event_type:xV.BEGIN_RECV,type:r,start:null===(c=this._currentAudioRecv)||void 0===c?void 0:c.startTime,event_session_id:this._audioEventSessionId,stream_user_id:null===(d=this._stream)||void 0===d?void 0:d.userId,transport_delay:n},this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),this._firstAudioFrameTimer=window.setTimeout((function(){_.stopRecvFrame(NV.AUDIO,PV.TIMEOUT),_._firstAudioFrameInterval&&window.clearInterval(_._firstAudioFrameInterval)}),this._timeout),HV.rtcFirstFrame(l),this._watchForFirstAudioFrameRecv(),this._audioFirstFrameState=1,this._login=!0,this._unMuteAudio=!0,this._enableAudio=!0,this._remoteUnmuteAudio=!0):t===NV.VIDEO&&(i||this._videoEventSessionId++,this._currentVideoRecv={startTime:Date.now(),eventSessionId:this._videoEventSessionId,type:r},v={media_type:null!==(h=this._stream)&&void 0!==h&&h.isScreen?NV.SCREEN_VIDEO:t,event_type:xV.BEGIN_RECV,type:r,start:null===(f=this._currentVideoRecv)||void 0===f?void 0:f.startTime,event_session_id:this._videoEventSessionId,stream_user_id:null===(p=this._stream)||void 0===p?void 0:p.userId,transport_delay:n},this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),this._firstVideoFrameTimer=window.setTimeout((function(){_.stopRecvFrame(NV.VIDEO,PV.TIMEOUT),_._firstVideoFrameInterval&&window.clearInterval(_._firstVideoFrameInterval)}),this._timeout),this._watchForFirstVideoFrameRecv(),HV.rtcFirstFrame(v),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===NV.AUDIO){var r,n,i;if(1!==this._audioFirstFrameState)return;var o={event_type:xV.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,HV.rtcFirstFrame(o),this._audioFirstFrameState=2}else if(e===NV.VIDEO){var a,s,u,c;if(1!==this._videoFirstFrameState)return;var d={event_type:xV.RECV_END,media_type:null!==(a=this._stream)&&void 0!==a&&a.isScreen?NV.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,HV.rtcFirstFrame(d),this._videoFirstFrameState=2}}},{key:"recvFrameFinish",value:(n=s(regeneratorRuntime.mark((function e(t){var r,n,i,o,a,s,u,c,d,l,h,f,p,v,_,m;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getTransportDelay();case 2:if(r=this._transportDelay,n=DV.LOGIN,i=DV.UNMUTE,o=DV.SUBSCRIBE,a=DV.PUSH_TRACK,t!==NV.AUDIO){e.next=18;break}if(1===this._audioFirstFrameState){e.next=7;break}return e.abrupt("return");case 7:if(this._currentAudioRecv){e.next=9;break}return e.abrupt("return");case 9:u=this._currentAudioRecv,c=u.type,d=u.startTime,[n,i,o,a].indexOf(c)>=0&&(r=0),l={event_type:xV.RECV_END,media_type:t,start:d,result:!0,stream_user_id:null===(s=this._stream)||void 0===s?void 0:s.userId,event_session_id:this._audioEventSessionId,type:c,transport_delay:r},delete this._currentAudioRecv,this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),HV.rtcFirstFrame(l),this._audioFirstFrameState=3,e.next=30;break;case 18:if(t!==NV.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:p=this._currentVideoRecv,v=p.type,_=p.startTime,[n,i,o,a].indexOf(v)>=0&&(r=0),m={event_type:xV.RECV_END,media_type:null!==(h=this._stream)&&void 0!==h&&h.isScreen?NV.SCREEN_VIDEO:t,start:_,result:!0,stream_user_id:null===(f=this._stream)||void 0===f?void 0:f.userId,event_session_id:this._videoEventSessionId,type:v,transport_delay:r},delete this._currentVideoRecv,this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),HV.rtcFirstFrame(m),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(NV.AUDIO,DV.LOGIN),e&&null!==(r=this._stream)&&void 0!==r&&r.hasVideo&&o.video&&this.beginRecvFrame(NV.VIDEO,DV.LOGIN),!e&&null!==(n=this._stream)&&void 0!==n&&n.hasAudio&&this.stopRecvFrame(NV.AUDIO,PV.LEAVE_ROOM),!e&&null!==(i=this._stream)&&void 0!==i&&i.hasVideo&&this.stopRecvFrame(NV.VIDEO,PV.LEAVE_ROOM))}},{key:"setUnmuteAudio",value:function(e){var t;this._unMuteAudio!==e&&(this._unMuteAudio=e,this._unMuteAudio?this.beginRecvFrame(NV.AUDIO,DV.UNMUTE):null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(NV.AUDIO,PV.MUTE))}},{key:"setRemoteUnmuteAudio",value:function(e){var t;this._remoteUnmuteAudio!==e&&(this._remoteUnmuteAudio=e,this._remoteUnmuteAudio?this.beginRecvFrame(NV.AUDIO,DV.REMOTE_UNMUTE):null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(NV.AUDIO,PV.REMOTE_MUTE))}},{key:"setEnableAudio",value:function(e){var t;this._enableAudio!==e&&(this._enableAudio=e,this._enableAudio?this.beginRecvFrame(NV.AUDIO,DV.ENABLE):null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(NV.AUDIO,PV.DISABLE))}},{key:"setUnmuteVideo",value:function(e){var t;this._unMuteVideo!==e&&(this._unMuteVideo=e,this._unMuteVideo?this.beginRecvFrame(NV.VIDEO,DV.UNMUTE):null!==(t=this._stream)&&void 0!==t&&t.hasVideo&&this.stopRecvFrame(NV.VIDEO,PV.MUTE))}},{key:"setRemoteUnmuteVideo",value:function(e){var t;this._remoteUnmuteVideo!==e&&(this._remoteUnmuteVideo=e,this._remoteUnmuteVideo?this.beginRecvFrame(NV.VIDEO,DV.REMOTE_UNMUTE):null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(NV.VIDEO,PV.REMOTE_MUTE))}},{key:"setEnableVideo",value:function(e){this._enableVideo!==e&&(this._enableVideo=e,this._enableVideo?this.beginRecvFrame(NV.VIDEO,DV.ENABLE):this.stopRecvFrame(NV.VIDEO,PV.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(NV.AUDIO,DV.PUSH),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.beginRecvFrame(NV.AUDIO,DV.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(NV.VIDEO,DV.PUSH),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasVideo&&this.beginRecvFrame(NV.VIDEO,DV.PUSH)}},{key:"setPublishVideo",value:function(e){var t;this._publishVideo!==e&&(this._publishVideo=e),this._publishVideo&&this.beginRecvFrame(NV.VIDEO,DV.PUBLISH),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasVideo&&this.stopRecvFrame(NV.VIDEO,PV.UNPUBLISH)}},{key:"setPublishAudio",value:function(e){var t;this._publishAudio!==e&&(this._publishAudio=e),this._publishAudio&&this.beginRecvFrame(NV.AUDIO,DV.PUBLISH),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(NV.AUDIO,PV.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(NV.AUDIO,DV.SUBSCRIBE));!e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(NV.AUDIO,PV.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(NV.VIDEO,DV.SUBSCRIBE));!e&&null!==(t=this._stream)&&void 0!==t&&t.hasVideo&&this.stopRecvFrame(NV.VIDEO,PV.UNSUBSCRIBE)}},{key:"setPushTrack",value:function(e){var t;this._pushTrack!==e&&(e&&!this._isScreen&&this.beginRecvFrame(NV.AUDIO,DV.PUSH_TRACK),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(NV.AUDIO,PV.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(s(regeneratorRuntime.mark((function n(){var i,o,a,s,u,c,d,l;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(null===(i=e._handler)||void 0===i||!i.pc||null===(o=e._stream)||void 0===o||null===(a=o.videoTrack)||void 0===a||!a.getTrack()){n.next=12;break}return n.next=3,QF(null===(s=e._handler)||void 0===s?void 0:s.pc,null===(u=e._stream)||void 0===u||null===(c=u.videoTrack)||void 0===c?void 0:c.getTrack());case 3:if(d=n.sent,!(l=d.find((function(e){return"inbound-rtp"===e.type})))||!(l.framesReceived>t||l.packetsReceived>r)){n.next=12;break}if(-1!==t||-1!==r){n.next=10;break}return t=l.framesReceived,r=l.packetsReceived,n.abrupt("return");case 10:e.recvFrameFinish(NV.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(s(regeneratorRuntime.mark((function n(){var i,o,a,s,u,c,d,l;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(null===(i=e._handler)||void 0===i||!i.pc||null===(o=e._stream)||void 0===o||null===(a=o.audioTrack)||void 0===a||!a.getTrack()){n.next=12;break}return n.next=3,QF(null===(s=e._handler)||void 0===s?void 0:s.pc,null===(u=e._stream)||void 0===u||null===(c=u.audioTrack)||void 0===c?void 0:c.getTrack());case 3:if(d=n.sent,!(l=d.find((function(e){return"inbound-rtp"===e.type})))||!(l.totalSamplesReceived>t||l.packetsReceived>r)){n.next=12;break}if(-1!==t||-1!==r){n.next=10;break}return t=l.totalSamplesReceived,r=l.packetsReceived,n.abrupt("return");case 10:e.recvFrameFinish(NV.AUDIO),window.clearInterval(e._firstAudioFrameInterval);case 12:case"end":return n.stop()}}),n)}))),200)}},{key:"getTransportDelay",value:(r=s(regeneratorRuntime.mark((function e(){var t=this;return regeneratorRuntime.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(s(regeneratorRuntime.mark((function e(){return regeneratorRuntime.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=s(regeneratorRuntime.mark((function e(){var t,r,n,i,o;return regeneratorRuntime.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,QF(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})),(o=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*o.currentRoundTripTime/2));case 7:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"reset",value:function(){this._currentAudioRecv={startTime:0,eventSessionId:0,type:DV.LOGIN},this._currentVideoRecv={startTime:0,eventSessionId:0,type:DV.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}(),WX=function(){function e(t,r){u(this,e),l(this,"_audioEventSessionId",PP()),l(this,"_videoEventSessionId",PP()),l(this,"_pcSessionId",void 0),l(this,"_handler",void 0),l(this,"_firstAudioFrameTimer",void 0),l(this,"_firstVideoFrameTimer",void 0),l(this,"_stream",void 0),l(this,"_firstVideoFrameInterval",void 0),l(this,"_firstAudioFrameInterval",void 0),l(this,"_currentAudioSend",{startTime:0,eventSessionId:0,type:DV.LOGIN}),l(this,"_currentVideoSend",{startTime:0,eventSessionId:0,type:DV.LOGIN}),l(this,"_login",!1),l(this,"_publisher",!1),l(this,"_unMuteAudio",!1),l(this,"_enableAudio",!1),l(this,"_unMuteVideo",!1),l(this,"_enableVideo",!1),l(this,"_audioExternal",!1),l(this,"_pushAudio",!1),l(this,"_videoExternal",!1),l(this,"_pushVideo",!1),l(this,"_autoPublish",!1),l(this,"_publish",!1),l(this,"_timeout",1e4),l(this,"_audioFirstFrameState",0),l(this,"_videoFirstFrameState",0),this._stream=t,this._handler=r}var t,r;return d(e,[{key:"beginSendFrame",value:function(e,t){var r=this;if(e===NV.AUDIO){var n;this._audioEventSessionId++,this._currentAudioSend={startTime:Date.now(),eventSessionId:this._audioEventSessionId,type:t};var i={media_type:e,event_type:xV.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(NV.AUDIO,PV.TIMEOUT),r._firstAudioFrameInterval&&window.clearInterval(r._firstAudioFrameInterval)}),this._timeout),HV.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===NV.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?NV.SCREEN_VIDEO:e,event_type:xV.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(NV.VIDEO,PV.TIMEOUT),r._firstVideoFrameInterval&&window.clearInterval(r._firstVideoFrameInterval)}),this._timeout),this._watchForFirstVideoFrameSend(),HV.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===NV.AUDIO){var r,n;if(1!==this._audioFirstFrameState)return;var i={event_type:xV.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,HV.rtcFirstFrame(i),this._audioFirstFrameState=2}else if(e===NV.VIDEO){var o,a,s;if(1!==this._videoFirstFrameState)return;var u={event_type:xV.SENT_END,media_type:null!==(o=this._stream)&&void 0!==o&&o.isScreen?NV.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,HV.rtcFirstFrame(u),this._videoFirstFrameState=2}}},{key:"sendFrameFinish",value:function(e){if(e===NV.AUDIO){if(1!==this._audioFirstFrameState)return;if(!this._currentAudioSend)return;var t=this._currentAudioSend,r=t.type,n=t.startTime,i={event_type:xV.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),HV.rtcFirstFrame(i),this._audioFirstFrameState=3}else if(e===NV.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:xV.SENT_END,media_type:null!==(o=this._stream)&&void 0!==o&&o.isScreen?NV.SCREEN_VIDEO:e,start:u,result:!0,event_session_id:this._videoEventSessionId,type:s};delete this._currentVideoSend,this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),HV.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(NV.VIDEO,DV.LOGIN),null!==(r=this._stream)&&void 0!==r&&r.audioTrack&&this.beginSendFrame(NV.AUDIO,DV.LOGIN);!e&&this._audioSending&&this.stopSendFrame(NV.AUDIO,PV.LEAVE_ROOM),!e&&this._videoSending&&this.stopSendFrame(NV.VIDEO,PV.LEAVE_ROOM)}}},{key:"setPublish",value:function(e){if(this._publish!==e){var t,r;if(this._publish=e,e)(null===(t=this._stream)||void 0===t?void 0:t.videoTrack)&&this.beginSendFrame(NV.VIDEO,DV.PUBLISH),(null===(r=this._stream)||void 0===r?void 0:r.audioTrack)&&this.beginSendFrame(NV.AUDIO,DV.PUBLISH);!e&&this._audioSending&&this.stopSendFrame(NV.AUDIO,PV.UNPUBLISH),!e&&this._videoSending&&this.stopSendFrame(NV.VIDEO,PV.UNPUBLISH)}}},{key:"setUnmuteAudio",value:function(e){this._unMuteAudio!==e&&(this._unMuteAudio=e,e&&this.beginSendFrame(NV.AUDIO,DV.UNMUTE),!e&&this._audioSending&&this.stopSendFrame(NV.AUDIO,PV.MUTE))}},{key:"setEnableAudio",value:function(e){this._enableAudio!==e&&(this._enableAudio=e,e&&this.beginSendFrame(NV.AUDIO,DV.ENABLE),!e&&this._audioSending&&this.stopSendFrame(NV.AUDIO,PV.DISABLE))}},{key:"setUnmuteVideo",value:function(e){this._unMuteVideo!==e&&(this._unMuteVideo=e,e&&this.beginSendFrame(NV.VIDEO,DV.UNMUTE),!e&&this._videoSending&&this.stopSendFrame(NV.VIDEO,PV.MUTE))}},{key:"setEnableVideo",value:function(e){this._enableVideo!==e&&(this._enableVideo=e,e&&this.beginSendFrame(NV.VIDEO,DV.ENABLE),!e&&this._videoSending&&this.stopSendFrame(NV.VIDEO,PV.DISABLE))}},{key:"setExternalAudioSource",value:function(e){this._audioExternal!==e&&(this._audioExternal=e,e&&(this._audioSending&&this.stopSendFrame(NV.AUDIO,PV.DISABLE),this._enableAudio=!1),e||(this._audioSending&&this.stopSendFrame(NV.AUDIO,PV.STOP_PUSH),this._pushAudio=!1))}},{key:"setPushAudio",value:function(e){this._pushAudio!==e&&(this._pushAudio=e,e&&this.beginSendFrame(NV.AUDIO,DV.PUSH),!e&&this._audioSending&&this.stopSendFrame(NV.AUDIO,PV.STOP_PUSH))}},{key:"setExternalVideoSource",value:function(e){this._videoExternal!==e&&(this._videoExternal=e,e&&(this._videoSending&&this.stopSendFrame(NV.VIDEO,PV.DISABLE),this._enableVideo=!1),e||(this._videoSending&&this.stopSendFrame(NV.VIDEO,PV.STOP_PUSH),this._pushVideo=!1))}},{key:"setPushVideo",value:function(e){this._pushVideo!==e&&(this._pushVideo=e,e&&this.beginSendFrame(NV.VIDEO,DV.PUSH),!e&&this._videoSending&&this.stopSendFrame(NV.VIDEO,PV.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(NV.AUDIO,PV.AUDIENCE),!e&&this._videoSending&&this.stopSendFrame(NV.VIDEO,PV.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=s(regeneratorRuntime.mark((function e(){var t,r,n,i,o,a,s,u;return regeneratorRuntime.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,QF(null===(i=this._handler)||void 0===i?void 0:i.pc,null===(o=this._stream)||void 0===o||null===(a=o.videoTrack)||void 0===a?void 0:a.getTrack("preprocessing"));case 3:return s=e.sent,u=s.find((function(e){return"outbound-rtp"===e.type})),e.abrupt("return",u);case 6:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"_getFirstAudioFrameStats",value:(t=s(regeneratorRuntime.mark((function e(){var t,r,n,i,o,a,s,u;return regeneratorRuntime.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,QF(null===(i=this._handler)||void 0===i?void 0:i.pc,null===(o=this._stream)||void 0===o||null===(a=o.audioTrack)||void 0===a?void 0:a.getTrack("preprocessing"));case 3:return s=e.sent,u=s.find((function(e){return"outbound-rtp"===e.type})),e.abrupt("return",u);case 6:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"_watchForFirstVideoFrameSend",value:function(){var e=this,t=-1,r=-1;this._firstVideoFrameInterval=window.setInterval(s(regeneratorRuntime.mark((function n(){var i;return regeneratorRuntime.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(NV.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(s(regeneratorRuntime.mark((function r(){var n;return regeneratorRuntime.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(NV.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:DV.LOGIN},this._currentVideoSend={startTime:0,eventSessionId:0,type:DV.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}(),YX=(l(qX={},"audio",{delay:1200,stallRadio:.3}),l(qX,"video",{delay:1200,stallRadio:.6}),l(qX,"screen_audio",{delay:1600,stallRadio:.8}),l(qX,"screen_video",{delay:1600,stallRadio:.8}),qX),JX=function(){function e(){u(this,e),l(this,"_preUplinkStats",new Map),l(this,"_preDownlinkStats",new Map),l(this,"_timer",void 0),l(this,"_delayTimer",void 0),l(this,"_connectionState",XG.CONNECTED),l(this,"reportor",void 0)}return d(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(E(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(E(_),[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=X.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",g=this._getQosLevel(l,h||0,u._retransmittedRate||0),y=this._getDownlinkQoE(m,_,v);r=this._getNetworkQuality(g,y)}if(a)if(0===u.receivedKBitrate||0===u.rtt)n=X.VBAD;else{var S=u.rtt,b=u.videoLossRate,R=u.stallDuration,k=u.statsInterval,T=u.e2eDelay,I=u._retransmittedRate,A=R/k,w=c?"screen_video":"video",C=this._getQosLevel(S,b||0,I||0),O=this._getDownlinkQoE(w,A,T);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(E(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!==XG.CONNECTED)e=t=X.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")||X.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)||X.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=YX[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=X.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,E(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&&BP(t)&&r.localaudio&&r.audiostream,videoActive:n&&jP(t)&&r.localvideo&&r.videostream}}}]),e}(),QX=function(){function e(t){u(this,e),l(this,"_timer",void 0),l(this,"_remoteVideoSizeCache",{}),l(this,"_remoteScreenSizeCache",{}),l(this,"onchange",void 0),this._room=t,this._start()}return d(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}(),ZX=new pM("SubscribeFallbackManager",2),$X=1e4,eK=function(){function e(t){u(this,e),l(this,"_preDownlinkNetworkQuality",[]),l(this,"_isSubscribeFallbackOrRecover",!1),l(this,"_inSubscribeRecoverChecking",!1),l(this,"_subRecoverCheckTimer",void 0),l(this,"_forbidSubRecover",!1),l(this,"_forbidSubRecoverTimer",void 0),l(this,"_forbidSubRecoverDuration",$X),l(this,"onSubscribeFallback",void 0),this._room=t}var t;return d(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===X.BAD||e===X.VBAD}))&&this._startForbidSubRecover(),this._preDownlinkNetworkQuality.slice(-3).reduce((function(e,t){return e+t}),0)>3*X.POOR&&this._subscribeFallbackOrRecover("fallback"),!this._forbidSubRecover&&10===this._preDownlinkNetworkQuality.length&&this._preDownlinkNetworkQuality.every((function(e){return e===X.EXCELLENT}))&&this._subscribeFallbackOrRecover("recover")}},{key:"destroy",value:function(){this._stopSubscribeRecoverCheck(),this._stopForbidSubRecover(),delete this.onSubscribeFallback}},{key:"_subscribeFallbackOrRecover",value:(t=s(regeneratorRuntime.mark((function e(t){var r,n,i,o,a,s,u,c,d,l,h=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._isSubscribeFallbackOrRecover&&this._room.connectionState===XG.CONNECTED){e.next=2;break}return e.abrupt("return");case 2:if(this._room.subscribeFallbackOption!==z.AUDIO_ONLY&&this._room.subscribeFallbackOption!==z.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(h._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(ZX.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)||[],o=b(i,1),!(a=o[0])){e.next=24;break}return s=a.stream,u=a.fallbackOrRecoverOption,this._isSubscribeFallbackOrRecover=!0,c=s.subLayer.spatialLayer,d=s.subVideo,ZX.print("_subscribeFallbackOrRecover()","".concat(s.userId,"'s stream will be ").concat(t," to: MediaType=").concat(u[0]," subState=").concat(u[1]," subLayer=").concat(u[2])),e.prev=15,e.next=18,VP([(l=this._room).updateSubTrack.apply(l,[s].concat(E(u))).then((function(){"recover"===t?h._startSubscribeRecoverCheck():ZX.print("_subscribeFallbackOrRecover()","fallback success."),"function"==typeof h.onSubscribeFallback&&h.onSubscribeFallback({userId:s.userId,isScreen:s.isScreen,beforeEnable:d,beforeVideoIndex:c,afterEnable:s.subVideo,afterVideoIndex:s.subLayer.spatialLayer,reason:"fallback"===t?K.SubscribeFallbackByBandwidth:K.SubscribeRecoverByBandwidth})})),OP(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=$X,delete e._subRecoverCheckTimer,ZX.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),ZX.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}(),tK=new pM("Room",1),rK=function(e){h(P,e);var t,r,n,o,a,c,f,p,v,m,y,S,E,R,k,I,A,C,O,x,D=g(P);function P(e,t){var r;return u(this,P),l(_(r=D.call(this)),"_mediaServerClient",void 0),l(_(r),"_localStream",void 0),l(_(r),"_localScreenStream",void 0),l(_(r),"_remoteUsers",new Map),l(_(r),"_remoteStreams",new Map),l(_(r),"_joinResolveCallback",void 0),l(_(r),"_joinRejectCallback",void 0),l(_(r),"_getAccessNode",void 0),l(_(r),"_getAccessFeedback",void 0),l(_(r),"_getAccessFeedbackIceNode",void 0),l(_(r),"_reconnectTimer",void 0),l(_(r),"_isReconnecting",void 0),l(_(r),"_context",void 0),l(_(r),"_sessionId",void 0),l(_(r),"_reconnectRecord",void 0),l(_(r),"_connectionLostTimer",void 0),l(_(r),"_liveControlMessage",void 0),l(_(r),"_serverConfig",void 0),l(_(r),"_roomConfig",void 0),l(_(r),"_roomInfo",void 0),l(_(r),"_waitForNewToken",!1),l(_(r),"_userDuplicateLoginTimerMap",new Map),l(_(r),"_networkQualityManager",void 0),l(_(r),"userPriorityMap",void 0),l(_(r),"subscribeFallbackOption",void 0),l(_(r),"_videoSizeObserver",void 0),l(_(r),"_subFallbackManager",void 0),l(_(r),"_hasPublished",!1),r._roomConfig=e,r._mediaServerClient=new WG(t),r._reconnectRecord=new nK,r._addHandlerEventHandler(),r._isReconnecting=!1,r._networkQualityManager=new JX,r._networkQualityManager.reportor=r._reportNetworkQuality.bind(_(r)),r._videoSizeObserver=new QX(_(r)),r._videoSizeObserver.onchange=r._emitVideoSizeChange.bind(_(r)),r._subFallbackManager=new eK(_(r)),r._subFallbackManager.onSubscribeFallback=r._emitSubscribeFallback.bind(_(r)),r._context=t,r}return d(P,[{key:"hasScreenPublished",get:function(){var e;return null===(e=this._localScreenStream)||void 0===e?void 0:e.hasPublished}},{key:"hasPublished",get:function(){var e;return null===(e=this._localStream)||void 0===e?void 0:e.hasPublished}},{key:"connectionState",get:function(){return this._mediaServerClient.connectionState}},{key:"remoteUsers",get:function(){return this._remoteUsers}},{key:"remoteStreams",get:function(){return this._remoteStreams}},{key:"localStream",get:function(){return this._localStream}},{key:"localScreenStream",get:function(){return this._localScreenStream}},{key:"roomInfo",get:function(){return this._roomInfo}},{key:"_addHandlerEventHandler",value:function(){var e,t,r,n,i,o,a,s,u,c,d,l,h,f,p,v,_,m,g,y,S,b,E,R,k,T=this;null===(e=this._mediaServerClient)||void 0===e||e.on(RF.ON_ADD_STREAM,this._onAddStream.bind(this)),null===(t=this._mediaServerClient)||void 0===t||t.on(RF.ON_REMOVE_STREAM,this._onRemoveStream.bind(this)),null===(r=this._mediaServerClient)||void 0===r||r.on(RF.USER_CONNECTION,this._onUserConnection.bind(this)),null===(n=this._mediaServerClient)||void 0===n||n.on(RF.USER_DISCONNECTION,this._onUserDisconnection.bind(this)),null===(i=this._mediaServerClient)||void 0===i||i.on(RF.ON_UPDATE_ROOM_ATTRIBUTES,this._onUpdateRoomAttributes.bind(this)),null===(o=this._mediaServerClient)||void 0===o||o.on(RF.ON_UPDATE_USER_ATTRIBUTES,this._onUpdateUserAttributes.bind(this)),null===(a=this._mediaServerClient)||void 0===a||a.on(RF.ON_UPDATE_STREAM_ATTRIBUTES,this._onUpdateStreamAttributes.bind(this)),null===(s=this._mediaServerClient)||void 0===s||s.on(RF.ON_PUSH_TRACK,this._onPushTrack.bind(this)),null===(u=this._mediaServerClient)||void 0===u||u.on(RF.ON_REMOVE_TRACK,this._onRemoveTrack.bind(this)),null===(c=this._mediaServerClient)||void 0===c||c.on(RF.NODE_CHANGE,this._nodeChange.bind(this)),null===(d=this._mediaServerClient)||void 0===d||d.on(RF.ON_CUSTOM_MESSAGE,this._onCustomMessage.bind(this)),null===(l=this._mediaServerClient)||void 0===l||l.on(RF.USER_MESSAGE_RECEIVED,this._onUserMessageReceived.bind(this)),null===(h=this._mediaServerClient)||void 0===h||h.on(RF.USER_BINARY_MESSAGE_RECEIVED,this._onUserBinaryMessageReceived.bind(this)),null===(f=this._mediaServerClient)||void 0===f||f.on(RF.POST_PROCESSING_MESSAGE,this._onPostProcessingMessage.bind(this)),null===(p=this._mediaServerClient)||void 0===p||p.on(RF.ON_USER_TOKEN_WILL_EXPIRE,this._onUserTokenWillExpire.bind(this)),null===(v=this._mediaServerClient)||void 0===v||v.on(RF.STREAM_CONTROL_MESSAGE,this._onStreamControlMessage.bind(this)),null===(_=this._mediaServerClient)||void 0===_||_.on(RF.ON_SCENE_CONFIG,this._onSceneConfig.bind(this)),null===(m=this._mediaServerClient)||void 0===m||m.on(kF.RSCP,this._onPublishOnDemand.bind(this)),null===(g=this._mediaServerClient)||void 0===g||g.on(kF.RTT,this._onRTT.bind(this)),null===(y=this._mediaServerClient)||void 0===y||y.on(TF.ON_CONNECTION_STATE_CHANGE,this._onConnectionStateChange.bind(this)),null===(S=this._mediaServerClient)||void 0===S||S.on(TF.ABNORMAL_DISCONNECTION,this._handleAbnormalDisconnection.bind(this)),null===(b=this._mediaServerClient)||void 0===b||b.on("onRemoteStreamStats",(function(e){T._networkQualityManager.updateDownlinkStats(e,T._findRemoteStreamByScreen(e.userId,e.isScreen)),T.emit(mG.ON_REMOTE_STREAM_STATS,GP(e))})),null===(E=this._mediaServerClient)||void 0===E||E.on("onLocalStreamStats",(function(e){T._networkQualityManager.updateUplinkStats(e),T.emit(mG.ON_LOCAL_STREAM_STATS,GP(e))})),null===(R=this._mediaServerClient)||void 0===R||R.on("prevIceNode",(function(e){T._getAccessFeedbackIceNode=e})),null===(k=this._mediaServerClient)||void 0===k||k.on("prevIceNode",(function(e){T._getAccessFeedbackIceNode=e}))}},{key:"_removeHandlerEventHandler",value:function(){var e;null===(e=this._mediaServerClient)||void 0===e||e.removeAllListeners()}},{key:"join",value:(x=s(regeneratorRuntime.mark((function e(t,r,n,i,o,a,s){var u=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return XV.setStats({rtc_app_id:t,room_id:r,user_id:i.userId}),XX.setStats({rtc_session_id:t,rtc_room_id:r}),tK.print("join()"),e.abrupt("return",new Promise((function(e,c){var d,l,h=IP();u._joinResolveCallback=function(t){var r;HV.joinRoom(LV.END,h,!0,"",{enable_cloud_proxy:null===(r=u._roomInfo)||void 0===r?void 0:r.useCloudProxy}),e(t)},u._joinRejectCallback=function(e){var t;HV.joinRoom(LV.END,h,!1,e.message,{enable_cloud_proxy:null===(t=u._roomInfo)||void 0===t?void 0:t.useCloudProxy}),c(e)},u._liveControlMessage=o,u._roomInfo={appId:t,roomId:r,token:n,userInfo:i,useCloudProxy:a,roomProfile:u._roomConfig.roomProfileType,expectedIDC:s},u.setSessionId(),HV.joinRoom(LV.BEGIN,h,!1,"",{enable_cloud_proxy:null===(d=u._roomInfo)||void 0===d?void 0:d.useCloudProxy,expectedIDC:null===(l=u._roomInfo)||void 0===l?void 0:l.expectedIDC}),u._join(u._joinResolveCallback,u._joinRejectCallback,!1)})));case 4:case"end":return e.stop()}}),e)}))),function(e,t,r,n,i,o,a){return x.apply(this,arguments)})},{key:"_join",value:(O=s(regeneratorRuntime.mark((function e(t,r){var n,i,o,a=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=a.length>2&&void 0!==a[2]&&a[2],i=IP(),tK.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:o=e.sent,this._mediaServerClient.roomAttributes=o.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:o.clients,streams:o.streams}),this._isReconnecting=!1,HV.rtcJoinRoom(0,"web","web",IP()-i),this._onJoinSucc(o,n),e.next=23;break;case 19:if(e.prev=19,e.t0=e.catch(3),e.t0.code===lD.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 O.apply(this,arguments)})},{key:"publishScreen",value:(C=s(regeneratorRuntime.mark((function e(t,r,n,i,o){var a,s,u,c,d,l,h,f,p,v;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(tK.print("publishScreen()"),this._localScreenStream||(this._localScreenStream=new RG,this._localScreenStream.isScreen=!0,this._mediaServerClient.handler&&(this._localScreenStream.observer=new WX(this._localScreenStream,this._mediaServerClient.handler))),a=!1,s=!1,u=!1,c=!1,!this._localScreenStream.videoTrack&&r?(r instanceof Oj&&(s=!0),a=!0):this._localScreenStream.videoTrack&&!r&&(a=!1),!this._localScreenStream.audioTrack&&n?(n instanceof xj&&(c=!0),u=!0):this._localScreenStream.audioTrack&&!n&&(u=!1),this._localScreenStream.videoTrack=r,this._localScreenStream.audioTrack=n,this._localScreenStream.videoEncodeConfig=t,i&&(BP(i)&&(this._localScreenStream.pubAudio=o===yG.PUB),jP(i)&&(this._localScreenStream.pubVideo=o===yG.PUB),tK.print("publishScreen mediaType","pubAudio: %o, pubVideo: %o",this._localScreenStream.pubAudio,this._localScreenStream.pubVideo)),this._localScreenStream.pubAudio||this._localScreenStream.pubVideo){e.next=18;break}if(null===(d=this._localScreenStream)||void 0===d||!d.hasPublished){e.next=17;break}return e.abrupt("return",this.unpublishScreen());case 17:return e.abrupt("return");case 18:if(this._localScreenStream.hasPublished){e.next=24;break}return null===(l=this._localScreenStream.observer)||void 0===l||l.setPublish(!0),e.next=22,this._mediaServerClient.publish(this._localScreenStream);case 22:e.next=28;break;case 24:return s?null===(h=this._localScreenStream.observer)||void 0===h||h.setPushVideo(a):null===(f=this._localScreenStream.observer)||void 0===f||f.setEnableVideo(a),c?null===(p=this._localScreenStream.observer)||void 0===p||p.setPushAudio(u):null===(v=this._localScreenStream.observer)||void 0===v||v.setEnableAudio(u),e.next=28,this.updatePubScreenTrack();case 28:case"end":return e.stop()}}),e,this)}))),function(e,t,r,n,i){return C.apply(this,arguments)})},{key:"updatePubScreenTrack",value:(A=s(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(tK.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 A.apply(this,arguments)})},{key:"unpublishScreen",value:(I=s(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(tK.print("unpublish","Invoke unpublishScreen"),!this._localScreenStream){e.next=7;break}return null===(t=this._localScreenStream.observer)||void 0===t||t.setPublish(!1),e.next=5,this._mediaServerClient.unpublish(this._localScreenStream);case 5:this._localScreenStream.clean(),this._localScreenStream=void 0;case 7:case"end":return e.stop()}}),e,this)}))),function(){return I.apply(this,arguments)})},{key:"liveControlMessage",value:(k=s(regeneratorRuntime.mark((function e(t){var r,n=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return tK.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 k.apply(this,arguments)})},{key:"publicStreamControlMessage",value:(R=s(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.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 R.apply(this,arguments)})},{key:"updateUserAttributes",value:(E=s(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return tK.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 E.apply(this,arguments)})},{key:"publish",value:(S=s(regeneratorRuntime.mark((function e(t,r,n,i,o,a){var s,u,c,d,l,h,f,p,v,_,m,g,y=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s=y.length>6&&void 0!==y[6]&&y[6],tK.print("publish","Invoke publish"),u=!1,this._localStream||(this._localStream=new RG,this._mediaServerClient.handler&&(this._localStream.observer=new WX(this._localStream,this._mediaServerClient.handler)),u=!0),this._localStream.videoTrack=n,this._localStream.audioTrack=i,this._localStream.videoEncodeConfig=t,this._localStream.enableSimulcast=r,o&&(BP(o)&&(this._localStream.pubAudio=a===yG.PUB),jP(o)&&(this._localStream.pubVideo=a===yG.PUB),tK.print("publish mediaType","pubAudio: %o, pubVideo: %o",this._localStream.pubAudio,this._localStream.pubVideo)),this._localStream.hasPublished){e.next=26;break}if(this._localStream.pubAudio||this._localStream.pubVideo){e.next=12;break}return e.abrupt("return");case 12:return e.prev=12,s?null===(c=this._localStream.observer)||void 0===c||c.setLogin(!0):u&&(d=!!this._localStream.videoTrack,l=!!this._localStream.audioTrack,h=this._localStream.videoTrack instanceof Oj,f=this._localStream.audioTrack instanceof xj,this._roomConfig.isAutoPublish&&!this._hasPublished?(d&&(h?null===(p=this._localStream.observer)||void 0===p||p.setPushVideo(!0):null===(v=this._localStream.observer)||void 0===v||v.setEnableVideo(!0)),l&&(f?null===(_=this._localStream.observer)||void 0===_||_.setPushAudio(!0):null===(m=this._localStream.observer)||void 0===m||m.setEnableAudio(!0))):null===(g=this._localStream.observer)||void 0===g||g.setPublish(!0)),e.next=16,this._mediaServerClient.publish(this._localStream);case 16:this._hasPublished=!0,this.emit(mG.ON_PUBLISH_RESULT,{isScreen:!1,state:N.PUBLISH_SUCC}),e.next=24;break;case 20:throw e.prev=20,e.t0=e.catch(12),this.emit(mG.ON_PUBLISH_RESULT,{isScreen:!1,state:N.PUBLISH_FAIL}),e.t0;case 24:e.next=28;break;case 26:return e.next=28,this.updatePubTrack();case 28:case"end":return e.stop()}}),e,this,[[12,20]])}))),function(e,t,r,n,i,o){return S.apply(this,arguments)})},{key:"updatePubTrack",value:(y=s(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(tK.print("updatePubTrack","Invoke updatePubTrack"),!this._localStream){e.next=4;break}return e.next=4,this._mediaServerClient.updatePubTrack(this._localStream);case 4:case"end":return e.stop()}}),e,this)}))),function(){return y.apply(this,arguments)})},{key:"unpublish",value:(m=s(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(tK.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 m.apply(this,arguments)})},{key:"subscribe",value:(v=s(regeneratorRuntime.mark((function e(t,r,n){var i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return tK.print("subscribe","remoteStream %o",t),i=void 0,n&&(i=this._getSubLayer(n,t)),e.next=5,this._mediaServerClient.subscribe(t,r,i);case 5:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return v.apply(this,arguments)})},{key:"updateSubTrack",value:(p=s(regeneratorRuntime.mark((function e(t,r,n,i){var o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return tK.print("updateSubTrack","Invoke updateSubTrack"),e.abrupt("return",null===(o=this._mediaServerClient)||void 0===o?void 0:o.updateSubTrack(t,r,n,i));case 2:case"end":return e.stop()}}),e,this)}))),function(e,t,r,n){return p.apply(this,arguments)})},{key:"updateSubVideoConfig",value:(f=s(regeneratorRuntime.mark((function e(t,r){var n,i,o,a,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((a=this._findRemoteStreamByScreen(t,!1))&&a.hasSubscribed&&!((null==a||null===(n=a.attributes)||void 0===n||null===(i=n.videoDescriptions)||void 0===i?void 0:i.length)<=1)){e.next=3;break}return e.abrupt("return");case 3:return s=this._getSubLayer(r,a),a.originalStreamIndex=s.spatialLayer,e.abrupt("return",null===(o=this._mediaServerClient)||void 0===o?void 0:o.updateSubTrack(a,a.subMediaType,SG.SUB,s));case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return f.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,g=(m-h)/(m-d[l].width*d[l].height);_=g<.1?d[l-1]:d[l],l=g<.1?l-1:l}return a=null!==(r=null===(n=_)||void 0===n?void 0:n.sub_index)&&void 0!==r?r:-1,{spatialLayer:null!==(i=null===(o=_)||void 0===o?void 0:o.video_index)&&void 0!==i?i:l,spatialSubLayer:a}}},{key:"unsubscribe",value:(c=s(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return tK.print("unsubscribe","Invoke unsubscribe"),e.next=3,this._mediaServerClient.unsubscribe(t,r);case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return c.apply(this,arguments)})},{key:"leave",value:(a=s(regeneratorRuntime.mark((function e(){var t,r,n,i,o,a,s=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=s.length>0&&void 0!==s[0]&&s[0],tK.print("leave","Invoke leave"),r=IP(),e.prev=3,clearTimeout(this._reconnectTimer),n=T(this._remoteStreams.values());try{for(n.s();!(i=n.n()).done;)o=i.value,Array.isArray(o)&&o.forEach((function(e){var t;null===(t=e.observer)||void 0===t||t.setLogin(!1)}))}catch(u){n.e(u)}finally{n.f()}return this._localStream&&(null===(a=this._localStream.observer)||void 0===a||a.setLogin(!1)),e.next=10,this._mediaServerClient.leave();case 10:this.destroy(),HV.rtcLeaveRoom(0,"",IP()-r),e.next=23;break;case 14:if(e.prev=14,e.t0=e.catch(3),e.t0 instanceof fD&&e.t0.code===lD.NOT_CONNECTED_YET&&this._joinRejectCallback&&this._joinRejectCallback(new Error(UV.LEAVE_ROOM)),!t){e.next=21;break}throw e.t0;case 21:this.destroy();case 22:e.t0 instanceof Error&&HV.rtcLeaveRoom(-1,e.t0.message,IP()-r);case 23:case"end":return e.stop()}}),e,this,[[3,14]])}))),function(){return a.apply(this,arguments)})},{key:"setRemoteUserPriority",value:function(e,t){var r,n;null===(r=this.remoteStreams.get(e))||void 0===r||r.forEach((function(e){return e.setRemoteUserPriority(t)})),null===(n=this.userPriorityMap)||void 0===n||n.set(e,t)}},{key:"destroy",value:function(){tK.print("destroy","Invoke destroy"),this._destroyAndInitMediaServerClient(),this._roomInfo=void 0,this._remoteUsers=new Map;var e,t,r,n=T(this._remoteStreams);try{for(n.s();!(e=n.n()).done;){var i=b(e.value,2)[1];Array.isArray(i)&&i.forEach((function(e){e&&e.clean()}))}}catch(o){n.e(o)}finally{n.f()}(this._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 nK,this._removeHandlerEventHandler(),clearTimeout(this._connectionLostTimer),this._userDuplicateLoginTimerMap.forEach((function(e){clearTimeout(e)})),this._userDuplicateLoginTimerMap.clear(),this._networkQualityManager.destroy(),this._videoSizeObserver.destroy(),this._subFallbackManager.destroy()}},{key:"updateToken",value:(o=s(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return tK.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 o.apply(this,arguments)})},{key:"pauseAllSubscribedStream",value:(n=s(regeneratorRuntime.mark((function e(t){var r,n,i,o,a=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=[],n=T(this._remoteStreams.values());try{for(n.s();!(i=n.n()).done;)o=i.value,Array.isArray(o)&&o.forEach((function(e){if(e.hasSubscribed){var n=a.updateSubTrack(e,t,SG.UNSUB);n&&r.push(n)}}))}catch(s){n.e(s)}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:"resumeAllSubscribedStream",value:(r=s(regeneratorRuntime.mark((function e(t){var r,n,i,o,a=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=[],n=T(this._remoteStreams.values());try{for(n.s();!(i=n.n()).done;)o=i.value,Array.isArray(o)&&o.forEach((function(e){if(e.hasSubscribed&&e.hasSubscribed){var n=a.updateSubTrack(e,t,SG.SUB);n&&r.push(n)}}))}catch(s){n.e(s)}finally{n.f()}return e.abrupt("return",Promise.all(r));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return r.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=EP(),XV.setStats({rtc_session_id:this._sessionId}),XX.setStats({rtc_session_id:this._sessionId})}},{key:"sendRoomMessage",value:(t=s(regeneratorRuntime.mark((function e(t){var r,n,i,o,a=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=a.length>1&&void 0!==a[1]&&a[1],o={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,CP.ab2b64str(t);case 5:o.message=e.sent,e.next=9;break;case 8:o.message=t;case 9:return e.abrupt("return",null===(n=this._mediaServerClient)||void 0===n?void 0:n.sendRoomMessage(o));case 10:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"_destroyAndInitMediaServerClient",value:function(){tK.print("_destroyAndInitMediaServerClient()"),this._mediaServerClient&&(this._mediaServerClient.destroy(),this._removeHandlerEventHandler()),this._mediaServerClient=new WG(this._context),this._addHandlerEventHandler()}},{key:"_onJoinSucc",value:function(e,t){var r,n=this;tK.print("JoinSuccess()"),this._serverConfig=e.config;var i=[],o=[],a=[],s=[];null===(r=e.clientsDetail)||void 0===r||r.forEach((function(t){if(t.attributes&&(t.attributes.serverMuteVideo&&n.safeEmit(mG.ON_VIDEO_STREAM_BANNED,{uid:t.clientId,banned:1===t.attributes.serverMuteVideo}),t.attributes.serverMuteAudio&&n.safeEmit(mG.ON_AUDIO_STREAM_BANNED,{uid:t.clientId,banned:1===t.attributes.serverMuteAudio})),t.clientId!==e.clientId){var r=n._remoteUsers.get(t.clientId);r?r._stillExist=!0:i.push(t)}}));var u,c=T(this._remoteUsers.values());try{for(c.s();!(u=c.n()).done;){var d=u.value;d._stillExist||o.push({clientId:d.userId}),delete d._stillExist}}catch(p){c.e(p)}finally{c.f()}e.streams.forEach((function(e){var t=n._findRemoteStreamByScreen(e.clientId,e.screen);t?(t.stillExist=!0,t.streamId=e.streamId):s.push(e)}));var l,h=T(this._remoteStreams.values());try{for(h.s();!(l=h.n()).done;){var f=l.value;Array.isArray(f)&&f.forEach((function(e){e.stillExist?delete e.stillExist:a.push({clientId:e.userId,streamId:e.streamId,message:bF.clientDisconnected})}))}}catch(p){h.e(p)}finally{h.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)})),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=T(this._remoteStreams.values());try{for(r.s();!(t=r.n()).done;){var n=t.value;Array.isArray(n)&&n.forEach(function(){var t=s(regeneratorRuntime.mark((function t(r){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!r.hasSubscribed){t.next=15;break}return r.resetHasSubscribed(),t.prev=2,tK.print("start resubscribe ".concat(r.userId," with ").concat(r.subMediaType)),t.next=6,e._mediaServerClient.subscribe(r,r.subMediaType);case 6:tK.print("success resubscribe ".concat(r.userId," with ").concat(r.subMediaType)),e.safeEmit(mG.RESUBSCRIBE,{stream:r}),t.next=15;break;case 10:t.prev=10,t.t0=t.catch(2),tK.print("failed resubscribe ".concat(r.userId," with ").concat(r.subMediaType,", error:").concat(t.t0)),r.clean(),null==r||r.resetHasSubscribed();case 15:case"end":return t.stop()}}),t,null,[[2,10]])})));return function(e){return t.apply(this,arguments)}}())}}catch(i){r.e(i)}finally{r.f()}}},{key:"_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._findRemoteStreamByScreen(e.clientId,e.screen);if(i&&i.streamId!==e.streamId){var o,a=null===(o=this._remoteStreams.get(e.clientId))||void 0===o?void 0:o.filter((function(e){return e.streamId!==i.streamId}));i.clean(),this._remoteStreams.set(e.clientId,a||[])}var s=this._findRemoteStream(e.clientId,e.streamId);if(s)s.attributes=e.attributes;else{var u;s=new kG(e.clientId,e.streamId,e.screen,e.attributes,null===(u=this.userPriorityMap)||void 0===u?void 0:u.get(e.clientId)),this._initStreamListeners(s);var c=this._remoteStreams.get(e.clientId);c?c.push(s):this._remoteStreams.set(e.clientId,[s])}if(this._mediaServerClient.handler&&(s.observer=new KX(s,this._mediaServerClient.handler)),!s.isScreen){var d,l,h,f,p,v,_,m;if(n&&s.hasVideo)if(s.attributes.extvideo)null===(d=s.observer)||void 0===d||d.setExternalVideoSource(!0),null===(l=s.observer)||void 0===l||l.setPushVideo(!0);else null===(h=s.observer)||void 0===h||h.setExternalVideoSource(!1),null===(f=s.observer)||void 0===f||f.setPublishVideo(!0);if(n&&s.hasAudio&&!this._mediaServerClient.roomAttributes.multiChatMode)if(s.attributes.extaudio)null===(p=s.observer)||void 0===p||p.setExternalAudioSource(!0),null===(v=s.observer)||void 0===v||v.setPushAudio(!0);else null===(_=s.observer)||void 0===_||_.setExternalAudioSource(!1),null===(m=s.observer)||void 0===m||m.setPublishAudio(!0);if(!0===r&&!1===n){var g,y=this._roomConfig,S=y.isAutoSubscribeAudio,b=y.isAutoSubscribeVideo;null===(g=s.observer)||void 0===g||g.setLogin(!0,{audio:!!S,video:!!b})}}return r&&this.safeEmit(RF.ON_ADD_STREAM,{stream:s}),s}}},{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(RF.USER_CONNECTION,{userInfo:n}),e.attributes&&(e.attributes.serverMuteVideo&&this.safeEmit(mG.ON_VIDEO_STREAM_BANNED,{uid:e.clientId,banned:1===e.attributes.serverMuteVideo}),e.attributes.serverMuteAudio&&this.safeEmit(mG.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===IF.kickedByAdmin?a=lD.KICKED_OUT:i===IF.onUserTokenDidExpire?a=lD.TOKEN_EXPIRED:i===IF.userDuplicateLogin&&(a=lD.DUPLICATE_LOGIN),o===AF.roomDismissByAdmin&&(a=lD.ROOM_DISMISS),a&&this.safeEmit(mG.ON_ROOM_ERROR,{errorCode:a})}else{var s=w.DROPPED;i===IF.userLeave?s=w.QUIT:i===IF.kickedByAdmin?s=w.KICKED_BY_ADMIN:i===IF.roleChanged&&(s=w.SWITCH_TO_INVISIBLE);var u=function(){r._remoteUsers.delete(n);var e=r._remoteStreams.get(n);Array.isArray(e)&&e.forEach((function(e){return null==e?void 0:e.clean()})),r._remoteStreams.set(n,[]),r.safeEmit(mG.ON_USER_LEAVE,{userInfo:{userId:n},reason:s})};if(i===IF.userDuplicateLogin){var c=this._userDuplicateLoginTimerMap.get(n);null!=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(RF.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(mG.ON_VIDEO_STREAM_BANNED,{uid:e.clientId,banned:1===e.attributes.serverMuteVideo}),e.attributes.serverMuteAudio&&this.safeEmit(mG.ON_AUDIO_STREAM_BANNED,{uid:e.clientId,banned:1===e.attributes.serverMuteAudio}))}},{key:"_onUpdateRoomAttributes",value:function(e){e.roomAttributes&&(this._mediaServerClient.roomAttributes=e.roomAttributes)}},{key:"_onUpdateStreamAttributes",value:function(e){var t=e.clientId,r=e.streamId,n=e.attributes,o=this._findRemoteStream(t,r);if(o){var a,s,u=o.attributes,c=i(i({},u),n),d=!1,l=c.localaudio!==u.localaudio,h=!1,f=!1,p=c.localvideo!==u.localvideo,v=!1,_=tG.NONE,m=tG.NONE;if(c.audiostream!==u.audiostream&&(d=c.localaudio,h=!!c.audiostream,c.audiostream?_|=L.AUDIO:m|=L.AUDIO),c.videostream!==u.videostream&&(f=c.localvideo,v=!!c.videostream,c.videostream?_|=L.VIDEO:m|=L.VIDEO),_&&this.safeEmit(mG.ON_USER_PUBLISH_STATE_CHANGE,{userId:t,mediaType:_,isScreen:o.isScreen,pubState:yG.PUB,remoteStream:o}),m&&this.safeEmit(mG.ON_USER_PUBLISH_STATE_CHANGE,{userId:t,mediaType:m,isScreen:o.isScreen,pubState:yG.UNPUB,remoteStream:o}),o.attributes=c,c.localaudio!==u.localaudio)if(c.localaudio){var g,y,S,b;if(c.extaudio)null===(g=o.observer)||void 0===g||g.setExternalAudioSource(!0),null===(y=o.observer)||void 0===y||y.setPushAudio(!0);else null===(S=o.observer)||void 0===S||S.setExternalAudioSource(!1),null===(b=o.observer)||void 0===b||b.setEnableAudio(!0);this.safeEmit(mG.ON_USER_START_AUDIO_CAPTURE,{userId:t},o)}else{var E,R,k,T;if(c.extaudio)null===(E=o.observer)||void 0===E||E.setExternalAudioSource(!0),null===(R=o.observer)||void 0===R||R.setPushAudio(!1);else null===(k=o.observer)||void 0===k||k.setExternalAudioSource(!1),null===(T=o.observer)||void 0===T||T.setEnableAudio(!1);!o.isScreen&&this.safeEmit(mG.ON_USER_STOP_AUDIO_CAPTURE,{userId:t})}if(c.localvideo!==u.localvideo)if(c.localvideo){var I,A,w,C;if(c.extvideo)null===(I=o.observer)||void 0===I||I.setExternalVideoSource(!0),null===(A=o.observer)||void 0===A||A.setPushVideo(!0);else null===(w=o.observer)||void 0===w||w.setExternalVideoSource(!1),null===(C=o.observer)||void 0===C||C.setEnableVideo(!0);this.safeEmit(mG.ON_USER_START_VIDEO_CAPTURE,{userId:t})}else{var O,x,N,D;if(c.extvideo)null===(O=o.observer)||void 0===O||O.setExternalVideoSource(!0),null===(x=o.observer)||void 0===x||x.setPushVideo(!1);else null===(N=o.observer)||void 0===N||N.setExternalVideoSource(!1),null===(D=o.observer)||void 0===D||D.setEnableVideo(!1);!o.isScreen&&this.safeEmit(mG.ON_USER_STOP_VIDEO_CAPTURE,{userId:t})}if(d&&!l)null===(a=o.observer)||void 0===a||a.setRemoteUnmuteAudio(h);if(f&&!p)null===(s=o.observer)||void 0===s||s.setRemoteUnmuteVideo(v)}}},{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(mG.SUBSCRIBE_PUSH_TRACK,{stream:i})})).catch((function(e){tK.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(mG.REMOVE_PUSH_TRACK,{stream:o})})).catch((function(e){tK.print("remove push track failed: ".concat(e))}))}},{key:"_nodeChange",value:function(e){var t,r=e.nodes,n=e.reason;sF.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,HV.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=T(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()}HV.rtcReconnect(1002,lV.PEERCONNECTION_RECONNECTING,this._roomInfo.userInfo.userId,hV.PEERCONNECTION),this._join((function(){HV.rtcReconnected(fV.PEERCONNECTION_RECONNECTED,pV.PEERCONNECTION)}),(function(t){e._reconnectRecord.record(t),e._reconnectRecord.shouldReconnect?(tK.print("Reconnecting error, will reconnect after 3s",t),e._reconnectTimer=window.setTimeout(e._reconnect.bind(e),3e3)):(e.safeEmit(mG.RECONNECT_FAILED),e.destroy())}),!0)}},{key:"_handleAbnormalDisconnection",value:function(){tK.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===XG.DISCONNECTED)t=V.CONNECTION_STATE_DISCONNECTED;else if(e.next===XG.CONNECTED)clearTimeout(this._connectionLostTimer),t=this._isReconnecting?V.CONNECTION_STATE_RECONNECTED:V.CONNECTION_STATE_CONNECTED;else{if(e.next!==XG.CONNECTING)return;t=this._isReconnecting?V.CONNECTION_STATE_RECONNECTING:V.CONNECTION_STATE_CONNECTING}e.prev===XG.CONNECTED&&e.next===XG.DISCONNECTED&&(this._connectionLostTimer=window.setTimeout((function(){r.safeEmit(TF.ON_CONNECTION_STATE_CHANGE,{state:V.CONNECTION_STATE_LOST})}),1e4)),this._networkQualityManager.setConnectionState(e.next),this.safeEmit(TF.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(mG.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?M.STREAM_INDEX_SCREEN:M.STREAM_INDEX_MAIN}})}))}},{key:"_onCustomMessage",value:function(e){this.safeEmit(RF.ON_CUSTOM_MESSAGE,e)}},{key:"_onUserMessageReceived",value:function(e){this.safeEmit(RF.USER_MESSAGE_RECEIVED,{userId:e.from,message:e.msg})}},{key:"_onUserBinaryMessageReceived",value:function(e){this.safeEmit(RF.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=gG.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=gG.START_FAILED);break;case"TranscodeStateChanged":n=0!==t.error?gG.START_FAILED:gG.START_SUCCESS;break;case"TranscodeStopped":n=0!==t.error?gG.STOP_FAILED:gG.STOP_SUCCESS;break;case"TranscodeUpdated":n=0!==t.error?gG.UPDATE_FAILED:gG.UPDATE_SUCCESS}this.safeEmit(RF.POST_PROCESSING_MESSAGE,{code:r,protocol:t.protocol,error:t.error,eventType:n,message:i[r]})}this.safeEmit(RF.POST_PROCESSING_MESSAGE,{code:r,message:i[r],type:e.type})}}},{key:"_onUserTokenWillExpire",value:function(){this.safeEmit(RF.ON_USER_TOKEN_WILL_EXPIRE,null)}},{key:"_onSceneConfig",value:function(e){var t=e.multiSceneConfig,r=BG[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:"_onStreamControlMessage",value:function(e){var t,r;e.type===EF.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={};tK.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,g=[];d.encodings=d.encodings.map((function(e){return e.rid&&(_[e.rid]?(e.active=!0,e.scaleResolutionDownBy=Math.max(m/_[e.rid].height,1),g.push({type:1,rid:e.rid,downBy:e.scaleResolutionDownBy})):(g.push({type:0,rid:e.rid}),e.active=!1)),e})),HV.rtcInvokeStatus(JSON.stringify(g),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(mG.ON_NETWORK_QUALITY,e,t)}},{key:"_emitVideoSizeChange",value:function(e,t,r,n){var i;this.emit(mG.ON_REMOTE_VIDEO_SIZE_CHANGED,{roomId:null===(i=this.roomInfo)||void 0===i?void 0:i.roomId,userId:e,streamIndex:t?M.STREAM_INDEX_SCREEN:M.STREAM_INDEX_MAIN},{width:r,height:n})}},{key:"_emitSubscribeFallback",value:function(e){this.emit(mG.ON_SIMULCAST_SUBSCRIBE_FALLBACK,e)}}]),P}(_M),nK=function(){function e(){u(this,e),l(this,"_all_201_count",void 0),l(this,"_has_4xx",void 0),this._all_201_count=0,this._has_4xx=!1}return d(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}(),iK=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=document.createElement(e);return t.id&&(r.id=t.id),t.classList&&t.classList.forEach((function(e){r.classList.add(e)})),t.style&&Object.assign(r.style,t.style),t.attributes&&Object.entries(t.attributes).forEach((function(e){var t=b(e,2),n=t[0],i=t[1];"muted"===n?r.muted=!0:r.setAttribute(n,i)})),r},oK=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=b(t,2),n=r[0],i=r[1];e.setAttribute(n,i)})),e},aK=new pM("Player",0),sK=["play","playing","pause","ended","error","seeking","seeked","waiting","canplay","canplaythrough","durationchange","volumechange","loadedmetadata","loadeddata","loadstart","timeupdate"],uK={playsinline:"","webkit-playsinline":""},cK={playsinline:"","webkit-playsinline":"","x5-playsinline":"","x5-video-player-type":"h5","x-webkit-airplay":"allow",preload:"",muted:""},dK=new(function(){function e(){u(this,e),l(this,"videoCache",[]),l(this,"audioCache",[])}return d(e,[{key:"getOrCreate",value:function(e,t){var r="audio"===e?uK:cK;if("video"===e&&this.videoCache.length>0){var n=this.videoCache.pop();if(n)return oK(n,{style:t,attributes:r}),n}else if("audio"===e&&this.audioCache.length>0){var i=this.audioCache.pop();if(i)return oK(i,{style:t,attributes:r}),i}return iK(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}()),lK=function(e){h(n,e);var t,r=g(n);function n(e){var t;u(this,n),l(_(t=r.call(this)),"_containerDom",void 0),l(_(t),"_videoDom",void 0),l(_(t),"__cumulativeTime",void 0),l(_(t),"userId",void 0),l(_(t),"renderMode",void 0),l(_(t),"mirrorType",F.MIRROR_TYPE_NONE),l(_(t),"isScreen",void 0),l(_(t),"isLocal",void 0),l(_(t),"played",!1),l(_(t),"_emitPlayFailed",!1),l(_(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)})),l(_(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,HV.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:P.RENDER_MODE_FIT;var a="string"==typeof i?document.getElementById(i):i;if(!a)throw new fD(lD.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 d(n,[{key:"_initVideo",value:function(){this._videoDom||(this._videoDom=dK.getOrCreate("video",{width:"100%",height:"100%"}),this._videoDom.id="".concat(this.userId,"_").concat(TP()),this.renderMode===P.RENDER_MODE_FIT?this._videoDom.style.objectFit="contain":this._videoDom.style.objectFit="cover",this.mirror(this.mirrorType===F.MIRROR_TYPE_RENDER)),this._containerDom.appendChild(this._videoDom),this._initListeners()}},{key:"_initListeners",value:function(){var e=this;this._videoDom&&sK.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&&(sK.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=s(regeneratorRuntime.mark((function e(t,r){var n,i,o,a,s=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=this._videoDom,aK.print("playVideo","play video track: ".concat(this.userId)),!(o&&o.srcObject instanceof MediaStream&&o.srcObject.getTrackById(null===(n=t.getTrack())||void 0===n?void 0:n.id))){e.next=4;break}return e.abrupt("return");case 4:o||(this._initVideo(),o=this._videoDom),aK.print("playVideo","play video by dom: ".concat(null===(i=o)||void 0===i?void 0:i.id)),(a=new MediaStream).addTrack(t.getTrack("preprocessing")),o.srcObject=a,o&&!this._containerDom.contains(o)&&this._containerDom.appendChild(o),o.addEventListener("canplay",this._internalPlay),o.addEventListener("loadeddata",this._internalPlay),setTimeout((function(){return s._internalPlay()})),r&&this._recordFrame(r),this.played=!0;case 15:case"end":return e.stop()}}),e,this)}))),function(e,r){return t.apply(this,arguments)})},{key:"updateSrcObject",value:function(e){var t=e.getTrack();if(t&&this._videoDom){var r=new MediaStream;r.addTrack(t),this._videoDom.srcObject=r}}},{key:"manuallyPlay",value:function(){if(aK.print("Invoke VideoPlayer.manuallyPlay"),this._emitPlayFailed=!1,!this._videoDom)throw new fD(lD.INVALID_PARAMS,"Player not found");return this._videoDom.play()}},{key:"mirror",value:function(e){aK.print("mirror","".concat(this.userId," set mirror: ").concat(e)),this.mirrorType=e?F.MIRROR_TYPE_RENDER:F.MIRROR_TYPE_NONE,this._videoDom&&(this._videoDom.style.transform=e?"rotateY(180deg)":"")}},{key:"stop",value:function(){var e=this._containerDom;aK.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(){aK.print("destroy","video player: ".concat(this.userId)),this.stop(),S(f(n.prototype),"removeAllListeners",this).call(this),this._removeListeners(),this._videoDom&&(dK.recycle(this._videoDom),delete this._videoDom)}},{key:"domElement",get:function(){return this._videoDom}}]),n}(cM.exports.EventEmitter),hK=function(e){h(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(u(this,i),l(_(t=n.call(this)),"_containerDom",void 0),l(_(t),"_audioDom",void 0),l(_(t),"_fakeAudioDom",void 0),l(_(t),"userId",void 0),l(_(t),"muted",!1),l(_(t),"_emitPlayFailed",!1),l(_(t),"played",!1),l(_(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)})),l(_(t),"_internalPlay",(function(){var e,r;if(ZV("_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(){ZV("_internalPlay successfully",{userId:t.userId})}))}catch(i){t._autoPlayError(i)}})),o){var s=document.getElementById(o);if(!s)throw new fD(lD.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 d(i,[{key:"_initAudio",value:function(){this._audioDom||(this._audioDom=dK.getOrCreate("audio",{display:"none"}),this._audioDom.volume=this.muted?0:1,this._audioDom.id="".concat(this.userId,"_").concat(TP()),this._containerDom.appendChild(this._audioDom)),this._initListeners()}},{key:"_initListeners",value:function(){var e=this;this._audioDom&&sK.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&&(sK.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=s(regeneratorRuntime.mark((function e(t){var r,n,i,o,a,s=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(aK.print("playAudio","play audio track: ".concat(this.userId)),!((o=this._audioDom)&&o.srcObject instanceof MediaStream&&o.srcObject.getTrackById(null===(r=t.getTrack())||void 0===r?void 0:r.id))){e.next=4;break}return e.abrupt("return");case 4:o||(this._initAudio(),o=this._audioDom),(a=new MediaStream).addTrack(t.getTrack("preprocessing")),o.srcObject=a,null===(n=o)||void 0===n||n.addEventListener("canplay",this._internalPlay),null===(i=o)||void 0===i||i.addEventListener("loadeddata",this._internalPlay),setTimeout((function(){return s._internalPlay()})),this.played=!0;case 12:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"_autoPlayError",value:function(e){var t,r;this._emitPlayFailed||(this._emitPlayFailed=!0,HV.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(aK.print("Invoke AudioPlayer.manuallyPlay"),this._emitPlayFailed=!1,!this._audioDom)throw new fD(lD.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=s(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return aK.print("setPlaybackDevice","setPlaybackDevice: ".concat(t)),e.next=3,fj.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;aK.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(){aK.print("destroy","audio player: ".concat(this.userId)),this.stop(),S(f(i.prototype),"removeAllListeners",this).call(this),this._removeListeners(),this._audioDom&&(dK.recycle(this._audioDom),delete this._audioDom)}}]),i}(cM.exports.EventEmitter),fK=function(){function e(){u(this,e),l(this,"_timer",void 0),l(this,"userMessage",void 0),l(this,"roomMessage",void 0),this.userMessage={},this.roomMessage={},this._setTimer()}return d(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;HV.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,VV.P2P,t)}},{key:"recvP2PMessage",value:function(e){this._recvUserMessage(e,VV.P2P)}},{key:"sendP2PFail",value:function(e){this._sendUserFail(e,VV.P2P)}},{key:"sendP2PAck",value:function(e,t,r,n){this._sendUserAck(e,VV.P2P,t,r,n)}},{key:"sendP2POutRoomMessage",value:function(e,t){this._sendUserMessage(e,VV.P2P_OUTSIDE_ROOM,t)}},{key:"recvP2POutRoomMessage",value:function(e){this._recvUserMessage(e,VV.P2P_OUTSIDE_ROOM)}},{key:"sendP2POutRoomFail",value:function(e){this._sendUserFail(e,VV.P2P_OUTSIDE_ROOM)}},{key:"sendP2POutRoomAck",value:function(e,t,r,n){this._sendUserAck(e,VV.P2P_OUTSIDE_ROOM,t,r,n)}},{key:"sendP2serverMessage",value:function(e){this._sendUserMessage("",VV.P2SERVER,e)}},{key:"sendP2serverFail",value:function(){this._sendUserFail("",VV.P2SERVER)}},{key:"sendP2serveAck",value:function(e){this._sendUserAck("",VV.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}(),pK="object"==typeof global&&global&&global.Object===Object&&global,vK="object"==typeof self&&self&&self.Object===Object&&self,_K=pK||vK||Function("return this")(),mK=_K.Symbol,gK=Object.prototype,yK=gK.hasOwnProperty,SK=gK.toString,bK=mK?mK.toStringTag:void 0;var EK=Object.prototype.toString;var RK=mK?mK.toStringTag:void 0;function kK(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":RK&&RK in Object(e)?function(e){var t=yK.call(e,bK),r=e[bK];try{e[bK]=void 0;var n=!0}catch(o){}var i=SK.call(e);return n&&(t?e[bK]=r:delete e[bK]),i}(e):function(e){return EK.call(e)}(e)}function TK(e){return null!=e&&"object"==typeof e}var IK=Array.isArray;function AK(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function wK(e){return e}function CK(e){if(!AK(e))return!1;var t=kK(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}var OK,xK=_K["__core-js_shared__"],NK=(OK=/[^.]+$/.exec(xK&&xK.keys&&xK.keys.IE_PROTO||""))?"Symbol(src)_1."+OK:"";var DK=Function.prototype.toString;var PK=/^\[object .+?Constructor\]$/,MK=Function.prototype,LK=Object.prototype,UK=MK.toString,VK=LK.hasOwnProperty,FK=RegExp("^"+UK.call(VK).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function BK(e){return!(!AK(e)||(t=e,NK&&NK in t))&&(CK(e)?FK:PK).test(function(e){if(null!=e){try{return DK.call(e)}catch(t){}try{return e+""}catch(t){}}return""}(e));var t}function jK(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 GK=Date.now;var HK,zK,qK,XK=function(){try{var e=BK(t=function(e,t){return null==e?void 0:e[t]}(Object,"defineProperty"))?t:void 0;return e({},"",{}),e}catch(r){}var t}(),KK=XK,WK=KK?function(e,t){return KK(e,"toString",{configurable:!0,enumerable:!1,value:(r=t,function(){return r}),writable:!0});var r}:wK,YK=(HK=WK,zK=0,qK=0,function(){var e=GK(),t=16-(e-qK);if(qK=e,t>0){if(++zK>=800)return arguments[0]}else zK=0;return HK.apply(void 0,arguments)}),JK=YK,QK=/^(?:0|[1-9]\d*)$/;function ZK(e,t){var r=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==r||"symbol"!=r&&QK.test(e))&&e>-1&&e%1==0&&e<t}function $K(e,t,r){"__proto__"==t&&KK?KK(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function eW(e,t){return e===t||e!=e&&t!=t}var tW=Object.prototype.hasOwnProperty;function rW(e,t,r){var n=e[t];tW.call(e,t)&&eW(n,r)&&(void 0!==r||t in e)||$K(e,t,r)}var nW=Math.max;function iW(e,t){return JK(function(e,t,r){return t=nW(void 0===t?e.length-1:t,0),function(){for(var n=arguments,i=-1,o=nW(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),jK(e,this,s)}}(e,t,wK),e+"")}function oW(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function aW(e){return null!=e&&oW(e.length)&&!CK(e)}var sW=Object.prototype;function uW(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||sW)}function cW(e){return TK(e)&&"[object Arguments]"==kK(e)}var dW=Object.prototype,lW=dW.hasOwnProperty,hW=dW.propertyIsEnumerable,fW=cW(function(){return arguments}())?cW:function(e){return TK(e)&&lW.call(e,"callee")&&!hW.call(e,"callee")},pW=fW;var vW="object"==typeof exports&&exports&&!exports.nodeType&&exports,_W=vW&&"object"==typeof module&&module&&!module.nodeType&&module,mW=_W&&_W.exports===vW?_K.Buffer:void 0,gW=(mW?mW.isBuffer:void 0)||function(){return!1},yW={};yW["[object Float32Array]"]=yW["[object Float64Array]"]=yW["[object Int8Array]"]=yW["[object Int16Array]"]=yW["[object Int32Array]"]=yW["[object Uint8Array]"]=yW["[object Uint8ClampedArray]"]=yW["[object Uint16Array]"]=yW["[object Uint32Array]"]=!0,yW["[object Arguments]"]=yW["[object Array]"]=yW["[object ArrayBuffer]"]=yW["[object Boolean]"]=yW["[object DataView]"]=yW["[object Date]"]=yW["[object Error]"]=yW["[object Function]"]=yW["[object Map]"]=yW["[object Number]"]=yW["[object Object]"]=yW["[object RegExp]"]=yW["[object Set]"]=yW["[object String]"]=yW["[object WeakMap]"]=!1;var SW="object"==typeof exports&&exports&&!exports.nodeType&&exports,bW=SW&&"object"==typeof module&&module&&!module.nodeType&&module,EW=bW&&bW.exports===SW&&pK.process,RW=function(){try{var e=bW&&bW.require&&bW.require("util").types;return e||EW&&EW.binding&&EW.binding("util")}catch(t){}}(),kW=RW&&RW.isTypedArray,TW=kW?function(e){return function(t){return e(t)}}(kW):function(e){return TK(e)&&oW(e.length)&&!!yW[kK(e)]},IW=TW,AW=Object.prototype.hasOwnProperty;function wW(e,t){var r=IK(e),n=!r&&pW(e),i=!r&&!n&&gW(e),o=!r&&!n&&!i&&IW(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&&!AW.call(e,c)||a&&("length"==c||i&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||ZK(c,u))||s.push(c);return s}var CW=function(e,t){return function(r){return e(t(r))}}(Object.keys,Object),OW=CW,xW=Object.prototype.hasOwnProperty;function NW(e){return aW(e)?wW(e):function(e){if(!uW(e))return OW(e);var t=[];for(var r in Object(e))xW.call(e,r)&&"constructor"!=r&&t.push(r);return t}(e)}var DW=Object.prototype.hasOwnProperty;function PW(e){if(!AK(e))return function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t}(e);var t=uW(e),r=[];for(var n in e)("constructor"!=n||!t&&DW.call(e,n))&&r.push(n);return r}var MW,LW=(MW=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?$K(r,s,u):rW(r,s,u)}}(t,function(e){return aW(e)?wW(e,!0):PW(e)}(t),e)},iW((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=MW.length>3&&"function"==typeof i?(n--,i):void 0,o&&function(e,t,r){if(!AK(r))return!1;var n=typeof t;return!!("number"==n?aW(r)&&ZK(t,r.length):"string"==n&&t in r)&&eW(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&&MW(e,a,r,i)}return e})));function UW(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 VW(e){return null==e?[]:UW(e,NW(e))}var FW=se,BW=er("iterator"),jW=!FW((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[BW]||"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})),GW=Te,HW=2147483647,zW=/[^\0-\u007E]/,qW=/[.\u3002\uFF0E\uFF61]/g,XW="Overflow: input needs wider integers to process",KW=oe.RangeError,WW=GW(qW.exec),YW=Math.floor,JW=String.fromCharCode,QW=GW("".charCodeAt),ZW=GW([].join),$W=GW([].push),eY=GW("".replace),tY=GW("".split),rY=GW("".toLowerCase),nY=function(e){return e+22+75*(e<26)},iY=function(e,t,r){var n=0;for(e=r?YW(e/700):e>>1,e+=YW(e/t);e>455;)e=YW(e/35),n+=36;return YW(n+36*e/(e+38))},oY=function(e){var t=[];e=function(e){for(var t=[],r=0,n=e.length;r<n;){var i=QW(e,r++);if(i>=55296&&i<=56319&&r<n){var o=QW(e,r++);56320==(64512&o)?$W(t,((1023&i)<<10)+(1023&o)+65536):($W(t,i),r--)}else $W(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&&$W(t,JW(n));var u=t.length,c=u;for(u&&$W(t,"-");c<i;){var d=HW;for(r=0;r<e.length;r++)(n=e[r])>=o&&n<d&&(d=n);var l=c+1;if(d-o>YW((HW-a)/l))throw KW(XW);for(a+=(d-o)*l,o=d,r=0;r<e.length;r++){if((n=e[r])<o&&++a>HW)throw KW(XW);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;$W(t,JW(nY(p+v%_))),h=YW(v/_),f+=36}$W(t,JW(nY(h))),s=iY(a,l,c==u),a=0,c++}}a++,o++}return ZW(t,"")},aY=Wi,sY=oe,uY=Ke,cY=he,dY=Te,lY=jW,hY=Yr.exports,fY=Gd,pY=fa,vY=vc,_Y=On,mY=Jd,gY=je,yY=Vt,SY=ma,bY=ho,EY=Pr,RY=He,kY=vo,TY=Fo,IY=ye,AY=hl,wY=ol,CY=Yl,OY=NI,xY=er("iterator"),NY="URLSearchParams",DY="URLSearchParamsIterator",PY=_Y.set,MY=_Y.getterFor(NY),LY=_Y.getterFor(DY),UY=uY("fetch"),VY=uY("Request"),FY=uY("Headers"),BY=VY&&VY.prototype,jY=FY&&FY.prototype,GY=sY.RegExp,HY=sY.TypeError,zY=sY.decodeURIComponent,qY=sY.encodeURIComponent,XY=dY("".charAt),KY=dY([].join),WY=dY([].push),YY=dY("".replace),JY=dY([].shift),QY=dY([].splice),ZY=dY("".split),$Y=dY("".slice),eJ=/\+/g,tJ=Array(4),rJ=function(e){return tJ[e-1]||(tJ[e-1]=GY("((?:%[\\da-f]{2}){"+e+"})","gi"))},nJ=function(e){try{return zY(e)}catch(VZ){return e}},iJ=function(e){var t=YY(e,eJ," "),r=4;try{return zY(t)}catch(VZ){for(;r;)t=YY(t,rJ(r--),nJ);return t}},oJ=/[!'()~]|%20/g,aJ={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},sJ=function(e){return aJ[e]},uJ=function(e){return YY(qY(e),oJ,sJ)},cJ=vY((function(e,t){PY(this,{type:DY,iterator:AY(MY(e).entries),kind:t})}),"Iterator",(function(){var e=LY(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),dJ=function(e){this.entries=[],this.url=null,void 0!==e&&(RY(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===XY(e,0)?$Y(e,1):e:kY(e)))};dJ.prototype={type:NY,bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t,r,n,i,o,a,s,u=wY(e);if(u)for(r=(t=AY(e,u)).next;!(n=cY(r,t)).done;){if(o=(i=AY(EY(n.value))).next,(a=cY(o,i)).done||(s=cY(o,i)).done||!cY(o,i).done)throw HY("Expected sequence with length 2");WY(this.entries,{key:kY(a.value),value:kY(s.value)})}else for(var c in e)yY(e,c)&&WY(this.entries,{key:c,value:kY(e[c])})},parseQuery:function(e){if(e)for(var t,r,n=ZY(e,"&"),i=0;i<n.length;)(t=n[i++]).length&&(r=ZY(t,"="),WY(this.entries,{key:iJ(JY(r)),value:iJ(KY(r,"="))}))},serialize:function(){for(var e,t=this.entries,r=[],n=0;n<t.length;)e=t[n++],WY(r,uJ(e.key)+"="+uJ(e.value));return KY(r,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var lJ=function(){mY(this,hJ);var e=arguments.length>0?arguments[0]:void 0;PY(this,new dJ(e))},hJ=lJ.prototype;if(fY(hJ,{append:function(e,t){CY(arguments.length,2);var r=MY(this);WY(r.entries,{key:kY(e),value:kY(t)}),r.updateURL()},delete:function(e){CY(arguments.length,1);for(var t=MY(this),r=t.entries,n=kY(e),i=0;i<r.length;)r[i].key===n?QY(r,i,1):i++;t.updateURL()},get:function(e){CY(arguments.length,1);for(var t=MY(this).entries,r=kY(e),n=0;n<t.length;n++)if(t[n].key===r)return t[n].value;return null},getAll:function(e){CY(arguments.length,1);for(var t=MY(this).entries,r=kY(e),n=[],i=0;i<t.length;i++)t[i].key===r&&WY(n,t[i].value);return n},has:function(e){CY(arguments.length,1);for(var t=MY(this).entries,r=kY(e),n=0;n<t.length;)if(t[n++].key===r)return!0;return!1},set:function(e,t){CY(arguments.length,1);for(var r,n=MY(this),i=n.entries,o=!1,a=kY(e),s=kY(t),u=0;u<i.length;u++)(r=i[u]).key===a&&(o?QY(i,u--,1):(o=!0,r.value=s));o||WY(i,{key:a,value:s}),n.updateURL()},sort:function(){var e=MY(this);OY(e.entries,(function(e,t){return e.key>t.key?1:-1})),e.updateURL()},forEach:function(e){for(var t,r=MY(this).entries,n=SY(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 cJ(this,"keys")},values:function(){return new cJ(this,"values")},entries:function(){return new cJ(this,"entries")}},{enumerable:!0}),hY(hJ,xY,hJ.entries,{name:"entries"}),hY(hJ,"toString",(function(){return MY(this).serialize()}),{enumerable:!0}),pY(lJ,NY),aY({global:!0,forced:!lY},{URLSearchParams:lJ}),!lY&&gY(FY)){var fJ=dY(jY.has),pJ=dY(jY.set),vJ=function(e){if(RY(e)){var t,r=e.body;if(bY(r)===NY)return t=e.headers?new FY(e.headers):new FY,fJ(t,"content-type")||pJ(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),TY(e,{body:IY(0,kY(r)),headers:IY(0,t)})}return e};if(gY(UY)&&aY({global:!0,enumerable:!0,forced:!0},{fetch:function(e){return UY(e,arguments.length>1?vJ(arguments[1]):{})}}),gY(VY)){var _J=function(e){return mY(this,BY),new VY(e,arguments.length>1?vJ(arguments[1]):{})};BY.constructor=_J,_J.prototype=BY,aY({global:!0,forced:!0},{Request:_J})}}var mJ,gJ={URLSearchParams:lJ,getState:MY},yJ=Wi,SJ=ue,bJ=jW,EJ=oe,RJ=ma,kJ=Te,TJ=_o.f,IJ=Yr.exports,AJ=Jd,wJ=Vt,CJ=Qg,OJ=ZD,xJ=Jo,NJ=ld.codeAt,DJ=function(e){var t,r,n=[],i=tY(eY(rY(e),qW,"."),".");for(t=0;t<i.length;t++)r=i[t],$W(n,WW(zW,r)?"xn--"+oY(r):r);return ZW(n,".")},PJ=vo,MJ=fa,LJ=Yl,UJ=gJ,VJ=On,FJ=VJ.set,BJ=VJ.getterFor("URL"),jJ=UJ.URLSearchParams,GJ=UJ.getState,HJ=EJ.URL,zJ=EJ.TypeError,qJ=EJ.parseInt,XJ=Math.floor,KJ=Math.pow,WJ=kJ("".charAt),YJ=kJ(/./.exec),JJ=kJ([].join),QJ=kJ(1..toString),ZJ=kJ([].pop),$J=kJ([].push),eQ=kJ("".replace),tQ=kJ([].shift),rQ=kJ("".split),nQ=kJ("".slice),iQ=kJ("".toLowerCase),oQ=kJ([].unshift),aQ="Invalid scheme",sQ="Invalid host",uQ="Invalid port",cQ=/[a-z]/i,dQ=/[\d+-.a-z]/i,lQ=/\d/,hQ=/^0x/i,fQ=/^[0-7]+$/,pQ=/^\d+$/,vQ=/^[\da-f]+$/i,_Q=/[\0\t\n\r #%/:<>?@[\\\]^|]/,mQ=/[\0\t\n\r #/:<>?@[\\\]^|]/,gQ=/^[\u0000-\u0020]+|[\u0000-\u0020]+$/g,yQ=/[\t\n\r]/g,SQ=function(e){var t,r,n,i;if("number"==typeof e){for(t=[],r=0;r<4;r++)oQ(t,e%256),e=XJ(e/256);return JJ(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+=QJ(e[r],16),r<7&&(t+=":")));return"["+t+"]"}return e},bQ={},EQ=CJ({},bQ,{" ":1,'"':1,"<":1,">":1,"`":1}),RQ=CJ({},EQ,{"#":1,"?":1,"{":1,"}":1}),kQ=CJ({},RQ,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),TQ=function(e,t){var r=NJ(e,0);return r>32&&r<127&&!wJ(t,e)?e:encodeURIComponent(e)},IQ={ftp:21,file:null,http:80,https:443,ws:80,wss:443},AQ=function(e,t){var r;return 2==e.length&&YJ(cQ,WJ(e,0))&&(":"==(r=WJ(e,1))||!t&&"|"==r)},wQ=function(e){var t;return e.length>1&&AQ(nQ(e,0,2))&&(2==e.length||"/"===(t=WJ(e,2))||"\\"===t||"?"===t||"#"===t)},CQ=function(e){return"."===e||"%2e"===iQ(e)},OQ={},xQ={},NQ={},DQ={},PQ={},MQ={},LQ={},UQ={},VQ={},FQ={},BQ={},jQ={},GQ={},HQ={},zQ={},qQ={},XQ={},KQ={},WQ={},YQ={},JQ={},QQ=function(e,t,r){var n,i,o,a=PJ(e);if(t){if(i=this.parse(a))throw zJ(i);this.searchParams=null}else{if(void 0!==r&&(n=new QQ(r,!0)),i=this.parse(a,null,n))throw zJ(i);(o=GJ(new jJ)).bindURL(this),this.searchParams=o}};QQ.prototype={type:"URL",parse:function(e,t,r){var n,i,o,a,s,u=this,c=t||OQ,d=0,l="",h=!1,f=!1,p=!1;for(e=PJ(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=eQ(e,gQ,"")),e=eQ(e,yQ,""),n=OJ(e);d<=n.length;){switch(i=n[d],c){case OQ:if(!i||!YJ(cQ,i)){if(t)return aQ;c=NQ;continue}l+=iQ(i),c=xQ;break;case xQ:if(i&&(YJ(dQ,i)||"+"==i||"-"==i||"."==i))l+=iQ(i);else{if(":"!=i){if(t)return aQ;l="",c=NQ,d=0;continue}if(t&&(u.isSpecial()!=wJ(IQ,l)||"file"==l&&(u.includesCredentials()||null!==u.port)||"file"==u.scheme&&!u.host))return;if(u.scheme=l,t)return void(u.isSpecial()&&IQ[u.scheme]==u.port&&(u.port=null));l="","file"==u.scheme?c=HQ:u.isSpecial()&&r&&r.scheme==u.scheme?c=DQ:u.isSpecial()?c=UQ:"/"==n[d+1]?(c=PQ,d++):(u.cannotBeABaseURL=!0,$J(u.path,""),c=WQ)}break;case NQ:if(!r||r.cannotBeABaseURL&&"#"!=i)return aQ;if(r.cannotBeABaseURL&&"#"==i){u.scheme=r.scheme,u.path=xJ(r.path),u.query=r.query,u.fragment="",u.cannotBeABaseURL=!0,c=JQ;break}c="file"==r.scheme?HQ:MQ;continue;case DQ:if("/"!=i||"/"!=n[d+1]){c=MQ;continue}c=VQ,d++;break;case PQ:if("/"==i){c=FQ;break}c=KQ;continue;case MQ:if(u.scheme=r.scheme,i==mJ)u.username=r.username,u.password=r.password,u.host=r.host,u.port=r.port,u.path=xJ(r.path),u.query=r.query;else if("/"==i||"\\"==i&&u.isSpecial())c=LQ;else if("?"==i)u.username=r.username,u.password=r.password,u.host=r.host,u.port=r.port,u.path=xJ(r.path),u.query="",c=YQ;else{if("#"!=i){u.username=r.username,u.password=r.password,u.host=r.host,u.port=r.port,u.path=xJ(r.path),u.path.length--,c=KQ;continue}u.username=r.username,u.password=r.password,u.host=r.host,u.port=r.port,u.path=xJ(r.path),u.query=r.query,u.fragment="",c=JQ}break;case LQ:if(!u.isSpecial()||"/"!=i&&"\\"!=i){if("/"!=i){u.username=r.username,u.password=r.password,u.host=r.host,u.port=r.port,c=KQ;continue}c=FQ}else c=VQ;break;case UQ:if(c=VQ,"/"!=i||"/"!=WJ(l,d+1))continue;d++;break;case VQ:if("/"!=i&&"\\"!=i){c=FQ;continue}break;case FQ:if("@"==i){h&&(l="%40"+l),h=!0,o=OJ(l);for(var v=0;v<o.length;v++){var _=o[v];if(":"!=_||p){var m=TQ(_,kQ);p?u.password+=m:u.username+=m}else p=!0}l=""}else if(i==mJ||"/"==i||"?"==i||"#"==i||"\\"==i&&u.isSpecial()){if(h&&""==l)return"Invalid authority";d-=OJ(l).length+1,l="",c=BQ}else l+=i;break;case BQ:case jQ:if(t&&"file"==u.scheme){c=qQ;continue}if(":"!=i||f){if(i==mJ||"/"==i||"?"==i||"#"==i||"\\"==i&&u.isSpecial()){if(u.isSpecial()&&""==l)return sQ;if(t&&""==l&&(u.includesCredentials()||null!==u.port))return;if(a=u.parseHost(l))return a;if(l="",c=XQ,t)return;continue}"["==i?f=!0:"]"==i&&(f=!1),l+=i}else{if(""==l)return sQ;if(a=u.parseHost(l))return a;if(l="",c=GQ,t==jQ)return}break;case GQ:if(!YJ(lQ,i)){if(i==mJ||"/"==i||"?"==i||"#"==i||"\\"==i&&u.isSpecial()||t){if(""!=l){var g=qJ(l,10);if(g>65535)return uQ;u.port=u.isSpecial()&&g===IQ[u.scheme]?null:g,l=""}if(t)return;c=XQ;continue}return uQ}l+=i;break;case HQ:if(u.scheme="file","/"==i||"\\"==i)c=zQ;else{if(!r||"file"!=r.scheme){c=KQ;continue}if(i==mJ)u.host=r.host,u.path=xJ(r.path),u.query=r.query;else if("?"==i)u.host=r.host,u.path=xJ(r.path),u.query="",c=YQ;else{if("#"!=i){wQ(JJ(xJ(n,d),""))||(u.host=r.host,u.path=xJ(r.path),u.shortenPath()),c=KQ;continue}u.host=r.host,u.path=xJ(r.path),u.query=r.query,u.fragment="",c=JQ}}break;case zQ:if("/"==i||"\\"==i){c=qQ;break}r&&"file"==r.scheme&&!wQ(JJ(xJ(n,d),""))&&(AQ(r.path[0],!0)?$J(u.path,r.path[0]):u.host=r.host),c=KQ;continue;case qQ:if(i==mJ||"/"==i||"\\"==i||"?"==i||"#"==i){if(!t&&AQ(l))c=KQ;else if(""==l){if(u.host="",t)return;c=XQ}else{if(a=u.parseHost(l))return a;if("localhost"==u.host&&(u.host=""),t)return;l="",c=XQ}continue}l+=i;break;case XQ:if(u.isSpecial()){if(c=KQ,"/"!=i&&"\\"!=i)continue}else if(t||"?"!=i)if(t||"#"!=i){if(i!=mJ&&(c=KQ,"/"!=i))continue}else u.fragment="",c=JQ;else u.query="",c=YQ;break;case KQ:if(i==mJ||"/"==i||"\\"==i&&u.isSpecial()||!t&&("?"==i||"#"==i)){if(".."===(s=iQ(s=l))||"%2e."===s||".%2e"===s||"%2e%2e"===s?(u.shortenPath(),"/"==i||"\\"==i&&u.isSpecial()||$J(u.path,"")):CQ(l)?"/"==i||"\\"==i&&u.isSpecial()||$J(u.path,""):("file"==u.scheme&&!u.path.length&&AQ(l)&&(u.host&&(u.host=""),l=WJ(l,0)+":"),$J(u.path,l)),l="","file"==u.scheme&&(i==mJ||"?"==i||"#"==i))for(;u.path.length>1&&""===u.path[0];)tQ(u.path);"?"==i?(u.query="",c=YQ):"#"==i&&(u.fragment="",c=JQ)}else l+=TQ(i,RQ);break;case WQ:"?"==i?(u.query="",c=YQ):"#"==i?(u.fragment="",c=JQ):i!=mJ&&(u.path[0]+=TQ(i,bQ));break;case YQ:t||"#"!=i?i!=mJ&&("'"==i&&u.isSpecial()?u.query+="%27":u.query+="#"==i?"%23":TQ(i,bQ)):(u.fragment="",c=JQ);break;case JQ:i!=mJ&&(u.fragment+=TQ(i,EQ))}d++}},parseHost:function(e){var t,r,n;if("["==WJ(e,0)){if("]"!=WJ(e,e.length-1))return sQ;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 WJ(e,l)};if(":"==h()){if(":"!=WJ(e,1))return;l+=2,d=++c}for(;h();){if(8==c)return;if(":"!=h()){for(t=r=0;r<4&&YJ(vQ,h());)t=16*t+qJ(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(!YJ(lQ,h()))return;for(;YJ(lQ,h());){if(o=qJ(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}(nQ(e,1,-1)),!t)return sQ;this.host=t}else if(this.isSpecial()){if(e=DJ(e),YJ(_Q,e))return sQ;if(t=function(e){var t,r,n,i,o,a,s,u=rQ(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"==WJ(i,0)&&(o=YJ(hQ,i)?16:8,i=nQ(i,8==o?1:2)),""===i)a=0;else{if(!YJ(10==o?pQ:8==o?fQ:vQ,i))return e;a=qJ(i,o)}$J(r,a)}for(n=0;n<t;n++)if(a=r[n],n==t-1){if(a>=KJ(256,5-t))return null}else if(a>255)return null;for(s=ZJ(r),n=0;n<r.length;n++)s+=r[n]*KJ(256,3-n);return s}(e),null===t)return sQ;this.host=t}else{if(YJ(mQ,e))return sQ;for(t="",r=OJ(e),n=0;n<r.length;n++)t+=TQ(r[n],bQ);this.host=t}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||"file"==this.scheme},includesCredentials:function(){return""!=this.username||""!=this.password},isSpecial:function(){return wJ(IQ,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;!t||"file"==this.scheme&&1==t&&AQ(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+=SQ(i),null!==o&&(c+=":"+o)):"file"==t&&(c+="//"),c+=e.cannotBeABaseURL?a[0]:a.length?"/"+JJ(a,"/"):"",null!==s&&(c+="?"+s),null!==u&&(c+="#"+u),c},setHref:function(e){var t=this.parse(e);if(t)throw zJ(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if("blob"==e)try{return new ZQ(e.path[0]).origin}catch(VZ){return"null"}return"file"!=e&&this.isSpecial()?e+"://"+SQ(this.host)+(null!==t?":"+t:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse(PJ(e)+":",OQ)},getUsername:function(){return this.username},setUsername:function(e){var t=OJ(PJ(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var r=0;r<t.length;r++)this.username+=TQ(t[r],kQ)}},getPassword:function(){return this.password},setPassword:function(e){var t=OJ(PJ(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var r=0;r<t.length;r++)this.password+=TQ(t[r],kQ)}},getHost:function(){var e=this.host,t=this.port;return null===e?"":null===t?SQ(e):SQ(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,BQ)},getHostname:function(){var e=this.host;return null===e?"":SQ(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,jQ)},getPort:function(){var e=this.port;return null===e?"":PJ(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""==(e=PJ(e))?this.port=null:this.parse(e,GQ))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+JJ(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,XQ))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){""==(e=PJ(e))?this.query=null:("?"==WJ(e,0)&&(e=nQ(e,1)),this.query="",this.parse(e,YQ)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){""!=(e=PJ(e))?("#"==WJ(e,0)&&(e=nQ(e,1)),this.fragment="",this.parse(e,JQ)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var ZQ=function(e){var t=AJ(this,$Q),r=LJ(arguments.length,1)>1?arguments[1]:void 0,n=FJ(t,new QQ(e,!1,r));SJ||(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())},$Q=ZQ.prototype,eZ=function(e,t){return{get:function(){return BJ(this)[e]()},set:t&&function(e){return BJ(this)[t](e)},configurable:!0,enumerable:!0}};if(SJ&&TJ($Q,{href:eZ("serialize","setHref"),origin:eZ("getOrigin"),protocol:eZ("getProtocol","setProtocol"),username:eZ("getUsername","setUsername"),password:eZ("getPassword","setPassword"),host:eZ("getHost","setHost"),hostname:eZ("getHostname","setHostname"),port:eZ("getPort","setPort"),pathname:eZ("getPathname","setPathname"),search:eZ("getSearch","setSearch"),searchParams:eZ("getSearchParams"),hash:eZ("getHash","setHash")}),IJ($Q,"toJSON",(function(){return BJ(this).serialize()}),{enumerable:!0}),IJ($Q,"toString",(function(){return BJ(this).serialize()}),{enumerable:!0}),HJ){var tZ=HJ.createObjectURL,rZ=HJ.revokeObjectURL;tZ&&IJ(ZQ,"createObjectURL",RJ(tZ,HJ)),rZ&&IJ(ZQ,"revokeObjectURL",RJ(rZ,HJ))}MJ(ZQ,"URL"),yJ({global:!0,forced:!bJ,sham:!SJ},{URL:ZQ});var nZ=function(){var e=s(regeneratorRuntime.mark((function e(t,r){var n;return regeneratorRuntime.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)}}(),iZ=Object.defineProperty,oZ=Object.getOwnPropertyDescriptor,aZ=function(e,t,r,n){for(var i,o=n>1?void 0:n?oZ(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&&iZ(t,r,o),o},sZ=function(){function e(t){u(this,e),l(this,"_sharedAudioContext",new AudioContext),l(this,"_audioDestination",this._sharedAudioContext.createMediaStreamDestination()),l(this,"_localGainNode",this._sharedAudioContext.createGain()),l(this,"_bufferGainNode",this._sharedAudioContext.createGain()),l(this,"_audioBufferSource",void 0),l(this,"_localSource",void 0),l(this,"_context",void 0),l(this,"_failedAudioList",[]),l(this,"mixingMap",new Map),l(this,"resourcesCache",new Map),l(this,"volumeConfig",new Map),l(this,"cachedBuffer",[]),this._context=t,this._localGainNode.gain.value=1}var t,r,n;return d(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=s(regeneratorRuntime.mark((function e(t,r,n){var i,o,a,s,u,c,d,l,h,f,p,v,_,m=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=n.playCount,KP(o=n.type,"mixingType",VW($)),a=this._context.getLocalAudioTrack()){e.next=5;break}return e.abrupt("return");case 5:if((s=a.getTrack("preprocessing"))&&this.mixMediaStream(new MediaStream([s])),null!=(u=this.mixingMap.get(t))&&u.audioNode){u.audioNode.pause(),this._context.emitMessage({mixId:t,state:ee.AUDIO_MIXING_STATE_STOPPED,error:hD.AUDIO_MIXING_ERROR_OK});try{u.gainNode.disconnect(this._audioDestination),u.audioSource.disconnect(u.gainNode)}catch(g){}}if(!(d=this.resourcesCache.get(t))||d.filePath!==r){e.next=14;break}c=d.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 m._context.emitMessage({mixId:t,state:ee.AUDIO_MIXING_STATE_FAILED,error:hD.AUDIO_MIXING_ERROR_START_FAILED}),new fD(lD.LOAD_RESOURCES_FAILED,e.statusText)}));case 16:return l=e.sent,r.endsWith("mp3")?h={type:"audio/mpeg"}:r.endsWith("aac")&&(h={type:"audio/aac"}),e.next=20,nZ(l,h);case 20:if(e.sent){e.next=24;break}throw this._context.emitMessage({mixId:t,state:ee.AUDIO_MIXING_STATE_FAILED,error:hD.AUDIO_MIXING_ERROR_START_FAILED}),new fD(lD.LOAD_RESOURCES_FAILED,"invalid audio resource");case 24:(c=new Audio).crossOrigin="anonymous",c.src=URL.createObjectURL(new Blob([l],h));case 27:return i<=0?c.loop=!0:i>0&&(f=i,c.onended=function(){--f>0?c.play():(m.mixingMap.delete(t),m._context.emitMessage({mixId:t,state:ee.AUDIO_MIXING_STATE_FINISHED,error:hD.AUDIO_MIXING_ERROR_OK}))}),e.prev=28,e.next=31,c.play();case 31:e.next=38;break;case 33:e.prev=33,e.t0=e.catch(28),console.error(e.t0),this._failedAudioList.push(c),this._context.onAutoPlayFailed();case 38:if(p=this._sharedAudioContext.createMediaElementSource(c),v=this._sharedAudioContext.createGain(),_=this.volumeConfig.get(t),v.gain.value=_?_/100:1,p.connect(v).connect(this._audioDestination),this.mixingMap.set(t,{audioSource:p,audioNode:c,gainNode:v,type:"file"}),o===$.PUBLISH)try{v.disconnect(this._sharedAudioContext.destination)}catch(g){}else v.connect(this._sharedAudioContext.destination);this._context.updateLocalAudioTrack(this._audioDestination.stream.getAudioTracks()[0],n.type),this._context.emitMessage({mixId:t,state:ee.AUDIO_MIXING_STATE_PLAYING,error:hD.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:ee.AUDIO_MIXING_STATE_STOPPED,error:hD.AUDIO_MIXING_ERROR_OK}))}},{key:"pauseAudioMixing",value:function(e){var t=this.mixingMap.get(e);t&&(this._context.emitMessage({mixId:e,state:ee.AUDIO_MIXING_STATE_PAUSED,error:hD.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:ee.AUDIO_MIXING_STATE_PLAYING,error:hD.AUDIO_MIXING_ERROR_OK}),t.audioNode.play())}},{key:"preloadAudioMixing",value:(r=s(regeneratorRuntime.mark((function e(t,r){var n,i=this;return regeneratorRuntime.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:ee.AUDIO_MIXING_STATE_FAILED,error:hD.AUDIO_MIXING_ERROR_PRELOAD_FAILED}),new fD(lD.LOAD_RESOURCES_FAILED,e.statusText)})).catch((function(e){throw i._context.emitMessage({mixId:t,state:ee.AUDIO_MIXING_STATE_FAILED,error:hD.AUDIO_MIXING_ERROR_PRELOAD_FAILED}),new fD(lD.LOAD_RESOURCES_FAILED,"Load resources failed",e)}));case 3:return n=e.sent,e.next=6,nZ(n);case 6:if(e.sent){e.next=10;break}throw this._context.emitMessage({mixId:t,state:ee.AUDIO_MIXING_STATE_FAILED,error:hD.AUDIO_MIXING_ERROR_PRELOAD_FAILED}),new fD(lD.LOAD_RESOURCES_FAILED,"Load resources failed");case 10:this._context.emitMessage({mixId:t,state:ee.AUDIO_MIXING_STATE_PRELOADED,error:hD.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){KP(e,"type",VW($));var t=this._context.getLocalAudioTrack();if(t){var r=t.getTrack("preprocessing");if(r&&this.mixMediaStream(new MediaStream([r])),e===$.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:ee.AUDIO_MIXING_STATE_PCM_ENABLED,error:hD.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:ee.AUDIO_MIXING_STATE_PCM_DISABLED,error:hD.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=s(regeneratorRuntime.mark((function e(){var t,r,n,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=[],r=T(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}();aZ([JV("default","id","filePath","options")],sZ.prototype,"startAudioMixing",1),aZ([JV("default","id")],sZ.prototype,"stopAudioMixing",1),aZ([JV("default","id")],sZ.prototype,"pauseAudioMixing",1),aZ([JV("default","id")],sZ.prototype,"resumeAudioMixing",1),aZ([JV("default","id")],sZ.prototype,"preloadAudioMixing",1),aZ([JV("default","id")],sZ.prototype,"unloadAudioMixing",1),aZ([JV("default","id")],sZ.prototype,"getAudioMixingVolume",1),aZ([JV("default","id","volume")],sZ.prototype,"setAudioMixingVolume",1),aZ([JV("default","id")],sZ.prototype,"getAudioMixingDuration",1),aZ([JV("default","id")],sZ.prototype,"getAudioMixingCurrentPosition",1),aZ([JV("default","id","position")],sZ.prototype,"setAudioMixingPosition",1),aZ([JV("default","type")],sZ.prototype,"enableAudioMixingBuffer",1),aZ([JV()],sZ.prototype,"disableAudioMixingBuffer",1),aZ([JV("default","buffer")],sZ.prototype,"pushAudioMixingBuffer",1);var uZ=function(e){return e.NORMAL_USER="normalUser",e.SILENT_USER="silentUser",e}(uZ||{}),cZ=new pM("RTMClient",1),dZ=function(e){h(v,e);var t,r,n,i,o,a,c,p=g(v);function v(e){var t;return u(this,v),l(_(t=p.call(this)),"_dataChannelSignal",null),l(_(t),"_handler",null),l(_(t),"_dataChannelSignalState",XG.DISCONNECTED),l(_(t),"_loginSessionId",null),l(_(t),"_userId",null),l(_(t),"_token",null),l(_(t),"_isReconnecting",!1),l(_(t),"_reconnectTimer",null),l(_(t),"_loginResolveCallback",null),l(_(t),"_loginRejectCallback",null),l(_(t),"_iceConfigNode",null),l(_(t),"_wait_login_token",!1),t._appId=e,t}return d(v,[{key:"login",value:function(e,t){var r=this;return new Promise((function(n,i){if(cZ.print("login","invoke login, token: %o, userId: %o",e,t),r._loginSessionId)throw new fD(lD.ALREADY_LOGIN,"Already logined");if(r._loginResolveCallback)throw new fD(lD.LOGIN_FAILED,"Is logging in, please try again later.");r._userId=t,r._token=e,KV.setStats({rtc_app_id:r._appId,user_id:t}),r._loginResolveCallback=n,r._loginRejectCallback=i,r._dataChannelSignal?r._login():(cZ.print("login","init dataChannelSingling"),r._dataChannelSignalState=XG.CONNECTING,r._createDataChannelSignaling(t).then((function(e){r._dataChannelSignal=e,r._login()})).catch((function(){r._onDisconnect()})))}))}},{key:"logout",value:(c=s(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._loginSessionId&&this._userId){e.next=2;break}throw new fD(lD.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:PF.C2RTM}).catch((function(){}));case 4:this._closeDataChannelSignaling(),this._clearState();case 6:case"end":return e.stop()}}),e,this)}))),function(){return c.apply(this,arguments)})},{key:"updateLoginToken",value:(a=s(regeneratorRuntime.mark((function e(t){var r=this;return regeneratorRuntime.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 a.apply(this,arguments)})},{key:"getPeerOnlineStatus",value:(o=s(regeneratorRuntime.mark((function e(t){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._loginSessionId&&this._userId){e.next=2;break}throw new fD(lD.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:PF.C2RTM});case 5:return r=e.sent,e.abrupt("return",null==r?void 0:r.status);case 7:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"sendUserMessageOutsideRoom",value:(i=s(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._loginSessionId&&this._userId){e.next=2;break}throw new fD(lD.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=s(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._loginSessionId&&this._userId){e.next=2;break}throw new fD(lD.NOT_LOGIN,"login first");case 2:return this._checkDataChannelSignal(),e.next=5,this._dataChannelSignal.sendSignaling("setServerParams",{loginSessionId:this._loginSessionId,userId:this._userId,appId:this._appId,signature:t,url:r},{functionType:PF.C2RTM});case 5:case"end":return e.stop()}}),e,this)}))),function(e,t){return n.apply(this,arguments)})},{key:"sendServerMessage",value:(r=s(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._loginSessionId&&this._userId){e.next=2;break}throw new fD(lD.NOT_LOGIN,"login first");case 2:return this._checkDataChannelSignal(),e.abrupt("return",this._dataChannelSignal.sendP2PMessage({from:this._userId,app:this._appId,to:"",room:"",type:CF.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(),S(f(v.prototype),"removeAllListeners",this).call(this)}},{key:"_login",value:function(){var e=this;if(this._userId){var t=TP();this._checkDataChannelSignal(),this._dataChannelSignal.sendSignaling("login",{Token:CP.token2auth(this._appId,null,this._userId,this._token),timestamp:Date.now(),loginSessionId:t,params:{deviceType:"web",userAgent:window.navigator.userAgent,sdkVersion:hF.VERSION,deviceId:sF.getDeviceId(),appId:this._appId,userId:this._userId}},{functionType:PF.C2RTM}).then((function(){"function"==typeof e._loginResolveCallback&&e._loginResolveCallback(),e._loginSessionId=t,e._wait_login_token=!1})).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=lD.INVALID_PARAMS,n="Invalid userId"):(r=lD.INVALID_TOKEN,n="Invalid token",e._wait_login_token=!0,e._loginRejectCallback||e.emit("onRTMTokenError")):(r=lD.LOGIN_FAILED,n="login failed"),"function"==typeof e._loginRejectCallback&&e._loginRejectCallback(new fD(r,a||n))})).finally((function(){e._loginResolveCallback=null,e._loginRejectCallback=null}))}}},{key:"_createDataChannelSignaling",value:(t=s(regeneratorRuntime.mark((function e(t){var r,n,i,o,a,s,u,c=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=new FF,i=this._iceConfigNode){e.next=16;break}return e.prev=3,e.next=6,null==n?void 0:n.getAccessNode(this._appId,"",t,sF.getDeviceId(),"");case 6:if(o=e.sent,i=o[0]){e.next=10;break}throw new Error;case 10:e.next=16;break;case 12:throw e.prev=12,e.t0=e.catch(3),ZV("rtm.login.getNodeFailed","",0,!0),new fD(lD.ICE_SERVER_WRONG,"get ICE config failed");case 16:return ZV("rtm.login.getNodeSuccess",i,0,!0),cZ.print("_createDataChannelSignaling()","get node success",i),this._handler=LG(zV),null===(r=this._handler)||void 0===r||r.once("disconnect",(function(){cZ.print("_createDataChannelSignaling()","recv BasicHandler event: disconnect"),c._onDisconnect()})),e.prev=20,e.next=23,null===(s=this._handler)||void 0===s?void 0:s.connect(i);case 23:a=e.sent,cZ.print("_createDataChannelSignaling()","establish peerConnection success"),this._dataChannelSignalState=XG.CONNECTED,e.next=33;break;case 28:throw e.prev=28,e.t1=e.catch(20),this._iceConfigNode=null,this._dataChannelSignalState=XG.DISCONNECTED,new fD(lD.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed",e.t1);case 33:return u=new LF(a),cZ.print("_createDataChannelSignaling()","send ping"),u.sendPingSignaling(),u.once("close",(function(){cZ.print("_createDataChannelSignaling()","recv DataChannelSignaling event: close"),c._onDisconnect()})),u.on(RF.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM,(function(e){c.emit("onUserMessageReceivedOutsideRoom",{userId:e.from,message:e.msg})})),u.on(RF.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM,(function(e){c.emit("onUserBinaryMessageReceivedOutsideRoom",{userId:e.from,message:e.msg})})),u.on(RF.USER_DISCONNECTION,(function(){c.emit("onUserDisconnection"),c._clearState()})),u.on(RF.NODE_CHANGE,(function(e){ZV("rtm.nodeChange",JSON.stringify(e),0,!0),Array.isArray(e.nodes)&&e.nodes.length&&(c._iceConfigNode=e.nodes[0]),c._loginResolveCallback&&c._loginRejectCallback?c._login():c._reconnect()})),e.abrupt("return",u);case 42:case"end":return e.stop()}}),e,this,[[3,12],[20,28]])}))),function(e){return t.apply(this,arguments)})},{key:"_closeDataChannelSignaling",value:function(){var e,t;null===(e=this._dataChannelSignal)||void 0===e||e.destroy(),this._dataChannelSignal=null,null===(t=this._handler)||void 0===t||t.destroy(),this._handler=null}},{key:"_checkDataChannelSignal",value:function(){if(!this._dataChannelSignal||this._dataChannelSignalState!==XG.CONNECTED)throw new fD(lD.NOT_CONNECTED_YET,"datachannel not connect")}},{key:"_onDisconnect",value:function(){this._dataChannelSignalState=XG.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&&(cZ.print("_reconnect()","start reconnect..."),this._isReconnecting=!0,this._createDataChannelSignaling(this._userId).then((function(t){cZ.print("_reconnect()","reconnect success!"),e._dataChannelSignal=t,e._login(),e._reconnectTimer=null})).catch((function(t){cZ.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)}}]),v}(cM.exports.EventEmitter),lZ=function(e){h(o,e);var t,r,n,i=g(o);function o(e){var t;return u(this,o),l(_(t=i.call(this)),"_mediaServerClient",void 0),l(_(t),"_appId",void 0),l(_(t),"_reconnectTimer",void 0),l(_(t),"remoteStreams",void 0),t._appId=e,t.remoteStreams=new Map,t}return d(o,[{key:"connect",value:(n=s(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._mediaServerClient=new WG({}),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=s(regeneratorRuntime.mark((function e(t){var r,n=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.remoteStreams.get(t)){e.next=2;break}throw new fD(lD.REPEAT_PLAY,"repeat play public media stream");case 2:return(r=new kG(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=HP(e),i=0;i<t.seiCount;i++)n.emit(mG.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=s(regeneratorRuntime.mark((function e(){var t,r,n,i=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:clearTimeout(this._reconnectTimer),t=T(this.remoteStreams);try{for(n=function(){var e=b(r.value,1)[0];i.remoteStreams.delete(e),i.startPlayPublicStream(e).then((function(){var t=i.remoteStreams.get(e);i.safeEmit(mG.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(TF.ABNORMAL_DISCONNECTION,this._reconnect.bind(this)),null===(t=this._mediaServerClient)||void 0===t||t.on("onRemoteStreamStats",(function(e){r.emit("onRemoteStreamStats",e)}))}}]),o}(_M),hZ=new pM("AudioDeviceManager",1),fZ=function(e){h(o,e);var t,r,n,i=g(o);function o(e){var t;return u(this,o),l(_(t=i.call(this)),"_audioLevelFetcher",void 0),l(_(t),"_playbackDeviceTestTimer",void 0),l(_(t),"_audioElement",void 0),l(_(t),"_audioTrack",void 0),l(_(t),"_mediaRecorder",void 0),l(_(t),"_recoderTimer",void 0),l(_(t),"_isAudioPlaybackDeviceTesting",!1),l(_(t),"_isAudioDeviceRecordTesting",!1),l(_(t),"_audioCaptureAndRecoderResolve",void 0),t._extensionManager=e,t}return d(o,[{key:"startAudioPlaybackDeviceTest",value:(n=s(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._isAudioPlaybackDeviceTesting&&!this._isAudioDeviceRecordTesting){e.next=2;break}throw new fD(lD.REPEAT_DEVICE_TEST,"device test cannot be called repeatedly at the same time.");case 2:return this._isAudioPlaybackDeviceTesting=!0,hZ.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&&(hZ.print("stopAudioPlaybackDeviceTest()","Invoke"),this._isAudioPlaybackDeviceTesting=!1,this._stopEmitAudioPlaybackDeviceTestVolume(),this._destroyAudioElement())}},{key:"startAudioDeviceRecordTest",value:(r=s(regeneratorRuntime.mark((function e(t){var r=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._isAudioDeviceRecordTesting){e.next=2;break}throw new fD(lD.REPEAT_DEVICE_TEST,"device test cannot be called repeatedly at the same time.");case 2:return this._isAudioDeviceRecordTesting=!0,hZ.print("startAudioDeviceRecordTest()","Invoke"),this._recoderTimer=window.setTimeout((function(){hZ.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(){hZ.print("stopAudioDeviceRecordAndPlayTest()","Invoke"),void 0!==this._recoderTimer&&(clearTimeout(this._recoderTimer),delete this._recoderTimer),this._stopAudioCaptureAndRecoder()}},{key:"stopAudioDevicePlayTest",value:function(){this._isAudioDeviceRecordTesting&&(hZ.print("stopAudioDevicePlayTest()","Invoke"),this._isAudioDeviceRecordTesting=!1,this.stopAudioDeviceRecordAndPlayTest(),this._stopEmitAudioPlaybackDeviceTestVolume(),this._destroyAudioElement())}},{key:"getRecordTrack",value:function(){return this._audioTrack}},{key:"destroy",value:function(){hZ.print("destroy()","Invoke"),S(f(o.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=iK("audio",{attributes:{src:e,crossOrigin:"",autoplay:"true"}}),r._audioElement.loop=t.loop,hZ.print("_playAudioFile()","url=".concat(e,";loop=").concat(t.loop)),r._audioElement.oncanplay=function(){hZ.print("_playAudioFile()","oncanplay"),n()},r._audioElement.onerror=function(e){var t,n;i(new fD(lD.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&&(hZ.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&&(hZ.print("_startEmitAudioPlaybackDeviceTestVolume()","start timer(".concat(e,"ms)")),this._audioLevelFetcher=new vj(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&&(hZ.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=s(regeneratorRuntime.mark((function e(t){var r,n=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Gj({},this._extensionManager);case 2:return this._audioTrack=e.sent,i=this._audioTrack.getTrack("preprocessing"),r=Sj.get(i),hZ.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=s(regeneratorRuntime.mark((function r(o){var a,s;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!n._isAudioDeviceRecordTesting){r.next=16;break}return hZ.print("startAudioDeviceRecordTest()","get recorded file."),s=new Blob([o.data]),r.prev=3,r.next=6,n._playAudioFile(URL.createObjectURL(s),{loop:!1});case 6:r.next=11;break;case 8:return r.prev=8,r.t0=r.catch(3),r.abrupt("return",i(r.t0));case 11:n._startEmitAudioPlaybackDeviceTestVolume(t),null===(a=n._audioElement)||void 0===a||a.addEventListener("ended",(function(){n.stopAudioDevicePlayTest(),e()})),n._audioCaptureAndRecoderResolve=e,r.next=17;break;case 16:e();case 17:case"end":return r.stop()}}),r,null,[[3,8]])})));return function(e){return r.apply(this,arguments)}}(),n._mediaRecorder.onerror=function(e){i(new fD(lD.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}}]),o}(cM.exports.EventEmitter),pZ=function(){function e(){u(this,e),l(this,"engineBAC",{adm:{},agc:{},ans:{}}),l(this,"engineANM",{}),l(this,"bitrate",void 0),l(this,"sampleRate",void 0),l(this,"channel",void 0),l(this,"aec",void 0),l(this,"agc",void 0),l(this,"ans",void 0),this._init()}var t;return d(e,[{key:"_init",value:(t=s(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=new BF,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 Y.fluent:r=16e3,t=24e3;break;case Y.standard:r=48e3,t=48e3;break;case Y.hd:r=48e3,t=128e3,n=2;break;case Y.standardStereo:r=48e3,t=8e4,n=2;break;case Y.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}(),vZ=new pM("VideoSnapshot",1),_Z=function(e){var t=null==e?void 0:e.domElement;if(t&&!t.paused&&4===t.readyState)return t},mZ=function(){var e=s(regeneratorRuntime.mark((function e(t,r,n){var i,o,a,s,u,c,d,l;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=document.createElement("canvas"),o=i.getContext("2d")){e.next=4;break}throw new Error("canvas.getContext error");case 4:if(a=function(e,t,n){return t=t||e.width,n=n||e.height,i.width=t,i.height=n,r?o.setTransform(-1,0,0,1,t,0):o.setTransform(1,0,0,1,0,0),o.drawImage(e,0,0,t,n),o.getImageData(0,0,t,n)},s=Date.now(),!(u=_Z(n))){e.next=16;break}return vZ.print("takeSnapshot","VideoPlayer already set."),e.next=11,a(u,u.videoWidth,u.videoHeight);case 11:return c=e.sent,vZ.print("takeSnapshot","success, cost ".concat(Date.now()-s,"ms")),e.abrupt("return",c);case 16:if(!window.ImageCapture){e.next=29;break}if("live"!==(d=new window.ImageCapture(t)).track.readyState||!d.track.enabled||d.track.muted){e.next=29;break}return vZ.print("takeSnapshot","use ImageCapture"),e.t0=a,e.next=23,d.grabFrame();case 23:return e.t1=e.sent,e.next=26,(0,e.t0)(e.t1);case 26:return l=e.sent,vZ.print("takeSnapshot","success, cost ".concat(Date.now()-s,"ms")),e.abrupt("return",l);case 29:return vZ.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=a(i,i.videoWidth,i.videoHeight);vZ.print("takeSnapshot","success, cost ".concat(Date.now()-s,"ms")),e(r),n.removeTrack(t),i.srcObject=null,i.load()},i.onerror=r,i.srcObject=n,i.play()})));case 31:case"end":return e.stop()}}),e)})));return function(t,r,n){return e.apply(this,arguments)}}(),gZ=new WeakMap,yZ=function(e,t,r){var n;if(requestAnimationFrame){var i=gZ.get(e);null!==(n=i)&&void 0!==n&&n[t]?SZ(e,t):i||(i={},gZ.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))}()}},SZ=function(e,t){var r=gZ.get(e);t&&r[t]?cancelAnimationFrame(r[t]):Object.keys(r).length&&Object.keys(r).forEach((function(e){cancelAnimationFrame(r[e])}))},bZ=Object.defineProperty,EZ=Object.getOwnPropertyDescriptor,RZ=function(e,t,r,n){for(var i,o=n>1?void 0:n?EZ(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&&bZ(t,r,o),o},kZ=new pM("Engine",0),TZ=function(e){h(Ve,e);var t,r,n,o,a,c,p,v,m,y,E,R,k,T,w,C,O,D,P,B,j,G,H,X,K,Y,Q,Z,ee,te,ne,ie,oe,ae,se,ue,ce,de,le,he,fe,pe,ve,_e,me,ge,ye,Se,be,Ee,Re,ke,Te,Ie,Ae,we,Ce,Oe,xe,Ne,De,Pe,Me,Le,Ue=g(Ve);function Ve(e,t){var r;return u(this,Ve),l(_(r=Ue.call(this)),"_room",void 0),l(_(r),"_outsideRoom",void 0),l(_(r),"_appId",void 0),l(_(r),"_businessId",void 0),l(_(r),"_visibility",!0),l(_(r),"_localVideoTrack",void 0),l(_(r),"_localAudioTrack",void 0),l(_(r),"_localImgVideoTrack",void 0),l(_(r),"_localImgScreenTrack",void 0),l(_(r),"_localScreenVideoTrack",void 0),l(_(r),"_localScreenAudioTrack",void 0),l(_(r),"_tempMixingAudioTrack",void 0),l(_(r),"_audioPlaybackDeviceId",void 0),l(_(r),"_videoPlayer",void 0),l(_(r),"_screenPlayer",void 0),l(_(r),"_remoteVideoPlayer",new Map),l(_(r),"_remoteScreenPlayer",new Map),l(_(r),"_remoteAudioPlayer",new Map),l(_(r),"_publicStreamAudioPlayer",new Map),l(_(r),"_publicStreamVideoPlayer",new Map),l(_(r),"_publicStreamIds",new Map),l(_(r),"_roomConfig",void 0),l(_(r),"_videoStreamConstraints",{}),l(_(r),"_audioStreamConstraints",{}),l(_(r),"_enableSimulcast",!1),l(_(r),"_videoStreamEncodeConfig",[yF]),l(_(r),"_screenStreamEncodeConfig",[SF]),l(_(r),"_trackSourceType",void 0),l(_(r),"_liveTranscodeConfig",void 0),l(_(r),"_useCloudProxy",void 0),l(_(r),"_startCloudProxyTimestamp",void 0),l(_(r),"_localVideoDeviceId",void 0),l(_(r),"_localAudioDeviceId",void 0),l(_(r),"_pauseAllSubscribeState",{audio:!1,video:!1}),l(_(r),"_audioVolumeIndicationTimer",void 0),l(_(r),"_dummyMainTimer",void 0),l(_(r),"_dummyScreenTimer",void 0),l(_(r),"_audioPropertiesReportTimer",null),l(_(r),"_mirrorType",F.MIRROR_TYPE_RENDER),l(_(r),"_audioMixingManager",void 0),l(_(r),"_pubLock",void 0),l(_(r),"_rtmClient",void 0),l(_(r),"_messageStatisticsObserver",void 0),l(_(r),"_tempRoomConfig",void 0),l(_(r),"_originIceConfigRequestUrls",void 0),l(_(r),"_originConfigServerUrls",void 0),l(_(r),"_originLogServerUrl",void 0),l(_(r),"_extensionManager",new gj),l(_(r),"_audioDeviceManager",new fZ(r._extensionManager)),l(_(r),"_audioProfileManager",new pZ),l(_(r),"_remoteVideoConfig",new Map),l(_(r),"_userPriorityMap",new Map),l(_(r),"_subscribeFallbackOption",z.DISABLE),l(_(r),"_config",void 0),l(_(r),"_updateMixAudioTrack",function(){var e=s(regeneratorRuntime.mark((function e(t){var n,i,o=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=o.length>1&&void 0!==o[1]?o[1]:$.PLAYOUT_AND_PUBLISH,kZ.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)}}()),l(_(r),"_onAudioMixingMessage",(function(e){r.safeEmit(re.onAudioMixingStateChanged,e)})),l(_(r),"_onAudioMixingAutoplayFailed",(function(){r.safeEmit(re.onAutoplayFailed,{})})),r._appId=e,r._pubLock=new FG("pubLock"),r._addDeviceEventHandler(),r._audioMixingManager=new sZ({getLocalAudioTrack:function(){return r._localAudioTrack},updateLocalAudioTrack:r._updateMixAudioTrack,emitMessage:r._onAudioMixingMessage,onAutoPlayFailed:r._onAudioMixingAutoplayFailed}),window.__rtc_engine__=_(r),window["__rtc_engine__".concat(Math.floor(100*Math.random()+1))]=_(r),r._trackSourceType={video:I.VIDEO_SOURCE_TYPE_INTERNAL,screenVideo:I.VIDEO_SOURCE_TYPE_INTERNAL,audio:A.AUDIO_SOURCE_TYPE_INTERNAL,screenAudio:A.AUDIO_SOURCE_TYPE_INTERNAL},r._config=t,r._rtmClient=new dZ(e),r._handleRTMClient(r._rtmClient),r._useCloudProxy=!1,r._handleAudioDeviceManager(),r._messageStatisticsObserver=new fK,r._extensionManager.setMinotor(HV),r}return d(Ve,[{key:"appId",get:function(){return this._appId},set:function(e){this._appId=e}},{key:"updateToken",value:(Le=s(regeneratorRuntime.mark((function e(t){var r,n,i,o,a,s,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(kZ.print("updateToken()","token: %s",t),XP(t,"token"),!(this.waitForNewToken&&null!==(r=this._room)&&void 0!==r&&r._roomInfo&&this._tempRoomConfig)){e.next=9;break}return o=null===(i=this._room)||void 0===i?void 0:i._roomInfo,a=o.roomId,s=o.userInfo,u=this._tempRoomConfig,delete this._tempRoomConfig,e.next=8,this.joinRoom(t,a,s,u);case 8:return e.abrupt("return",e.sent);case 9:if(this._room){e.next=11;break}throw new fD(lD.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 Le.apply(this,arguments)})},{key:"setVideoCaptureDevice",value:(Me=s(regeneratorRuntime.mark((function e(t){var r,n,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(kZ.print("setVideoCaptureDevice()","deviceId: %s",t),XP(t,"deviceId"),this._localVideoDeviceId=t,this._localVideoTrack){e.next=5;break}return e.abrupt("return");case 5:return n=this._videoStreamConstraints,"user"===t||"environment"===t||"left"===t||"right"===t?(delete n.deviceId,n.facingMode=t):n.deviceId={exact:t},this._videoStreamConstraints=n,e.next=10,Bj(n,this._extensionManager);case 10:if(i=e.sent,this._initLocalTrackEvents(i),this._localVideoTrack.close(),this._localVideoTrack=i,null!==(r=this._videoPlayer)&&void 0!==r&&r.played&&(this._videoPlayer.stop(),this._videoPlayer.playVideo(i),this._videoPlayer.mirror(!!this._mirrorType)),this._room){e.next=17;break}return e.abrupt("return");case 17:if(!this._room.hasPublished){e.next=20;break}return e.next=20,this._updatePublish();case 20:case"end":return e.stop()}}),e,this)}))),function(e){return Me.apply(this,arguments)})},{key:"setAudioCaptureDevice",value:(Pe=s(regeneratorRuntime.mark((function e(t){var r,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(kZ.print("setAudioCaptureDevice()","deviceId: %s",t),XP(t,"deviceId"),this._localAudioDeviceId=t,this._localAudioTrack){e.next=5;break}return e.abrupt("return");case 5:return(r=this._audioStreamConstraints).deviceId={exact:t},this._audioStreamConstraints=r,e.next=10,Gj(r,this._extensionManager,this._audioProfileManager);case 10:if(n=e.sent,this._initLocalTrackEvents(n),this._localAudioTrack.close(),this._localAudioTrack=n,this._room){e.next=16;break}return e.abrupt("return");case 16:if(!this._room.hasPublished){e.next=19;break}return e.next=19,this._updatePublish();case 19:case"end":return e.stop()}}),e,this)}))),function(e){return Pe.apply(this,arguments)})},{key:"_addDeviceEventHandler",value:function(){fj.on(re.onVideoDeviceStateChanged,this._onVideoDeviceStateChange.bind(this)),fj.on(re.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,g,y,S,b,E,R,k,T,I,A,w,C=this;null===(e=this._room)||void 0===e||e.on(RF.ON_ADD_STREAM,this._onAddStream.bind(this)),null===(t=this._room)||void 0===t||t.on(RF.ON_REMOVE_STREAM,this._onRemoveStream.bind(this)),null===(r=this._room)||void 0===r||r.on(RF.USER_CONNECTION,this._onUserConnection.bind(this)),null===(n=this._room)||void 0===n||n.on(mG.ON_USER_LEAVE,this._onUserLeave.bind(this)),null===(i=this._room)||void 0===i||i.on(mG.ON_ROOM_ERROR,this._onRoomError.bind(this)),null===(o=this._room)||void 0===o||o.on(mG.ON_NETWORK_QUALITY,this._onNetworkQuality.bind(this)),null===(a=this._room)||void 0===a||a.on(RF.ON_CUSTOM_MESSAGE,this._onCustomMessage.bind(this)),null===(s=this._room)||void 0===s||s.on(RF.USER_MESSAGE_RECEIVED,this._onUserMessageReceived.bind(this)),null===(u=this._room)||void 0===u||u.on(RF.USER_BINARY_MESSAGE_RECEIVED,this._onUserBinaryMessageReceived.bind(this)),null===(c=this._room)||void 0===c||c.on(RF.ON_USER_TOKEN_WILL_EXPIRE,this._onUserTokenWillExpire.bind(this)),null===(d=this._room)||void 0===d||d.on(RF.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(TF.ON_CONNECTION_STATE_CHANGE,this._onConnectionStateChange.bind(this)),null===(h=this._room)||void 0===h||h.on(mG.RESUBSCRIBE,this._onResubscribe.bind(this)),null===(f=this._room)||void 0===f||f.on(mG.SUBSCRIBE_PUSH_TRACK,this._onSubscribePushTrack.bind(this)),null===(p=this._room)||void 0===p||p.on(mG.REMOVE_PUSH_TRACK,this._onRemovePushTrack.bind(this)),null===(v=this._room)||void 0===v||v.on(mG.ON_PUBLISH_RESULT,(function(e){var t;null!==(t=C._room)&&void 0!==t&&t._roomConfig.isAutoPublish&&C.safeEmit(re.onAutoPublishResult,e)})),null===(_=this._room)||void 0===_||_.on(mG.ON_REMOTE_STREAM_STATS,(function(e){C.safeEmit(re.onRemoteStreamStats,e)})),null===(m=this._room)||void 0===m||m.on(mG.ON_LOCAL_STREAM_STATS,(function(e){C.safeEmit(re.onLocalStreamStats,e)})),null===(g=this._room)||void 0===g||g.on(mG.ON_USER_PUBLISH_STATE_CHANGE,this._onUserPublishStateChange.bind(this)),null===(y=this._room)||void 0===y||y.on(mG.ON_USER_START_AUDIO_CAPTURE,(function(e,t){var r=e.userId;C._updateAudioPlayerState(t),C.safeEmit(re.onUserStartAudioCapture,{userId:r})})),null===(S=this._room)||void 0===S||S.on(mG.ON_USER_STOP_AUDIO_CAPTURE,(function(e){var t=e.userId;C.safeEmit(re.onUserStopAudioCapture,{userId:t})})),null===(b=this._room)||void 0===b||b.on(mG.ON_USER_START_VIDEO_CAPTURE,(function(e){var t=e.userId;C.safeEmit(re.onUserStartVideoCapture,{userId:t})})),null===(E=this._room)||void 0===E||E.on(mG.ON_USER_STOP_VIDEO_CAPTURE,(function(e){var t=e.userId;C.safeEmit(re.onUserStopVideoCapture,{userId:t})})),null===(R=this._room)||void 0===R||R.on(mG.ON_SEI_MESSAGED_RECEIVED,(function(e){C.safeEmit(re.onSEIMessageReceived,e)})),null===(k=this._room)||void 0===k||k.on(mG.ON_REMOTE_VIDEO_SIZE_CHANGED,(function(e,t){C.safeEmit(re.onRemoteVideoSizeChanged,e,t)})),null===(T=this._room)||void 0===T||T.on(mG.ON_SIMULCAST_SUBSCRIBE_FALLBACK,(function(e){return C.safeEmit(re.onSimulcastSubscribeFallback,e)})),null===(I=this._room)||void 0===I||I.on(mG.RECONNECT_FAILED,(function(){C.safeEmit(re.onError,{errorCode:lD.RECONNECT_FAILED})})),null===(A=this._room)||void 0===A||A.on(mG.ON_VIDEO_STREAM_BANNED,(function(e){C.safeEmit(re.onVideoStreamBanned,{uid:e.uid,banned:e.banned})})),null===(w=this._room)||void 0===w||w.on(mG.ON_AUDIO_STREAM_BANNED,(function(e){C.safeEmit(re.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 sM(e)&&QV(e,LP(n)),(t=S(f(Ve.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:(De=s(regeneratorRuntime.mark((function e(t,r,n,o){var a,s,u,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(kZ.print("joinRoom()","token: %o roomId: %o, userInfo: %o, roomConfig: %o",t,r,n,o),$P(t)||XP(t,"token"),eM(r),nM(n),a={isAutoPublish:!0,isAutoSubscribeAudio:!0,isAutoSubscribeVideo:!0,roomProfileType:W.communication},LW(a,o),iM(a),!this._room||this._room.connectionState===XG.DISCONNECTED){e.next=11;break}throw new fD(lD.REPEAT_JOIN,"Already joined");case 11:return this._room=new rK(o,{audioProfileManager:this._audioProfileManager,streamRTT:{}}),this._room.userPriorityMap=this._userPriorityMap,this._room.subscribeFallbackOption=this._subscribeFallbackOption,this._addHandlerEventHandler(),s=this._liveTranscodeConfig&&vF("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?uZ.NORMAL_USER:uZ.SILENT_USER}),s,this._useCloudProxy,null===(u=this._config)||void 0===u?void 0:u.expectedIDC);case 20:return c=e.sent,this._roomConfig=o,this._tempRoomConfig&&delete this._tempRoomConfig,null!=o&&o.isAutoPublish&&(this._visibility?this._updatePublish({invokeByJoinRoom:!0,mediaType:L.AUDIO_AND_VIDEO}):this.safeEmit(re.onAutoPublishResult,{isScreen:!1,state:N.PUBLISH_FAIL})),e.abrupt("return",c);case 27:throw e.prev=27,e.t0=e.catch(16),e.t0.code===lD.INVALID_TOKEN&&(this._tempRoomConfig=o),e.t0;case 31:case"end":return e.stop()}}),e,this,[[16,27]])}))),function(e,t,r,n){return De.apply(this,arguments)})},{key:"leaveRoom",value:(Ne=s(regeneratorRuntime.mark((function e(){var t,r,n,i=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=i.length>0&&void 0!==i[0]&&i[0],kZ.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 Ne.apply(this,arguments)})},{key:"destroy",value:function(){var e,t,r;kZ.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=[yF],this._screenStreamEncodeConfig=[SF],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()}},{key:"publishStream",value:(xe=s(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(kZ.print("publishStream()","mediaType: %o",t),this._checkMediaType(t),this._assertNotInRoom(),!jP(t)||this._localVideoTrack||!this._localImgVideoTrack){e.next=7;break}return e.next=6,Lj(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 xe.apply(this,arguments)})},{key:"unpublishStream",value:(Oe=s(regeneratorRuntime.mark((function e(t,r){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(kZ.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:yG.UNPUB});case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return Oe.apply(this,arguments)})},{key:"publishScreen",value:(Ce=s(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(kZ.print("publishScreen()","mediaType: %o",t),this._checkMediaType(t),this._assertNotInRoom(),e.prev=3,!jP(t)||this._localScreenVideoTrack||!this._localImgScreenTrack){e.next=8;break}return e.next=7,Vj(this._localImgScreenTrack,this._extensionManager);case 7:this._localScreenVideoTrack=e.sent;case 8:return e.next=10,this._updateScreenPublish({mediaType:t,pubState:yG.PUB});case 10:e.next=19;break;case 12:if(e.prev=12,e.t0=e.catch(3),!(e.t0 instanceof fD)){e.next=18;break}throw e.t0;case 18:throw new fD(lD.UNEXPECTED_ERROR,"unexpected error",e.t0);case 19:case"end":return e.stop()}}),e,this,[[3,12]])}))),function(e){return Ce.apply(this,arguments)})},{key:"unpublishScreen",value:(we=s(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return kZ.print("unpublishScreen()","mediaType: %o",t),this._checkMediaType(t),this._assertNotInRoom(),e.next=5,this._updateScreenPublish({mediaType:t,pubState:yG.UNPUB});case 5:case"end":return e.stop()}}),e,this)}))),function(e){return we.apply(this,arguments)})},{key:"subscribeStream",value:(Ae=s(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return kZ.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 Ae.apply(this,arguments)})},{key:"_subscribe",value:(Ie=s(regeneratorRuntime.mark((function e(t,r,n){var i,o,a,s,u,c,d,l,h,f;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._checkMediaType(n),this._assertNotInRoom(),s=this._room.remoteStreams.get(r),u=null==s?void 0:s.find((function(e){return e.isScreen===t}))){e.next=6;break}throw new fD(lD.STREAM_NOT_EXIST,"stream not exist");case 6:return this._pauseAllSubscribeState.audio&&(n-=n&L.AUDIO),this._pauseAllSubscribeState.video&&(n-=n&L.VIDEO),kZ.print("subscribeStream()","due to pauseAll mediaType: %o",n),c=u.hasSubscribed,d=this._remoteVideoConfig.get(r)||(null===(i=this._roomConfig)||void 0===i?void 0:i.remoteVideoConfig),u.originalMediaType=n,e.next=14,this._room.subscribe(u,n,d);case 14:BP(n)&&this._updateAudioPlayerState(u),jP(n)&&this._updateVideoPlayerState(u),!t&&(null!==(o=this._roomConfig)&&void 0!==o&&o.isAutoSubscribeAudio||null!==(a=this._roomConfig)&&void 0!==a&&a.isAutoSubscribeVideo)&&(u.audioTrack||u.videoTrack)&&(l={userId:r,isScreen:!1,state:x.SUBSCRIBE_SUCC},this.safeEmit(re.onAutoSubscribeResult,l)),!c&&BP(n)&&u.hasAudio&&(null===(h=u.observer)||void 0===h||h.setSubscribeAudio(!0)),!c&&jP(n)&&u.hasVideo&&(null===(f=u.observer)||void 0===f||f.setSubscribeVideo(!0));case 19:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return Ie.apply(this,arguments)})},{key:"unsubscribeStream",value:(Te=s(regeneratorRuntime.mark((function e(t,r){var n,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(kZ.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 fD(lD.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:"subscribeScreen",value:(ke=s(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return kZ.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 ke.apply(this,arguments)})},{key:"unsubscribeScreen",value:(Re=s(regeneratorRuntime.mark((function e(t,r){var n,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(kZ.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 fD(lD.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:"setRemoteVideoConfig",value:(Ee=s(regeneratorRuntime.mark((function e(t,r){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return kZ.print("setRemoteVideoConfig() userId: %o, remoteVideoConfig: %o",t,r),tM(t),uM(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 Ee.apply(this,arguments)})},{key:"startVideoCapture",value:(be=s(regeneratorRuntime.mark((function e(t){var r,n,i,o,a,s,u,c,d,l=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(kZ.print("startVideoCapture()","deviceId: %s",t),$P(t)||XP(t,"deviceId"),t=t||this._localVideoDeviceId,this._localVideoDeviceId=t,!this._localVideoTrack||this._localVideoTrack.dummy){e.next=6;break}throw new fD(lD.REPEAT_CAPTURE,"Has already capture");case 6:return o=this._videoStreamConstraints,t&&("user"===t||"environment"===t||"left"===t||"right"===t?o.facingMode=t:o.deviceId={exact:t},this._videoStreamConstraints=o),e.next=10,Bj(o,this._extensionManager);case 10:if(a=e.sent,this._initLocalTrackEvents(a),this._localVideoTrack=a,null===(r=this._videoPlayer)||void 0===r||r.playVideo(a),s={},(u=null==a?void 0:a.getTrack())&&(s=u.getSettings(),c={width:s.width,height:s.height},this._localVideoTrack.resolution=c,setTimeout((function(){return l.safeEmit(re.onLocalVideoSizeChanged,{streamIndex:M.STREAM_INDEX_MAIN,info:c})}))),this._room){e.next=19;break}return e.abrupt("return",s);case 19:return d=this._room._roomConfig.isAutoPublish,(this._room.hasPublished||d)&&(this._visibility?this._updatePublish():this.safeEmit(re.onAutoPublishResult,{isScreen:!1,state:N.PUBLISH_FAIL})),null===(n=this._room.localStream)||void 0===n||null===(i=n.observer)||void 0===i||i.setEnableVideo(!0),e.abrupt("return",s);case 23:case"end":return e.stop()}}),e,this)}))),function(e){return be.apply(this,arguments)})},{key:"stopVideoCapture",value:(Se=s(regeneratorRuntime.mark((function e(){var t,r,n,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(kZ.print("stopVideoCapture()"),this._trackSourceType.video!==I.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=3;break}throw new fD(lD.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as internal first");case 3:if(null===(t=this._videoPlayer)||void 0===t||t.stop(),this._localVideoTrack&&(this._localVideoTrack.dummy||(this._localVideoTrack.close(),this._localImgVideoTrack&&(null===(i=this._localVideoTrack)||void 0===i||i.setTrack(this._localImgVideoTrack,this._extensionManager),this._localVideoTrack.dummy=!0))),this._room){e.next=7;break}return e.abrupt("return");case 7:if(!this._room.hasPublished){e.next=10;break}return e.next=10,this._updatePublish();case 10:null===(r=this._room.localStream)||void 0===r||null===(n=r.observer)||void 0===n||n.setEnableVideo(!1);case 11:case"end":return e.stop()}}),e,this)}))),function(){return Se.apply(this,arguments)})},{key:"startAudioCapture",value:(ye=s(regeneratorRuntime.mark((function e(t){var r,n,i,o,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(kZ.print("startAudioCapture()","deviceId: $o",t),$P(t)||XP(t,"deviceId"),t=t||this._localAudioDeviceId,this._localAudioDeviceId=t,!this._localAudioTrack){e.next=6;break}throw new fD(lD.REPEAT_CAPTURE,"Has already capture");case 6:return i=this._audioStreamConstraints,t&&(i.deviceId={exact:t},this._audioStreamConstraints=i),e.next=10,Gj(i,this._extensionManager,this._audioProfileManager);case 10:if(o=e.sent,this._initLocalTrackEvents(o),this._localAudioTrack=o,this._tempMixingAudioTrack&&(this._localAudioTrack.mixType=this._tempMixingAudioTrack.type,this._localAudioTrack.mixedAudioTrack=this._tempMixingAudioTrack.track,delete this._tempMixingAudioTrack),this._room){e.next=16;break}return e.abrupt("return");case 16:a=this._room._roomConfig.isAutoPublish,(this._room.hasPublished||a)&&(this._visibility?this._updatePublish():this.safeEmit(re.onAutoPublishResult,{isScreen:!1,state:N.PUBLISH_FAIL})),null===(r=this._room.localStream)||void 0===r||null===(n=r.observer)||void 0===n||n.setEnableAudio(!0);case 19:case"end":return e.stop()}}),e,this)}))),function(e){return ye.apply(this,arguments)})},{key:"stopAudioCapture",value:(ge=s(regeneratorRuntime.mark((function e(){var t,r,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(kZ.print("stopAudioCapture()"),null===(t=this._localAudioTrack)||void 0===t||t.close(),this._localAudioTrack=void 0,this._audioMixingManager.stopAll(),this._trackSourceType.audio!==A.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=6;break}throw new fD(lD.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");case 6:if(this._room){e.next=8;break}return e.abrupt("return");case 8:if(!this._room.hasPublished){e.next=11;break}return e.next=11,this._updatePublish();case 11:null===(r=this._room.localStream)||void 0===r||null===(n=r.observer)||void 0===n||n.setEnableAudio(!1);case 12:case"end":return e.stop()}}),e,this)}))),function(){return ge.apply(this,arguments)})},{key:"getAudioMixingManager",value:function(){return kZ.print("getAudioMixingManager()"),this._audioMixingManager}},{key:"startScreenCapture",value:(me=s(regeneratorRuntime.mark((function e(){var t,r,n,i,o,a,s,u,c,d,l,h,f,p,v=this,_=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=_.length>0&&void 0!==_[0]?_[0]:{},kZ.print("startScreenCapture()","config: %o",i),o=i.enableAudio,a=void 0!==o&&o,this._trackSourceType.screenVideo!==I.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=5;break}throw new fD(lD.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as internal first");case 5:if(this._trackSourceType.screenAudio!==A.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=7;break}throw new fD(lD.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");case 7:return e.next=9,zj(a,this._extensionManager,this._screenStreamEncodeConfig[0]);case 9:if(s=e.sent,u=b(s,2),c=u[0],d=u[1],this._localScreenVideoTrack&&!this._localScreenVideoTrack.dummy&&this._localScreenVideoTrack.close(),this._localScreenVideoTrack=c,null!==(t=this._screenStreamEncodeConfig[0])&&void 0!==t&&t.contentHint&&c.setContentHint(null===(l=this._screenStreamEncodeConfig[0])||void 0===l?void 0:l.contentHint),(h=null==c?void 0:c.getTrack())&&(f=h.getSettings(),p={width:f.width,height:f.height},c.resolution=p,setTimeout((function(){return v.safeEmit(re.onLocalVideoSizeChanged,{streamIndex:M.STREAM_INDEX_SCREEN,info:{width:f.width,height:f.height}})}))),d&&(this._localScreenAudioTrack=d,this._initLocalTrackEvents(d)),null===(r=this._screenPlayer)||void 0===r||r.playVideo(this._localScreenVideoTrack),this._initLocalTrackEvents(this._localScreenVideoTrack,!0),null===(n=this._room)||void 0===n||!n.hasScreenPublished){e.next=24;break}return e.next=24,this._updateScreenPublish();case 24:case"end":return e.stop()}}),e,this)}))),function(){return me.apply(this,arguments)})},{key:"stopScreenCapture",value:(_e=s(regeneratorRuntime.mark((function e(){var t,r,n,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(kZ.print("stopScreenCapture()"),null===(t=this._screenPlayer)||void 0===t||t.stop(),this._localScreenVideoTrack&&(this._localScreenVideoTrack.dummy||(this._localScreenVideoTrack.close(),this._localImgScreenTrack&&(null===(i=this._localScreenVideoTrack)||void 0===i||i.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||!n.hasScreenPublished){e.next=8;break}return e.next=8,this._updateScreenPublish();case 8:case"end":return e.stop()}}),e,this)}))),function(){return _e.apply(this,arguments)})},{key:"setLocalVideoPlayer",value:function(e,t){if(kZ.print("setLocalVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",e,t),KP(e,"streamIndex",[M.STREAM_INDEX_MAIN,M.STREAM_INDEX_SCREEN]),t&&t.renderDom){var r,n,o=i(i({userId:this._getUserId()},t),{},{isLocal:!0});if(oM(o),e===M.STREAM_INDEX_MAIN&&!this._videoPlayer)return this._videoPlayer=new lK(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)!==J.PLAY_MANUALLY&&this._videoPlayer.playVideo(this._localVideoTrack),this._videoPlayer.domElement;if(e===M.STREAM_INDEX_SCREEN&&!this._screenPlayer)return this._screenPlayer=new lK(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)!==J.PLAY_MANUALLY&&this._screenPlayer.playVideo(this._localScreenVideoTrack),this._screenPlayer.domElement}else{var a,s;e===M.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:(ve=s(regeneratorRuntime.mark((function e(t){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return kZ.print("startLiveTranscoding()","transcode: %o",t),XP(t.url,"liveTranscode.url"),this._liveTranscodeConfig=t,e.prev=3,this.safeEmit(re.onStreamMixingEvent,{event:gG.START,error:0,message:""}),e.next=7,null===(r=this._room)||void 0===r?void 0:r.liveControlMessage(vF("started",this._liveTranscodeConfig));case 7:e.next=16;break;case 9:if(e.prev=9,e.t0=e.catch(3),!(e.t0 instanceof fD)){e.next=15;break}throw e.t0;case 15:throw new fD(lD.UNEXPECTED_ERROR,"unexpected error",e.t0);case 16:case"end":return e.stop()}}),e,this,[[3,9]])}))),function(e){return ve.apply(this,arguments)})},{key:"updateLiveTranscoding",value:(pe=s(regeneratorRuntime.mark((function e(t){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(kZ.print("updateLiveTranscoding()","transcode: %o",t),this._liveTranscodeConfig){e.next=3;break}return e.abrupt("return");case 3:return this._liveTranscodeConfig=LW(this._liveTranscodeConfig,t),e.prev=4,this.safeEmit(re.onStreamMixingEvent,{event:gG.UPDATE,error:0,message:""}),e.next=8,null===(r=this._room)||void 0===r?void 0:r.liveControlMessage(vF("layoutChanged",this._liveTranscodeConfig));case 8:e.next=17;break;case 10:if(e.prev=10,e.t0=e.catch(4),!(e.t0 instanceof fD)){e.next=16;break}throw e.t0;case 16:throw new fD(lD.UNEXPECTED_ERROR,"unexpected error",e.t0);case 17:case"end":return e.stop()}}),e,this,[[4,10]])}))),function(e){return pe.apply(this,arguments)})},{key:"stopLiveTranscoding",value:(fe=s(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(kZ.print("stopLiveTranscoding()"),this._liveTranscodeConfig){e.next=3;break}return e.abrupt("return");case 3:return delete this._liveTranscodeConfig,e.prev=4,this.safeEmit(re.onStreamMixingEvent,{event:gG.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 fD)){e.next=16;break}throw e.t0;case 16:throw new fD(lD.UNEXPECTED_ERROR,"unexpected error",e.t0);case 17:case"end":return e.stop()}}),e,this,[[4,10]])}))),function(){return fe.apply(this,arguments)})},{key:"setBusinessId",value:function(e){return kZ.print("setBusinessId()","businessId: %s",e),!function(e){return"string"!=typeof e}(e)&&!this._room&&(XV.setStats({rtc_business_id:e}),XX.setStats({rtc_business_id:e}),this._businessId=e,!0)}},{key:"setUserVisibility",value:(he=s(regeneratorRuntime.mark((function e(t){var r,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(kZ.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===XG.CONNECTED){e.next=9;break}throw new fD(lD.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?uZ.NORMAL_USER:uZ.SILENT_USER});case 16:this._visibility=t,t&&null!==(r=this._roomConfig)&&void 0!==r&&r.isAutoPublish&&this._updatePublish({mediaType:L.AUDIO_AND_VIDEO});case 18:case"end":return e.stop()}}),e,this)}))),function(e){return he.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]:M.STREAM_INDEX_MAIN,i=n===M.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(re.onFirstPublicStreamAudioFrameDecoded,{publicStreamId:o}):(t.safeEmit(re.onAudioFirstFrameDecoded,{userId:o,isScreen:i}),t.safeEmit(re.onRemoteAudioFirstFrame,{userId:o,isScreen:i})),HV.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(re.onFirstPublicStreamVideoFrameRendered,u),t.safeEmit(re.onFirstPublicStreamVideoFrameDecoded,u)):e.isLocal||(t.safeEmit(re.onVideoFirstFrameRendered,u),t.safeEmit(re.onVideoFirstFrameDecoded,u),t.safeEmit(re.onRemoteVideoFirstFrame,u)),HV.firstRemoteVideoRender("",n.userId||"",{isScreen:i})}break;case"autoplay-error":return r&&(n.publicStreamId=n.userId),void t.safeEmit(re.onAutoplayFailed,{userId:n.userId||n.publicStreamId,kind:e instanceof lK?"video":"audio"})}t.safeEmit(re.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(re.onTrackEnded,{kind:e.getTrack().kind,isScreen:r})})),e.on("resolution-change",(function(e){t.safeEmit(re.onLocalVideoSizeChanged,{streamIndex:r?M.STREAM_INDEX_SCREEN:M.STREAM_INDEX_MAIN,info:e})}))}},{key:"setRemoteVideoPlayer",value:function(e,t){kZ.print("setRemoteVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",e,t),KP(e,"streamIndex",[M.STREAM_INDEX_MAIN,M.STREAM_INDEX_SCREEN]),oM(t);var r,n,o,a=t.userId;if(e===M.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 lK(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 lK(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){kZ.print("setLocalVideoMirrorType()","mirrorType: %o",e),KP(e,"mirrorType",[F.MIRROR_TYPE_NONE,F.MIRROR_TYPE_RENDER]),this._mirrorType=e,this._videoPlayer&&this._videoPlayer.mirror(!!e)}},{key:"setAudioPlaybackDevice",value:(le=s(regeneratorRuntime.mark((function e(t){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(kZ.print("setAudioPlaybackDevice()","deviceId: %s",t),XP(t,"deviceId"),void 0!==HTMLAudioElement.prototype.setSinkId){e.next=5;break}return kZ.print("setAudioPlaybackDevice failed","setSinkId not supported by current browser"),e.abrupt("return");case 5:return e.next=7,fj.getDeviceById(t);case 7:if(r=e.sent){e.next=10;break}throw new fD(lD.INVALID_DEVICE_ID,"audio playback device id ".concat(t," is invalid"));case 10:this._remoteAudioPlayer.forEach((function(e){e.setPlaybackDevice(t)})),this._audioPlaybackDeviceId=t,r&&this.safeEmit(re.onAudioPlaybackDeviceChanged,r),HV.rtcAudioDevice(OV.PLAYOUT_DEVICE_SWITCH,t,0);case 14:case"end":return e.stop()}}),e,this)}))),function(e){return le.apply(this,arguments)})},{key:"play",value:(de=s(regeneratorRuntime.mark((function e(t){var r,n,i,o,a,s,u,c,d;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(kZ.print("play()","userId | publicStreamId: %s",t),a=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||""),o=this._remoteVideoPlayer.get(t||""),i||(i=this._publicStreamAudioPlayer.get(t||"")),o||(o=this._publicStreamVideoPlayer.get(t||"")),!t&&this._videoPlayer&&(o=this._videoPlayer),o&&(o.played?o.manuallyPlay():null!=a&&a.videoTrack?o.playVideo(a.videoTrack,a):!t&&this._localVideoTrack&&(o.mirror(!!this._mirrorType),o.playVideo(this._localVideoTrack))),i&&(i.played?i.manuallyPlay():null!=a&&a.audioTrack&&(i.playAudio(a.audioTrack),(u=null==a||null===(s=a.audioTrack._audioLevelFetcher)||void 0===s?void 0:s._ctx)&&u.resume())),null!=a&&a.audioTrack&&(d=null==a||null===(c=a.audioTrack._audioLevelFetcher)||void 0===c?void 0:c._ctx)&&"suspended"===d.state&&d.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 de.apply(this,arguments)})},{key:"pauseAllSubscribedStream",value:(ce=s(regeneratorRuntime.mark((function e(t){var r,n=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(kZ.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(){BP(t)&&(n._pauseAllSubscribeState.audio=!0),jP(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 ce.apply(this,arguments)})},{key:"resumeAllSubscribedStream",value:(ue=s(regeneratorRuntime.mark((function e(t){var r,n=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(kZ.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(){BP(t)&&(n._pauseAllSubscribeState.audio=!1),jP(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 ue.apply(this,arguments)})},{key:"sendUserMessage",value:(se=s(regeneratorRuntime.mark((function e(t,r){var n,i,o=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(tM(t),aM(r),this._room&&this._room.connectionState===XG.CONNECTED){e.next=4;break}throw new fD(lD.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 o._messageStatisticsObserver.countP2PMessage(!0,t,!1,i,e),e.id})).catch((function(e){throw o._messageStatisticsObserver.countP2PMessage(!1,t,!1,i),e})));case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return se.apply(this,arguments)})},{key:"sendUserBinaryMessage",value:(ae=s(regeneratorRuntime.mark((function e(t,r){var n,i,o=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(tM(t),JP(r,"message"),aM(r),this._room&&this._room.connectionState===XG.CONNECTED){e.next=5;break}throw new fD(lD.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 o._messageStatisticsObserver.countP2PMessage(!0,t,!0,i,e),e.id})).catch((function(e){throw o._messageStatisticsObserver.countP2PMessage(!1,t,!0,i),e})));case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return ae.apply(this,arguments)})},{key:"sendRoomMessage",value:(oe=s(regeneratorRuntime.mark((function e(t){var r,n=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(aM(t),this._room&&this._room.connectionState===XG.CONNECTED){e.next=3;break}throw new fD(lD.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 oe.apply(this,arguments)})},{key:"sendRoomBinaryMessage",value:(ie=s(regeneratorRuntime.mark((function e(t){var r,n=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(aM(t),this._room&&this._room.connectionState===XG.CONNECTED){e.next=3;break}throw new fD(lD.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 ie.apply(this,arguments)})},{key:"setAudioCaptureConfig",value:(ne=s(regeneratorRuntime.mark((function e(){var t,r,n,i=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=i.length>0&&void 0!==i[0]?i[0]:{},kZ.print("setAudioCaptureConfig()","config: %o",t),delete t.deviceId,QP(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:(te=s(regeneratorRuntime.mark((function e(){var t,r,n,i=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=i.length>0&&void 0!==i[0]?i[0]:{},kZ.print("setVideoCaptureConfig()","config: %o",t),delete t.deviceId,QP(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 te.apply(this,arguments)})},{key:"enableSimulcastMode",value:function(e){return kZ.print("enableSimulcastMode()","enabled: %o",e),this._enableSimulcast=e,!0}},{key:"setVideoEncoderConfig",value:(ee=s(regeneratorRuntime.mark((function e(t){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:kZ.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:(Z=s(regeneratorRuntime.mark((function e(t){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:kZ.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 Z.apply(this,arguments)})},{key:"sendSEIMessage",value:function(e,t,r){kZ.print("sendSEIMessage()","streamIdex: %o, message: %o, repeatCount: %o",e,t,r),KP(e,"streamIndex",[M.STREAM_INDEX_MAIN,M.STREAM_INDEX_SCREEN]),qP(r,"repeatCount",0,30);var n="string"==typeof t?new Uint8Array(CP.str2ab(t)):t;if(t.length){var i;if(e===M.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)kZ.print("sei size must not bigger than 4KB");else{var l=TP();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 kZ.print("sei message must not be empty")}},{key:"setAudioVolumeIndicationInterval",value:function(e){var t=this;kZ.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(re.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(re.onActiveSpeaker,{userId:o.userId,extraInfo:o.extraInfo})}}}},{key:"enableAudioPropertiesReport",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};kZ.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:M.STREAM_INDEX_MAIN,audioPropertiesInfo:{linearVolume:i,nonlinearVolume:FP(i)}})}if(e._localScreenAudioTrack){var o=e._localScreenAudioTrack.getAudioLevel();t.push({streamIndex:M.STREAM_INDEX_SCREEN,audioPropertiesInfo:{linearVolume:o,nonlinearVolume:FP(o)}})}if(e.safeEmit(re.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?M.STREAM_INDEX_SCREEN:M.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:FP(o)}})}}))})),e._sendActiveSpeaker(t,a.filter((function(e){return e.streamKey.streamIndex!==M.STREAM_INDEX_SCREEN}))),e.safeEmit(re.onRemoteAudioPropertiesReport,a)}}}),o))}},{key:"setVideoSourceType",value:(Q=s(regeneratorRuntime.mark((function e(t,r){var n,i,o,a,s,u,c,d,l,h,f,p,v,_,m,g,y,S,b,E,R;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(kZ.print("setVideoSourceType()","index: %o, videoSourceType: %o",t,r),KP(t,"streamIndex",[M.STREAM_INDEX_MAIN,M.STREAM_INDEX_SCREEN]),KP(r,"VideoSourceType",[I.VIDEO_SOURCE_TYPE_EXTERNAL,I.VIDEO_SOURCE_TYPE_INTERNAL]),n=t===M.STREAM_INDEX_MAIN?"video":"screenVideo",this._trackSourceType[n]===r){e.next=26;break}if(this._trackSourceType[n]=r,kZ.print("setVideoSourceType","set ".concat(n," source type to ").concat(r)),!this._localVideoTrack||t!==M.STREAM_INDEX_MAIN){e.next=17;break}if(s=!1,r===I.VIDEO_SOURCE_TYPE_EXTERNAL&&(s=!0,this._localVideoTrack.close()),null===(i=this._videoPlayer)||void 0===i||i.stop(),this._localVideoTrack=void 0,u=null===(o=this._room)||void 0===o?void 0:o._roomConfig.isAutoPublish,s?null===(c=this._room)||void 0===c||null===(d=c.localStream)||void 0===d||null===(l=d.observer)||void 0===l||l.setEnableVideo(!1):null===(h=this._room)||void 0===h||null===(f=h.localStream)||void 0===f||null===(p=f.observer)||void 0===p||p.setPushVideo(!1),!(null!==(a=this._room)&&void 0!==a&&a.hasPublished||u)){e.next=17;break}return e.next=17,this._updatePublish();case 17:if(!this._localScreenVideoTrack||t!==M.STREAM_INDEX_SCREEN){e.next=26;break}if(m=!1,r===I.VIDEO_SOURCE_TYPE_EXTERNAL&&(m=!0,this._localScreenVideoTrack.close()),null===(v=this._screenPlayer)||void 0===v||v.stop(),this._localScreenVideoTrack=void 0,m?null===(g=this._room)||void 0===g||null===(y=g.localScreenStream)||void 0===y||null===(S=y.observer)||void 0===S||S.setEnableVideo(!1):null===(b=this._room)||void 0===b||null===(E=b.localScreenStream)||void 0===E||null===(R=E.observer)||void 0===R||R.setPushVideo(!1),null===(_=this._room)||void 0===_||!_.hasScreenPublished){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=s(regeneratorRuntime.mark((function e(t,r){var n,i,o,a,s,u,c,d,l;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(kZ.print("setExternalVideoTrack()","index: %o, track: %o",t,r),KP(t,"streamIndex",[M.STREAM_INDEX_MAIN,M.STREAM_INDEX_SCREEN]),WP(r),t!==M.STREAM_INDEX_MAIN){e.next=15;break}if(this._trackSourceType.video===I.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=6;break}throw new fD(lD.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as external first");case 6:return e.next=8,Xj(r,this._extensionManager);case 8:if(this._localVideoTrack=e.sent,this._initLocalTrackEvents(this._localVideoTrack),null===(n=this._videoPlayer)||void 0===n||n.playVideo(this._localVideoTrack),a=null===(i=this._room)||void 0===i?void 0:i._roomConfig.isAutoPublish,!(null!==(o=this._room)&&void 0!==o&&o.hasPublished||a)){e.next=15;break}return e.next=15,this._updatePublish();case 15:if(t!==M.STREAM_INDEX_SCREEN){e.next=27;break}if(this._trackSourceType.screenVideo===I.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=18;break}throw new fD(lD.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as external first");case 18:return e.next=20,Jj(r,this._extensionManager);case 20:if(this._localScreenVideoTrack=e.sent,this._initLocalTrackEvents(this._localScreenVideoTrack,!0),null===(s=this._screenPlayer)||void 0===s||s.playVideo(this._localScreenVideoTrack),null===(u=this._room)||void 0===u||null===(c=u.localScreenStream)||void 0===c||null===(d=c.observer)||void 0===d||d.setPushVideo(!0),null===(l=this._room)||void 0===l||!l.hasScreenPublished){e.next=27;break}return e.next=27,this._updateScreenPublish();case 27:case"end":return e.stop()}}),e,this)}))),function(e,t){return Y.apply(this,arguments)})},{key:"setAudioSourceType",value:(K=s(regeneratorRuntime.mark((function e(t,r){var n,i,o,a,s,u,c,d,l,h,f,p,v,_,m,g,y,S,b;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(kZ.print("setAudioSourceType()","index: %o, audioSourceType: %o",t,r),KP(t,"streamIndex",[M.STREAM_INDEX_MAIN,M.STREAM_INDEX_SCREEN]),KP(r,"audioSourceType",[A.AUDIO_SOURCE_TYPE_EXTERNAL,A.AUDIO_SOURCE_TYPE_INTERNAL]),n=t===M.STREAM_INDEX_MAIN?"audio":"screenAudio",this._trackSourceType[n]===r){e.next=24;break}if(this._trackSourceType[n]=r,kZ.print("setVideoSourceType","set ".concat(n," source type to ").concat(r)),!this._localAudioTrack||t!==M.STREAM_INDEX_MAIN){e.next=16;break}if(a=!1,this._trackSourceType.audio===A.AUDIO_SOURCE_TYPE_EXTERNAL&&(a=!0,this._localAudioTrack.close()),this._localAudioTrack=void 0,s=null===(i=this._room)||void 0===i?void 0:i._roomConfig.isAutoPublish,a?null===(u=this._room)||void 0===u||null===(c=u.localStream)||void 0===c||null===(d=c.observer)||void 0===d||d.setEnableAudio(!1):null===(l=this._room)||void 0===l||null===(h=l.localStream)||void 0===h||null===(f=h.observer)||void 0===f||f.setPushAudio(!1),!(null!==(o=this._room)&&void 0!==o&&o.hasPublished||s)){e.next=16;break}return e.next=16,this._updatePublish();case 16:if(!this._localScreenAudioTrack||t!==M.STREAM_INDEX_SCREEN){e.next=24;break}if(v=!1,this._trackSourceType.audio===A.AUDIO_SOURCE_TYPE_EXTERNAL&&(v=!0,this._localScreenAudioTrack.close()),this._localScreenAudioTrack=void 0,v?null===(_=this._room)||void 0===_||null===(m=_.localScreenStream)||void 0===m||null===(g=m.observer)||void 0===g||g.setEnableAudio(!1):null===(y=this._room)||void 0===y||null===(S=y.localScreenStream)||void 0===S||null===(b=S.observer)||void 0===b||b.setPushAudio(!1),null===(p=this._room)||void 0===p||!p.hasScreenPublished){e.next=24;break}return e.next=24,this._updateScreenPublish();case 24:case"end":return e.stop()}}),e,this)}))),function(e,t){return K.apply(this,arguments)})},{key:"setExternalAudioTrack",value:(X=s(regeneratorRuntime.mark((function e(t,r){var n,i,o,a,s,u,c,d,l,h;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(kZ.print("setExternalAudioTrack()","index: %o, track: %o",t,r),KP(t,"streamIndex",[M.STREAM_INDEX_MAIN,M.STREAM_INDEX_SCREEN]),WP(r),t!==M.STREAM_INDEX_MAIN){e.next=15;break}if(this._trackSourceType.audio===A.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=6;break}throw new fD(lD.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as external first");case 6:return e.next=8,Wj(r,this._extensionManager);case 8:if(this._localAudioTrack=e.sent,this._initLocalTrackEvents(this._localAudioTrack),u=null===(n=this._room)||void 0===n?void 0:n._roomConfig.isAutoPublish,null===(i=this._room)||void 0===i||null===(o=i.localStream)||void 0===o||null===(a=o.observer)||void 0===a||a.setPushAudio(!0),!(null!==(s=this._room)&&void 0!==s&&s.hasPublished||u)){e.next=15;break}return e.next=15,this._updatePublish();case 15:if(t!==M.STREAM_INDEX_SCREEN){e.next=26;break}if(this._trackSourceType.screenAudio===A.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=18;break}throw new fD(lD.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as external first");case 18:return e.next=20,Zj(r,this._extensionManager);case 20:if(this._localScreenAudioTrack=e.sent,this._initLocalTrackEvents(this._localScreenAudioTrack),null===(c=this._room)||void 0===c||null===(d=c.localScreenStream)||void 0===d||null===(l=d.observer)||void 0===l||l.setPushAudio(!0),null===(h=this._room)||void 0===h||!h.hasScreenPublished){e.next=26;break}return e.next=26,this._updateScreenPublish();case 26:case"end":return e.stop()}}),e,this)}))),function(e,t){return X.apply(this,arguments)})},{key:"login",value:(H=s(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return kZ.print("login()","token: %o, userInfo: %o",t,r),$P(t)||XP(t,"token"),tM(r),e.abrupt("return",this._rtmClient.login(t,r));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return H.apply(this,arguments)})},{key:"logout",value:(G=s(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return kZ.print("logout()"),e.abrupt("return",this._rtmClient.logout());case 2:case"end":return e.stop()}}),e,this)}))),function(){return G.apply(this,arguments)})},{key:"updateLoginToken",value:(j=s(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return kZ.print("updateLoginToken()","token: %o",t),$P(t)||XP(t,"token"),e.abrupt("return",this._rtmClient.updateLoginToken(t));case 3:case"end":return e.stop()}}),e,this)}))),function(e){return j.apply(this,arguments)})},{key:"getPeerOnlineStatus",value:(B=s(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return kZ.print("getPeerOnlineStatus()","userId: %o",t),tM(t),e.abrupt("return",this._rtmClient.getPeerOnlineStatus(t));case 3:case"end":return e.stop()}}),e,this)}))),function(e){return B.apply(this,arguments)})},{key:"sendUserMessageOutsideRoom",value:(P=s(regeneratorRuntime.mark((function e(t,r){var n,i=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return tM(t),aM(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 P.apply(this,arguments)})},{key:"sendUserBinaryMessageOutsideRoom",value:(D=s(regeneratorRuntime.mark((function e(t,r){var n,i=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return tM(t),JP(r,"message"),aM(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 D.apply(this,arguments)})},{key:"setServerParams",value:(O=s(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return kZ.print("setServerParams()","signature: %o, url: %0",t,r),XP(t,"signature"),XP(r,"url"),e.abrupt("return",this._rtmClient.setServerParams(t,r));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return O.apply(this,arguments)})},{key:"sendServerMessage",value:(C=s(regeneratorRuntime.mark((function e(t){var r,n=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return XP(t,"message"),aM(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 C.apply(this,arguments)})},{key:"sendServerBinaryMessage",value:(w=s(regeneratorRuntime.mark((function e(t){var r,n=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return JP(t,"message"),aM(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 w.apply(this,arguments)})},{key:"startCloudProxy",value:function(e){if(this._room)throw new fD(lD.START_CLOUD_PROXY_AFTER_JOIN,"[startCloudProxy] should be invoke before join room ");kZ.print("startCloudProxy()",e),XP(e.logProxy,"logProxy"),XP(e.accessProxy,"accessProxy"),XP(e.configProxy,"configProxy"),this._originIceConfigRequestUrls=pF("ICE_CONFIG_REQUEST_URLS"),this._originLogServerUrl=pF("LOG_SERVER_URL"),this._originConfigServerUrls=pF("CONFIG_REQUEST_DOMAINS"),fF("ICE_CONFIG_REQUEST_URLS",e.accessProxy),fF("LOG_SERVER_URL",function(){return"https://".concat(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"","/video/v1/webrtc_log/")}(e.logProxy)),fF("CONFIG_REQUEST_DOMAINS",[e.configProxy]),this._useCloudProxy=!0}},{key:"stopCloudProxy",value:function(){if(this._room)throw new fD(lD.STOP_CLOUD_PROXY_BEFORE_LEAVE,"[stopCloudProxy] should be invoke after leave room ");kZ.print("stopCloudProxy()"),fF("ICE_CONFIG_REQUEST_URLS",[]),fF("LOG_SERVER_URL",this._originLogServerUrl),fF("CONFIG_REQUEST_DOMAINS",this._originConfigServerUrls),this._useCloudProxy=!1,this._startCloudProxyTimestamp=void 0}},{key:"startPushPublicStream",value:(T=s(regeneratorRuntime.mark((function e(t,r){var n,i=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(kZ.print("startPushPublicStream()","publicStreamId: %o, publicStreamParam: %o",t,r),rM(t),this._room&&this._room.connectionState===XG.CONNECTED){e.next=4;break}throw new fD(lD.START_PUBLIC_STREAM_BEFORE_JOIN,"join first");case 4:if(!this._publicStreamIds.get(t)){e.next=6;break}throw new fD(lD.REPEAT_PUSH,"repeat push public media stream");case 6:return n=_F(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 T.apply(this,arguments)})},{key:"updatePublicStreamParam",value:(k=s(regeneratorRuntime.mark((function e(t,r){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(kZ.print("startPushPublicStream()","publicStreamId: %o, publicStreamParam: %o",t,r),rM(t),this._room&&this._room.connectionState===XG.CONNECTED){e.next=4;break}throw new fD(lD.START_PUBLIC_STREAM_BEFORE_JOIN,"join first");case 4:return n=_F(t,"layoutChanged",r),e.abrupt("return",this._room.publicStreamControlMessage(n));case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return k.apply(this,arguments)})},{key:"stopPushPublicStream",value:(R=s(regeneratorRuntime.mark((function e(t){var r=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(kZ.print("startPushPublicStream()","publicStreamId: %o",t),rM(t),this._room&&this._room.connectionState===XG.CONNECTED){e.next=4;break}throw new fD(lD.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 R.apply(this,arguments)})},{key:"startPlayPublicStream",value:(E=s(regeneratorRuntime.mark((function e(t){var r,n,i,o,a,s,u=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(rM(t),this._outsideRoom){e.next=8;break}return this._outsideRoom=new lZ(this._appId),this._outsideRoom.on(mG.RESUBSCRIBE,(function(e){var t=e.stream;if(t){var r,n=u._publicStreamAudioPlayer.get(t.streamId);n&&t.audioTrack&&(n.stop(),n.playAudio(null===(r=e.stream)||void 0===r?void 0:r.audioTrack));var i,o=u._publicStreamVideoPlayer.get(t.streamId);o&&t.videoTrack&&o.playVideo(null===(i=e.stream)||void 0===i?void 0:i.videoTrack)}})),null===(r=this._outsideRoom)||void 0===r||r.on("onRemoteStreamStats",(function(e){e.publicStreamId=e.userId,delete e.userId,delete e.isScreen,u.safeEmit(re.onPublicStreamStats,e)})),null===(n=this._outsideRoom)||void 0===n||n.on(mG.ON_SEI_MESSAGED_RECEIVED,(function(e){u.safeEmit(re.onPublicStreamSEIMessageReceived,e)})),e.next=8,this._outsideRoom.connect();case 8:return e.next=10,this._outsideRoom.startPlayPublicStream(t);case 10:i=e.sent,(o=this._publicStreamVideoPlayer.get(t))&&null!=i&&i.videoTrack&&o.playVideo(i.videoTrack,i),!(a=this._publicStreamAudioPlayer.get(t))&&null!=i&&i.audioTrack&&(a=new hK(t,{muted:(null===(s=this._config)||void 0===s?void 0:s.autoPlayPolicy)===J.VIDEO_ONLY}),this._initPlayerEvents(a,!0),a.playAudio(i.audioTrack),this._publicStreamAudioPlayer.set(t,a));case 15:case"end":return e.stop()}}),e,this)}))),function(e){return E.apply(this,arguments)})},{key:"stopPlayPublicStream",value:(y=s(regeneratorRuntime.mark((function e(t){var r;return regeneratorRuntime.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 y.apply(this,arguments)})},{key:"setAudioProfile",value:(m=s(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.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 m.apply(this,arguments)})},{key:"setPublicStreamVideoPlayer",value:function(e,t){var r,n,o,a;kZ.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 lK(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)!==J.PLAY_MANUALLY&&s.playVideo(u.videoTrack,u)}else this._publicStreamVideoPlayer.delete(e)}},{key:"setDummyCaptureImagePath",value:(v=s(regeneratorRuntime.mark((function e(t,r){var n=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e,i){XP(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 fD(lD.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===M.STREAM_INDEX_MAIN?(clearInterval(n._dummyMainTimer),n._dummyMainTimer=s):(clearInterval(n._dummyScreenTimer),n._dummyScreenTimer=s);var u=r.captureStream(5).getVideoTracks()[0];t===M.STREAM_INDEX_MAIN?n._localImgVideoTrack=u:n._localImgScreenTrack=u,e()}catch(c){i(new fD(lD.UNEXPECTED_ERROR,c.message))}},o.onerror=function(){i(new fD(lD.UNEXPECTED_ERROR,"Load image error"))}})));case 1:case"end":return e.stop()}}),e)}))),function(e,t){return v.apply(this,arguments)})},{key:"registerExtension",value:(p=s(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.monitor=HV,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 p.apply(this,arguments)})},{key:"defaultTranscoding",value:function(){return JSON.parse(JSON.stringify(gF))}},{key:"_updatePublish",value:(c=s(regeneratorRuntime.mark((function e(){var t,r,n,o=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=o.length>0&&void 0!==o[0]?o[0]:{},kZ.print("_updatePublish()","config: %o",t),r={mediaType:void 0,invokeByJoinRoom:!1,pubState:yG.PUB},t=i(i({},r),t),this._visibility){e.next=6;break}throw new fD(lD.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===XG.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 fD)){e.next=23;break}throw e.t0;case 23:throw new fD(lD.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 c.apply(this,arguments)})},{key:"startAudioPlaybackDeviceTest",value:(a=s(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return kZ.print("startAudioPlaybackDeviceTest()","filePath: %o, indicationInterval: %o",t,r),XP(t,"filePath"),qP(r,"indicationInterval"),e.next=5,this._audioDeviceManager.startAudioPlaybackDeviceTest(t,r);case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return a.apply(this,arguments)})},{key:"stopAudioPlaybackDeviceTest",value:function(){kZ.print("stopAudioPlaybackDeviceTest()"),this._audioDeviceManager.stopAudioPlaybackDeviceTest()}},{key:"startAudioDeviceRecordTest",value:(o=s(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return kZ.print("startAudioDeviceRecordTest()","indicationInterval: %o",t),qP(t,"indicationInterval"),e.next=4,this._audioDeviceManager.startAudioDeviceRecordTest(t);case 4:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"stopAudioDeviceRecordAndPlayTest",value:function(){kZ.print("stopAudioDeviceRecordAndPlayTest()"),this._audioDeviceManager.stopAudioDeviceRecordAndPlayTest()}},{key:"stopAudioDevicePlayTest",value:function(){kZ.print("stopAudioDevicePlayTest()"),this._audioDeviceManager.stopAudioDevicePlayTest()}},{key:"setRemoteUserPriority",value:function(e,t){var r;kZ.print("setRemoteUserPriority()","userId: %o, priority: %o",e,t);try{tM(e),KP(t,"priority",[q.HIGH,q.MEDIUM,q.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=s(regeneratorRuntime.mark((function e(t){var r,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(kZ.print("takeLocalSnapshot()","streamIndex: %o",t),KP(t,"streamIndex",[M.STREAM_INDEX_MAIN,M.STREAM_INDEX_SCREEN]),r=t===M.STREAM_INDEX_MAIN?this.localVideoTrack:this.localScreenVideoTrack){e.next=5;break}throw new fD(lD.INVOKED_BEFORE_CAPTURE,"capture first");case 5:return n=t===M.STREAM_INDEX_MAIN?this._videoPlayer:this._screenPlayer,e.abrupt("return",mZ(r.getTrack("preprocessing"),(null==n?void 0:n.mirrorType)===F.MIRROR_TYPE_RENDER,n));case 7:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"takeRemoteSnapshot",value:(r=s(regeneratorRuntime.mark((function e(t,r){var n,i,o,a,s,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(kZ.print("takeRemoteSnapshot()","id: %o, streamIndex: %o",t,r),XP(t,"id"),KP(r,"streamIndex",[M.STREAM_INDEX_MAIN,M.STREAM_INDEX_SCREEN]),u=(null===(n=this._room)||void 0===n||null===(i=n.remoteStreams.get(t))||void 0===i||null===(o=i.find((function(e){return e.isScreen===(r===M.STREAM_INDEX_SCREEN)})))||void 0===o?void 0:o.videoTrack)||(null===(a=this._outsideRoom)||void 0===a||null===(s=a.remoteStreams.get(t))||void 0===s?void 0:s.videoTrack)){e.next=6;break}throw new fD(lD.STREAM_NOT_EXIST,"stream not exist");case 6:return e.abrupt("return",mZ(u.getTrack(),!1,r===M.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){kZ.print("setSubscribeFallbackOption()","option: %o",e);try{KP(e,"option",[z.DISABLE,z.VIDEO_STREAM_LOW,z.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===M.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 eG&&r.mixedAudioTrack?r.mixedAudioTrack:r.getTrack("preprocessing");if(o){var a=n();return yZ(o,"enabled",this._reportMsTrackEvent.bind(this,"enabled",(null==a?void 0:a.streamId)||"","getLocalStreamTrack",t)),yZ(o,"readyState",(function(e){"ended"===e&&(SZ(o,"enabled"),SZ(o,"readyState")),i._reportMsTrackEvent("readyState",(null==a?void 0:a.streamId)||"","getLocalStreamTrack",t,e)})),o.addEventListener("ended",(function(){SZ(o,"enabled"),SZ(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===M.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 yZ(h,"enabled",this._reportMsTrackEvent.bind(this,"enabled",f,"getRemoteStreamTrack",r)),yZ(h,"readyState",(function(e){"ended"===e&&(SZ(h,"enabled"),SZ(h,"readyState")),o._reportMsTrackEvent("readyState",f,"getRemoteStreamTrack",r,e)})),h.addEventListener("ended",(function(){SZ(h,"enabled"),SZ(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 yZ(o,"enabled",this._reportMsTrackEvent.bind(this,"enabled",a,"getPublicStreamTrack",t)),yZ(o,"readyState",(function(e){"ended"===e&&(SZ(o,"enabled"),SZ(o,"readyState")),r._reportMsTrackEvent("readyState",a,"getPublicStreamTrack",t,e)})),o.addEventListener("ended",(function(){SZ(o,"enabled"),SZ(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"}HV.rtcInvokeStatus(o,0,r,t||"",0,{direction:"getLocalStreamTrack"===r?"up":"down"})}},{key:"_updateScreenPublish",value:(t=s(regeneratorRuntime.mark((function e(){var t,r,n,o=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=o.length>0&&void 0!==o[0]?o[0]:{},kZ.print("_updateScreenPublish()"),r={mediaType:void 0,pubState:yG.PUB},t=i(i({},r),t),e.next=6,this._pubLock.lock();case 6:if(n=e.sent,this._room&&this._room.connectionState===XG.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 fD)){e.next=21;break}throw e.t0;case 21:throw new fD(lD.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){kZ.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.hasAudio&&e.subAudio||this.multiChatMode)){var i;if(!t){var o,a=n?"".concat(r,"_screen"):r;t=new hK(a,{muted:(null===(o=this._config)||void 0===o?void 0:o.autoPlayPolicy)===J.VIDEO_ONLY}),this._initPlayerEvents(t,!1,n?M.STREAM_INDEX_SCREEN:M.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)!==J.PLAY_MANUALLY&&t.playAudio(e.audioTrack)}else{var s;null===(s=t)||void 0===s||s.stop()}}},{key:"_updateVideoPlayerState",value:function(e){var t;kZ.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)!==J.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=tG.NONE;if(i&&(s|=L.AUDIO),a&&(s|=L.VIDEO),s){var u;if(null!=t&&t.isScreen)this.safeEmit(re.onUserPublishScreen,{userId:t.userId,mediaType:s});else this.safeEmit(re.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(re.onUserStartAudioCapture,{userId:t.userId}),o&&this.safeEmit(re.onUserStartVideoCapture,{userId:t.userId}))}}},{key:"_handleAutoSubscribe",value:function(e,t){var r,n,i=tG.NONE;if(null!==(r=this._roomConfig)&&void 0!==r&&r.isAutoSubscribeAudio&&(i|=L.AUDIO),null!==(n=this._roomConfig)&&void 0!==n&&n.isAutoSubscribeVideo&&(i|=L.VIDEO),kZ.print("_onAddStream","autoSubType: ".concat(i)),i){var o,a;if(t&&BP(i))null===(o=e.observer)||void 0===o||o.setAutoSubscribeAudio(!0);if(t&&jP(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=IZ[e.reason])&&void 0!==t?t:U.STREAM_REMOVE_REASON_OTHER,o=n.isScreen?re.onUserUnpublishScreen:re.onUserUnpublishStream,a=tG.NONE;n.attributes.audiostream&&(a|=L.AUDIO),n.attributes.videostream&&(a|=L.VIDEO),null!=n&&n._workaround_1_&&(a=L.VIDEO),a!==tG.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(re.onUserJoined,e)}},{key:"_onUserLeave",value:function(e){this.safeEmit(re.onUserLeave,e)}},{key:"_onRoomError",value:function(e){var t;this.safeEmit(re.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,[re.onNetworkQuality].concat(t))}},{key:"_onConnectionStateChange",value:function(e){void 0!==this._startCloudProxyTimestamp&&this._useCloudProxy&&e.state===V.CONNECTION_STATE_CONNECTED&&this.safeEmit(re.onCloudProxyConnected,{interval:Date.now()-this._startCloudProxyTimestamp}),this.safeEmit(re.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(re.onVideoDeviceStateChanged,e)}},{key:"_onAudioDeviceStateChange",value:function(e){this.safeEmit(re.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===yG.PUB?this.safeEmit(re.onUserPublishScreen,u):this.safeEmit(re.onUserUnpublishScreen,i(i({},u),{},{reason:U.STREAM_REMOVE_REASON_UNPUBLISH})):a===yG.PUB?(u.videoStreamDescriptions=null==s||null===(t=s.attributes)||void 0===t?void 0:t.videoDescriptions,this.safeEmit(re.onUserPublishStream,u),this._handleAutoSubscribe(s,!0)):this.safeEmit(re.onUserUnpublishStream,i(i({},u),{},{reason:U.STREAM_REMOVE_REASON_UNPUBLISH}))}},{key:"_onCustomMessage",value:function(e){var t=e.message;e.binary?this.safeEmit(re.onRoomBinaryMessageReceived,{userId:e.clientId,message:t}):this.safeEmit(re.onRoomMessageReceived,{userId:e.clientId,message:t})}},{key:"_onUserMessageReceived",value:function(e){this._messageStatisticsObserver.recvP2PMessage(e.userId),this.safeEmit(re.onUserMessageReceived,e)}},{key:"_onUserBinaryMessageReceived",value:function(e){this._messageStatisticsObserver.recvP2PMessage(e.userId),this.safeEmit(re.onUserBinaryMessageReceived,e)}},{key:"_onLiveTranscodingResult",value:function(e){this.safeEmit(re.onLiveTranscodingResult,e)}},{key:"_onStreamMixingEvent",value:function(e){this.safeEmit(re.onStreamMixingEvent,e)}},{key:"_onUserTokenWillExpire",value:function(){this.safeEmit(re.onTokenWillExpire)}},{key:"_onPushPublicStreamResult",value:function(e){this.safeEmit(re.onPushPublicStreamResult,e)}},{key:"_handleRTMClient",value:function(e){var t=this;e.on("onUserMessageReceivedOutsideRoom",(function(e){t._messageStatisticsObserver.recvP2POutRoomMessage(e.userId),t.safeEmit(re.onUserMessageReceivedOutsideRoom,e)})),e.on("onUserBinaryMessageReceivedOutsideRoom",(function(e){t._messageStatisticsObserver.recvP2POutRoomMessage(e.userId),t.safeEmit(re.onUserBinaryMessageReceivedOutsideRoom,e)})),e.on("onUserDisconnection",(function(){t.safeEmit(re.onError,{errorCode:lD.RTM_DUPLICATE_LOGIN})})),e.on("onRTMTokenError",(function(){t.safeEmit(re.onError,{errorCode:lD.RTM_TOKEN_ERROR})}))}},{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(re.onAudioPlaybackDeviceTestVolume,t)}))}},{key:"_assertNotInRoom",value:function(){if(!this._room||this._room.connectionState!==XG.CONNECTED)throw new fD(lD.INVOKED_BEFORE_JOIN_ROOM,"join first")}},{key:"_checkMediaType",value:function(e){KP(e,"mediaType",[L.AUDIO,L.VIDEO,L.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"}}]),Ve}(_M);RZ([JV()],TZ.prototype,"updateToken",1),RZ([JV()],TZ.prototype,"setVideoCaptureDevice",1),RZ([JV()],TZ.prototype,"setAudioCaptureDevice",1),RZ([JV()],TZ.prototype,"joinRoom",1),RZ([JV()],TZ.prototype,"leaveRoom",1),RZ([JV()],TZ.prototype,"destroy",1),RZ([JV()],TZ.prototype,"publishStream",1),RZ([JV()],TZ.prototype,"unpublishStream",1),RZ([JV()],TZ.prototype,"publishScreen",1),RZ([JV()],TZ.prototype,"unpublishScreen",1),RZ([JV()],TZ.prototype,"subscribeStream",1),RZ([JV()],TZ.prototype,"unsubscribeStream",1),RZ([JV()],TZ.prototype,"subscribeScreen",1),RZ([JV()],TZ.prototype,"unsubscribeScreen",1),RZ([JV()],TZ.prototype,"setRemoteVideoConfig",1),RZ([JV()],TZ.prototype,"startVideoCapture",1),RZ([JV()],TZ.prototype,"stopVideoCapture",1),RZ([JV()],TZ.prototype,"startAudioCapture",1),RZ([JV()],TZ.prototype,"stopAudioCapture",1),RZ([JV()],TZ.prototype,"getAudioMixingManager",1),RZ([JV()],TZ.prototype,"startScreenCapture",1),RZ([JV()],TZ.prototype,"stopScreenCapture",1),RZ([JV()],TZ.prototype,"setLocalVideoPlayer",1),RZ([JV()],TZ.prototype,"startLiveTranscoding",1),RZ([JV()],TZ.prototype,"updateLiveTranscoding",1),RZ([JV()],TZ.prototype,"stopLiveTranscoding",1),RZ([JV()],TZ.prototype,"setBusinessId",1),RZ([JV()],TZ.prototype,"setUserVisibility",1),RZ([JV()],TZ.prototype,"setRemoteVideoPlayer",1),RZ([JV()],TZ.prototype,"setLocalVideoMirrorType",1),RZ([JV()],TZ.prototype,"setAudioPlaybackDevice",1),RZ([JV()],TZ.prototype,"play",1),RZ([JV()],TZ.prototype,"pauseAllSubscribedStream",1),RZ([JV()],TZ.prototype,"resumeAllSubscribedStream",1),RZ([JV()],TZ.prototype,"sendUserMessage",1),RZ([JV()],TZ.prototype,"sendUserBinaryMessage",1),RZ([JV()],TZ.prototype,"sendRoomMessage",1),RZ([JV()],TZ.prototype,"sendRoomBinaryMessage",1),RZ([JV()],TZ.prototype,"setAudioCaptureConfig",1),RZ([JV()],TZ.prototype,"setVideoCaptureConfig",1),RZ([JV()],TZ.prototype,"enableSimulcastMode",1),RZ([JV()],TZ.prototype,"setVideoEncoderConfig",1),RZ([JV()],TZ.prototype,"setScreenEncoderConfig",1),RZ([JV()],TZ.prototype,"sendSEIMessage",1),RZ([JV()],TZ.prototype,"setAudioVolumeIndicationInterval",1),RZ([JV()],TZ.prototype,"enableAudioPropertiesReport",1),RZ([JV()],TZ.prototype,"setVideoSourceType",1),RZ([JV()],TZ.prototype,"setExternalVideoTrack",1),RZ([JV()],TZ.prototype,"setAudioSourceType",1),RZ([JV()],TZ.prototype,"setExternalAudioTrack",1),RZ([JV("rtm")],TZ.prototype,"login",1),RZ([JV("rtm")],TZ.prototype,"logout",1),RZ([JV("rtm")],TZ.prototype,"updateLoginToken",1),RZ([JV("rtm")],TZ.prototype,"getPeerOnlineStatus",1),RZ([JV("rtm")],TZ.prototype,"sendUserMessageOutsideRoom",1),RZ([JV("rtm")],TZ.prototype,"sendUserBinaryMessageOutsideRoom",1),RZ([JV("rtm")],TZ.prototype,"setServerParams",1),RZ([JV("rtm")],TZ.prototype,"sendServerMessage",1),RZ([JV("rtm")],TZ.prototype,"sendServerBinaryMessage",1),RZ([JV()],TZ.prototype,"startCloudProxy",1),RZ([JV()],TZ.prototype,"stopCloudProxy",1),RZ([JV()],TZ.prototype,"startPushPublicStream",1),RZ([JV()],TZ.prototype,"updatePublicStreamParam",1),RZ([JV()],TZ.prototype,"stopPushPublicStream",1),RZ([JV("outsideRoom")],TZ.prototype,"startPlayPublicStream",1),RZ([JV("outsideRoom")],TZ.prototype,"stopPlayPublicStream",1),RZ([JV()],TZ.prototype,"setAudioProfile",1),RZ([JV("outsideRoom")],TZ.prototype,"setPublicStreamVideoPlayer",1),RZ([JV()],TZ.prototype,"setDummyCaptureImagePath",1),RZ([JV()],TZ.prototype,"registerExtension",1),RZ([JV()],TZ.prototype,"startAudioPlaybackDeviceTest",1),RZ([JV()],TZ.prototype,"stopAudioPlaybackDeviceTest",1),RZ([JV()],TZ.prototype,"startAudioDeviceRecordTest",1),RZ([JV()],TZ.prototype,"stopAudioDeviceRecordAndPlayTest",1),RZ([JV()],TZ.prototype,"stopAudioDevicePlayTest",1),RZ([JV()],TZ.prototype,"setRemoteUserPriority",1),RZ([JV()],TZ.prototype,"takeLocalSnapshot",1),RZ([JV()],TZ.prototype,"takeRemoteSnapshot",1),RZ([JV()],TZ.prototype,"setSubscribeFallbackOption",1),RZ([JV()],TZ.prototype,"getLocalStreamTrack",1),RZ([JV()],TZ.prototype,"getRemoteStreamTrack",1),RZ([JV()],TZ.prototype,"getPublicStreamTrack",1);var IZ={"client unpublished":U.STREAM_REMOVE_REASON_UNPUBLISH,"publish failed":U.STREAM_REMOVE_REASON_PUBLISH_FAILED,"stream removed":U.STREAM_REMOVE_REASON_KEEP_LIVE_FAILED,"client disconnected":U.STREAM_REMOVE_REASON_CLIENT_DISCONNECTED,"client republish":U.STREAM_REMOVE_REASON_REPUBLISH},AZ=new pM("VERTC",0);[XV,KV,WV].forEach((function(e){var t;return e.setStats({rtc_sdk_version:hF.VERSION,product_line:sV.RTC,report_version:uV.W_5,os:cV.WEB,device_id:sF.getDeviceId(),user_agent:wP()?"":null===(t=navigator)||void 0===t?void 0:t.userAgent})})),XX.setStats({rtc_sdk_version:hF.VERSION});var wZ=function(e,t){return AZ.print("createEngine","Invoke VERTC.createEngine"),XP(e,"appId"),[XV,KV,WV].forEach((function(r){return r.setStats({rtc_app_id:e,auto_play_policy:null==t?void 0:t.autoPlayPolicy})})),XX.setStats({rtc_app_id:e}),HV.sdkInitEngine(Date.now(),MV.BEGIN),new TZ(e,t)},CZ=function(e){if(AZ.print("destroyEngine","Invoke VERTC.destroyEngine"),!(e instanceof TZ))throw new fD(lD.INVALID_ENGINE,"Invalid engine object");e.destroy(),HV.sdkInitEngine(Date.now(),MV.END)},OZ=function(){var e=s(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",fj.enumerateDevices());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),xZ=function(){var e=s(regeneratorRuntime.mark((function e(){var t,r,n,i,o=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=o.length>0&&void 0!==o[0]?o[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,fj.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,fj.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)}}(),NZ=function(){var e=s(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",fj.enumerateAudioCaptureDevices());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),DZ=function(){var e=s(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",fj.enumerateVideoCaptureDevices());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),PZ=function(){var e=s(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",fj.enumerateAudioPlaybackDevices());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),MZ=function(){return hF.VERSION},LZ=function(){return HV.rtcSdkApiCall("isSupported",0,""),ZF()},UZ=function(){return HV.rtcSdkApiCall("getSupportedCodecs",0,""),eB()};return!wP()&&location.search.includes("_rtc_autotest_"),i(i(i(i({},new(d((function e(){u(this,e),l(this,"getSdkVersion",MZ),l(this,"createEngine",wZ),l(this,"destroyEngine",CZ),l(this,"enumerateDevices",OZ),l(this,"enableDevices",xZ),l(this,"enumerateAudioCaptureDevices",NZ),l(this,"enumerateVideoCaptureDevices",DZ),l(this,"enumerateAudioPlaybackDevices",PZ),l(this,"getParameter",pF),l(this,"setParameter",fF),l(this,"isSupported",LZ),l(this,"getSupportedCodecs",UZ),l(this,"events",re),l(this,"ErrorCode",lD),l(this,"platform","".concat({}.PRODUCT_PLATFORM)),l(this,"_monitor",HV)})))),Q),te),{},{events:re})}));