trtc-cloud-js-sdk 2.12.2-beta.25 → 2.12.2-beta.26
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/package.json +2 -2
- package/trtc-cloud-js-sdk.esm.js +1 -1
- package/trtc-cloud-js-sdk.js +1 -1
package/trtc-cloud-js-sdk.esm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"trtc-sdk-v5";import{LEBPlayer as t}from"trtc-sdk-v5/plugins/lebplayer";import{VirtualBackground as i}from"trtc-sdk-v5/plugins/video-effect/virtual-background";import{BasicBeauty as o}from"trtc-sdk-v5/plugins/video-effect/basic-beauty";import{RealtimeTranscriber as r}from"trtc-sdk-v5/plugins/realtime-transcriber";import n from"trtc-sdk-v5/plugins/video-effect/video-mixer";import s from"trtc-sdk-v5/plugins/whiteboard";var a=function(e,t){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},a(e,t)};var c=function(){return c=Object.assign||function(e){for(var t,i=1,o=arguments.length;i<o;i++)for(var r in t=arguments[i])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},c.apply(this,arguments)};function u(e,t,i,o){var r,n=arguments.length,s=n<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,o);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(n<3?r(s):n>3?r(t,i,s):r(t,i))||s);return n>3&&s&&Object.defineProperty(t,i,s),s}function l(e,t,i,o){return new(i||(i=Promise))((function(r,n){function s(e){try{c(o.next(e))}catch(t){n(t)}}function a(e){try{c(o.throw(e))}catch(t){n(t)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,a)}c((o=o.apply(e,t||[])).next())}))}function h(e,t){var i,o,r,n,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return n={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(n[Symbol.iterator]=function(){return this}),n;function a(a){return function(c){return function(a){if(i)throw new TypeError("Generator is already executing.");for(;n&&(n=0,a[0]&&(s=0)),s;)try{if(i=1,o&&(r=2&a[0]?o.return:a[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,a[1])).done)return r;switch(o=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,o=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){s.label=a[1];break}if(6===a[0]&&s.label<r[1]){s.label=r[1],r=a;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(a);break}r[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(c){a=[6,c],o=0}finally{i=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}function d(e){var t="function"==typeof Symbol&&Symbol.iterator,i=t&&e[t],o=0;if(i)return i.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&o>=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function p(e,t,i){if(i||2===arguments.length)for(var o,r=0,n=t.length;r<n;r++)!o&&r in t||(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}function f(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,i=e[Symbol.asyncIterator];return i?i.call(e):(e=d(e),t={},o("next"),o("throw"),o("return"),t[Symbol.asyncIterator]=function(){return this},t);function o(i){t[i]=e[i]&&function(t){return new Promise((function(o,r){(function(e,t,i,o){Promise.resolve(o).then((function(t){e({value:t,done:i})}),t)})(o,r,(t=e[i](t)).done,t.value)}))}}}var v="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function g(e,t){return e(t={exports:{}},t.exports),t.exports}var m,T,y,_,R,b,C,S,w,E=g((function(e){var t=Object.prototype.hasOwnProperty,i="~";function o(){}function r(e,t,i){this.fn=e,this.context=t,this.once=i||!1}function n(e,t,o,n,s){if("function"!=typeof o)throw new TypeError("The listener must be a function");var a=new r(o,n||e,s),c=i?i+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],a]:e._events[c].push(a):(e._events[c]=a,e._eventsCount++),e}function s(e,t){0==--e._eventsCount?e._events=new o:delete e._events[t]}function a(){this._events=new o,this._eventsCount=0}Object.create&&(o.prototype=Object.create(null),(new o).__proto__||(i=!1)),a.prototype.eventNames=function(){var e,o,r=[];if(0===this._eventsCount)return r;for(o in e=this._events)t.call(e,o)&&r.push(i?o.slice(1):o);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(e)):r},a.prototype.listeners=function(e){var t=i?i+e:e,o=this._events[t];if(!o)return[];if(o.fn)return[o.fn];for(var r=0,n=o.length,s=new Array(n);r<n;r++)s[r]=o[r].fn;return s},a.prototype.listenerCount=function(e){var t=i?i+e:e,o=this._events[t];return o?o.fn?1:o.length:0},a.prototype.emit=function(e,t,o,r,n,s){var a=i?i+e:e;if(!this._events[a])return!1;var c,u,l=this._events[a],h=arguments.length;if(l.fn){switch(l.once&&this.removeListener(e,l.fn,void 0,!0),h){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,t),!0;case 3:return l.fn.call(l.context,t,o),!0;case 4:return l.fn.call(l.context,t,o,r),!0;case 5:return l.fn.call(l.context,t,o,r,n),!0;case 6:return l.fn.call(l.context,t,o,r,n,s),!0}for(u=1,c=new Array(h-1);u<h;u++)c[u-1]=arguments[u];l.fn.apply(l.context,c)}else{var d,p=l.length;for(u=0;u<p;u++)switch(l[u].once&&this.removeListener(e,l[u].fn,void 0,!0),h){case 1:l[u].fn.call(l[u].context);break;case 2:l[u].fn.call(l[u].context,t);break;case 3:l[u].fn.call(l[u].context,t,o);break;case 4:l[u].fn.call(l[u].context,t,o,r);break;default:if(!c)for(d=1,c=new Array(h-1);d<h;d++)c[d-1]=arguments[d];l[u].fn.apply(l[u].context,c)}}return!0},a.prototype.on=function(e,t,i){return n(this,e,t,i,!1)},a.prototype.once=function(e,t,i){return n(this,e,t,i,!0)},a.prototype.removeListener=function(e,t,o,r){var n=i?i+e:e;if(!this._events[n])return this;if(!t)return s(this,n),this;var a=this._events[n];if(a.fn)a.fn!==t||r&&!a.once||o&&a.context!==o||s(this,n);else{for(var c=0,u=[],l=a.length;c<l;c++)(a[c].fn!==t||r&&!a[c].once||o&&a[c].context!==o)&&u.push(a[c]);u.length?this._events[n]=1===u.length?u[0]:u:s(this,n)}return this},a.prototype.removeAllListeners=function(e){var t;return e?(t=i?i+e:e,this._events[t]&&s(this,t)):(this._events=new o,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=i,a.EventEmitter=a,e.exports=a}));!function(e){e[e.TRTCVideoResolution_120_120=1]="TRTCVideoResolution_120_120",e[e.TRTCVideoResolution_160_160=3]="TRTCVideoResolution_160_160",e[e.TRTCVideoResolution_270_270=5]="TRTCVideoResolution_270_270",e[e.TRTCVideoResolution_480_480=7]="TRTCVideoResolution_480_480",e[e.TRTCVideoResolution_160_120=50]="TRTCVideoResolution_160_120",e[e.TRTCVideoResolution_240_180=52]="TRTCVideoResolution_240_180",e[e.TRTCVideoResolution_280_210=54]="TRTCVideoResolution_280_210",e[e.TRTCVideoResolution_320_240=56]="TRTCVideoResolution_320_240",e[e.TRTCVideoResolution_400_300=58]="TRTCVideoResolution_400_300",e[e.TRTCVideoResolution_480_360=60]="TRTCVideoResolution_480_360",e[e.TRTCVideoResolution_640_480=62]="TRTCVideoResolution_640_480",e[e.TRTCVideoResolution_960_720=64]="TRTCVideoResolution_960_720",e[e.TRTCVideoResolution_160_90=100]="TRTCVideoResolution_160_90",e[e.TRTCVideoResolution_256_144=102]="TRTCVideoResolution_256_144",e[e.TRTCVideoResolution_320_180=104]="TRTCVideoResolution_320_180",e[e.TRTCVideoResolution_480_270=106]="TRTCVideoResolution_480_270",e[e.TRTCVideoResolution_640_360=108]="TRTCVideoResolution_640_360",e[e.TRTCVideoResolution_960_540=110]="TRTCVideoResolution_960_540",e[e.TRTCVideoResolution_1280_720=112]="TRTCVideoResolution_1280_720",e[e.TRTCVideoResolution_1920_1080=114]="TRTCVideoResolution_1920_1080"}(m||(m={})),function(e){e[e.TRTCVideoStreamTypeBig=0]="TRTCVideoStreamTypeBig",e[e.TRTCVideoStreamTypeSmall=1]="TRTCVideoStreamTypeSmall",e[e.TRTCVideoStreamTypeSub=2]="TRTCVideoStreamTypeSub"}(T||(T={})),function(e){e[e.TRTCVideoFillMode_Fill=0]="TRTCVideoFillMode_Fill",e[e.TRTCVideoFillMode_Fit=1]="TRTCVideoFillMode_Fit"}(y||(y={})),function(e){e[e.TRTCVideoMirrorType_Auto=0]="TRTCVideoMirrorType_Auto",e[e.TRTCVideoMirrorType_Enable=1]="TRTCVideoMirrorType_Enable",e[e.TRTCVideoMirrorType_Disable=2]="TRTCVideoMirrorType_Disable"}(_||(_={})),function(e){e[e.TRTCBeautyStyleSmooth=0]="TRTCBeautyStyleSmooth",e[e.TRTCBeautyStyleNature=1]="TRTCBeautyStyleNature"}(R||(R={})),function(e){e[e.TRTCAppSceneVideoCall=0]="TRTCAppSceneVideoCall",e[e.TRTCAppSceneLIVE=1]="TRTCAppSceneLIVE",e[e.TRTCAppSceneAudioCall=2]="TRTCAppSceneAudioCall",e[e.TRTCAppSceneVoiceChatRoom=3]="TRTCAppSceneVoiceChatRoom"}(b||(b={})),function(e){e[e.TRTCRoleAnchor=20]="TRTCRoleAnchor",e[e.TRTCRoleAudience=21]="TRTCRoleAudience"}(C||(C={})),function(e){e[e.TRTCAudioQualitySpeech=1]="TRTCAudioQualitySpeech",e[e.TRTCAudioQualityDefault=2]="TRTCAudioQualityDefault",e[e.TRTCAudioQualityMusic=3]="TRTCAudioQualityMusic"}(S||(S={})),function(e){e[e.default=0]="default",e[e.silent=8]="silent",e[e.hifi2=18]="hifi2"}(w||(w={}));var M,A,P=function(e,t,i,o,r){void 0===e&&(e=""),void 0===t&&(t=""),void 0===i&&(i=""),void 0===o&&(o=""),void 0===r&&(r=""),this.deviceId=e,this.deviceName=t,this.kind=i,this.label=o,this.groupId=r};!function(e){e[e.TRTCDeviceStateAdd=0]="TRTCDeviceStateAdd",e[e.TRTCDeviceStateRemove=1]="TRTCDeviceStateRemove",e[e.TRTCDeviceStateActive=2]="TRTCDeviceStateActive"}(M||(M={})),function(e){e[e.TRTCDeviceTypeUnknow=-1]="TRTCDeviceTypeUnknow",e[e.TRTCDeviceTypeMic=0]="TRTCDeviceTypeMic",e[e.TRTCDeviceTypeSpeaker=1]="TRTCDeviceTypeSpeaker",e[e.TRTCDeviceTypeCamera=2]="TRTCDeviceTypeCamera"}(A||(A={}));var I,L=function(e,t,i,o,r,n,s,a,c,u,l){void 0===e&&(e=0),void 0===t&&(t=""),void 0===i&&(i=""),void 0===o&&(o=0),void 0===r&&(r=""),void 0===n&&(n=C.TRTCRoleAnchor),void 0===s&&(s=null),void 0===c&&(c=null),void 0===u&&(u=null),void 0===l&&(l=30),this.sdkAppId=e,this.userId=t,this.userSig=i,this.roomId=o,this.strRoomId=r,this.role=n,this.privateMapKey=s,this.streamId=c,this.userDefineRecordId=u,this.frameWorkType=l},V=function(e,t,i,o){void 0===e&&(e=m.TRTCVideoResolution_640_360),void 0===t&&(t=D.TRTCVideoResolutionModeLandscape),void 0===i&&(i=15),void 0===o&&(o=550),this.videoResolution=e,this.resMode=t,this.videoFps=i,this.videoBitrate=o};!function(e){e[e.TRTCVideoRotation0=0]="TRTCVideoRotation0",e[e.TRTCVideoRotation90=1]="TRTCVideoRotation90",e[e.TRTCVideoRotation180=2]="TRTCVideoRotation180",e[e.TRTCVideoRotation270=3]="TRTCVideoRotation270"}(I||(I={}));var x,O=function(e,t,i){void 0===e&&(e=I.TRTCVideoRotation0),void 0===t&&(t=y.TRTCVideoFillMode_Fit),void 0===i&&(i=_.TRTCVideoMirrorType_Disable),this.rotation=e,this.fillMode=t,this.mirrorType=i};!function(e){e[e.TRTCQuality_Unknown=0]="TRTCQuality_Unknown",e[e.TRTCQuality_Excellent=1]="TRTCQuality_Excellent",e[e.TRTCQuality_Good=2]="TRTCQuality_Good",e[e.TRTCQuality_Poor=3]="TRTCQuality_Poor",e[e.TRTCQuality_Bad=4]="TRTCQuality_Bad",e[e.TRTCQuality_Vbad=5]="TRTCQuality_Vbad",e[e.TRTCQuality_Down=6]="TRTCQuality_Down"}(x||(x={}));var D,k,B,z=function(e,t){void 0===e&&(e=""),void 0===t&&(t=x.TRTCQuality_Unknown),this.userId=e,this.quality=t},N=function(e,t){void 0===e&&(e=""),void 0===t&&(t=0),this.userId=e,this.volume=t},F=function(e,t,i){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=null),this.appId=e,this.bizId=t,this.url=i},W=function(e,t,i,o,r,n,s){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0),void 0===o&&(o=0),void 0===n&&(n=0),void 0===s&&(s=T.TRTCVideoStreamTypeBig),this.width=e,this.height=t,this.frameRate=i,this.videoBitrate=o,this.audioBitrate=n,this.streamType=s},H=function(e,t,i,o,r,n,s,a,c,u,l,h,d,p){void 0===e&&(e=""),void 0===i&&(i=0),void 0===o&&(o=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=0),void 0===p&&(p=T.TRTCVideoStreamTypeBig),this.userId=e,this.width=i,this.height=o,this.frameRate=r,this.videoBitrate=n,this.audioBitrate=a,this.streamType=p},Q=function(e,t,i,o,r,n,s,a,c,u,l){void 0===e&&(e=0),void 0===t&&(t=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===s&&(s=0),void 0===a&&(a=[]),void 0===c&&(c=0),void 0===u&&(u=[]),void 0===l&&(l=0),this.upLoss=e,this.downLoss=t,this.rtt=r,this.receivedBytes=n,this.sentBytes=s,this.localStatisticsArray=a,this.localStatisticsArraySize=c,this.remoteStatisticsArray=u,this.remoteStatisticsArraySize=l};!function(e){e[e.TRTCVideoResolutionModeLandscape=0]="TRTCVideoResolutionModeLandscape",e[e.TRTCVideoResolutionModePortrait=1]="TRTCVideoResolutionModePortrait"}(D||(D={})),function(e){e[e.TRTCVideoQosPreferenceSmooth=1]="TRTCVideoQosPreferenceSmooth",e[e.TRTCVideoQosPreferenceClear=2]="TRTCVideoQosPreferenceClear"}(k||(k={})),function(e){e[e.TRTCQosControlModeClient=0]="TRTCQosControlModeClient",e[e.TRTCQosControlModeServer=1]="TRTCQosControlModeServer"}(B||(B={}));var j,U,G=function(e,t){void 0===e&&(e=k.TRTCVideoQosPreferenceClear),void 0===t&&(t=B.TRTCQosControlModeServer),this.preference=e,this.controlMode=t},q=function(e,t,i,o){void 0===e&&(e=new ArrayBuffer(0)),void 0===t&&(t=0),void 0===i&&(i=0),void 0===o&&(o=0),this.buffer=e,this.length=t,this.width=i,this.height=o};!function(e){e[e.TRTCLogLevelVerbose=0]="TRTCLogLevelVerbose",e[e.TRTCLogLevelDebug=1]="TRTCLogLevelDebug",e[e.TRTCLogLevelInfo=2]="TRTCLogLevelInfo",e[e.TRTCLogLevelWarn=3]="TRTCLogLevelWarn",e[e.TRTCLogLevelError=4]="TRTCLogLevelError",e[e.TRTCLogLevelFatal=5]="TRTCLogLevelFatal",e[e.TRTCLogLevelNone=6]="TRTCLogLevelNone"}(j||(j={})),function(e){e[e.TRTCScreenCaptureSourceTypeUnknown=-1]="TRTCScreenCaptureSourceTypeUnknown",e[e.TRTCScreenCaptureSourceTypeWindow=0]="TRTCScreenCaptureSourceTypeWindow",e[e.TRTCScreenCaptureSourceTypeScreen=1]="TRTCScreenCaptureSourceTypeScreen",e[e.TRTCScreenCaptureSourceTypeCustom=2]="TRTCScreenCaptureSourceTypeCustom"}(U||(U={}));var Y,K=function(e,t,i,o,r,n){void 0===e&&(e=U.TRTCScreenCaptureSourceTypeUnknown),void 0===t&&(t=""),void 0===i&&(i=""),void 0===o&&(o=new q),void 0===r&&(r=new q),void 0===n&&(n=!1),this.type=e,this.sourceId=t,this.sourceName=i,this.thumbBGRA=o,this.iconBGRA=r,this.isMinimizeWindow=n},J=function(e,t,i,o){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0),void 0===o&&(o=0),this.left=e,this.top=t,this.right=i,this.bottom=o},X=function(e,t,i,o,r,n,s,a,c,u,l,h,d,p,f){void 0===e&&(e=Y.TRTCTranscodingConfigMode_Unknown),void 0===t&&(t=0),void 0===i&&(i=0),void 0===o&&(o=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===s&&(s=15),void 0===a&&(a=2),void 0===c&&(c=0),void 0===u&&(u=""),void 0===l&&(l=64),void 0===h&&(h=48e3),void 0===d&&(d=1),void 0===p&&(p=[]),void 0===f&&(f=""),this.mode=e,this.appId=t,this.bizId=i,this.videoWidth=o,this.videoHeight=r,this.videoBitrate=n,this.videoFramerate=s,this.videoGOP=a,this.backgroundColor=c,this.backgroundImage=u,this.audioSampleRate=l,this.audioBitrate=h,this.audioChannels=d,this.mixUsersArray=p,this.mixUsersArraySize=p.length,this.streamId=f};!function(e){e[e.TRTCTranscodingConfigMode_Unknown=0]="TRTCTranscodingConfigMode_Unknown",e[e.TRTCTranscodingConfigMode_Manual=1]="TRTCTranscodingConfigMode_Manual",e[e.TRTCTranscodingConfigMode_Template_PureAudio=2]="TRTCTranscodingConfigMode_Template_PureAudio",e[e.TRTCTranscodingConfigMode_Template_PresetLayout=3]="TRTCTranscodingConfigMode_Template_PresetLayout",e[e.TRTCTranscodingConfigMode_Template_ScreenSharing=4]="TRTCTranscodingConfigMode_Template_ScreenSharing",e[e.TRTC_TranscodingConfigMode_Unknown=5]="TRTC_TranscodingConfigMode_Unknown",e[e.TRTC_TranscodingConfigMode_Manual=6]="TRTC_TranscodingConfigMode_Manual",e[e.TRTC_TranscodingConfigMode_Template_PureAudio=7]="TRTC_TranscodingConfigMode_Template_PureAudio",e[e.TRTC_TranscodingConfigMode_Template_PresetLayout=8]="TRTC_TranscodingConfigMode_Template_PresetLayout",e[e.TRTC_TranscodingConfigMode_Template_ScreenSharing=9]="TRTC_TranscodingConfigMode_Template_ScreenSharing"}(Y||(Y={}));var $,Z,ee=function(e,t,i,o,r,n,s,a){void 0===e&&(e=""),void 0===t&&(t=""),void 0===i&&(i=null),void 0===o&&(o=0),void 0===r&&(r=!1),void 0===n&&(n=T.TRTCVideoStreamTypeBig),void 0===s&&(s=$.TRTCMixInputTypeUndefined),void 0===a&&(a=0),this.userId=e,this.roomId=t,this.rect=i,this.zOrder=o,this.pureAudio=r,this.streamType=n,this.inputType=s,this.renderMode=a};!function(e){e[e.TRTCMixInputTypeUndefined=0]="TRTCMixInputTypeUndefined",e[e.TRTCMixInputTypeAudioVideo=1]="TRTCMixInputTypeAudioVideo",e[e.TRTCMixInputTypePureVideo=2]="TRTCMixInputTypePureVideo",e[e.TRTCMixInputTypePureAudio=3]="TRTCMixInputTypePureAudio"}($||($={})),function(e){e[e.TRTCCameraResolutionStrategyAuto=0]="TRTCCameraResolutionStrategyAuto",e[e.TRTCCameraResolutionStrategyPerformance=1]="TRTCCameraResolutionStrategyPerformance",e[e.TRTCCameraResolutionStrategyHighQuality=2]="TRTCCameraResolutionStrategyHighQuality",e[e.TRTCCameraCaptureManual=3]="TRTCCameraCaptureManual"}(Z||(Z={}));var te,ie=function(e,t,i,o,r,n){void 0===e&&(e=!0),void 0===t&&(t=!0),void 0===i&&(i=!0),void 0===o&&(o=0),void 0===r&&(r=0),void 0===n&&(n=!1),this.enableCaptureMouse=e,this.enableHighLight=t,this.enableHighPerformance=i,this.highLightColor=o,this.highLightWidth=r,this.enableCaptureChildWindow=n},oe=void 0,re=void 0,ne="onError",se="onWarning",ae="rtc",ce="live",ue="VirtualBackground",le="BasicBeauty",he="AIDenoiser",de="blur",pe="image",fe={20:"anchor",21:"audience"},ve={0:ae,1:ce,2:ae,3:ce};!function(e){e[e.ActiveExitRoom=0]="ActiveExitRoom",e[e.KickedExitRoom=1]="KickedExitRoom"}(te||(te={}));var ge="enum";function me(){return Math.floor(performance.now())}var Te=function(e){return void 0===e},ye=function(e){return"number"==typeof e},_e=function(e){return"boolean"==typeof e};function Re(e){if("string"!=typeof e)return e;var t;try{var i=JSON.parse(e);t="object"==typeof i&&i?i:e}catch(o){t=e}return t}function be(e){return null==e}function Ce(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.reduce((function(e,t){return Object.keys(t).forEach((function(i){e[i]&&"object"==typeof e[i]?e[i]=Ce(e[i],t[i]):e[i]=t[i]})),e}),{})}function Se(e){var t=null;return e instanceof MediaStream||e instanceof MediaStreamTrack||e instanceof HTMLElement?e:([Date,RegExp,Set,WeakSet,Map,WeakMap,Error].includes(null==e?void 0:e.constructor)?t=new e.constructor(e):Array.isArray(e)?(t=[],e.forEach((function(e,i){t[i]=Se(e)}))):"object"==typeof e&&null!==e?(t={},Object.keys(e).forEach((function(i){Object.hasOwnProperty.call(e,i)&&(t[i]=Se(e[i]))}))):t=e,t)}var we,Ee,Me=function(e){return e&&e.Math===Math&&e},Ae=Me("object"==typeof globalThis&&globalThis)||Me("object"==typeof window&&window)||Me("object"==typeof self&&self)||Me("object"==typeof v&&v)||function(){return this}()||v||Function("return this")(),Pe=function(e){try{return!!e()}catch(t){return!0}},Ie=!Pe((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]})),Le=!Pe((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),Ve=Function.prototype.call,xe=Le?Ve.bind(Ve):function(){return Ve.apply(Ve,arguments)},Oe={}.propertyIsEnumerable,De=Object.getOwnPropertyDescriptor,ke={f:De&&!Oe.call({1:2},1)?function(e){var t=De(this,e);return!!t&&t.enumerable}:Oe},Be=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},ze=Function.prototype,Ne=ze.call,Fe=Le&&ze.bind.bind(Ne,Ne),We=Le?Fe:function(e){return function(){return Ne.apply(e,arguments)}},He=We({}.toString),Qe=We("".slice),je=function(e){return Qe(He(e),8,-1)},Ue=Object,Ge=We("".split),qe=Pe((function(){return!Ue("z").propertyIsEnumerable(0)}))?function(e){return"String"===je(e)?Ge(e,""):Ue(e)}:Ue,Ye=function(e){return null==e},Ke=TypeError,Je=function(e){if(Ye(e))throw Ke("Can't call method on "+e);return e},Xe=function(e){return qe(Je(e))},$e="object"==typeof document&&document.all,Ze={all:$e,IS_HTMLDDA:void 0===$e&&void 0!==$e},et=Ze.all,tt=Ze.IS_HTMLDDA?function(e){return"function"==typeof e||e===et}:function(e){return"function"==typeof e},it=Ze.all,ot=Ze.IS_HTMLDDA?function(e){return"object"==typeof e?null!==e:tt(e)||e===it}:function(e){return"object"==typeof e?null!==e:tt(e)},rt=function(e,t){return arguments.length<2?(i=Ae[e],tt(i)?i:void 0):Ae[e]&&Ae[e][t];var i},nt=We({}.isPrototypeOf),st="undefined"!=typeof navigator&&String(navigator.userAgent)||"",at=Ae.process,ct=Ae.Deno,ut=at&&at.versions||ct&&ct.version,lt=ut&&ut.v8;lt&&(Ee=(we=lt.split("."))[0]>0&&we[0]<4?1:+(we[0]+we[1])),!Ee&&st&&(!(we=st.match(/Edge\/(\d+)/))||we[1]>=74)&&(we=st.match(/Chrome\/(\d+)/))&&(Ee=+we[1]);var ht=Ee,dt=Ae.String,pt=!!Object.getOwnPropertySymbols&&!Pe((function(){var e=Symbol("symbol detection");return!dt(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&ht&&ht<41})),ft=pt&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,vt=Object,gt=ft?function(e){return"symbol"==typeof e}:function(e){var t=rt("Symbol");return tt(t)&&nt(t.prototype,vt(e))},mt=String,Tt=TypeError,yt=function(e){if(tt(e))return e;throw Tt(function(e){try{return mt(e)}catch(t){return"Object"}}(e)+" is not a function")},_t=function(e,t){var i=e[t];return Ye(i)?void 0:yt(i)},Rt=TypeError,bt=Object.defineProperty,Ct=function(e,t){try{bt(Ae,e,{value:t,configurable:!0,writable:!0})}catch(i){Ae[e]=t}return t},St="__core-js_shared__",wt=Ae[St]||Ct(St,{}),Et=g((function(e){(e.exports=function(e,t){return wt[e]||(wt[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.32.1",mode:"global",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.32.1/LICENSE",source:"https://github.com/zloirock/core-js"})})),Mt=Object,At=function(e){return Mt(Je(e))},Pt=We({}.hasOwnProperty),It=Object.hasOwn||function(e,t){return Pt(At(e),t)},Lt=0,Vt=Math.random(),xt=We(1..toString),Ot=function(e){return"Symbol("+(void 0===e?"":e)+")_"+xt(++Lt+Vt,36)},Dt=Ae.Symbol,kt=Et("wks"),Bt=ft?Dt.for||Dt:Dt&&Dt.withoutSetter||Ot,zt=function(e){return It(kt,e)||(kt[e]=pt&&It(Dt,e)?Dt[e]:Bt("Symbol."+e)),kt[e]},Nt=TypeError,Ft=zt("toPrimitive"),Wt=function(e,t){if(!ot(e)||gt(e))return e;var i,o=_t(e,Ft);if(o){if(void 0===t&&(t="default"),i=xe(o,e,t),!ot(i)||gt(i))return i;throw Nt("Can't convert object to primitive value")}return void 0===t&&(t="number"),function(e,t){var i,o;if("string"===t&&tt(i=e.toString)&&!ot(o=xe(i,e)))return o;if(tt(i=e.valueOf)&&!ot(o=xe(i,e)))return o;if("string"!==t&&tt(i=e.toString)&&!ot(o=xe(i,e)))return o;throw Rt("Can't convert object to primitive value")}(e,t)},Ht=function(e){var t=Wt(e,"string");return gt(t)?t:t+""},Qt=Ae.document,jt=ot(Qt)&&ot(Qt.createElement),Ut=function(e){return jt?Qt.createElement(e):{}},Gt=!Ie&&!Pe((function(){return 7!==Object.defineProperty(Ut("div"),"a",{get:function(){return 7}}).a})),qt=Object.getOwnPropertyDescriptor,Yt={f:Ie?qt:function(e,t){if(e=Xe(e),t=Ht(t),Gt)try{return qt(e,t)}catch(i){}if(It(e,t))return Be(!xe(ke.f,e,t),e[t])}},Kt=Ie&&Pe((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Jt=String,Xt=TypeError,$t=function(e){if(ot(e))return e;throw Xt(Jt(e)+" is not an object")},Zt=TypeError,ei=Object.defineProperty,ti=Object.getOwnPropertyDescriptor,ii="enumerable",oi="configurable",ri="writable",ni={f:Ie?Kt?function(e,t,i){if($t(e),t=Ht(t),$t(i),"function"==typeof e&&"prototype"===t&&"value"in i&&ri in i&&!i[ri]){var o=ti(e,t);o&&o[ri]&&(e[t]=i.value,i={configurable:oi in i?i[oi]:o[oi],enumerable:ii in i?i[ii]:o[ii],writable:!1})}return ei(e,t,i)}:ei:function(e,t,i){if($t(e),t=Ht(t),$t(i),Gt)try{return ei(e,t,i)}catch(o){}if("get"in i||"set"in i)throw Zt("Accessors not supported");return"value"in i&&(e[t]=i.value),e}},si=Ie?function(e,t,i){return ni.f(e,t,Be(1,i))}:function(e,t,i){return e[t]=i,e},ai=Function.prototype,ci=Ie&&Object.getOwnPropertyDescriptor,ui=It(ai,"name"),li={EXISTS:ui,PROPER:ui&&"something"===function(){}.name,CONFIGURABLE:ui&&(!Ie||Ie&&ci(ai,"name").configurable)},hi=We(Function.toString);tt(wt.inspectSource)||(wt.inspectSource=function(e){return hi(e)});var di,pi,fi,vi=wt.inspectSource,gi=Ae.WeakMap,mi=tt(gi)&&/native code/.test(String(gi)),Ti=Et("keys"),yi=function(e){return Ti[e]||(Ti[e]=Ot(e))},_i={},Ri="Object already initialized",bi=Ae.TypeError,Ci=Ae.WeakMap;if(mi||wt.state){var Si=wt.state||(wt.state=new Ci);Si.get=Si.get,Si.has=Si.has,Si.set=Si.set,di=function(e,t){if(Si.has(e))throw bi(Ri);return t.facade=e,Si.set(e,t),t},pi=function(e){return Si.get(e)||{}},fi=function(e){return Si.has(e)}}else{var wi=yi("state");_i[wi]=!0,di=function(e,t){if(It(e,wi))throw bi(Ri);return t.facade=e,si(e,wi,t),t},pi=function(e){return It(e,wi)?e[wi]:{}},fi=function(e){return It(e,wi)}}var Ei={set:di,get:pi,has:fi,enforce:function(e){return fi(e)?pi(e):di(e,{})},getterFor:function(e){return function(t){var i;if(!ot(t)||(i=pi(t)).type!==e)throw bi("Incompatible receiver, "+e+" required");return i}}},Mi=g((function(e){var t=li.CONFIGURABLE,i=Ei.enforce,o=Ei.get,r=String,n=Object.defineProperty,s=We("".slice),a=We("".replace),c=We([].join),u=Ie&&!Pe((function(){return 8!==n((function(){}),"length",{value:8}).length})),l=String(String).split("String"),h=e.exports=function(e,o,h){"Symbol("===s(r(o),0,7)&&(o="["+a(r(o),/^Symbol\(([^)]*)\)/,"$1")+"]"),h&&h.getter&&(o="get "+o),h&&h.setter&&(o="set "+o),(!It(e,"name")||t&&e.name!==o)&&(Ie?n(e,"name",{value:o,configurable:!0}):e.name=o),u&&h&&It(h,"arity")&&e.length!==h.arity&&n(e,"length",{value:h.arity});try{h&&It(h,"constructor")&&h.constructor?Ie&&n(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(p){}var d=i(e);return It(d,"source")||(d.source=c(l,"string"==typeof o?o:"")),e};Function.prototype.toString=h((function(){return tt(this)&&o(this).source||vi(this)}),"toString")})),Ai=function(e,t,i,o){o||(o={});var r=o.enumerable,n=void 0!==o.name?o.name:t;if(tt(i)&&Mi(i,n,o),o.global)r?e[t]=i:Ct(t,i);else{try{o.unsafe?e[t]&&(r=!0):delete e[t]}catch(s){}r?e[t]=i:ni.f(e,t,{value:i,enumerable:!1,configurable:!o.nonConfigurable,writable:!o.nonWritable})}return e},Pi=Math.ceil,Ii=Math.floor,Li=Math.trunc||function(e){var t=+e;return(t>0?Ii:Pi)(t)},Vi=function(e){var t=+e;return t!=t||0===t?0:Li(t)},xi=Math.max,Oi=Math.min,Di=Math.min,ki=function(e){return e>0?Di(Vi(e),9007199254740991):0},Bi=function(e){return ki(e.length)},zi=function(e){return function(t,i,o){var r,n=Xe(t),s=Bi(n),a=function(e,t){var i=Vi(e);return i<0?xi(i+t,0):Oi(i,t)}(o,s);if(e&&i!=i){for(;s>a;)if((r=n[a++])!=r)return!0}else for(;s>a;a++)if((e||a in n)&&n[a]===i)return e||a||0;return!e&&-1}},Ni={includes:zi(!0),indexOf:zi(!1)}.indexOf,Fi=We([].push),Wi=function(e,t){var i,o=Xe(e),r=0,n=[];for(i in o)!It(_i,i)&&It(o,i)&&Fi(n,i);for(;t.length>r;)It(o,i=t[r++])&&(~Ni(n,i)||Fi(n,i));return n},Hi=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Qi=Hi.concat("length","prototype"),ji={f:Object.getOwnPropertyNames||function(e){return Wi(e,Qi)}},Ui={f:Object.getOwnPropertySymbols},Gi=We([].concat),qi=rt("Reflect","ownKeys")||function(e){var t=ji.f($t(e)),i=Ui.f;return i?Gi(t,i(e)):t},Yi=function(e,t,i){for(var o=qi(t),r=ni.f,n=Yt.f,s=0;s<o.length;s++){var a=o[s];It(e,a)||i&&It(i,a)||r(e,a,n(t,a))}},Ki=/#|\.prototype\./,Ji=function(e,t){var i=$i[Xi(e)];return i===eo||i!==Zi&&(tt(t)?Pe(t):!!t)},Xi=Ji.normalize=function(e){return String(e).replace(Ki,".").toLowerCase()},$i=Ji.data={},Zi=Ji.NATIVE="N",eo=Ji.POLYFILL="P",to=Ji,io=Yt.f,oo=function(e,t){var i,o,r,n,s,a=e.target,c=e.global,u=e.stat;if(i=c?Ae:u?Ae[a]||Ct(a,{}):(Ae[a]||{}).prototype)for(o in t){if(n=t[o],r=e.dontCallGetSet?(s=io(i,o))&&s.value:i[o],!to(c?o:a+(u?".":"#")+o,e.forced)&&void 0!==r){if(typeof n==typeof r)continue;Yi(n,r)}(e.sham||r&&r.sham)&&si(n,"sham",!0),Ai(i,o,n,e)}},ro={};ro[zt("toStringTag")]="z";var no,so="[object z]"===String(ro),ao=zt("toStringTag"),co=Object,uo="Arguments"===je(function(){return arguments}()),lo=so?je:function(e){var t,i,o;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(i=function(e,t){try{return e[t]}catch(i){}}(t=co(e),ao))?i:uo?je(t):"Object"===(o=je(t))&&tt(t.callee)?"Arguments":o},ho=String,po=function(e){if("Symbol"===lo(e))throw TypeError("Cannot convert a Symbol value to a string");return ho(e)},fo=function(){var e=$t(this),t="";return e.hasIndices&&(t+="d"),e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.unicodeSets&&(t+="v"),e.sticky&&(t+="y"),t},vo=Ae.RegExp,go=Pe((function(){var e=vo("a","y");return e.lastIndex=2,null!==e.exec("abcd")})),mo=go||Pe((function(){return!vo("a","y").sticky})),To={BROKEN_CARET:go||Pe((function(){var e=vo("^r","gy");return e.lastIndex=2,null!==e.exec("str")})),MISSED_STICKY:mo,UNSUPPORTED_Y:go},yo=Object.keys||function(e){return Wi(e,Hi)},_o=Ie&&!Kt?Object.defineProperties:function(e,t){$t(e);for(var i,o=Xe(t),r=yo(t),n=r.length,s=0;n>s;)ni.f(e,i=r[s++],o[i]);return e},Ro={f:_o},bo=rt("document","documentElement"),Co="prototype",So="script",wo=yi("IE_PROTO"),Eo=function(){},Mo=function(e){return"<"+So+">"+e+"</"+So+">"},Ao=function(e){e.write(Mo("")),e.close();var t=e.parentWindow.Object;return e=null,t},Po=function(){try{no=new ActiveXObject("htmlfile")}catch(r){}var e,t,i;Po="undefined"!=typeof document?document.domain&&no?Ao(no):(t=Ut("iframe"),i="java"+So+":",t.style.display="none",bo.appendChild(t),t.src=String(i),(e=t.contentWindow.document).open(),e.write(Mo("document.F=Object")),e.close(),e.F):Ao(no);for(var o=Hi.length;o--;)delete Po[Co][Hi[o]];return Po()};_i[wo]=!0;var Io,Lo,Vo=Object.create||function(e,t){var i;return null!==e?(Eo[Co]=$t(e),i=new Eo,Eo[Co]=null,i[wo]=e):i=Po(),void 0===t?i:Ro.f(i,t)},xo=Ae.RegExp,Oo=Pe((function(){var e=xo(".","s");return!(e.dotAll&&e.exec("\n")&&"s"===e.flags)})),Do=Ae.RegExp,ko=Pe((function(){var e=Do("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")})),Bo=Ei.get,zo=Et("native-string-replace",String.prototype.replace),No=RegExp.prototype.exec,Fo=No,Wo=We("".charAt),Ho=We("".indexOf),Qo=We("".replace),jo=We("".slice),Uo=(Lo=/b*/g,xe(No,Io=/a/,"a"),xe(No,Lo,"a"),0!==Io.lastIndex||0!==Lo.lastIndex),Go=To.BROKEN_CARET,qo=void 0!==/()??/.exec("")[1];(Uo||qo||Go||Oo||ko)&&(Fo=function(e){var t,i,o,r,n,s,a,c=this,u=Bo(c),l=po(e),h=u.raw;if(h)return h.lastIndex=c.lastIndex,t=xe(Fo,h,l),c.lastIndex=h.lastIndex,t;var d=u.groups,p=Go&&c.sticky,f=xe(fo,c),v=c.source,g=0,m=l;if(p&&(f=Qo(f,"y",""),-1===Ho(f,"g")&&(f+="g"),m=jo(l,c.lastIndex),c.lastIndex>0&&(!c.multiline||c.multiline&&"\n"!==Wo(l,c.lastIndex-1))&&(v="(?: "+v+")",m=" "+m,g++),i=new RegExp("^(?:"+v+")",f)),qo&&(i=new RegExp("^"+v+"$(?!\\s)",f)),Uo&&(o=c.lastIndex),r=xe(No,p?i:c,m),p?r?(r.input=jo(r.input,g),r[0]=jo(r[0],g),r.index=c.lastIndex,c.lastIndex+=r[0].length):c.lastIndex=0:Uo&&r&&(c.lastIndex=c.global?r.index+r[0].length:o),qo&&r&&r.length>1&&xe(zo,r[0],i,(function(){for(n=1;n<arguments.length-2;n++)void 0===arguments[n]&&(r[n]=void 0)})),r&&d)for(r.groups=s=Vo(null),n=0;n<d.length;n++)s[(a=d[n])[0]]=r[a[1]];return r});var Yo=Fo;oo({target:"RegExp",proto:!0,forced:/./.exec!==Yo},{exec:Yo});var Ko="\t\n\v\f\r \u2028\u2029\ufeff",Jo=We("".replace),Xo=RegExp("^["+Ko+"]+"),$o=RegExp("(^|[^"+Ko+"])["+Ko+"]+$"),Zo=function(e){return function(t){var i=po(Je(t));return 1&e&&(i=Jo(i,Xo,"")),2&e&&(i=Jo(i,$o,"$1")),i}},er={start:Zo(1),end:Zo(2),trim:Zo(3)}.trim,tr=We("".charAt),ir=Ae.parseFloat,or=Ae.Symbol,rr=or&&or.iterator,nr=1/ir(Ko+"-0")!=-Infinity||rr&&!Pe((function(){ir(Object(rr))}))?function(e){var t=er(po(e)),i=ir(t);return 0===i&&"-"===tr(t,0)?-0:i}:ir;oo({global:!0,forced:parseFloat!==nr},{parseFloat:nr});var sr=function(e){if("Function"===je(e))return We(e)},ar=zt("species"),cr=RegExp.prototype,ur=We("".charAt),lr=We("".charCodeAt),hr=We("".slice),dr=function(e){return function(t,i){var o,r,n=po(Je(t)),s=Vi(i),a=n.length;return s<0||s>=a?e?"":void 0:(o=lr(n,s))<55296||o>56319||s+1===a||(r=lr(n,s+1))<56320||r>57343?e?ur(n,s):o:e?hr(n,s,s+2):r-56320+(o-55296<<10)+65536}},pr={codeAt:dr(!1),charAt:dr(!0)}.charAt,fr=function(e,t,i){return t+(i?pr(e,t).length:1)},vr=TypeError,gr=function(e,t){var i=e.exec;if(tt(i)){var o=xe(i,e,t);return null!==o&&$t(o),o}if("RegExp"===je(e))return xe(Yo,e,t);throw vr("RegExp#exec called on incompatible receiver")};!function(e,t,i,o){var r=zt(e),n=!Pe((function(){var t={};return t[r]=function(){return 7},7!==""[e](t)})),s=n&&!Pe((function(){var t=!1,i=/a/;return"split"===e&&((i={}).constructor={},i.constructor[ar]=function(){return i},i.flags="",i[r]=/./[r]),i.exec=function(){return t=!0,null},i[r](""),!t}));if(!n||!s||i){var a=sr(/./[r]),c=t(r,""[e],(function(e,t,i,o,r){var s=sr(e),c=t.exec;return c===Yo||c===cr.exec?n&&!r?{done:!0,value:a(t,i,o)}:{done:!0,value:s(i,t,o)}:{done:!1}}));Ai(String.prototype,e,c[0]),Ai(cr,r,c[1])}o&&si(cr[r],"sham",!0)}("match",(function(e,t,i){return[function(t){var i=Je(this),o=Ye(t)?void 0:_t(t,e);return o?xe(o,t,i):new RegExp(t)[e](po(i))},function(e){var o=$t(this),r=po(e),n=i(t,o,r);if(n.done)return n.value;if(!o.global)return gr(o,r);var s=o.unicode;o.lastIndex=0;for(var a,c=[],u=0;null!==(a=gr(o,r));){var l=po(a[0]);c[u]=l,""===l&&(o.lastIndex=fr(r,ki(o.lastIndex),s)),u++}return 0===u?null:c}]}));var mr=Array.isArray||function(e){return"Array"===je(e)},Tr=TypeError,yr=function(e){if(e>9007199254740991)throw Tr("Maximum allowed index exceeded");return e},_r=function(e,t,i){var o=Ht(t);o in e?ni.f(e,o,Be(0,i)):e[o]=i},Rr=function(){},br=[],Cr=rt("Reflect","construct"),Sr=/^\s*(?:class|function)\b/,wr=We(Sr.exec),Er=!Sr.exec(Rr),Mr=function(e){if(!tt(e))return!1;try{return Cr(Rr,br,e),!0}catch(t){return!1}},Ar=function(e){if(!tt(e))return!1;switch(lo(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Er||!!wr(Sr,vi(e))}catch(t){return!0}};Ar.sham=!0;var Pr,Ir=!Cr||Pe((function(){var e;return Mr(Mr.call)||!Mr(Object)||!Mr((function(){e=!0}))||e}))?Ar:Mr,Lr=zt("species"),Vr=Array,xr=function(e,t){return new(function(e){var t;return mr(e)&&(t=e.constructor,(Ir(t)&&(t===Vr||mr(t.prototype))||ot(t)&&null===(t=t[Lr]))&&(t=void 0)),void 0===t?Vr:t}(e))(0===t?0:t)},Or=zt("species"),Dr=zt("isConcatSpreadable"),kr=ht>=51||!Pe((function(){var e=[];return e[Dr]=!1,e.concat()[0]!==e})),Br=function(e){if(!ot(e))return!1;var t=e[Dr];return void 0!==t?!!t:mr(e)};oo({target:"Array",proto:!0,arity:1,forced:!(kr&&(Pr="concat",ht>=51||!Pe((function(){var e=[];return(e.constructor={})[Or]=function(){return{foo:1}},1!==e[Pr](Boolean).foo}))))},{concat:function(e){var t,i,o,r,n,s=At(this),a=xr(s,0),c=0;for(t=-1,o=arguments.length;t<o;t++)if(Br(n=-1===t?s:arguments[t]))for(r=Bi(n),yr(c+r),i=0;i<r;i++,c++)i in n&&_r(a,c,n[i]);else yr(c+1),_r(a,c++,n);return a.length=c,a}});var zr=window.navigator&&window.navigator.userAgent||"",Nr=/AppleWebKit\/([\d.]+)/i.exec(zr);Nr&&parseFloat(Nr.pop());var Fr=/iPad/i.test(zr),Wr=/iPhone/i.test(zr)&&!Fr,Hr=/iPod/i.test(zr),Qr=Wr||Fr||Hr,jr=/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i.test(zr);Qr&&function(){var e=zr.match(/OS (\d+)_/i);e&&e[1]&&e[1]}();var Ur=/Android/i.test(zr);Ur&&function(){var e=zr.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!e)return null;var t=e[1]&&parseFloat(e[1]),i=e[2]&&parseFloat(e[2]);t&&i&&parseFloat("".concat(e[1],".").concat(e[2]))}();Ur&&/webkit/i.test(zr),/Firefox/i.test(zr)&&function(){var e=zr.match(/Firefox\/(\d+)/);e&&e[1]&&parseFloat(e[1])}();var Gr=/Edge\//i.test(zr);Gr&&function(){var e=zr.match(/Edge\/(\d+)/i);if(e&&e[1])e[1]}();var qr=/Edg\//i.test(zr);qr&&function(){var e=zr.match(/Edg\/(\d+)/);e&&e[1]&&parseFloat(e[1])}();var Yr=/SogouMobileBrowser\//i.test(zr);Yr&&function(){var e=zr.match(/SogouMobileBrowser\/(\d+)/);e&&e[1]&&parseFloat(e[1])}();var Kr=/MetaSr\s/i.test(zr);Kr&&function(){var e=zr.match(/MetaSr(\s\d+(\.\d+)+)/);e&&e[1]&&parseFloat(e[1])}();var Jr=/TBS\/\d+/i.test(zr);Jr&&function(){var e=zr.match(/TBS\/(\d+)/i);if(e&&e[1])e[1]}();var Xr=/XWEB\/\d+/i.test(zr);Xr&&function(){var e=zr.match(/XWEB\/(\d+)/i);if(e&&e[1])e[1]}(),/MSIE\s8\.0/.test(zr),/MSIE\/\d+/i.test(zr)&&function(){var e=/MSIE\s(\d+)\.\d/.exec(zr),t=e&&parseFloat(e[1]);!t&&/Trident\/7.0/i.test(zr)&&/rv:11.0/.test(zr)&&(t=11)}(),/(micromessenger|webbrowser)/i.test(zr)&&function(){var e=zr.match(/MicroMessenger\/(\d+)/i);if(e&&e[1])e[1]}();var $r=!Jr&&/MQQBrowser\/\d+/i.test(zr)&&/COVC\/\d+/i.test(zr),Zr=!Jr&&/MQQBrowser\/\d+/i.test(zr)&&!/COVC\/\d+/i.test(zr);(Zr||$r)&&function(){var e=zr.match(/ MQQBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var en=!Jr&&/ QQBrowser\/\d+/i.test(zr);en&&function(){var e=zr.match(/ QQBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var tn=!Jr&&/QQBrowserLite\/\d+/i.test(zr);tn&&function(){var e=zr.match(/QQBrowserLite\/([\d.]+)/);e&&e[1]&&e[1]}();var on=!Jr&&/MQBHD\/\d+/i.test(zr);on&&function(){var e=zr.match(/MQBHD\/([\d.]+)/);e&&e[1]&&e[1]}(),/Windows/i.test(zr),!Qr&&/MAC OS X/i.test(zr),!Ur&&/Linux/i.test(zr),/MicroMessenger/i.test(zr),/UCBrowser/i.test(zr),/Electron/i.test(zr);var rn=/MiuiBrowser/i.test(zr);rn&&function(){var e=zr.match(/MiuiBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var nn=/HuaweiBrowser/i.test(zr);/Huawei/i.test(zr),nn&&function(){var e=zr.match(/HuaweiBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var sn=/SamsungBrowser/i.test(zr);sn&&function(){var e=zr.match(/SamsungBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var an=/HeyTapBrowser/i.test(zr);an&&function(){var e=zr.match(/HeyTapBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var cn=/VivoBrowser/i.test(zr);cn&&function(){var e=zr.match(/VivoBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var un,ln,hn,dn=/Chrome/i.test(zr),pn=!Gr&&!Kr&&!Yr&&!Jr&&!Xr&&!qr&&!en&&!rn&&!nn&&!sn&&!an&&!cn&&/Chrome/i.test(zr);pn&&function(){var e=zr.match(/Chrome\/(\d+)/);e&&e[1]&&parseFloat(e[1])}(),pn&&function(){var e=zr.match(/Chrome\/([\d.]+)/);e&&e[1]&&e[1]}(),!dn&&!Zr&&!$r&&!tn&&!on&&/Safari/i.test(zr)&&function(){var e=zr.match(/Version\/([\d.]+)/);e&&e[1]&&e[1]}(),"file:"===location.protocol||"localhost"===location.hostname||/^\d+\.\d+\.\d+\.\d+$/.test(location.hostname),function(e){e.LIVE="live",e.RTC="rtc"}(un||(un={})),function(e){e.CONTAIN="contain",e.COVER="cover",e.FILL="fill"}(ln||(ln={})),function(e){e[e.exitRoom=0]="exitRoom",e[e.banned=1]="banned",e[e.roomDisband=2]="roomDisband"}(hn||(hn={}));var fn,vn,gn,mn=-3340,Tn=-1301,yn=-1314,_n=-1315,Rn=-1316,bn=-1302,Cn=-1317,Sn=-1318,wn=-1319,En=-1308,Mn=-102015,An=-70252,Pn={code:-1001,message:"参数错误, 请检查参数格式、是否非空等"},In={code:-1005,message:"not supported"},Ln="2.12.2-beta.25";!function(e){e[e.Success=0]="Success",e[e.Error=-1]="Error",e[e.InvalidParams=-2]="InvalidParams",e[e.NotFoundSource=-3]="NotFoundSource",e[e.ImageSourceLoadFailed=-4]="ImageSourceLoadFailed",e[e.CameraNotAuthorized=-5]="CameraNotAuthorized",e[e.CameraIsOccupied=-6]="CameraIsOccupied",e[e.CameraDisconnected=-7]="CameraDisconnected"}(fn||(fn={})),function(e){e[e.kCamera=0]="kCamera",e[e.kScreen=1]="kScreen",e[e.kImage=2]="kImage",e[e.kPhoneMirror=4]="kPhoneMirror",e[e.kText=5]="kText",e[e.kVideo=6]="kVideo"}(vn||(vn={})),function(e){e.onSourceSelected="onSourceSelected",e.onSourceMoved="onSourceMoved",e.onSourceResized="onSourceResized",e.onRightButtonClicked="onRightButtonClicked",e.onError="onError",e.onSourcePlugged="onSourcePlugged",e.onSourceConnected="onSourceConnected",e.onSourceDisconnected="onSourceDisconnected",e.onSourceUnplugged="onSourceUnplugged",e.onMediaSourceSizeChanged="onMediaSourceSizeChanged"}(gn||(gn={}));var Vn,xn=void 0,On=void 0,Dn=void 0,kn=void 0,Bn=void 0,zn=function(){function e(e,t){if(this.logRegion="tc",this.loggerManager=e,t){var i=t.sdkAppId,o=t.userId,r=t.seq;this.seq=r,e&&(this.logger=e.createLogger({id:"".concat(this.logRegion).concat(r),userId:o,sdkAppId:i}))}else this.logger=e;this.logger||(this.logger={debug:function(e){console.debug(e)},info:function(e){console.info(e)},warn:function(e){console.warn(e)},error:function(e){console.error(e)}})}return e.prototype.getLogMessage=function(e){var t=this;return e.map((function(e){return t.getStringifyMessage(e)})).join(" ")},e.prototype.getStringifyMessage=function(e){var t=this;if("object"!=typeof e)return e;if(e instanceof HTMLElement)return"".concat(e.tagName.toLocaleLowerCase(),"#").concat(e.id);if(e instanceof Array){var i=[];return Object.keys(e).forEach((function(o){return i[o]=t.getStringifyMessage(e[o])})),JSON.stringify(i)}if(e instanceof Object){var o={};return Object.keys(e).forEach((function(i){return o[i]=t.getStringifyMessage(e[i])})),JSON.stringify(o)}return e},e.prototype.update=function(e){var t=e.userId,i=e.sdkAppId;this.loggerManager&&this.loggerManager.createLogger&&(this.logger=this.loggerManager.createLogger({id:"".concat(this.logRegion).concat(this.seq),userId:t,sdkAppId:i}))},e.prototype.log=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=this.getLogMessage(e);this.logger&&this.logger.info&&this.logger.info(i)},e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=this.getLogMessage(e);this.logger.debug(i)},e.prototype.info=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=this.getLogMessage(e);this.logger&&this.logger.info&&this.logger.info(i)},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=this.getLogMessage(e);this.logger&&this.logger.warn&&this.logger.warn(i)},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=this.getLogMessage(e);this.logger&&this.logger.error&&this.logger.error(i)},e}(),Nn=new zn(null),Fn=function(){function e(e,t,i){void 0===i&&(i={calcPositionOnly:!1,canExceedContainer:!1}),this.logPrefix="[Movable]",this.movable=null,this.container=null,this.options={calcPositionOnly:!1,canExceedContainer:!1},this.callbacksMap=new Map,this.enabled=!0,this.originLeft=0,this.originTop=0,this.moveStartOfLeft=0,this.moveStartOfTop=0,this.movable=e,this.container=t||document.body,this.options={calcPositionOnly:!!i.calcPositionOnly||!1,canExceedContainer:!!i.canExceedContainer||!1},this.setStyle(),this.onMouseDown=this.onMouseDown.bind(this),this.onMouseMove=this.onMouseMove.bind(this),this.onMouseUp=this.onMouseUp.bind(this),this.onMouseMove5px=this.onMouseMove5px.bind(this),this.onMouseUp5px=this.onMouseUp5px.bind(this),this.movable.addEventListener("mousedown",this.onMouseDown,!1)}return e.prototype.setStyle=function(){this.movable?(this.movable.style.position="absolute",this.movable.style.cursor="move"):Nn.debug("".concat(this.logPrefix,"setStyle 'movable' is null"))},e.prototype.onMouseDown=function(e){if(this.enabled&&0===e.button){if(e.preventDefault(),document.defaultView&&this.movable){var t=document.defaultView.getComputedStyle(this.movable);this.originLeft=window.parseInt(t.left),this.originTop=window.parseInt(t.top)}else Nn.debug("".concat(this.logPrefix,"onMouseDown 'movable' is null"));this.moveStartOfLeft=e.screenX,this.moveStartOfTop=e.screenY,document.addEventListener("mousemove",this.onMouseMove5px,!1),document.addEventListener("mouseup",this.onMouseUp5px,!1)}},e.prototype.onMouseMove5px=function(e){var t=e.screenX-(this.moveStartOfLeft||0),i=e.screenY-(this.moveStartOfTop||0);Math.abs(t)>=5||Math.abs(i)>=5?(document.removeEventListener("mousemove",this.onMouseMove5px,!1),document.removeEventListener("mouseup",this.onMouseUp5px,!1),document.addEventListener("mousemove",this.onMouseMove,!1),document.addEventListener("mouseup",this.onMouseUp,!1)):Nn.debug("".concat(this.logPrefix,"on Movable mouse move less than 5px"))},e.prototype.onMouseUp5px=function(){document.removeEventListener("mousemove",this.onMouseMove5px,!1),document.removeEventListener("mouseup",this.onMouseUp5px,!1)},e.prototype.onMouseMove=function(e){if(this.movable&&this.container){var t=e.screenX-this.moveStartOfLeft,i=e.screenY-this.moveStartOfTop,o=this.originLeft+t,r=this.originTop+i,n=this.movable.offsetWidth,s=this.movable.offsetHeight,a=this.container.offsetWidth,c=this.container.offsetHeight;this.options.canExceedContainer||(o<0?o=0:o>a-n&&(o=a-n),r<0?r=0:r>c-s&&(r=c-s)),!this.options.calcPositionOnly&&this.movable&&(this.movable.style.left="".concat(o,"px"),this.movable.style.top="".concat(r,"px")),this.emit("move",o,r)}else Nn.debug("".concat(this.logPrefix,"onMouseMove error:No 'movable' and 'container'."))},e.prototype.onMouseUp=function(){document.removeEventListener("mousemove",this.onMouseMove,!1),document.removeEventListener("mouseup",this.onMouseUp,!1),this.originLeft=0,this.originTop=0,this.moveStartOfLeft=0,this.moveStartOfTop=0},e.prototype.on=function(e,t){var i=this.callbacksMap.get(e);i?i.push(t):this.callbacksMap.set(e,[t])},e.prototype.off=function(e,t){var i=this.callbacksMap.get(e);i&&(i=i.filter((function(e){return e!=t})),this.callbacksMap.set(e,i))},e.prototype.emit=function(e){for(var t=[],i=1;i<arguments.length;i++)t[i-1]=arguments[i];var o=this.callbacksMap.get(e);o&&o.forEach((function(e){try{e.apply(null,t)}catch(i){console.error("[Movable]emit error:",e,i)}}))},e.prototype.destroy=function(){var e;null===(e=this.movable)||void 0===e||e.removeEventListener("mousedown",this.onMouseDown,!1),this.callbacksMap.clear(),this.movable=null,this.container=null},e.prototype.setEnabled=function(e){Nn.debug("".concat(this.logPrefix,"setEnabled: ").concat(this.enabled," -> ").concat(e)),this.enabled=e,this.movable&&(this.movable.style.cursor=e?"move":"default",Nn.debug("".concat(this.logPrefix,"setEnabled: cursor updated to '").concat(e?"move":"default","'")))},e.prototype.isEnabled=function(){return this.enabled},e}();!function(e){e[e.Both=0]="Both",e[e.Corner=1]="Corner",e[e.Edge=2]="Edge"}(Vn||(Vn={}));var Wn="trtc-resizable-top-left-anchor",Hn="trtc-resizable-top-anchor",Qn="trtc-resizable-top-right-anchor",jn="trtc-resizable-left-anchor",Un="trtc-resizable-right-anchor",Gn="trtc-resizable-bottom-left-anchor",qn="trtc-resizable-bottom-anchor",Yn="trtc-resizable-bottom-right-anchor",Kn={resizeAnchor:{position:"absolute",width:"".concat(8,"px"),height:"".concat(8,"px"),border:"1px solid #3D7EFD",backgroundColor:"#FFFFFF"},topLeftAnchor:{top:"-".concat(4,"px"),left:"-".concat(4,"px"),cursor:"nw-resize"},topAnchor:{top:"-".concat(4,"px"),left:"calc(50% - ".concat(4,"px)"),cursor:"n-resize"},topRightAnchor:{top:"-".concat(4,"px"),right:"-".concat(4,"px"),cursor:"ne-resize"},leftAnchor:{top:"calc(50% - ".concat(4,"px)"),left:"-".concat(4,"px"),cursor:"w-resize"},rightAnchor:{top:"calc(50% - ".concat(4,"px)"),right:"-".concat(4,"px"),cursor:"e-resize"},bottomLeftAnchor:{bottom:"-".concat(4,"px"),left:"-".concat(4,"px"),cursor:"sw-resize"},bottomAnchor:{bottom:"-".concat(4,"px"),left:"calc(50% - ".concat(4,"px)"),cursor:"s-resize"},bottomRightAnchor:{bottom:"-".concat(4,"px"),right:"-".concat(4,"px"),cursor:"se-resize"}};function Jn(e,t){for(var i in t)e.style[i]=t[i]}var Xn,$n=function(){function e(e,t,i){void 0===i&&(i={keepRatio:!1,stopPropagation:!1,anchorMode:Vn.Both,canExceedContainer:!1}),this.logPrefix="[Resizable]",this.container=null,this.options={keepRatio:!1,stopPropagation:!1,anchorMode:Vn.Both,canExceedContainer:!1},this.callbacksMap=new Map,this.topLeftAnchor=null,this.topAnchor=null,this.topRightAnchor=null,this.leftAnchor=null,this.rightAnchor=null,this.bottomLeftAnchor=null,this.bottomAnchor=null,this.bottomRightAnchor=null,this.currentAnchor=null,this.resizeStartLeft=0,this.resizeStartTop=0,this.originLeft=0,this.originTop=0,this.originWidth=0,this.originHeight=0,this.resizeTarget=e,this.container=t||document.body,this.options={keepRatio:!!i.keepRatio||!1,stopPropagation:!!i.stopPropagation||!1,anchorMode:i.anchorMode||Vn.Both,canExceedContainer:!!i.canExceedContainer||!1},this.mousedown=this.mousedown.bind(this),this.mousemove=this.mousemove.bind(this),this.mouseup=this.mouseup.bind(this),this.currentAnchor=null,this.createResizeAnchor(),this.resizeTarget.classList.add("trtc-resizable"),this.resizeTarget.style.position="absolute",this.resizeTarget.style.border="1px solid #3D7EFD",this.resizeTarget.style.boxSizing="border-box",this.initResizeEvent()}return e.prototype.createResizeAnchor=function(){var e,t,i,o,r,n,s,a,c=document.createElement("div");c.className="trtc-resizable-resize-anchor ".concat(Wn),Jn(c,Object.assign({},Kn.resizeAnchor,Kn.topLeftAnchor)),this.topLeftAnchor=c;var u=document.createElement("div");u.className="trtc-resizable-resize-anchor ".concat(Hn),Jn(u,Object.assign({},Kn.resizeAnchor,Kn.topAnchor)),this.topAnchor=u;var l=document.createElement("div");l.className="trtc-resizable-resize-anchor ".concat(Qn),Jn(l,Object.assign({},Kn.resizeAnchor,Kn.topRightAnchor)),this.topRightAnchor=l;var h=document.createElement("div");h.className="trtc-resizable-resize-anchor ".concat(jn),Jn(h,Object.assign({},Kn.resizeAnchor,Kn.leftAnchor)),this.leftAnchor=h;var d=document.createElement("div");d.className="trtc-resizable-resize-anchor ".concat(Un),Jn(d,Object.assign({},Kn.resizeAnchor,Kn.rightAnchor)),this.rightAnchor=d;var p=document.createElement("div");p.className="trtc-resizable-resize-anchor ".concat(Gn),Jn(p,Object.assign({},Kn.resizeAnchor,Kn.bottomLeftAnchor)),this.bottomLeftAnchor=p;var f=document.createElement("div");f.className="trtc-resizable-resize-anchor ".concat(qn),Jn(f,Object.assign({},Kn.resizeAnchor,Kn.bottomAnchor)),this.bottomAnchor=f;var v=document.createElement("div");v.className="trtc-resizable-resize-anchor ".concat(Yn),Jn(v,Object.assign({},Kn.resizeAnchor,Kn.bottomRightAnchor)),this.bottomRightAnchor=v,this.options.anchorMode!==Vn.Both&&this.options.anchorMode!==Vn.Edge||(null===(e=this.resizeTarget)||void 0===e||e.appendChild(u),null===(t=this.resizeTarget)||void 0===t||t.appendChild(h),null===(i=this.resizeTarget)||void 0===i||i.appendChild(d),null===(o=this.resizeTarget)||void 0===o||o.appendChild(f)),this.options.anchorMode!==Vn.Both&&this.options.anchorMode!==Vn.Corner||(null===(r=this.resizeTarget)||void 0===r||r.appendChild(c),null===(n=this.resizeTarget)||void 0===n||n.appendChild(l),null===(s=this.resizeTarget)||void 0===s||s.appendChild(p),null===(a=this.resizeTarget)||void 0===a||a.appendChild(v))},e.prototype.initResizeEvent=function(){var e,t,i,o,r,n,s,a;null===(e=this.topLeftAnchor)||void 0===e||e.addEventListener("mousedown",this.mousedown,!1),null===(t=this.topAnchor)||void 0===t||t.addEventListener("mousedown",this.mousedown,!1),null===(i=this.topRightAnchor)||void 0===i||i.addEventListener("mousedown",this.mousedown,!1),null===(o=this.leftAnchor)||void 0===o||o.addEventListener("mousedown",this.mousedown,!1),null===(r=this.rightAnchor)||void 0===r||r.addEventListener("mousedown",this.mousedown,!1),null===(n=this.bottomLeftAnchor)||void 0===n||n.addEventListener("mousedown",this.mousedown,!1),null===(s=this.bottomAnchor)||void 0===s||s.addEventListener("mousedown",this.mousedown,!1),null===(a=this.bottomRightAnchor)||void 0===a||a.addEventListener("mousedown",this.mousedown,!1)},e.prototype.mousedown=function(e){if(0===e.button){if(e.preventDefault(),this.options.stopPropagation&&e.stopPropagation(),this.currentAnchor=e.target,this.resizeStartLeft=e.screenX,this.resizeStartTop=e.screenY,document.defaultView&&this.resizeTarget){var t=document.defaultView.getComputedStyle(this.resizeTarget);this.originTop=window.parseInt(t.top),this.originLeft=window.parseInt(t.left),this.originWidth=this.resizeTarget.offsetWidth,this.originHeight=this.resizeTarget.offsetHeight,Nn.debug("resize origin:",this.originTop,this.originLeft,this.originWidth,this.originHeight)}else Nn.debug("".concat(this.logPrefix,"mouseDown 'resizeTarget' is null"));document.addEventListener("mousemove",this.mousemove,!1),document.addEventListener("mouseup",this.mouseup,!1)}},e.prototype.mousemove=function(e){if(this.container&&this.resizeTarget&&this.currentAnchor){var t,i=this.currentAnchor.classList[1],o=this.originLeft,r=this.originTop,n=this.originWidth,s=this.originHeight;switch(i){case Wn:r=(t=this._resizeTop(e)).top,s=t.height,o=(t=this._resizeLeft(e)).left,n=t.width,this.options.keepRatio&&(n/this.originWidth<s/this.originHeight?(s=n*this.originHeight/this.originWidth,r=this.originTop+this.originHeight-s):(n=s*this.originWidth/this.originHeight,o=this.originLeft+this.originWidth-n));break;case Hn:r=(t=this._resizeTop(e)).top,s=t.height,this.options.keepRatio&&((n=this.originWidth*s/this.originHeight)<20?(n=20,s=this.originHeight*n/this.originWidth,r=this.originTop+this.originHeight-s):!this.options.canExceedContainer&&n>this.container.offsetWidth-this.originLeft&&(n=this.container.offsetWidth-this.originLeft,s=this.originHeight*n/this.originWidth,r=this.originTop+this.originHeight-s));break;case Qn:r=(t=this._resizeTop(e)).top,s=t.height,n=this._resizeRight(e),this.options.keepRatio&&(n/this.originWidth<s/this.originHeight?(s=n*this.originHeight/this.originWidth,r=this.originTop+this.originHeight-s):n=s*this.originWidth/this.originHeight);break;case jn:o=(t=this._resizeLeft(e)).left,n=t.width,this.options.keepRatio&&((s=this.originHeight*n/this.originWidth)<20?(s=20,n=this.originWidth*s/this.originHeight,o=this.originLeft+this.originWidth-n):!this.options.canExceedContainer&&s>this.container.offsetHeight-this.originTop&&(s=this.container.offsetHeight-this.originTop,n=this.originWidth*s/this.originHeight,o=this.originLeft+this.originWidth-n));break;case Un:n=this._resizeRight(e),this.options.keepRatio&&((s=n*this.originHeight/this.originWidth)<20?n=(s=20)*this.originWidth/this.originHeight:!this.options.canExceedContainer&&s>this.container.offsetHeight-this.originTop&&(n=(s=this.container.offsetHeight-this.originTop)*this.originWidth/this.originHeight));break;case Gn:s=this._resizeBottom(e),o=(t=this._resizeLeft(e)).left,n=t.width,this.options.keepRatio&&(n/this.originWidth<s/this.originHeight?s=n*this.originHeight/this.originWidth:(n=s*this.originWidth/this.originHeight,o=this.originLeft+this.originWidth-n));break;case qn:s=this._resizeBottom(e),this.options.keepRatio&&((n=s*this.originWidth/this.originHeight)<20?s=(n=20)*this.originHeight/this.originWidth:!this.options.canExceedContainer&&n>this.container.offsetWidth-this.originLeft&&(s=(n=this.container.offsetWidth-this.originLeft)*this.originHeight/this.originWidth));break;case Yn:s=this._resizeBottom(e),n=this._resizeRight(e),this.options.keepRatio&&(n/this.originWidth<s/this.originHeight?s=n*this.originHeight/this.originWidth:n=s*this.originWidth/this.originHeight)}this.resizeTarget.style.left="".concat(o,"px"),this.resizeTarget.style.top="".concat(r,"px"),this.resizeTarget.style.height="".concat(s,"px"),this.resizeTarget.style.width="".concat(n,"px"),this.emit("resize",o,r,n,s)}else Nn.debug("".concat(this.logPrefix,"mouseMove error. No valid inner info:"),this.container,this.resizeTarget,this.currentAnchor)},e.prototype._resizeLeft=function(e){var t=e.screenX-this.resizeStartLeft,i=this.originLeft+t,o=this.originWidth-t;return!this.options.canExceedContainer&&i<0?(i=0,o=this.originWidth+this.originLeft):i>this.originLeft+this.originWidth-20&&(i=this.originLeft+this.originWidth-20,o=20),{left:i,width:o}},e.prototype._resizeTop=function(e){var t=e.screenY-this.resizeStartTop,i=this.originTop+t,o=this.originHeight-t;return!this.options.canExceedContainer&&i<0?(i=0,o=this.originHeight+this.originTop):i>this.originTop+this.originHeight-20&&(i=this.originTop+this.originHeight-20,o=20),{top:i,height:o}},e.prototype._resizeRight=function(e){if(!this.container)return Nn.debug("".concat(this.logPrefix,"_resizeRight error. No container:"),this.container),0;var t=e.screenX-this.resizeStartLeft,i=this.originWidth+t;return i<20?i=20:!this.options.canExceedContainer&&i>this.container.offsetWidth-this.originLeft&&(i=this.container.offsetWidth-this.originLeft),i},e.prototype._resizeBottom=function(e){if(!this.container)return Nn.debug("".concat(this.logPrefix,"_resizeBottom error. No container:"),this.container),0;var t=e.screenY-this.resizeStartTop,i=this.originHeight+t;return i<20?i=20:!this.options.canExceedContainer&&i>this.container.offsetHeight-this.originTop&&(i=this.container.offsetHeight-this.originTop),i},e.prototype.mouseup=function(){document.removeEventListener("mousemove",this.mousemove,!1),document.removeEventListener("mouseup",this.mouseup,!1),this.currentAnchor=null,this.resizeStartLeft=0,this.resizeStartTop=0,this.originLeft=0,this.originTop=0,this.originWidth=0,this.originHeight=0},e.prototype.on=function(e,t){var i=this.callbacksMap.get(e);i?i.push(t):this.callbacksMap.set(e,[t])},e.prototype.off=function(e,t){var i=this.callbacksMap.get(e);i&&(i=i.filter((function(e){return e!=t})),this.callbacksMap.set(e,i))},e.prototype.emit=function(e){for(var t=[],i=1;i<arguments.length;i++)t[i-1]=arguments[i];var o=this.callbacksMap.get(e);o&&o.slice().forEach((function(e){try{e.apply(null,t)}catch(i){console.error("[Resizable]emit error:",e,i)}}))},e.prototype.destroy=function(){var e,t,i,o,r,n,s,a,c,u,l,h,d,p,f,v;null===(e=this.topLeftAnchor)||void 0===e||e.removeEventListener("mousedown",this.mousedown,!1),null===(t=this.topAnchor)||void 0===t||t.removeEventListener("mousedown",this.mousedown,!1),null===(i=this.topRightAnchor)||void 0===i||i.removeEventListener("mousedown",this.mousedown,!1),null===(o=this.leftAnchor)||void 0===o||o.removeEventListener("mousedown",this.mousedown,!1),null===(r=this.rightAnchor)||void 0===r||r.removeEventListener("mousedown",this.mousedown,!1),null===(n=this.bottomLeftAnchor)||void 0===n||n.removeEventListener("mousedown",this.mousedown,!1),null===(s=this.bottomAnchor)||void 0===s||s.removeEventListener("mousedown",this.mousedown,!1),null===(a=this.bottomRightAnchor)||void 0===a||a.removeEventListener("mousedown",this.mousedown,!1),this.callbacksMap.clear(),this.options.anchorMode!==Vn.Both&&this.options.anchorMode!==Vn.Edge||(this.topAnchor&&(null===(c=this.resizeTarget)||void 0===c||c.removeChild(this.topAnchor)),this.leftAnchor&&(null===(u=this.resizeTarget)||void 0===u||u.removeChild(this.leftAnchor)),this.rightAnchor&&(null===(l=this.resizeTarget)||void 0===l||l.removeChild(this.rightAnchor)),this.bottomAnchor&&(null===(h=this.resizeTarget)||void 0===h||h.removeChild(this.bottomAnchor))),this.options.anchorMode!==Vn.Both&&this.options.anchorMode!==Vn.Corner||(this.topLeftAnchor&&(null===(d=this.resizeTarget)||void 0===d||d.removeChild(this.topLeftAnchor)),this.topRightAnchor&&(null===(p=this.resizeTarget)||void 0===p||p.removeChild(this.topRightAnchor)),this.bottomLeftAnchor&&(null===(f=this.resizeTarget)||void 0===f||f.removeChild(this.bottomLeftAnchor)),this.bottomRightAnchor&&(null===(v=this.resizeTarget)||void 0===v||v.removeChild(this.bottomRightAnchor))),this.topLeftAnchor=null,this.topAnchor=null,this.topRightAnchor=null,this.leftAnchor=null,this.rightAnchor=null,this.bottomLeftAnchor=null,this.bottomAnchor=null,this.bottomRightAnchor=null,this.resizeTarget=null,this.container=null,this.currentAnchor=null,this.resizeStartLeft=0,this.resizeStartTop=0,this.originLeft=0,this.originTop=0,this.originWidth=0,this.originHeight=0},e.prototype.setVisible=function(e){var t=e?"block":"none";this.topLeftAnchor&&(this.topLeftAnchor.style.display=t),this.topAnchor&&(this.topAnchor.style.display=t),this.topRightAnchor&&(this.topRightAnchor.style.display=t),this.leftAnchor&&(this.leftAnchor.style.display=t),this.rightAnchor&&(this.rightAnchor.style.display=t),this.bottomLeftAnchor&&(this.bottomLeftAnchor.style.display=t),this.bottomAnchor&&(this.bottomAnchor.style.display=t),this.bottomRightAnchor&&(this.bottomRightAnchor.style.display=t)},e}(),Zn=function(){var e=new Map;for(var t in m)if(isNaN(Number(t))){var i=m[t],o=t.split("_");e.set(i,{width:parseInt(o[1]),height:parseInt(o[2])})}return e}(),es=function(){function e(e){if(this.logPrefix="[TRTCMediaMixingDesigner]",this.mixingVideoWidth=640,this.mixingVideoHeight=360,this.canExceedContainer=!1,this.movableHandler=null,this.resizableHandler=null,this.previewScale=1,this.previewWidth=0,this.previewHeight=0,this.previewLeft=0,this.previewTop=0,this.BOUNDARY_ADSORPTION_THRESHOLD=10,this.newSelected=null,this.clickedMediaSources=[],this.oldSelectedIndex=-1,this.mousedownLeft=null,this.mousedownTop=null,this.eventButton=null,this.resizeObserver=null,this.logger=e.logger,this.container=e.view,this.container.style.position="relative",this.videoResolution=e.videoResolution,this.resMode=e.resMode,Zn.has(e.videoResolution)){var t=Zn.get(e.videoResolution),i=t.width,o=t.height;this.resMode===D.TRTCVideoResolutionModeLandscape?(this.mixingVideoWidth=i,this.mixingVideoHeight=o):(this.mixingVideoWidth=o,this.mixingVideoHeight=i)}this.updatePreviewProperty(),this.canExceedContainer=e.canExceedContainer||!1,this.eventEmitter=new E,this.mediaList=[],this.selectedMediaIndex=-1,this.moveAndResizeOverlay=document.createElement("div"),this.moveAndResizeOverlay.style.position="relative",this.container.appendChild(this.moveAndResizeOverlay),this.initMediaMovable(),this.initMediaResizable(),this.initContainerMouseEventHander(),this.initContainerResizeObserver()}return e.prototype.updateOptions=function(e){if(!be(e.videoResolution)||!be(e.resMode)){if(this.resMode=be(e.resMode)?this.resMode:e.resMode,e.videoResolution&&Zn.has(e.videoResolution)){var t=Zn.get(e.videoResolution),i=t.width,o=t.height;this.resMode===D.TRTCVideoResolutionModeLandscape?(this.mixingVideoWidth=i,this.mixingVideoHeight=o):(this.mixingVideoWidth=o,this.mixingVideoHeight=i)}this.updatePreviewProperty(),this.updateOverlay()}},e.prototype.addMedia=function(e){this.mediaList.unshift(e),e.isSelected&&(this.selectedMediaIndex=0,this.updateOverlay())},e.prototype.removeMedia=function(e){var t=this.mediaList.findIndex((function(t){return t.id===e.id}));-1!==t&&(this.mediaList.splice(t,1),(this.selectedMediaIndex===t||e.isSelected)&&(this.selectedMediaIndex=-1,this.updateOverlay()))},e.prototype.updateMedia=function(e){var t=this.mediaList.findIndex((function(t){return t.id===e.id}));-1!==t&&(this.mediaList[t]=Object.assign({},this.mediaList[t],e),e.isSelected&&(this.selectedMediaIndex=t,this.updateOverlay()))},e.prototype.on=function(e,t){var i;null===(i=this.eventEmitter)||void 0===i||i.on(e,t)},e.prototype.off=function(e,t){var i;null===(i=this.eventEmitter)||void 0===i||i.off(e,t)},e.prototype.destroy=function(){var e,t,i,o;this.resizeObserver&&(this.container&&this.resizeObserver.unobserve(this.container),this.resizeObserver.disconnect(),this.resizeObserver=null),null===(e=this.movableHandler)||void 0===e||e.destroy(),null===(t=this.resizableHandler)||void 0===t||t.destroy(),this.movableHandler=null,this.resizableHandler=null,null===(i=this.container)||void 0===i||i.removeEventListener("contextmenu",this.onRightButtonClicked,!1),document.removeEventListener("mousedown",this.onContainerMousedown,!1),this.moveAndResizeOverlay&&(null===(o=this.container)||void 0===o||o.removeChild(this.moveAndResizeOverlay),this.moveAndResizeOverlay=null),this.container=null,this.eventEmitter=null,this.mediaList=[]},e.prototype.initMediaMovable=function(){this.onMove=this.onMove.bind(this),this.movableHandler=new Fn(this.moveAndResizeOverlay,this.container,{canExceedContainer:this.canExceedContainer,calcPositionOnly:!1}),this.movableHandler.on("move",this.onMove)},e.prototype.initMediaResizable=function(){this.onResize=this.onResize.bind(this),this.resizableHandler=new $n(this.moveAndResizeOverlay,this.container,{keepRatio:!0,stopPropagation:!0,canExceedContainer:this.canExceedContainer,anchorMode:0}),this.resizableHandler.on("resize",this.onResize)},e.prototype.updateCanExceedContainer=function(e){this.movableHandler&&(this.movableHandler.options.canExceedContainer=e),this.resizableHandler&&(this.resizableHandler.options.canExceedContainer=e)},e.prototype.initContainerMouseEventHander=function(){this.container?(this.onContainerMousedown=this.onContainerMousedown.bind(this),this.onContainerMousemove=this.onContainerMousemove.bind(this),this.onContainerMouseup=this.onContainerMouseup.bind(this),document.addEventListener("mousedown",this.onContainerMousedown,!1),this.onRightButtonClicked=this.onRightButtonClicked.bind(this),this.container.addEventListener("contextmenu",this.onRightButtonClicked,!1)):this.logger.error("".concat(this.logPrefix,"initContainerMouseEventHander failed, no container view"))},e.prototype.initContainerResizeObserver=function(){this.container&&(this.onPreviewAreaResize=this.onPreviewAreaResize.bind(this),this.resizeObserver=new ResizeObserver(this.onPreviewAreaResize),this.resizeObserver.observe(this.container))},e.prototype.onPreviewAreaResize=function(e){for(var t=0,i=e;t<i.length;t++){if(i[t].target===this.container){this.updatePreviewProperty(),this.updateOverlay();break}}},e.prototype.updatePreviewProperty=function(){if(this.container){var e=this.container.offsetWidth,t=this.container.offsetHeight,i=e/this.mixingVideoWidth,o=t/this.mixingVideoHeight;this.previewScale=i>o?i:o,this.previewWidth=this.mixingVideoWidth*this.previewScale,this.previewHeight=this.mixingVideoHeight*this.previewScale,this.previewLeft=(e-this.previewWidth)/2,this.previewTop=(t-this.previewHeight)/2}else console.debug("".concat(this.logPrefix,"calcPreviewScale failed, no HTML element to display"))},e.prototype.updateOverlay=function(){if(this.moveAndResizeOverlay){var e=void 0,t=void 0,i=void 0,o=void 0;if(this.selectedMediaIndex>=0){var r=this.mediaList[this.selectedMediaIndex],n={left:r.rect.left*this.previewScale,top:r.rect.top*this.previewScale,right:r.rect.right*this.previewScale,bottom:r.rect.bottom*this.previewScale};e="".concat(n.left+this.previewLeft,"px"),t="".concat(n.top+this.previewTop,"px"),i="".concat(n.right-n.left,"px"),o="".concat(n.bottom-n.top,"px");var s=r.interaction||{},a=!1!==s.showBorder,c=!1!==s.showResizeAnchors,u=!1!==s.draggable,l=!1!==s.canExceedCanvas;this.logger.debug("".concat(this.logPrefix,"updateOverlay: interaction config -"),{showBorder:a,showResizeAnchors:c,draggable:u,canExceedCanvas:l}),this.updateCanExceedContainer(l),this.moveAndResizeOverlay.style.display="block",this.moveAndResizeOverlay.style.border=a?"1px solid #3D7EFD":"none",this.resizableHandler&&this.resizableHandler.setVisible(c),this.movableHandler&&(this.logger.debug("".concat(this.logPrefix,"updateOverlay: setting movableHandler.setEnabled(").concat(u,")")),this.movableHandler.setEnabled(u))}else e="".concat(this.previewLeft,"px"),t="".concat(this.previewTop,"px"),i="0px",o="0px",this.moveAndResizeOverlay.style.display="none";this.moveAndResizeOverlay.style.left=e,this.moveAndResizeOverlay.style.top=t,this.moveAndResizeOverlay.style.width=i,this.moveAndResizeOverlay.style.height=o}},e.prototype.onMove=function(e,t){var i;console.debug("".concat(this.logPrefix,"onMove: ").concat(e," ").concat(t));var o=this.mediaList[this.selectedMediaIndex];if(o&&this.moveAndResizeOverlay){var r={left:e-this.previewLeft,top:t-this.previewTop,right:e-this.previewLeft+this.moveAndResizeOverlay.offsetWidth,bottom:t-this.previewTop+this.moveAndResizeOverlay.offsetHeight};this.doAdsorption(r);var n={left:Math.round(r.left/this.previewScale),top:Math.round(r.top/this.previewScale),right:Math.round(r.right/this.previewScale),bottom:Math.round(r.bottom/this.previewScale)};null===(i=this.eventEmitter)||void 0===i||i.emit("onSourceMoved",c({},o),n)}else console.debug("".concat(this.logPrefix,"onMove no selected media"))},e.prototype.doAdsorption=function(e){var t=this.BOUNDARY_ADSORPTION_THRESHOLD;Math.abs(e.left)<t&&(e.right=e.right-e.left,e.left=0),Math.abs(e.top)<t&&(e.bottom=e.bottom-e.top,e.top=0),Math.abs(e.right-this.previewWidth)<t&&(e.left=e.left+this.previewWidth-e.right,e.right=this.previewWidth),Math.abs(e.bottom-this.previewHeight)<t&&(e.top=e.top+this.previewHeight-e.bottom,e.bottom=this.previewHeight)},e.prototype.onResize=function(e,t,i,o){var r;console.debug("".concat(this.logPrefix,"onResize: ").concat(e," ").concat(t," ").concat(i," ").concat(o));var n=this.mediaList[this.selectedMediaIndex];if(n){var s=n.interaction||{};if(!Te(s.showResizeAnchors)&&!s.showResizeAnchors)return;var a={left:e-this.previewLeft,top:t-this.previewTop,right:e-this.previewLeft+i,bottom:t-this.previewTop+o},u={left:Math.round(a.left/this.previewScale),top:Math.round(a.top/this.previewScale),right:Math.round(a.right/this.previewScale),bottom:Math.round(a.bottom/this.previewScale)};null===(r=this.eventEmitter)||void 0===r||r.emit("onSourceResized",c({},n),u)}else console.debug("".concat(this.logPrefix,"onResize no selected media"))},e.prototype.getMaxZOrderMedia=function(e){var t,i,o,r,n,s;if(0===e.length)return null;for(var a=e[0],c=null!==(o=null===(i=null===(t=a.origin)||void 0===t?void 0:t.layout)||void 0===i?void 0:i.zOrder)&&void 0!==o?o:-Infinity,u=1;u<e.length;u++){var l=null!==(s=null===(n=null===(r=e[u].origin)||void 0===r?void 0:r.layout)||void 0===n?void 0:n.zOrder)&&void 0!==s?s:-Infinity;l>c&&(c=l,a=e[u])}return a},e.prototype.emitOnSelect=function(e){var t;if(e){for(var i=this.mediaList.length,o=0;o<i;o++)if(e.id===this.mediaList[o].id){this.selectedMediaIndex=o;break}}else this.selectedMediaIndex=-1;this.updateOverlay(),null===(t=this.eventEmitter)||void 0===t||t.emit("onSourceSelected",e?c({},e):null)},e.prototype.onContainerMousedown=function(e){var t;console.debug("".concat(this.logPrefix,"onContainerMousedown event:"),e,e.target,e.currentTarget);var i=e.target;if(this.eventButton=e.button,i&&this.container){if(this.container.contains(i)){console.debug("".concat(this.logPrefix,"onContainerMousedown mix video image clicked"));var o=this.container.getBoundingClientRect(),r=e.clientX-o.x-this.previewLeft,n=e.clientY-o.y-this.previewTop,s=r/this.previewScale,a=n/this.previewScale;console.debug("".concat(this.logPrefix,"onContainerMousedown click point coordinates in mix video:"),r,n,s,a);for(var c=0;c<this.mediaList.length;c++){var u=this.mediaList[c];u.rect&&s>=u.rect.left&&s<=u.rect.right&&a>=u.rect.top&&a<=u.rect.bottom&&!1!==(null===(t=u.interaction)||void 0===t?void 0:t.selectable)&&(this.clickedMediaSources.push(u),this.mediaList[this.selectedMediaIndex]&&u.id===this.mediaList[this.selectedMediaIndex].id&&(this.oldSelectedIndex=this.clickedMediaSources.length-1))}this.mousedownLeft=e.screenX,this.mousedownTop=e.screenY}this.clickedMediaSources.length>0?2===this.eventButton&&-1===this.oldSelectedIndex?(this.newSelected=this.getMaxZOrderMedia(this.clickedMediaSources),console.debug("".concat(this.logPrefix,"onContainerMousedown find clicked media source:"),this.newSelected),this.emitOnSelect(this.newSelected),this.clickedMediaSources.splice(0,this.clickedMediaSources.length)):(document.addEventListener("mousemove",this.onContainerMousemove,!1),document.addEventListener("mouseup",this.onContainerMouseup,!1)):(this.newSelected=null,console.debug("".concat(this.logPrefix,"onContainerMousedown find clicked media source:"),this.newSelected),this.emitOnSelect(null),this.mousedownLeft=null,this.mousedownTop=null,this.eventButton=null)}},e.prototype.onContainerMousemove=function(e){var t;if(e.target&&this.container&&null!==this.mousedownLeft&&null!==this.mousedownTop){var i=e.screenX-this.mousedownLeft,o=e.screenY-this.mousedownTop;(Math.abs(i)>=5||Math.abs(o)>=5)&&(this.oldSelectedIndex>=0?(console.debug("".concat(this.logPrefix,"onContainerMousemove move or resize old selected media source, clear data:"),this.clickedMediaSources,this.oldSelectedIndex),this.clickedMediaSources.splice(0,this.clickedMediaSources.length),this.oldSelectedIndex=-1):this.clickedMediaSources.length>0&&(this.newSelected=this.getMaxZOrderMedia(this.clickedMediaSources),console.debug("".concat(this.logPrefix,"onContainerMousemove find clicked media source:"),this.newSelected),this.emitOnSelect(this.newSelected),this.clickedMediaSources.splice(0,this.clickedMediaSources.length),null===(t=this.moveAndResizeOverlay)||void 0===t||t.dispatchEvent(new MouseEvent("mousedown",{screenX:this.mousedownLeft,screenY:this.mousedownTop,button:this.eventButton}))))}},e.prototype.onContainerMouseup=function(e){if(document.removeEventListener("mousemove",this.onContainerMousemove,!1),document.removeEventListener("mouseup",this.onContainerMouseup,!1),console.debug("".concat(this.logPrefix,"onContainerMouseup data:"),this.clickedMediaSources,this.oldSelectedIndex),e.target&&this.container){if(this.clickedMediaSources.length>0)if(this.oldSelectedIndex>=0){if(0===this.eventButton){var t=(this.oldSelectedIndex+1)%this.clickedMediaSources.length;this.newSelected=this.clickedMediaSources[t],console.debug("".concat(this.logPrefix,"onContainerMouseup find clicked media source:"),this.newSelected),this.emitOnSelect(this.newSelected)}}else this.newSelected=this.getMaxZOrderMedia(this.clickedMediaSources),console.debug("".concat(this.logPrefix,"onContainerMouseup find clicked media source:"),this.newSelected),this.emitOnSelect(this.newSelected)}else console.debug("".concat(this.logPrefix,"onContainerMouseup click outside of mixing video image")),this.emitOnSelect(null);this.mousedownLeft=null,this.mousedownTop=null,this.clickedMediaSources.splice(0,this.clickedMediaSources.length),this.oldSelectedIndex=-1,this.newSelected=null,this.eventButton=null},e.prototype.onRightButtonClicked=function(e){var t;console.debug("".concat(this.logPrefix,"onRightButtonClicked:"),e.target,e.currentTarget,e.buttons),e.preventDefault(),null===(t=this.eventEmitter)||void 0===t||t.emit("onRightButtonClicked",c({},this.mediaList[this.selectedMediaIndex]))},e}(),ts=function(){function t(e){if(this.logPrefix="[TRTCMediaMixingManager]",this.eventEmitter=new E,this.publishParams={videoEncoderParams:{videoResolution:m.TRTCVideoResolution_1280_720,resMode:D.TRTCVideoResolutionModeLandscape,videoFps:15,videoBitrate:1800},canvasColor:0},this.mediaMixingDesigner=null,this.sourceList=[],this.trtcSourceMap=new Map,this.mixVideoTrack=null,this.publishStreamType=T.TRTCVideoStreamTypeBig,this.selectedSource=null,this.view=null,this.screensWithSystemAudio=new Set,t.mediaMixingManager)return t.mediaMixingManager;t.mediaMixingManager=this,this.logger=e.logger,this.trtc=e.trtc,this.trtcCloud=e.trtcCloud,this.onSourceSelected=this.onSourceSelected.bind(this),this.onSourceMoved=this.onSourceMoved.bind(this),this.onSourceResized=this.onSourceResized.bind(this),this.onRightButtonClicked=this.onRightButtonClicked.bind(this)}return t.prototype.destroy=function(){return l(this,void 0,Promise,(function(){var e,i,o,r,n;return h(this,(function(s){switch(s.label){case 0:this.view=null,s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this.trtc.stopPlugin("VideoMixer")];case 2:return s.sent(),[3,4];case 3:return e=s.sent(),this.logger.error("".concat(this.logPrefix," destroy and stopPlugin error:"),e),[3,4];case 4:if(!(this.screensWithSystemAudio.size>0))return[3,12];s.label=5;case 5:s.trys.push([5,10,,11]),i=0,o=Array.from(this.screensWithSystemAudio),s.label=6;case 6:return i<o.length?(r=o[i],[4,this.trtc.stopPlugin("AudioMixer",{id:"systemAudioTrack_".concat(r)})]):[3,9];case 7:s.sent(),s.label=8;case 8:return i++,[3,6];case 9:return[3,11];case 10:return n=s.sent(),this.logger.error("".concat(this.logPrefix," destroy and stopPlugin AudioMixer error:"),n),[3,11];case 11:this.screensWithSystemAudio.clear(),s.label=12;case 12:return this.destroyDesigner(),this.eventEmitter=null,t.mediaMixingManager=null,[2]}}))}))},t.prototype.bindPreviewArea=function(e){return l(this,void 0,Promise,(function(){var t,i,o,r,n=this;return h(this,(function(s){switch(s.label){case 0:return this.logger.log("".concat(this.logPrefix," bindPreviewArea:"),e),this.view=e,t=this._getCanvasSize(this.publishParams.videoEncoderParams.videoResolution,this.publishParams.videoEncoderParams.resMode),i=t.width,o=t.height,[4,this.trtc.startPlugin("VideoMixer",{view:e,canvasInfo:{width:i,height:o,canvasColor:String(this.publishParams.canvasColor)},onScreenShareStop:function(e){var t,i=n.sourceList.find((function(t){return t.id===e}));n.removeMediaSource(i),null===(t=n.eventEmitter)||void 0===t||t.emit("onSourceDisconnected",i||null)}})];case 1:return r=s.sent(),console.log("startPlugin result",r,r.track),this.mixVideoTrack=r.track,this.createDesigner(),[2]}}))}))},t.prototype.updatePreviewArea=function(e){return l(this,void 0,Promise,(function(){return h(this,(function(t){switch(t.label){case 0:return this.logger.log("".concat(this.logPrefix," updatePreviewArea:"),e),e===this.view?[2]:[4,this.trtc.updatePlugin("VideoMixer",{view:e})];case 1:return t.sent(),this.destroyDesigner(),this.view=e,e&&this.createDesigner(),[2]}}))}))},t.prototype._getTRTCSourceKey=function(e){var t;return((t={})[vn.kCamera]="camera",t[vn.kScreen]="screen",t[vn.kText]="text",t[vn.kVideo]="video",t[vn.kImage]="image",t)[e.type]},t.prototype._getTRTCFillMode=function(e){var t;return((t={})[y.TRTCVideoFillMode_Fill]="cover",t[y.TRTCVideoFillMode_Fit]="contain",t)[e]},t.prototype._getTRTCVideoProfile=function(e,t){var i,o,r,n=null!==(o=((i={})[m.TRTCVideoResolution_480_270]={width:480,height:270},i[m.TRTCVideoResolution_640_360]={width:640,height:360},i[m.TRTCVideoResolution_960_540]={width:960,height:540},i[m.TRTCVideoResolution_1280_720]={width:1280,height:720},i[m.TRTCVideoResolution_1920_1080]={width:1920,height:1080},i)[e])&&void 0!==o?o:(r=e)&&"object"==typeof r&&"number"==typeof r.width&&"number"==typeof r.height?e:{width:1920,height:1080};return{width:n.width,height:n.height,frameRate:t,bitrate:1e3}},t.prototype._getTRTCLayout=function(e){var t,i,o,r,n,s,a,c,u,l,h,d,p,f,v,g,m={zIndex:(null===(o=e.layout)||void 0===o?void 0:o.zOrder)||0};if(Te(null===(r=e.layout)||void 0===r?void 0:r.rect)||(m.x=null===(n=e.layout)||void 0===n?void 0:n.rect.left,m.y=null===(s=e.layout)||void 0===s?void 0:s.rect.top,m.width=(null===(a=e.layout)||void 0===a?void 0:a.rect.right)-(null===(c=e.layout)||void 0===c?void 0:c.rect.left),m.height=(null===(u=e.layout)||void 0===u?void 0:u.rect.bottom)-(null===(l=e.layout)||void 0===l?void 0:l.rect.top)),Te(null===(h=e.layout)||void 0===h?void 0:h.fillMode)||(m.fillMode=this._getTRTCFillMode(null===(d=e.layout)||void 0===d?void 0:d.fillMode)),!Te(null===(p=e.layout)||void 0===p?void 0:p.mirror)){var T=((t={})[_.TRTCVideoMirrorType_Auto]=!0,t[_.TRTCVideoMirrorType_Enable]=!0,t[_.TRTCVideoMirrorType_Disable]=!1,t);m.mirror=T[null===(f=e.layout)||void 0===f?void 0:f.mirror]}if(!Te(null===(v=e.layout)||void 0===v?void 0:v.rotation)){var y=((i={})[I.TRTCVideoRotation0]=0,i[I.TRTCVideoRotation90]=90,i[I.TRTCVideoRotation180]=180,i[I.TRTCVideoRotation270]=270,i);m.rotation=y[null===(g=e.layout)||void 0===g?void 0:g.rotation]}return m},t.prototype._getTRTCSourceItem=function(e){var t,i,o,r,n,s,a,u,l,h;switch(e.type){case vn.kScreen:return h=m.TRTCVideoResolution_1920_1080,(null==e?void 0:e.useInternalTrack)?{id:e.id,layout:this._getTRTCLayout(e),useInternalTrack:!0}:{id:e.id,profile:this._getTRTCVideoProfile((null===(t=e.screen)||void 0===t?void 0:t.resolution)||h,(null===(i=e.screen)||void 0===i?void 0:i.fps)||15),layout:this._getTRTCLayout(e),systemAudio:null===(o=e.screen)||void 0===o?void 0:o.systemAudio};case vn.kCamera:return h=m.TRTCVideoResolution_1280_720,(null==e?void 0:e.useInternalTrack)?{id:e.id,layout:this._getTRTCLayout(e),useInternalTrack:!0}:{id:e.id,cameraId:null===(r=e.camera)||void 0===r?void 0:r.cameraId,profile:this._getTRTCVideoProfile((null===(n=e.camera)||void 0===n?void 0:n.resolution)||h,(null===(s=e.camera)||void 0===s?void 0:s.fps)||15),videoTrack:null===(a=e.camera)||void 0===a?void 0:a.videoTrack,layout:this._getTRTCLayout(e)};case vn.kText:return c(c({id:e.id},e.text||{}),{layout:this._getTRTCLayout(e)});case vn.kImage:return{id:e.id,url:null===(u=e.image)||void 0===u?void 0:u.url,layout:this._getTRTCLayout(e)};case vn.kVideo:return{id:e.id,url:null===(l=e.video)||void 0===l?void 0:l.url,layout:this._getTRTCLayout(e)};default:return null}},t.prototype._getCanvasSize=function(e,t){var i,o,r=((i={})[m.TRTCVideoResolution_480_270]={width:480,height:270},i[m.TRTCVideoResolution_640_360]={width:640,height:360},i[m.TRTCVideoResolution_960_540]={width:960,height:540},i[m.TRTCVideoResolution_1280_720]={width:1280,height:720},i[m.TRTCVideoResolution_1920_1080]={width:1920,height:1080},i)[e],n=r.width,s=r.height;return t===D.TRTCVideoResolutionModePortrait&&(n=(o=[s,n])[0],s=o[1]),{width:n,height:s}},t.prototype.addMediaSource=function(e){var t;return l(this,void 0,Promise,(function(){var i,o,r,n,s,a,c,u,l;return h(this,(function(h){switch(h.label){case 0:if(-1!==this.findMediaSourceIndex(e))throw new Error("Media source already existed");if(i=Se(e),o=this._getTRTCSourceKey(i),!(r=this._getTRTCSourceItem(i))||!o)throw new Error("Invalid media source");return(n=Se(this.trtcSourceMap.get(o))||[]).push(r),[4,this.trtc.updatePlugin("VideoMixer",(l={},l[o]=n,l))];case 1:return s=h.sent(),a=s.result,c=s.systemAudioTrackList,e.type===vn.kScreen&&(null==c?void 0:c[e.id])?(this.screensWithSystemAudio.add(e.id),u=null==c?void 0:c[e.id],this.logger.log("".concat(this.logPrefix," startPlugin AudioMixer, track ID:"),u.id),[4,this.trtc.startPlugin("AudioMixer",{id:"systemAudioTrack_".concat(e.id),track:u})]):[3,3];case 2:h.sent(),h.label=3;case 3:if(a.failedDetails.find((function(t){return t.id===e.id})))throw new Error("Failed to add media source");return i.isSelected&&(this.unselectMediaSource(this.selectedSource),this.selectedSource=e),this.trtcSourceMap.set(o,n),null===(t=this.mediaMixingDesigner)||void 0===t||t.addMedia({id:i.id,rect:this._getDesignerMediaRect(e),isSelected:!!Te(i.isSelected)||i.isSelected,origin:i,interaction:i.interaction}),i.isSelected&&(this.selectedSource=i),this.sourceList.push(i),[2]}}))}))},t.prototype.removeMediaSource=function(e){var t,i,o;return l(this,void 0,Promise,(function(){var r,n,s,a,c,u;return h(this,(function(l){switch(l.label){case 0:if(this.logger.log("".concat(this.logPrefix,"removeMediaSource:"),e),-1===(r=this.findMediaSourceIndex(e)))throw new Error("Not existing media source to remove");return n=this._getTRTCSourceKey(e),s=Se(this.trtcSourceMap.get(n))||[],a=s.findIndex((function(t){return t.id===e.id})),s.splice(a,1),[4,this.trtc.updatePlugin("VideoMixer",(u={},u[n]=s,u))];case 1:return c=l.sent().result,e.type===vn.kScreen&&this.screensWithSystemAudio.has(e.id)?(this.screensWithSystemAudio.delete(e.id),[4,this.trtc.stopPlugin("AudioMixer",{id:"systemAudioTrack_".concat(e.id)})]):[3,3];case 2:l.sent(),l.label=3;case 3:if(c.failedDetails.find((function(t){return t.id===e.id})))throw new Error("Failed to remove media source");return null===(t=this.mediaMixingDesigner)||void 0===t||t.removeMedia({id:e.id,rect:null===(i=e.layout)||void 0===i?void 0:i.rect,isSelected:e.isSelected||!1,origin:Se(e)}),(null===(o=this.selectedSource)||void 0===o?void 0:o.id)===e.id&&(this.selectedSource=null),this.trtcSourceMap.set(n,s),this.sourceList.splice(r,1),[2]}}))}))},t.prototype._getDesignerMediaRect=function(e){var t,i,o=(null===(t=e.layout)||void 0===t?void 0:t.rect)||{left:0,top:0,right:0,bottom:0},r=o.left,n=o.top,s=o.right,a=o.bottom,c=s-r,u=a-n;switch(null===(i=e.layout)||void 0===i?void 0:i.rotation){case I.TRTCVideoRotation0:case I.TRTCVideoRotation180:return{left:r,top:n,right:s,bottom:a};case I.TRTCVideoRotation90:case I.TRTCVideoRotation270:return{left:r,top:n,right:r+u,bottom:n+c};default:return{left:r,top:n,right:s,bottom:a}}},t.prototype._getPluginMediaRect=function(e){var t,i,o=(null===(t=e.layout)||void 0===t?void 0:t.rect)||{left:0,top:0,right:0,bottom:0},r=o.left,n=o.top,s=o.right,a=o.bottom;switch(null===(i=e.layout)||void 0===i?void 0:i.rotation){case I.TRTCVideoRotation0:case I.TRTCVideoRotation180:return{left:r,top:n,right:s,bottom:a};case I.TRTCVideoRotation90:case I.TRTCVideoRotation270:return{left:r,top:n,right:r+(a-n),bottom:n+(s-r)};default:return{left:r,top:n,right:s,bottom:a}}},t.prototype.updateMediaSource=function(e){var t,i;return l(this,void 0,Promise,(function(){var o,r,n,s,a,u,l,d;return h(this,(function(h){switch(h.label){case 0:if(this.logger.log("".concat(this.logPrefix,"updateMediaSource:"),e),-1===(o=this.findMediaSourceIndex(e)))throw new Error("Not existing media source to update");return r=c(c({},this.sourceList[o]),Se(e)),e.isSelected?(this.unselectMediaSource(this.selectedSource),this.selectedSource=e):(null===(t=this.selectedSource)||void 0===t?void 0:t.id)===e.id&&(this.selectedSource=null),n=this._getTRTCSourceKey(r),s=this._getTRTCSourceItem(r),a=Se(this.trtcSourceMap.get(n))||[],u=a.findIndex((function(t){return t.id===e.id})),a[u]=s,[4,this.trtc.updatePlugin("VideoMixer",(d={},d[n]=a,d))];case 1:if(h.sent().result.failedDetails.find((function(t){return t.id===e.id})))throw new Error("Failed to update media source");return l={id:e.id,rect:this._getDesignerMediaRect(e),isSelected:e.isSelected||!1,origin:Se(e),interaction:r.interaction},this.logger.log("".concat(this.logPrefix,"updateParams:"),JSON.stringify(l)),null===(i=this.mediaMixingDesigner)||void 0===i||i.updateMedia(l),this.trtcSourceMap.set(n,a),this.sourceList[o]=r,[2]}}))}))},t.prototype.startPublish=function(e){var t;return l(this,void 0,Promise,(function(){var i;return h(this,(function(o){switch(o.label){case 0:return i=null!==(t=null==e?void 0:e.streamType)&&void 0!==t?t:T.TRTCVideoStreamTypeBig,this.publishStreamType=i,this.logger.log("".concat(this.logPrefix," startPublish, streamType:"),i),[4,this.trtcCloud._startPublishVideoTrack({videoTrack:this.mixVideoTrack,streamType:i})];case 1:return o.sent(),[2]}}))}))},t.prototype.stopPublish=function(){return l(this,void 0,Promise,(function(){return h(this,(function(e){switch(e.label){case 0:return this.logger.log("".concat(this.logPrefix," stopPublish, streamType:"),this.publishStreamType),[4,this.trtcCloud._stopPublishVideoTrack({streamType:this.publishStreamType})];case 1:return e.sent(),[2]}}))}))},t.prototype.updatePublishParams=function(t){var i,o,r,n,s;return l(this,void 0,Promise,(function(){var a,c,u,l,d,p,v,g,m,T,y,_,R,b,C,S,w,E,M,A,P,I,L,V;return h(this,(function(h){switch(h.label){case 0:this.logger.log("".concat(this.logPrefix,"updatePublishParams:"),t),a=this.publishParams,this.publishParams=t,c=this._getCanvasSize(t.videoEncoderParams.videoResolution,t.videoEncoderParams.resMode),u=c.width,l=c.height,h.label=1;case 1:return h.trys.push([1,3,,4]),[4,this.trtc.updatePlugin("VideoMixer",{canvasInfo:{width:u,height:l,canvasColor:String(t.canvasColor)}})];case 2:return h.sent(),[3,4];case 3:if((d=h.sent()).code!==e.ERROR_CODE.OPERATION_ABORT)throw d;return[3,4];case 4:null===(r=this.mediaMixingDesigner)||void 0===r||r.updateOptions({videoResolution:this.publishParams.videoEncoderParams.videoResolution,resMode:this.publishParams.videoEncoderParams.resMode}),h.label=5;case 5:h.trys.push([5,11,12,17]),p=f(this.sourceList),h.label=6;case 6:return[4,p.next()];case 7:return(v=h.sent()).done?[3,10]:(g=v.value).layout?(m=g.layout.rect||{left:0,top:0,right:0,bottom:0},T=m.left,y=m.top,_=m.right,R=m.bottom,b=this._getCanvasSize(a.videoEncoderParams.videoResolution),C=b.width,S=b.height,w=this._getCanvasSize(t.videoEncoderParams.videoResolution),E=w.width,M=w.height,A=T*E/C,P=y*M/S,I=_*E/C,L=R*M/S,g.layout.rect={left:A,top:P,right:I,bottom:L},[4,this.updateMediaSource(g)]):[3,9];case 8:h.sent(),null===(n=this.eventEmitter)||void 0===n||n.emit("onSourceResized",g,null===(s=g.layout)||void 0===s?void 0:s.rect),h.label=9;case 9:return[3,6];case 10:return[3,17];case 11:return V=h.sent(),i={error:V},[3,17];case 12:return h.trys.push([12,,15,16]),v&&!v.done&&(o=p.return)?[4,o.call(p)]:[3,14];case 13:h.sent(),h.label=14;case 14:return[3,16];case 15:if(i)throw i.error;return[7];case 16:return[7];case 17:return[4,this.trtcCloud.setVideoEncoderParam(t.videoEncoderParams)];case 18:return h.sent(),[2]}}))}))},t.prototype.on=function(e,t){var i;null===(i=this.eventEmitter)||void 0===i||i.on(e,t)},t.prototype.off=function(e,t){var i;null===(i=this.eventEmitter)||void 0===i||i.off(e,t)},t.prototype.onVisibilityChange=function(){this.logger.log("".concat(this.logPrefix,"onVisibilityChange document.hidden:").concat(document.hidden)),document.hidden?this.bindPreviewArea(null):this.bindPreviewArea(this.view)},t.prototype.createDesigner=function(){var e,t;this.view&&(this.mediaMixingDesigner=new es({view:this.view,videoResolution:(null===(e=this.publishParams)||void 0===e?void 0:e.videoEncoderParams.videoResolution)||m.TRTCVideoResolution_1920_1080,resMode:(null===(t=this.publishParams)||void 0===t?void 0:t.videoEncoderParams.resMode)||D.TRTCVideoResolutionModeLandscape,canExceedContainer:!0,logger:this.logger}),this.listenDesignerEvent())},t.prototype.destroyDesigner=function(){var e;this.mediaMixingDesigner&&(this.unlistenDesignerEvent(),null===(e=this.mediaMixingDesigner)||void 0===e||e.destroy(),this.mediaMixingDesigner=null)},t.prototype.listenDesignerEvent=function(){var e,t,i,o,r;null===(e=this.mediaMixingDesigner)||void 0===e||e.on("onError",this.onError),null===(t=this.mediaMixingDesigner)||void 0===t||t.on("onSourceSelected",this.onSourceSelected),null===(i=this.mediaMixingDesigner)||void 0===i||i.on("onSourceMoved",this.onSourceMoved),null===(o=this.mediaMixingDesigner)||void 0===o||o.on("onSourceResized",this.onSourceResized),null===(r=this.mediaMixingDesigner)||void 0===r||r.on("onRightButtonClicked",this.onRightButtonClicked)},t.prototype.unlistenDesignerEvent=function(){var e,t,i,o,r;null===(e=this.mediaMixingDesigner)||void 0===e||e.off("onError",this.onError),null===(t=this.mediaMixingDesigner)||void 0===t||t.off("onSourceSelected",this.onSourceSelected),null===(i=this.mediaMixingDesigner)||void 0===i||i.off("onSourceMoved",this.onSourceMoved),null===(o=this.mediaMixingDesigner)||void 0===o||o.off("onSourceResized",this.onSourceResized),null===(r=this.mediaMixingDesigner)||void 0===r||r.off("onRightButtonClicked",this.onRightButtonClicked)},t.prototype.onError=function(e,t){this.logger.log("".concat(this.logPrefix,"onError:"),e,t)},t.prototype.onSourceSelected=function(e){var t;return l(this,void 0,void 0,(function(){return h(this,(function(i){switch(i.label){case 0:return this.logger.debug("".concat(this.logPrefix,"onSourceSelected: "),e,this.selectedSource),e&&this.selectedSource&&e.origin.id===this.selectedSource.id?[2]:(null==e?void 0:e.origin)?(this.updateMediaSource(c(c({},e.origin),{isSelected:!0})),[3,3]):[3,1];case 1:return this.selectedSource?[4,this.updateMediaSource(c(c({},this.selectedSource),{isSelected:!1}))]:[3,3];case 2:i.sent(),this.selectedSource=null,i.label=3;case 3:return null===(t=this.eventEmitter)||void 0===t||t.emit("onSourceSelected",e?e.origin:null),[2]}}))}))},t.prototype.onSourceMoved=function(e,t){var i,o;if(this.logger.debug("".concat(this.logPrefix,"onSourceMoved:"),e,t),null==e?void 0:e.origin){var r=c(c({},e.origin),{layout:c(c({},e.origin.layout),{rect:t})});this.updateMediaSource(Ce(r,{layout:{rect:this._getPluginMediaRect(r)}})),(null===(i=this.selectedSource)||void 0===i?void 0:i.id)===e.origin.id&&(this.selectedSource=this.sourceList.find((function(t){return t.id===e.origin.id}))),null===(o=this.eventEmitter)||void 0===o||o.emit("onSourceMoved",e.origin,this._getPluginMediaRect(r))}},t.prototype.onSourceResized=function(e,t){var i,o;if(this.logger.debug("".concat(this.logPrefix,"onSourceResized:"),e,t),null==e?void 0:e.origin){var r=c(c({},e.origin),{layout:c(c({},e.origin.layout),{rect:t})});this.updateMediaSource(Ce(r,{layout:{rect:this._getPluginMediaRect(r)}})),(null===(i=this.selectedSource)||void 0===i?void 0:i.id)===e.origin.id&&(this.selectedSource=this.sourceList.find((function(t){return t.id===e.origin.id})))}null===(o=this.eventEmitter)||void 0===o||o.emit("onSourceResized",e.origin,t)},t.prototype.onRightButtonClicked=function(e){var t;this.logger.debug("".concat(this.logPrefix,"onRightButtonClicked:"),e),null===(t=this.eventEmitter)||void 0===t||t.emit("onRightButtonClicked",e.origin)},t.prototype.isSameMediaSource=function(e,t){return e.id===t.id},t.prototype.isMediaSourceExisted=function(e){var t=this;return this.sourceList.some((function(i){return t.isSameMediaSource(i,e)}))},t.prototype.findMediaSourceIndex=function(e){return this.sourceList.findIndex((function(t){return t.id===e.id}))},t.prototype.unselectMediaSource=function(e){var t,i;return l(this,void 0,Promise,(function(){var o;return h(this,(function(r){return e?(-1!==(o=this.findMediaSourceIndex(e))&&(this.sourceList[o].isSelected=!1),null===(t=this.mediaMixingDesigner)||void 0===t||t.updateMedia({id:e.id,rect:null===(i=e.layout)||void 0===i?void 0:i.rect,isSelected:!1,origin:Se(e)}),[2]):[2]}))}))},t.mediaMixingManager=null,t}();!function(e){e.STARTED="started",e.STOPPED="stopped",e.ERROR="error",e.STALLED="stalled",e.RESUMED="resumed",e.UNDO_STATE_CHANGED="undo-state-changed",e.REDO_STATE_CHANGED="redo-state-changed"}(Xn||(Xn={}));var is=void 0,os=void 0,rs=void 0,ns=void 0,ss=void 0,as=void 0,cs=void 0,us=void 0,ls=["pen","rect","ellipse","arrow","laser","eraserObject"];function hs(e){var t,i={},o=e.tool;if(e.view_handle&&(i.view=e.view_handle),e.canvas&&(i.canvasInfo={},"number"==typeof e.canvas.width&&(i.canvasInfo.width=e.canvas.width),"number"==typeof e.canvas.height&&(i.canvasInfo.height=e.canvas.height)),(null==o?void 0:o.type)&&ls.includes(o.type)&&(i.tool={name:o.type}),o){var r=i.tool||{};o.color&&(r.color=o.color),"number"==typeof o.line_width&&(r.lineWidth=o.line_width),"laser"===o.type&&(r.laserFadeDuration="number"==typeof o.laserFadeDuration?o.laserFadeDuration:1e3),Object.keys(r).length>0&&(i.tool=r)}return"boolean"==typeof(null===(t=e.whiteboard)||void 0===t?void 0:t.interactive)&&(i.config={interactive:e.whiteboard.interactive}),i}var ds="Whiteboard",ps=[Xn.STARTED,Xn.STOPPED,Xn.ERROR,Xn.STALLED,Xn.RESUMED,Xn.UNDO_STATE_CHANGED,Xn.REDO_STATE_CHANGED],fs=function(){function e(t){if(this.logPrefix="[TRTCWhiteboardManager]",this.eventEmitter=new E,this.pluginEventHandlers=[],this.boundPlugin=null,this.started=!1,e.whiteboardManager)return e.whiteboardManager;e.whiteboardManager=this,this.logger=t.logger,this.trtc=t.trtc,this._bindPluginEvents()}return e.prototype.onRecvWhiteboardCommand=function(e){return l(this,void 0,Promise,(function(){return h(this,(function(t){switch(t.label){case 0:return this.log("onRecvWhiteboardCommand:",e),e&&"object"==typeof e?0!==Number(e.enable)?[3,2]:[4,this._stop()]:(this.logError("onRecvWhiteboardCommand: invalid command"),[2]);case 1:return t.sent(),[2];case 2:return e.owner_id?[4,this._applyRemoteCommand(e)]:[3,4];case 3:return t.sent(),[2];case 4:return this.started?[3,6]:[4,this._start(e)];case 5:return t.sent(),[3,8];case 6:return[4,this._update(e)];case 7:t.sent(),t.label=8;case 8:return e.op?[4,this._applyLocalOp(e.op)]:[3,10];case 9:t.sent(),t.label=10;case 10:return[2]}}))}))},e.prototype._start=function(e){return l(this,void 0,Promise,(function(){var t,i;return h(this,(function(o){switch(o.label){case 0:t=hs(e),o.label=1;case 1:return o.trys.push([1,3,,4]),this._bindPluginEvents(),[4,this.trtc.startPlugin(ds,t)];case 2:return o.sent(),this.started=!0,this.log("whiteboard started:",t),[3,4];case 3:throw i=o.sent(),this.logError("startPlugin Whiteboard error:",i),i;case 4:return[2]}}))}))},e.prototype._update=function(e){return l(this,void 0,Promise,(function(){var t,i;return h(this,(function(o){switch(o.label){case 0:if(t=hs(e),0===Object.keys(t).length)return[2];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,this.trtc.updatePlugin(ds,t)];case 2:return o.sent(),this.log("whiteboard updated:",t),[3,4];case 3:throw i=o.sent(),this.logError("updatePlugin Whiteboard error:",i),i;case 4:return[2]}}))}))},e.prototype._stop=function(){return l(this,void 0,Promise,(function(){var e;return h(this,(function(t){switch(t.label){case 0:if(!this.started)return[2];t.label=1;case 1:return t.trys.push([1,3,4,5]),[4,this.trtc.stopPlugin(ds)];case 2:return t.sent(),this.log("whiteboard stopped"),[3,5];case 3:return e=t.sent(),this.logError("stopPlugin Whiteboard error:",e),[3,5];case 4:return this.started=!1,this._resetPluginEventBinding(),[7];case 5:return[2]}}))}))},e.prototype._applyLocalOp=function(e){return l(this,void 0,Promise,(function(){var t,i;return h(this,(function(o){switch(o.label){case 0:if(t=function(e){switch(e){case"undo":return{operation:"undo"};case"redo":return{operation:"redo"};case"clearall":return{tool:{clearScope:"all"},operation:"clear"};default:return null}}(e),!t)return[2];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,this.trtc.updatePlugin(ds,t)];case 2:return o.sent(),this.log("whiteboard local op:",e,"-> options:",t),[3,4];case 3:return i=o.sent(),this.logError("updatePlugin Whiteboard op error:",i),[3,4];case 4:return[2]}}))}))},e.prototype._bindPluginEvents=function(){var e=this,t=this._getWhiteboardPlugin();t&&"function"==typeof t.on&&(this._offPluginEvents(),this.boundPlugin=t,ps.forEach((function(i){var o=function(){for(var t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];e._emitWhiteboardEvent(i,t)};t.on(i,o),e.pluginEventHandlers.push({event:i,handler:o})})))},e.prototype._offPluginEvents=function(){var e=this;this.boundPlugin&&0!==this.pluginEventHandlers.length?("function"==typeof this.boundPlugin.off&&this.pluginEventHandlers.forEach((function(t){var i=t.event,o=t.handler;e.boundPlugin.off(i,o)})),this._resetPluginEventBinding()):this._resetPluginEventBinding()},e.prototype._resetPluginEventBinding=function(){this.boundPlugin=null,this.pluginEventHandlers=[]},e.prototype._getWhiteboardPlugin=function(){var e,t,i;return(null===(i=null===(t=null===(e=this.trtc)||void 0===e?void 0:e._plugins)||void 0===t?void 0:t.get)||void 0===i?void 0:i.call(t,ds))||null},e.prototype._emitWhiteboardEvent=function(e,t){var i,o;void 0===t&&(t=[]),this.log.apply(this,p(["whiteboard event:",e],t,!1)),0!==t.length?null===(o=this.eventEmitter)||void 0===o||o.emit.apply(o,p([e],t,!1)):null===(i=this.eventEmitter)||void 0===i||i.emit(e)},e.prototype._applyRemoteCommand=function(e){return l(this,void 0,Promise,(function(){return h(this,(function(t){return this.log("remote whiteboard command handled by plugin internal sync, skip injection:",{ownerId:e.owner_id,strokeId:e.stroke_id,op:e.op}),[2]}))}))},e.prototype.on=function(e,t){var i;null===(i=this.eventEmitter)||void 0===i||i.on(e,t)},e.prototype.off=function(e,t){var i;null===(i=this.eventEmitter)||void 0===i||i.off(e,t)},e.prototype.destroy=function(){var t;return l(this,void 0,Promise,(function(){return h(this,(function(i){switch(i.label){case 0:return this.log("destroy"),[4,this._stop()];case 1:return i.sent(),this._offPluginEvents(),null===(t=this.eventEmitter)||void 0===t||t.removeAllListeners(),e.whiteboardManager=null,[2]}}))}))},e.prototype.log=function(){for(var e,t,i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];null===(t=null===(e=this.logger)||void 0===e?void 0:e.log)||void 0===t||t.call.apply(t,p([e,this.logPrefix],i,!1))},e.prototype.logError=function(){for(var e,t,i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];null===(t=null===(e=this.logger)||void 0===e?void 0:e.error)||void 0===t||t.call.apply(t,p([e,this.logPrefix],i,!1))},e.whiteboardManager=null,e}(),vs=function(){function e(){this.isRunning=!1,this.queue=[]}return Object.defineProperty(e.prototype,"length",{get:function(){return this.queue.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastQueueItem",{get:function(){return 0===this.length?null:this.queue[this.length-1]},enumerable:!1,configurable:!0}),e.prototype.push=function(e,t,i,o){var r,n;void 0===t&&(t=!1),void 0===i&&(i=!1);var s=c(c({},e),{functionName:o}),a=new Promise((function(e,t){s.resolve=e,s.reject=t}));if(s.promise=a,t)this.length<=1?this.queue.push(s):null===(n=null===(r=this.lastQueueItem)||void 0===r?void 0:r.promise)||void 0===n||n.then(s.resolve,s.reject);else{if(i&&o&&this.queue.length>1){var u=[];this.queue=this.queue.filter((function(e,t){return 0===t||(e.functionName!==o||(u.push(e),!1))})),u.forEach((function(e){e.reject(new Error("aborted by newer task"))}))}this.queue.push(s)}return this.isRunning||this.callNext(),a},e.prototype.shift=function(){return this.queue.shift()},e.prototype.callNext=function(){var e=this;if(!this.isRunning&&0!==this.length){var t=this.queue[0],i=t.fn,o=t.args,r=t.context,n=t.resolve,s=t.reject;this.isRunning=!0,i.apply(r,o).then(n,s).finally((function(){e.isRunning=!1,e.shift(),e.callNext()}))}},e}(),gs=new WeakMap,ms=new WeakMap,Ts=new WeakMap;function ys(e,t){return void 0===t&&(t={}),function(i,o,r){var n=r.value,s=t.deduplicate,a=void 0!==s&&s;return r.value=function(){for(var t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];var r=e.apply(void 0,t),s=Array.isArray(r)?r:[r],c=Ts.get(this)||new Map;Ts.set(this,c);for(var u=null,l=0,h=s;l<h.length;l++){var d=h[l],p=c.get(d);if(p){u=p;break}}for(var f=u||new vs,v=0,g=s;v<g.length;v++){d=g[v];c.set(d,f)}var m=a?o:void 0;return f.push({fn:n,args:t,context:this},!1,a,m)},r}}var _s=function(){function t(e){var t=this;this.logPrefix="[AITranscriberManager]",this.listeners=new Set,this.isPaused=!1,this.isMessageListenerRegistered=!1,this.handleMessageEvent=function(e){var i=t.createMessageFromEvent(e);t._notifyListeners("onReceiveTranscriberMessage",e.roomId,i)},this.handleStateEvent=function(e){var i=e.transcriberRobotId,o=e.state,r=e.roomId,n=e.sourceLanguage,s=void 0===n?"":n,a=e.error,c=e.errorMessage,u=void 0===c?"":c;if(r&&i){if("started"===o)t._notifyListeners("onRealtimeTranscriberStarted",r,i,s);else if("stopped"===o){t._notifyListeners("onRealtimeTranscriberStopped",r,i,0)}null!=a&&t._notifyListeners("onRealtimeTranscriberError",r,i,a,u)}},this.logger=e.logger,this.trtc=e.trtc,this.registerStateListener()}return t.prototype.registerStateListener=function(){this.trtc.on(e.EVENT.REALTIME_TRANSCRIBER_STATE_CHANGED,this.handleStateEvent)},t.prototype.createMessageFromEvent=function(e){var t,i,o,r;return{segmentId:null!==(t=null==e?void 0:e.segmentId)&&void 0!==t?t:"",speakerUserId:null!==(i=null==e?void 0:e.speakerUserId)&&void 0!==i?i:"",sourceText:null!==(o=null==e?void 0:e.sourceText)&&void 0!==o?o:"",translationTexts:(null==e?void 0:e.translationTexts)?new Map(Object.entries(e.translationTexts)):void 0,timestamp:null!==(r=null==e?void 0:e.timestamp)&&void 0!==r?r:Date.now(),isCompleted:Boolean(null==e?void 0:e.isCompleted)}},t.prototype.updateMessageSubscription=function(){var t=!this.isPaused&&this.listeners.size>0;if(t&&!this.isMessageListenerRegistered)return this.trtc.on(e.EVENT.REALTIME_TRANSCRIBER_MESSAGE,this.handleMessageEvent),void(this.isMessageListenerRegistered=!0);!t&&this.isMessageListenerRegistered&&(this.trtc.off(e.EVENT.REALTIME_TRANSCRIBER_MESSAGE,this.handleMessageEvent),this.isMessageListenerRegistered=!1)},t.prototype.log=function(){for(var e,t,i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];null===(t=null===(e=this.logger)||void 0===e?void 0:e.log)||void 0===t||t.call.apply(t,p([e,this.logPrefix],i,!1))},t.prototype.logError=function(){for(var e,t,i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];null===(t=null===(e=this.logger)||void 0===e?void 0:e.error)||void 0===t||t.call.apply(t,p([e,this.logPrefix],i,!1))},t.prototype._notifyListeners=function(e){for(var t=this,i=[],o=1;o<arguments.length;o++)i[o-1]=arguments[o];this.listeners.forEach((function(o){var r=o[e];if("function"==typeof r)try{r.apply(o,i)}catch(n){t.logError("Error notifying listener:",n)}}))},t.prototype.startRealtimeTranscriber=function(e){return l(this,void 0,Promise,(function(){var t,i,o;return h(this,(function(r){switch(r.label){case 0:if(this.log("startRealtimeTranscriber:",e),!(null==e?void 0:e.sourceLanguage))throw new Error("sourceLanguage is required");t={sourceLanguage:e.sourceLanguage},e.transcriberRobotId&&(t.transcriberRobotId=e.transcriberRobotId),void 0!==e.userIdsToTranscribe&&(t.userIdsToTranscribe=e.userIdsToTranscribe),void 0!==e.translationLanguages&&(t.translationLanguages=e.translationLanguages),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this.trtc.startPlugin("RealtimeTranscriber",t)];case 2:return i=r.sent(),this.log("startRealtimeTranscriber success, robotId:",i),[2,i];case 3:throw o=r.sent(),this.logError("startRealtimeTranscriber error:",o),o;case 4:return[2]}}))}))},t.prototype.stopRealtimeTranscriber=function(e){return l(this,void 0,Promise,(function(){var t;return h(this,(function(i){switch(i.label){case 0:if(this.log("stopRealtimeTranscriber:",e),!e)throw new Error("transcriberRobotId is required");i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this.trtc.stopPlugin("RealtimeTranscriber",{transcriberRobotId:e})];case 2:return i.sent(),this.log("stopRealtimeTranscriber success"),[3,4];case 3:throw t=i.sent(),this.logError("stopRealtimeTranscriber error:",t),t;case 4:return[2]}}))}))},t.prototype.pauseReceivingMessage=function(){this.isPaused||(this.log("pauseReceivingMessage"),this.isPaused=!0,this.updateMessageSubscription())},t.prototype.resumeReceivingMessage=function(){this.isPaused&&(this.log("resumeReceivingMessage"),this.isPaused=!1,this.updateMessageSubscription())},t.prototype.addListener=function(e){this.listeners.add(e),this.updateMessageSubscription()},t.prototype.removeListener=function(e){this.log("removeListener"),this.listeners.delete(e),this.updateMessageSubscription()},t.prototype.destroy=function(){this.log("destroy"),this.listeners.clear(),this.isPaused=!0,this.updateMessageSubscription(),this.trtc.off(e.EVENT.REALTIME_TRANSCRIBER_STATE_CHANGED,this.handleStateEvent)},t}(),Rs=void 0,bs=void 0,Cs=void 0,Ss=void 0,ws=e._loggerManager;ws.info("TRTCCloud Version: ".concat(Ln));var Es,Ms,As,Ps="trtcCloud",Is=1;navigator&&navigator.mediaDevices&&navigator.mediaDevices.addEventListener&&navigator.mediaDevices.addEventListener("devicechange",(Es=function(){0!==Ls.size&&Array.from(Ls.values()).forEach((function(e){e.fn()}))},Ms=30,function(){for(var e=this,t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];As>0&&clearTimeout(As),As=window.setTimeout((function(){Es.apply(e,t),As=-1}),Ms)}));var Ls=new Map,Vs=function(d){function f(i){void 0===i&&(i={});var o=d.call(this)||this;o._version="",o._frameWorkType=30,o._component=0,o._language=0,o._networkProxy={},o._localView=null,o._autoRecvAudio=!0,o._autoRecvVideo=!1,o._localTestView=null,o._isVideoPublish=!0,o._localRenderParams={rotation:I.TRTCVideoRotation0,fillMode:y.TRTCVideoFillMode_Fill,mirrorType:_.TRTCVideoMirrorType_Auto},o._encoderMirror=void 0,o._videoProfile={},o._isAudioPublish=!0,o._audioMuteType=!1,o._audioProfile=e.TYPE.AUDIO_PROFILE_STANDARD,o._captureVolume=100,o._playoutVolume=100,o._isSharingScreen=!1,o._remoteStreamConfig=new Map,o._remoteStreamMap=new Map,o._cameraList=[],o._microphoneList=[],o._speakerList=[],o._currentCamera={},o._currentMicrophone={},o._currentSpeaker={},o._currentCameraId="",o._currentMicrophoneId="",o._currentSpeakerId="",o._screenShareParams={option:{}},o._isMobile=jr,o._isFrontCamera=!0,o._cameraVideoTrack=null,o._smallStreamVideoProfile=void 0,o._qosPreference=void 0,o._defaultVideoProfile={width:640,height:480,frameRate:15,bitrate:900},o._defaultScreenProfile={width:1920,height:1080,frameRate:15,bitrate:1500},o._defaultSmallVideoProfile={width:160,height:120,frameRate:15,bitrate:200},o._isVirtualBackground=!1,o._isTestVirtualBackground=!1,o._isBeautyEnabled=!1,o._isTestBeautyEnabled=!1,o._currentAudioQuality=S.TRTCAudioQualityDefault,o._lastAudioScene=w.default,o._isAIDenoiserEnabled=!1,o._currentAIDenoiserMode=void 0,o._pendingAIDenoiserApply=!1,o._remoteStatisticsUserIdList=[],o._hasJoinedRoom=!1,o._isExitingRoom=!1,o._version=Ln;var a=i.frameWorkType,c=void 0===a?30:a,u=i.component,l=void 0===u?0:u,h=i.language,p=void 0===h?0:h;return o._frameWorkType=c,o._component=l,o._language=p,o._trtc=e.create({enableSEI:f.enableSEI,assetsPath:f.assetsPath,enableVolumeControlInIOS:!0,plugins:[n,t,r,s]}),o._testTrtc=e.create(),o._log=e._loggerManager,o.logger=new zn(ws,{seq:Is++}),o._echoCancellation=void 0,o._noiseSuppression=void 0,o._autoGainControl=void 0,o._addTRTCEvents(),o.handleDeviceChange=o.handleDeviceChange.bind(o),Ls.set(o,{fn:o.handleDeviceChange,self:o}),o}var v;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=e}a(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}(f,d),f.getPlugin=function(e){return"VirtualBackground"===e?i:"BasicBeauty"===e?o:"VideoMixer"===e?n:"Whiteboard"===e?s:null},f.getTRTCShareInstance=function(e){return f.shareInstance||(f.shareInstance=new f(e)),f.shareInstance},f.setLogLevel=function(t,i){var o,r=((o={})[j.TRTCLogLevelVerbose]=0,o[j.TRTCLogLevelDebug]=1,o[j.TRTCLogLevelInfo]=2,o[j.TRTCLogLevelWarn]=3,o[j.TRTCLogLevelError]=4,o[j.TRTCLogLevelFatal]=4,o[j.TRTCLogLevelNone]=5,o),n=r[t];Te(n)&&(n=r[j.TRTCLogLevelInfo]);var s=!_e(i)||i;e.setLogLevel(n,s)},f.destroyTRTCShareInstance=function(){f.shareInstance&&(f.shareInstance._destroy(),f.shareInstance=null),Array.from(f.subCloudMap.keys()).forEach((function(e){return e._destroy()}))},f.callExperimentalAPI=function(e){console.log("static ".concat(Ps,".callExperimentalAPI"),e);var t=Re(e);if(t!==e){var i=t.api,o=t.params;if(i&&o)try{switch(i){case"enableSEI":f.enableSEI=o.enable;break;case"setAssetsPath":f.assetsPath=o.assetsPath}}catch(r){throw r}}},f.prototype.createSubCloud=function(){if(this!==f.shareInstance)return null;var e=new f;return this._inheritPropertiesToSubCloud(e),this._inheritEventsToSubCloud(e),f.subCloudMap.set(e,e),e},f.prototype.destroy=function(){this!==f.shareInstance?(f.subCloudMap.get(this)&&f.subCloudMap.delete(this),this._destroy()):f.destroyTRTCShareInstance()},f.prototype._destroy=function(){Ls.delete(this),this.removeAllListeners(),this._trtc.off("*"),this._trtc.destroy(),this._trtc=null,this._testTrtc.off("*"),this._testTrtc.destroy(),this._testTrtc=null},f.prototype.getSDKVersion=function(){return this._version||""},f.prototype.enterRoom=function(e,t){return l(this,void 0,Promise,(function(){var i,o,r,n,s,a,u,l,d,p,f,v,g,m,T,y,_,R,b=this;return h(this,(function(h){switch(h.label){case 0:if(i=e.sdkAppId,o=e.userId,r=e.userSig,n=e.roomId,s=e.strRoomId,a=e.role,u=e.privateMapKey,l=e.businessInfo,d=e.enableAutoPlayDialog,p=e.proxy,f=e.streamId,v=e.userDefineRecordId,this.logger.update({sdkAppId:i,userId:o}),this.logger.info("".concat(Ps,".enterRoom with params: "),e,t),p&&(this._networkProxy=p),!(i&&o&&r))return[3,5];h.label=1;case 1:return h.trys.push([1,3,,4]),g={sdkAppId:i,userId:o,userSig:r,roomId:n,strRoomId:s,role:fe[a],scene:ve[t],autoReceiveAudio:this._autoRecvAudio,autoReceiveVideo:this._autoRecvVideo,frameWorkType:this._frameWorkType,component:this._component,language:this._language},g=u?c(c({},g),{privateMapKey:u}):g,g=l?c(c({},g),{businessInfo:l}):g,m=d||this._enableAutoPlayDialog,g=_e(m)?c(c({},g),{enableAutoPlayDialog:m}):g,g=this._networkProxy?c(c({},g),{proxy:this._networkProxy}):g,g=f?c(c({},g),{streamId:f}):g,g=v?c(c({},g),{userDefineRecordId:v}):g,g=void 0!==this._latencyLevel?c(c({},g),{latencyLevel:this._latencyLevel}):g,T=me(),[4,this._trtc.enterRoom(g)];case 2:return h.sent(),this._hasJoinedRoom=!0,this._sdkAppId=i,this._userId=o,this._userSig=r,this._pendingAIDenoiserApply&&(this._pendingAIDenoiserApply=!1,this._applyAIDenoiserDecision().catch((function(e){b.logger.warn("".concat(Ps,".enterRoom flush AI denoiser decision fail: "),e)}))),y=me()-T,this.emit("onEnterRoom",y),[3,4];case 3:throw _=h.sent(),R=(R=this._transformTRTCErrorCode(_,"enterRoom"))<0?R:-1,this.emit("onEnterRoom",R),this._callFunctionErrorManage(_,"enterRoom"),_;case 4:return[3,6];case 5:this._emitError(Pn),h.label=6;case 6:return[2]}}))}))},f.prototype.exitRoom=function(){return l(this,void 0,Promise,(function(){var e;return h(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),this.logger.info("".concat(Ps,".exitRoom")),this._isExitingRoom=!0,this._isSharingScreen&&this.stopScreenShare(),this.resetTRTCCloud(),this.stopLocalPreview(),this.stopLocalAudio(),[4,this._trtc.exitRoom()];case 1:return t.sent(),this._hasJoinedRoom=!1,this._isExitingRoom=!1,this._isVideoPublish=!0,this._isAudioPublish=!0,this.emit("onExitRoom",hn.exitRoom),[3,3];case 2:throw e=t.sent(),this._callFunctionErrorManage(e,"exitRoom"),e;case 3:return[2]}}))}))},f.prototype.switchRole=function(e){return l(this,void 0,void 0,(function(){var t;return h(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(Ps,".switchRole with param: "),e),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this._trtc.switchRole(fe[e])];case 2:return i.sent(),this.emit("onSwitchRole",0,"switch role success, role = ".concat(e,", ").concat(fe[e])),[3,4];case 3:throw t=i.sent(),this.emit("onSwitchRole",null==t?void 0:t.getCode(),t.message),t;case 4:return[2]}}))}))},f.prototype.setDefaultStreamRecvMode=function(e,t){return l(this,void 0,void 0,(function(){return h(this,(function(i){return this.logger.info("".concat(Ps,".setDefaultStreamRecvMode with param: "),{autoRecvAudio:e,autoRecvVideo:t}),_e(e)&&(this._autoRecvAudio=e),_e(t)&&(this._autoRecvVideo=t),[2]}))}))},f.prototype.resetTRTCCloud=function(){if(this._setIsAudioPublish(!0),this._setAudioMuteType(!1),this._echoCancellation=void 0,this._noiseSuppression=void 0,this._autoGainControl=void 0,this._isVirtualBackground=!1,this._isTestVirtualBackground=!1,this._remoteStatisticsUserIdList=[],this._resetBeautyStyle(),this._sdkAppId=void 0,this._userId=void 0,this._userSig=void 0,this._currentAudioQuality=S.TRTCAudioQualityDefault,this._lastAudioScene=w.default,this._isAIDenoiserEnabled&&this._trtc)try{this._trtc.stopPlugin(he)}catch(e){this.logger.warn("".concat(Ps,".resetTRTCCloud stop AI denoiser fail: "),e)}this._isAIDenoiserEnabled=!1,this._currentAIDenoiserMode=void 0,this._pendingAIDenoiserApply=!1},f.prototype._updateLocalVideo=function(){return l(this,void 0,void 0,(function(){var t;return h(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this._trtc.updateLocalVideo(this._generateLocalVideoData())];case 1:return i.sent(),[3,3];case 2:if((t=i.sent()).code!==e.ERROR_CODE.OPERATION_ABORT)throw t;return[3,3];case 3:return[2]}}))}))},f.prototype._updateLocalTestVideo=function(){return l(this,void 0,void 0,(function(){var t;return h(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this._testTrtc.updateLocalVideo(this._generateLocalTestVideoData())];case 1:return i.sent(),[3,3];case 2:if((t=i.sent()).code!==e.ERROR_CODE.OPERATION_ABORT)throw t;return[3,3];case 3:return[2]}}))}))},f.prototype._updateLocalScreen=function(){return l(this,void 0,void 0,(function(){var t;return h(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this._trtc.updateScreenShare(this._getScreenShareParams())];case 1:return i.sent(),[3,3];case 2:if((t=i.sent()).code!==e.ERROR_CODE.OPERATION_ABORT)throw t;return[3,3];case 3:return[2]}}))}))},f.prototype._updateRemoteVideo=function(t,i){return l(this,void 0,void 0,(function(){var o;return h(this,(function(r){switch(r.label){case 0:if(!this._hasJoinedRoom||this._isExitingRoom)return[2];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this._trtc.updateRemoteVideo(this._generateRemoteVideoData(t,i))];case 2:return r.sent(),[3,4];case 3:if((o=r.sent()).code!==e.ERROR_CODE.OPERATION_ABORT)throw o;return[3,4];case 4:return[2]}}))}))},f.prototype.startLocalPreview=function(){for(var t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];return l(this,void 0,Promise,(function(){var i,o,r,n,s;return h(this,(function(a){switch(a.label){case 0:this.logger.info("".concat(Ps,".startLocalPreview with params: "),t),1===p([],t,!0).length?o=p([],t,!0)[0]:2===p([],t,!0).length&&(s=p([],t,!0),i=s[0],o=s[1]),Te(i)||(this._setIsMobile(!0),this._setIsFrontCamera(i)),this._setLocalView(o),a.label=1;case 1:a.trys.push([1,9,,10]),a.label=2;case 2:return a.trys.push([2,4,,8]),[4,this._trtc.startLocalVideo(this._generateLocalVideoData())];case 3:return a.sent(),[3,8];case 4:return(r=a.sent()).code!==e.ERROR_CODE.OPERATION_ABORT?[3,6]:[4,this._updateLocalVideo()];case 5:return a.sent(),[3,7];case 6:throw r;case 7:return[3,8];case 8:return this.emit("onCameraDidReady"),[3,10];case 9:throw n=a.sent(),this._callFunctionErrorManage(n,"startLocalPreview"),n;case 10:return[2]}}))}))},f.prototype.updateLocalView=function(e){return l(this,void 0,void 0,(function(){return h(this,(function(t){switch(t.label){case 0:return this.logger.info("".concat(Ps,".updateLocalView with param: "),e),this._setLocalView(e),[4,this._updateLocalVideo()];case 1:return t.sent(),[2]}}))}))},f.prototype.stopLocalPreview=function(){return l(this,void 0,void 0,(function(){var e;return h(this,(function(t){switch(t.label){case 0:this.logger.info("".concat(Ps,".stopLocalPreview")),t.label=1;case 1:return t.trys.push([1,3,,4]),this._setLocalView(null),[4,this._trtc.stopLocalVideo()];case 2:return t.sent(),this.emit("onCameraStopped"),[3,4];case 3:throw e=t.sent(),console.warn("".concat(Ps," stopLocalPreview error: ").concat(e)),this._callFunctionErrorManage(e,"stopLocalPreview"),e;case 4:return[2]}}))}))},f.prototype.muteLocalVideo=function(e){return void 0===e&&(e=!1),l(this,void 0,void 0,(function(){var t;return h(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(Ps,".muteLocalVideo with params: "),e),i.label=1;case 1:return i.trys.push([1,3,,4]),this._setIsVideoPublish(!e),[4,this._updateLocalVideo()];case 2:return i.sent(),[3,4];case 3:throw t=i.sent(),this._callFunctionErrorManage(t,"muteLocalVideo"),t;case 4:return[2]}}))}))},f.prototype.startRemoteView=function(t,i,o){return l(this,void 0,void 0,(function(){var r,n;return h(this,(function(s){switch(s.label){case 0:this.logger.info("".concat(Ps,".startRemoteView with params: "),t,i,o),s.label=1;case 1:if(s.trys.push([1,9,,10]),this._setRemoteStreamConfig(t,o,{view:i,small:o===T.TRTCVideoStreamTypeSmall}),!this._remoteStreamMap.get("".concat(t,"_").concat(this._getTRTCStreamType(o))))return[2];s.label=2;case 2:return s.trys.push([2,4,,8]),[4,this._trtc.startRemoteVideo(this._generateRemoteVideoData(t,o))];case 3:return s.sent(),[3,8];case 4:return(r=s.sent()).code!==e.ERROR_CODE.OPERATION_ABORT?[3,6]:[4,this._updateRemoteVideo(t,o)];case 5:return s.sent(),[3,7];case 6:throw r;case 7:return[3,8];case 8:return[3,10];case 9:throw n=s.sent(),this._callFunctionErrorManage(n,"startRemoteView"),n;case 10:return[2]}}))}))},f.prototype.updateRemoteView=function(e,t,i){return l(this,void 0,void 0,(function(){return h(this,(function(o){switch(o.label){case 0:return this.logger.info("".concat(Ps,".updateRemoteView with params: "),e,t,i),this._setRemoteStreamConfig(e,i,{view:t}),this._remoteStreamMap.get("".concat(e,"_").concat(this._getTRTCStreamType(i)))?[4,this._updateRemoteVideo(e,i)]:[2];case 1:return o.sent(),[2]}}))}))},f.prototype.stopRemoteView=function(e,t){return l(this,void 0,void 0,(function(){var i;return h(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(Ps,".stopRemoteView with params: "),e,t),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,this._trtc.stopRemoteVideo({userId:e,streamType:this._getTRTCStreamType(t)})];case 2:return o.sent(),[3,4];case 3:throw i=o.sent(),this._callFunctionErrorManage(i,"stopRemoteView"),i;case 4:return[2]}}))}))},f.prototype.stopAllRemoteView=function(){return l(this,void 0,void 0,(function(){var e;return h(this,(function(t){switch(t.label){case 0:this.logger.info("".concat(Ps,".stopAllRemoteView")),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this._trtc.stopRemoteVideo({userId:"*"})];case 2:return t.sent(),[3,4];case 3:throw e=t.sent(),this._callFunctionErrorManage(e,"stopAllRemoteView"),e;case 4:return[2]}}))}))},f.prototype.setVideoEncoderParam=function(e){return l(this,void 0,void 0,(function(){var t,i;return h(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(Ps,".setVideoEncoderParam with params: "),e),o.label=1;case 1:return o.trys.push([1,4,,5]),t=this._getTRTCVideoProfile(T.TRTCVideoStreamTypeBig,e),this._setVideoProfile(t),[4,this._updateLocalVideo()];case 2:return o.sent(),[4,this._updateLocalTestVideo()];case 3:return o.sent(),[3,5];case 4:throw i=o.sent(),this._callFunctionErrorManage(i,"setVideoEncoderParam"),i;case 5:return[2]}}))}))},f.prototype.setNetworkQosParam=function(e){return l(this,void 0,void 0,(function(){var t,i,o=this;return h(this,(function(r){return this.logger.info("".concat(Ps,".setNetworkQosParam with params: "),e),t=e.preference,i=this._getTRTCQosPreference(t),this._setQosPreference(i),this._setScreenShareParams({qosPreference:i}),[2,new Promise((function(e,t){Promise.all([o._updateLocalVideo(),o._updateLocalScreen()]).then((function(){e(!0)})).catch((function(e){o._callFunctionErrorManage(e,"setNetworkQosParam"),t(e)}))}))]}))}))},f.prototype.setLocalRenderParams=function(e){return l(this,void 0,void 0,(function(){var t;return h(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(Ps,".setLocalRenderParams with params: "),e),Object.assign(this._localRenderParams,e),i.label=1;case 1:return i.trys.push([1,4,,5]),[4,this._updateLocalVideo()];case 2:return i.sent(),[4,this._updateLocalTestVideo()];case 3:return i.sent(),[3,5];case 4:throw t=i.sent(),this._callFunctionErrorManage(t,"setLocalRenderParams"),t;case 5:return[2]}}))}))},f.prototype.setVideoEncoderMirror=function(e){return l(this,void 0,void 0,(function(){var t;return h(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(Ps,".setVideoEncoderMirror with params: "),e),this._encoderMirror=e,i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this._updateLocalVideo()];case 2:return i.sent(),[3,4];case 3:throw t=i.sent(),this._callFunctionErrorManage(t,"setVideoEncoderMirror"),t;case 4:return[2]}}))}))},f.prototype.setRemoteRenderParams=function(e,t,i){return l(this,void 0,void 0,(function(){var o;return h(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(Ps,".setRemoteRenderParams with params: "),e,t,i),r.label=1;case 1:return r.trys.push([1,3,,4]),this._setRemoteStreamConfig(e,t,i),[4,this._updateRemoteVideo(e,t)];case 2:return r.sent(),[3,4];case 3:throw o=r.sent(),this._callFunctionErrorManage(o,"setRemoteRenderParams"),o;case 4:return[2]}}))}))},f.prototype._updateLocalAudio=function(){return l(this,void 0,void 0,(function(){var t;return h(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this._trtc.updateLocalAudio(this._generateLocalAudioData())];case 1:return i.sent(),[3,3];case 2:if((t=i.sent()).code!==e.ERROR_CODE.OPERATION_ABORT)throw t;return[3,3];case 3:return[2]}}))}))},f.prototype._updateLocalTestAudio=function(){return l(this,void 0,void 0,(function(){var t;return h(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this._testTrtc.updateLocalAudio(this._generateLocalTestAudioData())];case 1:return i.sent(),[3,3];case 2:if((t=i.sent()).code!==e.ERROR_CODE.OPERATION_ABORT)throw t;return[3,3];case 3:return[2]}}))}))},f.prototype.startLocalAudio=function(t){return void 0===t&&(t=S.TRTCAudioQualityDefault),l(this,void 0,void 0,(function(){var i,o,r;return h(this,(function(n){switch(n.label){case 0:t===S.TRTCAudioQualitySpeech?this.logger.warn("Web trtcCloud not support audioQuality of TRTCAudioQualitySpeech, and will use TRTCAudioQualityDefault"):this.logger.info("".concat(Ps,".startLocalAudio with params: "),t),this._currentAudioQuality=t,i=this._getTRTCAudioQuality(t),n.label=1;case 1:n.trys.push([1,11,,12]),this._setAudioProfile(i),n.label=2;case 2:return n.trys.push([2,4,,8]),[4,this._trtc.startLocalAudio(this._generateLocalAudioData())];case 3:return n.sent(),[3,8];case 4:return(o=n.sent()).code!==e.ERROR_CODE.OPERATION_ABORT?[3,6]:[4,this._updateLocalAudio()];case 5:return n.sent(),[3,7];case 6:throw o;case 7:return[3,8];case 8:return this.emit("onMicDidReady"),this._lastAudioScene===w.default?[3,10]:[4,this._applyAIDenoiserDecision()];case 9:n.sent(),n.label=10;case 10:return[3,12];case 11:throw r=n.sent(),console.warn("".concat(Ps," startLocalAudio error: ").concat(r)),this._callFunctionErrorManage(r,"startLocalAudio"),r;case 12:return[2]}}))}))},f.prototype.stopLocalAudio=function(){return l(this,void 0,void 0,(function(){var e;return h(this,(function(t){switch(t.label){case 0:this.logger.info("".concat(Ps,".stopLocalAudio")),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this._trtc.stopLocalAudio()];case 2:return t.sent(),[3,4];case 3:throw e=t.sent(),this._callFunctionErrorManage(e,"stopLocalAudio"),e;case 4:return[2]}}))}))},f.prototype.muteLocalAudio=function(e){return void 0===e&&(e=!1),l(this,void 0,void 0,(function(){var t;return h(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(Ps,".muteLocalAudio with params: "),e),i.label=1;case 1:return i.trys.push([1,3,,4]),this._setAudioMuteType(!!e&&"microphone"),[4,this._updateLocalAudio()];case 2:return i.sent(),[3,4];case 3:throw t=i.sent(),this._callFunctionErrorManage(t,"muteLocalAudio"),t;case 4:return[2]}}))}))},f.prototype.setAudioCaptureVolume=function(e){return l(this,void 0,void 0,(function(){var t;return h(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(Ps,".setAudioCaptureVolume with params: "),e),i.label=1;case 1:return i.trys.push([1,3,,4]),this._setCaptureVolume(e),[4,this._updateLocalAudio()];case 2:return i.sent(),[3,4];case 3:throw t=i.sent(),this._callFunctionErrorManage(t,"setAudioCaptureVolume"),t;case 4:return[2]}}))}))},f.prototype.getAudioCaptureVolume=function(){return this.logger.info("".concat(Ps,".getAudioCaptureVolume")),this._getCaptureVolume()},f.prototype.setAudioPlayoutVolume=function(e){return l(this,void 0,void 0,(function(){var t;return h(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(Ps,".setAudioPlayoutVolume with params: "),e),i.label=1;case 1:return i.trys.push([1,3,,4]),this._playoutVolume=e,[4,this._trtc.setRemoteAudioVolume("*",e)];case 2:return i.sent(),[3,4];case 3:throw t=i.sent(),this._callFunctionErrorManage(t,"setAudioPlayoutVolume"),t;case 4:return[2]}}))}))},f.prototype.getAudioPlayoutVolume=function(){return this.logger.info("".concat(Ps,".getAudioPlayoutVolume")),this._playoutVolume},f.prototype.muteRemoteAudio=function(e,t){return void 0===t&&(t=!1),l(this,void 0,void 0,(function(){var i;return h(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(Ps,".muteRemoteAudio with params: "),e,t),o.label=1;case 1:return o.trys.push([1,3,,4]),e?[4,this._trtc.muteRemoteAudio(e,t)]:(this._emitError(Pn),[2]);case 2:return o.sent(),[3,4];case 3:throw i=o.sent(),this._callFunctionErrorManage(i,"muteRemoteAudio"),i;case 4:return[2]}}))}))},f.prototype.muteAllRemoteAudio=function(e){this.logger.info("".concat(Ps,".muteAllRemoteAudio with params: "),e);try{this._trtc.muteRemoteAudio("*",e)}catch(t){throw this._callFunctionErrorManage(t,"muteAllRemoteAudio"),t}},f.prototype.muteRemoteVideoStream=function(e,t,i){return l(this,void 0,void 0,(function(){var o;return h(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(Ps,".muteRemoteVideoStream with params: "),e,t,i),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this._trtc.updateRemoteVideo({userId:e,mute:t,streamType:this._getTRTCStreamType(i)})];case 2:return r.sent(),[3,4];case 3:throw o=r.sent(),this._callFunctionErrorManage(o,"muteRemoteVideoStream"),o;case 4:return[2]}}))}))},f.prototype.muteAllRemoteVideoStreams=function(e){return l(this,void 0,void 0,(function(){var t;return h(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(Ps,".muteAllRemoteVideoStreams with params: "),e),i.label=1;case 1:return i.trys.push([1,6,,7]),e?[4,this._trtc.callExperimentalAPI("pauseRemotePlayer",{userId:"*"})]:[3,3];case 2:return i.sent(),[3,5];case 3:return[4,this._trtc.callExperimentalAPI("resumeRemotePlayer",{userId:"*"})];case 4:i.sent(),i.label=5;case 5:return[3,7];case 6:throw t=i.sent(),this._callFunctionErrorManage(t,"muteAllRemoteVideoStreams"),t;case 7:return[2]}}))}))},f.prototype.setRemoteAudioVolume=function(e,t){this.logger.info("".concat(Ps,".setRemoteAudioVolume with params: "),e,t);try{this._trtc.setRemoteAudioVolume(e,t)}catch(i){throw this._callFunctionErrorManage(i,"setRemoteAudioVolume"),i}},f.prototype.enableAudioVolumeEvaluation=function(e){this.logger.info("".concat(Ps,".enableAudioVolumeEvaluation with params: "),e);try{this._trtc.enableAudioVolumeEvaluation(e)}catch(t){throw this._callFunctionErrorManage(t,"enableAudioVolumeEvaluation"),t}},f.prototype.enableSmallVideoStream=function(e,t){return l(this,void 0,Promise,(function(){var i;return h(this,(function(o){switch(o.label){case 0:return this.logger.info("".concat(Ps,".enableSmallVideoStream with params: "),e,t),e?(i=this._getTRTCVideoProfile(T.TRTCVideoStreamTypeSmall,t),this._setSmallStreamVideoProfile(i)):this._setSmallStreamVideoProfile(void 0),[4,this._updateLocalVideo()];case 1:return o.sent(),[2]}}))}))},f.prototype.snapshotVideo=function(e,t){var i="";return i=""===e&&t===T.TRTCVideoStreamTypeBig?this._trtc.getVideoSnapshot():""===e&&t===T.TRTCVideoStreamTypeSub?this._trtc.getVideoSnapshot({streamType:this._getTRTCStreamType(t)}):this._trtc.getVideoSnapshot({userId:e,streamType:this._getTRTCStreamType(t)}),this.emit("onSnapshotComplete",e,t,i),i},f.prototype.startScreenShare=function(t,i,o){return l(this,void 0,void 0,(function(){var r,n,s,a,c,u;return h(this,(function(l){switch(l.label){case 0:this.logger.info("".concat(Ps,".startScreenShare with params: "),t,i,o),l.label=1;case 1:return l.trys.push([1,3,,4]),n=(r=o||{}).screenAudio,s=void 0!==n&&n,a=r.videoTrack,c=this._getTRTCVideoProfile(T.TRTCVideoStreamTypeSub,o),this._setScreenShareParams({view:t,profile:c,systemAudio:s,videoTrack:a,streamType:i}),[4,this._trtc.startScreenShare(this._getScreenShareParams())];case 2:return l.sent(),this._isSharingScreen=!0,this.emit("onScreenCaptureStarted"),[3,4];case 3:if(u=l.sent(),this._callFunctionErrorManage(u,"startScreenShare"),u.code!==e.ERROR_CODE.OPERATION_ABORT)throw console.error("Start share screen error:",u,u.code,u.name,u.message),u;return[3,4];case 4:return[2]}}))}))},f.prototype.setSubStreamEncoderParam=function(e){return l(this,void 0,void 0,(function(){var t,i;return h(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(Ps,".setSubStreamEncoderParam with params: "),e),t=this._getTRTCVideoProfile(T.TRTCVideoStreamTypeSub,e),this._setScreenShareParams({profile:t}),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,this._updateLocalScreen()];case 2:return o.sent(),[3,4];case 3:throw i=o.sent(),this._callFunctionErrorManage(i,"setSubStreamEncoderParam"),i;case 4:return[2]}}))}))},f.prototype.stopScreenShare=function(){return l(this,void 0,Promise,(function(){var e;return h(this,(function(t){switch(t.label){case 0:this.logger.info("".concat(Ps,".stopScreenShare")),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this._trtc.stopScreenShare()];case 2:return t.sent(),this._clearScreenShareParams(),this._isSharingScreen=!1,this.emit("onScreenCaptureStopped",0),[3,4];case 3:throw e=t.sent(),this._callFunctionErrorManage(e,"stopScreenShare"),e;case 4:return[2]}}))}))},f.prototype._startPublishVideoTrack=function(t){var i=t.videoTrack,o=t.streamType,r=void 0===o?T.TRTCVideoStreamTypeBig:o;return l(this,void 0,void 0,(function(){var t,o,n,s;return h(this,(function(a){switch(a.label){case 0:if(r!==T.TRTCVideoStreamTypeSub)return[3,10];a.label=1;case 1:a.trys.push([1,8,,9]),a.label=2;case 2:return a.trys.push([2,4,,7]),[4,this._trtc.startScreenShare({publish:!0,streamType:e.TYPE.STREAM_TYPE_SUB,option:{videoTrack:i}})];case 3:return a.sent(),[3,7];case 4:return(t=a.sent()).code!==e.ERROR_CODE.OPERATION_ABORT?[3,6]:[4,this._trtc.updateScreenShare({publish:!0,option:{videoTrack:i}})];case 5:a.sent(),a.label=6;case 6:throw t;case 7:return[3,9];case 8:return o=a.sent(),this._callFunctionErrorManage(o,"startPublishVideoTrack"),[3,9];case 9:return[2];case 10:a.trys.push([10,17,,18]),a.label=11;case 11:return a.trys.push([11,13,,16]),[4,this._trtc.startLocalVideo({option:{videoTrack:i,profile:this._getVideoProfile()},forcePublish:!0})];case 12:return a.sent(),[3,16];case 13:return(n=a.sent()).code!==e.ERROR_CODE.OPERATION_ABORT?[3,15]:[4,this._trtc.updateLocalVideo({option:{videoTrack:i,profile:this._getVideoProfile()},forcePublish:!0})];case 14:a.sent(),a.label=15;case 15:throw n;case 16:return[3,18];case 17:return s=a.sent(),this._callFunctionErrorManage(s,"startPublishVideoTrack"),[3,18];case 18:return[2]}}))}))},f.prototype._stopPublishVideoTrack=function(e){var t=(void 0===e?{}:e).streamType,i=void 0===t?T.TRTCVideoStreamTypeBig:t;return l(this,void 0,void 0,(function(){return h(this,(function(e){switch(e.label){case 0:return i!==T.TRTCVideoStreamTypeSub?[3,2]:[4,this._trtc.stopScreenShare()];case 1:case 3:return e.sent(),[2];case 2:return this._cameraVideoTrack=null,[4,this._trtc.stopLocalVideo()]}}))}))},f.prototype.startScreenCapture=function(){this._emitError(In)},f.prototype.pauseScreenCapture=function(){this._emitError(In)},f.prototype.resumeScreenCapture=function(){this._emitError(In)},f.prototype.getScreenCaptureSources=function(){this._emitError(In)},f.prototype.selectScreenCaptureTarget=function(){this._emitError(In)},f.prototype.getCameraDevicesList=function(){return l(this,void 0,Promise,(function(){var t,i,o;return h(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(Ps,".getCameraDevicesList")),r.label=1;case 1:return r.trys.push([1,5,,6]),[4,e.getCameraList()];case 2:return t=r.sent(),i=t.map((function(e){return c(c({},e),{deviceName:e.label})})),this._cameraList=t,"{}"!==JSON.stringify(this._currentCamera)?[3,4]:(this._currentCamera=this.getDefaultDeviceInfo(t),this._currentCameraId=this._currentCamera.deviceId,[4,this.setCurrentCameraDevice(this._currentCameraId)]);case 3:r.sent(),r.label=4;case 4:return[2,Promise.resolve(i)];case 5:return o=r.sent(),this._callFunctionErrorManage(o,"getCameraDevicesList"),[2,Promise.resolve([])];case 6:return[2]}}))}))},f.prototype.setCurrentCameraDevice=function(e){var t;return l(this,void 0,Promise,(function(){var i;return h(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(Ps,".setCurrentCameraDevice with params: "),{cameraId:e}),o.label=1;case 1:return o.trys.push([1,4,,5]),e?(this._currentCameraId=e,[4,this._updateLocalVideo()]):[2,!1];case 2:return o.sent(),[4,this._updateLocalTestVideo()];case 3:return o.sent(),this._currentCamera=this._cameraList.find((function(t){return t.deviceId===e}))||{},[3,5];case 4:throw i=o.sent(),this._currentCameraId=null===(t=this._currentCamera)||void 0===t?void 0:t.cameraId,this._callFunctionErrorManage(i,"setCurrentCameraDevice"),i;case 5:return[2]}}))}))},f.prototype.getCurrentCameraDevice=function(){this.logger.info("".concat(Ps,".getCurrentCameraDevice"));var e=this._currentCamera,t=e.deviceId,i=e.label,o=e.kind,r=e.groupId;return new P(t,i,o,i,r)},f.prototype.isFrontCamera=function(){return this._getIsFrontCamera()},f.prototype.switchCamera=function(e){return l(this,void 0,void 0,(function(){return h(this,(function(t){switch(t.label){case 0:return this.logger.info("".concat(Ps,".switchCamera with params: "),e),this._setIsFrontCamera(e),[4,this._updateLocalVideo()];case 1:return t.sent(),[4,this._updateLocalTestVideo()];case 2:return t.sent(),[2]}}))}))},f.prototype._onVirtualBackgroundError=function(e){this._emitError({code:-1006,message:e.message?e.message:"virtual background error"})},f.prototype.setVirtualBackground=function(e){return l(this,void 0,void 0,(function(){var t,i,o,r,n;return h(this,(function(s){switch(s.label){case 0:return s.trys.push([0,10,,11]),t=e.enable,i=e.type,o=e.blurLevel,r=e.imagePath,t?this._isVirtualBackground?i!==de?[3,2]:[4,this._trtc.updatePlugin(ue,{type:i,blurLevel:o})]:[3,5]:[3,8];case 1:s.sent(),s.label=2;case 2:return i!==pe?[3,4]:[4,this._trtc.updatePlugin(ue,{type:i,src:r})];case 3:s.sent(),s.label=4;case 4:return[3,7];case 5:return[4,this._trtc.startPlugin(ue,c(c({},e),{src:r,onAbort:this._onVirtualBackgroundError.bind(this)}))];case 6:s.sent(),this._isVirtualBackground=!0,s.label=7;case 7:return[3,9];case 8:this._trtc.stopPlugin(ue),this._isVirtualBackground=!1,s.label=9;case 9:return[3,11];case 10:throw n=s.sent(),this.logger.error("".concat(Ps,".setVirtualBackground fail: "),n),n;case 11:return[2]}}))}))},f.prototype.setTestVirtualBackground=function(e){return l(this,void 0,void 0,(function(){var t,i,o,r,n;return h(this,(function(s){switch(s.label){case 0:return s.trys.push([0,10,,11]),t=e.enable,i=e.type,o=e.blurLevel,r=e.imagePath,t?this._isTestVirtualBackground?i!==de?[3,2]:[4,this._testTrtc.updatePlugin(ue,{type:i,blurLevel:o})]:[3,5]:[3,8];case 1:s.sent(),s.label=2;case 2:return i!==pe?[3,4]:[4,this._testTrtc.updatePlugin(ue,{type:i,src:r})];case 3:s.sent(),s.label=4;case 4:return[3,7];case 5:return[4,this._testTrtc.startPlugin(ue,c(c({},e),{src:r,onAbort:this._onVirtualBackgroundError.bind(this)}))];case 6:s.sent(),this._isTestVirtualBackground=!0,s.label=7;case 7:return[3,9];case 8:this._testTrtc.stopPlugin(ue),this._isTestVirtualBackground=!1,s.label=9;case 9:return[3,11];case 10:throw n=s.sent(),this.logger.error("".concat(Ps,".setTestVirtualBackground fail: "),n),n;case 11:return[2]}}))}))},f.prototype.useVirtualBackground=function(e){return l(this,void 0,void 0,(function(){return h(this,(function(t){switch(t.label){case 0:return this._trtc?[4,this._trtc.use({plugin:i,assetsPath:e})]:[3,2];case 1:t.sent(),t.label=2;case 2:return this._testTrtc?[4,this._testTrtc.use({plugin:i,assetsPath:e})]:[3,4];case 3:t.sent(),t.label=4;case 4:return[2]}}))}))},f.prototype.setBeautyStyle=function(e,t,i,o){return l(this,void 0,void 0,(function(){return h(this,(function(r){switch(r.label){case 0:return[4,this._handleBeautyStyleParam(this._trtc,this._isBeautyEnabled,e,t,i,o,!1)];case 1:return r.sent(),[2]}}))}))},f.prototype.setTestBeautyStyle=function(e,t,i,o){return l(this,void 0,void 0,(function(){return h(this,(function(r){switch(r.label){case 0:return[4,this._handleBeautyStyleParam(this._testTrtc,this._isTestBeautyEnabled,e,t,i,o,!0)];case 1:return r.sent(),[2]}}))}))},f.prototype.useBeautyStyle=function(e){return l(this,void 0,void 0,(function(){return h(this,(function(t){switch(t.label){case 0:return this._trtc?[4,this._trtc.use({plugin:o,assetsPath:e})]:[3,2];case 1:t.sent(),t.label=2;case 2:return this._testTrtc?[4,this._testTrtc.use({plugin:o,assetsPath:e})]:[3,4];case 3:t.sent(),t.label=4;case 4:return[2]}}))}))},f.prototype._setAudioQualityEx=function(e){return l(this,void 0,void 0,(function(){var t;return h(this,(function(i){switch(i.label){case 0:return t=(e||{}).audioScene,ye(t)?(this.logger.info("".concat(Ps,"._setAudioQualityEx audioScene=").concat(t)),this._lastAudioScene=t,[4,this._applyAIDenoiserDecision()]):(this.logger.warn("".concat(Ps,"._setAudioQualityEx invalid audioScene: "),t),[2]);case 1:return i.sent(),[2]}}))}))},f.prototype._applyAIDenoiserDecision=function(){return l(this,void 0,void 0,(function(){var e,t,i,o,r;return h(this,(function(n){switch(n.label){case 0:if(e=this._currentAudioQuality,t=this._lastAudioScene,!(void 0===(i=this._resolveAIDenoiserMode(e,t))||this._sdkAppId&&this._userId&&this._userSig))return this._pendingAIDenoiserApply=!0,this.logger.info("".concat(Ps,".applyAIDenoiserDecision pending: enterRoom not ready, will retry after enterRoom success")),[2];n.label=1;case 1:return n.trys.push([1,9,,10]),void 0!==i?[3,4]:this._isAIDenoiserEnabled?[4,this._trtc.stopPlugin(he)]:[3,3];case 2:n.sent(),this._isAIDenoiserEnabled=!1,this._currentAIDenoiserMode=void 0,n.label=3;case 3:return[2];case 4:return this._isAIDenoiserEnabled?[3,6]:(o={sdkAppId:this._sdkAppId,userId:this._userId,userSig:this._userSig,mode:i},f.assetsPath&&(o.assetsPath=f.assetsPath),[4,this._trtc.startPlugin(he,o)]);case 5:return n.sent(),this._isAIDenoiserEnabled=!0,this._currentAIDenoiserMode=i,[2];case 6:return this._currentAIDenoiserMode===i?[3,8]:[4,this._trtc.updatePlugin(he,{mode:i})];case 7:n.sent(),this._currentAIDenoiserMode=i,n.label=8;case 8:return[3,10];case 9:return r=n.sent(),this.logger.error("".concat(Ps,".applyAIDenoiserDecision fail: "),r),[3,10];case 10:return[2]}}))}))},f.prototype._resolveAIDenoiserMode=function(e,t){if(t!==w.default&&e!==S.TRTCAudioQualityMusic)return e===S.TRTCAudioQualitySpeech?1:0},f.prototype._handleBeautyStyleParam=function(e,t,i,o,r,n,s){return l(this,void 0,void 0,(function(){var i,a,c,u,l;return h(this,(function(h){switch(h.label){case 0:if(o<0||o>9)throw new Error("beautyLevel must be between 0 and 9");if(r<0||r>9)throw new Error("whitenessLevel must be between 0 and 9");if(n<0||n>9)throw new Error("ruddinessLevel must be between 0 and 9");h.label=1;case 1:return h.trys.push([1,8,,9]),a=r/9,c=n/9,0===(i=o/9)&&0===a&&0===c?[4,e.stopPlugin(le)]:[3,3];case 2:return h.sent(),s?this._isTestBeautyEnabled=!1:this._isBeautyEnabled=!1,[3,7];case 3:return u={beauty:i,brightness:a,ruddy:c},t?[3,5]:[4,e.startPlugin(le,u)];case 4:return h.sent(),s?this._isTestBeautyEnabled=!0:this._isBeautyEnabled=!0,[3,7];case 5:return[4,e.updatePlugin(le,u)];case 6:h.sent(),h.label=7;case 7:return[3,9];case 8:throw l=h.sent(),s?this.logger.error("".concat(Ps,".").concat("setTestBeautyStyle"," fail: "),l):this.logger.error("".concat(Ps,".").concat("setBeautyStyle"," fail: "),l),l;case 9:return[2]}}))}))},f.prototype._resetBeautyStyle=function(){return l(this,void 0,void 0,(function(){return h(this,(function(e){switch(e.label){case 0:return this._isBeautyEnabled?[4,this._trtc.stopPlugin(le)]:[3,2];case 1:e.sent(),this._isBeautyEnabled=!1,e.label=2;case 2:return this._isTestBeautyEnabled?[4,this._testTrtc.stopPlugin(le)]:[3,4];case 3:e.sent(),this._isTestBeautyEnabled=!1,e.label=4;case 4:return[2]}}))}))},f.prototype.getMicDevicesList=function(){return l(this,void 0,Promise,(function(){var t,i,o;return h(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(Ps,".getMicDevicesList")),r.label=1;case 1:return r.trys.push([1,5,,6]),[4,e.getMicrophoneList()];case 2:return t=r.sent(),i=t.map((function(e){return c(c({},e),{deviceName:e.label})})),this._microphoneList=t,"{}"!==JSON.stringify(this._currentMicrophone)?[3,4]:(this._currentMicrophone=this.getDefaultDeviceInfo(t),this._currentMicrophoneId=this._currentMicrophone.deviceId,[4,this.setCurrentMicDevice(this._currentMicrophoneId)]);case 3:r.sent(),r.label=4;case 4:return[2,Promise.resolve(i)];case 5:return o=r.sent(),this._callFunctionErrorManage(o,"getMicDevicesList"),[2,Promise.resolve([])];case 6:return[2]}}))}))},f.prototype.setCurrentMicDevice=function(e){var t;return l(this,void 0,Promise,(function(){var i;return h(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(Ps,".setCurrentMicDevice with params: "),{micId:e}),o.label=1;case 1:return o.trys.push([1,4,,5]),e?(this._setCurrentMicrophoneId(e),[4,this._updateLocalAudio()]):[2,!1];case 2:return o.sent(),[4,this._updateLocalTestAudio()];case 3:return o.sent(),this._currentMicrophone=this._microphoneList.find((function(t){return t.deviceId===e}))||{},[3,5];case 4:throw i=o.sent(),this._setCurrentMicrophoneId(null===(t=this._currentMicrophone)||void 0===t?void 0:t.deviceId),this._callFunctionErrorManage(i,"setCurrentMicDevice"),i;case 5:return[2]}}))}))},f.prototype.getCurrentMicDevice=function(){this.logger.info("".concat(Ps,".getCurrentMicDevice"));var e=this._currentMicrophone,t=e.deviceId,i=e.label,o=e.kind,r=e.groupId;return new P(t,i,o,i,r)},f.prototype.getSpeakerDevicesList=function(){return l(this,void 0,Promise,(function(){var t,i,o;return h(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(Ps,".getSpeakerDevicesList")),r.label=1;case 1:return r.trys.push([1,5,,6]),[4,e.getSpeakerList()];case 2:return t=r.sent(),i=t.map((function(e){return c(c({},e),{deviceName:e.label})})),this._speakerList=t,"{}"!==JSON.stringify(this._currentSpeaker)?[3,4]:(this._currentSpeaker=this.getDefaultDeviceInfo(t),this._currentSpeakerId=this._currentSpeaker.deviceId,[4,this.setCurrentSpeakerDevice(this._currentSpeakerId)]);case 3:r.sent(),r.label=4;case 4:return[2,Promise.resolve(i)];case 5:return o=r.sent(),this._callFunctionErrorManage(o,"getSpeakerDevicesList"),[2,Promise.resolve([])];case 6:return[2]}}))}))},f.prototype.setCurrentSpeakerDevice=function(t){return l(this,void 0,Promise,(function(){var i;return h(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(Ps,".setCurrentSpeakerDevice with params: "),{speakerId:t}),o.label=1;case 1:return o.trys.push([1,3,,4]),t?[4,e.setCurrentSpeaker(t)]:[2,!1];case 2:return o.sent(),this._setCurrentSpeakerId(t),this._currentSpeaker=this._speakerList.find((function(e){return e.deviceId===t}))||{},[3,4];case 3:throw i=o.sent(),this._callFunctionErrorManage(i,"setCurrentSpeakerDevice"),i;case 4:return[2]}}))}))},f.prototype.getCurrentSpeakerDevice=function(){this.logger.info("".concat(Ps,".getCurrentSpeakerDevice"));var e=this._currentSpeaker,t=e.deviceId,i=e.label,o=e.kind,r=e.groupId;return new P(t,i,o,i,r)},f.prototype.startCameraDeviceTest=function(t){return l(this,void 0,void 0,(function(){var i;return h(this,(function(o){switch(o.label){case 0:if(this.logger.info("".concat(Ps,".startCameraDeviceTest with params: "),t),!t)return[2];this._setLocalTestView(t),o.label=1;case 1:return o.trys.push([1,3,,7]),[4,this._testTrtc.startLocalVideo(this._generateLocalTestVideoData())];case 2:return o.sent(),[3,7];case 3:return(i=o.sent()).code!==e.ERROR_CODE.OPERATION_ABORT?[3,5]:[4,this._updateLocalTestVideo()];case 4:return o.sent(),[3,6];case 5:throw this._callFunctionErrorManage(i,"startCameraDeviceTest"),i;case 6:return[3,7];case 7:return[2]}}))}))},f.prototype.stopCameraDeviceTest=function(){return l(this,void 0,void 0,(function(){return h(this,(function(e){switch(e.label){case 0:return this.logger.info("".concat(Ps,".stopCameraDeviceTest")),this._setLocalTestView(null),[4,this._testTrtc.stopLocalVideo()];case 1:return e.sent(),[2]}}))}))},f.prototype.startMicDeviceTest=function(t){return l(this,void 0,void 0,(function(){var i,o=this;return h(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(Ps,".startMicDeviceTest with params: "),t),r.label=1;case 1:return r.trys.push([1,3,,7]),[4,this._testTrtc.startLocalAudio(this._generateLocalTestAudioData())];case 2:return r.sent(),[3,7];case 3:return(i=r.sent()).code!==e.ERROR_CODE.OPERATION_ABORT?[3,5]:[4,this._updateLocalTestAudio()];case 4:return r.sent(),[3,6];case 5:throw this._callFunctionErrorManage(i,"startMicDeviceTest"),i;case 6:return[3,7];case 7:return this._testTrtc.on(e.EVENT.AUDIO_VOLUME,(function(e){null==e||e.result.forEach((function(e){var t=e.userId,i=e.volume;""===t&&o.emit("onTestMicVolume",i)}))})),[4,this._testTrtc.enableAudioVolumeEvaluation(t)];case 8:return r.sent(),[2]}}))}))},f.prototype.stopMicDeviceTest=function(){return l(this,void 0,void 0,(function(){return h(this,(function(e){switch(e.label){case 0:return this.logger.info("".concat(Ps,".stopMicDeviceTest")),[4,this._testTrtc.stopLocalAudio()];case 1:return e.sent(),[2]}}))}))},f.prototype.callExperimentalAPI=function(e){return l(this,void 0,void 0,(function(){var t,i,o;return h(this,(function(r){switch(r.label){case 0:if(this.logger.info("".concat(Ps,".callExperimentalAPI"),e),(t=Re(e))===e)return[2];if(i=t.api,o=t.params,!i||!o)return[2];r.label=1;case 1:switch(r.trys.push([1,29,,30]),i){case"setFramework":return[3,2];case"enableAudioAEC":return[3,3];case"enableAudioANS":return[3,4];case"enableAudioAGC":return[3,5];case"KeyMetricsStats":return[3,6];case"setNetworkProxy":return[3,7];case"enableVirtualBackground":return[3,8];case"enableTestVirtualBackground":return[3,10];case"enableTestBeautyStyle":return[3,12];case"setVideoEncodeParamEx":return[3,14];case"enableAutoPlayDialog":return[3,15];case"setAudioQualityEx":return[3,16];case"setAudienceLatencyLevel":return[3,18];case"switchPlaybackQuality":return[3,19];case"requestPictureInPicture":return[3,21];case"exitPictureInPicture":return[3,23];case"OnRecvWhiteboardCommand":return[3,25]}return[3,27];case 2:return this._handleSetFrameWork(o),[3,28];case 3:return this._echoCancellation=Boolean(o.enable),[3,28];case 4:return this._noiseSuppression=Boolean(o.enable),[3,28];case 5:return this._autoGainControl=Boolean(o.enable),[3,28];case 6:return this._handleKeyMetricsStats(o),[3,28];case 7:return this._networkProxy=o,[3,28];case 8:return[4,this.setVirtualBackground(o)];case 9:return r.sent(),[3,28];case 10:return[4,this.setTestVirtualBackground(o)];case 11:return r.sent(),[3,28];case 12:return[4,this.setTestBeautyStyle(o.style,o.beautyLevel,o.whitenessLevel,o.ruddinessLevel)];case 13:return r.sent(),[3,28];case 14:return this._setVideoEncodeParamEx(o),[3,28];case 15:return this._enableAutoPlayDialog=Boolean(o.enable),[3,28];case 16:return[4,this._setAudioQualityEx(o)];case 17:return r.sent(),[3,28];case 18:return this._latencyLevel=o.latencyLevel,[3,28];case 19:return[4,this._switchPlaybackQuality(o)];case 20:return r.sent(),[3,28];case 21:return[4,this._requestPictureInPicture()];case 22:return r.sent(),[3,28];case 23:return[4,this._exitPictureInPicture()];case 24:return r.sent(),[3,28];case 25:return[4,this.getWhiteboardManager().onRecvWhiteboardCommand(JSON.parse(o))];case 26:return r.sent(),[3,28];case 27:return[3,28];case 28:return[3,30];case 29:throw r.sent();case 30:return[2]}}))}))},f.prototype._handleSetFrameWork=function(e){var t=e.frameWork,i=e.component,o=e.language;ye(t)&&(this._frameWorkType=t),ye(i)&&(this._component=i),ye(o)&&(this._language=o)},f.prototype._handleKeyMetricsStats=function(t){var i=t.key,o=t.opt,r=t.value,n=t.version,s=o===ge;e._addKVStat({type:o,key:i,value:r,version:n,useUV:s,base:100})},f.prototype._setVideoEncodeParamEx=function(e){return l(this,void 0,void 0,(function(){return h(this,(function(t){switch(t.label){case 0:switch(e.streamType){case T.TRTCVideoStreamTypeBig:return[3,1];case T.TRTCVideoStreamTypeSub:return[3,3]}return[3,5];case 1:return[4,this.setVideoEncoderParam(e)];case 2:case 4:return t.sent(),[3,6];case 3:return[4,this.setSubStreamEncoderParam(e)];case 5:return[3,6];case 6:return[2]}}))}))},f.prototype._switchPlaybackQuality=function(e){return l(this,void 0,void 0,(function(){var t,i,o,r,n,s,a,c;return h(this,(function(u){switch(u.label){case 0:if(i=(t=e||{}).quality,o=t.stream_list,r=void 0===o?[]:o,!i||0===r.length)return[2];for(n=null,s=0,a=r;s<a.length;s++)(c=a[s]).name===i&&(n=c),c.userId=c.user_id;return n&&n.user_id?[4,this._trtc.callExperimentalAPI("switchPlaybackQuality",{streamList:r,quality:n.name,autoUnmuteAudio:!0})]:[2];case 1:return u.sent(),[2]}}))}))},f.prototype._requestPictureInPicture=function(){return l(this,void 0,void 0,(function(){return h(this,(function(e){switch(e.label){case 0:return this.logger.info("".concat(Ps,"._requestPictureInPicture")),[4,this._trtc.callExperimentalAPI("requestPictureInPicture",{enable:!0})];case 1:return e.sent(),[2]}}))}))},f.prototype._exitPictureInPicture=function(){return l(this,void 0,void 0,(function(){return h(this,(function(e){switch(e.label){case 0:return this.logger.info("".concat(Ps,"._exitPictureInPicture")),[4,this._trtc.callExperimentalAPI("requestPictureInPicture",{enable:!1})];case 1:return e.sent(),[2]}}))}))},f.prototype._emitError=function(e){e&&this.emit&&this.emit(ne,e.code,e.message)},f.prototype._emitWarning=function(e){this.emit&&this.emit(se,e)},f.prototype._transformTRTCServerError=function(e){return-8===e.extraCode?An:0===String(e.extraCode).indexOf("70")?0-e.extraCode:void 0},f.prototype._transformTRTCInvalidOperationError=function(e,t){return"enterRoom"!==t||5104!==e.extraCode&&5998!==e.code?e.code:mn},f.prototype._isCameraError=function(e){return["startLocalPreview","updateLocalView","muteLocalVideo","setVideoEncoderParam","setCurrentCameraDevice","switchCamera","setLocalRenderParams","enableSmallVideoStream","startCameraDeviceTest"].includes(e)},f.prototype._isMicError=function(e){return["startLocalAudio","muteLocalAudio","setAudioCaptureVolume","setCurrentMicDevice","startMicDeviceTest"].includes(e)},f.prototype._transformTRTCDeviceError=function(e,t){var i=this._isCameraError(t),o=this._isMicError(t),r="startScreenShare"===t;switch(e.extraCode){case 5301:case 5305:case 5306:case 5307:case 5308:case 5309:if(i)return Tn;if(o)return bn;if(r)return En;break;case 5302:if(i)return yn;if(o)return Cn;if(r)return Mn;break;case 5303:if(i)return Rn;if(o)return wn;if(r)return En;break;case 5304:if(i)return _n;if(o)return Sn;if(r)return En}},f.prototype._transformTRTCUnKnowError=function(e,t){var i=this._isCameraError(t),o=this._isMicError(t);return i?Tn:o?bn:e.code},f.prototype._transformTRTCErrorCode=function(t,i){var o=null==t?void 0:t.code;if(t&&t.code)switch(t.code){case e.ERROR_CODE.DEVICE_ERROR:o=this._transformTRTCDeviceError(t,i);break;case e.ERROR_CODE.SERVER_ERROR:o=this._transformTRTCServerError(t);break;case e.ERROR_CODE.INVALID_OPERATION:case e.ERROR_CODE.OPERATION_ABORT:o=this._transformTRTCInvalidOperationError(t,i);break;case e.ERROR_CODE.UNKNOWN_ERROR:o=this._transformTRTCUnKnowError(t,i)}return o},f.prototype._callFunctionErrorManage=function(t,i){if(!t||t.code!==e.ERROR_CODE.OPERATION_ABORT){this.logger.warn("(".concat(i,") failed - ").concat(t.code," - ").concat(t.message));var o=this._transformTRTCErrorCode(t,i),r=t.message;"startScreenShare"===i&&(r=JSON.stringify({name:t.originError.name,message:r})),this.emit(ne,o,r)}},f.prototype._getTRTCResolution=function(e){var t=(m[e]||"").split("_");return{width:+(t.length>1&&t[1]),height:+(t.length>2&&t[2])}},f.prototype._getTRTCVideoProfile=function(e,t){void 0===t&&(t={});var i=t.videoWidth,o=t.videoHeight,r=t.videoResolution,n=t.videoFps,s=t.videoBitrate,a=t.resMode,c=t.resolutionMode,u={};switch(e){case T.TRTCVideoStreamTypeSub:u=this._defaultScreenProfile;break;case T.TRTCVideoStreamTypeSmall:u=this._defaultSmallVideoProfile;break;case T.TRTCVideoStreamTypeBig:default:u=this._defaultVideoProfile}if(Te(r))Te(i)||(u.width=i),Te(o)||(u.height=o);else{var l=this._getTRTCResolution(r);u.width=l.width,u.height=l.height}if(!Te(a)&&a===D.TRTCVideoResolutionModePortrait||!Te(c)&&c===D.TRTCVideoResolutionModePortrait){var h=u.height,d=u.width;u.width=h,u.height=d}return n&&(u.frameRate=n),s&&(u.bitrate=s),u},f.prototype._getTRTCStreamType=function(t){var i;return((i={})[T.TRTCVideoStreamTypeBig]=e.TYPE.STREAM_TYPE_MAIN,i[T.TRTCVideoStreamTypeSmall]=e.TYPE.STREAM_TYPE_MAIN,i[T.TRTCVideoStreamTypeSub]=e.TYPE.STREAM_TYPE_SUB,i)[t]},f.prototype._getTRTCFillMode=function(e){var t;return((t={})[y.TRTCVideoFillMode_Fill]=ln.COVER,t[y.TRTCVideoFillMode_Fit]=ln.CONTAIN,t)[e]},f.prototype._getTRTCCloudVideoFillMode=function(e){var t;return((t={})[ln.COVER]=y.TRTCVideoFillMode_Fill,t[ln.CONTAIN]=y.TRTCVideoFillMode_Fit,t)[e]},f.prototype._getTRTCCloudMirrorType=function(e){return!0===e?_.TRTCVideoMirrorType_Enable:_.TRTCVideoMirrorType_Disable},f.prototype._getLocalRenderMirror=function(e){var t;return e===_.TRTCVideoMirrorType_Auto?!this._getIsMobile()||this._getIsFrontCamera():((t={})[_.TRTCVideoMirrorType_Enable]=!0,t[_.TRTCVideoMirrorType_Disable]=!1,t)[e]},f.prototype._getTRTCLocalMirror=function(e,t){var i=this._getLocalRenderMirror(e);return Te(t)?!!i&&"both":i&&t?"both":i&&!t?"view":!i&&t?"publish":!(!i&&!t)&&"view"},f.prototype._getTRTCRemoteMirror=function(e){var t;return((t={})[_.TRTCVideoMirrorType_Auto]=!1,t[_.TRTCVideoMirrorType_Enable]=!0,t[_.TRTCVideoMirrorType_Disable]=!1,t)[e]},f.prototype._getTRTCQosPreference=function(t){var i;return((i={})[k.TRTCVideoQosPreferenceSmooth]=e.TYPE.QOS_PREFERENCE_SMOOTH,i[k.TRTCVideoQosPreferenceClear]=e.TYPE.QOS_PREFERENCE_CLEAR,i)[t]},f.prototype._getTRTCAudioQuality=function(t){var i;return((i={})[S.TRTCAudioQualitySpeech]=e.TYPE.AUDIO_PROFILE_STANDARD,i[S.TRTCAudioQualityDefault]=e.TYPE.AUDIO_PROFILE_STANDARD,i[S.TRTCAudioQualityMusic]=e.TYPE.AUDIO_PROFILE_HIGH_STEREO,i)[t]},f.prototype._getTRTCCloudDeviceType=function(e){return{camera:A.TRTCDeviceTypeCamera,microphone:A.TRTCDeviceTypeMic,speaker:A.TRTCDeviceTypeSpeaker}[e]},f.prototype._getTRTCCloudDeviceState=function(e){return{add:M.TRTCDeviceStateAdd,remove:M.TRTCDeviceStateRemove,active:M.TRTCDeviceStateActive}[e]},f.prototype._getTRTCCloudQuality=function(e){return[x.TRTCQuality_Unknown,x.TRTCQuality_Excellent,x.TRTCQuality_Good,x.TRTCQuality_Poor,x.TRTCQuality_Bad,x.TRTCQuality_Vbad,x.TRTCQuality_Down][e]},f.prototype._generateLocalVideoData=function(){var e={view:this._getLocalView(),publish:this._getIsVideoPublish(),option:{profile:this._getVideoProfile(),small:this._getSmallStreamVideoProfile()||!1,mirror:this._getTRTCLocalMirror(this._localRenderParams.mirrorType,this._encoderMirror),fillMode:this._getTRTCFillMode(this._localRenderParams.fillMode)}};return this._cameraVideoTrack?e&&Object.assign(e.option,{videoTrack:this._cameraVideoTrack}):this._getIsMobile()?e&&Object.assign(e.option,{useFrontCamera:this._getIsFrontCamera()}):e&&Object.assign(e.option,{cameraId:this._getCurrentCameraId()}),this._getQosPreference()&&e&&Object.assign(e.option,{qosPreference:this._getQosPreference()}),e},f.prototype._generateLocalTestVideoData=function(){var e={view:this._getLocalTestView(),publish:!1,option:{profile:this._getVideoProfile(),mirror:this._getTRTCLocalMirror(this._localRenderParams.mirrorType,this._encoderMirror),fillMode:this._getTRTCFillMode(this._localRenderParams.fillMode)}};return this._getIsMobile()?e&&Object.assign(e.option,{useFrontCamera:this._getIsFrontCamera()}):e&&Object.assign(e.option,{cameraId:this._getCurrentCameraId()}),e},f.prototype._generateLocalAudioData=function(){var e={publish:this._getIsAudioPublish(),mute:this._getAudioMuteType(),muteKeepVolumeDetection:!0,option:{microphoneId:this._getCurrentMicrophoneId(),profile:this._getAudioProfile(),captureVolume:this._getCaptureVolume()}};return _e(this._echoCancellation)&&(e.option.echoCancellation=this._echoCancellation),_e(this._autoGainControl)&&(e.option.autoGainControl=this._autoGainControl),_e(this._noiseSuppression)&&(e.option.noiseSuppression=this._noiseSuppression),e},f.prototype._generateLocalTestAudioData=function(){return{publish:!1,option:{microphoneId:this._getCurrentMicrophoneId(),profile:this._getAudioProfile()}}},f.prototype._generateRemoteVideoData=function(e,t){return Se(this._remoteStreamConfig.get("".concat(e,"_").concat(this._getTRTCStreamType(t))))},f.prototype._addTRTCEvents=function(){var t=this;this._trtc.on(e.EVENT.ERROR,(function(e){e&&t.emit("onError",e.code,e.message)})),this._trtc.on(e.EVENT.REMOTE_USER_ENTER,(function(e){(null==e?void 0:e.userId)&&t.emit("onRemoteUserEnterRoom",e.userId)})),this._trtc.on(e.EVENT.REMOTE_USER_EXIT,(function(e){(null==e?void 0:e.userId)&&t.emit("onRemoteUserLeaveRoom",e.userId)})),this._trtc.on(e.EVENT.REMOTE_AUDIO_AVAILABLE,(function(e){(null==e?void 0:e.userId)&&t.emit("onUserAudioAvailable",e.userId,!0)})),this._trtc.on(e.EVENT.REMOTE_AUDIO_UNAVAILABLE,(function(e){(null==e?void 0:e.userId)&&t.emit("onUserAudioAvailable",e.userId,!1)})),this._trtc.on(e.EVENT.REMOTE_VIDEO_AVAILABLE,(function(e){t._emitVideoAvailable(e,!0)})),this._trtc.on(e.EVENT.REMOTE_VIDEO_UNAVAILABLE,(function(e){t._emitVideoAvailable(e,!1)})),this._trtc.on(e.EVENT.AUDIO_VOLUME,(function(e){(null==e?void 0:e.result)&&t.emit("onUserVoiceVolume",null==e?void 0:e.result,((null==e?void 0:e.result)||[]).length)})),this._trtc.on(e.EVENT.KICKED_OUT,(function(e){var i={banned:hn.banned,room_disband:hn.roomDisband};ye(i[e.reason])&&t.emit("onExitRoom",i[e.reason])})),this._trtc.on(e.EVENT.NETWORK_QUALITY,(function(e){var i=e.uplinkNetworkQuality,o=e.downlinkNetworkQuality,r=new z("",t._getTRTCCloudQuality(i)),n=[];t._remoteStatisticsUserIdList.length>0&&(n=t._remoteStatisticsUserIdList.map((function(e){return new z(e,t._getTRTCCloudQuality(o))}))),t.emit("onNetworkQuality",r,n)})),this._trtc.on(e.EVENT.AUTOPLAY_FAILED,(function(e){t.emit("onAutoPlayFailed",e)})),this._trtc.on(e.EVENT.SEI_MESSAGE,(function(e){if(e.data&&"object"==typeof e.data&&e.data instanceof ArrayBuffer){for(var i=new Uint8Array(e.data),o="",r=0;r<i.length;r++)o+=String.fromCharCode(i[r]);e.stringData=o}t.emit("onRecvSEIMsg",e.userId,JSON.stringify(e))})),this._trtc.on(e.EVENT.STATISTICS,(function(e){var i,o=e.rtt,r=e.upLoss,n=e.downLoss,s=e.bytesSent,a=e.bytesReceived,c=e.localStatistics,u=e.remoteStatistics;t._remoteStatisticsUserIdList=u.map((function(e){return e.userId}));var l={big:T.TRTCVideoStreamTypeBig,small:T.TRTCVideoStreamTypeSmall,sub:T.TRTCVideoStreamTypeSub},h=(null===(i=c.video)||void 0===i?void 0:i.length)>0?c.video.map((function(e){var t=new W;return t.width=e.width,t.height=e.height,t.frameRate=e.frameRate,t.videoBitrate=e.bitrate,t.audioBitrate=c.audio.bitrate||0,t.streamType=l[e.videoType],t})):[];if(0===h.length&&c.audio.bitrate>0){var d=new W;d.audioBitrate=c.audio.bitrate||0,h.push(d)}var p=[];u.forEach((function(e){var t=[],i=e.userId,o=e.audio.bitrate;if(e.video&&e.video.forEach((function(e){var r=new H;r.userId=i,r.width=e.width,r.height=e.height,r.frameRate=e.frameRate,r.videoBitrate=e.bitrate,r.audioBitrate=o||0,r.streamType=l[e.videoType],t.push(r)})),0===t.length){var r=new H;r.userId=i,r.audioBitrate=o||0,t.push(r)}p.push.apply(p,t)}));var f=new Q;f.upLoss=r,f.downLoss=n,f.rtt=o,f.sentBytes=s,f.receivedBytes=a,f.localStatisticsArray=h,f.localStatisticsArraySize=h.length,f.remoteStatisticsArray=p,f.remoteStatisticsArraySize=p.length,t.emit("onStatistics",f)})),this._trtc.on(e.EVENT.SCREEN_SHARE_STOPPED,(function(){t.emit("onScreenCaptureStopped",0),t._clearScreenShareParams(),t._isSharingScreen=!1})),this._trtc.on(e.EVENT.PUBLISH_STATE_CHANGED,(function(e){var i=e.mediaType;"started"===e.state&&("audio"===i?t.emit("onSendFirstLocalAudioFrame"):"video"===i?t.emit("onSendFirstLocalVideoFrame",T.TRTCVideoStreamTypeBig):"screen"===i&&t.emit("onSendFirstLocalVideoFrame",T.TRTCVideoStreamTypeSub))})),this._trtc.on(e.EVENT.FIRST_VIDEO_FRAME,(function(e){var i=e.userId,o=e.streamType,r=e.width,n=e.height;t.emit("onFirstVideoFrame",i,o,r,n)})),this._trtc.on(e.EVENT.AUDIO_PLAY_STATE_CHANGED,(function(e){var i=e.userId;"PLAYING"===e.state&&t.emit("onFirstAudioFrame",i)})),this._trtc.on(e.EVENT.DEVICE_CHANGED,(function(e){var i=e.type,o=e.device,r=e.action,n=o.deviceId;if("active"===r){switch(i){case"camera":t._currentCameraId=n,t._currentCamera=o;break;case"microphone":t._currentMicrophoneId=n,t._currentMicrophone=o;break;case"speaker":t._currentSpeakerId=n,t._currentSpeaker=o}t.emitOnDeviceChange(n,t._getTRTCCloudDeviceType(i),t._getTRTCCloudDeviceState(r))}})),this._trtc.on(e.EVENT.CUSTOM_MESSAGE,(function(e){e&&t.emit("onRecvCustomCmdMsg",e.userId,e.cmdId,e.seq,null==e?void 0:e.data)})),this._trtc.on(e.EVENT.CONNECTION_STATE_CHANGED,(function(e){t._hasJoinedRoom&&!t._isExitingRoom&&("CONNECTED"===e.prevState&&"DISCONNECTED"===e.state?t.emit("onConnectionLost"):"DISCONNECTED"===e.prevState&&"CONNECTING"===e.state?t.emit("onTryToReconnect"):"CONNECTING"===e.prevState&&"CONNECTED"===e.state&&t.emit("onConnectionRecovery"))})),this._trtc.on(e.EVENT.PICTURE_IN_PICTURE_STATE_CHANGED,(function(e){t.emit("onPictureInPictureStateChanged",e)}))},f.prototype._removeTRTCEvents=function(){this._trtc.off("*")},f.prototype._emitVideoAvailable=function(t,i){var o=t.userId,r=t.streamType;i?this._remoteStreamMap.set("".concat(o,"_").concat(r),!0):this._remoteStreamMap.delete("".concat(o,"_").concat(r)),r===e.TYPE.STREAM_TYPE_SUB?o&&this.emit("onUserSubStreamAvailable",o,i):o&&this.emit("onUserVideoAvailable",o,i)},f.prototype._setLocalView=function(e){this._localView=e},f.prototype._getLocalView=function(){return this._localView},f.prototype._setIsMobile=function(e){this._isMobile=e},f.prototype._getIsMobile=function(){return this._isMobile},f.prototype._setIsFrontCamera=function(e){this._isFrontCamera=e},f.prototype._getIsFrontCamera=function(){return this._isFrontCamera},f.prototype._getSmallStreamVideoProfile=function(){return this._smallStreamVideoProfile},f.prototype._setSmallStreamVideoProfile=function(e){this._smallStreamVideoProfile=e},f.prototype._setIsVideoPublish=function(e){this._isVideoPublish=e},f.prototype._getIsVideoPublish=function(){return this._isVideoPublish},f.prototype._setVideoProfile=function(e){this._videoProfile=e},f.prototype._getVideoProfile=function(){return this._videoProfile},f.prototype._setQosPreference=function(e){this._qosPreference=e},f.prototype._getQosPreference=function(){return this._qosPreference},f.prototype._setLocalTestView=function(e){this._localTestView=e},f.prototype._getLocalTestView=function(){return this._localTestView},f.prototype._setScreenShareParams=function(e){var t=e.view,i=e.systemAudio,o=e.fillMode,r=e.profile,n=e.videoTrack,s=e.qosPreference;Te(t)||(this._screenShareParams.view=t),Te(i)||(this._screenShareParams.option.systemAudio=i),Te(o)||(this._screenShareParams.option.fillMode=o),Te(r)||(this._screenShareParams.option.profile=r),Te(n)||(this._screenShareParams.option.videoTrack=n),Te(s)||(this._screenShareParams.option.qosPreference=s),Te(e.streamType)||(this._screenShareParams.streamType=this._getTRTCStreamType(e.streamType))},f.prototype._clearScreenShareParams=function(){var e,t,i,o,r;(null===(e=this._screenShareParams)||void 0===e?void 0:e.view)&&delete this._screenShareParams.view,(null===(i=null===(t=this._screenShareParams)||void 0===t?void 0:t.option)||void 0===i?void 0:i.systemAudio)&&delete this._screenShareParams.option.systemAudio,(null===(r=null===(o=this._screenShareParams)||void 0===o?void 0:o.option)||void 0===r?void 0:r.videoTrack)&&delete this._screenShareParams.option.videoTrack},f.prototype._getScreenShareParams=function(){return this._screenShareParams},f.prototype._setIsAudioPublish=function(e){this._isAudioPublish=e},f.prototype._getIsAudioPublish=function(){return this._isAudioPublish},f.prototype._setAudioMuteType=function(e){this._audioMuteType=e},f.prototype._getAudioMuteType=function(){return this._audioMuteType},f.prototype._setAudioProfile=function(e){this._audioProfile=e},f.prototype._getAudioProfile=function(){return this._audioProfile},f.prototype._getCaptureVolume=function(){return this._captureVolume},f.prototype._setCaptureVolume=function(e){this._captureVolume=e},f.prototype._setCurrentCameraId=function(e){this._currentCameraId=e},f.prototype._getCurrentCameraId=function(){return this._currentCameraId},f.prototype._setCurrentMicrophoneId=function(e){this._currentMicrophoneId=e},f.prototype._getCurrentMicrophoneId=function(){return this._currentMicrophoneId},f.prototype._setCurrentSpeakerId=function(e){this._currentSpeakerId=e},f.prototype._getCurrentSpeakerId=function(){return this._currentSpeakerId},f.prototype._setRemoteStreamConfig=function(e,t,i){var o=this._remoteStreamConfig.get("".concat(e,"_").concat(this._getTRTCStreamType(t)));o||(o={userId:e,streamType:this._getTRTCStreamType(t),option:{mirror:this._getTRTCRemoteMirror(_.TRTCVideoMirrorType_Disable),fillMode:this._getTRTCFillMode(y.TRTCVideoFillMode_Fit)}});var r=i.view,n=i.mirrorType,s=i.fillMode,a=i.small;Te(r)||(o.view=r),Te(n)||(o.option.mirror=this._getTRTCRemoteMirror(n)),Te(s)||(o.option.fillMode=this._getTRTCFillMode(s)),Te(a)||(o.option.small=a),this._remoteStreamConfig.set("".concat(e,"_").concat(this._getTRTCStreamType(t)),o)},f.prototype._inheritPropertiesToSubCloud=function(e){e._frameWorkType=this._frameWorkType,e._component=this._component,e._language=this._language,e._networkProxy=c({},this._networkProxy),e._latencyLevel=this._latencyLevel,e._enableAutoPlayDialog=this._enableAutoPlayDialog},f.prototype._inheritEventsToSubCloud=function(t){var i=this;t._trtc.on(e.EVENT.AUTOPLAY_FAILED,(function(e){i.emit("onAutoPlayFailed",e)})),t._trtc.on(e.EVENT.PICTURE_IN_PICTURE_STATE_CHANGED,(function(e){i.emit("onPictureInPictureStateChanged",e)}))},f.prototype.handleDeviceChange=function(){return l(this,void 0,void 0,(function(){var t=this;return h(this,(function(i){return e.getCameraList().then((function(e){return l(t,void 0,void 0,(function(){return h(this,(function(t){switch(t.label){case 0:return this._cameraList.length===e.length?[2]:[4,this.deviceChangeManage(this._cameraList,e,A.TRTCDeviceTypeCamera)];case 1:return t.sent(),this._cameraList=e,[2]}}))}))})),e.getMicrophoneList().then((function(e){return l(t,void 0,void 0,(function(){return h(this,(function(t){switch(t.label){case 0:return[4,this.deviceChangeManage(this._microphoneList,e,A.TRTCDeviceTypeMic)];case 1:return t.sent(),this._microphoneList=e,[2]}}))}))})),e.getSpeakerList().then((function(e){return l(t,void 0,void 0,(function(){return h(this,(function(t){switch(t.label){case 0:return[4,this.deviceChangeManage(this._speakerList,e,A.TRTCDeviceTypeSpeaker)];case 1:return t.sent(),this._speakerList=e,[2]}}))}))})),[2]}))}))},f.prototype.isSameDevice=function(e,t){var i=e&&e.deviceId&&e.groupId&&e.label,o=t&&t.deviceId&&t.groupId&&t.label;return!(!i||!o)&&(e.deviceId===t.deviceId&&e.groupId===t.groupId&&e.label===t.label)},f.prototype.deviceChangeManage=function(e,t,i){return l(this,void 0,void 0,(function(){var o,r,n,s,a;return h(this,(function(c){switch(c.label){case 0:return o=void 0,e.length!==t.length&&(r=(t||[]).map((function(e){return e.deviceId})),n=new P,e.length>t.length?(n=e.filter((function(e){return!r.includes(e.deviceId)}))[0]||{},o=M.TRTCDeviceStateRemove):(r=(e||[]).map((function(e){return e.deviceId})),n=t.filter((function(e){return!r.includes(e.deviceId)}))[0]||{},o=M.TRTCDeviceStateAdd),s=n.deviceId,this.emitOnDeviceChange(s,i,o)),a=this.getDefaultDeviceInfo(t),i!==A.TRTCDeviceTypeCamera||o!==M.TRTCDeviceStateRemove?[3,3]:this.isSameDevice(this._currentCamera,a)?[2]:a.deviceId?[4,this.autoChangeDevice(i,a)]:[3,2];case 1:c.sent(),c.label=2;case 2:c.label=3;case 3:return i!==A.TRTCDeviceTypeMic?[3,6]:this.isSameDevice(this._currentMicrophone,a)?[2]:a.deviceId?[4,this.autoChangeDevice(i,a)]:[3,5];case 4:c.sent(),c.label=5;case 5:c.label=6;case 6:return i!==A.TRTCDeviceTypeSpeaker?[3,9]:this.isSameDevice(this._currentSpeaker,a)?[2]:a.deviceId?[4,this.autoChangeDevice(i,a)]:[3,8];case 7:c.sent(),c.label=8;case 8:c.label=9;case 9:return[2]}}))}))},f.prototype.getDefaultDeviceInfo=function(e){var t=new P;if(0===e.length)return t;var i=e.filter((function(e){return"default"===e.deviceId}));return t=i.length>0?i[0]:e[0]},f.prototype.autoChangeDevice=function(t,i){return l(this,void 0,void 0,(function(){var o,r,n;return h(this,(function(s){switch(s.label){case 0:return o=i.deviceId,t!==A.TRTCDeviceTypeCamera?[3,6]:(this._setCurrentCameraId(o),[4,this._updateLocalVideo()]);case 1:s.sent(),s.label=2;case 2:return s.trys.push([2,4,,5]),[4,this._testTrtc.updateLocalVideo({option:{cameraId:o}})];case 3:return s.sent(),[3,5];case 4:return r=s.sent(),console.log("testTRTC error",JSON.stringify(r)),r.code,e.ERROR_CODE.OPERATION_ABORT,[3,5];case 5:this._currentCameraId=o,this._currentCamera=i,this.emitOnDeviceChange(o,t,M.TRTCDeviceStateActive),s.label=6;case 6:return t!==A.TRTCDeviceTypeMic?[3,12]:(this._setCurrentMicrophoneId(o),[4,this._updateLocalAudio()]);case 7:s.sent(),s.label=8;case 8:return s.trys.push([8,10,,11]),[4,this._testTrtc.updateLocalAudio({option:{microphoneId:o}})];case 9:return s.sent(),[3,11];case 10:return n=s.sent(),console.log("testTRTC error",JSON.stringify(n)),n.code,e.ERROR_CODE.OPERATION_ABORT,[3,11];case 11:this._currentMicrophoneId=o,this._currentMicrophone=i,this.emitOnDeviceChange(o,t,M.TRTCDeviceStateActive),s.label=12;case 12:return t!==A.TRTCDeviceTypeSpeaker?[3,14]:[4,e.setCurrentSpeaker(o)];case 13:s.sent(),this._currentSpeakerId=o,this._currentSpeaker=i,this.emitOnDeviceChange(o,t,M.TRTCDeviceStateActive),s.label=14;case 14:return[2]}}))}))},f.prototype.emitOnDeviceChange=function(e,t,i){this.emit("onDeviceChange",e,t,i)},f.prototype.getMediaMixingManager=function(){return new ts({logger:this.logger,trtc:this._trtc,trtcCloud:this})},f.prototype.getWhiteboardManager=function(){return new fs({logger:this.logger,trtc:this._trtc})},f.prototype.getAITranscriberManager=function(){return new _s({logger:this.logger,trtc:this._trtc})},f.shareInstance=null,f.subCloudMap=new Map,f.enableSEI=!1,f.assetsPath="",u([(v="exitRoom",function(e,t,i){var o=i.value;return i.value=function(){for(var e,t,i,r,n=[],s=0;s<arguments.length;s++)n[s]=arguments[s];var a=[];return null===(t=null===(e=gs.get(this))||void 0===e?void 0:e.queue)||void 0===t||t.forEach((function(e){return a.push(e)})),null===(i=ms.get(this))||void 0===i||i.forEach((function(e){return null==e?void 0:e.queue.forEach((function(e){return a.push(e)}))})),null===(r=Ts.get(this))||void 0===r||r.forEach((function(e){return null==e?void 0:e.queue.forEach((function(e){return a.push(e)}))})),a.forEach((function(e){e.reject(new Error("aborted ".concat(v)))})),gs.delete(this),ms.delete(this),Ts.delete(this),o.apply(this,n)},i})],f.prototype,"exitRoom",null),u([ys((function(e){return e}))],f.prototype,"muteRemoteAudio",null),u([ys((function(e){return e}))],f.prototype,"muteRemoteVideoStream",null),u([ys((function(e){var t=e||{},i=t.quality,o=t.stream_list,r=void 0===o?[]:o,n=r.some((function(e){return e.name===i}));return i&&n?r.map((function(e){return e.user_id})):(console.warn("[QualitySwitch] Invalid params: target ".concat(i," not found in list")),[])}),{deduplicate:!0})],f.prototype,"_switchPlaybackQuality",null),f}(E);export{Cs as AITranscriberListener,oe as AudioMuteType,Ss as IAITranscriberManager,Bn as ITRTCMediaMixingEvent,kn as ITRTCMediaMixingManager,us as ITRTCWhiteboardManager,Dn as InteractionOption,J as Rect,b as TRTCAppScene,S as TRTCAudioQuality,w as TRTCAudioSceneEx,R as TRTCBeautyStyle,Z as TRTCCameraCaptureMode,re as TRTCCameraCaptureParams,P as TRTCDeviceInfo,M as TRTCDeviceState,A as TRTCDeviceType,q as TRTCImageBuffer,W as TRTCLocalStatistics,j as TRTCLogLevel,xn as TRTCMediaMixingEncParam,fn as TRTCMediaMixingErrorCode,gn as TRTCMediaMixingEvent,On as TRTCMediaSource,vn as TRTCMediaSourceType,$ as TRTCMixInputType,ee as TRTCMixUser,G as TRTCNetworkQosParam,L as TRTCParams,F as TRTCPublishCDNParam,B as TRTCQosControlMode,x as TRTCQuality,z as TRTCQualityInfo,H as TRTCRemoteStatistics,O as TRTCRenderParams,C as TRTCRoleType,ie as TRTCScreenCaptureProperty,K as TRTCScreenCaptureSourceInfo,U as TRTCScreenCaptureSourceType,Q as TRTCStatistics,X as TRTCTranscodingConfig,Y as TRTCTranscodingConfigMode,V as TRTCVideoEncParam,y as TRTCVideoFillMode,_ as TRTCVideoMirrorType,k as TRTCVideoQosPreference,m as TRTCVideoResolution,D as TRTCVideoResolutionMode,I as TRTCVideoRotation,T as TRTCVideoStreamType,N as TRTCVolumeInfo,Xn as TRTCWhiteboardEvent,bs as TranscriberMessage,Rs as TranscriberParams,os as WhiteboardCanvasInfo,cs as WhiteboardHistoryStateChangedInfo,rs as WhiteboardRecvCommand,ns as WhiteboardSendPayload,as as WhiteboardSessionResumedInfo,ss as WhiteboardSessionStalledInfo,is as WhiteboardToolConfig,Vs as default,ws as loggerManager};export const __esModule=!0;
|
|
1
|
+
import e from"trtc-sdk-v5";import{LEBPlayer as t}from"trtc-sdk-v5/plugins/lebplayer";import{VirtualBackground as i}from"trtc-sdk-v5/plugins/video-effect/virtual-background";import{BasicBeauty as o}from"trtc-sdk-v5/plugins/video-effect/basic-beauty";import{RealtimeTranscriber as r}from"trtc-sdk-v5/plugins/realtime-transcriber";import n from"trtc-sdk-v5/plugins/video-effect/video-mixer";import s from"trtc-sdk-v5/plugins/whiteboard";var a=function(e,t){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},a(e,t)};var c=function(){return c=Object.assign||function(e){for(var t,i=1,o=arguments.length;i<o;i++)for(var r in t=arguments[i])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},c.apply(this,arguments)};function u(e,t,i,o){var r,n=arguments.length,s=n<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,o);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(n<3?r(s):n>3?r(t,i,s):r(t,i))||s);return n>3&&s&&Object.defineProperty(t,i,s),s}function l(e,t,i,o){return new(i||(i=Promise))((function(r,n){function s(e){try{c(o.next(e))}catch(t){n(t)}}function a(e){try{c(o.throw(e))}catch(t){n(t)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,a)}c((o=o.apply(e,t||[])).next())}))}function h(e,t){var i,o,r,n,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return n={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(n[Symbol.iterator]=function(){return this}),n;function a(a){return function(c){return function(a){if(i)throw new TypeError("Generator is already executing.");for(;n&&(n=0,a[0]&&(s=0)),s;)try{if(i=1,o&&(r=2&a[0]?o.return:a[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,a[1])).done)return r;switch(o=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,o=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){s.label=a[1];break}if(6===a[0]&&s.label<r[1]){s.label=r[1],r=a;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(a);break}r[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(c){a=[6,c],o=0}finally{i=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}function d(e){var t="function"==typeof Symbol&&Symbol.iterator,i=t&&e[t],o=0;if(i)return i.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&o>=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function p(e,t,i){if(i||2===arguments.length)for(var o,r=0,n=t.length;r<n;r++)!o&&r in t||(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}function f(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,i=e[Symbol.asyncIterator];return i?i.call(e):(e=d(e),t={},o("next"),o("throw"),o("return"),t[Symbol.asyncIterator]=function(){return this},t);function o(i){t[i]=e[i]&&function(t){return new Promise((function(o,r){(function(e,t,i,o){Promise.resolve(o).then((function(t){e({value:t,done:i})}),t)})(o,r,(t=e[i](t)).done,t.value)}))}}}var v="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function g(e,t){return e(t={exports:{}},t.exports),t.exports}var m,T,y,_,R,b,C,S,w,E=g((function(e){var t=Object.prototype.hasOwnProperty,i="~";function o(){}function r(e,t,i){this.fn=e,this.context=t,this.once=i||!1}function n(e,t,o,n,s){if("function"!=typeof o)throw new TypeError("The listener must be a function");var a=new r(o,n||e,s),c=i?i+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],a]:e._events[c].push(a):(e._events[c]=a,e._eventsCount++),e}function s(e,t){0==--e._eventsCount?e._events=new o:delete e._events[t]}function a(){this._events=new o,this._eventsCount=0}Object.create&&(o.prototype=Object.create(null),(new o).__proto__||(i=!1)),a.prototype.eventNames=function(){var e,o,r=[];if(0===this._eventsCount)return r;for(o in e=this._events)t.call(e,o)&&r.push(i?o.slice(1):o);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(e)):r},a.prototype.listeners=function(e){var t=i?i+e:e,o=this._events[t];if(!o)return[];if(o.fn)return[o.fn];for(var r=0,n=o.length,s=new Array(n);r<n;r++)s[r]=o[r].fn;return s},a.prototype.listenerCount=function(e){var t=i?i+e:e,o=this._events[t];return o?o.fn?1:o.length:0},a.prototype.emit=function(e,t,o,r,n,s){var a=i?i+e:e;if(!this._events[a])return!1;var c,u,l=this._events[a],h=arguments.length;if(l.fn){switch(l.once&&this.removeListener(e,l.fn,void 0,!0),h){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,t),!0;case 3:return l.fn.call(l.context,t,o),!0;case 4:return l.fn.call(l.context,t,o,r),!0;case 5:return l.fn.call(l.context,t,o,r,n),!0;case 6:return l.fn.call(l.context,t,o,r,n,s),!0}for(u=1,c=new Array(h-1);u<h;u++)c[u-1]=arguments[u];l.fn.apply(l.context,c)}else{var d,p=l.length;for(u=0;u<p;u++)switch(l[u].once&&this.removeListener(e,l[u].fn,void 0,!0),h){case 1:l[u].fn.call(l[u].context);break;case 2:l[u].fn.call(l[u].context,t);break;case 3:l[u].fn.call(l[u].context,t,o);break;case 4:l[u].fn.call(l[u].context,t,o,r);break;default:if(!c)for(d=1,c=new Array(h-1);d<h;d++)c[d-1]=arguments[d];l[u].fn.apply(l[u].context,c)}}return!0},a.prototype.on=function(e,t,i){return n(this,e,t,i,!1)},a.prototype.once=function(e,t,i){return n(this,e,t,i,!0)},a.prototype.removeListener=function(e,t,o,r){var n=i?i+e:e;if(!this._events[n])return this;if(!t)return s(this,n),this;var a=this._events[n];if(a.fn)a.fn!==t||r&&!a.once||o&&a.context!==o||s(this,n);else{for(var c=0,u=[],l=a.length;c<l;c++)(a[c].fn!==t||r&&!a[c].once||o&&a[c].context!==o)&&u.push(a[c]);u.length?this._events[n]=1===u.length?u[0]:u:s(this,n)}return this},a.prototype.removeAllListeners=function(e){var t;return e?(t=i?i+e:e,this._events[t]&&s(this,t)):(this._events=new o,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=i,a.EventEmitter=a,e.exports=a}));!function(e){e[e.TRTCVideoResolution_120_120=1]="TRTCVideoResolution_120_120",e[e.TRTCVideoResolution_160_160=3]="TRTCVideoResolution_160_160",e[e.TRTCVideoResolution_270_270=5]="TRTCVideoResolution_270_270",e[e.TRTCVideoResolution_480_480=7]="TRTCVideoResolution_480_480",e[e.TRTCVideoResolution_160_120=50]="TRTCVideoResolution_160_120",e[e.TRTCVideoResolution_240_180=52]="TRTCVideoResolution_240_180",e[e.TRTCVideoResolution_280_210=54]="TRTCVideoResolution_280_210",e[e.TRTCVideoResolution_320_240=56]="TRTCVideoResolution_320_240",e[e.TRTCVideoResolution_400_300=58]="TRTCVideoResolution_400_300",e[e.TRTCVideoResolution_480_360=60]="TRTCVideoResolution_480_360",e[e.TRTCVideoResolution_640_480=62]="TRTCVideoResolution_640_480",e[e.TRTCVideoResolution_960_720=64]="TRTCVideoResolution_960_720",e[e.TRTCVideoResolution_160_90=100]="TRTCVideoResolution_160_90",e[e.TRTCVideoResolution_256_144=102]="TRTCVideoResolution_256_144",e[e.TRTCVideoResolution_320_180=104]="TRTCVideoResolution_320_180",e[e.TRTCVideoResolution_480_270=106]="TRTCVideoResolution_480_270",e[e.TRTCVideoResolution_640_360=108]="TRTCVideoResolution_640_360",e[e.TRTCVideoResolution_960_540=110]="TRTCVideoResolution_960_540",e[e.TRTCVideoResolution_1280_720=112]="TRTCVideoResolution_1280_720",e[e.TRTCVideoResolution_1920_1080=114]="TRTCVideoResolution_1920_1080"}(m||(m={})),function(e){e[e.TRTCVideoStreamTypeBig=0]="TRTCVideoStreamTypeBig",e[e.TRTCVideoStreamTypeSmall=1]="TRTCVideoStreamTypeSmall",e[e.TRTCVideoStreamTypeSub=2]="TRTCVideoStreamTypeSub"}(T||(T={})),function(e){e[e.TRTCVideoFillMode_Fill=0]="TRTCVideoFillMode_Fill",e[e.TRTCVideoFillMode_Fit=1]="TRTCVideoFillMode_Fit"}(y||(y={})),function(e){e[e.TRTCVideoMirrorType_Auto=0]="TRTCVideoMirrorType_Auto",e[e.TRTCVideoMirrorType_Enable=1]="TRTCVideoMirrorType_Enable",e[e.TRTCVideoMirrorType_Disable=2]="TRTCVideoMirrorType_Disable"}(_||(_={})),function(e){e[e.TRTCBeautyStyleSmooth=0]="TRTCBeautyStyleSmooth",e[e.TRTCBeautyStyleNature=1]="TRTCBeautyStyleNature"}(R||(R={})),function(e){e[e.TRTCAppSceneVideoCall=0]="TRTCAppSceneVideoCall",e[e.TRTCAppSceneLIVE=1]="TRTCAppSceneLIVE",e[e.TRTCAppSceneAudioCall=2]="TRTCAppSceneAudioCall",e[e.TRTCAppSceneVoiceChatRoom=3]="TRTCAppSceneVoiceChatRoom"}(b||(b={})),function(e){e[e.TRTCRoleAnchor=20]="TRTCRoleAnchor",e[e.TRTCRoleAudience=21]="TRTCRoleAudience"}(C||(C={})),function(e){e[e.TRTCAudioQualitySpeech=1]="TRTCAudioQualitySpeech",e[e.TRTCAudioQualityDefault=2]="TRTCAudioQualityDefault",e[e.TRTCAudioQualityMusic=3]="TRTCAudioQualityMusic"}(S||(S={})),function(e){e[e.default=0]="default",e[e.silent=8]="silent",e[e.hifi2=18]="hifi2"}(w||(w={}));var M,A,P=function(e,t,i,o,r){void 0===e&&(e=""),void 0===t&&(t=""),void 0===i&&(i=""),void 0===o&&(o=""),void 0===r&&(r=""),this.deviceId=e,this.deviceName=t,this.kind=i,this.label=o,this.groupId=r};!function(e){e[e.TRTCDeviceStateAdd=0]="TRTCDeviceStateAdd",e[e.TRTCDeviceStateRemove=1]="TRTCDeviceStateRemove",e[e.TRTCDeviceStateActive=2]="TRTCDeviceStateActive"}(M||(M={})),function(e){e[e.TRTCDeviceTypeUnknow=-1]="TRTCDeviceTypeUnknow",e[e.TRTCDeviceTypeMic=0]="TRTCDeviceTypeMic",e[e.TRTCDeviceTypeSpeaker=1]="TRTCDeviceTypeSpeaker",e[e.TRTCDeviceTypeCamera=2]="TRTCDeviceTypeCamera"}(A||(A={}));var I,L=function(e,t,i,o,r,n,s,a,c,u,l){void 0===e&&(e=0),void 0===t&&(t=""),void 0===i&&(i=""),void 0===o&&(o=0),void 0===r&&(r=""),void 0===n&&(n=C.TRTCRoleAnchor),void 0===s&&(s=null),void 0===c&&(c=null),void 0===u&&(u=null),void 0===l&&(l=30),this.sdkAppId=e,this.userId=t,this.userSig=i,this.roomId=o,this.strRoomId=r,this.role=n,this.privateMapKey=s,this.streamId=c,this.userDefineRecordId=u,this.frameWorkType=l},V=function(e,t,i,o){void 0===e&&(e=m.TRTCVideoResolution_640_360),void 0===t&&(t=D.TRTCVideoResolutionModeLandscape),void 0===i&&(i=15),void 0===o&&(o=550),this.videoResolution=e,this.resMode=t,this.videoFps=i,this.videoBitrate=o};!function(e){e[e.TRTCVideoRotation0=0]="TRTCVideoRotation0",e[e.TRTCVideoRotation90=1]="TRTCVideoRotation90",e[e.TRTCVideoRotation180=2]="TRTCVideoRotation180",e[e.TRTCVideoRotation270=3]="TRTCVideoRotation270"}(I||(I={}));var x,O=function(e,t,i){void 0===e&&(e=I.TRTCVideoRotation0),void 0===t&&(t=y.TRTCVideoFillMode_Fit),void 0===i&&(i=_.TRTCVideoMirrorType_Disable),this.rotation=e,this.fillMode=t,this.mirrorType=i};!function(e){e[e.TRTCQuality_Unknown=0]="TRTCQuality_Unknown",e[e.TRTCQuality_Excellent=1]="TRTCQuality_Excellent",e[e.TRTCQuality_Good=2]="TRTCQuality_Good",e[e.TRTCQuality_Poor=3]="TRTCQuality_Poor",e[e.TRTCQuality_Bad=4]="TRTCQuality_Bad",e[e.TRTCQuality_Vbad=5]="TRTCQuality_Vbad",e[e.TRTCQuality_Down=6]="TRTCQuality_Down"}(x||(x={}));var D,k,B,z=function(e,t){void 0===e&&(e=""),void 0===t&&(t=x.TRTCQuality_Unknown),this.userId=e,this.quality=t},N=function(e,t){void 0===e&&(e=""),void 0===t&&(t=0),this.userId=e,this.volume=t},F=function(e,t,i){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=null),this.appId=e,this.bizId=t,this.url=i},W=function(e,t,i,o,r,n,s){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0),void 0===o&&(o=0),void 0===n&&(n=0),void 0===s&&(s=T.TRTCVideoStreamTypeBig),this.width=e,this.height=t,this.frameRate=i,this.videoBitrate=o,this.audioBitrate=n,this.streamType=s},H=function(e,t,i,o,r,n,s,a,c,u,l,h,d,p){void 0===e&&(e=""),void 0===i&&(i=0),void 0===o&&(o=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=0),void 0===p&&(p=T.TRTCVideoStreamTypeBig),this.userId=e,this.width=i,this.height=o,this.frameRate=r,this.videoBitrate=n,this.audioBitrate=a,this.streamType=p},Q=function(e,t,i,o,r,n,s,a,c,u,l){void 0===e&&(e=0),void 0===t&&(t=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===s&&(s=0),void 0===a&&(a=[]),void 0===c&&(c=0),void 0===u&&(u=[]),void 0===l&&(l=0),this.upLoss=e,this.downLoss=t,this.rtt=r,this.receivedBytes=n,this.sentBytes=s,this.localStatisticsArray=a,this.localStatisticsArraySize=c,this.remoteStatisticsArray=u,this.remoteStatisticsArraySize=l};!function(e){e[e.TRTCVideoResolutionModeLandscape=0]="TRTCVideoResolutionModeLandscape",e[e.TRTCVideoResolutionModePortrait=1]="TRTCVideoResolutionModePortrait"}(D||(D={})),function(e){e[e.TRTCVideoQosPreferenceSmooth=1]="TRTCVideoQosPreferenceSmooth",e[e.TRTCVideoQosPreferenceClear=2]="TRTCVideoQosPreferenceClear"}(k||(k={})),function(e){e[e.TRTCQosControlModeClient=0]="TRTCQosControlModeClient",e[e.TRTCQosControlModeServer=1]="TRTCQosControlModeServer"}(B||(B={}));var j,U,G=function(e,t){void 0===e&&(e=k.TRTCVideoQosPreferenceClear),void 0===t&&(t=B.TRTCQosControlModeServer),this.preference=e,this.controlMode=t},q=function(e,t,i,o){void 0===e&&(e=new ArrayBuffer(0)),void 0===t&&(t=0),void 0===i&&(i=0),void 0===o&&(o=0),this.buffer=e,this.length=t,this.width=i,this.height=o};!function(e){e[e.TRTCLogLevelVerbose=0]="TRTCLogLevelVerbose",e[e.TRTCLogLevelDebug=1]="TRTCLogLevelDebug",e[e.TRTCLogLevelInfo=2]="TRTCLogLevelInfo",e[e.TRTCLogLevelWarn=3]="TRTCLogLevelWarn",e[e.TRTCLogLevelError=4]="TRTCLogLevelError",e[e.TRTCLogLevelFatal=5]="TRTCLogLevelFatal",e[e.TRTCLogLevelNone=6]="TRTCLogLevelNone"}(j||(j={})),function(e){e[e.TRTCScreenCaptureSourceTypeUnknown=-1]="TRTCScreenCaptureSourceTypeUnknown",e[e.TRTCScreenCaptureSourceTypeWindow=0]="TRTCScreenCaptureSourceTypeWindow",e[e.TRTCScreenCaptureSourceTypeScreen=1]="TRTCScreenCaptureSourceTypeScreen",e[e.TRTCScreenCaptureSourceTypeCustom=2]="TRTCScreenCaptureSourceTypeCustom"}(U||(U={}));var Y,K=function(e,t,i,o,r,n){void 0===e&&(e=U.TRTCScreenCaptureSourceTypeUnknown),void 0===t&&(t=""),void 0===i&&(i=""),void 0===o&&(o=new q),void 0===r&&(r=new q),void 0===n&&(n=!1),this.type=e,this.sourceId=t,this.sourceName=i,this.thumbBGRA=o,this.iconBGRA=r,this.isMinimizeWindow=n},J=function(e,t,i,o){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0),void 0===o&&(o=0),this.left=e,this.top=t,this.right=i,this.bottom=o},X=function(e,t,i,o,r,n,s,a,c,u,l,h,d,p,f){void 0===e&&(e=Y.TRTCTranscodingConfigMode_Unknown),void 0===t&&(t=0),void 0===i&&(i=0),void 0===o&&(o=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===s&&(s=15),void 0===a&&(a=2),void 0===c&&(c=0),void 0===u&&(u=""),void 0===l&&(l=64),void 0===h&&(h=48e3),void 0===d&&(d=1),void 0===p&&(p=[]),void 0===f&&(f=""),this.mode=e,this.appId=t,this.bizId=i,this.videoWidth=o,this.videoHeight=r,this.videoBitrate=n,this.videoFramerate=s,this.videoGOP=a,this.backgroundColor=c,this.backgroundImage=u,this.audioSampleRate=l,this.audioBitrate=h,this.audioChannels=d,this.mixUsersArray=p,this.mixUsersArraySize=p.length,this.streamId=f};!function(e){e[e.TRTCTranscodingConfigMode_Unknown=0]="TRTCTranscodingConfigMode_Unknown",e[e.TRTCTranscodingConfigMode_Manual=1]="TRTCTranscodingConfigMode_Manual",e[e.TRTCTranscodingConfigMode_Template_PureAudio=2]="TRTCTranscodingConfigMode_Template_PureAudio",e[e.TRTCTranscodingConfigMode_Template_PresetLayout=3]="TRTCTranscodingConfigMode_Template_PresetLayout",e[e.TRTCTranscodingConfigMode_Template_ScreenSharing=4]="TRTCTranscodingConfigMode_Template_ScreenSharing",e[e.TRTC_TranscodingConfigMode_Unknown=5]="TRTC_TranscodingConfigMode_Unknown",e[e.TRTC_TranscodingConfigMode_Manual=6]="TRTC_TranscodingConfigMode_Manual",e[e.TRTC_TranscodingConfigMode_Template_PureAudio=7]="TRTC_TranscodingConfigMode_Template_PureAudio",e[e.TRTC_TranscodingConfigMode_Template_PresetLayout=8]="TRTC_TranscodingConfigMode_Template_PresetLayout",e[e.TRTC_TranscodingConfigMode_Template_ScreenSharing=9]="TRTC_TranscodingConfigMode_Template_ScreenSharing"}(Y||(Y={}));var $,Z,ee=function(e,t,i,o,r,n,s,a){void 0===e&&(e=""),void 0===t&&(t=""),void 0===i&&(i=null),void 0===o&&(o=0),void 0===r&&(r=!1),void 0===n&&(n=T.TRTCVideoStreamTypeBig),void 0===s&&(s=$.TRTCMixInputTypeUndefined),void 0===a&&(a=0),this.userId=e,this.roomId=t,this.rect=i,this.zOrder=o,this.pureAudio=r,this.streamType=n,this.inputType=s,this.renderMode=a};!function(e){e[e.TRTCMixInputTypeUndefined=0]="TRTCMixInputTypeUndefined",e[e.TRTCMixInputTypeAudioVideo=1]="TRTCMixInputTypeAudioVideo",e[e.TRTCMixInputTypePureVideo=2]="TRTCMixInputTypePureVideo",e[e.TRTCMixInputTypePureAudio=3]="TRTCMixInputTypePureAudio"}($||($={})),function(e){e[e.TRTCCameraResolutionStrategyAuto=0]="TRTCCameraResolutionStrategyAuto",e[e.TRTCCameraResolutionStrategyPerformance=1]="TRTCCameraResolutionStrategyPerformance",e[e.TRTCCameraResolutionStrategyHighQuality=2]="TRTCCameraResolutionStrategyHighQuality",e[e.TRTCCameraCaptureManual=3]="TRTCCameraCaptureManual"}(Z||(Z={}));var te,ie=function(e,t,i,o,r,n){void 0===e&&(e=!0),void 0===t&&(t=!0),void 0===i&&(i=!0),void 0===o&&(o=0),void 0===r&&(r=0),void 0===n&&(n=!1),this.enableCaptureMouse=e,this.enableHighLight=t,this.enableHighPerformance=i,this.highLightColor=o,this.highLightWidth=r,this.enableCaptureChildWindow=n},oe=void 0,re=void 0,ne="onError",se="onWarning",ae="rtc",ce="live",ue="VirtualBackground",le="BasicBeauty",he="AIDenoiser",de="blur",pe="image",fe={20:"anchor",21:"audience"},ve={0:ae,1:ce,2:ae,3:ce};!function(e){e[e.ActiveExitRoom=0]="ActiveExitRoom",e[e.KickedExitRoom=1]="KickedExitRoom"}(te||(te={}));var ge="enum";function me(){return Math.floor(performance.now())}var Te=function(e){return void 0===e},ye=function(e){return"number"==typeof e},_e=function(e){return"boolean"==typeof e};function Re(e){if("string"!=typeof e)return e;var t;try{var i=JSON.parse(e);t="object"==typeof i&&i?i:e}catch(o){t=e}return t}function be(e){return null==e}function Ce(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.reduce((function(e,t){return Object.keys(t).forEach((function(i){e[i]&&"object"==typeof e[i]?e[i]=Ce(e[i],t[i]):e[i]=t[i]})),e}),{})}function Se(e){var t=null;return e instanceof MediaStream||e instanceof MediaStreamTrack||e instanceof HTMLElement?e:([Date,RegExp,Set,WeakSet,Map,WeakMap,Error].includes(null==e?void 0:e.constructor)?t=new e.constructor(e):Array.isArray(e)?(t=[],e.forEach((function(e,i){t[i]=Se(e)}))):"object"==typeof e&&null!==e?(t={},Object.keys(e).forEach((function(i){Object.hasOwnProperty.call(e,i)&&(t[i]=Se(e[i]))}))):t=e,t)}var we,Ee,Me=function(e){return e&&e.Math===Math&&e},Ae=Me("object"==typeof globalThis&&globalThis)||Me("object"==typeof window&&window)||Me("object"==typeof self&&self)||Me("object"==typeof v&&v)||function(){return this}()||v||Function("return this")(),Pe=function(e){try{return!!e()}catch(t){return!0}},Ie=!Pe((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]})),Le=!Pe((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),Ve=Function.prototype.call,xe=Le?Ve.bind(Ve):function(){return Ve.apply(Ve,arguments)},Oe={}.propertyIsEnumerable,De=Object.getOwnPropertyDescriptor,ke={f:De&&!Oe.call({1:2},1)?function(e){var t=De(this,e);return!!t&&t.enumerable}:Oe},Be=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},ze=Function.prototype,Ne=ze.call,Fe=Le&&ze.bind.bind(Ne,Ne),We=Le?Fe:function(e){return function(){return Ne.apply(e,arguments)}},He=We({}.toString),Qe=We("".slice),je=function(e){return Qe(He(e),8,-1)},Ue=Object,Ge=We("".split),qe=Pe((function(){return!Ue("z").propertyIsEnumerable(0)}))?function(e){return"String"===je(e)?Ge(e,""):Ue(e)}:Ue,Ye=function(e){return null==e},Ke=TypeError,Je=function(e){if(Ye(e))throw Ke("Can't call method on "+e);return e},Xe=function(e){return qe(Je(e))},$e="object"==typeof document&&document.all,Ze={all:$e,IS_HTMLDDA:void 0===$e&&void 0!==$e},et=Ze.all,tt=Ze.IS_HTMLDDA?function(e){return"function"==typeof e||e===et}:function(e){return"function"==typeof e},it=Ze.all,ot=Ze.IS_HTMLDDA?function(e){return"object"==typeof e?null!==e:tt(e)||e===it}:function(e){return"object"==typeof e?null!==e:tt(e)},rt=function(e,t){return arguments.length<2?(i=Ae[e],tt(i)?i:void 0):Ae[e]&&Ae[e][t];var i},nt=We({}.isPrototypeOf),st="undefined"!=typeof navigator&&String(navigator.userAgent)||"",at=Ae.process,ct=Ae.Deno,ut=at&&at.versions||ct&&ct.version,lt=ut&&ut.v8;lt&&(Ee=(we=lt.split("."))[0]>0&&we[0]<4?1:+(we[0]+we[1])),!Ee&&st&&(!(we=st.match(/Edge\/(\d+)/))||we[1]>=74)&&(we=st.match(/Chrome\/(\d+)/))&&(Ee=+we[1]);var ht=Ee,dt=Ae.String,pt=!!Object.getOwnPropertySymbols&&!Pe((function(){var e=Symbol("symbol detection");return!dt(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&ht&&ht<41})),ft=pt&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,vt=Object,gt=ft?function(e){return"symbol"==typeof e}:function(e){var t=rt("Symbol");return tt(t)&&nt(t.prototype,vt(e))},mt=String,Tt=TypeError,yt=function(e){if(tt(e))return e;throw Tt(function(e){try{return mt(e)}catch(t){return"Object"}}(e)+" is not a function")},_t=function(e,t){var i=e[t];return Ye(i)?void 0:yt(i)},Rt=TypeError,bt=Object.defineProperty,Ct=function(e,t){try{bt(Ae,e,{value:t,configurable:!0,writable:!0})}catch(i){Ae[e]=t}return t},St="__core-js_shared__",wt=Ae[St]||Ct(St,{}),Et=g((function(e){(e.exports=function(e,t){return wt[e]||(wt[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.32.1",mode:"global",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.32.1/LICENSE",source:"https://github.com/zloirock/core-js"})})),Mt=Object,At=function(e){return Mt(Je(e))},Pt=We({}.hasOwnProperty),It=Object.hasOwn||function(e,t){return Pt(At(e),t)},Lt=0,Vt=Math.random(),xt=We(1..toString),Ot=function(e){return"Symbol("+(void 0===e?"":e)+")_"+xt(++Lt+Vt,36)},Dt=Ae.Symbol,kt=Et("wks"),Bt=ft?Dt.for||Dt:Dt&&Dt.withoutSetter||Ot,zt=function(e){return It(kt,e)||(kt[e]=pt&&It(Dt,e)?Dt[e]:Bt("Symbol."+e)),kt[e]},Nt=TypeError,Ft=zt("toPrimitive"),Wt=function(e,t){if(!ot(e)||gt(e))return e;var i,o=_t(e,Ft);if(o){if(void 0===t&&(t="default"),i=xe(o,e,t),!ot(i)||gt(i))return i;throw Nt("Can't convert object to primitive value")}return void 0===t&&(t="number"),function(e,t){var i,o;if("string"===t&&tt(i=e.toString)&&!ot(o=xe(i,e)))return o;if(tt(i=e.valueOf)&&!ot(o=xe(i,e)))return o;if("string"!==t&&tt(i=e.toString)&&!ot(o=xe(i,e)))return o;throw Rt("Can't convert object to primitive value")}(e,t)},Ht=function(e){var t=Wt(e,"string");return gt(t)?t:t+""},Qt=Ae.document,jt=ot(Qt)&&ot(Qt.createElement),Ut=function(e){return jt?Qt.createElement(e):{}},Gt=!Ie&&!Pe((function(){return 7!==Object.defineProperty(Ut("div"),"a",{get:function(){return 7}}).a})),qt=Object.getOwnPropertyDescriptor,Yt={f:Ie?qt:function(e,t){if(e=Xe(e),t=Ht(t),Gt)try{return qt(e,t)}catch(i){}if(It(e,t))return Be(!xe(ke.f,e,t),e[t])}},Kt=Ie&&Pe((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Jt=String,Xt=TypeError,$t=function(e){if(ot(e))return e;throw Xt(Jt(e)+" is not an object")},Zt=TypeError,ei=Object.defineProperty,ti=Object.getOwnPropertyDescriptor,ii="enumerable",oi="configurable",ri="writable",ni={f:Ie?Kt?function(e,t,i){if($t(e),t=Ht(t),$t(i),"function"==typeof e&&"prototype"===t&&"value"in i&&ri in i&&!i[ri]){var o=ti(e,t);o&&o[ri]&&(e[t]=i.value,i={configurable:oi in i?i[oi]:o[oi],enumerable:ii in i?i[ii]:o[ii],writable:!1})}return ei(e,t,i)}:ei:function(e,t,i){if($t(e),t=Ht(t),$t(i),Gt)try{return ei(e,t,i)}catch(o){}if("get"in i||"set"in i)throw Zt("Accessors not supported");return"value"in i&&(e[t]=i.value),e}},si=Ie?function(e,t,i){return ni.f(e,t,Be(1,i))}:function(e,t,i){return e[t]=i,e},ai=Function.prototype,ci=Ie&&Object.getOwnPropertyDescriptor,ui=It(ai,"name"),li={EXISTS:ui,PROPER:ui&&"something"===function(){}.name,CONFIGURABLE:ui&&(!Ie||Ie&&ci(ai,"name").configurable)},hi=We(Function.toString);tt(wt.inspectSource)||(wt.inspectSource=function(e){return hi(e)});var di,pi,fi,vi=wt.inspectSource,gi=Ae.WeakMap,mi=tt(gi)&&/native code/.test(String(gi)),Ti=Et("keys"),yi=function(e){return Ti[e]||(Ti[e]=Ot(e))},_i={},Ri="Object already initialized",bi=Ae.TypeError,Ci=Ae.WeakMap;if(mi||wt.state){var Si=wt.state||(wt.state=new Ci);Si.get=Si.get,Si.has=Si.has,Si.set=Si.set,di=function(e,t){if(Si.has(e))throw bi(Ri);return t.facade=e,Si.set(e,t),t},pi=function(e){return Si.get(e)||{}},fi=function(e){return Si.has(e)}}else{var wi=yi("state");_i[wi]=!0,di=function(e,t){if(It(e,wi))throw bi(Ri);return t.facade=e,si(e,wi,t),t},pi=function(e){return It(e,wi)?e[wi]:{}},fi=function(e){return It(e,wi)}}var Ei={set:di,get:pi,has:fi,enforce:function(e){return fi(e)?pi(e):di(e,{})},getterFor:function(e){return function(t){var i;if(!ot(t)||(i=pi(t)).type!==e)throw bi("Incompatible receiver, "+e+" required");return i}}},Mi=g((function(e){var t=li.CONFIGURABLE,i=Ei.enforce,o=Ei.get,r=String,n=Object.defineProperty,s=We("".slice),a=We("".replace),c=We([].join),u=Ie&&!Pe((function(){return 8!==n((function(){}),"length",{value:8}).length})),l=String(String).split("String"),h=e.exports=function(e,o,h){"Symbol("===s(r(o),0,7)&&(o="["+a(r(o),/^Symbol\(([^)]*)\)/,"$1")+"]"),h&&h.getter&&(o="get "+o),h&&h.setter&&(o="set "+o),(!It(e,"name")||t&&e.name!==o)&&(Ie?n(e,"name",{value:o,configurable:!0}):e.name=o),u&&h&&It(h,"arity")&&e.length!==h.arity&&n(e,"length",{value:h.arity});try{h&&It(h,"constructor")&&h.constructor?Ie&&n(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(p){}var d=i(e);return It(d,"source")||(d.source=c(l,"string"==typeof o?o:"")),e};Function.prototype.toString=h((function(){return tt(this)&&o(this).source||vi(this)}),"toString")})),Ai=function(e,t,i,o){o||(o={});var r=o.enumerable,n=void 0!==o.name?o.name:t;if(tt(i)&&Mi(i,n,o),o.global)r?e[t]=i:Ct(t,i);else{try{o.unsafe?e[t]&&(r=!0):delete e[t]}catch(s){}r?e[t]=i:ni.f(e,t,{value:i,enumerable:!1,configurable:!o.nonConfigurable,writable:!o.nonWritable})}return e},Pi=Math.ceil,Ii=Math.floor,Li=Math.trunc||function(e){var t=+e;return(t>0?Ii:Pi)(t)},Vi=function(e){var t=+e;return t!=t||0===t?0:Li(t)},xi=Math.max,Oi=Math.min,Di=Math.min,ki=function(e){return e>0?Di(Vi(e),9007199254740991):0},Bi=function(e){return ki(e.length)},zi=function(e){return function(t,i,o){var r,n=Xe(t),s=Bi(n),a=function(e,t){var i=Vi(e);return i<0?xi(i+t,0):Oi(i,t)}(o,s);if(e&&i!=i){for(;s>a;)if((r=n[a++])!=r)return!0}else for(;s>a;a++)if((e||a in n)&&n[a]===i)return e||a||0;return!e&&-1}},Ni={includes:zi(!0),indexOf:zi(!1)}.indexOf,Fi=We([].push),Wi=function(e,t){var i,o=Xe(e),r=0,n=[];for(i in o)!It(_i,i)&&It(o,i)&&Fi(n,i);for(;t.length>r;)It(o,i=t[r++])&&(~Ni(n,i)||Fi(n,i));return n},Hi=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Qi=Hi.concat("length","prototype"),ji={f:Object.getOwnPropertyNames||function(e){return Wi(e,Qi)}},Ui={f:Object.getOwnPropertySymbols},Gi=We([].concat),qi=rt("Reflect","ownKeys")||function(e){var t=ji.f($t(e)),i=Ui.f;return i?Gi(t,i(e)):t},Yi=function(e,t,i){for(var o=qi(t),r=ni.f,n=Yt.f,s=0;s<o.length;s++){var a=o[s];It(e,a)||i&&It(i,a)||r(e,a,n(t,a))}},Ki=/#|\.prototype\./,Ji=function(e,t){var i=$i[Xi(e)];return i===eo||i!==Zi&&(tt(t)?Pe(t):!!t)},Xi=Ji.normalize=function(e){return String(e).replace(Ki,".").toLowerCase()},$i=Ji.data={},Zi=Ji.NATIVE="N",eo=Ji.POLYFILL="P",to=Ji,io=Yt.f,oo=function(e,t){var i,o,r,n,s,a=e.target,c=e.global,u=e.stat;if(i=c?Ae:u?Ae[a]||Ct(a,{}):(Ae[a]||{}).prototype)for(o in t){if(n=t[o],r=e.dontCallGetSet?(s=io(i,o))&&s.value:i[o],!to(c?o:a+(u?".":"#")+o,e.forced)&&void 0!==r){if(typeof n==typeof r)continue;Yi(n,r)}(e.sham||r&&r.sham)&&si(n,"sham",!0),Ai(i,o,n,e)}},ro={};ro[zt("toStringTag")]="z";var no,so="[object z]"===String(ro),ao=zt("toStringTag"),co=Object,uo="Arguments"===je(function(){return arguments}()),lo=so?je:function(e){var t,i,o;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(i=function(e,t){try{return e[t]}catch(i){}}(t=co(e),ao))?i:uo?je(t):"Object"===(o=je(t))&&tt(t.callee)?"Arguments":o},ho=String,po=function(e){if("Symbol"===lo(e))throw TypeError("Cannot convert a Symbol value to a string");return ho(e)},fo=function(){var e=$t(this),t="";return e.hasIndices&&(t+="d"),e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.unicodeSets&&(t+="v"),e.sticky&&(t+="y"),t},vo=Ae.RegExp,go=Pe((function(){var e=vo("a","y");return e.lastIndex=2,null!==e.exec("abcd")})),mo=go||Pe((function(){return!vo("a","y").sticky})),To={BROKEN_CARET:go||Pe((function(){var e=vo("^r","gy");return e.lastIndex=2,null!==e.exec("str")})),MISSED_STICKY:mo,UNSUPPORTED_Y:go},yo=Object.keys||function(e){return Wi(e,Hi)},_o=Ie&&!Kt?Object.defineProperties:function(e,t){$t(e);for(var i,o=Xe(t),r=yo(t),n=r.length,s=0;n>s;)ni.f(e,i=r[s++],o[i]);return e},Ro={f:_o},bo=rt("document","documentElement"),Co="prototype",So="script",wo=yi("IE_PROTO"),Eo=function(){},Mo=function(e){return"<"+So+">"+e+"</"+So+">"},Ao=function(e){e.write(Mo("")),e.close();var t=e.parentWindow.Object;return e=null,t},Po=function(){try{no=new ActiveXObject("htmlfile")}catch(r){}var e,t,i;Po="undefined"!=typeof document?document.domain&&no?Ao(no):(t=Ut("iframe"),i="java"+So+":",t.style.display="none",bo.appendChild(t),t.src=String(i),(e=t.contentWindow.document).open(),e.write(Mo("document.F=Object")),e.close(),e.F):Ao(no);for(var o=Hi.length;o--;)delete Po[Co][Hi[o]];return Po()};_i[wo]=!0;var Io,Lo,Vo=Object.create||function(e,t){var i;return null!==e?(Eo[Co]=$t(e),i=new Eo,Eo[Co]=null,i[wo]=e):i=Po(),void 0===t?i:Ro.f(i,t)},xo=Ae.RegExp,Oo=Pe((function(){var e=xo(".","s");return!(e.dotAll&&e.exec("\n")&&"s"===e.flags)})),Do=Ae.RegExp,ko=Pe((function(){var e=Do("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")})),Bo=Ei.get,zo=Et("native-string-replace",String.prototype.replace),No=RegExp.prototype.exec,Fo=No,Wo=We("".charAt),Ho=We("".indexOf),Qo=We("".replace),jo=We("".slice),Uo=(Lo=/b*/g,xe(No,Io=/a/,"a"),xe(No,Lo,"a"),0!==Io.lastIndex||0!==Lo.lastIndex),Go=To.BROKEN_CARET,qo=void 0!==/()??/.exec("")[1];(Uo||qo||Go||Oo||ko)&&(Fo=function(e){var t,i,o,r,n,s,a,c=this,u=Bo(c),l=po(e),h=u.raw;if(h)return h.lastIndex=c.lastIndex,t=xe(Fo,h,l),c.lastIndex=h.lastIndex,t;var d=u.groups,p=Go&&c.sticky,f=xe(fo,c),v=c.source,g=0,m=l;if(p&&(f=Qo(f,"y",""),-1===Ho(f,"g")&&(f+="g"),m=jo(l,c.lastIndex),c.lastIndex>0&&(!c.multiline||c.multiline&&"\n"!==Wo(l,c.lastIndex-1))&&(v="(?: "+v+")",m=" "+m,g++),i=new RegExp("^(?:"+v+")",f)),qo&&(i=new RegExp("^"+v+"$(?!\\s)",f)),Uo&&(o=c.lastIndex),r=xe(No,p?i:c,m),p?r?(r.input=jo(r.input,g),r[0]=jo(r[0],g),r.index=c.lastIndex,c.lastIndex+=r[0].length):c.lastIndex=0:Uo&&r&&(c.lastIndex=c.global?r.index+r[0].length:o),qo&&r&&r.length>1&&xe(zo,r[0],i,(function(){for(n=1;n<arguments.length-2;n++)void 0===arguments[n]&&(r[n]=void 0)})),r&&d)for(r.groups=s=Vo(null),n=0;n<d.length;n++)s[(a=d[n])[0]]=r[a[1]];return r});var Yo=Fo;oo({target:"RegExp",proto:!0,forced:/./.exec!==Yo},{exec:Yo});var Ko="\t\n\v\f\r \u2028\u2029\ufeff",Jo=We("".replace),Xo=RegExp("^["+Ko+"]+"),$o=RegExp("(^|[^"+Ko+"])["+Ko+"]+$"),Zo=function(e){return function(t){var i=po(Je(t));return 1&e&&(i=Jo(i,Xo,"")),2&e&&(i=Jo(i,$o,"$1")),i}},er={start:Zo(1),end:Zo(2),trim:Zo(3)}.trim,tr=We("".charAt),ir=Ae.parseFloat,or=Ae.Symbol,rr=or&&or.iterator,nr=1/ir(Ko+"-0")!=-Infinity||rr&&!Pe((function(){ir(Object(rr))}))?function(e){var t=er(po(e)),i=ir(t);return 0===i&&"-"===tr(t,0)?-0:i}:ir;oo({global:!0,forced:parseFloat!==nr},{parseFloat:nr});var sr=function(e){if("Function"===je(e))return We(e)},ar=zt("species"),cr=RegExp.prototype,ur=We("".charAt),lr=We("".charCodeAt),hr=We("".slice),dr=function(e){return function(t,i){var o,r,n=po(Je(t)),s=Vi(i),a=n.length;return s<0||s>=a?e?"":void 0:(o=lr(n,s))<55296||o>56319||s+1===a||(r=lr(n,s+1))<56320||r>57343?e?ur(n,s):o:e?hr(n,s,s+2):r-56320+(o-55296<<10)+65536}},pr={codeAt:dr(!1),charAt:dr(!0)}.charAt,fr=function(e,t,i){return t+(i?pr(e,t).length:1)},vr=TypeError,gr=function(e,t){var i=e.exec;if(tt(i)){var o=xe(i,e,t);return null!==o&&$t(o),o}if("RegExp"===je(e))return xe(Yo,e,t);throw vr("RegExp#exec called on incompatible receiver")};!function(e,t,i,o){var r=zt(e),n=!Pe((function(){var t={};return t[r]=function(){return 7},7!==""[e](t)})),s=n&&!Pe((function(){var t=!1,i=/a/;return"split"===e&&((i={}).constructor={},i.constructor[ar]=function(){return i},i.flags="",i[r]=/./[r]),i.exec=function(){return t=!0,null},i[r](""),!t}));if(!n||!s||i){var a=sr(/./[r]),c=t(r,""[e],(function(e,t,i,o,r){var s=sr(e),c=t.exec;return c===Yo||c===cr.exec?n&&!r?{done:!0,value:a(t,i,o)}:{done:!0,value:s(i,t,o)}:{done:!1}}));Ai(String.prototype,e,c[0]),Ai(cr,r,c[1])}o&&si(cr[r],"sham",!0)}("match",(function(e,t,i){return[function(t){var i=Je(this),o=Ye(t)?void 0:_t(t,e);return o?xe(o,t,i):new RegExp(t)[e](po(i))},function(e){var o=$t(this),r=po(e),n=i(t,o,r);if(n.done)return n.value;if(!o.global)return gr(o,r);var s=o.unicode;o.lastIndex=0;for(var a,c=[],u=0;null!==(a=gr(o,r));){var l=po(a[0]);c[u]=l,""===l&&(o.lastIndex=fr(r,ki(o.lastIndex),s)),u++}return 0===u?null:c}]}));var mr=Array.isArray||function(e){return"Array"===je(e)},Tr=TypeError,yr=function(e){if(e>9007199254740991)throw Tr("Maximum allowed index exceeded");return e},_r=function(e,t,i){var o=Ht(t);o in e?ni.f(e,o,Be(0,i)):e[o]=i},Rr=function(){},br=[],Cr=rt("Reflect","construct"),Sr=/^\s*(?:class|function)\b/,wr=We(Sr.exec),Er=!Sr.exec(Rr),Mr=function(e){if(!tt(e))return!1;try{return Cr(Rr,br,e),!0}catch(t){return!1}},Ar=function(e){if(!tt(e))return!1;switch(lo(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Er||!!wr(Sr,vi(e))}catch(t){return!0}};Ar.sham=!0;var Pr,Ir=!Cr||Pe((function(){var e;return Mr(Mr.call)||!Mr(Object)||!Mr((function(){e=!0}))||e}))?Ar:Mr,Lr=zt("species"),Vr=Array,xr=function(e,t){return new(function(e){var t;return mr(e)&&(t=e.constructor,(Ir(t)&&(t===Vr||mr(t.prototype))||ot(t)&&null===(t=t[Lr]))&&(t=void 0)),void 0===t?Vr:t}(e))(0===t?0:t)},Or=zt("species"),Dr=zt("isConcatSpreadable"),kr=ht>=51||!Pe((function(){var e=[];return e[Dr]=!1,e.concat()[0]!==e})),Br=function(e){if(!ot(e))return!1;var t=e[Dr];return void 0!==t?!!t:mr(e)};oo({target:"Array",proto:!0,arity:1,forced:!(kr&&(Pr="concat",ht>=51||!Pe((function(){var e=[];return(e.constructor={})[Or]=function(){return{foo:1}},1!==e[Pr](Boolean).foo}))))},{concat:function(e){var t,i,o,r,n,s=At(this),a=xr(s,0),c=0;for(t=-1,o=arguments.length;t<o;t++)if(Br(n=-1===t?s:arguments[t]))for(r=Bi(n),yr(c+r),i=0;i<r;i++,c++)i in n&&_r(a,c,n[i]);else yr(c+1),_r(a,c++,n);return a.length=c,a}});var zr=window.navigator&&window.navigator.userAgent||"",Nr=/AppleWebKit\/([\d.]+)/i.exec(zr);Nr&&parseFloat(Nr.pop());var Fr=/iPad/i.test(zr),Wr=/iPhone/i.test(zr)&&!Fr,Hr=/iPod/i.test(zr),Qr=Wr||Fr||Hr,jr=/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i.test(zr);Qr&&function(){var e=zr.match(/OS (\d+)_/i);e&&e[1]&&e[1]}();var Ur=/Android/i.test(zr);Ur&&function(){var e=zr.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!e)return null;var t=e[1]&&parseFloat(e[1]),i=e[2]&&parseFloat(e[2]);t&&i&&parseFloat("".concat(e[1],".").concat(e[2]))}();Ur&&/webkit/i.test(zr),/Firefox/i.test(zr)&&function(){var e=zr.match(/Firefox\/(\d+)/);e&&e[1]&&parseFloat(e[1])}();var Gr=/Edge\//i.test(zr);Gr&&function(){var e=zr.match(/Edge\/(\d+)/i);if(e&&e[1])e[1]}();var qr=/Edg\//i.test(zr);qr&&function(){var e=zr.match(/Edg\/(\d+)/);e&&e[1]&&parseFloat(e[1])}();var Yr=/SogouMobileBrowser\//i.test(zr);Yr&&function(){var e=zr.match(/SogouMobileBrowser\/(\d+)/);e&&e[1]&&parseFloat(e[1])}();var Kr=/MetaSr\s/i.test(zr);Kr&&function(){var e=zr.match(/MetaSr(\s\d+(\.\d+)+)/);e&&e[1]&&parseFloat(e[1])}();var Jr=/TBS\/\d+/i.test(zr);Jr&&function(){var e=zr.match(/TBS\/(\d+)/i);if(e&&e[1])e[1]}();var Xr=/XWEB\/\d+/i.test(zr);Xr&&function(){var e=zr.match(/XWEB\/(\d+)/i);if(e&&e[1])e[1]}(),/MSIE\s8\.0/.test(zr),/MSIE\/\d+/i.test(zr)&&function(){var e=/MSIE\s(\d+)\.\d/.exec(zr),t=e&&parseFloat(e[1]);!t&&/Trident\/7.0/i.test(zr)&&/rv:11.0/.test(zr)&&(t=11)}(),/(micromessenger|webbrowser)/i.test(zr)&&function(){var e=zr.match(/MicroMessenger\/(\d+)/i);if(e&&e[1])e[1]}();var $r=!Jr&&/MQQBrowser\/\d+/i.test(zr)&&/COVC\/\d+/i.test(zr),Zr=!Jr&&/MQQBrowser\/\d+/i.test(zr)&&!/COVC\/\d+/i.test(zr);(Zr||$r)&&function(){var e=zr.match(/ MQQBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var en=!Jr&&/ QQBrowser\/\d+/i.test(zr);en&&function(){var e=zr.match(/ QQBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var tn=!Jr&&/QQBrowserLite\/\d+/i.test(zr);tn&&function(){var e=zr.match(/QQBrowserLite\/([\d.]+)/);e&&e[1]&&e[1]}();var on=!Jr&&/MQBHD\/\d+/i.test(zr);on&&function(){var e=zr.match(/MQBHD\/([\d.]+)/);e&&e[1]&&e[1]}(),/Windows/i.test(zr),!Qr&&/MAC OS X/i.test(zr),!Ur&&/Linux/i.test(zr),/MicroMessenger/i.test(zr),/UCBrowser/i.test(zr),/Electron/i.test(zr);var rn=/MiuiBrowser/i.test(zr);rn&&function(){var e=zr.match(/MiuiBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var nn=/HuaweiBrowser/i.test(zr);/Huawei/i.test(zr),nn&&function(){var e=zr.match(/HuaweiBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var sn=/SamsungBrowser/i.test(zr);sn&&function(){var e=zr.match(/SamsungBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var an=/HeyTapBrowser/i.test(zr);an&&function(){var e=zr.match(/HeyTapBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var cn=/VivoBrowser/i.test(zr);cn&&function(){var e=zr.match(/VivoBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var un,ln,hn,dn=/Chrome/i.test(zr),pn=!Gr&&!Kr&&!Yr&&!Jr&&!Xr&&!qr&&!en&&!rn&&!nn&&!sn&&!an&&!cn&&/Chrome/i.test(zr);pn&&function(){var e=zr.match(/Chrome\/(\d+)/);e&&e[1]&&parseFloat(e[1])}(),pn&&function(){var e=zr.match(/Chrome\/([\d.]+)/);e&&e[1]&&e[1]}(),!dn&&!Zr&&!$r&&!tn&&!on&&/Safari/i.test(zr)&&function(){var e=zr.match(/Version\/([\d.]+)/);e&&e[1]&&e[1]}(),"file:"===location.protocol||"localhost"===location.hostname||/^\d+\.\d+\.\d+\.\d+$/.test(location.hostname),function(e){e.LIVE="live",e.RTC="rtc"}(un||(un={})),function(e){e.CONTAIN="contain",e.COVER="cover",e.FILL="fill"}(ln||(ln={})),function(e){e[e.exitRoom=0]="exitRoom",e[e.banned=1]="banned",e[e.roomDisband=2]="roomDisband"}(hn||(hn={}));var fn,vn,gn,mn=-3340,Tn=-1301,yn=-1314,_n=-1315,Rn=-1316,bn=-1302,Cn=-1317,Sn=-1318,wn=-1319,En=-1308,Mn=-102015,An=-70252,Pn={code:-1001,message:"参数错误, 请检查参数格式、是否非空等"},In={code:-1005,message:"not supported"},Ln="2.12.2-beta.26";!function(e){e[e.Success=0]="Success",e[e.Error=-1]="Error",e[e.InvalidParams=-2]="InvalidParams",e[e.NotFoundSource=-3]="NotFoundSource",e[e.ImageSourceLoadFailed=-4]="ImageSourceLoadFailed",e[e.CameraNotAuthorized=-5]="CameraNotAuthorized",e[e.CameraIsOccupied=-6]="CameraIsOccupied",e[e.CameraDisconnected=-7]="CameraDisconnected"}(fn||(fn={})),function(e){e[e.kCamera=0]="kCamera",e[e.kScreen=1]="kScreen",e[e.kImage=2]="kImage",e[e.kPhoneMirror=4]="kPhoneMirror",e[e.kText=5]="kText",e[e.kVideo=6]="kVideo"}(vn||(vn={})),function(e){e.onSourceSelected="onSourceSelected",e.onSourceMoved="onSourceMoved",e.onSourceResized="onSourceResized",e.onRightButtonClicked="onRightButtonClicked",e.onError="onError",e.onSourcePlugged="onSourcePlugged",e.onSourceConnected="onSourceConnected",e.onSourceDisconnected="onSourceDisconnected",e.onSourceUnplugged="onSourceUnplugged",e.onMediaSourceSizeChanged="onMediaSourceSizeChanged"}(gn||(gn={}));var Vn,xn=void 0,On=void 0,Dn=void 0,kn=void 0,Bn=void 0,zn=function(){function e(e,t){if(this.logRegion="tc",this.loggerManager=e,t){var i=t.sdkAppId,o=t.userId,r=t.seq;this.seq=r,e&&(this.logger=e.createLogger({id:"".concat(this.logRegion).concat(r),userId:o,sdkAppId:i}))}else this.logger=e;this.logger||(this.logger={debug:function(e){console.debug(e)},info:function(e){console.info(e)},warn:function(e){console.warn(e)},error:function(e){console.error(e)}})}return e.prototype.getLogMessage=function(e){var t=this;return e.map((function(e){return t.getStringifyMessage(e)})).join(" ")},e.prototype.getStringifyMessage=function(e){var t=this;if("object"!=typeof e)return e;if(e instanceof HTMLElement)return"".concat(e.tagName.toLocaleLowerCase(),"#").concat(e.id);if(e instanceof Array){var i=[];return Object.keys(e).forEach((function(o){return i[o]=t.getStringifyMessage(e[o])})),JSON.stringify(i)}if(e instanceof Object){var o={};return Object.keys(e).forEach((function(i){return o[i]=t.getStringifyMessage(e[i])})),JSON.stringify(o)}return e},e.prototype.update=function(e){var t=e.userId,i=e.sdkAppId;this.loggerManager&&this.loggerManager.createLogger&&(this.logger=this.loggerManager.createLogger({id:"".concat(this.logRegion).concat(this.seq),userId:t,sdkAppId:i}))},e.prototype.log=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=this.getLogMessage(e);this.logger&&this.logger.info&&this.logger.info(i)},e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=this.getLogMessage(e);this.logger.debug(i)},e.prototype.info=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=this.getLogMessage(e);this.logger&&this.logger.info&&this.logger.info(i)},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=this.getLogMessage(e);this.logger&&this.logger.warn&&this.logger.warn(i)},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=this.getLogMessage(e);this.logger&&this.logger.error&&this.logger.error(i)},e}(),Nn=new zn(null),Fn=function(){function e(e,t,i){void 0===i&&(i={calcPositionOnly:!1,canExceedContainer:!1}),this.logPrefix="[Movable]",this.movable=null,this.container=null,this.options={calcPositionOnly:!1,canExceedContainer:!1},this.callbacksMap=new Map,this.enabled=!0,this.originLeft=0,this.originTop=0,this.moveStartOfLeft=0,this.moveStartOfTop=0,this.movable=e,this.container=t||document.body,this.options={calcPositionOnly:!!i.calcPositionOnly||!1,canExceedContainer:!!i.canExceedContainer||!1},this.setStyle(),this.onMouseDown=this.onMouseDown.bind(this),this.onMouseMove=this.onMouseMove.bind(this),this.onMouseUp=this.onMouseUp.bind(this),this.onMouseMove5px=this.onMouseMove5px.bind(this),this.onMouseUp5px=this.onMouseUp5px.bind(this),this.movable.addEventListener("mousedown",this.onMouseDown,!1)}return e.prototype.setStyle=function(){this.movable?(this.movable.style.position="absolute",this.movable.style.cursor="move"):Nn.debug("".concat(this.logPrefix,"setStyle 'movable' is null"))},e.prototype.onMouseDown=function(e){if(this.enabled&&0===e.button){if(e.preventDefault(),document.defaultView&&this.movable){var t=document.defaultView.getComputedStyle(this.movable);this.originLeft=window.parseInt(t.left),this.originTop=window.parseInt(t.top)}else Nn.debug("".concat(this.logPrefix,"onMouseDown 'movable' is null"));this.moveStartOfLeft=e.screenX,this.moveStartOfTop=e.screenY,document.addEventListener("mousemove",this.onMouseMove5px,!1),document.addEventListener("mouseup",this.onMouseUp5px,!1)}},e.prototype.onMouseMove5px=function(e){var t=e.screenX-(this.moveStartOfLeft||0),i=e.screenY-(this.moveStartOfTop||0);Math.abs(t)>=5||Math.abs(i)>=5?(document.removeEventListener("mousemove",this.onMouseMove5px,!1),document.removeEventListener("mouseup",this.onMouseUp5px,!1),document.addEventListener("mousemove",this.onMouseMove,!1),document.addEventListener("mouseup",this.onMouseUp,!1)):Nn.debug("".concat(this.logPrefix,"on Movable mouse move less than 5px"))},e.prototype.onMouseUp5px=function(){document.removeEventListener("mousemove",this.onMouseMove5px,!1),document.removeEventListener("mouseup",this.onMouseUp5px,!1)},e.prototype.onMouseMove=function(e){if(this.movable&&this.container){var t=e.screenX-this.moveStartOfLeft,i=e.screenY-this.moveStartOfTop,o=this.originLeft+t,r=this.originTop+i,n=this.movable.offsetWidth,s=this.movable.offsetHeight,a=this.container.offsetWidth,c=this.container.offsetHeight;this.options.canExceedContainer||(o<0?o=0:o>a-n&&(o=a-n),r<0?r=0:r>c-s&&(r=c-s)),!this.options.calcPositionOnly&&this.movable&&(this.movable.style.left="".concat(o,"px"),this.movable.style.top="".concat(r,"px")),this.emit("move",o,r)}else Nn.debug("".concat(this.logPrefix,"onMouseMove error:No 'movable' and 'container'."))},e.prototype.onMouseUp=function(){document.removeEventListener("mousemove",this.onMouseMove,!1),document.removeEventListener("mouseup",this.onMouseUp,!1),this.originLeft=0,this.originTop=0,this.moveStartOfLeft=0,this.moveStartOfTop=0},e.prototype.on=function(e,t){var i=this.callbacksMap.get(e);i?i.push(t):this.callbacksMap.set(e,[t])},e.prototype.off=function(e,t){var i=this.callbacksMap.get(e);i&&(i=i.filter((function(e){return e!=t})),this.callbacksMap.set(e,i))},e.prototype.emit=function(e){for(var t=[],i=1;i<arguments.length;i++)t[i-1]=arguments[i];var o=this.callbacksMap.get(e);o&&o.forEach((function(e){try{e.apply(null,t)}catch(i){console.error("[Movable]emit error:",e,i)}}))},e.prototype.destroy=function(){var e;null===(e=this.movable)||void 0===e||e.removeEventListener("mousedown",this.onMouseDown,!1),this.callbacksMap.clear(),this.movable=null,this.container=null},e.prototype.setEnabled=function(e){Nn.debug("".concat(this.logPrefix,"setEnabled: ").concat(this.enabled," -> ").concat(e)),this.enabled=e,this.movable&&(this.movable.style.cursor=e?"move":"default",Nn.debug("".concat(this.logPrefix,"setEnabled: cursor updated to '").concat(e?"move":"default","'")))},e.prototype.isEnabled=function(){return this.enabled},e}();!function(e){e[e.Both=0]="Both",e[e.Corner=1]="Corner",e[e.Edge=2]="Edge"}(Vn||(Vn={}));var Wn="trtc-resizable-top-left-anchor",Hn="trtc-resizable-top-anchor",Qn="trtc-resizable-top-right-anchor",jn="trtc-resizable-left-anchor",Un="trtc-resizable-right-anchor",Gn="trtc-resizable-bottom-left-anchor",qn="trtc-resizable-bottom-anchor",Yn="trtc-resizable-bottom-right-anchor",Kn={resizeAnchor:{position:"absolute",width:"".concat(8,"px"),height:"".concat(8,"px"),border:"1px solid #3D7EFD",backgroundColor:"#FFFFFF"},topLeftAnchor:{top:"-".concat(4,"px"),left:"-".concat(4,"px"),cursor:"nw-resize"},topAnchor:{top:"-".concat(4,"px"),left:"calc(50% - ".concat(4,"px)"),cursor:"n-resize"},topRightAnchor:{top:"-".concat(4,"px"),right:"-".concat(4,"px"),cursor:"ne-resize"},leftAnchor:{top:"calc(50% - ".concat(4,"px)"),left:"-".concat(4,"px"),cursor:"w-resize"},rightAnchor:{top:"calc(50% - ".concat(4,"px)"),right:"-".concat(4,"px"),cursor:"e-resize"},bottomLeftAnchor:{bottom:"-".concat(4,"px"),left:"-".concat(4,"px"),cursor:"sw-resize"},bottomAnchor:{bottom:"-".concat(4,"px"),left:"calc(50% - ".concat(4,"px)"),cursor:"s-resize"},bottomRightAnchor:{bottom:"-".concat(4,"px"),right:"-".concat(4,"px"),cursor:"se-resize"}};function Jn(e,t){for(var i in t)e.style[i]=t[i]}var Xn,$n=function(){function e(e,t,i){void 0===i&&(i={keepRatio:!1,stopPropagation:!1,anchorMode:Vn.Both,canExceedContainer:!1}),this.logPrefix="[Resizable]",this.container=null,this.options={keepRatio:!1,stopPropagation:!1,anchorMode:Vn.Both,canExceedContainer:!1},this.callbacksMap=new Map,this.topLeftAnchor=null,this.topAnchor=null,this.topRightAnchor=null,this.leftAnchor=null,this.rightAnchor=null,this.bottomLeftAnchor=null,this.bottomAnchor=null,this.bottomRightAnchor=null,this.currentAnchor=null,this.resizeStartLeft=0,this.resizeStartTop=0,this.originLeft=0,this.originTop=0,this.originWidth=0,this.originHeight=0,this.resizeTarget=e,this.container=t||document.body,this.options={keepRatio:!!i.keepRatio||!1,stopPropagation:!!i.stopPropagation||!1,anchorMode:i.anchorMode||Vn.Both,canExceedContainer:!!i.canExceedContainer||!1},this.mousedown=this.mousedown.bind(this),this.mousemove=this.mousemove.bind(this),this.mouseup=this.mouseup.bind(this),this.currentAnchor=null,this.createResizeAnchor(),this.resizeTarget.classList.add("trtc-resizable"),this.resizeTarget.style.position="absolute",this.resizeTarget.style.border="1px solid #3D7EFD",this.resizeTarget.style.boxSizing="border-box",this.initResizeEvent()}return e.prototype.createResizeAnchor=function(){var e,t,i,o,r,n,s,a,c=document.createElement("div");c.className="trtc-resizable-resize-anchor ".concat(Wn),Jn(c,Object.assign({},Kn.resizeAnchor,Kn.topLeftAnchor)),this.topLeftAnchor=c;var u=document.createElement("div");u.className="trtc-resizable-resize-anchor ".concat(Hn),Jn(u,Object.assign({},Kn.resizeAnchor,Kn.topAnchor)),this.topAnchor=u;var l=document.createElement("div");l.className="trtc-resizable-resize-anchor ".concat(Qn),Jn(l,Object.assign({},Kn.resizeAnchor,Kn.topRightAnchor)),this.topRightAnchor=l;var h=document.createElement("div");h.className="trtc-resizable-resize-anchor ".concat(jn),Jn(h,Object.assign({},Kn.resizeAnchor,Kn.leftAnchor)),this.leftAnchor=h;var d=document.createElement("div");d.className="trtc-resizable-resize-anchor ".concat(Un),Jn(d,Object.assign({},Kn.resizeAnchor,Kn.rightAnchor)),this.rightAnchor=d;var p=document.createElement("div");p.className="trtc-resizable-resize-anchor ".concat(Gn),Jn(p,Object.assign({},Kn.resizeAnchor,Kn.bottomLeftAnchor)),this.bottomLeftAnchor=p;var f=document.createElement("div");f.className="trtc-resizable-resize-anchor ".concat(qn),Jn(f,Object.assign({},Kn.resizeAnchor,Kn.bottomAnchor)),this.bottomAnchor=f;var v=document.createElement("div");v.className="trtc-resizable-resize-anchor ".concat(Yn),Jn(v,Object.assign({},Kn.resizeAnchor,Kn.bottomRightAnchor)),this.bottomRightAnchor=v,this.options.anchorMode!==Vn.Both&&this.options.anchorMode!==Vn.Edge||(null===(e=this.resizeTarget)||void 0===e||e.appendChild(u),null===(t=this.resizeTarget)||void 0===t||t.appendChild(h),null===(i=this.resizeTarget)||void 0===i||i.appendChild(d),null===(o=this.resizeTarget)||void 0===o||o.appendChild(f)),this.options.anchorMode!==Vn.Both&&this.options.anchorMode!==Vn.Corner||(null===(r=this.resizeTarget)||void 0===r||r.appendChild(c),null===(n=this.resizeTarget)||void 0===n||n.appendChild(l),null===(s=this.resizeTarget)||void 0===s||s.appendChild(p),null===(a=this.resizeTarget)||void 0===a||a.appendChild(v))},e.prototype.initResizeEvent=function(){var e,t,i,o,r,n,s,a;null===(e=this.topLeftAnchor)||void 0===e||e.addEventListener("mousedown",this.mousedown,!1),null===(t=this.topAnchor)||void 0===t||t.addEventListener("mousedown",this.mousedown,!1),null===(i=this.topRightAnchor)||void 0===i||i.addEventListener("mousedown",this.mousedown,!1),null===(o=this.leftAnchor)||void 0===o||o.addEventListener("mousedown",this.mousedown,!1),null===(r=this.rightAnchor)||void 0===r||r.addEventListener("mousedown",this.mousedown,!1),null===(n=this.bottomLeftAnchor)||void 0===n||n.addEventListener("mousedown",this.mousedown,!1),null===(s=this.bottomAnchor)||void 0===s||s.addEventListener("mousedown",this.mousedown,!1),null===(a=this.bottomRightAnchor)||void 0===a||a.addEventListener("mousedown",this.mousedown,!1)},e.prototype.mousedown=function(e){if(0===e.button){if(e.preventDefault(),this.options.stopPropagation&&e.stopPropagation(),this.currentAnchor=e.target,this.resizeStartLeft=e.screenX,this.resizeStartTop=e.screenY,document.defaultView&&this.resizeTarget){var t=document.defaultView.getComputedStyle(this.resizeTarget);this.originTop=window.parseInt(t.top),this.originLeft=window.parseInt(t.left),this.originWidth=this.resizeTarget.offsetWidth,this.originHeight=this.resizeTarget.offsetHeight,Nn.debug("resize origin:",this.originTop,this.originLeft,this.originWidth,this.originHeight)}else Nn.debug("".concat(this.logPrefix,"mouseDown 'resizeTarget' is null"));document.addEventListener("mousemove",this.mousemove,!1),document.addEventListener("mouseup",this.mouseup,!1)}},e.prototype.mousemove=function(e){if(this.container&&this.resizeTarget&&this.currentAnchor){var t,i=this.currentAnchor.classList[1],o=this.originLeft,r=this.originTop,n=this.originWidth,s=this.originHeight;switch(i){case Wn:r=(t=this._resizeTop(e)).top,s=t.height,o=(t=this._resizeLeft(e)).left,n=t.width,this.options.keepRatio&&(n/this.originWidth<s/this.originHeight?(s=n*this.originHeight/this.originWidth,r=this.originTop+this.originHeight-s):(n=s*this.originWidth/this.originHeight,o=this.originLeft+this.originWidth-n));break;case Hn:r=(t=this._resizeTop(e)).top,s=t.height,this.options.keepRatio&&((n=this.originWidth*s/this.originHeight)<20?(n=20,s=this.originHeight*n/this.originWidth,r=this.originTop+this.originHeight-s):!this.options.canExceedContainer&&n>this.container.offsetWidth-this.originLeft&&(n=this.container.offsetWidth-this.originLeft,s=this.originHeight*n/this.originWidth,r=this.originTop+this.originHeight-s));break;case Qn:r=(t=this._resizeTop(e)).top,s=t.height,n=this._resizeRight(e),this.options.keepRatio&&(n/this.originWidth<s/this.originHeight?(s=n*this.originHeight/this.originWidth,r=this.originTop+this.originHeight-s):n=s*this.originWidth/this.originHeight);break;case jn:o=(t=this._resizeLeft(e)).left,n=t.width,this.options.keepRatio&&((s=this.originHeight*n/this.originWidth)<20?(s=20,n=this.originWidth*s/this.originHeight,o=this.originLeft+this.originWidth-n):!this.options.canExceedContainer&&s>this.container.offsetHeight-this.originTop&&(s=this.container.offsetHeight-this.originTop,n=this.originWidth*s/this.originHeight,o=this.originLeft+this.originWidth-n));break;case Un:n=this._resizeRight(e),this.options.keepRatio&&((s=n*this.originHeight/this.originWidth)<20?n=(s=20)*this.originWidth/this.originHeight:!this.options.canExceedContainer&&s>this.container.offsetHeight-this.originTop&&(n=(s=this.container.offsetHeight-this.originTop)*this.originWidth/this.originHeight));break;case Gn:s=this._resizeBottom(e),o=(t=this._resizeLeft(e)).left,n=t.width,this.options.keepRatio&&(n/this.originWidth<s/this.originHeight?s=n*this.originHeight/this.originWidth:(n=s*this.originWidth/this.originHeight,o=this.originLeft+this.originWidth-n));break;case qn:s=this._resizeBottom(e),this.options.keepRatio&&((n=s*this.originWidth/this.originHeight)<20?s=(n=20)*this.originHeight/this.originWidth:!this.options.canExceedContainer&&n>this.container.offsetWidth-this.originLeft&&(s=(n=this.container.offsetWidth-this.originLeft)*this.originHeight/this.originWidth));break;case Yn:s=this._resizeBottom(e),n=this._resizeRight(e),this.options.keepRatio&&(n/this.originWidth<s/this.originHeight?s=n*this.originHeight/this.originWidth:n=s*this.originWidth/this.originHeight)}this.resizeTarget.style.left="".concat(o,"px"),this.resizeTarget.style.top="".concat(r,"px"),this.resizeTarget.style.height="".concat(s,"px"),this.resizeTarget.style.width="".concat(n,"px"),this.emit("resize",o,r,n,s)}else Nn.debug("".concat(this.logPrefix,"mouseMove error. No valid inner info:"),this.container,this.resizeTarget,this.currentAnchor)},e.prototype._resizeLeft=function(e){var t=e.screenX-this.resizeStartLeft,i=this.originLeft+t,o=this.originWidth-t;return!this.options.canExceedContainer&&i<0?(i=0,o=this.originWidth+this.originLeft):i>this.originLeft+this.originWidth-20&&(i=this.originLeft+this.originWidth-20,o=20),{left:i,width:o}},e.prototype._resizeTop=function(e){var t=e.screenY-this.resizeStartTop,i=this.originTop+t,o=this.originHeight-t;return!this.options.canExceedContainer&&i<0?(i=0,o=this.originHeight+this.originTop):i>this.originTop+this.originHeight-20&&(i=this.originTop+this.originHeight-20,o=20),{top:i,height:o}},e.prototype._resizeRight=function(e){if(!this.container)return Nn.debug("".concat(this.logPrefix,"_resizeRight error. No container:"),this.container),0;var t=e.screenX-this.resizeStartLeft,i=this.originWidth+t;return i<20?i=20:!this.options.canExceedContainer&&i>this.container.offsetWidth-this.originLeft&&(i=this.container.offsetWidth-this.originLeft),i},e.prototype._resizeBottom=function(e){if(!this.container)return Nn.debug("".concat(this.logPrefix,"_resizeBottom error. No container:"),this.container),0;var t=e.screenY-this.resizeStartTop,i=this.originHeight+t;return i<20?i=20:!this.options.canExceedContainer&&i>this.container.offsetHeight-this.originTop&&(i=this.container.offsetHeight-this.originTop),i},e.prototype.mouseup=function(){document.removeEventListener("mousemove",this.mousemove,!1),document.removeEventListener("mouseup",this.mouseup,!1),this.currentAnchor=null,this.resizeStartLeft=0,this.resizeStartTop=0,this.originLeft=0,this.originTop=0,this.originWidth=0,this.originHeight=0},e.prototype.on=function(e,t){var i=this.callbacksMap.get(e);i?i.push(t):this.callbacksMap.set(e,[t])},e.prototype.off=function(e,t){var i=this.callbacksMap.get(e);i&&(i=i.filter((function(e){return e!=t})),this.callbacksMap.set(e,i))},e.prototype.emit=function(e){for(var t=[],i=1;i<arguments.length;i++)t[i-1]=arguments[i];var o=this.callbacksMap.get(e);o&&o.slice().forEach((function(e){try{e.apply(null,t)}catch(i){console.error("[Resizable]emit error:",e,i)}}))},e.prototype.destroy=function(){var e,t,i,o,r,n,s,a,c,u,l,h,d,p,f,v;null===(e=this.topLeftAnchor)||void 0===e||e.removeEventListener("mousedown",this.mousedown,!1),null===(t=this.topAnchor)||void 0===t||t.removeEventListener("mousedown",this.mousedown,!1),null===(i=this.topRightAnchor)||void 0===i||i.removeEventListener("mousedown",this.mousedown,!1),null===(o=this.leftAnchor)||void 0===o||o.removeEventListener("mousedown",this.mousedown,!1),null===(r=this.rightAnchor)||void 0===r||r.removeEventListener("mousedown",this.mousedown,!1),null===(n=this.bottomLeftAnchor)||void 0===n||n.removeEventListener("mousedown",this.mousedown,!1),null===(s=this.bottomAnchor)||void 0===s||s.removeEventListener("mousedown",this.mousedown,!1),null===(a=this.bottomRightAnchor)||void 0===a||a.removeEventListener("mousedown",this.mousedown,!1),this.callbacksMap.clear(),this.options.anchorMode!==Vn.Both&&this.options.anchorMode!==Vn.Edge||(this.topAnchor&&(null===(c=this.resizeTarget)||void 0===c||c.removeChild(this.topAnchor)),this.leftAnchor&&(null===(u=this.resizeTarget)||void 0===u||u.removeChild(this.leftAnchor)),this.rightAnchor&&(null===(l=this.resizeTarget)||void 0===l||l.removeChild(this.rightAnchor)),this.bottomAnchor&&(null===(h=this.resizeTarget)||void 0===h||h.removeChild(this.bottomAnchor))),this.options.anchorMode!==Vn.Both&&this.options.anchorMode!==Vn.Corner||(this.topLeftAnchor&&(null===(d=this.resizeTarget)||void 0===d||d.removeChild(this.topLeftAnchor)),this.topRightAnchor&&(null===(p=this.resizeTarget)||void 0===p||p.removeChild(this.topRightAnchor)),this.bottomLeftAnchor&&(null===(f=this.resizeTarget)||void 0===f||f.removeChild(this.bottomLeftAnchor)),this.bottomRightAnchor&&(null===(v=this.resizeTarget)||void 0===v||v.removeChild(this.bottomRightAnchor))),this.topLeftAnchor=null,this.topAnchor=null,this.topRightAnchor=null,this.leftAnchor=null,this.rightAnchor=null,this.bottomLeftAnchor=null,this.bottomAnchor=null,this.bottomRightAnchor=null,this.resizeTarget=null,this.container=null,this.currentAnchor=null,this.resizeStartLeft=0,this.resizeStartTop=0,this.originLeft=0,this.originTop=0,this.originWidth=0,this.originHeight=0},e.prototype.setVisible=function(e){var t=e?"block":"none";this.topLeftAnchor&&(this.topLeftAnchor.style.display=t),this.topAnchor&&(this.topAnchor.style.display=t),this.topRightAnchor&&(this.topRightAnchor.style.display=t),this.leftAnchor&&(this.leftAnchor.style.display=t),this.rightAnchor&&(this.rightAnchor.style.display=t),this.bottomLeftAnchor&&(this.bottomLeftAnchor.style.display=t),this.bottomAnchor&&(this.bottomAnchor.style.display=t),this.bottomRightAnchor&&(this.bottomRightAnchor.style.display=t)},e}(),Zn=function(){var e=new Map;for(var t in m)if(isNaN(Number(t))){var i=m[t],o=t.split("_");e.set(i,{width:parseInt(o[1]),height:parseInt(o[2])})}return e}(),es=function(){function e(e){if(this.logPrefix="[TRTCMediaMixingDesigner]",this.mixingVideoWidth=640,this.mixingVideoHeight=360,this.canExceedContainer=!1,this.movableHandler=null,this.resizableHandler=null,this.previewScale=1,this.previewWidth=0,this.previewHeight=0,this.previewLeft=0,this.previewTop=0,this.BOUNDARY_ADSORPTION_THRESHOLD=10,this.newSelected=null,this.clickedMediaSources=[],this.oldSelectedIndex=-1,this.mousedownLeft=null,this.mousedownTop=null,this.eventButton=null,this.resizeObserver=null,this.logger=e.logger,this.container=e.view,this.container.style.position="relative",this.videoResolution=e.videoResolution,this.resMode=e.resMode,Zn.has(e.videoResolution)){var t=Zn.get(e.videoResolution),i=t.width,o=t.height;this.resMode===D.TRTCVideoResolutionModeLandscape?(this.mixingVideoWidth=i,this.mixingVideoHeight=o):(this.mixingVideoWidth=o,this.mixingVideoHeight=i)}this.updatePreviewProperty(),this.canExceedContainer=e.canExceedContainer||!1,this.eventEmitter=new E,this.mediaList=[],this.selectedMediaIndex=-1,this.moveAndResizeOverlay=document.createElement("div"),this.moveAndResizeOverlay.style.position="relative",this.container.appendChild(this.moveAndResizeOverlay),this.initMediaMovable(),this.initMediaResizable(),this.initContainerMouseEventHander(),this.initContainerResizeObserver()}return e.prototype.updateOptions=function(e){if(!be(e.videoResolution)||!be(e.resMode)){if(this.resMode=be(e.resMode)?this.resMode:e.resMode,e.videoResolution&&Zn.has(e.videoResolution)){var t=Zn.get(e.videoResolution),i=t.width,o=t.height;this.resMode===D.TRTCVideoResolutionModeLandscape?(this.mixingVideoWidth=i,this.mixingVideoHeight=o):(this.mixingVideoWidth=o,this.mixingVideoHeight=i)}this.updatePreviewProperty(),this.updateOverlay()}},e.prototype.addMedia=function(e){this.mediaList.unshift(e),e.isSelected&&(this.selectedMediaIndex=0,this.updateOverlay())},e.prototype.removeMedia=function(e){var t=this.mediaList.findIndex((function(t){return t.id===e.id}));-1!==t&&(this.mediaList.splice(t,1),(this.selectedMediaIndex===t||e.isSelected)&&(this.selectedMediaIndex=-1,this.updateOverlay()))},e.prototype.updateMedia=function(e){var t=this.mediaList.findIndex((function(t){return t.id===e.id}));-1!==t&&(this.mediaList[t]=Object.assign({},this.mediaList[t],e),e.isSelected&&(this.selectedMediaIndex=t,this.updateOverlay()))},e.prototype.on=function(e,t){var i;null===(i=this.eventEmitter)||void 0===i||i.on(e,t)},e.prototype.off=function(e,t){var i;null===(i=this.eventEmitter)||void 0===i||i.off(e,t)},e.prototype.destroy=function(){var e,t,i,o;this.resizeObserver&&(this.container&&this.resizeObserver.unobserve(this.container),this.resizeObserver.disconnect(),this.resizeObserver=null),null===(e=this.movableHandler)||void 0===e||e.destroy(),null===(t=this.resizableHandler)||void 0===t||t.destroy(),this.movableHandler=null,this.resizableHandler=null,null===(i=this.container)||void 0===i||i.removeEventListener("contextmenu",this.onRightButtonClicked,!1),document.removeEventListener("mousedown",this.onContainerMousedown,!1),this.moveAndResizeOverlay&&(null===(o=this.container)||void 0===o||o.removeChild(this.moveAndResizeOverlay),this.moveAndResizeOverlay=null),this.container=null,this.eventEmitter=null,this.mediaList=[]},e.prototype.initMediaMovable=function(){this.onMove=this.onMove.bind(this),this.movableHandler=new Fn(this.moveAndResizeOverlay,this.container,{canExceedContainer:this.canExceedContainer,calcPositionOnly:!1}),this.movableHandler.on("move",this.onMove)},e.prototype.initMediaResizable=function(){this.onResize=this.onResize.bind(this),this.resizableHandler=new $n(this.moveAndResizeOverlay,this.container,{keepRatio:!0,stopPropagation:!0,canExceedContainer:this.canExceedContainer,anchorMode:0}),this.resizableHandler.on("resize",this.onResize)},e.prototype.updateCanExceedContainer=function(e){this.movableHandler&&(this.movableHandler.options.canExceedContainer=e),this.resizableHandler&&(this.resizableHandler.options.canExceedContainer=e)},e.prototype.initContainerMouseEventHander=function(){this.container?(this.onContainerMousedown=this.onContainerMousedown.bind(this),this.onContainerMousemove=this.onContainerMousemove.bind(this),this.onContainerMouseup=this.onContainerMouseup.bind(this),document.addEventListener("mousedown",this.onContainerMousedown,!1),this.onRightButtonClicked=this.onRightButtonClicked.bind(this),this.container.addEventListener("contextmenu",this.onRightButtonClicked,!1)):this.logger.error("".concat(this.logPrefix,"initContainerMouseEventHander failed, no container view"))},e.prototype.initContainerResizeObserver=function(){this.container&&(this.onPreviewAreaResize=this.onPreviewAreaResize.bind(this),this.resizeObserver=new ResizeObserver(this.onPreviewAreaResize),this.resizeObserver.observe(this.container))},e.prototype.onPreviewAreaResize=function(e){for(var t=0,i=e;t<i.length;t++){if(i[t].target===this.container){this.updatePreviewProperty(),this.updateOverlay();break}}},e.prototype.updatePreviewProperty=function(){if(this.container){var e=this.container.offsetWidth,t=this.container.offsetHeight,i=e/this.mixingVideoWidth,o=t/this.mixingVideoHeight;this.previewScale=i>o?i:o,this.previewWidth=this.mixingVideoWidth*this.previewScale,this.previewHeight=this.mixingVideoHeight*this.previewScale,this.previewLeft=(e-this.previewWidth)/2,this.previewTop=(t-this.previewHeight)/2}else console.debug("".concat(this.logPrefix,"calcPreviewScale failed, no HTML element to display"))},e.prototype.updateOverlay=function(){if(this.moveAndResizeOverlay){var e=void 0,t=void 0,i=void 0,o=void 0;if(this.selectedMediaIndex>=0){var r=this.mediaList[this.selectedMediaIndex],n={left:r.rect.left*this.previewScale,top:r.rect.top*this.previewScale,right:r.rect.right*this.previewScale,bottom:r.rect.bottom*this.previewScale};e="".concat(n.left+this.previewLeft,"px"),t="".concat(n.top+this.previewTop,"px"),i="".concat(n.right-n.left,"px"),o="".concat(n.bottom-n.top,"px");var s=r.interaction||{},a=!1!==s.showBorder,c=!1!==s.showResizeAnchors,u=!1!==s.draggable,l=!1!==s.canExceedCanvas;this.logger.debug("".concat(this.logPrefix,"updateOverlay: interaction config -"),{showBorder:a,showResizeAnchors:c,draggable:u,canExceedCanvas:l}),this.updateCanExceedContainer(l),this.moveAndResizeOverlay.style.display="block",this.moveAndResizeOverlay.style.border=a?"1px solid #3D7EFD":"none",this.resizableHandler&&this.resizableHandler.setVisible(c),this.movableHandler&&(this.logger.debug("".concat(this.logPrefix,"updateOverlay: setting movableHandler.setEnabled(").concat(u,")")),this.movableHandler.setEnabled(u))}else e="".concat(this.previewLeft,"px"),t="".concat(this.previewTop,"px"),i="0px",o="0px",this.moveAndResizeOverlay.style.display="none";this.moveAndResizeOverlay.style.left=e,this.moveAndResizeOverlay.style.top=t,this.moveAndResizeOverlay.style.width=i,this.moveAndResizeOverlay.style.height=o}},e.prototype.onMove=function(e,t){var i;console.debug("".concat(this.logPrefix,"onMove: ").concat(e," ").concat(t));var o=this.mediaList[this.selectedMediaIndex];if(o&&this.moveAndResizeOverlay){var r={left:e-this.previewLeft,top:t-this.previewTop,right:e-this.previewLeft+this.moveAndResizeOverlay.offsetWidth,bottom:t-this.previewTop+this.moveAndResizeOverlay.offsetHeight};this.doAdsorption(r);var n={left:Math.round(r.left/this.previewScale),top:Math.round(r.top/this.previewScale),right:Math.round(r.right/this.previewScale),bottom:Math.round(r.bottom/this.previewScale)};null===(i=this.eventEmitter)||void 0===i||i.emit("onSourceMoved",c({},o),n)}else console.debug("".concat(this.logPrefix,"onMove no selected media"))},e.prototype.doAdsorption=function(e){var t=this.BOUNDARY_ADSORPTION_THRESHOLD;Math.abs(e.left)<t&&(e.right=e.right-e.left,e.left=0),Math.abs(e.top)<t&&(e.bottom=e.bottom-e.top,e.top=0),Math.abs(e.right-this.previewWidth)<t&&(e.left=e.left+this.previewWidth-e.right,e.right=this.previewWidth),Math.abs(e.bottom-this.previewHeight)<t&&(e.top=e.top+this.previewHeight-e.bottom,e.bottom=this.previewHeight)},e.prototype.onResize=function(e,t,i,o){var r;console.debug("".concat(this.logPrefix,"onResize: ").concat(e," ").concat(t," ").concat(i," ").concat(o));var n=this.mediaList[this.selectedMediaIndex];if(n){var s=n.interaction||{};if(!Te(s.showResizeAnchors)&&!s.showResizeAnchors)return;var a={left:e-this.previewLeft,top:t-this.previewTop,right:e-this.previewLeft+i,bottom:t-this.previewTop+o},u={left:Math.round(a.left/this.previewScale),top:Math.round(a.top/this.previewScale),right:Math.round(a.right/this.previewScale),bottom:Math.round(a.bottom/this.previewScale)};null===(r=this.eventEmitter)||void 0===r||r.emit("onSourceResized",c({},n),u)}else console.debug("".concat(this.logPrefix,"onResize no selected media"))},e.prototype.getMaxZOrderMedia=function(e){var t,i,o,r,n,s;if(0===e.length)return null;for(var a=e[0],c=null!==(o=null===(i=null===(t=a.origin)||void 0===t?void 0:t.layout)||void 0===i?void 0:i.zOrder)&&void 0!==o?o:-Infinity,u=1;u<e.length;u++){var l=null!==(s=null===(n=null===(r=e[u].origin)||void 0===r?void 0:r.layout)||void 0===n?void 0:n.zOrder)&&void 0!==s?s:-Infinity;l>c&&(c=l,a=e[u])}return a},e.prototype.emitOnSelect=function(e){var t;if(e){for(var i=this.mediaList.length,o=0;o<i;o++)if(e.id===this.mediaList[o].id){this.selectedMediaIndex=o;break}}else this.selectedMediaIndex=-1;this.updateOverlay(),null===(t=this.eventEmitter)||void 0===t||t.emit("onSourceSelected",e?c({},e):null)},e.prototype.onContainerMousedown=function(e){var t;console.debug("".concat(this.logPrefix,"onContainerMousedown event:"),e,e.target,e.currentTarget);var i=e.target;if(this.eventButton=e.button,i&&this.container){if(this.container.contains(i)){console.debug("".concat(this.logPrefix,"onContainerMousedown mix video image clicked"));var o=this.container.getBoundingClientRect(),r=e.clientX-o.x-this.previewLeft,n=e.clientY-o.y-this.previewTop,s=r/this.previewScale,a=n/this.previewScale;console.debug("".concat(this.logPrefix,"onContainerMousedown click point coordinates in mix video:"),r,n,s,a);for(var c=0;c<this.mediaList.length;c++){var u=this.mediaList[c];u.rect&&s>=u.rect.left&&s<=u.rect.right&&a>=u.rect.top&&a<=u.rect.bottom&&!1!==(null===(t=u.interaction)||void 0===t?void 0:t.selectable)&&(this.clickedMediaSources.push(u),this.mediaList[this.selectedMediaIndex]&&u.id===this.mediaList[this.selectedMediaIndex].id&&(this.oldSelectedIndex=this.clickedMediaSources.length-1))}this.mousedownLeft=e.screenX,this.mousedownTop=e.screenY}this.clickedMediaSources.length>0?2===this.eventButton&&-1===this.oldSelectedIndex?(this.newSelected=this.getMaxZOrderMedia(this.clickedMediaSources),console.debug("".concat(this.logPrefix,"onContainerMousedown find clicked media source:"),this.newSelected),this.emitOnSelect(this.newSelected),this.clickedMediaSources.splice(0,this.clickedMediaSources.length)):(document.addEventListener("mousemove",this.onContainerMousemove,!1),document.addEventListener("mouseup",this.onContainerMouseup,!1)):(this.newSelected=null,console.debug("".concat(this.logPrefix,"onContainerMousedown find clicked media source:"),this.newSelected),this.emitOnSelect(null),this.mousedownLeft=null,this.mousedownTop=null,this.eventButton=null)}},e.prototype.onContainerMousemove=function(e){var t;if(e.target&&this.container&&null!==this.mousedownLeft&&null!==this.mousedownTop){var i=e.screenX-this.mousedownLeft,o=e.screenY-this.mousedownTop;(Math.abs(i)>=5||Math.abs(o)>=5)&&(this.oldSelectedIndex>=0?(console.debug("".concat(this.logPrefix,"onContainerMousemove move or resize old selected media source, clear data:"),this.clickedMediaSources,this.oldSelectedIndex),this.clickedMediaSources.splice(0,this.clickedMediaSources.length),this.oldSelectedIndex=-1):this.clickedMediaSources.length>0&&(this.newSelected=this.getMaxZOrderMedia(this.clickedMediaSources),console.debug("".concat(this.logPrefix,"onContainerMousemove find clicked media source:"),this.newSelected),this.emitOnSelect(this.newSelected),this.clickedMediaSources.splice(0,this.clickedMediaSources.length),null===(t=this.moveAndResizeOverlay)||void 0===t||t.dispatchEvent(new MouseEvent("mousedown",{screenX:this.mousedownLeft,screenY:this.mousedownTop,button:this.eventButton}))))}},e.prototype.onContainerMouseup=function(e){if(document.removeEventListener("mousemove",this.onContainerMousemove,!1),document.removeEventListener("mouseup",this.onContainerMouseup,!1),console.debug("".concat(this.logPrefix,"onContainerMouseup data:"),this.clickedMediaSources,this.oldSelectedIndex),e.target&&this.container){if(this.clickedMediaSources.length>0)if(this.oldSelectedIndex>=0){if(0===this.eventButton){var t=(this.oldSelectedIndex+1)%this.clickedMediaSources.length;this.newSelected=this.clickedMediaSources[t],console.debug("".concat(this.logPrefix,"onContainerMouseup find clicked media source:"),this.newSelected),this.emitOnSelect(this.newSelected)}}else this.newSelected=this.getMaxZOrderMedia(this.clickedMediaSources),console.debug("".concat(this.logPrefix,"onContainerMouseup find clicked media source:"),this.newSelected),this.emitOnSelect(this.newSelected)}else console.debug("".concat(this.logPrefix,"onContainerMouseup click outside of mixing video image")),this.emitOnSelect(null);this.mousedownLeft=null,this.mousedownTop=null,this.clickedMediaSources.splice(0,this.clickedMediaSources.length),this.oldSelectedIndex=-1,this.newSelected=null,this.eventButton=null},e.prototype.onRightButtonClicked=function(e){var t;console.debug("".concat(this.logPrefix,"onRightButtonClicked:"),e.target,e.currentTarget,e.buttons),e.preventDefault(),null===(t=this.eventEmitter)||void 0===t||t.emit("onRightButtonClicked",c({},this.mediaList[this.selectedMediaIndex]))},e}(),ts=function(){function t(e){if(this.logPrefix="[TRTCMediaMixingManager]",this.eventEmitter=new E,this.publishParams={videoEncoderParams:{videoResolution:m.TRTCVideoResolution_1280_720,resMode:D.TRTCVideoResolutionModeLandscape,videoFps:15,videoBitrate:1800},canvasColor:0},this.mediaMixingDesigner=null,this.sourceList=[],this.trtcSourceMap=new Map,this.mixVideoTrack=null,this.publishStreamType=T.TRTCVideoStreamTypeBig,this.selectedSource=null,this.view=null,this.screensWithSystemAudio=new Set,t.mediaMixingManager)return t.mediaMixingManager;t.mediaMixingManager=this,this.logger=e.logger,this.trtc=e.trtc,this.trtcCloud=e.trtcCloud,this.onSourceSelected=this.onSourceSelected.bind(this),this.onSourceMoved=this.onSourceMoved.bind(this),this.onSourceResized=this.onSourceResized.bind(this),this.onRightButtonClicked=this.onRightButtonClicked.bind(this)}return t.prototype.destroy=function(){return l(this,void 0,Promise,(function(){var e,i,o,r,n;return h(this,(function(s){switch(s.label){case 0:this.view=null,s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this.trtc.stopPlugin("VideoMixer")];case 2:return s.sent(),[3,4];case 3:return e=s.sent(),this.logger.error("".concat(this.logPrefix," destroy and stopPlugin error:"),e),[3,4];case 4:if(!(this.screensWithSystemAudio.size>0))return[3,12];s.label=5;case 5:s.trys.push([5,10,,11]),i=0,o=Array.from(this.screensWithSystemAudio),s.label=6;case 6:return i<o.length?(r=o[i],[4,this.trtc.stopPlugin("AudioMixer",{id:"systemAudioTrack_".concat(r)})]):[3,9];case 7:s.sent(),s.label=8;case 8:return i++,[3,6];case 9:return[3,11];case 10:return n=s.sent(),this.logger.error("".concat(this.logPrefix," destroy and stopPlugin AudioMixer error:"),n),[3,11];case 11:this.screensWithSystemAudio.clear(),s.label=12;case 12:return this.destroyDesigner(),this.eventEmitter=null,t.mediaMixingManager=null,[2]}}))}))},t.prototype.bindPreviewArea=function(e){return l(this,void 0,Promise,(function(){var t,i,o,r,n=this;return h(this,(function(s){switch(s.label){case 0:return this.logger.log("".concat(this.logPrefix," bindPreviewArea:"),e),this.view=e,t=this._getCanvasSize(this.publishParams.videoEncoderParams.videoResolution,this.publishParams.videoEncoderParams.resMode),i=t.width,o=t.height,[4,this.trtc.startPlugin("VideoMixer",{view:e,canvasInfo:{width:i,height:o,canvasColor:String(this.publishParams.canvasColor)},onScreenShareStop:function(e){var t,i=n.sourceList.find((function(t){return t.id===e}));n.removeMediaSource(i),null===(t=n.eventEmitter)||void 0===t||t.emit("onSourceDisconnected",i||null)}})];case 1:return r=s.sent(),console.log("startPlugin result",r,r.track),this.mixVideoTrack=r.track,this.createDesigner(),[2]}}))}))},t.prototype.updatePreviewArea=function(e){return l(this,void 0,Promise,(function(){return h(this,(function(t){switch(t.label){case 0:return this.logger.log("".concat(this.logPrefix," updatePreviewArea:"),e),e===this.view?[2]:[4,this.trtc.updatePlugin("VideoMixer",{view:e})];case 1:return t.sent(),this.destroyDesigner(),this.view=e,e&&this.createDesigner(),[2]}}))}))},t.prototype._getTRTCSourceKey=function(e){var t;return((t={})[vn.kCamera]="camera",t[vn.kScreen]="screen",t[vn.kText]="text",t[vn.kVideo]="video",t[vn.kImage]="image",t)[e.type]},t.prototype._getTRTCFillMode=function(e){var t;return((t={})[y.TRTCVideoFillMode_Fill]="cover",t[y.TRTCVideoFillMode_Fit]="contain",t)[e]},t.prototype._getTRTCVideoProfile=function(e,t){var i,o,r,n=null!==(o=((i={})[m.TRTCVideoResolution_480_270]={width:480,height:270},i[m.TRTCVideoResolution_640_360]={width:640,height:360},i[m.TRTCVideoResolution_960_540]={width:960,height:540},i[m.TRTCVideoResolution_1280_720]={width:1280,height:720},i[m.TRTCVideoResolution_1920_1080]={width:1920,height:1080},i)[e])&&void 0!==o?o:(r=e)&&"object"==typeof r&&"number"==typeof r.width&&"number"==typeof r.height?e:{width:1920,height:1080};return{width:n.width,height:n.height,frameRate:t,bitrate:1e3}},t.prototype._getTRTCLayout=function(e){var t,i,o,r,n,s,a,c,u,l,h,d,p,f,v,g,m={zIndex:(null===(o=e.layout)||void 0===o?void 0:o.zOrder)||0};if(Te(null===(r=e.layout)||void 0===r?void 0:r.rect)||(m.x=null===(n=e.layout)||void 0===n?void 0:n.rect.left,m.y=null===(s=e.layout)||void 0===s?void 0:s.rect.top,m.width=(null===(a=e.layout)||void 0===a?void 0:a.rect.right)-(null===(c=e.layout)||void 0===c?void 0:c.rect.left),m.height=(null===(u=e.layout)||void 0===u?void 0:u.rect.bottom)-(null===(l=e.layout)||void 0===l?void 0:l.rect.top)),Te(null===(h=e.layout)||void 0===h?void 0:h.fillMode)||(m.fillMode=this._getTRTCFillMode(null===(d=e.layout)||void 0===d?void 0:d.fillMode)),!Te(null===(p=e.layout)||void 0===p?void 0:p.mirror)){var T=((t={})[_.TRTCVideoMirrorType_Auto]=!0,t[_.TRTCVideoMirrorType_Enable]=!0,t[_.TRTCVideoMirrorType_Disable]=!1,t);m.mirror=T[null===(f=e.layout)||void 0===f?void 0:f.mirror]}if(!Te(null===(v=e.layout)||void 0===v?void 0:v.rotation)){var y=((i={})[I.TRTCVideoRotation0]=0,i[I.TRTCVideoRotation90]=90,i[I.TRTCVideoRotation180]=180,i[I.TRTCVideoRotation270]=270,i);m.rotation=y[null===(g=e.layout)||void 0===g?void 0:g.rotation]}return m},t.prototype._getTRTCSourceItem=function(e){var t,i,o,r,n,s,a,u,l,h;switch(e.type){case vn.kScreen:return h=m.TRTCVideoResolution_1920_1080,(null==e?void 0:e.useInternalTrack)?{id:e.id,layout:this._getTRTCLayout(e),useInternalTrack:!0}:{id:e.id,profile:this._getTRTCVideoProfile((null===(t=e.screen)||void 0===t?void 0:t.resolution)||h,(null===(i=e.screen)||void 0===i?void 0:i.fps)||15),layout:this._getTRTCLayout(e),systemAudio:null===(o=e.screen)||void 0===o?void 0:o.systemAudio};case vn.kCamera:return h=m.TRTCVideoResolution_1280_720,(null==e?void 0:e.useInternalTrack)?{id:e.id,layout:this._getTRTCLayout(e),useInternalTrack:!0}:{id:e.id,cameraId:null===(r=e.camera)||void 0===r?void 0:r.cameraId,profile:this._getTRTCVideoProfile((null===(n=e.camera)||void 0===n?void 0:n.resolution)||h,(null===(s=e.camera)||void 0===s?void 0:s.fps)||15),videoTrack:null===(a=e.camera)||void 0===a?void 0:a.videoTrack,layout:this._getTRTCLayout(e)};case vn.kText:return c(c({id:e.id},e.text||{}),{layout:this._getTRTCLayout(e)});case vn.kImage:return{id:e.id,url:null===(u=e.image)||void 0===u?void 0:u.url,layout:this._getTRTCLayout(e)};case vn.kVideo:return{id:e.id,url:null===(l=e.video)||void 0===l?void 0:l.url,layout:this._getTRTCLayout(e)};default:return null}},t.prototype._getCanvasSize=function(e,t){var i,o,r=((i={})[m.TRTCVideoResolution_480_270]={width:480,height:270},i[m.TRTCVideoResolution_640_360]={width:640,height:360},i[m.TRTCVideoResolution_960_540]={width:960,height:540},i[m.TRTCVideoResolution_1280_720]={width:1280,height:720},i[m.TRTCVideoResolution_1920_1080]={width:1920,height:1080},i)[e],n=r.width,s=r.height;return t===D.TRTCVideoResolutionModePortrait&&(n=(o=[s,n])[0],s=o[1]),{width:n,height:s}},t.prototype.addMediaSource=function(e){var t;return l(this,void 0,Promise,(function(){var i,o,r,n,s,a,c,u,l;return h(this,(function(h){switch(h.label){case 0:if(-1!==this.findMediaSourceIndex(e))throw new Error("Media source already existed");if(i=Se(e),o=this._getTRTCSourceKey(i),!(r=this._getTRTCSourceItem(i))||!o)throw new Error("Invalid media source");return(n=Se(this.trtcSourceMap.get(o))||[]).push(r),[4,this.trtc.updatePlugin("VideoMixer",(l={},l[o]=n,l))];case 1:return s=h.sent(),a=s.result,c=s.systemAudioTrackList,e.type===vn.kScreen&&(null==c?void 0:c[e.id])?(this.screensWithSystemAudio.add(e.id),u=null==c?void 0:c[e.id],this.logger.log("".concat(this.logPrefix," startPlugin AudioMixer, track ID:"),u.id),[4,this.trtc.startPlugin("AudioMixer",{id:"systemAudioTrack_".concat(e.id),track:u})]):[3,3];case 2:h.sent(),h.label=3;case 3:if(a.failedDetails.find((function(t){return t.id===e.id})))throw new Error("Failed to add media source");return i.isSelected&&(this.unselectMediaSource(this.selectedSource),this.selectedSource=e),this.trtcSourceMap.set(o,n),null===(t=this.mediaMixingDesigner)||void 0===t||t.addMedia({id:i.id,rect:this._getDesignerMediaRect(e),isSelected:!!Te(i.isSelected)||i.isSelected,origin:i,interaction:i.interaction}),i.isSelected&&(this.selectedSource=i),this.sourceList.push(i),[2]}}))}))},t.prototype.removeMediaSource=function(e){var t,i,o;return l(this,void 0,Promise,(function(){var r,n,s,a,c,u;return h(this,(function(l){switch(l.label){case 0:if(this.logger.log("".concat(this.logPrefix,"removeMediaSource:"),e),-1===(r=this.findMediaSourceIndex(e)))throw new Error("Not existing media source to remove");return n=this._getTRTCSourceKey(e),s=Se(this.trtcSourceMap.get(n))||[],a=s.findIndex((function(t){return t.id===e.id})),s.splice(a,1),[4,this.trtc.updatePlugin("VideoMixer",(u={},u[n]=s,u))];case 1:return c=l.sent().result,e.type===vn.kScreen&&this.screensWithSystemAudio.has(e.id)?(this.screensWithSystemAudio.delete(e.id),[4,this.trtc.stopPlugin("AudioMixer",{id:"systemAudioTrack_".concat(e.id)})]):[3,3];case 2:l.sent(),l.label=3;case 3:if(c.failedDetails.find((function(t){return t.id===e.id})))throw new Error("Failed to remove media source");return null===(t=this.mediaMixingDesigner)||void 0===t||t.removeMedia({id:e.id,rect:null===(i=e.layout)||void 0===i?void 0:i.rect,isSelected:e.isSelected||!1,origin:Se(e)}),(null===(o=this.selectedSource)||void 0===o?void 0:o.id)===e.id&&(this.selectedSource=null),this.trtcSourceMap.set(n,s),this.sourceList.splice(r,1),[2]}}))}))},t.prototype._getDesignerMediaRect=function(e){var t,i,o=(null===(t=e.layout)||void 0===t?void 0:t.rect)||{left:0,top:0,right:0,bottom:0},r=o.left,n=o.top,s=o.right,a=o.bottom,c=s-r,u=a-n;switch(null===(i=e.layout)||void 0===i?void 0:i.rotation){case I.TRTCVideoRotation0:case I.TRTCVideoRotation180:return{left:r,top:n,right:s,bottom:a};case I.TRTCVideoRotation90:case I.TRTCVideoRotation270:return{left:r,top:n,right:r+u,bottom:n+c};default:return{left:r,top:n,right:s,bottom:a}}},t.prototype._getPluginMediaRect=function(e){var t,i,o=(null===(t=e.layout)||void 0===t?void 0:t.rect)||{left:0,top:0,right:0,bottom:0},r=o.left,n=o.top,s=o.right,a=o.bottom;switch(null===(i=e.layout)||void 0===i?void 0:i.rotation){case I.TRTCVideoRotation0:case I.TRTCVideoRotation180:return{left:r,top:n,right:s,bottom:a};case I.TRTCVideoRotation90:case I.TRTCVideoRotation270:return{left:r,top:n,right:r+(a-n),bottom:n+(s-r)};default:return{left:r,top:n,right:s,bottom:a}}},t.prototype.updateMediaSource=function(e){var t,i;return l(this,void 0,Promise,(function(){var o,r,n,s,a,u,l,d;return h(this,(function(h){switch(h.label){case 0:if(this.logger.log("".concat(this.logPrefix,"updateMediaSource:"),e),-1===(o=this.findMediaSourceIndex(e)))throw new Error("Not existing media source to update");return r=c(c({},this.sourceList[o]),Se(e)),e.isSelected?(this.unselectMediaSource(this.selectedSource),this.selectedSource=e):(null===(t=this.selectedSource)||void 0===t?void 0:t.id)===e.id&&(this.selectedSource=null),n=this._getTRTCSourceKey(r),s=this._getTRTCSourceItem(r),a=Se(this.trtcSourceMap.get(n))||[],u=a.findIndex((function(t){return t.id===e.id})),a[u]=s,[4,this.trtc.updatePlugin("VideoMixer",(d={},d[n]=a,d))];case 1:if(h.sent().result.failedDetails.find((function(t){return t.id===e.id})))throw new Error("Failed to update media source");return l={id:e.id,rect:this._getDesignerMediaRect(e),isSelected:e.isSelected||!1,origin:Se(e),interaction:r.interaction},this.logger.log("".concat(this.logPrefix,"updateParams:"),JSON.stringify(l)),null===(i=this.mediaMixingDesigner)||void 0===i||i.updateMedia(l),this.trtcSourceMap.set(n,a),this.sourceList[o]=r,[2]}}))}))},t.prototype.startPublish=function(e){var t;return l(this,void 0,Promise,(function(){var i;return h(this,(function(o){switch(o.label){case 0:return i=null!==(t=null==e?void 0:e.streamType)&&void 0!==t?t:T.TRTCVideoStreamTypeBig,this.publishStreamType=i,this.logger.log("".concat(this.logPrefix," startPublish, streamType:"),i),[4,this.trtcCloud._startPublishVideoTrack({videoTrack:this.mixVideoTrack,streamType:i})];case 1:return o.sent(),[2]}}))}))},t.prototype.stopPublish=function(){return l(this,void 0,Promise,(function(){return h(this,(function(e){switch(e.label){case 0:return this.logger.log("".concat(this.logPrefix," stopPublish, streamType:"),this.publishStreamType),[4,this.trtcCloud._stopPublishVideoTrack({streamType:this.publishStreamType})];case 1:return e.sent(),[2]}}))}))},t.prototype.updatePublishParams=function(t){var i,o,r,n,s;return l(this,void 0,Promise,(function(){var a,c,u,l,d,p,v,g,m,T,y,_,R,b,C,S,w,E,M,A,P,I,L,V;return h(this,(function(h){switch(h.label){case 0:this.logger.log("".concat(this.logPrefix,"updatePublishParams:"),t),a=this.publishParams,this.publishParams=t,c=this._getCanvasSize(t.videoEncoderParams.videoResolution,t.videoEncoderParams.resMode),u=c.width,l=c.height,h.label=1;case 1:return h.trys.push([1,3,,4]),[4,this.trtc.updatePlugin("VideoMixer",{canvasInfo:{width:u,height:l,canvasColor:String(t.canvasColor)}})];case 2:return h.sent(),[3,4];case 3:if((d=h.sent()).code!==e.ERROR_CODE.OPERATION_ABORT)throw d;return[3,4];case 4:null===(r=this.mediaMixingDesigner)||void 0===r||r.updateOptions({videoResolution:this.publishParams.videoEncoderParams.videoResolution,resMode:this.publishParams.videoEncoderParams.resMode}),h.label=5;case 5:h.trys.push([5,11,12,17]),p=f(this.sourceList),h.label=6;case 6:return[4,p.next()];case 7:return(v=h.sent()).done?[3,10]:(g=v.value).layout?(m=g.layout.rect||{left:0,top:0,right:0,bottom:0},T=m.left,y=m.top,_=m.right,R=m.bottom,b=this._getCanvasSize(a.videoEncoderParams.videoResolution),C=b.width,S=b.height,w=this._getCanvasSize(t.videoEncoderParams.videoResolution),E=w.width,M=w.height,A=T*E/C,P=y*M/S,I=_*E/C,L=R*M/S,g.layout.rect={left:A,top:P,right:I,bottom:L},[4,this.updateMediaSource(g)]):[3,9];case 8:h.sent(),null===(n=this.eventEmitter)||void 0===n||n.emit("onSourceResized",g,null===(s=g.layout)||void 0===s?void 0:s.rect),h.label=9;case 9:return[3,6];case 10:return[3,17];case 11:return V=h.sent(),i={error:V},[3,17];case 12:return h.trys.push([12,,15,16]),v&&!v.done&&(o=p.return)?[4,o.call(p)]:[3,14];case 13:h.sent(),h.label=14;case 14:return[3,16];case 15:if(i)throw i.error;return[7];case 16:return[7];case 17:return[4,this.trtcCloud.setVideoEncoderParam(t.videoEncoderParams)];case 18:return h.sent(),[2]}}))}))},t.prototype.on=function(e,t){var i;null===(i=this.eventEmitter)||void 0===i||i.on(e,t)},t.prototype.off=function(e,t){var i;null===(i=this.eventEmitter)||void 0===i||i.off(e,t)},t.prototype.onVisibilityChange=function(){this.logger.log("".concat(this.logPrefix,"onVisibilityChange document.hidden:").concat(document.hidden)),document.hidden?this.bindPreviewArea(null):this.bindPreviewArea(this.view)},t.prototype.createDesigner=function(){var e,t;this.view&&(this.mediaMixingDesigner=new es({view:this.view,videoResolution:(null===(e=this.publishParams)||void 0===e?void 0:e.videoEncoderParams.videoResolution)||m.TRTCVideoResolution_1920_1080,resMode:(null===(t=this.publishParams)||void 0===t?void 0:t.videoEncoderParams.resMode)||D.TRTCVideoResolutionModeLandscape,canExceedContainer:!0,logger:this.logger}),this.listenDesignerEvent())},t.prototype.destroyDesigner=function(){var e;this.mediaMixingDesigner&&(this.unlistenDesignerEvent(),null===(e=this.mediaMixingDesigner)||void 0===e||e.destroy(),this.mediaMixingDesigner=null)},t.prototype.listenDesignerEvent=function(){var e,t,i,o,r;null===(e=this.mediaMixingDesigner)||void 0===e||e.on("onError",this.onError),null===(t=this.mediaMixingDesigner)||void 0===t||t.on("onSourceSelected",this.onSourceSelected),null===(i=this.mediaMixingDesigner)||void 0===i||i.on("onSourceMoved",this.onSourceMoved),null===(o=this.mediaMixingDesigner)||void 0===o||o.on("onSourceResized",this.onSourceResized),null===(r=this.mediaMixingDesigner)||void 0===r||r.on("onRightButtonClicked",this.onRightButtonClicked)},t.prototype.unlistenDesignerEvent=function(){var e,t,i,o,r;null===(e=this.mediaMixingDesigner)||void 0===e||e.off("onError",this.onError),null===(t=this.mediaMixingDesigner)||void 0===t||t.off("onSourceSelected",this.onSourceSelected),null===(i=this.mediaMixingDesigner)||void 0===i||i.off("onSourceMoved",this.onSourceMoved),null===(o=this.mediaMixingDesigner)||void 0===o||o.off("onSourceResized",this.onSourceResized),null===(r=this.mediaMixingDesigner)||void 0===r||r.off("onRightButtonClicked",this.onRightButtonClicked)},t.prototype.onError=function(e,t){this.logger.log("".concat(this.logPrefix,"onError:"),e,t)},t.prototype.onSourceSelected=function(e){var t;return l(this,void 0,void 0,(function(){return h(this,(function(i){switch(i.label){case 0:return this.logger.debug("".concat(this.logPrefix,"onSourceSelected: "),e,this.selectedSource),e&&this.selectedSource&&e.origin.id===this.selectedSource.id?[2]:(null==e?void 0:e.origin)?(this.updateMediaSource(c(c({},e.origin),{isSelected:!0})),[3,3]):[3,1];case 1:return this.selectedSource?[4,this.updateMediaSource(c(c({},this.selectedSource),{isSelected:!1}))]:[3,3];case 2:i.sent(),this.selectedSource=null,i.label=3;case 3:return null===(t=this.eventEmitter)||void 0===t||t.emit("onSourceSelected",e?e.origin:null),[2]}}))}))},t.prototype.onSourceMoved=function(e,t){var i,o;if(this.logger.debug("".concat(this.logPrefix,"onSourceMoved:"),e,t),null==e?void 0:e.origin){var r=c(c({},e.origin),{layout:c(c({},e.origin.layout),{rect:t})});this.updateMediaSource(Ce(r,{layout:{rect:this._getPluginMediaRect(r)}})),(null===(i=this.selectedSource)||void 0===i?void 0:i.id)===e.origin.id&&(this.selectedSource=this.sourceList.find((function(t){return t.id===e.origin.id}))),null===(o=this.eventEmitter)||void 0===o||o.emit("onSourceMoved",e.origin,this._getPluginMediaRect(r))}},t.prototype.onSourceResized=function(e,t){var i,o;if(this.logger.debug("".concat(this.logPrefix,"onSourceResized:"),e,t),null==e?void 0:e.origin){var r=c(c({},e.origin),{layout:c(c({},e.origin.layout),{rect:t})});this.updateMediaSource(Ce(r,{layout:{rect:this._getPluginMediaRect(r)}})),(null===(i=this.selectedSource)||void 0===i?void 0:i.id)===e.origin.id&&(this.selectedSource=this.sourceList.find((function(t){return t.id===e.origin.id})))}null===(o=this.eventEmitter)||void 0===o||o.emit("onSourceResized",e.origin,t)},t.prototype.onRightButtonClicked=function(e){var t;this.logger.debug("".concat(this.logPrefix,"onRightButtonClicked:"),e),null===(t=this.eventEmitter)||void 0===t||t.emit("onRightButtonClicked",e.origin)},t.prototype.isSameMediaSource=function(e,t){return e.id===t.id},t.prototype.isMediaSourceExisted=function(e){var t=this;return this.sourceList.some((function(i){return t.isSameMediaSource(i,e)}))},t.prototype.findMediaSourceIndex=function(e){return this.sourceList.findIndex((function(t){return t.id===e.id}))},t.prototype.unselectMediaSource=function(e){var t,i;return l(this,void 0,Promise,(function(){var o;return h(this,(function(r){return e?(-1!==(o=this.findMediaSourceIndex(e))&&(this.sourceList[o].isSelected=!1),null===(t=this.mediaMixingDesigner)||void 0===t||t.updateMedia({id:e.id,rect:null===(i=e.layout)||void 0===i?void 0:i.rect,isSelected:!1,origin:Se(e)}),[2]):[2]}))}))},t.mediaMixingManager=null,t}();!function(e){e.STARTED="started",e.STOPPED="stopped",e.ERROR="error",e.STALLED="stalled",e.RESUMED="resumed",e.UNDO_STATE_CHANGED="undo-state-changed",e.REDO_STATE_CHANGED="redo-state-changed"}(Xn||(Xn={}));var is=void 0,os=void 0,rs=void 0,ns=void 0,ss=void 0,as=void 0,cs=void 0,us=void 0,ls=["pen","rect","ellipse","arrow","laser","eraserObject"];function hs(e){var t,i={},o=e.tool;if(e.view_handle&&(i.view=e.view_handle),e.canvas&&(i.canvasInfo={},"number"==typeof e.canvas.width&&(i.canvasInfo.width=e.canvas.width),"number"==typeof e.canvas.height&&(i.canvasInfo.height=e.canvas.height)),(null==o?void 0:o.type)&&ls.includes(o.type)&&(i.tool={name:o.type}),o){var r=i.tool||{};o.color&&(r.color=o.color),"number"==typeof o.line_width&&(r.lineWidth=o.line_width),"laser"===o.type&&(r.laserFadeDuration="number"==typeof o.laserFadeDuration?o.laserFadeDuration:1e3),Object.keys(r).length>0&&(i.tool=r)}return"boolean"==typeof(null===(t=e.whiteboard)||void 0===t?void 0:t.interactive)&&(i.config={interactive:e.whiteboard.interactive}),i}var ds="Whiteboard",ps=[Xn.STARTED,Xn.STOPPED,Xn.ERROR,Xn.STALLED,Xn.RESUMED,Xn.UNDO_STATE_CHANGED,Xn.REDO_STATE_CHANGED],fs=function(){function e(t){if(this.logPrefix="[TRTCWhiteboardManager]",this.eventEmitter=new E,this.pluginEventHandlers=[],this.boundPlugin=null,this.started=!1,e.whiteboardManager)return e.whiteboardManager;e.whiteboardManager=this,this.logger=t.logger,this.trtc=t.trtc,this._bindPluginEvents()}return e.prototype.onRecvWhiteboardCommand=function(e){return l(this,void 0,Promise,(function(){return h(this,(function(t){switch(t.label){case 0:return this.log("onRecvWhiteboardCommand:",e),e&&"object"==typeof e?0!==Number(e.enable)?[3,2]:[4,this._stop()]:(this.logError("onRecvWhiteboardCommand: invalid command"),[2]);case 1:return t.sent(),[2];case 2:return e.owner_id?[4,this._applyRemoteCommand(e)]:[3,4];case 3:return t.sent(),[2];case 4:return this.started?[3,6]:[4,this._start(e)];case 5:return t.sent(),[3,8];case 6:return[4,this._update(e)];case 7:t.sent(),t.label=8;case 8:return e.op?[4,this._applyLocalOp(e.op)]:[3,10];case 9:t.sent(),t.label=10;case 10:return[2]}}))}))},e.prototype._start=function(e){return l(this,void 0,Promise,(function(){var t,i;return h(this,(function(o){switch(o.label){case 0:t=hs(e),o.label=1;case 1:return o.trys.push([1,3,,4]),this._bindPluginEvents(),[4,this.trtc.startPlugin(ds,t)];case 2:return o.sent(),this.started=!0,this.log("whiteboard started:",t),[3,4];case 3:throw i=o.sent(),this.logError("startPlugin Whiteboard error:",i),i;case 4:return[2]}}))}))},e.prototype._update=function(e){return l(this,void 0,Promise,(function(){var t,i;return h(this,(function(o){switch(o.label){case 0:if(t=hs(e),0===Object.keys(t).length)return[2];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,this.trtc.updatePlugin(ds,t)];case 2:return o.sent(),this.log("whiteboard updated:",t),[3,4];case 3:throw i=o.sent(),this.logError("updatePlugin Whiteboard error:",i),i;case 4:return[2]}}))}))},e.prototype._stop=function(){return l(this,void 0,Promise,(function(){var e;return h(this,(function(t){switch(t.label){case 0:if(!this.started)return[2];t.label=1;case 1:return t.trys.push([1,3,4,5]),[4,this.trtc.stopPlugin(ds)];case 2:return t.sent(),this.log("whiteboard stopped"),[3,5];case 3:return e=t.sent(),this.logError("stopPlugin Whiteboard error:",e),[3,5];case 4:return this.started=!1,this._resetPluginEventBinding(),[7];case 5:return[2]}}))}))},e.prototype._applyLocalOp=function(e){return l(this,void 0,Promise,(function(){var t,i;return h(this,(function(o){switch(o.label){case 0:if(t=function(e){switch(e){case"undo":return{operation:"undo"};case"redo":return{operation:"redo"};case"clearall":return{tool:{clearScope:"all"},operation:"clear"};default:return null}}(e),!t)return[2];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,this.trtc.updatePlugin(ds,t)];case 2:return o.sent(),this.log("whiteboard local op:",e,"-> options:",t),[3,4];case 3:return i=o.sent(),this.logError("updatePlugin Whiteboard op error:",i),[3,4];case 4:return[2]}}))}))},e.prototype._bindPluginEvents=function(){var e=this,t=this._getWhiteboardPlugin();t&&"function"==typeof t.on&&(this._offPluginEvents(),this.boundPlugin=t,ps.forEach((function(i){var o=function(){for(var t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];e._emitWhiteboardEvent(i,t)};t.on(i,o),e.pluginEventHandlers.push({event:i,handler:o})})))},e.prototype._offPluginEvents=function(){var e=this;this.boundPlugin&&0!==this.pluginEventHandlers.length?("function"==typeof this.boundPlugin.off&&this.pluginEventHandlers.forEach((function(t){var i=t.event,o=t.handler;e.boundPlugin.off(i,o)})),this._resetPluginEventBinding()):this._resetPluginEventBinding()},e.prototype._resetPluginEventBinding=function(){this.boundPlugin=null,this.pluginEventHandlers=[]},e.prototype._getWhiteboardPlugin=function(){var e,t,i;return(null===(i=null===(t=null===(e=this.trtc)||void 0===e?void 0:e._plugins)||void 0===t?void 0:t.get)||void 0===i?void 0:i.call(t,ds))||null},e.prototype._emitWhiteboardEvent=function(e,t){var i,o;void 0===t&&(t=[]),this.log.apply(this,p(["whiteboard event:",e],t,!1)),0!==t.length?null===(o=this.eventEmitter)||void 0===o||o.emit.apply(o,p([e],t,!1)):null===(i=this.eventEmitter)||void 0===i||i.emit(e)},e.prototype._applyRemoteCommand=function(e){return l(this,void 0,Promise,(function(){return h(this,(function(t){return this.log("remote whiteboard command handled by plugin internal sync, skip injection:",{ownerId:e.owner_id,strokeId:e.stroke_id,op:e.op}),[2]}))}))},e.prototype.on=function(e,t){var i;null===(i=this.eventEmitter)||void 0===i||i.on(e,t)},e.prototype.off=function(e,t){var i;null===(i=this.eventEmitter)||void 0===i||i.off(e,t)},e.prototype.destroy=function(){var t;return l(this,void 0,Promise,(function(){return h(this,(function(i){switch(i.label){case 0:return this.log("destroy"),[4,this._stop()];case 1:return i.sent(),this._offPluginEvents(),null===(t=this.eventEmitter)||void 0===t||t.removeAllListeners(),e.whiteboardManager=null,[2]}}))}))},e.prototype.log=function(){for(var e,t,i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];null===(t=null===(e=this.logger)||void 0===e?void 0:e.log)||void 0===t||t.call.apply(t,p([e,this.logPrefix],i,!1))},e.prototype.logError=function(){for(var e,t,i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];null===(t=null===(e=this.logger)||void 0===e?void 0:e.error)||void 0===t||t.call.apply(t,p([e,this.logPrefix],i,!1))},e.whiteboardManager=null,e}(),vs=function(){function e(){this.isRunning=!1,this.queue=[]}return Object.defineProperty(e.prototype,"length",{get:function(){return this.queue.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastQueueItem",{get:function(){return 0===this.length?null:this.queue[this.length-1]},enumerable:!1,configurable:!0}),e.prototype.push=function(e,t,i,o){var r,n;void 0===t&&(t=!1),void 0===i&&(i=!1);var s=c(c({},e),{functionName:o}),a=new Promise((function(e,t){s.resolve=e,s.reject=t}));if(s.promise=a,t)this.length<=1?this.queue.push(s):null===(n=null===(r=this.lastQueueItem)||void 0===r?void 0:r.promise)||void 0===n||n.then(s.resolve,s.reject);else{if(i&&o&&this.queue.length>1){var u=[];this.queue=this.queue.filter((function(e,t){return 0===t||(e.functionName!==o||(u.push(e),!1))})),u.forEach((function(e){e.reject(new Error("aborted by newer task"))}))}this.queue.push(s)}return this.isRunning||this.callNext(),a},e.prototype.shift=function(){return this.queue.shift()},e.prototype.callNext=function(){var e=this;if(!this.isRunning&&0!==this.length){var t=this.queue[0],i=t.fn,o=t.args,r=t.context,n=t.resolve,s=t.reject;this.isRunning=!0,i.apply(r,o).then(n,s).finally((function(){e.isRunning=!1,e.shift(),e.callNext()}))}},e}(),gs=new WeakMap,ms=new WeakMap,Ts=new WeakMap;function ys(e,t){return void 0===t&&(t={}),function(i,o,r){var n=r.value,s=t.deduplicate,a=void 0!==s&&s;return r.value=function(){for(var t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];var r=e.apply(void 0,t),s=Array.isArray(r)?r:[r],c=Ts.get(this)||new Map;Ts.set(this,c);for(var u=null,l=0,h=s;l<h.length;l++){var d=h[l],p=c.get(d);if(p){u=p;break}}for(var f=u||new vs,v=0,g=s;v<g.length;v++){d=g[v];c.set(d,f)}var m=a?o:void 0;return f.push({fn:n,args:t,context:this},!1,a,m)},r}}var _s=function(){function t(e){var t=this;this.logPrefix="[AITranscriberManager]",this.listeners=new Set,this.isPaused=!1,this.isMessageListenerRegistered=!1,this.handleMessageEvent=function(e){var i=t.createMessageFromEvent(e);t._notifyListeners("onReceiveTranscriberMessage",e.roomId,i)},this.handleStateEvent=function(e){var i=e.transcriberRobotId,o=e.state,r=e.roomId,n=e.sourceLanguage,s=void 0===n?"":n,a=e.error,c=e.errorMessage,u=void 0===c?"":c;if(r&&i){if("started"===o)t._notifyListeners("onRealtimeTranscriberStarted",r,i,s);else if("stopped"===o){t._notifyListeners("onRealtimeTranscriberStopped",r,i,0)}null!=a&&t._notifyListeners("onRealtimeTranscriberError",r,i,a,u)}},this.logger=e.logger,this.trtc=e.trtc,this.registerStateListener()}return t.prototype.registerStateListener=function(){this.trtc.on(e.EVENT.REALTIME_TRANSCRIBER_STATE_CHANGED,this.handleStateEvent)},t.prototype.createMessageFromEvent=function(e){var t,i,o,r;return{segmentId:null!==(t=null==e?void 0:e.segmentId)&&void 0!==t?t:"",speakerUserId:null!==(i=null==e?void 0:e.speakerUserId)&&void 0!==i?i:"",sourceText:null!==(o=null==e?void 0:e.sourceText)&&void 0!==o?o:"",translationTexts:(null==e?void 0:e.translationTexts)?new Map(Object.entries(e.translationTexts)):void 0,timestamp:null!==(r=null==e?void 0:e.timestamp)&&void 0!==r?r:Date.now(),isCompleted:Boolean(null==e?void 0:e.isCompleted)}},t.prototype.updateMessageSubscription=function(){var t=!this.isPaused&&this.listeners.size>0;if(t&&!this.isMessageListenerRegistered)return this.trtc.on(e.EVENT.REALTIME_TRANSCRIBER_MESSAGE,this.handleMessageEvent),void(this.isMessageListenerRegistered=!0);!t&&this.isMessageListenerRegistered&&(this.trtc.off(e.EVENT.REALTIME_TRANSCRIBER_MESSAGE,this.handleMessageEvent),this.isMessageListenerRegistered=!1)},t.prototype.log=function(){for(var e,t,i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];null===(t=null===(e=this.logger)||void 0===e?void 0:e.log)||void 0===t||t.call.apply(t,p([e,this.logPrefix],i,!1))},t.prototype.logError=function(){for(var e,t,i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];null===(t=null===(e=this.logger)||void 0===e?void 0:e.error)||void 0===t||t.call.apply(t,p([e,this.logPrefix],i,!1))},t.prototype._notifyListeners=function(e){for(var t=this,i=[],o=1;o<arguments.length;o++)i[o-1]=arguments[o];this.listeners.forEach((function(o){var r=o[e];if("function"==typeof r)try{r.apply(o,i)}catch(n){t.logError("Error notifying listener:",n)}}))},t.prototype.startRealtimeTranscriber=function(e){return l(this,void 0,Promise,(function(){var t,i,o;return h(this,(function(r){switch(r.label){case 0:if(this.log("startRealtimeTranscriber:",e),!(null==e?void 0:e.sourceLanguage))throw new Error("sourceLanguage is required");t={sourceLanguage:e.sourceLanguage},e.transcriberRobotId&&(t.transcriberRobotId=e.transcriberRobotId),void 0!==e.userIdsToTranscribe&&(t.userIdsToTranscribe=e.userIdsToTranscribe),void 0!==e.translationLanguages&&(t.translationLanguages=e.translationLanguages),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this.trtc.startPlugin("RealtimeTranscriber",t)];case 2:return i=r.sent(),this.log("startRealtimeTranscriber success, robotId:",i),[2,i];case 3:throw o=r.sent(),this.logError("startRealtimeTranscriber error:",o),o;case 4:return[2]}}))}))},t.prototype.stopRealtimeTranscriber=function(e){return l(this,void 0,Promise,(function(){var t;return h(this,(function(i){switch(i.label){case 0:if(this.log("stopRealtimeTranscriber:",e),!e)throw new Error("transcriberRobotId is required");i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this.trtc.stopPlugin("RealtimeTranscriber",{transcriberRobotId:e})];case 2:return i.sent(),this.log("stopRealtimeTranscriber success"),[3,4];case 3:throw t=i.sent(),this.logError("stopRealtimeTranscriber error:",t),t;case 4:return[2]}}))}))},t.prototype.pauseReceivingMessage=function(){this.isPaused||(this.log("pauseReceivingMessage"),this.isPaused=!0,this.updateMessageSubscription())},t.prototype.resumeReceivingMessage=function(){this.isPaused&&(this.log("resumeReceivingMessage"),this.isPaused=!1,this.updateMessageSubscription())},t.prototype.addListener=function(e){this.listeners.add(e),this.updateMessageSubscription()},t.prototype.removeListener=function(e){this.log("removeListener"),this.listeners.delete(e),this.updateMessageSubscription()},t.prototype.destroy=function(){this.log("destroy"),this.listeners.clear(),this.isPaused=!0,this.updateMessageSubscription(),this.trtc.off(e.EVENT.REALTIME_TRANSCRIBER_STATE_CHANGED,this.handleStateEvent)},t}(),Rs=void 0,bs=void 0,Cs=void 0,Ss=void 0,ws=e._loggerManager;ws.info("TRTCCloud Version: ".concat(Ln));var Es,Ms,As,Ps="trtcCloud",Is=1;navigator&&navigator.mediaDevices&&navigator.mediaDevices.addEventListener&&navigator.mediaDevices.addEventListener("devicechange",(Es=function(){0!==Ls.size&&Array.from(Ls.values()).forEach((function(e){e.fn()}))},Ms=30,function(){for(var e=this,t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];As>0&&clearTimeout(As),As=window.setTimeout((function(){Es.apply(e,t),As=-1}),Ms)}));var Ls=new Map,Vs=function(d){function f(i){void 0===i&&(i={});var o=d.call(this)||this;o._version="",o._frameWorkType=30,o._component=0,o._language=0,o._networkProxy={},o._localView=null,o._autoRecvAudio=!0,o._autoRecvVideo=!1,o._localTestView=null,o._isVideoPublish=!0,o._localRenderParams={rotation:I.TRTCVideoRotation0,fillMode:y.TRTCVideoFillMode_Fill,mirrorType:_.TRTCVideoMirrorType_Auto},o._encoderMirror=void 0,o._videoProfile={},o._isAudioPublish=!0,o._audioMuteType=!1,o._audioProfile=e.TYPE.AUDIO_PROFILE_STANDARD,o._captureVolume=100,o._playoutVolume=100,o._isSharingScreen=!1,o._remoteStreamConfig=new Map,o._remoteStreamMap=new Map,o._cameraList=[],o._microphoneList=[],o._speakerList=[],o._currentCamera={},o._currentMicrophone={},o._currentSpeaker={},o._currentCameraId="",o._currentMicrophoneId="",o._currentSpeakerId="",o._screenShareParams={option:{}},o._isMobile=jr,o._isFrontCamera=!0,o._cameraVideoTrack=null,o._smallStreamVideoProfile=void 0,o._qosPreference=void 0,o._defaultVideoProfile={width:640,height:480,frameRate:15,bitrate:900},o._defaultScreenProfile={width:1920,height:1080,frameRate:15,bitrate:1500},o._defaultSmallVideoProfile={width:160,height:120,frameRate:15,bitrate:200},o._isVirtualBackground=!1,o._isTestVirtualBackground=!1,o._isBeautyEnabled=!1,o._isTestBeautyEnabled=!1,o._currentAudioQuality=S.TRTCAudioQualityDefault,o._lastAudioScene=w.default,o._isAIDenoiserEnabled=!1,o._currentAIDenoiserMode=void 0,o._pendingAIDenoiserApply=!1,o._remoteStatisticsUserIdList=[],o._hasJoinedRoom=!1,o._isExitingRoom=!1,o._version=Ln;var a=i.frameWorkType,c=void 0===a?30:a,u=i.component,l=void 0===u?0:u,h=i.language,p=void 0===h?0:h;return o._frameWorkType=c,o._component=l,o._language=p,o._trtc=e.create({enableSEI:f.enableSEI,assetsPath:f.assetsPath,enableVolumeControlInIOS:!0,plugins:[n,t,r,s]}),o._testTrtc=e.create(),o._log=e._loggerManager,o.logger=new zn(ws,{seq:Is++}),o._echoCancellation=void 0,o._noiseSuppression=void 0,o._autoGainControl=void 0,o._addTRTCEvents(),o.handleDeviceChange=o.handleDeviceChange.bind(o),Ls.set(o,{fn:o.handleDeviceChange,self:o}),o}var v;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=e}a(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}(f,d),f.getPlugin=function(e){return"VirtualBackground"===e?i:"BasicBeauty"===e?o:"VideoMixer"===e?n:"Whiteboard"===e?s:null},f.getTRTCShareInstance=function(e){return f.shareInstance||(f.shareInstance=new f(e)),f.shareInstance},f.setLogLevel=function(t,i){var o,r=((o={})[j.TRTCLogLevelVerbose]=0,o[j.TRTCLogLevelDebug]=1,o[j.TRTCLogLevelInfo]=2,o[j.TRTCLogLevelWarn]=3,o[j.TRTCLogLevelError]=4,o[j.TRTCLogLevelFatal]=4,o[j.TRTCLogLevelNone]=5,o),n=r[t];Te(n)&&(n=r[j.TRTCLogLevelInfo]);var s=!_e(i)||i;e.setLogLevel(n,s)},f.destroyTRTCShareInstance=function(){f.shareInstance&&(f.shareInstance._destroy(),f.shareInstance=null),Array.from(f.subCloudMap.keys()).forEach((function(e){return e._destroy()}))},f.callExperimentalAPI=function(e){console.log("static ".concat(Ps,".callExperimentalAPI"),e);var t=Re(e);if(t!==e){var i=t.api,o=t.params;if(i&&o)try{switch(i){case"enableSEI":f.enableSEI=o.enable;break;case"setAssetsPath":f.assetsPath=o.assetsPath}}catch(r){throw r}}},f.prototype.createSubCloud=function(){if(this!==f.shareInstance)return null;var e=new f;return this._inheritPropertiesToSubCloud(e),this._inheritEventsToSubCloud(e),f.subCloudMap.set(e,e),e},f.prototype.destroy=function(){this!==f.shareInstance?(f.subCloudMap.get(this)&&f.subCloudMap.delete(this),this._destroy()):f.destroyTRTCShareInstance()},f.prototype._destroy=function(){Ls.delete(this),this.removeAllListeners(),this._trtc.off("*"),this._trtc.destroy(),this._trtc=null,this._testTrtc.off("*"),this._testTrtc.destroy(),this._testTrtc=null},f.prototype.getSDKVersion=function(){return this._version||""},f.prototype.enterRoom=function(e,t){return l(this,void 0,Promise,(function(){var i,o,r,n,s,a,u,l,d,p,f,v,g,m,T,y,_,R,b=this;return h(this,(function(h){switch(h.label){case 0:if(i=e.sdkAppId,o=e.userId,r=e.userSig,n=e.roomId,s=e.strRoomId,a=e.role,u=e.privateMapKey,l=e.businessInfo,d=e.enableAutoPlayDialog,p=e.proxy,f=e.streamId,v=e.userDefineRecordId,this.logger.update({sdkAppId:i,userId:o}),this.logger.info("".concat(Ps,".enterRoom with params: "),e,t),p&&(this._networkProxy=p),!(i&&o&&r))return[3,5];h.label=1;case 1:return h.trys.push([1,3,,4]),g={sdkAppId:i,userId:o,userSig:r,roomId:n,strRoomId:s,role:fe[a],scene:ve[t],autoReceiveAudio:this._autoRecvAudio,autoReceiveVideo:this._autoRecvVideo,frameWorkType:this._frameWorkType,component:this._component,language:this._language},g=u?c(c({},g),{privateMapKey:u}):g,g=l?c(c({},g),{businessInfo:l}):g,m=d||this._enableAutoPlayDialog,g=_e(m)?c(c({},g),{enableAutoPlayDialog:m}):g,g=this._networkProxy?c(c({},g),{proxy:this._networkProxy}):g,g=f?c(c({},g),{streamId:f}):g,g=v?c(c({},g),{userDefineRecordId:v}):g,g=void 0!==this._latencyLevel?c(c({},g),{latencyLevel:this._latencyLevel}):g,T=me(),[4,this._trtc.enterRoom(g)];case 2:return h.sent(),this._hasJoinedRoom=!0,this._sdkAppId=i,this._userId=o,this._userSig=r,this._pendingAIDenoiserApply&&(this._pendingAIDenoiserApply=!1,this._applyAIDenoiserDecision().catch((function(e){b.logger.warn("".concat(Ps,".enterRoom flush AI denoiser decision fail: "),e)}))),y=me()-T,this.emit("onEnterRoom",y),[3,4];case 3:throw _=h.sent(),R=(R=this._transformTRTCErrorCode(_,"enterRoom"))<0?R:-1,this.emit("onEnterRoom",R),this._callFunctionErrorManage(_,"enterRoom"),_;case 4:return[3,6];case 5:this._emitError(Pn),h.label=6;case 6:return[2]}}))}))},f.prototype.exitRoom=function(){return l(this,void 0,Promise,(function(){var e;return h(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),this.logger.info("".concat(Ps,".exitRoom")),this._isExitingRoom=!0,this._isSharingScreen&&this.stopScreenShare(),this.resetTRTCCloud(),this.stopLocalPreview(),this.stopLocalAudio(),[4,this._trtc.exitRoom()];case 1:return t.sent(),this._hasJoinedRoom=!1,this._isExitingRoom=!1,this._isVideoPublish=!0,this._isAudioPublish=!0,this.emit("onExitRoom",hn.exitRoom),[3,3];case 2:throw e=t.sent(),this._callFunctionErrorManage(e,"exitRoom"),e;case 3:return[2]}}))}))},f.prototype.switchRole=function(e){return l(this,void 0,void 0,(function(){var t;return h(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(Ps,".switchRole with param: "),e),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this._trtc.switchRole(fe[e])];case 2:return i.sent(),this.emit("onSwitchRole",0,"switch role success, role = ".concat(e,", ").concat(fe[e])),[3,4];case 3:throw t=i.sent(),this.emit("onSwitchRole",null==t?void 0:t.getCode(),t.message),t;case 4:return[2]}}))}))},f.prototype.setDefaultStreamRecvMode=function(e,t){return l(this,void 0,void 0,(function(){return h(this,(function(i){return this.logger.info("".concat(Ps,".setDefaultStreamRecvMode with param: "),{autoRecvAudio:e,autoRecvVideo:t}),_e(e)&&(this._autoRecvAudio=e),_e(t)&&(this._autoRecvVideo=t),[2]}))}))},f.prototype.resetTRTCCloud=function(){if(this._setIsAudioPublish(!0),this._setAudioMuteType(!1),this._echoCancellation=void 0,this._noiseSuppression=void 0,this._autoGainControl=void 0,this._isVirtualBackground=!1,this._isTestVirtualBackground=!1,this._remoteStatisticsUserIdList=[],this._resetBeautyStyle(),this._sdkAppId=void 0,this._userId=void 0,this._userSig=void 0,this._currentAudioQuality=S.TRTCAudioQualityDefault,this._lastAudioScene=w.default,this._isAIDenoiserEnabled&&this._trtc)try{this._trtc.stopPlugin(he)}catch(e){this.logger.warn("".concat(Ps,".resetTRTCCloud stop AI denoiser fail: "),e)}this._isAIDenoiserEnabled=!1,this._currentAIDenoiserMode=void 0,this._pendingAIDenoiserApply=!1},f.prototype._updateLocalVideo=function(){return l(this,void 0,void 0,(function(){var t;return h(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this._trtc.updateLocalVideo(this._generateLocalVideoData())];case 1:return i.sent(),[3,3];case 2:if((t=i.sent()).code!==e.ERROR_CODE.OPERATION_ABORT)throw t;return[3,3];case 3:return[2]}}))}))},f.prototype._updateLocalTestVideo=function(){return l(this,void 0,void 0,(function(){var t;return h(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this._testTrtc.updateLocalVideo(this._generateLocalTestVideoData())];case 1:return i.sent(),[3,3];case 2:if((t=i.sent()).code!==e.ERROR_CODE.OPERATION_ABORT)throw t;return[3,3];case 3:return[2]}}))}))},f.prototype._updateLocalScreen=function(){return l(this,void 0,void 0,(function(){var t;return h(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this._trtc.updateScreenShare(this._getScreenShareParams())];case 1:return i.sent(),[3,3];case 2:if((t=i.sent()).code!==e.ERROR_CODE.OPERATION_ABORT)throw t;return[3,3];case 3:return[2]}}))}))},f.prototype._updateRemoteVideo=function(t,i){return l(this,void 0,void 0,(function(){var o;return h(this,(function(r){switch(r.label){case 0:if(!this._hasJoinedRoom||this._isExitingRoom)return[2];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this._trtc.updateRemoteVideo(this._generateRemoteVideoData(t,i))];case 2:return r.sent(),[3,4];case 3:if((o=r.sent()).code!==e.ERROR_CODE.OPERATION_ABORT)throw o;return[3,4];case 4:return[2]}}))}))},f.prototype.startLocalPreview=function(){for(var t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];return l(this,void 0,Promise,(function(){var i,o,r,n,s;return h(this,(function(a){switch(a.label){case 0:this.logger.info("".concat(Ps,".startLocalPreview with params: "),t),1===p([],t,!0).length?o=p([],t,!0)[0]:2===p([],t,!0).length&&(s=p([],t,!0),i=s[0],o=s[1]),Te(i)||(this._setIsMobile(!0),this._setIsFrontCamera(i)),this._setLocalView(o),a.label=1;case 1:a.trys.push([1,9,,10]),a.label=2;case 2:return a.trys.push([2,4,,8]),[4,this._trtc.startLocalVideo(this._generateLocalVideoData())];case 3:return a.sent(),[3,8];case 4:return(r=a.sent()).code!==e.ERROR_CODE.OPERATION_ABORT?[3,6]:[4,this._updateLocalVideo()];case 5:return a.sent(),[3,7];case 6:throw r;case 7:return[3,8];case 8:return this.emit("onCameraDidReady"),[3,10];case 9:throw n=a.sent(),this._callFunctionErrorManage(n,"startLocalPreview"),n;case 10:return[2]}}))}))},f.prototype.updateLocalView=function(e){return l(this,void 0,void 0,(function(){return h(this,(function(t){switch(t.label){case 0:return this.logger.info("".concat(Ps,".updateLocalView with param: "),e),this._setLocalView(e),[4,this._updateLocalVideo()];case 1:return t.sent(),[2]}}))}))},f.prototype.stopLocalPreview=function(){return l(this,void 0,void 0,(function(){var e;return h(this,(function(t){switch(t.label){case 0:this.logger.info("".concat(Ps,".stopLocalPreview")),t.label=1;case 1:return t.trys.push([1,3,,4]),this._setLocalView(null),[4,this._trtc.stopLocalVideo()];case 2:return t.sent(),this.emit("onCameraStopped"),[3,4];case 3:throw e=t.sent(),console.warn("".concat(Ps," stopLocalPreview error: ").concat(e)),this._callFunctionErrorManage(e,"stopLocalPreview"),e;case 4:return[2]}}))}))},f.prototype.muteLocalVideo=function(e){return void 0===e&&(e=!1),l(this,void 0,void 0,(function(){var t;return h(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(Ps,".muteLocalVideo with params: "),e),i.label=1;case 1:return i.trys.push([1,3,,4]),this._setIsVideoPublish(!e),[4,this._updateLocalVideo()];case 2:return i.sent(),[3,4];case 3:throw t=i.sent(),this._callFunctionErrorManage(t,"muteLocalVideo"),t;case 4:return[2]}}))}))},f.prototype.startRemoteView=function(t,i,o){return l(this,void 0,void 0,(function(){var r,n;return h(this,(function(s){switch(s.label){case 0:this.logger.info("".concat(Ps,".startRemoteView with params: "),t,i,o),s.label=1;case 1:if(s.trys.push([1,9,,10]),this._setRemoteStreamConfig(t,o,{view:i,small:o===T.TRTCVideoStreamTypeSmall}),!this._remoteStreamMap.get("".concat(t,"_").concat(this._getTRTCStreamType(o))))return[2];s.label=2;case 2:return s.trys.push([2,4,,8]),[4,this._trtc.startRemoteVideo(this._generateRemoteVideoData(t,o))];case 3:return s.sent(),[3,8];case 4:return(r=s.sent()).code!==e.ERROR_CODE.OPERATION_ABORT?[3,6]:[4,this._updateRemoteVideo(t,o)];case 5:return s.sent(),[3,7];case 6:throw r;case 7:return[3,8];case 8:return[3,10];case 9:throw n=s.sent(),this._callFunctionErrorManage(n,"startRemoteView"),n;case 10:return[2]}}))}))},f.prototype.updateRemoteView=function(e,t,i){return l(this,void 0,void 0,(function(){return h(this,(function(o){switch(o.label){case 0:return this.logger.info("".concat(Ps,".updateRemoteView with params: "),e,t,i),this._setRemoteStreamConfig(e,i,{view:t}),this._remoteStreamMap.get("".concat(e,"_").concat(this._getTRTCStreamType(i)))?[4,this._updateRemoteVideo(e,i)]:[2];case 1:return o.sent(),[2]}}))}))},f.prototype.stopRemoteView=function(e,t){return l(this,void 0,void 0,(function(){var i;return h(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(Ps,".stopRemoteView with params: "),e,t),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,this._trtc.stopRemoteVideo({userId:e,streamType:this._getTRTCStreamType(t)})];case 2:return o.sent(),[3,4];case 3:throw i=o.sent(),this._callFunctionErrorManage(i,"stopRemoteView"),i;case 4:return[2]}}))}))},f.prototype.stopAllRemoteView=function(){return l(this,void 0,void 0,(function(){var e;return h(this,(function(t){switch(t.label){case 0:this.logger.info("".concat(Ps,".stopAllRemoteView")),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this._trtc.stopRemoteVideo({userId:"*"})];case 2:return t.sent(),[3,4];case 3:throw e=t.sent(),this._callFunctionErrorManage(e,"stopAllRemoteView"),e;case 4:return[2]}}))}))},f.prototype.setVideoEncoderParam=function(e){return l(this,void 0,void 0,(function(){var t,i;return h(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(Ps,".setVideoEncoderParam with params: "),e),o.label=1;case 1:return o.trys.push([1,4,,5]),t=this._getTRTCVideoProfile(T.TRTCVideoStreamTypeBig,e),this._setVideoProfile(t),[4,this._updateLocalVideo()];case 2:return o.sent(),[4,this._updateLocalTestVideo()];case 3:return o.sent(),[3,5];case 4:throw i=o.sent(),this._callFunctionErrorManage(i,"setVideoEncoderParam"),i;case 5:return[2]}}))}))},f.prototype.setNetworkQosParam=function(e){return l(this,void 0,void 0,(function(){var t,i,o=this;return h(this,(function(r){return this.logger.info("".concat(Ps,".setNetworkQosParam with params: "),e),t=e.preference,i=this._getTRTCQosPreference(t),this._setQosPreference(i),this._setScreenShareParams({qosPreference:i}),[2,new Promise((function(e,t){Promise.all([o._updateLocalVideo(),o._updateLocalScreen()]).then((function(){e(!0)})).catch((function(e){o._callFunctionErrorManage(e,"setNetworkQosParam"),t(e)}))}))]}))}))},f.prototype.setLocalRenderParams=function(e){return l(this,void 0,void 0,(function(){var t;return h(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(Ps,".setLocalRenderParams with params: "),e),Object.assign(this._localRenderParams,e),i.label=1;case 1:return i.trys.push([1,4,,5]),[4,this._updateLocalVideo()];case 2:return i.sent(),[4,this._updateLocalTestVideo()];case 3:return i.sent(),[3,5];case 4:throw t=i.sent(),this._callFunctionErrorManage(t,"setLocalRenderParams"),t;case 5:return[2]}}))}))},f.prototype.setVideoEncoderMirror=function(e){return l(this,void 0,void 0,(function(){var t;return h(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(Ps,".setVideoEncoderMirror with params: "),e),this._encoderMirror=e,i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this._updateLocalVideo()];case 2:return i.sent(),[3,4];case 3:throw t=i.sent(),this._callFunctionErrorManage(t,"setVideoEncoderMirror"),t;case 4:return[2]}}))}))},f.prototype.setRemoteRenderParams=function(e,t,i){return l(this,void 0,void 0,(function(){var o;return h(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(Ps,".setRemoteRenderParams with params: "),e,t,i),r.label=1;case 1:return r.trys.push([1,3,,4]),this._setRemoteStreamConfig(e,t,i),[4,this._updateRemoteVideo(e,t)];case 2:return r.sent(),[3,4];case 3:throw o=r.sent(),this._callFunctionErrorManage(o,"setRemoteRenderParams"),o;case 4:return[2]}}))}))},f.prototype._updateLocalAudio=function(){return l(this,void 0,void 0,(function(){var t;return h(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this._trtc.updateLocalAudio(this._generateLocalAudioData())];case 1:return i.sent(),[3,3];case 2:if((t=i.sent()).code!==e.ERROR_CODE.OPERATION_ABORT)throw t;return[3,3];case 3:return[2]}}))}))},f.prototype._updateLocalTestAudio=function(){return l(this,void 0,void 0,(function(){var t;return h(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this._testTrtc.updateLocalAudio(this._generateLocalTestAudioData())];case 1:return i.sent(),[3,3];case 2:if((t=i.sent()).code!==e.ERROR_CODE.OPERATION_ABORT)throw t;return[3,3];case 3:return[2]}}))}))},f.prototype.startLocalAudio=function(t){return void 0===t&&(t=S.TRTCAudioQualityDefault),l(this,void 0,void 0,(function(){var i,o,r;return h(this,(function(n){switch(n.label){case 0:t===S.TRTCAudioQualitySpeech?this.logger.warn("Web trtcCloud not support audioQuality of TRTCAudioQualitySpeech, and will use TRTCAudioQualityDefault"):this.logger.info("".concat(Ps,".startLocalAudio with params: "),t),this._currentAudioQuality=t,i=this._getTRTCAudioQuality(t),n.label=1;case 1:n.trys.push([1,11,,12]),this._setAudioProfile(i),n.label=2;case 2:return n.trys.push([2,4,,8]),[4,this._trtc.startLocalAudio(this._generateLocalAudioData())];case 3:return n.sent(),[3,8];case 4:return(o=n.sent()).code!==e.ERROR_CODE.OPERATION_ABORT?[3,6]:[4,this._updateLocalAudio()];case 5:return n.sent(),[3,7];case 6:throw o;case 7:return[3,8];case 8:return this.emit("onMicDidReady"),this._lastAudioScene===w.default?[3,10]:[4,this._applyAIDenoiserDecision()];case 9:n.sent(),n.label=10;case 10:return[3,12];case 11:throw r=n.sent(),console.warn("".concat(Ps," startLocalAudio error: ").concat(r)),this._callFunctionErrorManage(r,"startLocalAudio"),r;case 12:return[2]}}))}))},f.prototype.stopLocalAudio=function(){return l(this,void 0,void 0,(function(){var e;return h(this,(function(t){switch(t.label){case 0:this.logger.info("".concat(Ps,".stopLocalAudio")),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this._trtc.stopLocalAudio()];case 2:return t.sent(),[3,4];case 3:throw e=t.sent(),this._callFunctionErrorManage(e,"stopLocalAudio"),e;case 4:return[2]}}))}))},f.prototype.muteLocalAudio=function(e){return void 0===e&&(e=!1),l(this,void 0,void 0,(function(){var t;return h(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(Ps,".muteLocalAudio with params: "),e),i.label=1;case 1:return i.trys.push([1,3,,4]),this._setAudioMuteType(!!e&&"microphone"),[4,this._updateLocalAudio()];case 2:return i.sent(),[3,4];case 3:throw t=i.sent(),this._callFunctionErrorManage(t,"muteLocalAudio"),t;case 4:return[2]}}))}))},f.prototype.setAudioCaptureVolume=function(e){return l(this,void 0,void 0,(function(){var t;return h(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(Ps,".setAudioCaptureVolume with params: "),e),i.label=1;case 1:return i.trys.push([1,3,,4]),this._setCaptureVolume(e),[4,this._updateLocalAudio()];case 2:return i.sent(),[3,4];case 3:throw t=i.sent(),this._callFunctionErrorManage(t,"setAudioCaptureVolume"),t;case 4:return[2]}}))}))},f.prototype.getAudioCaptureVolume=function(){return this.logger.info("".concat(Ps,".getAudioCaptureVolume")),this._getCaptureVolume()},f.prototype.setAudioPlayoutVolume=function(e){return l(this,void 0,void 0,(function(){var t;return h(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(Ps,".setAudioPlayoutVolume with params: "),e),i.label=1;case 1:return i.trys.push([1,3,,4]),this._playoutVolume=e,[4,this._trtc.setRemoteAudioVolume("*",e)];case 2:return i.sent(),[3,4];case 3:throw t=i.sent(),this._callFunctionErrorManage(t,"setAudioPlayoutVolume"),t;case 4:return[2]}}))}))},f.prototype.getAudioPlayoutVolume=function(){return this.logger.info("".concat(Ps,".getAudioPlayoutVolume")),this._playoutVolume},f.prototype.muteRemoteAudio=function(e,t){return void 0===t&&(t=!1),l(this,void 0,void 0,(function(){var i;return h(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(Ps,".muteRemoteAudio with params: "),e,t),o.label=1;case 1:return o.trys.push([1,3,,4]),e?[4,this._trtc.muteRemoteAudio(e,t)]:(this._emitError(Pn),[2]);case 2:return o.sent(),[3,4];case 3:throw i=o.sent(),this._callFunctionErrorManage(i,"muteRemoteAudio"),i;case 4:return[2]}}))}))},f.prototype.muteAllRemoteAudio=function(e){this.logger.info("".concat(Ps,".muteAllRemoteAudio with params: "),e);try{this._trtc.muteRemoteAudio("*",e)}catch(t){throw this._callFunctionErrorManage(t,"muteAllRemoteAudio"),t}},f.prototype.muteRemoteVideoStream=function(e,t,i){return l(this,void 0,void 0,(function(){var o;return h(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(Ps,".muteRemoteVideoStream with params: "),e,t,i),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this._trtc.updateRemoteVideo({userId:e,mute:t,streamType:this._getTRTCStreamType(i)})];case 2:return r.sent(),[3,4];case 3:throw o=r.sent(),this._callFunctionErrorManage(o,"muteRemoteVideoStream"),o;case 4:return[2]}}))}))},f.prototype.muteAllRemoteVideoStreams=function(e){return l(this,void 0,void 0,(function(){var t;return h(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(Ps,".muteAllRemoteVideoStreams with params: "),e),i.label=1;case 1:return i.trys.push([1,6,,7]),e?[4,this._trtc.callExperimentalAPI("pauseRemotePlayer",{userId:"*"})]:[3,3];case 2:return i.sent(),[3,5];case 3:return[4,this._trtc.callExperimentalAPI("resumeRemotePlayer",{userId:"*"})];case 4:i.sent(),i.label=5;case 5:return[3,7];case 6:throw t=i.sent(),this._callFunctionErrorManage(t,"muteAllRemoteVideoStreams"),t;case 7:return[2]}}))}))},f.prototype.setRemoteAudioVolume=function(e,t){this.logger.info("".concat(Ps,".setRemoteAudioVolume with params: "),e,t);try{this._trtc.setRemoteAudioVolume(e,t)}catch(i){throw this._callFunctionErrorManage(i,"setRemoteAudioVolume"),i}},f.prototype.enableAudioVolumeEvaluation=function(e){this.logger.info("".concat(Ps,".enableAudioVolumeEvaluation with params: "),e);try{this._trtc.enableAudioVolumeEvaluation(e)}catch(t){throw this._callFunctionErrorManage(t,"enableAudioVolumeEvaluation"),t}},f.prototype.enableSmallVideoStream=function(e,t){return l(this,void 0,Promise,(function(){var i;return h(this,(function(o){switch(o.label){case 0:return this.logger.info("".concat(Ps,".enableSmallVideoStream with params: "),e,t),e?(i=this._getTRTCVideoProfile(T.TRTCVideoStreamTypeSmall,t),this._setSmallStreamVideoProfile(i)):this._setSmallStreamVideoProfile(void 0),[4,this._updateLocalVideo()];case 1:return o.sent(),[2]}}))}))},f.prototype.snapshotVideo=function(e,t){var i="";return i=""===e&&t===T.TRTCVideoStreamTypeBig?this._trtc.getVideoSnapshot():""===e&&t===T.TRTCVideoStreamTypeSub?this._trtc.getVideoSnapshot({streamType:this._getTRTCStreamType(t)}):this._trtc.getVideoSnapshot({userId:e,streamType:this._getTRTCStreamType(t)}),this.emit("onSnapshotComplete",e,t,i),i},f.prototype.startScreenShare=function(t,i,o){return l(this,void 0,void 0,(function(){var r,n,s,a,c,u;return h(this,(function(l){switch(l.label){case 0:this.logger.info("".concat(Ps,".startScreenShare with params: "),t,i,o),l.label=1;case 1:return l.trys.push([1,3,,4]),n=(r=o||{}).screenAudio,s=void 0!==n&&n,a=r.videoTrack,c=this._getTRTCVideoProfile(T.TRTCVideoStreamTypeSub,o),this._setScreenShareParams({view:t,profile:c,systemAudio:s,videoTrack:a,streamType:i}),[4,this._trtc.startScreenShare(this._getScreenShareParams())];case 2:return l.sent(),this._isSharingScreen=!0,this.emit("onScreenCaptureStarted"),[3,4];case 3:if(u=l.sent(),this._callFunctionErrorManage(u,"startScreenShare"),u.code!==e.ERROR_CODE.OPERATION_ABORT)throw console.error("Start share screen error:",u,u.code,u.name,u.message),u;return[3,4];case 4:return[2]}}))}))},f.prototype.setSubStreamEncoderParam=function(e){return l(this,void 0,void 0,(function(){var t,i;return h(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(Ps,".setSubStreamEncoderParam with params: "),e),t=this._getTRTCVideoProfile(T.TRTCVideoStreamTypeSub,e),this._setScreenShareParams({profile:t}),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,this._updateLocalScreen()];case 2:return o.sent(),[3,4];case 3:throw i=o.sent(),this._callFunctionErrorManage(i,"setSubStreamEncoderParam"),i;case 4:return[2]}}))}))},f.prototype.stopScreenShare=function(){return l(this,void 0,Promise,(function(){var e;return h(this,(function(t){switch(t.label){case 0:this.logger.info("".concat(Ps,".stopScreenShare")),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this._trtc.stopScreenShare()];case 2:return t.sent(),this._clearScreenShareParams(),this._isSharingScreen=!1,this.emit("onScreenCaptureStopped",0),[3,4];case 3:throw e=t.sent(),this._callFunctionErrorManage(e,"stopScreenShare"),e;case 4:return[2]}}))}))},f.prototype._startPublishVideoTrack=function(t){var i=t.videoTrack,o=t.streamType,r=void 0===o?T.TRTCVideoStreamTypeBig:o;return l(this,void 0,void 0,(function(){var t,o,n,s;return h(this,(function(a){switch(a.label){case 0:if(r!==T.TRTCVideoStreamTypeSub)return[3,10];a.label=1;case 1:a.trys.push([1,8,,9]),a.label=2;case 2:return a.trys.push([2,4,,7]),[4,this._trtc.startScreenShare({publish:!0,streamType:e.TYPE.STREAM_TYPE_SUB,option:{videoTrack:i}})];case 3:return a.sent(),[3,7];case 4:return(t=a.sent()).code!==e.ERROR_CODE.OPERATION_ABORT?[3,6]:[4,this._trtc.updateScreenShare({publish:!0,option:{videoTrack:i}})];case 5:a.sent(),a.label=6;case 6:throw t;case 7:return[3,9];case 8:return o=a.sent(),this._callFunctionErrorManage(o,"startPublishVideoTrack"),[3,9];case 9:return[2];case 10:a.trys.push([10,17,,18]),a.label=11;case 11:return a.trys.push([11,13,,16]),[4,this._trtc.startLocalVideo({option:{videoTrack:i,profile:this._getVideoProfile()},forcePublish:!0})];case 12:return a.sent(),[3,16];case 13:return(n=a.sent()).code!==e.ERROR_CODE.OPERATION_ABORT?[3,15]:[4,this._trtc.updateLocalVideo({option:{videoTrack:i,profile:this._getVideoProfile()},forcePublish:!0})];case 14:a.sent(),a.label=15;case 15:throw n;case 16:return[3,18];case 17:return s=a.sent(),this._callFunctionErrorManage(s,"startPublishVideoTrack"),[3,18];case 18:return[2]}}))}))},f.prototype._stopPublishVideoTrack=function(e){var t=(void 0===e?{}:e).streamType,i=void 0===t?T.TRTCVideoStreamTypeBig:t;return l(this,void 0,void 0,(function(){return h(this,(function(e){switch(e.label){case 0:return i!==T.TRTCVideoStreamTypeSub?[3,2]:[4,this._trtc.stopScreenShare()];case 1:case 3:return e.sent(),[2];case 2:return this._cameraVideoTrack=null,[4,this._trtc.stopLocalVideo()]}}))}))},f.prototype.startScreenCapture=function(){this._emitError(In)},f.prototype.pauseScreenCapture=function(){this._emitError(In)},f.prototype.resumeScreenCapture=function(){this._emitError(In)},f.prototype.getScreenCaptureSources=function(){this._emitError(In)},f.prototype.selectScreenCaptureTarget=function(){this._emitError(In)},f.prototype.getCameraDevicesList=function(){return l(this,void 0,Promise,(function(){var t,i,o;return h(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(Ps,".getCameraDevicesList")),r.label=1;case 1:return r.trys.push([1,5,,6]),[4,e.getCameraList()];case 2:return t=r.sent(),i=t.map((function(e){return c(c({},e),{deviceName:e.label})})),this._cameraList=t,"{}"!==JSON.stringify(this._currentCamera)?[3,4]:(this._currentCamera=this.getDefaultDeviceInfo(t),this._currentCameraId=this._currentCamera.deviceId,[4,this.setCurrentCameraDevice(this._currentCameraId)]);case 3:r.sent(),r.label=4;case 4:return[2,Promise.resolve(i)];case 5:return o=r.sent(),this._callFunctionErrorManage(o,"getCameraDevicesList"),[2,Promise.resolve([])];case 6:return[2]}}))}))},f.prototype.setCurrentCameraDevice=function(e){var t;return l(this,void 0,Promise,(function(){var i;return h(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(Ps,".setCurrentCameraDevice with params: "),{cameraId:e}),o.label=1;case 1:return o.trys.push([1,4,,5]),e?(this._currentCameraId=e,[4,this._updateLocalVideo()]):[2,!1];case 2:return o.sent(),[4,this._updateLocalTestVideo()];case 3:return o.sent(),this._currentCamera=this._cameraList.find((function(t){return t.deviceId===e}))||{},[3,5];case 4:throw i=o.sent(),this._currentCameraId=null===(t=this._currentCamera)||void 0===t?void 0:t.cameraId,this._callFunctionErrorManage(i,"setCurrentCameraDevice"),i;case 5:return[2]}}))}))},f.prototype.getCurrentCameraDevice=function(){this.logger.info("".concat(Ps,".getCurrentCameraDevice"));var e=this._currentCamera,t=e.deviceId,i=e.label,o=e.kind,r=e.groupId;return new P(t,i,o,i,r)},f.prototype.isFrontCamera=function(){return this._getIsFrontCamera()},f.prototype.switchCamera=function(e){return l(this,void 0,void 0,(function(){return h(this,(function(t){switch(t.label){case 0:return this.logger.info("".concat(Ps,".switchCamera with params: "),e),this._setIsFrontCamera(e),[4,this._updateLocalVideo()];case 1:return t.sent(),[4,this._updateLocalTestVideo()];case 2:return t.sent(),[2]}}))}))},f.prototype._onVirtualBackgroundError=function(e){this._emitError({code:-1006,message:e.message?e.message:"virtual background error"})},f.prototype.setVirtualBackground=function(e){return l(this,void 0,void 0,(function(){var t,i,o,r,n;return h(this,(function(s){switch(s.label){case 0:return s.trys.push([0,10,,11]),t=e.enable,i=e.type,o=e.blurLevel,r=e.imagePath,t?this._isVirtualBackground?i!==de?[3,2]:[4,this._trtc.updatePlugin(ue,{type:i,blurLevel:o})]:[3,5]:[3,8];case 1:s.sent(),s.label=2;case 2:return i!==pe?[3,4]:[4,this._trtc.updatePlugin(ue,{type:i,src:r})];case 3:s.sent(),s.label=4;case 4:return[3,7];case 5:return[4,this._trtc.startPlugin(ue,c(c({},e),{src:r,onAbort:this._onVirtualBackgroundError.bind(this)}))];case 6:s.sent(),this._isVirtualBackground=!0,s.label=7;case 7:return[3,9];case 8:this._trtc.stopPlugin(ue),this._isVirtualBackground=!1,s.label=9;case 9:return[3,11];case 10:throw n=s.sent(),this.logger.error("".concat(Ps,".setVirtualBackground fail: "),n),n;case 11:return[2]}}))}))},f.prototype.setTestVirtualBackground=function(e){return l(this,void 0,void 0,(function(){var t,i,o,r,n;return h(this,(function(s){switch(s.label){case 0:return s.trys.push([0,10,,11]),t=e.enable,i=e.type,o=e.blurLevel,r=e.imagePath,t?this._isTestVirtualBackground?i!==de?[3,2]:[4,this._testTrtc.updatePlugin(ue,{type:i,blurLevel:o})]:[3,5]:[3,8];case 1:s.sent(),s.label=2;case 2:return i!==pe?[3,4]:[4,this._testTrtc.updatePlugin(ue,{type:i,src:r})];case 3:s.sent(),s.label=4;case 4:return[3,7];case 5:return[4,this._testTrtc.startPlugin(ue,c(c({},e),{src:r,onAbort:this._onVirtualBackgroundError.bind(this)}))];case 6:s.sent(),this._isTestVirtualBackground=!0,s.label=7;case 7:return[3,9];case 8:this._testTrtc.stopPlugin(ue),this._isTestVirtualBackground=!1,s.label=9;case 9:return[3,11];case 10:throw n=s.sent(),this.logger.error("".concat(Ps,".setTestVirtualBackground fail: "),n),n;case 11:return[2]}}))}))},f.prototype.useVirtualBackground=function(e){return l(this,void 0,void 0,(function(){return h(this,(function(t){switch(t.label){case 0:return this._trtc?[4,this._trtc.use({plugin:i,assetsPath:e})]:[3,2];case 1:t.sent(),t.label=2;case 2:return this._testTrtc?[4,this._testTrtc.use({plugin:i,assetsPath:e})]:[3,4];case 3:t.sent(),t.label=4;case 4:return[2]}}))}))},f.prototype.setBeautyStyle=function(e,t,i,o){return l(this,void 0,void 0,(function(){return h(this,(function(r){switch(r.label){case 0:return[4,this._handleBeautyStyleParam(this._trtc,this._isBeautyEnabled,e,t,i,o,!1)];case 1:return r.sent(),[2]}}))}))},f.prototype.setTestBeautyStyle=function(e,t,i,o){return l(this,void 0,void 0,(function(){return h(this,(function(r){switch(r.label){case 0:return[4,this._handleBeautyStyleParam(this._testTrtc,this._isTestBeautyEnabled,e,t,i,o,!0)];case 1:return r.sent(),[2]}}))}))},f.prototype.useBeautyStyle=function(e){return l(this,void 0,void 0,(function(){return h(this,(function(t){switch(t.label){case 0:return this._trtc?[4,this._trtc.use({plugin:o,assetsPath:e})]:[3,2];case 1:t.sent(),t.label=2;case 2:return this._testTrtc?[4,this._testTrtc.use({plugin:o,assetsPath:e})]:[3,4];case 3:t.sent(),t.label=4;case 4:return[2]}}))}))},f.prototype._setAudioQualityEx=function(e){return l(this,void 0,void 0,(function(){var t;return h(this,(function(i){switch(i.label){case 0:return t=(e||{}).audioScene,ye(t)?(this.logger.info("".concat(Ps,"._setAudioQualityEx audioScene=").concat(t)),this._lastAudioScene=t,[4,this._applyAIDenoiserDecision()]):(this.logger.warn("".concat(Ps,"._setAudioQualityEx invalid audioScene: "),t),[2]);case 1:return i.sent(),[2]}}))}))},f.prototype._applyAIDenoiserDecision=function(){return l(this,void 0,void 0,(function(){var e,t,i,o,r;return h(this,(function(n){switch(n.label){case 0:if(e=this._currentAudioQuality,t=this._lastAudioScene,!(void 0===(i=this._resolveAIDenoiserMode(e,t))||this._sdkAppId&&this._userId&&this._userSig))return this._pendingAIDenoiserApply=!0,this.logger.info("".concat(Ps,".applyAIDenoiserDecision pending: enterRoom not ready, will retry after enterRoom success")),[2];n.label=1;case 1:return n.trys.push([1,9,,10]),void 0!==i?[3,4]:this._isAIDenoiserEnabled?[4,this._trtc.stopPlugin(he)]:[3,3];case 2:n.sent(),this._isAIDenoiserEnabled=!1,this._currentAIDenoiserMode=void 0,n.label=3;case 3:return[2];case 4:return this._isAIDenoiserEnabled?[3,6]:(o={sdkAppId:this._sdkAppId,userId:this._userId,userSig:this._userSig,mode:i},f.assetsPath&&(o.assetsPath=f.assetsPath),[4,this._trtc.startPlugin(he,o)]);case 5:return n.sent(),this._isAIDenoiserEnabled=!0,this._currentAIDenoiserMode=i,[2];case 6:return this._currentAIDenoiserMode===i?[3,8]:[4,this._trtc.updatePlugin(he,{mode:i})];case 7:n.sent(),this._currentAIDenoiserMode=i,n.label=8;case 8:return[3,10];case 9:return r=n.sent(),this.logger.error("".concat(Ps,".applyAIDenoiserDecision fail: "),r),[3,10];case 10:return[2]}}))}))},f.prototype._resolveAIDenoiserMode=function(e,t){if(t!==w.default&&e!==S.TRTCAudioQualityMusic)return e===S.TRTCAudioQualitySpeech?1:0},f.prototype._handleBeautyStyleParam=function(e,t,i,o,r,n,s){return l(this,void 0,void 0,(function(){var i,a,c,u,l;return h(this,(function(h){switch(h.label){case 0:if(o<0||o>9)throw new Error("beautyLevel must be between 0 and 9");if(r<0||r>9)throw new Error("whitenessLevel must be between 0 and 9");if(n<0||n>9)throw new Error("ruddinessLevel must be between 0 and 9");h.label=1;case 1:return h.trys.push([1,8,,9]),a=r/9,c=n/9,0===(i=o/9)&&0===a&&0===c?[4,e.stopPlugin(le)]:[3,3];case 2:return h.sent(),s?this._isTestBeautyEnabled=!1:this._isBeautyEnabled=!1,[3,7];case 3:return u={beauty:i,brightness:a,ruddy:c},t?[3,5]:[4,e.startPlugin(le,u)];case 4:return h.sent(),s?this._isTestBeautyEnabled=!0:this._isBeautyEnabled=!0,[3,7];case 5:return[4,e.updatePlugin(le,u)];case 6:h.sent(),h.label=7;case 7:return[3,9];case 8:throw l=h.sent(),s?this.logger.error("".concat(Ps,".").concat("setTestBeautyStyle"," fail: "),l):this.logger.error("".concat(Ps,".").concat("setBeautyStyle"," fail: "),l),l;case 9:return[2]}}))}))},f.prototype._resetBeautyStyle=function(){return l(this,void 0,void 0,(function(){return h(this,(function(e){switch(e.label){case 0:return this._isBeautyEnabled?[4,this._trtc.stopPlugin(le)]:[3,2];case 1:e.sent(),this._isBeautyEnabled=!1,e.label=2;case 2:return this._isTestBeautyEnabled?[4,this._testTrtc.stopPlugin(le)]:[3,4];case 3:e.sent(),this._isTestBeautyEnabled=!1,e.label=4;case 4:return[2]}}))}))},f.prototype.getMicDevicesList=function(){return l(this,void 0,Promise,(function(){var t,i,o;return h(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(Ps,".getMicDevicesList")),r.label=1;case 1:return r.trys.push([1,5,,6]),[4,e.getMicrophoneList()];case 2:return t=r.sent(),i=t.map((function(e){return c(c({},e),{deviceName:e.label})})),this._microphoneList=t,"{}"!==JSON.stringify(this._currentMicrophone)?[3,4]:(this._currentMicrophone=this.getDefaultDeviceInfo(t),this._currentMicrophoneId=this._currentMicrophone.deviceId,[4,this.setCurrentMicDevice(this._currentMicrophoneId)]);case 3:r.sent(),r.label=4;case 4:return[2,Promise.resolve(i)];case 5:return o=r.sent(),this._callFunctionErrorManage(o,"getMicDevicesList"),[2,Promise.resolve([])];case 6:return[2]}}))}))},f.prototype.setCurrentMicDevice=function(e){var t;return l(this,void 0,Promise,(function(){var i;return h(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(Ps,".setCurrentMicDevice with params: "),{micId:e}),o.label=1;case 1:return o.trys.push([1,4,,5]),e?(this._setCurrentMicrophoneId(e),[4,this._updateLocalAudio()]):[2,!1];case 2:return o.sent(),[4,this._updateLocalTestAudio()];case 3:return o.sent(),this._currentMicrophone=this._microphoneList.find((function(t){return t.deviceId===e}))||{},[3,5];case 4:throw i=o.sent(),this._setCurrentMicrophoneId(null===(t=this._currentMicrophone)||void 0===t?void 0:t.deviceId),this._callFunctionErrorManage(i,"setCurrentMicDevice"),i;case 5:return[2]}}))}))},f.prototype.getCurrentMicDevice=function(){this.logger.info("".concat(Ps,".getCurrentMicDevice"));var e=this._currentMicrophone,t=e.deviceId,i=e.label,o=e.kind,r=e.groupId;return new P(t,i,o,i,r)},f.prototype.getSpeakerDevicesList=function(){return l(this,void 0,Promise,(function(){var t,i,o;return h(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(Ps,".getSpeakerDevicesList")),r.label=1;case 1:return r.trys.push([1,5,,6]),[4,e.getSpeakerList()];case 2:return t=r.sent(),i=t.map((function(e){return c(c({},e),{deviceName:e.label})})),this._speakerList=t,"{}"!==JSON.stringify(this._currentSpeaker)?[3,4]:(this._currentSpeaker=this.getDefaultDeviceInfo(t),this._currentSpeakerId=this._currentSpeaker.deviceId,[4,this.setCurrentSpeakerDevice(this._currentSpeakerId)]);case 3:r.sent(),r.label=4;case 4:return[2,Promise.resolve(i)];case 5:return o=r.sent(),this._callFunctionErrorManage(o,"getSpeakerDevicesList"),[2,Promise.resolve([])];case 6:return[2]}}))}))},f.prototype.setCurrentSpeakerDevice=function(t){return l(this,void 0,Promise,(function(){var i;return h(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(Ps,".setCurrentSpeakerDevice with params: "),{speakerId:t}),o.label=1;case 1:return o.trys.push([1,3,,4]),t?[4,e.setCurrentSpeaker(t)]:[2,!1];case 2:return o.sent(),this._setCurrentSpeakerId(t),this._currentSpeaker=this._speakerList.find((function(e){return e.deviceId===t}))||{},[3,4];case 3:throw i=o.sent(),this._callFunctionErrorManage(i,"setCurrentSpeakerDevice"),i;case 4:return[2]}}))}))},f.prototype.getCurrentSpeakerDevice=function(){this.logger.info("".concat(Ps,".getCurrentSpeakerDevice"));var e=this._currentSpeaker,t=e.deviceId,i=e.label,o=e.kind,r=e.groupId;return new P(t,i,o,i,r)},f.prototype.startCameraDeviceTest=function(t){return l(this,void 0,void 0,(function(){var i;return h(this,(function(o){switch(o.label){case 0:if(this.logger.info("".concat(Ps,".startCameraDeviceTest with params: "),t),!t)return[2];this._setLocalTestView(t),o.label=1;case 1:return o.trys.push([1,3,,7]),[4,this._testTrtc.startLocalVideo(this._generateLocalTestVideoData())];case 2:return o.sent(),[3,7];case 3:return(i=o.sent()).code!==e.ERROR_CODE.OPERATION_ABORT?[3,5]:[4,this._updateLocalTestVideo()];case 4:return o.sent(),[3,6];case 5:throw this._callFunctionErrorManage(i,"startCameraDeviceTest"),i;case 6:return[3,7];case 7:return[2]}}))}))},f.prototype.stopCameraDeviceTest=function(){return l(this,void 0,void 0,(function(){return h(this,(function(e){switch(e.label){case 0:return this.logger.info("".concat(Ps,".stopCameraDeviceTest")),this._setLocalTestView(null),[4,this._testTrtc.stopLocalVideo()];case 1:return e.sent(),[2]}}))}))},f.prototype.startMicDeviceTest=function(t){return l(this,void 0,void 0,(function(){var i,o=this;return h(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(Ps,".startMicDeviceTest with params: "),t),r.label=1;case 1:return r.trys.push([1,3,,7]),[4,this._testTrtc.startLocalAudio(this._generateLocalTestAudioData())];case 2:return r.sent(),[3,7];case 3:return(i=r.sent()).code!==e.ERROR_CODE.OPERATION_ABORT?[3,5]:[4,this._updateLocalTestAudio()];case 4:return r.sent(),[3,6];case 5:throw this._callFunctionErrorManage(i,"startMicDeviceTest"),i;case 6:return[3,7];case 7:return this._testTrtc.on(e.EVENT.AUDIO_VOLUME,(function(e){null==e||e.result.forEach((function(e){var t=e.userId,i=e.volume;""===t&&o.emit("onTestMicVolume",i)}))})),[4,this._testTrtc.enableAudioVolumeEvaluation(t)];case 8:return r.sent(),[2]}}))}))},f.prototype.stopMicDeviceTest=function(){return l(this,void 0,void 0,(function(){return h(this,(function(e){switch(e.label){case 0:return this.logger.info("".concat(Ps,".stopMicDeviceTest")),[4,this._testTrtc.stopLocalAudio()];case 1:return e.sent(),[2]}}))}))},f.prototype.callExperimentalAPI=function(e){return l(this,void 0,void 0,(function(){var t,i,o;return h(this,(function(r){switch(r.label){case 0:if(this.logger.info("".concat(Ps,".callExperimentalAPI"),e),(t=Re(e))===e)return[2];if(i=t.api,o=t.params,!i||!o)return[2];r.label=1;case 1:switch(r.trys.push([1,29,,30]),i){case"setFramework":return[3,2];case"enableAudioAEC":return[3,3];case"enableAudioANS":return[3,4];case"enableAudioAGC":return[3,5];case"KeyMetricsStats":return[3,6];case"setNetworkProxy":return[3,7];case"enableVirtualBackground":return[3,8];case"enableTestVirtualBackground":return[3,10];case"enableTestBeautyStyle":return[3,12];case"setVideoEncodeParamEx":return[3,14];case"enableAutoPlayDialog":return[3,15];case"setAudioQualityEx":return[3,16];case"setAudienceLatencyLevel":return[3,18];case"switchPlaybackQuality":return[3,19];case"requestPictureInPicture":return[3,21];case"exitPictureInPicture":return[3,23];case"OnRecvWhiteboardCommand":return[3,25]}return[3,27];case 2:return this._handleSetFrameWork(o),[3,28];case 3:return this._echoCancellation=Boolean(o.enable),[3,28];case 4:return this._noiseSuppression=Boolean(o.enable),[3,28];case 5:return this._autoGainControl=Boolean(o.enable),[3,28];case 6:return this._handleKeyMetricsStats(o),[3,28];case 7:return this._networkProxy=o,[3,28];case 8:return[4,this.setVirtualBackground(o)];case 9:return r.sent(),[3,28];case 10:return[4,this.setTestVirtualBackground(o)];case 11:return r.sent(),[3,28];case 12:return[4,this.setTestBeautyStyle(o.style,o.beautyLevel,o.whitenessLevel,o.ruddinessLevel)];case 13:return r.sent(),[3,28];case 14:return this._setVideoEncodeParamEx(o),[3,28];case 15:return this._enableAutoPlayDialog=Boolean(o.enable),[3,28];case 16:return[4,this._setAudioQualityEx(o)];case 17:return r.sent(),[3,28];case 18:return this._latencyLevel=o.latencyLevel,[3,28];case 19:return[4,this._switchPlaybackQuality(o)];case 20:return r.sent(),[3,28];case 21:return[4,this._requestPictureInPicture()];case 22:return r.sent(),[3,28];case 23:return[4,this._exitPictureInPicture()];case 24:return r.sent(),[3,28];case 25:return[4,this.getWhiteboardManager().onRecvWhiteboardCommand(JSON.parse(o))];case 26:return r.sent(),[3,28];case 27:return[3,28];case 28:return[3,30];case 29:throw r.sent();case 30:return[2]}}))}))},f.prototype._handleSetFrameWork=function(e){var t=e.frameWork,i=e.component,o=e.language;ye(t)&&(this._frameWorkType=t),ye(i)&&(this._component=i),ye(o)&&(this._language=o)},f.prototype._handleKeyMetricsStats=function(t){var i=t.key,o=t.opt,r=t.value,n=t.version,s=o===ge;e._addKVStat({type:o,key:i,value:r,version:n,useUV:s,base:100})},f.prototype._setVideoEncodeParamEx=function(e){return l(this,void 0,void 0,(function(){return h(this,(function(t){switch(t.label){case 0:switch(e.streamType){case T.TRTCVideoStreamTypeBig:return[3,1];case T.TRTCVideoStreamTypeSub:return[3,3]}return[3,5];case 1:return[4,this.setVideoEncoderParam(e)];case 2:case 4:return t.sent(),[3,6];case 3:return[4,this.setSubStreamEncoderParam(e)];case 5:return[3,6];case 6:return[2]}}))}))},f.prototype._switchPlaybackQuality=function(e){return l(this,void 0,void 0,(function(){var t,i,o,r,n,s,a,c;return h(this,(function(u){switch(u.label){case 0:if(i=(t=e||{}).quality,o=t.stream_list,r=void 0===o?[]:o,!i||0===r.length)return[2];for(n=null,s=0,a=r;s<a.length;s++)(c=a[s]).name===i&&(n=c),c.userId=c.user_id;return n&&n.user_id?[4,this._trtc.callExperimentalAPI("switchPlaybackQuality",{streamList:r,quality:n.name,autoUnmuteAudio:!0})]:[2];case 1:return u.sent(),[2]}}))}))},f.prototype._requestPictureInPicture=function(){return l(this,void 0,void 0,(function(){return h(this,(function(e){switch(e.label){case 0:return this.logger.info("".concat(Ps,"._requestPictureInPicture")),[4,this._trtc.callExperimentalAPI("requestPictureInPicture",{enable:!0})];case 1:return e.sent(),[2]}}))}))},f.prototype._exitPictureInPicture=function(){return l(this,void 0,void 0,(function(){return h(this,(function(e){switch(e.label){case 0:return this.logger.info("".concat(Ps,"._exitPictureInPicture")),[4,this._trtc.callExperimentalAPI("requestPictureInPicture",{enable:!1})];case 1:return e.sent(),[2]}}))}))},f.prototype._emitError=function(e){e&&this.emit&&this.emit(ne,e.code,e.message)},f.prototype._emitWarning=function(e){this.emit&&this.emit(se,e)},f.prototype._transformTRTCServerError=function(e){return-8===e.extraCode?An:0===String(e.extraCode).indexOf("70")?0-e.extraCode:void 0},f.prototype._transformTRTCInvalidOperationError=function(e,t){return"enterRoom"!==t||5104!==e.extraCode&&5998!==e.code?e.code:mn},f.prototype._isCameraError=function(e){return["startLocalPreview","updateLocalView","muteLocalVideo","setVideoEncoderParam","setCurrentCameraDevice","switchCamera","setLocalRenderParams","enableSmallVideoStream","startCameraDeviceTest"].includes(e)},f.prototype._isMicError=function(e){return["startLocalAudio","muteLocalAudio","setAudioCaptureVolume","setCurrentMicDevice","startMicDeviceTest"].includes(e)},f.prototype._transformTRTCDeviceError=function(e,t){var i=this._isCameraError(t),o=this._isMicError(t),r="startScreenShare"===t;switch(e.extraCode){case 5301:case 5305:case 5306:case 5307:case 5308:case 5309:if(i)return Tn;if(o)return bn;if(r)return En;break;case 5302:if(i)return yn;if(o)return Cn;if(r)return Mn;break;case 5303:if(i)return Rn;if(o)return wn;if(r)return En;break;case 5304:if(i)return _n;if(o)return Sn;if(r)return En}},f.prototype._transformTRTCUnKnowError=function(e,t){var i=this._isCameraError(t),o=this._isMicError(t);return i?Tn:o?bn:e.code},f.prototype._transformTRTCErrorCode=function(t,i){var o=null==t?void 0:t.code;if(t&&t.code)switch(t.code){case e.ERROR_CODE.DEVICE_ERROR:o=this._transformTRTCDeviceError(t,i);break;case e.ERROR_CODE.SERVER_ERROR:o=this._transformTRTCServerError(t);break;case e.ERROR_CODE.INVALID_OPERATION:case e.ERROR_CODE.OPERATION_ABORT:o=this._transformTRTCInvalidOperationError(t,i);break;case e.ERROR_CODE.UNKNOWN_ERROR:o=this._transformTRTCUnKnowError(t,i)}return o},f.prototype._callFunctionErrorManage=function(t,i){if(!t||t.code!==e.ERROR_CODE.OPERATION_ABORT){this.logger.warn("(".concat(i,") failed - ").concat(t.code," - ").concat(t.message));var o=this._transformTRTCErrorCode(t,i),r=t.message;"startScreenShare"===i&&(r=JSON.stringify({name:t.originError.name,message:r})),this.emit(ne,o,r)}},f.prototype._getTRTCResolution=function(e){var t=(m[e]||"").split("_");return{width:+(t.length>1&&t[1]),height:+(t.length>2&&t[2])}},f.prototype._getTRTCVideoProfile=function(e,t){void 0===t&&(t={});var i=t.videoWidth,o=t.videoHeight,r=t.videoResolution,n=t.videoFps,s=t.videoBitrate,a=t.resMode,c=t.resolutionMode,u={};switch(e){case T.TRTCVideoStreamTypeSub:u=this._defaultScreenProfile;break;case T.TRTCVideoStreamTypeSmall:u=this._defaultSmallVideoProfile;break;case T.TRTCVideoStreamTypeBig:default:u=this._defaultVideoProfile}if(Te(r))Te(i)||(u.width=i),Te(o)||(u.height=o);else{var l=this._getTRTCResolution(r);u.width=l.width,u.height=l.height}if(!Te(a)&&a===D.TRTCVideoResolutionModePortrait||!Te(c)&&c===D.TRTCVideoResolutionModePortrait){var h=u.height,d=u.width;u.width=h,u.height=d}return n&&(u.frameRate=n),s&&(u.bitrate=s),u},f.prototype._getTRTCStreamType=function(t){var i;return((i={})[T.TRTCVideoStreamTypeBig]=e.TYPE.STREAM_TYPE_MAIN,i[T.TRTCVideoStreamTypeSmall]=e.TYPE.STREAM_TYPE_MAIN,i[T.TRTCVideoStreamTypeSub]=e.TYPE.STREAM_TYPE_SUB,i)[t]},f.prototype._getTRTCFillMode=function(e){var t;return((t={})[y.TRTCVideoFillMode_Fill]=ln.COVER,t[y.TRTCVideoFillMode_Fit]=ln.CONTAIN,t)[e]},f.prototype._getTRTCCloudVideoFillMode=function(e){var t;return((t={})[ln.COVER]=y.TRTCVideoFillMode_Fill,t[ln.CONTAIN]=y.TRTCVideoFillMode_Fit,t)[e]},f.prototype._getTRTCCloudMirrorType=function(e){return!0===e?_.TRTCVideoMirrorType_Enable:_.TRTCVideoMirrorType_Disable},f.prototype._getLocalRenderMirror=function(e){var t;return e===_.TRTCVideoMirrorType_Auto?!this._getIsMobile()||this._getIsFrontCamera():((t={})[_.TRTCVideoMirrorType_Enable]=!0,t[_.TRTCVideoMirrorType_Disable]=!1,t)[e]},f.prototype._getTRTCLocalMirror=function(e,t){var i=this._getLocalRenderMirror(e);return Te(t)?!!i&&"both":i&&t?"both":i&&!t?"view":!i&&t?"publish":!(!i&&!t)&&"view"},f.prototype._getTRTCRemoteMirror=function(e){var t;return((t={})[_.TRTCVideoMirrorType_Auto]=!1,t[_.TRTCVideoMirrorType_Enable]=!0,t[_.TRTCVideoMirrorType_Disable]=!1,t)[e]},f.prototype._getTRTCQosPreference=function(t){var i;return((i={})[k.TRTCVideoQosPreferenceSmooth]=e.TYPE.QOS_PREFERENCE_SMOOTH,i[k.TRTCVideoQosPreferenceClear]=e.TYPE.QOS_PREFERENCE_CLEAR,i)[t]},f.prototype._getTRTCAudioQuality=function(t){var i;return((i={})[S.TRTCAudioQualitySpeech]=e.TYPE.AUDIO_PROFILE_STANDARD,i[S.TRTCAudioQualityDefault]=e.TYPE.AUDIO_PROFILE_STANDARD,i[S.TRTCAudioQualityMusic]=e.TYPE.AUDIO_PROFILE_HIGH_STEREO,i)[t]},f.prototype._getTRTCCloudDeviceType=function(e){return{camera:A.TRTCDeviceTypeCamera,microphone:A.TRTCDeviceTypeMic,speaker:A.TRTCDeviceTypeSpeaker}[e]},f.prototype._getTRTCCloudDeviceState=function(e){return{add:M.TRTCDeviceStateAdd,remove:M.TRTCDeviceStateRemove,active:M.TRTCDeviceStateActive}[e]},f.prototype._getTRTCCloudQuality=function(e){return[x.TRTCQuality_Unknown,x.TRTCQuality_Excellent,x.TRTCQuality_Good,x.TRTCQuality_Poor,x.TRTCQuality_Bad,x.TRTCQuality_Vbad,x.TRTCQuality_Down][e]},f.prototype._generateLocalVideoData=function(){var e={view:this._getLocalView(),publish:this._getIsVideoPublish(),option:{profile:this._getVideoProfile(),small:this._getSmallStreamVideoProfile()||!1,mirror:this._getTRTCLocalMirror(this._localRenderParams.mirrorType,this._encoderMirror),fillMode:this._getTRTCFillMode(this._localRenderParams.fillMode)}};return this._cameraVideoTrack?e&&Object.assign(e.option,{videoTrack:this._cameraVideoTrack}):this._getIsMobile()?e&&Object.assign(e.option,{useFrontCamera:this._getIsFrontCamera()}):e&&Object.assign(e.option,{cameraId:this._getCurrentCameraId()}),this._getQosPreference()&&e&&Object.assign(e.option,{qosPreference:this._getQosPreference()}),e},f.prototype._generateLocalTestVideoData=function(){var e={view:this._getLocalTestView(),publish:!1,option:{profile:this._getVideoProfile(),mirror:this._getTRTCLocalMirror(this._localRenderParams.mirrorType,this._encoderMirror),fillMode:this._getTRTCFillMode(this._localRenderParams.fillMode)}};return this._getIsMobile()?e&&Object.assign(e.option,{useFrontCamera:this._getIsFrontCamera()}):e&&Object.assign(e.option,{cameraId:this._getCurrentCameraId()}),e},f.prototype._generateLocalAudioData=function(){var e={publish:this._getIsAudioPublish(),mute:this._getAudioMuteType(),muteKeepVolumeDetection:!0,option:{microphoneId:this._getCurrentMicrophoneId(),profile:this._getAudioProfile(),captureVolume:this._getCaptureVolume()}};return _e(this._echoCancellation)&&(e.option.echoCancellation=this._echoCancellation),_e(this._autoGainControl)&&(e.option.autoGainControl=this._autoGainControl),_e(this._noiseSuppression)&&(e.option.noiseSuppression=this._noiseSuppression),e},f.prototype._generateLocalTestAudioData=function(){return{publish:!1,option:{microphoneId:this._getCurrentMicrophoneId(),profile:this._getAudioProfile()}}},f.prototype._generateRemoteVideoData=function(e,t){return Se(this._remoteStreamConfig.get("".concat(e,"_").concat(this._getTRTCStreamType(t))))},f.prototype._addTRTCEvents=function(){var t=this;this._trtc.on(e.EVENT.ERROR,(function(e){e&&t.emit("onError",e.code,e.message)})),this._trtc.on(e.EVENT.REMOTE_USER_ENTER,(function(e){(null==e?void 0:e.userId)&&t.emit("onRemoteUserEnterRoom",e.userId)})),this._trtc.on(e.EVENT.REMOTE_USER_EXIT,(function(e){(null==e?void 0:e.userId)&&t.emit("onRemoteUserLeaveRoom",e.userId)})),this._trtc.on(e.EVENT.REMOTE_AUDIO_AVAILABLE,(function(e){(null==e?void 0:e.userId)&&t.emit("onUserAudioAvailable",e.userId,!0)})),this._trtc.on(e.EVENT.REMOTE_AUDIO_UNAVAILABLE,(function(e){(null==e?void 0:e.userId)&&t.emit("onUserAudioAvailable",e.userId,!1)})),this._trtc.on(e.EVENT.REMOTE_VIDEO_AVAILABLE,(function(e){t._emitVideoAvailable(e,!0)})),this._trtc.on(e.EVENT.REMOTE_VIDEO_UNAVAILABLE,(function(e){t._emitVideoAvailable(e,!1)})),this._trtc.on(e.EVENT.AUDIO_VOLUME,(function(e){(null==e?void 0:e.result)&&t.emit("onUserVoiceVolume",null==e?void 0:e.result,((null==e?void 0:e.result)||[]).length)})),this._trtc.on(e.EVENT.KICKED_OUT,(function(e){var i={banned:hn.banned,room_disband:hn.roomDisband};ye(i[e.reason])&&t.emit("onExitRoom",i[e.reason])})),this._trtc.on(e.EVENT.NETWORK_QUALITY,(function(e){var i=e.uplinkNetworkQuality,o=e.downlinkNetworkQuality,r=new z("",t._getTRTCCloudQuality(i)),n=[];t._remoteStatisticsUserIdList.length>0&&(n=t._remoteStatisticsUserIdList.map((function(e){return new z(e,t._getTRTCCloudQuality(o))}))),t.emit("onNetworkQuality",r,n)})),this._trtc.on(e.EVENT.AUTOPLAY_FAILED,(function(e){t.emit("onAutoPlayFailed",e)})),this._trtc.on(e.EVENT.SEI_MESSAGE,(function(e){if(e.data&&"object"==typeof e.data&&e.data instanceof ArrayBuffer){for(var i=new Uint8Array(e.data),o="",r=0;r<i.length;r++)o+=String.fromCharCode(i[r]);e.stringData=o}t.emit("onRecvSEIMsg",e.userId,JSON.stringify(e))})),this._trtc.on(e.EVENT.STATISTICS,(function(e){var i,o=e.rtt,r=e.upLoss,n=e.downLoss,s=e.bytesSent,a=e.bytesReceived,c=e.localStatistics,u=e.remoteStatistics;t._remoteStatisticsUserIdList=u.map((function(e){return e.userId}));var l={big:T.TRTCVideoStreamTypeBig,small:T.TRTCVideoStreamTypeSmall,sub:T.TRTCVideoStreamTypeSub},h=(null===(i=c.video)||void 0===i?void 0:i.length)>0?c.video.map((function(e){var t=new W;return t.width=e.width,t.height=e.height,t.frameRate=e.frameRate,t.videoBitrate=e.bitrate,t.audioBitrate=c.audio.bitrate||0,t.streamType=l[e.videoType],t})):[];if(0===h.length&&c.audio.bitrate>0){var d=new W;d.audioBitrate=c.audio.bitrate||0,h.push(d)}var p=[];u.forEach((function(e){var t=[],i=e.userId,o=e.audio.bitrate;if(e.video&&e.video.forEach((function(e){var r=new H;r.userId=i,r.width=e.width,r.height=e.height,r.frameRate=e.frameRate,r.videoBitrate=e.bitrate,r.audioBitrate=o||0,r.streamType=l[e.videoType],t.push(r)})),0===t.length){var r=new H;r.userId=i,r.audioBitrate=o||0,t.push(r)}p.push.apply(p,t)}));var f=new Q;f.upLoss=r,f.downLoss=n,f.rtt=o,f.sentBytes=s,f.receivedBytes=a,f.localStatisticsArray=h,f.localStatisticsArraySize=h.length,f.remoteStatisticsArray=p,f.remoteStatisticsArraySize=p.length,t.emit("onStatistics",f)})),this._trtc.on(e.EVENT.SCREEN_SHARE_STOPPED,(function(){t.emit("onScreenCaptureStopped",0),t._clearScreenShareParams(),t._isSharingScreen=!1})),this._trtc.on(e.EVENT.PUBLISH_STATE_CHANGED,(function(e){var i=e.mediaType;"started"===e.state&&("audio"===i?t.emit("onSendFirstLocalAudioFrame"):"video"===i?t.emit("onSendFirstLocalVideoFrame",T.TRTCVideoStreamTypeBig):"screen"===i&&t.emit("onSendFirstLocalVideoFrame",T.TRTCVideoStreamTypeSub))})),this._trtc.on(e.EVENT.FIRST_VIDEO_FRAME,(function(e){var i=e.userId,o=e.streamType,r=e.width,n=e.height;t.emit("onFirstVideoFrame",i,o,r,n)})),this._trtc.on(e.EVENT.AUDIO_PLAY_STATE_CHANGED,(function(e){var i=e.userId;"PLAYING"===e.state&&t.emit("onFirstAudioFrame",i)})),this._trtc.on(e.EVENT.DEVICE_CHANGED,(function(e){var i=e.type,o=e.device,r=e.action,n=o.deviceId;if("active"===r){switch(i){case"camera":t._currentCameraId=n,t._currentCamera=o;break;case"microphone":t._currentMicrophoneId=n,t._currentMicrophone=o;break;case"speaker":t._currentSpeakerId=n,t._currentSpeaker=o}t.emitOnDeviceChange(n,t._getTRTCCloudDeviceType(i),t._getTRTCCloudDeviceState(r))}})),this._trtc.on(e.EVENT.CUSTOM_MESSAGE,(function(e){e&&t.emit("onRecvCustomCmdMsg",e.userId,e.cmdId,e.seq,null==e?void 0:e.data)})),this._trtc.on(e.EVENT.CONNECTION_STATE_CHANGED,(function(e){t._hasJoinedRoom&&!t._isExitingRoom&&("CONNECTED"===e.prevState&&"DISCONNECTED"===e.state?t.emit("onConnectionLost"):"DISCONNECTED"===e.prevState&&"CONNECTING"===e.state?t.emit("onTryToReconnect"):"CONNECTING"===e.prevState&&"CONNECTED"===e.state&&t.emit("onConnectionRecovery"))})),this._trtc.on(e.EVENT.PICTURE_IN_PICTURE_STATE_CHANGED,(function(e){t.emit("onPictureInPictureStateChanged",e)}))},f.prototype._removeTRTCEvents=function(){this._trtc.off("*")},f.prototype._emitVideoAvailable=function(t,i){var o=t.userId,r=t.streamType;i?this._remoteStreamMap.set("".concat(o,"_").concat(r),!0):this._remoteStreamMap.delete("".concat(o,"_").concat(r)),r===e.TYPE.STREAM_TYPE_SUB?o&&this.emit("onUserSubStreamAvailable",o,i):o&&this.emit("onUserVideoAvailable",o,i)},f.prototype._setLocalView=function(e){this._localView=e},f.prototype._getLocalView=function(){return this._localView},f.prototype._setIsMobile=function(e){this._isMobile=e},f.prototype._getIsMobile=function(){return this._isMobile},f.prototype._setIsFrontCamera=function(e){this._isFrontCamera=e},f.prototype._getIsFrontCamera=function(){return this._isFrontCamera},f.prototype._getSmallStreamVideoProfile=function(){return this._smallStreamVideoProfile},f.prototype._setSmallStreamVideoProfile=function(e){this._smallStreamVideoProfile=e},f.prototype._setIsVideoPublish=function(e){this._isVideoPublish=e},f.prototype._getIsVideoPublish=function(){return this._isVideoPublish},f.prototype._setVideoProfile=function(e){this._videoProfile=e},f.prototype._getVideoProfile=function(){return this._videoProfile},f.prototype._setQosPreference=function(e){this._qosPreference=e},f.prototype._getQosPreference=function(){return this._qosPreference},f.prototype._setLocalTestView=function(e){this._localTestView=e},f.prototype._getLocalTestView=function(){return this._localTestView},f.prototype._setScreenShareParams=function(e){var t=e.view,i=e.systemAudio,o=e.fillMode,r=e.profile,n=e.videoTrack,s=e.qosPreference;Te(t)||(this._screenShareParams.view=t),Te(i)||(this._screenShareParams.option.systemAudio=i),Te(o)||(this._screenShareParams.option.fillMode=o),Te(r)||(this._screenShareParams.option.profile=r),Te(n)||(this._screenShareParams.option.videoTrack=n),Te(s)||(this._screenShareParams.option.qosPreference=s),Te(e.streamType)||(this._screenShareParams.streamType=this._getTRTCStreamType(e.streamType))},f.prototype._clearScreenShareParams=function(){var e,t,i,o,r;(null===(e=this._screenShareParams)||void 0===e?void 0:e.view)&&delete this._screenShareParams.view,(null===(i=null===(t=this._screenShareParams)||void 0===t?void 0:t.option)||void 0===i?void 0:i.systemAudio)&&delete this._screenShareParams.option.systemAudio,(null===(r=null===(o=this._screenShareParams)||void 0===o?void 0:o.option)||void 0===r?void 0:r.videoTrack)&&delete this._screenShareParams.option.videoTrack},f.prototype._getScreenShareParams=function(){return this._screenShareParams},f.prototype._setIsAudioPublish=function(e){this._isAudioPublish=e},f.prototype._getIsAudioPublish=function(){return this._isAudioPublish},f.prototype._setAudioMuteType=function(e){this._audioMuteType=e},f.prototype._getAudioMuteType=function(){return this._audioMuteType},f.prototype._setAudioProfile=function(e){this._audioProfile=e},f.prototype._getAudioProfile=function(){return this._audioProfile},f.prototype._getCaptureVolume=function(){return this._captureVolume},f.prototype._setCaptureVolume=function(e){this._captureVolume=e},f.prototype._setCurrentCameraId=function(e){this._currentCameraId=e},f.prototype._getCurrentCameraId=function(){return this._currentCameraId},f.prototype._setCurrentMicrophoneId=function(e){this._currentMicrophoneId=e},f.prototype._getCurrentMicrophoneId=function(){return this._currentMicrophoneId},f.prototype._setCurrentSpeakerId=function(e){this._currentSpeakerId=e},f.prototype._getCurrentSpeakerId=function(){return this._currentSpeakerId},f.prototype._setRemoteStreamConfig=function(e,t,i){var o=this._remoteStreamConfig.get("".concat(e,"_").concat(this._getTRTCStreamType(t)));o||(o={userId:e,streamType:this._getTRTCStreamType(t),option:{mirror:this._getTRTCRemoteMirror(_.TRTCVideoMirrorType_Disable),fillMode:this._getTRTCFillMode(y.TRTCVideoFillMode_Fit)}});var r=i.view,n=i.mirrorType,s=i.fillMode,a=i.small;Te(r)||(o.view=r),Te(n)||(o.option.mirror=this._getTRTCRemoteMirror(n)),Te(s)||(o.option.fillMode=this._getTRTCFillMode(s)),Te(a)||(o.option.small=a),this._remoteStreamConfig.set("".concat(e,"_").concat(this._getTRTCStreamType(t)),o)},f.prototype._inheritPropertiesToSubCloud=function(e){e._frameWorkType=this._frameWorkType,e._component=this._component,e._language=this._language,e._networkProxy=c({},this._networkProxy),e._latencyLevel=this._latencyLevel,e._enableAutoPlayDialog=this._enableAutoPlayDialog},f.prototype._inheritEventsToSubCloud=function(t){var i=this;t._trtc.on(e.EVENT.AUTOPLAY_FAILED,(function(e){i.emit("onAutoPlayFailed",e)})),t._trtc.on(e.EVENT.PICTURE_IN_PICTURE_STATE_CHANGED,(function(e){i.emit("onPictureInPictureStateChanged",e)}))},f.prototype.handleDeviceChange=function(){return l(this,void 0,void 0,(function(){var t=this;return h(this,(function(i){return e.getCameraList().then((function(e){return l(t,void 0,void 0,(function(){return h(this,(function(t){switch(t.label){case 0:return this._cameraList.length===e.length?[2]:[4,this.deviceChangeManage(this._cameraList,e,A.TRTCDeviceTypeCamera)];case 1:return t.sent(),this._cameraList=e,[2]}}))}))})),e.getMicrophoneList().then((function(e){return l(t,void 0,void 0,(function(){return h(this,(function(t){switch(t.label){case 0:return[4,this.deviceChangeManage(this._microphoneList,e,A.TRTCDeviceTypeMic)];case 1:return t.sent(),this._microphoneList=e,[2]}}))}))})),e.getSpeakerList().then((function(e){return l(t,void 0,void 0,(function(){return h(this,(function(t){switch(t.label){case 0:return[4,this.deviceChangeManage(this._speakerList,e,A.TRTCDeviceTypeSpeaker)];case 1:return t.sent(),this._speakerList=e,[2]}}))}))})),[2]}))}))},f.prototype.isSameDevice=function(e,t){var i=e&&e.deviceId&&e.groupId&&e.label,o=t&&t.deviceId&&t.groupId&&t.label;return!(!i||!o)&&(e.deviceId===t.deviceId&&e.groupId===t.groupId&&e.label===t.label)},f.prototype.deviceChangeManage=function(e,t,i){return l(this,void 0,void 0,(function(){var o,r,n,s,a;return h(this,(function(c){switch(c.label){case 0:return o=void 0,e.length!==t.length&&(r=(t||[]).map((function(e){return e.deviceId})),n=new P,e.length>t.length?(n=e.filter((function(e){return!r.includes(e.deviceId)}))[0]||{},o=M.TRTCDeviceStateRemove):(r=(e||[]).map((function(e){return e.deviceId})),n=t.filter((function(e){return!r.includes(e.deviceId)}))[0]||{},o=M.TRTCDeviceStateAdd),s=n.deviceId,this.emitOnDeviceChange(s,i,o)),a=this.getDefaultDeviceInfo(t),i!==A.TRTCDeviceTypeCamera||o!==M.TRTCDeviceStateRemove?[3,3]:this.isSameDevice(this._currentCamera,a)?[2]:a.deviceId?[4,this.autoChangeDevice(i,a)]:[3,2];case 1:c.sent(),c.label=2;case 2:c.label=3;case 3:return i!==A.TRTCDeviceTypeMic?[3,6]:this.isSameDevice(this._currentMicrophone,a)?[2]:a.deviceId?[4,this.autoChangeDevice(i,a)]:[3,5];case 4:c.sent(),c.label=5;case 5:c.label=6;case 6:return i!==A.TRTCDeviceTypeSpeaker?[3,9]:this.isSameDevice(this._currentSpeaker,a)?[2]:a.deviceId?[4,this.autoChangeDevice(i,a)]:[3,8];case 7:c.sent(),c.label=8;case 8:c.label=9;case 9:return[2]}}))}))},f.prototype.getDefaultDeviceInfo=function(e){var t=new P;if(0===e.length)return t;var i=e.filter((function(e){return"default"===e.deviceId}));return t=i.length>0?i[0]:e[0]},f.prototype.autoChangeDevice=function(t,i){return l(this,void 0,void 0,(function(){var o,r,n;return h(this,(function(s){switch(s.label){case 0:return o=i.deviceId,t!==A.TRTCDeviceTypeCamera?[3,6]:(this._setCurrentCameraId(o),[4,this._updateLocalVideo()]);case 1:s.sent(),s.label=2;case 2:return s.trys.push([2,4,,5]),[4,this._testTrtc.updateLocalVideo({option:{cameraId:o}})];case 3:return s.sent(),[3,5];case 4:return r=s.sent(),console.log("testTRTC error",JSON.stringify(r)),r.code,e.ERROR_CODE.OPERATION_ABORT,[3,5];case 5:this._currentCameraId=o,this._currentCamera=i,this.emitOnDeviceChange(o,t,M.TRTCDeviceStateActive),s.label=6;case 6:return t!==A.TRTCDeviceTypeMic?[3,12]:(this._setCurrentMicrophoneId(o),[4,this._updateLocalAudio()]);case 7:s.sent(),s.label=8;case 8:return s.trys.push([8,10,,11]),[4,this._testTrtc.updateLocalAudio({option:{microphoneId:o}})];case 9:return s.sent(),[3,11];case 10:return n=s.sent(),console.log("testTRTC error",JSON.stringify(n)),n.code,e.ERROR_CODE.OPERATION_ABORT,[3,11];case 11:this._currentMicrophoneId=o,this._currentMicrophone=i,this.emitOnDeviceChange(o,t,M.TRTCDeviceStateActive),s.label=12;case 12:return t!==A.TRTCDeviceTypeSpeaker?[3,14]:[4,e.setCurrentSpeaker(o)];case 13:s.sent(),this._currentSpeakerId=o,this._currentSpeaker=i,this.emitOnDeviceChange(o,t,M.TRTCDeviceStateActive),s.label=14;case 14:return[2]}}))}))},f.prototype.emitOnDeviceChange=function(e,t,i){this.emit("onDeviceChange",e,t,i)},f.prototype.getMediaMixingManager=function(){return new ts({logger:this.logger,trtc:this._trtc,trtcCloud:this})},f.prototype.getWhiteboardManager=function(){return new fs({logger:this.logger,trtc:this._trtc})},f.prototype.getAITranscriberManager=function(){return new _s({logger:this.logger,trtc:this._trtc})},f.shareInstance=null,f.subCloudMap=new Map,f.enableSEI=!1,f.assetsPath="",u([(v="exitRoom",function(e,t,i){var o=i.value;return i.value=function(){for(var e,t,i,r,n=[],s=0;s<arguments.length;s++)n[s]=arguments[s];var a=[];return null===(t=null===(e=gs.get(this))||void 0===e?void 0:e.queue)||void 0===t||t.forEach((function(e){return a.push(e)})),null===(i=ms.get(this))||void 0===i||i.forEach((function(e){return null==e?void 0:e.queue.forEach((function(e){return a.push(e)}))})),null===(r=Ts.get(this))||void 0===r||r.forEach((function(e){return null==e?void 0:e.queue.forEach((function(e){return a.push(e)}))})),a.forEach((function(e){e.reject(new Error("aborted ".concat(v)))})),gs.delete(this),ms.delete(this),Ts.delete(this),o.apply(this,n)},i})],f.prototype,"exitRoom",null),u([ys((function(e){return e}))],f.prototype,"muteRemoteAudio",null),u([ys((function(e){return e}))],f.prototype,"muteRemoteVideoStream",null),u([ys((function(e){var t=e||{},i=t.quality,o=t.stream_list,r=void 0===o?[]:o,n=r.some((function(e){return e.name===i}));return i&&n?r.map((function(e){return e.user_id})):(console.warn("[QualitySwitch] Invalid params: target ".concat(i," not found in list")),[])}),{deduplicate:!0})],f.prototype,"_switchPlaybackQuality",null),f}(E);export{Cs as AITranscriberListener,oe as AudioMuteType,Ss as IAITranscriberManager,Bn as ITRTCMediaMixingEvent,kn as ITRTCMediaMixingManager,us as ITRTCWhiteboardManager,Dn as InteractionOption,J as Rect,b as TRTCAppScene,S as TRTCAudioQuality,w as TRTCAudioSceneEx,R as TRTCBeautyStyle,Z as TRTCCameraCaptureMode,re as TRTCCameraCaptureParams,P as TRTCDeviceInfo,M as TRTCDeviceState,A as TRTCDeviceType,q as TRTCImageBuffer,W as TRTCLocalStatistics,j as TRTCLogLevel,xn as TRTCMediaMixingEncParam,fn as TRTCMediaMixingErrorCode,gn as TRTCMediaMixingEvent,On as TRTCMediaSource,vn as TRTCMediaSourceType,$ as TRTCMixInputType,ee as TRTCMixUser,G as TRTCNetworkQosParam,L as TRTCParams,F as TRTCPublishCDNParam,B as TRTCQosControlMode,x as TRTCQuality,z as TRTCQualityInfo,H as TRTCRemoteStatistics,O as TRTCRenderParams,C as TRTCRoleType,ie as TRTCScreenCaptureProperty,K as TRTCScreenCaptureSourceInfo,U as TRTCScreenCaptureSourceType,Q as TRTCStatistics,X as TRTCTranscodingConfig,Y as TRTCTranscodingConfigMode,V as TRTCVideoEncParam,y as TRTCVideoFillMode,_ as TRTCVideoMirrorType,k as TRTCVideoQosPreference,m as TRTCVideoResolution,D as TRTCVideoResolutionMode,I as TRTCVideoRotation,T as TRTCVideoStreamType,N as TRTCVolumeInfo,Xn as TRTCWhiteboardEvent,bs as TranscriberMessage,Rs as TranscriberParams,os as WhiteboardCanvasInfo,cs as WhiteboardHistoryStateChangedInfo,rs as WhiteboardRecvCommand,ns as WhiteboardSendPayload,as as WhiteboardSessionResumedInfo,ss as WhiteboardSessionStalledInfo,is as WhiteboardToolConfig,Vs as default,ws as loggerManager};export const __esModule=!0;
|