trtc-cloud-js-sdk 2.12.2-beta.4 → 2.12.2-beta.6

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.
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("trtc-sdk-v5"),require("trtc-sdk-v5/plugins/lebplayer"),require("trtc-sdk-v5/plugins/video-effect/virtual-background"),require("trtc-sdk-v5/plugins/video-effect/basic-beauty"),require("trtc-sdk-v5/plugins/realtime-transcriber"),require("trtc-sdk-v5/plugins/video-effect/video-mixer")):"function"==typeof define&&define.amd?define(["exports","trtc-sdk-v5","trtc-sdk-v5/plugins/lebplayer","trtc-sdk-v5/plugins/video-effect/virtual-background","trtc-sdk-v5/plugins/video-effect/basic-beauty","trtc-sdk-v5/plugins/realtime-transcriber","trtc-sdk-v5/plugins/video-effect/video-mixer"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).TRTCCloud={},e.TRTC,e.LEBPlayer,e.VirtualBackground,e.BasicBeauty,e.realtimeTranscriber,e.VideoMixer)}(this,(function(e,t,i,o,r,n,s){function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=a(t),u=a(s),l=function(e,t){return l=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])},l(e,t)};var d=function(){return d=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},d.apply(this,arguments)};function h(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 p(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 T(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 f(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 v(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 g(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,i=e[Symbol.asyncIterator];return i?i.call(e):(e=f(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 m="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function R(e,t){return e(t={exports:{}},t.exports),t.exports}var y,C,_,b,S,M,w,E,A,V=R((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],d=arguments.length;if(l.fn){switch(l.once&&this.removeListener(e,l.fn,void 0,!0),d){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(d-1);u<d;u++)c[u-1]=arguments[u];l.fn.apply(l.context,c)}else{var h,p=l.length;for(u=0;u<p;u++)switch(l[u].once&&this.removeListener(e,l[u].fn,void 0,!0),d){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(h=1,c=new Array(d-1);h<d;h++)c[h-1]=arguments[h];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}));e.TRTCVideoResolution=void 0,(y=e.TRTCVideoResolution||(e.TRTCVideoResolution={}))[y.TRTCVideoResolution_120_120=1]="TRTCVideoResolution_120_120",y[y.TRTCVideoResolution_160_160=3]="TRTCVideoResolution_160_160",y[y.TRTCVideoResolution_270_270=5]="TRTCVideoResolution_270_270",y[y.TRTCVideoResolution_480_480=7]="TRTCVideoResolution_480_480",y[y.TRTCVideoResolution_160_120=50]="TRTCVideoResolution_160_120",y[y.TRTCVideoResolution_240_180=52]="TRTCVideoResolution_240_180",y[y.TRTCVideoResolution_280_210=54]="TRTCVideoResolution_280_210",y[y.TRTCVideoResolution_320_240=56]="TRTCVideoResolution_320_240",y[y.TRTCVideoResolution_400_300=58]="TRTCVideoResolution_400_300",y[y.TRTCVideoResolution_480_360=60]="TRTCVideoResolution_480_360",y[y.TRTCVideoResolution_640_480=62]="TRTCVideoResolution_640_480",y[y.TRTCVideoResolution_960_720=64]="TRTCVideoResolution_960_720",y[y.TRTCVideoResolution_160_90=100]="TRTCVideoResolution_160_90",y[y.TRTCVideoResolution_256_144=102]="TRTCVideoResolution_256_144",y[y.TRTCVideoResolution_320_180=104]="TRTCVideoResolution_320_180",y[y.TRTCVideoResolution_480_270=106]="TRTCVideoResolution_480_270",y[y.TRTCVideoResolution_640_360=108]="TRTCVideoResolution_640_360",y[y.TRTCVideoResolution_960_540=110]="TRTCVideoResolution_960_540",y[y.TRTCVideoResolution_1280_720=112]="TRTCVideoResolution_1280_720",y[y.TRTCVideoResolution_1920_1080=114]="TRTCVideoResolution_1920_1080",e.TRTCVideoStreamType=void 0,(C=e.TRTCVideoStreamType||(e.TRTCVideoStreamType={}))[C.TRTCVideoStreamTypeBig=0]="TRTCVideoStreamTypeBig",C[C.TRTCVideoStreamTypeSmall=1]="TRTCVideoStreamTypeSmall",C[C.TRTCVideoStreamTypeSub=2]="TRTCVideoStreamTypeSub",e.TRTCVideoFillMode=void 0,(_=e.TRTCVideoFillMode||(e.TRTCVideoFillMode={}))[_.TRTCVideoFillMode_Fill=0]="TRTCVideoFillMode_Fill",_[_.TRTCVideoFillMode_Fit=1]="TRTCVideoFillMode_Fit",e.TRTCVideoMirrorType=void 0,(b=e.TRTCVideoMirrorType||(e.TRTCVideoMirrorType={}))[b.TRTCVideoMirrorType_Auto=0]="TRTCVideoMirrorType_Auto",b[b.TRTCVideoMirrorType_Enable=1]="TRTCVideoMirrorType_Enable",b[b.TRTCVideoMirrorType_Disable=2]="TRTCVideoMirrorType_Disable",e.TRTCBeautyStyle=void 0,(S=e.TRTCBeautyStyle||(e.TRTCBeautyStyle={}))[S.TRTCBeautyStyleSmooth=0]="TRTCBeautyStyleSmooth",S[S.TRTCBeautyStyleNature=1]="TRTCBeautyStyleNature",e.TRTCAppScene=void 0,(M=e.TRTCAppScene||(e.TRTCAppScene={}))[M.TRTCAppSceneVideoCall=0]="TRTCAppSceneVideoCall",M[M.TRTCAppSceneLIVE=1]="TRTCAppSceneLIVE",M[M.TRTCAppSceneAudioCall=2]="TRTCAppSceneAudioCall",M[M.TRTCAppSceneVoiceChatRoom=3]="TRTCAppSceneVoiceChatRoom",e.TRTCRoleType=void 0,(w=e.TRTCRoleType||(e.TRTCRoleType={}))[w.TRTCRoleAnchor=20]="TRTCRoleAnchor",w[w.TRTCRoleAudience=21]="TRTCRoleAudience",e.TRTCAudioQuality=void 0,(E=e.TRTCAudioQuality||(e.TRTCAudioQuality={}))[E.TRTCAudioQualitySpeech=1]="TRTCAudioQualitySpeech",E[E.TRTCAudioQualityDefault=2]="TRTCAudioQualityDefault",E[E.TRTCAudioQualityMusic=3]="TRTCAudioQualityMusic",e.TRTCAudioSceneEx=void 0,(A=e.TRTCAudioSceneEx||(e.TRTCAudioSceneEx={}))[A.default=0]="default",A[A.silent=8]="silent",A[A.hifi2=18]="hifi2";var P,L,I=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};e.TRTCDeviceState=void 0,(P=e.TRTCDeviceState||(e.TRTCDeviceState={}))[P.TRTCDeviceStateAdd=0]="TRTCDeviceStateAdd",P[P.TRTCDeviceStateRemove=1]="TRTCDeviceStateRemove",P[P.TRTCDeviceStateActive=2]="TRTCDeviceStateActive",e.TRTCDeviceType=void 0,(L=e.TRTCDeviceType||(e.TRTCDeviceType={}))[L.TRTCDeviceTypeUnknow=-1]="TRTCDeviceTypeUnknow",L[L.TRTCDeviceTypeMic=0]="TRTCDeviceTypeMic",L[L.TRTCDeviceTypeSpeaker=1]="TRTCDeviceTypeSpeaker",L[L.TRTCDeviceTypeCamera=2]="TRTCDeviceTypeCamera";var x,D=function(t,i,o,r,n,s,a,c,u,l,d){void 0===t&&(t=0),void 0===i&&(i=""),void 0===o&&(o=""),void 0===r&&(r=0),void 0===n&&(n=""),void 0===s&&(s=e.TRTCRoleType.TRTCRoleAnchor),void 0===a&&(a=null),void 0===u&&(u=null),void 0===l&&(l=null),void 0===d&&(d=30),this.sdkAppId=t,this.userId=i,this.userSig=o,this.roomId=r,this.strRoomId=n,this.role=s,this.privateMapKey=a,this.streamId=u,this.userDefineRecordId=l,this.frameWorkType=d},O=function(t,i,o,r){void 0===t&&(t=e.TRTCVideoResolution.TRTCVideoResolution_640_360),void 0===i&&(i=e.TRTCVideoResolutionMode.TRTCVideoResolutionModeLandscape),void 0===o&&(o=15),void 0===r&&(r=550),this.videoResolution=t,this.resMode=i,this.videoFps=o,this.videoBitrate=r};e.TRTCVideoRotation=void 0,(x=e.TRTCVideoRotation||(e.TRTCVideoRotation={}))[x.TRTCVideoRotation0=0]="TRTCVideoRotation0",x[x.TRTCVideoRotation90=1]="TRTCVideoRotation90",x[x.TRTCVideoRotation180=2]="TRTCVideoRotation180",x[x.TRTCVideoRotation270=3]="TRTCVideoRotation270";var k,B=function(t,i,o){void 0===t&&(t=e.TRTCVideoRotation.TRTCVideoRotation0),void 0===i&&(i=e.TRTCVideoFillMode.TRTCVideoFillMode_Fit),void 0===o&&(o=e.TRTCVideoMirrorType.TRTCVideoMirrorType_Disable),this.rotation=t,this.fillMode=i,this.mirrorType=o};e.TRTCQuality=void 0,(k=e.TRTCQuality||(e.TRTCQuality={}))[k.TRTCQuality_Unknown=0]="TRTCQuality_Unknown",k[k.TRTCQuality_Excellent=1]="TRTCQuality_Excellent",k[k.TRTCQuality_Good=2]="TRTCQuality_Good",k[k.TRTCQuality_Poor=3]="TRTCQuality_Poor",k[k.TRTCQuality_Bad=4]="TRTCQuality_Bad",k[k.TRTCQuality_Vbad=5]="TRTCQuality_Vbad",k[k.TRTCQuality_Down=6]="TRTCQuality_Down";var z,F,N,Q=function(t,i){void 0===t&&(t=""),void 0===i&&(i=e.TRTCQuality.TRTCQuality_Unknown),this.userId=t,this.quality=i},H=function(e,t){void 0===e&&(e=""),void 0===t&&(t=0),this.userId=e,this.volume=t},W=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},j=function(t,i,o,r,n,s,a){void 0===t&&(t=0),void 0===i&&(i=0),void 0===o&&(o=0),void 0===r&&(r=0),void 0===s&&(s=0),void 0===a&&(a=e.TRTCVideoStreamType.TRTCVideoStreamTypeBig),this.width=t,this.height=i,this.frameRate=o,this.videoBitrate=r,this.audioBitrate=s,this.streamType=a},U=function(t,i,o,r,n,s,a,c,u,l,d,h,p,T){void 0===t&&(t=""),void 0===o&&(o=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===s&&(s=0),void 0===c&&(c=0),void 0===T&&(T=e.TRTCVideoStreamType.TRTCVideoStreamTypeBig),this.userId=t,this.width=o,this.height=r,this.frameRate=n,this.videoBitrate=s,this.audioBitrate=c,this.streamType=T},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};e.TRTCVideoResolutionMode=void 0,(z=e.TRTCVideoResolutionMode||(e.TRTCVideoResolutionMode={}))[z.TRTCVideoResolutionModeLandscape=0]="TRTCVideoResolutionModeLandscape",z[z.TRTCVideoResolutionModePortrait=1]="TRTCVideoResolutionModePortrait",e.TRTCVideoQosPreference=void 0,(F=e.TRTCVideoQosPreference||(e.TRTCVideoQosPreference={}))[F.TRTCVideoQosPreferenceSmooth=1]="TRTCVideoQosPreferenceSmooth",F[F.TRTCVideoQosPreferenceClear=2]="TRTCVideoQosPreferenceClear",e.TRTCQosControlMode=void 0,(N=e.TRTCQosControlMode||(e.TRTCQosControlMode={}))[N.TRTCQosControlModeClient=0]="TRTCQosControlModeClient",N[N.TRTCQosControlModeServer=1]="TRTCQosControlModeServer";var G,Y,K=function(t,i){void 0===t&&(t=e.TRTCVideoQosPreference.TRTCVideoQosPreferenceClear),void 0===i&&(i=e.TRTCQosControlMode.TRTCQosControlModeServer),this.preference=t,this.controlMode=i},J=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};e.TRTCLogLevel=void 0,(G=e.TRTCLogLevel||(e.TRTCLogLevel={}))[G.TRTCLogLevelVerbose=0]="TRTCLogLevelVerbose",G[G.TRTCLogLevelDebug=1]="TRTCLogLevelDebug",G[G.TRTCLogLevelInfo=2]="TRTCLogLevelInfo",G[G.TRTCLogLevelWarn=3]="TRTCLogLevelWarn",G[G.TRTCLogLevelError=4]="TRTCLogLevelError",G[G.TRTCLogLevelFatal=5]="TRTCLogLevelFatal",G[G.TRTCLogLevelNone=6]="TRTCLogLevelNone",e.TRTCScreenCaptureSourceType=void 0,(Y=e.TRTCScreenCaptureSourceType||(e.TRTCScreenCaptureSourceType={}))[Y.TRTCScreenCaptureSourceTypeUnknown=-1]="TRTCScreenCaptureSourceTypeUnknown",Y[Y.TRTCScreenCaptureSourceTypeWindow=0]="TRTCScreenCaptureSourceTypeWindow",Y[Y.TRTCScreenCaptureSourceTypeScreen=1]="TRTCScreenCaptureSourceTypeScreen",Y[Y.TRTCScreenCaptureSourceTypeCustom=2]="TRTCScreenCaptureSourceTypeCustom";var X,$=function(t,i,o,r,n,s){void 0===t&&(t=e.TRTCScreenCaptureSourceType.TRTCScreenCaptureSourceTypeUnknown),void 0===i&&(i=""),void 0===o&&(o=""),void 0===r&&(r=new J),void 0===n&&(n=new J),void 0===s&&(s=!1),this.type=t,this.sourceId=i,this.sourceName=o,this.thumbBGRA=r,this.iconBGRA=n,this.isMinimizeWindow=s},Z=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},ee=function(t,i,o,r,n,s,a,c,u,l,d,h,p,T,f){void 0===t&&(t=e.TRTCTranscodingConfigMode.TRTCTranscodingConfigMode_Unknown),void 0===i&&(i=0),void 0===o&&(o=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===s&&(s=0),void 0===a&&(a=15),void 0===c&&(c=2),void 0===u&&(u=0),void 0===l&&(l=""),void 0===d&&(d=64),void 0===h&&(h=48e3),void 0===p&&(p=1),void 0===T&&(T=[]),void 0===f&&(f=""),this.mode=t,this.appId=i,this.bizId=o,this.videoWidth=r,this.videoHeight=n,this.videoBitrate=s,this.videoFramerate=a,this.videoGOP=c,this.backgroundColor=u,this.backgroundImage=l,this.audioSampleRate=d,this.audioBitrate=h,this.audioChannels=p,this.mixUsersArray=T,this.mixUsersArraySize=T.length,this.streamId=f};e.TRTCTranscodingConfigMode=void 0,(X=e.TRTCTranscodingConfigMode||(e.TRTCTranscodingConfigMode={}))[X.TRTCTranscodingConfigMode_Unknown=0]="TRTCTranscodingConfigMode_Unknown",X[X.TRTCTranscodingConfigMode_Manual=1]="TRTCTranscodingConfigMode_Manual",X[X.TRTCTranscodingConfigMode_Template_PureAudio=2]="TRTCTranscodingConfigMode_Template_PureAudio",X[X.TRTCTranscodingConfigMode_Template_PresetLayout=3]="TRTCTranscodingConfigMode_Template_PresetLayout",X[X.TRTCTranscodingConfigMode_Template_ScreenSharing=4]="TRTCTranscodingConfigMode_Template_ScreenSharing",X[X.TRTC_TranscodingConfigMode_Unknown=5]="TRTC_TranscodingConfigMode_Unknown",X[X.TRTC_TranscodingConfigMode_Manual=6]="TRTC_TranscodingConfigMode_Manual",X[X.TRTC_TranscodingConfigMode_Template_PureAudio=7]="TRTC_TranscodingConfigMode_Template_PureAudio",X[X.TRTC_TranscodingConfigMode_Template_PresetLayout=8]="TRTC_TranscodingConfigMode_Template_PresetLayout",X[X.TRTC_TranscodingConfigMode_Template_ScreenSharing=9]="TRTC_TranscodingConfigMode_Template_ScreenSharing";var te,ie,oe=function(t,i,o,r,n,s,a,c){void 0===t&&(t=""),void 0===i&&(i=""),void 0===o&&(o=null),void 0===r&&(r=0),void 0===n&&(n=!1),void 0===s&&(s=e.TRTCVideoStreamType.TRTCVideoStreamTypeBig),void 0===a&&(a=e.TRTCMixInputType.TRTCMixInputTypeUndefined),void 0===c&&(c=0),this.userId=t,this.roomId=i,this.rect=o,this.zOrder=r,this.pureAudio=n,this.streamType=s,this.inputType=a,this.renderMode=c};e.TRTCMixInputType=void 0,(te=e.TRTCMixInputType||(e.TRTCMixInputType={}))[te.TRTCMixInputTypeUndefined=0]="TRTCMixInputTypeUndefined",te[te.TRTCMixInputTypeAudioVideo=1]="TRTCMixInputTypeAudioVideo",te[te.TRTCMixInputTypePureVideo=2]="TRTCMixInputTypePureVideo",te[te.TRTCMixInputTypePureAudio=3]="TRTCMixInputTypePureAudio",e.TRTCCameraCaptureMode=void 0,(ie=e.TRTCCameraCaptureMode||(e.TRTCCameraCaptureMode={}))[ie.TRTCCameraResolutionStrategyAuto=0]="TRTCCameraResolutionStrategyAuto",ie[ie.TRTCCameraResolutionStrategyPerformance=1]="TRTCCameraResolutionStrategyPerformance",ie[ie.TRTCCameraResolutionStrategyHighQuality=2]="TRTCCameraResolutionStrategyHighQuality",ie[ie.TRTCCameraCaptureManual=3]="TRTCCameraCaptureManual";var re,ne=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},se="onError",ae="onWarning",ce="rtc",ue="live",le="VirtualBackground",de="BasicBeauty",he="AIDenoiser",pe="blur",Te="image",fe={20:"anchor",21:"audience"},ve={0:ce,1:ue,2:ce,3:ue};!function(e){e[e.ActiveExitRoom=0]="ActiveExitRoom",e[e.KickedExitRoom=1]="KickedExitRoom"}(re||(re={}));var ge="enum";function me(){return Math.floor(performance.now())}var Re=function(e){return void 0===e},ye=function(e){return"number"==typeof e},Ce=function(e){return"boolean"==typeof e};function _e(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 Se(){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]=Se(e[i],t[i]):e[i]=t[i]})),e}),{})}function Me(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]=Me(e)}))):"object"==typeof e&&null!==e?(t={},Object.keys(e).forEach((function(i){Object.hasOwnProperty.call(e,i)&&(t[i]=Me(e[i]))}))):t=e,t)}var we,Ee,Ae=function(e){return e&&e.Math===Math&&e},Ve=Ae("object"==typeof globalThis&&globalThis)||Ae("object"==typeof window&&window)||Ae("object"==typeof self&&self)||Ae("object"==typeof m&&m)||function(){return this}()||m||Function("return this")(),Pe=function(e){try{return!!e()}catch(t){return!0}},Le=!Pe((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]})),Ie=!Pe((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),xe=Function.prototype.call,De=Ie?xe.bind(xe):function(){return xe.apply(xe,arguments)},Oe={}.propertyIsEnumerable,ke=Object.getOwnPropertyDescriptor,Be={f:ke&&!Oe.call({1:2},1)?function(e){var t=ke(this,e);return!!t&&t.enumerable}:Oe},ze=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},Fe=Function.prototype,Ne=Fe.call,Qe=Ie&&Fe.bind.bind(Ne,Ne),He=Ie?Qe:function(e){return function(){return Ne.apply(e,arguments)}},We=He({}.toString),je=He("".slice),Ue=function(e){return je(We(e),8,-1)},qe=Object,Ge=He("".split),Ye=Pe((function(){return!qe("z").propertyIsEnumerable(0)}))?function(e){return"String"===Ue(e)?Ge(e,""):qe(e)}:qe,Ke=function(e){return null==e},Je=TypeError,Xe=function(e){if(Ke(e))throw Je("Can't call method on "+e);return e},$e=function(e){return Ye(Xe(e))},Ze="object"==typeof document&&document.all,et={all:Ze,IS_HTMLDDA:void 0===Ze&&void 0!==Ze},tt=et.all,it=et.IS_HTMLDDA?function(e){return"function"==typeof e||e===tt}:function(e){return"function"==typeof e},ot=et.all,rt=et.IS_HTMLDDA?function(e){return"object"==typeof e?null!==e:it(e)||e===ot}:function(e){return"object"==typeof e?null!==e:it(e)},nt=function(e,t){return arguments.length<2?(i=Ve[e],it(i)?i:void 0):Ve[e]&&Ve[e][t];var i},st=He({}.isPrototypeOf),at="undefined"!=typeof navigator&&String(navigator.userAgent)||"",ct=Ve.process,ut=Ve.Deno,lt=ct&&ct.versions||ut&&ut.version,dt=lt&&lt.v8;dt&&(Ee=(we=dt.split("."))[0]>0&&we[0]<4?1:+(we[0]+we[1])),!Ee&&at&&(!(we=at.match(/Edge\/(\d+)/))||we[1]>=74)&&(we=at.match(/Chrome\/(\d+)/))&&(Ee=+we[1]);var ht=Ee,pt=Ve.String,Tt=!!Object.getOwnPropertySymbols&&!Pe((function(){var e=Symbol("symbol detection");return!pt(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&ht&&ht<41})),ft=Tt&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,vt=Object,gt=ft?function(e){return"symbol"==typeof e}:function(e){var t=nt("Symbol");return it(t)&&st(t.prototype,vt(e))},mt=String,Rt=TypeError,yt=function(e){if(it(e))return e;throw Rt(function(e){try{return mt(e)}catch(t){return"Object"}}(e)+" is not a function")},Ct=function(e,t){var i=e[t];return Ke(i)?void 0:yt(i)},_t=TypeError,bt=Object.defineProperty,St=function(e,t){try{bt(Ve,e,{value:t,configurable:!0,writable:!0})}catch(i){Ve[e]=t}return t},Mt="__core-js_shared__",wt=Ve[Mt]||St(Mt,{}),Et=R((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"})})),At=Object,Vt=function(e){return At(Xe(e))},Pt=He({}.hasOwnProperty),Lt=Object.hasOwn||function(e,t){return Pt(Vt(e),t)},It=0,xt=Math.random(),Dt=He(1..toString),Ot=function(e){return"Symbol("+(void 0===e?"":e)+")_"+Dt(++It+xt,36)},kt=Ve.Symbol,Bt=Et("wks"),zt=ft?kt.for||kt:kt&&kt.withoutSetter||Ot,Ft=function(e){return Lt(Bt,e)||(Bt[e]=Tt&&Lt(kt,e)?kt[e]:zt("Symbol."+e)),Bt[e]},Nt=TypeError,Qt=Ft("toPrimitive"),Ht=function(e,t){if(!rt(e)||gt(e))return e;var i,o=Ct(e,Qt);if(o){if(void 0===t&&(t="default"),i=De(o,e,t),!rt(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&&it(i=e.toString)&&!rt(o=De(i,e)))return o;if(it(i=e.valueOf)&&!rt(o=De(i,e)))return o;if("string"!==t&&it(i=e.toString)&&!rt(o=De(i,e)))return o;throw _t("Can't convert object to primitive value")}(e,t)},Wt=function(e){var t=Ht(e,"string");return gt(t)?t:t+""},jt=Ve.document,Ut=rt(jt)&&rt(jt.createElement),qt=function(e){return Ut?jt.createElement(e):{}},Gt=!Le&&!Pe((function(){return 7!==Object.defineProperty(qt("div"),"a",{get:function(){return 7}}).a})),Yt=Object.getOwnPropertyDescriptor,Kt={f:Le?Yt:function(e,t){if(e=$e(e),t=Wt(t),Gt)try{return Yt(e,t)}catch(i){}if(Lt(e,t))return ze(!De(Be.f,e,t),e[t])}},Jt=Le&&Pe((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Xt=String,$t=TypeError,Zt=function(e){if(rt(e))return e;throw $t(Xt(e)+" is not an object")},ei=TypeError,ti=Object.defineProperty,ii=Object.getOwnPropertyDescriptor,oi="enumerable",ri="configurable",ni="writable",si={f:Le?Jt?function(e,t,i){if(Zt(e),t=Wt(t),Zt(i),"function"==typeof e&&"prototype"===t&&"value"in i&&ni in i&&!i[ni]){var o=ii(e,t);o&&o[ni]&&(e[t]=i.value,i={configurable:ri in i?i[ri]:o[ri],enumerable:oi in i?i[oi]:o[oi],writable:!1})}return ti(e,t,i)}:ti:function(e,t,i){if(Zt(e),t=Wt(t),Zt(i),Gt)try{return ti(e,t,i)}catch(o){}if("get"in i||"set"in i)throw ei("Accessors not supported");return"value"in i&&(e[t]=i.value),e}},ai=Le?function(e,t,i){return si.f(e,t,ze(1,i))}:function(e,t,i){return e[t]=i,e},ci=Function.prototype,ui=Le&&Object.getOwnPropertyDescriptor,li=Lt(ci,"name"),di={EXISTS:li,PROPER:li&&"something"===function(){}.name,CONFIGURABLE:li&&(!Le||Le&&ui(ci,"name").configurable)},hi=He(Function.toString);it(wt.inspectSource)||(wt.inspectSource=function(e){return hi(e)});var pi,Ti,fi,vi=wt.inspectSource,gi=Ve.WeakMap,mi=it(gi)&&/native code/.test(String(gi)),Ri=Et("keys"),yi=function(e){return Ri[e]||(Ri[e]=Ot(e))},Ci={},_i="Object already initialized",bi=Ve.TypeError,Si=Ve.WeakMap;if(mi||wt.state){var Mi=wt.state||(wt.state=new Si);Mi.get=Mi.get,Mi.has=Mi.has,Mi.set=Mi.set,pi=function(e,t){if(Mi.has(e))throw bi(_i);return t.facade=e,Mi.set(e,t),t},Ti=function(e){return Mi.get(e)||{}},fi=function(e){return Mi.has(e)}}else{var wi=yi("state");Ci[wi]=!0,pi=function(e,t){if(Lt(e,wi))throw bi(_i);return t.facade=e,ai(e,wi,t),t},Ti=function(e){return Lt(e,wi)?e[wi]:{}},fi=function(e){return Lt(e,wi)}}var Ei={set:pi,get:Ti,has:fi,enforce:function(e){return fi(e)?Ti(e):pi(e,{})},getterFor:function(e){return function(t){var i;if(!rt(t)||(i=Ti(t)).type!==e)throw bi("Incompatible receiver, "+e+" required");return i}}},Ai=R((function(e){var t=di.CONFIGURABLE,i=Ei.enforce,o=Ei.get,r=String,n=Object.defineProperty,s=He("".slice),a=He("".replace),c=He([].join),u=Le&&!Pe((function(){return 8!==n((function(){}),"length",{value:8}).length})),l=String(String).split("String"),d=e.exports=function(e,o,d){"Symbol("===s(r(o),0,7)&&(o="["+a(r(o),/^Symbol\(([^)]*)\)/,"$1")+"]"),d&&d.getter&&(o="get "+o),d&&d.setter&&(o="set "+o),(!Lt(e,"name")||t&&e.name!==o)&&(Le?n(e,"name",{value:o,configurable:!0}):e.name=o),u&&d&&Lt(d,"arity")&&e.length!==d.arity&&n(e,"length",{value:d.arity});try{d&&Lt(d,"constructor")&&d.constructor?Le&&n(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(p){}var h=i(e);return Lt(h,"source")||(h.source=c(l,"string"==typeof o?o:"")),e};Function.prototype.toString=d((function(){return it(this)&&o(this).source||vi(this)}),"toString")})),Vi=function(e,t,i,o){o||(o={});var r=o.enumerable,n=void 0!==o.name?o.name:t;if(it(i)&&Ai(i,n,o),o.global)r?e[t]=i:St(t,i);else{try{o.unsafe?e[t]&&(r=!0):delete e[t]}catch(s){}r?e[t]=i:si.f(e,t,{value:i,enumerable:!1,configurable:!o.nonConfigurable,writable:!o.nonWritable})}return e},Pi=Math.ceil,Li=Math.floor,Ii=Math.trunc||function(e){var t=+e;return(t>0?Li:Pi)(t)},xi=function(e){var t=+e;return t!=t||0===t?0:Ii(t)},Di=Math.max,Oi=Math.min,ki=Math.min,Bi=function(e){return e>0?ki(xi(e),9007199254740991):0},zi=function(e){return Bi(e.length)},Fi=function(e){return function(t,i,o){var r,n=$e(t),s=zi(n),a=function(e,t){var i=xi(e);return i<0?Di(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:Fi(!0),indexOf:Fi(!1)}.indexOf,Qi=He([].push),Hi=function(e,t){var i,o=$e(e),r=0,n=[];for(i in o)!Lt(Ci,i)&&Lt(o,i)&&Qi(n,i);for(;t.length>r;)Lt(o,i=t[r++])&&(~Ni(n,i)||Qi(n,i));return n},Wi=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],ji=Wi.concat("length","prototype"),Ui={f:Object.getOwnPropertyNames||function(e){return Hi(e,ji)}},qi={f:Object.getOwnPropertySymbols},Gi=He([].concat),Yi=nt("Reflect","ownKeys")||function(e){var t=Ui.f(Zt(e)),i=qi.f;return i?Gi(t,i(e)):t},Ki=function(e,t,i){for(var o=Yi(t),r=si.f,n=Kt.f,s=0;s<o.length;s++){var a=o[s];Lt(e,a)||i&&Lt(i,a)||r(e,a,n(t,a))}},Ji=/#|\.prototype\./,Xi=function(e,t){var i=Zi[$i(e)];return i===to||i!==eo&&(it(t)?Pe(t):!!t)},$i=Xi.normalize=function(e){return String(e).replace(Ji,".").toLowerCase()},Zi=Xi.data={},eo=Xi.NATIVE="N",to=Xi.POLYFILL="P",io=Xi,oo=Kt.f,ro=function(e,t){var i,o,r,n,s,a=e.target,c=e.global,u=e.stat;if(i=c?Ve:u?Ve[a]||St(a,{}):(Ve[a]||{}).prototype)for(o in t){if(n=t[o],r=e.dontCallGetSet?(s=oo(i,o))&&s.value:i[o],!io(c?o:a+(u?".":"#")+o,e.forced)&&void 0!==r){if(typeof n==typeof r)continue;Ki(n,r)}(e.sham||r&&r.sham)&&ai(n,"sham",!0),Vi(i,o,n,e)}},no={};no[Ft("toStringTag")]="z";var so,ao="[object z]"===String(no),co=Ft("toStringTag"),uo=Object,lo="Arguments"===Ue(function(){return arguments}()),ho=ao?Ue: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=uo(e),co))?i:lo?Ue(t):"Object"===(o=Ue(t))&&it(t.callee)?"Arguments":o},po=String,To=function(e){if("Symbol"===ho(e))throw TypeError("Cannot convert a Symbol value to a string");return po(e)},fo=function(){var e=Zt(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=Ve.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})),Ro={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 Hi(e,Wi)},Co=Le&&!Jt?Object.defineProperties:function(e,t){Zt(e);for(var i,o=$e(t),r=yo(t),n=r.length,s=0;n>s;)si.f(e,i=r[s++],o[i]);return e},_o={f:Co},bo=nt("document","documentElement"),So="prototype",Mo="script",wo=yi("IE_PROTO"),Eo=function(){},Ao=function(e){return"<"+Mo+">"+e+"</"+Mo+">"},Vo=function(e){e.write(Ao("")),e.close();var t=e.parentWindow.Object;return e=null,t},Po=function(){try{so=new ActiveXObject("htmlfile")}catch(r){}var e,t,i;Po="undefined"!=typeof document?document.domain&&so?Vo(so):(t=qt("iframe"),i="java"+Mo+":",t.style.display="none",bo.appendChild(t),t.src=String(i),(e=t.contentWindow.document).open(),e.write(Ao("document.F=Object")),e.close(),e.F):Vo(so);for(var o=Wi.length;o--;)delete Po[So][Wi[o]];return Po()};Ci[wo]=!0;var Lo,Io,xo=Object.create||function(e,t){var i;return null!==e?(Eo[So]=Zt(e),i=new Eo,Eo[So]=null,i[wo]=e):i=Po(),void 0===t?i:_o.f(i,t)},Do=Ve.RegExp,Oo=Pe((function(){var e=Do(".","s");return!(e.dotAll&&e.exec("\n")&&"s"===e.flags)})),ko=Ve.RegExp,Bo=Pe((function(){var e=ko("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")})),zo=Ei.get,Fo=Et("native-string-replace",String.prototype.replace),No=RegExp.prototype.exec,Qo=No,Ho=He("".charAt),Wo=He("".indexOf),jo=He("".replace),Uo=He("".slice),qo=(Io=/b*/g,De(No,Lo=/a/,"a"),De(No,Io,"a"),0!==Lo.lastIndex||0!==Io.lastIndex),Go=Ro.BROKEN_CARET,Yo=void 0!==/()??/.exec("")[1];(qo||Yo||Go||Oo||Bo)&&(Qo=function(e){var t,i,o,r,n,s,a,c=this,u=zo(c),l=To(e),d=u.raw;if(d)return d.lastIndex=c.lastIndex,t=De(Qo,d,l),c.lastIndex=d.lastIndex,t;var h=u.groups,p=Go&&c.sticky,T=De(fo,c),f=c.source,v=0,g=l;if(p&&(T=jo(T,"y",""),-1===Wo(T,"g")&&(T+="g"),g=Uo(l,c.lastIndex),c.lastIndex>0&&(!c.multiline||c.multiline&&"\n"!==Ho(l,c.lastIndex-1))&&(f="(?: "+f+")",g=" "+g,v++),i=new RegExp("^(?:"+f+")",T)),Yo&&(i=new RegExp("^"+f+"$(?!\\s)",T)),qo&&(o=c.lastIndex),r=De(No,p?i:c,g),p?r?(r.input=Uo(r.input,v),r[0]=Uo(r[0],v),r.index=c.lastIndex,c.lastIndex+=r[0].length):c.lastIndex=0:qo&&r&&(c.lastIndex=c.global?r.index+r[0].length:o),Yo&&r&&r.length>1&&De(Fo,r[0],i,(function(){for(n=1;n<arguments.length-2;n++)void 0===arguments[n]&&(r[n]=void 0)})),r&&h)for(r.groups=s=xo(null),n=0;n<h.length;n++)s[(a=h[n])[0]]=r[a[1]];return r});var Ko=Qo;ro({target:"RegExp",proto:!0,forced:/./.exec!==Ko},{exec:Ko});var Jo="\t\n\v\f\r                 \u2028\u2029\ufeff",Xo=He("".replace),$o=RegExp("^["+Jo+"]+"),Zo=RegExp("(^|[^"+Jo+"])["+Jo+"]+$"),er=function(e){return function(t){var i=To(Xe(t));return 1&e&&(i=Xo(i,$o,"")),2&e&&(i=Xo(i,Zo,"$1")),i}},tr={start:er(1),end:er(2),trim:er(3)}.trim,ir=He("".charAt),or=Ve.parseFloat,rr=Ve.Symbol,nr=rr&&rr.iterator,sr=1/or(Jo+"-0")!=-Infinity||nr&&!Pe((function(){or(Object(nr))}))?function(e){var t=tr(To(e)),i=or(t);return 0===i&&"-"===ir(t,0)?-0:i}:or;ro({global:!0,forced:parseFloat!==sr},{parseFloat:sr});var ar=function(e){if("Function"===Ue(e))return He(e)},cr=Ft("species"),ur=RegExp.prototype,lr=He("".charAt),dr=He("".charCodeAt),hr=He("".slice),pr=function(e){return function(t,i){var o,r,n=To(Xe(t)),s=xi(i),a=n.length;return s<0||s>=a?e?"":void 0:(o=dr(n,s))<55296||o>56319||s+1===a||(r=dr(n,s+1))<56320||r>57343?e?lr(n,s):o:e?hr(n,s,s+2):r-56320+(o-55296<<10)+65536}},Tr={codeAt:pr(!1),charAt:pr(!0)}.charAt,fr=function(e,t,i){return t+(i?Tr(e,t).length:1)},vr=TypeError,gr=function(e,t){var i=e.exec;if(it(i)){var o=De(i,e,t);return null!==o&&Zt(o),o}if("RegExp"===Ue(e))return De(Ko,e,t);throw vr("RegExp#exec called on incompatible receiver")};!function(e,t,i,o){var r=Ft(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[cr]=function(){return i},i.flags="",i[r]=/./[r]),i.exec=function(){return t=!0,null},i[r](""),!t}));if(!n||!s||i){var a=ar(/./[r]),c=t(r,""[e],(function(e,t,i,o,r){var s=ar(e),c=t.exec;return c===Ko||c===ur.exec?n&&!r?{done:!0,value:a(t,i,o)}:{done:!0,value:s(i,t,o)}:{done:!1}}));Vi(String.prototype,e,c[0]),Vi(ur,r,c[1])}o&&ai(ur[r],"sham",!0)}("match",(function(e,t,i){return[function(t){var i=Xe(this),o=Ke(t)?void 0:Ct(t,e);return o?De(o,t,i):new RegExp(t)[e](To(i))},function(e){var o=Zt(this),r=To(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=To(a[0]);c[u]=l,""===l&&(o.lastIndex=fr(r,Bi(o.lastIndex),s)),u++}return 0===u?null:c}]}));var mr=Array.isArray||function(e){return"Array"===Ue(e)},Rr=TypeError,yr=function(e){if(e>9007199254740991)throw Rr("Maximum allowed index exceeded");return e},Cr=function(e,t,i){var o=Wt(t);o in e?si.f(e,o,ze(0,i)):e[o]=i},_r=function(){},br=[],Sr=nt("Reflect","construct"),Mr=/^\s*(?:class|function)\b/,wr=He(Mr.exec),Er=!Mr.exec(_r),Ar=function(e){if(!it(e))return!1;try{return Sr(_r,br,e),!0}catch(t){return!1}},Vr=function(e){if(!it(e))return!1;switch(ho(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Er||!!wr(Mr,vi(e))}catch(t){return!0}};Vr.sham=!0;var Pr,Lr=!Sr||Pe((function(){var e;return Ar(Ar.call)||!Ar(Object)||!Ar((function(){e=!0}))||e}))?Vr:Ar,Ir=Ft("species"),xr=Array,Dr=function(e,t){return new(function(e){var t;return mr(e)&&(t=e.constructor,(Lr(t)&&(t===xr||mr(t.prototype))||rt(t)&&null===(t=t[Ir]))&&(t=void 0)),void 0===t?xr:t}(e))(0===t?0:t)},Or=Ft("species"),kr=Ft("isConcatSpreadable"),Br=ht>=51||!Pe((function(){var e=[];return e[kr]=!1,e.concat()[0]!==e})),zr=function(e){if(!rt(e))return!1;var t=e[kr];return void 0!==t?!!t:mr(e)};ro({target:"Array",proto:!0,arity:1,forced:!(Br&&(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=Vt(this),a=Dr(s,0),c=0;for(t=-1,o=arguments.length;t<o;t++)if(zr(n=-1===t?s:arguments[t]))for(r=zi(n),yr(c+r),i=0;i<r;i++,c++)i in n&&Cr(a,c,n[i]);else yr(c+1),Cr(a,c++,n);return a.length=c,a}});var Fr=window.navigator&&window.navigator.userAgent||"",Nr=/AppleWebKit\/([\d.]+)/i.exec(Fr);Nr&&parseFloat(Nr.pop());var Qr=/iPad/i.test(Fr),Hr=/iPhone/i.test(Fr)&&!Qr,Wr=/iPod/i.test(Fr),jr=Hr||Qr||Wr,Ur=/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i.test(Fr);jr&&function(){var e=Fr.match(/OS (\d+)_/i);e&&e[1]&&e[1]}();var qr=/Android/i.test(Fr);qr&&function(){var e=Fr.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]))}();qr&&/webkit/i.test(Fr),/Firefox/i.test(Fr)&&function(){var e=Fr.match(/Firefox\/(\d+)/);e&&e[1]&&parseFloat(e[1])}();var Gr=/Edge\//i.test(Fr);Gr&&function(){var e=Fr.match(/Edge\/(\d+)/i);if(e&&e[1])e[1]}();var Yr=/Edg\//i.test(Fr);Yr&&function(){var e=Fr.match(/Edg\/(\d+)/);e&&e[1]&&parseFloat(e[1])}();var Kr=/SogouMobileBrowser\//i.test(Fr);Kr&&function(){var e=Fr.match(/SogouMobileBrowser\/(\d+)/);e&&e[1]&&parseFloat(e[1])}();var Jr=/MetaSr\s/i.test(Fr);Jr&&function(){var e=Fr.match(/MetaSr(\s\d+(\.\d+)+)/);e&&e[1]&&parseFloat(e[1])}();var Xr=/TBS\/\d+/i.test(Fr);Xr&&function(){var e=Fr.match(/TBS\/(\d+)/i);if(e&&e[1])e[1]}();var $r=/XWEB\/\d+/i.test(Fr);$r&&function(){var e=Fr.match(/XWEB\/(\d+)/i);if(e&&e[1])e[1]}(),/MSIE\s8\.0/.test(Fr),/MSIE\/\d+/i.test(Fr)&&function(){var e=/MSIE\s(\d+)\.\d/.exec(Fr),t=e&&parseFloat(e[1]);!t&&/Trident\/7.0/i.test(Fr)&&/rv:11.0/.test(Fr)&&(t=11)}(),/(micromessenger|webbrowser)/i.test(Fr)&&function(){var e=Fr.match(/MicroMessenger\/(\d+)/i);if(e&&e[1])e[1]}();var Zr=!Xr&&/MQQBrowser\/\d+/i.test(Fr)&&/COVC\/\d+/i.test(Fr),en=!Xr&&/MQQBrowser\/\d+/i.test(Fr)&&!/COVC\/\d+/i.test(Fr);(en||Zr)&&function(){var e=Fr.match(/ MQQBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var tn=!Xr&&/ QQBrowser\/\d+/i.test(Fr);tn&&function(){var e=Fr.match(/ QQBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var on=!Xr&&/QQBrowserLite\/\d+/i.test(Fr);on&&function(){var e=Fr.match(/QQBrowserLite\/([\d.]+)/);e&&e[1]&&e[1]}();var rn=!Xr&&/MQBHD\/\d+/i.test(Fr);rn&&function(){var e=Fr.match(/MQBHD\/([\d.]+)/);e&&e[1]&&e[1]}(),/Windows/i.test(Fr),!jr&&/MAC OS X/i.test(Fr),!qr&&/Linux/i.test(Fr),/MicroMessenger/i.test(Fr),/UCBrowser/i.test(Fr),/Electron/i.test(Fr);var nn=/MiuiBrowser/i.test(Fr);nn&&function(){var e=Fr.match(/MiuiBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var sn=/HuaweiBrowser/i.test(Fr);/Huawei/i.test(Fr),sn&&function(){var e=Fr.match(/HuaweiBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var an=/SamsungBrowser/i.test(Fr);an&&function(){var e=Fr.match(/SamsungBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var cn=/HeyTapBrowser/i.test(Fr);cn&&function(){var e=Fr.match(/HeyTapBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var un=/VivoBrowser/i.test(Fr);un&&function(){var e=Fr.match(/VivoBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var ln,dn,hn,pn=/Chrome/i.test(Fr),Tn=!Gr&&!Jr&&!Kr&&!Xr&&!$r&&!Yr&&!tn&&!nn&&!sn&&!an&&!cn&&!un&&/Chrome/i.test(Fr);Tn&&function(){var e=Fr.match(/Chrome\/(\d+)/);e&&e[1]&&parseFloat(e[1])}(),Tn&&function(){var e=Fr.match(/Chrome\/([\d.]+)/);e&&e[1]&&e[1]}(),!pn&&!en&&!Zr&&!on&&!rn&&/Safari/i.test(Fr)&&function(){var e=Fr.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"}(ln||(ln={})),function(e){e.CONTAIN="contain",e.COVER="cover",e.FILL="fill"}(dn||(dn={})),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,Rn=-1301,yn=-1314,Cn=-1315,_n=-1316,bn=-1302,Sn=-1317,Mn=-1318,wn=-1319,En=-1308,An=-102015,Vn=-70252,Pn={code:-1001,message:"参数错误, 请检查参数格式、是否非空等"},Ln={code:-1005,message:"not supported"},In="2.12.2-beta.4";e.TRTCMediaMixingErrorCode=void 0,(fn=e.TRTCMediaMixingErrorCode||(e.TRTCMediaMixingErrorCode={}))[fn.Success=0]="Success",fn[fn.Error=-1]="Error",fn[fn.InvalidParams=-2]="InvalidParams",fn[fn.NotFoundSource=-3]="NotFoundSource",fn[fn.ImageSourceLoadFailed=-4]="ImageSourceLoadFailed",fn[fn.CameraNotAuthorized=-5]="CameraNotAuthorized",fn[fn.CameraIsOccupied=-6]="CameraIsOccupied",fn[fn.CameraDisconnected=-7]="CameraDisconnected",e.TRTCMediaSourceType=void 0,(vn=e.TRTCMediaSourceType||(e.TRTCMediaSourceType={}))[vn.kCamera=0]="kCamera",vn[vn.kScreen=1]="kScreen",vn[vn.kImage=2]="kImage",vn[vn.kPhoneMirror=4]="kPhoneMirror",vn[vn.kText=5]="kText",vn[vn.kVideo=6]="kVideo",e.TRTCMediaMixingEvent=void 0,(gn=e.TRTCMediaMixingEvent||(e.TRTCMediaMixingEvent={})).onSourceSelected="onSourceSelected",gn.onSourceMoved="onSourceMoved",gn.onSourceResized="onSourceResized",gn.onRightButtonClicked="onRightButtonClicked",gn.onError="onError",gn.onSourcePlugged="onSourcePlugged",gn.onSourceConnected="onSourceConnected",gn.onSourceDisconnected="onSourceDisconnected",gn.onSourceUnplugged="onSourceUnplugged",gn.onMediaSourceSizeChanged="onMediaSourceSizeChanged";var xn,Dn=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}(),On=new Dn(null),kn=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"):On.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 On.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)):On.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 On.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){On.debug("".concat(this.logPrefix,"setEnabled: ").concat(this.enabled," -> ").concat(e)),this.enabled=e,this.movable&&(this.movable.style.cursor=e?"move":"default",On.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"}(xn||(xn={}));var Bn="trtc-resizable-top-left-anchor",zn="trtc-resizable-top-anchor",Fn="trtc-resizable-top-right-anchor",Nn="trtc-resizable-left-anchor",Qn="trtc-resizable-right-anchor",Hn="trtc-resizable-bottom-left-anchor",Wn="trtc-resizable-bottom-anchor",jn="trtc-resizable-bottom-right-anchor",Un={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 qn(e,t){for(var i in t)e.style[i]=t[i]}var Gn=function(){function e(e,t,i){void 0===i&&(i={keepRatio:!1,stopPropagation:!1,anchorMode:xn.Both,canExceedContainer:!1}),this.logPrefix="[Resizable]",this.container=null,this.options={keepRatio:!1,stopPropagation:!1,anchorMode:xn.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||xn.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(Bn),qn(c,Object.assign({},Un.resizeAnchor,Un.topLeftAnchor)),this.topLeftAnchor=c;var u=document.createElement("div");u.className="trtc-resizable-resize-anchor ".concat(zn),qn(u,Object.assign({},Un.resizeAnchor,Un.topAnchor)),this.topAnchor=u;var l=document.createElement("div");l.className="trtc-resizable-resize-anchor ".concat(Fn),qn(l,Object.assign({},Un.resizeAnchor,Un.topRightAnchor)),this.topRightAnchor=l;var d=document.createElement("div");d.className="trtc-resizable-resize-anchor ".concat(Nn),qn(d,Object.assign({},Un.resizeAnchor,Un.leftAnchor)),this.leftAnchor=d;var h=document.createElement("div");h.className="trtc-resizable-resize-anchor ".concat(Qn),qn(h,Object.assign({},Un.resizeAnchor,Un.rightAnchor)),this.rightAnchor=h;var p=document.createElement("div");p.className="trtc-resizable-resize-anchor ".concat(Hn),qn(p,Object.assign({},Un.resizeAnchor,Un.bottomLeftAnchor)),this.bottomLeftAnchor=p;var T=document.createElement("div");T.className="trtc-resizable-resize-anchor ".concat(Wn),qn(T,Object.assign({},Un.resizeAnchor,Un.bottomAnchor)),this.bottomAnchor=T;var f=document.createElement("div");f.className="trtc-resizable-resize-anchor ".concat(jn),qn(f,Object.assign({},Un.resizeAnchor,Un.bottomRightAnchor)),this.bottomRightAnchor=f,this.options.anchorMode!==xn.Both&&this.options.anchorMode!==xn.Edge||(null===(e=this.resizeTarget)||void 0===e||e.appendChild(u),null===(t=this.resizeTarget)||void 0===t||t.appendChild(d),null===(i=this.resizeTarget)||void 0===i||i.appendChild(h),null===(o=this.resizeTarget)||void 0===o||o.appendChild(T)),this.options.anchorMode!==xn.Both&&this.options.anchorMode!==xn.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(f))},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,On.debug("resize origin:",this.originTop,this.originLeft,this.originWidth,this.originHeight)}else On.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 Bn: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 zn: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 Fn: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 Nn: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 Qn: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 Hn: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 Wn: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 jn: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 On.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 On.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 On.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,d,h,p,T,f;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!==xn.Both&&this.options.anchorMode!==xn.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===(d=this.resizeTarget)||void 0===d||d.removeChild(this.bottomAnchor))),this.options.anchorMode!==xn.Both&&this.options.anchorMode!==xn.Corner||(this.topLeftAnchor&&(null===(h=this.resizeTarget)||void 0===h||h.removeChild(this.topLeftAnchor)),this.topRightAnchor&&(null===(p=this.resizeTarget)||void 0===p||p.removeChild(this.topRightAnchor)),this.bottomLeftAnchor&&(null===(T=this.resizeTarget)||void 0===T||T.removeChild(this.bottomLeftAnchor)),this.bottomRightAnchor&&(null===(f=this.resizeTarget)||void 0===f||f.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}(),Yn=function(){var t=new Map;for(var i in e.TRTCVideoResolution)if(isNaN(Number(i))){var o=e.TRTCVideoResolution[i],r=i.split("_");t.set(o,{width:parseInt(r[1]),height:parseInt(r[2])})}return t}(),Kn=function(){function t(t){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=t.logger,this.container=t.view,this.container.style.position="relative",this.videoResolution=t.videoResolution,this.resMode=t.resMode,Yn.has(t.videoResolution)){var i=Yn.get(t.videoResolution),o=i.width,r=i.height;this.resMode===e.TRTCVideoResolutionMode.TRTCVideoResolutionModeLandscape?(this.mixingVideoWidth=o,this.mixingVideoHeight=r):(this.mixingVideoWidth=r,this.mixingVideoHeight=o)}this.updatePreviewProperty(),this.canExceedContainer=t.canExceedContainer||!1,this.eventEmitter=new V,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 t.prototype.updateOptions=function(t){if(!be(t.videoResolution)||!be(t.resMode)){if(this.resMode=be(t.resMode)?this.resMode:t.resMode,t.videoResolution&&Yn.has(t.videoResolution)){var i=Yn.get(t.videoResolution),o=i.width,r=i.height;this.resMode===e.TRTCVideoResolutionMode.TRTCVideoResolutionModeLandscape?(this.mixingVideoWidth=o,this.mixingVideoHeight=r):(this.mixingVideoWidth=r,this.mixingVideoHeight=o)}this.updatePreviewProperty(),this.updateOverlay()}},t.prototype.addMedia=function(e){this.mediaList.unshift(e),e.isSelected&&(this.selectedMediaIndex=0,this.updateOverlay())},t.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()))},t.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()))},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.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=[]},t.prototype.initMediaMovable=function(){this.onMove=this.onMove.bind(this),this.movableHandler=new kn(this.moveAndResizeOverlay,this.container,{canExceedContainer:this.canExceedContainer,calcPositionOnly:!1}),this.movableHandler.on("move",this.onMove)},t.prototype.initMediaResizable=function(){this.onResize=this.onResize.bind(this),this.resizableHandler=new Gn(this.moveAndResizeOverlay,this.container,{keepRatio:!0,stopPropagation:!0,canExceedContainer:this.canExceedContainer,anchorMode:0}),this.resizableHandler.on("resize",this.onResize)},t.prototype.updateCanExceedContainer=function(e){this.movableHandler&&(this.movableHandler.options.canExceedContainer=e),this.resizableHandler&&(this.resizableHandler.options.canExceedContainer=e)},t.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"))},t.prototype.initContainerResizeObserver=function(){this.container&&(this.onPreviewAreaResize=this.onPreviewAreaResize.bind(this),this.resizeObserver=new ResizeObserver(this.onPreviewAreaResize),this.resizeObserver.observe(this.container))},t.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}}},t.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"))},t.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}},t.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",d({},o),n)}else console.debug("".concat(this.logPrefix,"onMove no selected media"))},t.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)},t.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(!Re(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},c={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",d({},n),c)}else console.debug("".concat(this.logPrefix,"onResize no selected media"))},t.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},t.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?d({},e):null)},t.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)}},t.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}))))}},t.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},t.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",d({},this.mediaList[this.selectedMediaIndex]))},t}(),Jn=function(){function t(i){if(this.logPrefix="[TRTCMediaMixingManager]",this.eventEmitter=new V,this.publishParams={videoEncoderParams:{videoResolution:e.TRTCVideoResolution.TRTCVideoResolution_1280_720,resMode:e.TRTCVideoResolutionMode.TRTCVideoResolutionModeLandscape,videoFps:15,videoBitrate:1800},canvasColor:0},this.mediaMixingDesigner=null,this.sourceList=[],this.trtcSourceMap=new Map,this.mixVideoTrack=null,this.selectedSource=null,this.view=null,this.screensWithSystemAudio=new Set,t.mediaMixingManager)return t.mediaMixingManager;t.mediaMixingManager=this,this.logger=i.logger,this.trtc=i.trtc,this.trtcCloud=i.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 p(this,void 0,Promise,(function(){var e,i,o,r,n;return T(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 p(this,void 0,Promise,(function(){var t,i,o,r,n=this;return T(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._getTRTCSourceKey=function(t){var i;return((i={})[e.TRTCMediaSourceType.kCamera]="camera",i[e.TRTCMediaSourceType.kScreen]="screen",i[e.TRTCMediaSourceType.kText]="text",i[e.TRTCMediaSourceType.kVideo]="video",i[e.TRTCMediaSourceType.kImage]="image",i)[t.type]},t.prototype._getTRTCFillMode=function(t){var i;return((i={})[e.TRTCVideoFillMode.TRTCVideoFillMode_Fill]="cover",i[e.TRTCVideoFillMode.TRTCVideoFillMode_Fit]="contain",i)[t]},t.prototype._getTRTCVideoProfile=function(t,i){var o,r,n,s=null!==(r=((o={})[e.TRTCVideoResolution.TRTCVideoResolution_480_270]={width:480,height:270},o[e.TRTCVideoResolution.TRTCVideoResolution_640_360]={width:640,height:360},o[e.TRTCVideoResolution.TRTCVideoResolution_960_540]={width:960,height:540},o[e.TRTCVideoResolution.TRTCVideoResolution_1280_720]={width:1280,height:720},o[e.TRTCVideoResolution.TRTCVideoResolution_1920_1080]={width:1920,height:1080},o)[t])&&void 0!==r?r:(n=t)&&"object"==typeof n&&"number"==typeof n.width&&"number"==typeof n.height?t:{width:1920,height:1080};return{width:s.width,height:s.height,frameRate:i,bitrate:1e3}},t.prototype._getTRTCLayout=function(t){var i,o,r,n,s,a,c,u,l,d,h,p,T,f,v,g,m={zIndex:(null===(r=t.layout)||void 0===r?void 0:r.zOrder)||0};if(Re(null===(n=t.layout)||void 0===n?void 0:n.rect)||(m.x=null===(s=t.layout)||void 0===s?void 0:s.rect.left,m.y=null===(a=t.layout)||void 0===a?void 0:a.rect.top,m.width=(null===(c=t.layout)||void 0===c?void 0:c.rect.right)-(null===(u=t.layout)||void 0===u?void 0:u.rect.left),m.height=(null===(l=t.layout)||void 0===l?void 0:l.rect.bottom)-(null===(d=t.layout)||void 0===d?void 0:d.rect.top)),Re(null===(h=t.layout)||void 0===h?void 0:h.fillMode)||(m.fillMode=this._getTRTCFillMode(null===(p=t.layout)||void 0===p?void 0:p.fillMode)),!Re(null===(T=t.layout)||void 0===T?void 0:T.mirror)){var R=((i={})[e.TRTCVideoMirrorType.TRTCVideoMirrorType_Auto]=!0,i[e.TRTCVideoMirrorType.TRTCVideoMirrorType_Enable]=!0,i[e.TRTCVideoMirrorType.TRTCVideoMirrorType_Disable]=!1,i);m.mirror=R[null===(f=t.layout)||void 0===f?void 0:f.mirror]}if(!Re(null===(v=t.layout)||void 0===v?void 0:v.rotation)){var y=((o={})[e.TRTCVideoRotation.TRTCVideoRotation0]=0,o[e.TRTCVideoRotation.TRTCVideoRotation90]=90,o[e.TRTCVideoRotation.TRTCVideoRotation180]=180,o[e.TRTCVideoRotation.TRTCVideoRotation270]=270,o);m.rotation=y[null===(g=t.layout)||void 0===g?void 0:g.rotation]}return m},t.prototype._getTRTCSourceItem=function(t){var i,o,r,n,s,a,c,u,l,h;switch(t.type){case e.TRTCMediaSourceType.kScreen:return h=e.TRTCVideoResolution.TRTCVideoResolution_1920_1080,(null==t?void 0:t.useInternalTrack)?{id:t.id,layout:this._getTRTCLayout(t),useInternalTrack:!0}:{id:t.id,profile:this._getTRTCVideoProfile((null===(i=t.screen)||void 0===i?void 0:i.resolution)||h,(null===(o=t.screen)||void 0===o?void 0:o.fps)||15),layout:this._getTRTCLayout(t),systemAudio:null===(r=t.screen)||void 0===r?void 0:r.systemAudio};case e.TRTCMediaSourceType.kCamera:return h=e.TRTCVideoResolution.TRTCVideoResolution_1280_720,(null==t?void 0:t.useInternalTrack)?{id:t.id,layout:this._getTRTCLayout(t),useInternalTrack:!0}:{id:t.id,cameraId:null===(n=t.camera)||void 0===n?void 0:n.cameraId,profile:this._getTRTCVideoProfile((null===(s=t.camera)||void 0===s?void 0:s.resolution)||h,(null===(a=t.camera)||void 0===a?void 0:a.fps)||15),videoTrack:null===(c=t.camera)||void 0===c?void 0:c.videoTrack,layout:this._getTRTCLayout(t)};case e.TRTCMediaSourceType.kText:return d(d({id:t.id},t.text||{}),{layout:this._getTRTCLayout(t)});case e.TRTCMediaSourceType.kImage:return{id:t.id,url:null===(u=t.image)||void 0===u?void 0:u.url,layout:this._getTRTCLayout(t)};case e.TRTCMediaSourceType.kVideo:return{id:t.id,url:null===(l=t.video)||void 0===l?void 0:l.url,layout:this._getTRTCLayout(t)};default:return null}},t.prototype._getCanvasSize=function(t,i){var o,r,n=((o={})[e.TRTCVideoResolution.TRTCVideoResolution_480_270]={width:480,height:270},o[e.TRTCVideoResolution.TRTCVideoResolution_640_360]={width:640,height:360},o[e.TRTCVideoResolution.TRTCVideoResolution_960_540]={width:960,height:540},o[e.TRTCVideoResolution.TRTCVideoResolution_1280_720]={width:1280,height:720},o[e.TRTCVideoResolution.TRTCVideoResolution_1920_1080]={width:1920,height:1080},o)[t],s=n.width,a=n.height;return i===e.TRTCVideoResolutionMode.TRTCVideoResolutionModePortrait&&(s=(r=[a,s])[0],a=r[1]),{width:s,height:a}},t.prototype.addMediaSource=function(t){var i;return p(this,void 0,Promise,(function(){var o,r,n,s,a,c,u,l,d;return T(this,(function(h){switch(h.label){case 0:if(-1!==this.findMediaSourceIndex(t))throw new Error("Media source already existed");if(o=Me(t),r=this._getTRTCSourceKey(o),!(n=this._getTRTCSourceItem(o))||!r)throw new Error("Invalid media source");return(s=Me(this.trtcSourceMap.get(r))||[]).push(n),[4,this.trtc.updatePlugin("VideoMixer",(d={},d[r]=s,d))];case 1:return a=h.sent(),c=a.result,u=a.systemAudioTrackList,t.type===e.TRTCMediaSourceType.kScreen&&(null==u?void 0:u[t.id])?(this.screensWithSystemAudio.add(t.id),l=null==u?void 0:u[t.id],this.logger.log("".concat(this.logPrefix," startPlugin AudioMixer, track ID:"),l.id),[4,this.trtc.startPlugin("AudioMixer",{id:"systemAudioTrack_".concat(t.id),track:l})]):[3,3];case 2:h.sent(),h.label=3;case 3:if(c.failedDetails.find((function(e){return e.id===t.id})))throw new Error("Failed to add media source");return o.isSelected&&(this.unselectMediaSource(this.selectedSource),this.selectedSource=t),this.trtcSourceMap.set(r,s),null===(i=this.mediaMixingDesigner)||void 0===i||i.addMedia({id:o.id,rect:this._getDesignerMediaRect(t),isSelected:!!Re(o.isSelected)||o.isSelected,origin:o,interaction:o.interaction}),o.isSelected&&(this.selectedSource=o),this.sourceList.push(o),[2]}}))}))},t.prototype.removeMediaSource=function(t){var i,o,r;return p(this,void 0,Promise,(function(){var n,s,a,c,u,l;return T(this,(function(d){switch(d.label){case 0:if(this.logger.log("".concat(this.logPrefix,"removeMediaSource:"),t),-1===(n=this.findMediaSourceIndex(t)))throw new Error("Not existing media source to remove");return s=this._getTRTCSourceKey(t),a=Me(this.trtcSourceMap.get(s))||[],c=a.findIndex((function(e){return e.id===t.id})),a.splice(c,1),[4,this.trtc.updatePlugin("VideoMixer",(l={},l[s]=a,l))];case 1:return u=d.sent().result,t.type===e.TRTCMediaSourceType.kScreen&&this.screensWithSystemAudio.has(t.id)?(this.screensWithSystemAudio.delete(t.id),[4,this.trtc.stopPlugin("AudioMixer",{id:"systemAudioTrack_".concat(t.id)})]):[3,3];case 2:d.sent(),d.label=3;case 3:if(u.failedDetails.find((function(e){return e.id===t.id})))throw new Error("Failed to remove media source");return null===(i=this.mediaMixingDesigner)||void 0===i||i.removeMedia({id:t.id,rect:null===(o=t.layout)||void 0===o?void 0:o.rect,isSelected:t.isSelected||!1,origin:Me(t)}),(null===(r=this.selectedSource)||void 0===r?void 0:r.id)===t.id&&(this.selectedSource=null),this.trtcSourceMap.set(s,a),this.sourceList.splice(n,1),[2]}}))}))},t.prototype._getDesignerMediaRect=function(t){var i,o,r=(null===(i=t.layout)||void 0===i?void 0:i.rect)||{left:0,top:0,right:0,bottom:0},n=r.left,s=r.top,a=r.right,c=r.bottom,u=a-n,l=c-s;switch(null===(o=t.layout)||void 0===o?void 0:o.rotation){case e.TRTCVideoRotation.TRTCVideoRotation0:case e.TRTCVideoRotation.TRTCVideoRotation180:return{left:n,top:s,right:a,bottom:c};case e.TRTCVideoRotation.TRTCVideoRotation90:case e.TRTCVideoRotation.TRTCVideoRotation270:return{left:n,top:s,right:n+l,bottom:s+u};default:return{left:n,top:s,right:a,bottom:c}}},t.prototype._getPluginMediaRect=function(t){var i,o,r=(null===(i=t.layout)||void 0===i?void 0:i.rect)||{left:0,top:0,right:0,bottom:0},n=r.left,s=r.top,a=r.right,c=r.bottom;switch(null===(o=t.layout)||void 0===o?void 0:o.rotation){case e.TRTCVideoRotation.TRTCVideoRotation0:case e.TRTCVideoRotation.TRTCVideoRotation180:return{left:n,top:s,right:a,bottom:c};case e.TRTCVideoRotation.TRTCVideoRotation90:case e.TRTCVideoRotation.TRTCVideoRotation270:return{left:n,top:s,right:n+(c-s),bottom:s+(a-n)};default:return{left:n,top:s,right:a,bottom:c}}},t.prototype.updateMediaSource=function(e){var t,i;return p(this,void 0,Promise,(function(){var o,r,n,s,a,c,u,l;return T(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=d(d({},this.sourceList[o]),Me(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=Me(this.trtcSourceMap.get(n))||[],c=a.findIndex((function(t){return t.id===e.id})),a[c]=s,[4,this.trtc.updatePlugin("VideoMixer",(l={},l[n]=a,l))];case 1:if(h.sent().result.failedDetails.find((function(t){return t.id===e.id})))throw new Error("Failed to update media source");return u={id:e.id,rect:this._getDesignerMediaRect(e),isSelected:e.isSelected||!1,origin:Me(e),interaction:r.interaction},this.logger.log("".concat(this.logPrefix,"updateParams:"),JSON.stringify(u)),null===(i=this.mediaMixingDesigner)||void 0===i||i.updateMedia(u),this.trtcSourceMap.set(n,a),this.sourceList[o]=r,[2]}}))}))},t.prototype.startPublish=function(){return p(this,void 0,Promise,(function(){return T(this,(function(e){switch(e.label){case 0:return this.logger.log("".concat(this.logPrefix," startPublish")),[4,this.trtcCloud._startPublishVideoTrack({videoTrack:this.mixVideoTrack})];case 1:return e.sent(),[2]}}))}))},t.prototype.stopPublish=function(){return p(this,void 0,Promise,(function(){return T(this,(function(e){switch(e.label){case 0:return this.logger.log("".concat(this.logPrefix," stopPublish")),[4,this.trtcCloud._stopPublishVideoTrack()];case 1:return e.sent(),[2]}}))}))},t.prototype.updatePublishParams=function(e){var t,i,o,r,n;return p(this,void 0,Promise,(function(){var s,a,u,l,d,h,p,f,v,m,R,y,C,_,b,S,M,w,E,A,V,P,L,I;return T(this,(function(T){switch(T.label){case 0:this.logger.log("".concat(this.logPrefix,"updatePublishParams:"),e),s=this.publishParams,this.publishParams=e,a=this._getCanvasSize(e.videoEncoderParams.videoResolution,e.videoEncoderParams.resMode),u=a.width,l=a.height,T.label=1;case 1:return T.trys.push([1,3,,4]),[4,this.trtc.updatePlugin("VideoMixer",{canvasInfo:{width:u,height:l,canvasColor:String(e.canvasColor)}})];case 2:return T.sent(),[3,4];case 3:if((d=T.sent()).code!==c.default.ERROR_CODE.OPERATION_ABORT)throw d;return[3,4];case 4:null===(o=this.mediaMixingDesigner)||void 0===o||o.updateOptions({videoResolution:this.publishParams.videoEncoderParams.videoResolution,resMode:this.publishParams.videoEncoderParams.resMode}),T.label=5;case 5:T.trys.push([5,11,12,17]),h=g(this.sourceList),T.label=6;case 6:return[4,h.next()];case 7:return(p=T.sent()).done?[3,10]:(f=p.value).layout?(v=f.layout.rect||{left:0,top:0,right:0,bottom:0},m=v.left,R=v.top,y=v.right,C=v.bottom,_=this._getCanvasSize(s.videoEncoderParams.videoResolution),b=_.width,S=_.height,M=this._getCanvasSize(e.videoEncoderParams.videoResolution),w=M.width,E=M.height,A=m*w/b,V=R*E/S,P=y*w/b,L=C*E/S,f.layout.rect={left:A,top:V,right:P,bottom:L},[4,this.updateMediaSource(f)]):[3,9];case 8:T.sent(),null===(r=this.eventEmitter)||void 0===r||r.emit("onSourceResized",f,null===(n=f.layout)||void 0===n?void 0:n.rect),T.label=9;case 9:return[3,6];case 10:return[3,17];case 11:return I=T.sent(),t={error:I},[3,17];case 12:return T.trys.push([12,,15,16]),p&&!p.done&&(i=h.return)?[4,i.call(h)]:[3,14];case 13:T.sent(),T.label=14;case 14:return[3,16];case 15:if(t)throw t.error;return[7];case 16:return[7];case 17:return[4,this.trtcCloud.setVideoEncoderParam(e.videoEncoderParams)];case 18:return T.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 t,i;this.view&&(this.mediaMixingDesigner=new Kn({view:this.view,videoResolution:(null===(t=this.publishParams)||void 0===t?void 0:t.videoEncoderParams.videoResolution)||e.TRTCVideoResolution.TRTCVideoResolution_1920_1080,resMode:(null===(i=this.publishParams)||void 0===i?void 0:i.videoEncoderParams.resMode)||e.TRTCVideoResolutionMode.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 p(this,void 0,void 0,(function(){return T(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(d(d({},e.origin),{isSelected:!0})),[3,3]):[3,1];case 1:return this.selectedSource?[4,this.updateMediaSource(d(d({},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=d(d({},e.origin),{layout:d(d({},e.origin.layout),{rect:t})});this.updateMediaSource(Se(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=d(d({},e.origin),{layout:d(d({},e.origin.layout),{rect:t})});this.updateMediaSource(Se(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 p(this,void 0,Promise,(function(){var o;return T(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:Me(e)}),[2]):[2]}))}))},t.mediaMixingManager=null,t}(),Xn=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=d(d({},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 c=[];this.queue=this.queue.filter((function(e,t){return 0===t||(e.functionName!==o||(c.push(e),!1))})),c.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}(),$n=new WeakMap,Zn=new WeakMap,es=new WeakMap;function ts(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=es.get(this)||new Map;es.set(this,c);for(var u=null,l=0,d=s;l<d.length;l++){var h=d[l],p=c.get(h);if(p){u=p;break}}for(var T=u||new Xn,f=0,v=s;f<v.length;f++){h=v[f];c.set(h,T)}var g=a?o:void 0;return T.push({fn:n,args:t,context:this},!1,a,g)},r}}var is=function(){function e(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 e.prototype.registerStateListener=function(){this.trtc.on(c.default.EVENT.REALTIME_TRANSCRIBER_STATE_CHANGED,this.handleStateEvent)},e.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)}},e.prototype.updateMessageSubscription=function(){var e=!this.isPaused&&this.listeners.size>0;if(e&&!this.isMessageListenerRegistered)return this.trtc.on(c.default.EVENT.REALTIME_TRANSCRIBER_MESSAGE,this.handleMessageEvent),void(this.isMessageListenerRegistered=!0);!e&&this.isMessageListenerRegistered&&(this.trtc.off(c.default.EVENT.REALTIME_TRANSCRIBER_MESSAGE,this.handleMessageEvent),this.isMessageListenerRegistered=!1)},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,v([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,v([e,this.logPrefix],i,!1))},e.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)}}))},e.prototype.startRealtimeTranscriber=function(e){return p(this,void 0,Promise,(function(){var t,i,o;return T(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]}}))}))},e.prototype.stopRealtimeTranscriber=function(e){return p(this,void 0,Promise,(function(){var t;return T(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]}}))}))},e.prototype.pauseReceivingMessage=function(){this.isPaused||(this.log("pauseReceivingMessage"),this.isPaused=!0,this.updateMessageSubscription())},e.prototype.resumeReceivingMessage=function(){this.isPaused&&(this.log("resumeReceivingMessage"),this.isPaused=!1,this.updateMessageSubscription())},e.prototype.addListener=function(e){this.listeners.add(e),this.updateMessageSubscription()},e.prototype.removeListener=function(e){this.log("removeListener"),this.listeners.delete(e),this.updateMessageSubscription()},e.prototype.destroy=function(){this.log("destroy"),this.listeners.clear(),this.isPaused=!0,this.updateMessageSubscription(),this.trtc.off(c.default.EVENT.REALTIME_TRANSCRIBER_STATE_CHANGED,this.handleStateEvent)},e}(),os=c.default._loggerManager;os.info("TRTCCloud Version: ".concat(In));var rs,ns,ss,as="trtcCloud",cs=1;navigator&&navigator.mediaDevices&&navigator.mediaDevices.addEventListener&&navigator.mediaDevices.addEventListener("devicechange",(rs=function(){0!==us.size&&Array.from(us.values()).forEach((function(e){e.fn()}))},ns=30,function(){for(var e=this,t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];ss>0&&clearTimeout(ss),ss=window.setTimeout((function(){rs.apply(e,t),ss=-1}),ns)}));var us=new Map,ls=function(t){function s(o){void 0===o&&(o={});var r=t.call(this)||this;r._version="",r._frameWorkType=30,r._component=0,r._language=0,r._networkProxy={},r._localView=null,r._autoRecvAudio=!0,r._autoRecvVideo=!1,r._localTestView=null,r._isVideoPublish=!0,r._localRenderParams={rotation:e.TRTCVideoRotation.TRTCVideoRotation0,fillMode:e.TRTCVideoFillMode.TRTCVideoFillMode_Fill,mirrorType:e.TRTCVideoMirrorType.TRTCVideoMirrorType_Auto},r._encoderMirror=void 0,r._videoProfile={},r._isAudioPublish=!0,r._audioMuteType=!1,r._audioProfile=c.default.TYPE.AUDIO_PROFILE_STANDARD,r._captureVolume=100,r._playoutVolume=100,r._isSharingScreen=!1,r._remoteStreamConfig=new Map,r._remoteStreamMap=new Map,r._cameraList=[],r._microphoneList=[],r._speakerList=[],r._currentCamera={},r._currentMicrophone={},r._currentSpeaker={},r._currentCameraId="",r._currentMicrophoneId="",r._currentSpeakerId="",r._screenShareParams={option:{}},r._isMobile=Ur,r._isFrontCamera=!0,r._cameraVideoTrack=null,r._smallStreamVideoProfile=void 0,r._qosPreference=void 0,r._defaultVideoProfile={width:640,height:480,frameRate:15,bitrate:900},r._defaultScreenProfile={width:1920,height:1080,frameRate:15,bitrate:1500},r._defaultSmallVideoProfile={width:160,height:120,frameRate:15,bitrate:200},r._isVirtualBackground=!1,r._isTestVirtualBackground=!1,r._isBeautyEnabled=!1,r._isTestBeautyEnabled=!1,r._currentAudioQuality=e.TRTCAudioQuality.TRTCAudioQualityDefault,r._lastAudioScene=e.TRTCAudioSceneEx.default,r._isAIDenoiserEnabled=!1,r._currentAIDenoiserMode=void 0,r._pendingAIDenoiserApply=!1,r._remoteStatisticsUserIdList=[],r._hasJoinedRoom=!1,r._isExitingRoom=!1,r._version=In;var a=o.frameWorkType,l=void 0===a?30:a,d=o.component,h=void 0===d?0:d,p=o.language,T=void 0===p?0:p;return r._frameWorkType=l,r._component=h,r._language=T,r._trtc=c.default.create({enableSEI:s.enableSEI,assetsPath:s.assetsPath,enableVolumeControlInIOS:!0,plugins:[u.default,i.LEBPlayer,n.RealtimeTranscriber]}),r._testTrtc=c.default.create(),r._log=c.default._loggerManager,r.logger=new Dn(os,{seq:cs++}),r._echoCancellation=void 0,r._noiseSuppression=void 0,r._autoGainControl=void 0,r._addTRTCEvents(),r.handleDeviceChange=r.handleDeviceChange.bind(r),us.set(r,{fn:r.handleDeviceChange,self:r}),r}var a;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}l(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}(s,t),s.getPlugin=function(e){return"VirtualBackground"===e?o.VirtualBackground:"BasicBeauty"===e?r.BasicBeauty:"VideoMixer"===e?u.default:null},s.getTRTCShareInstance=function(e){return s.shareInstance||(s.shareInstance=new s(e)),s.shareInstance},s.setLogLevel=function(t,i){var o,r=((o={})[e.TRTCLogLevel.TRTCLogLevelVerbose]=0,o[e.TRTCLogLevel.TRTCLogLevelDebug]=1,o[e.TRTCLogLevel.TRTCLogLevelInfo]=2,o[e.TRTCLogLevel.TRTCLogLevelWarn]=3,o[e.TRTCLogLevel.TRTCLogLevelError]=4,o[e.TRTCLogLevel.TRTCLogLevelFatal]=4,o[e.TRTCLogLevel.TRTCLogLevelNone]=5,o),n=r[t];Re(n)&&(n=r[e.TRTCLogLevel.TRTCLogLevelInfo]);var s=!Ce(i)||i;c.default.setLogLevel(n,s)},s.destroyTRTCShareInstance=function(){s.shareInstance&&(s.shareInstance._destroy(),s.shareInstance=null),Array.from(s.subCloudMap.keys()).forEach((function(e){return e._destroy()}))},s.callExperimentalAPI=function(e){console.log("static ".concat(as,".callExperimentalAPI"),e);var t=_e(e);if(t!==e){var i=t.api,o=t.params;if(i&&o)try{switch(i){case"enableSEI":s.enableSEI=o.enable;break;case"setAssetsPath":s.assetsPath=o.assetsPath}}catch(r){throw r}}},s.prototype.createSubCloud=function(){if(this!==s.shareInstance)return null;var e=new s;return this._inheritPropertiesToSubCloud(e),this._inheritEventsToSubCloud(e),s.subCloudMap.set(e,e),e},s.prototype.destroy=function(){this!==s.shareInstance?(s.subCloudMap.get(this)&&s.subCloudMap.delete(this),this._destroy()):s.destroyTRTCShareInstance()},s.prototype._destroy=function(){us.delete(this),this.removeAllListeners(),this._trtc.off("*"),this._trtc.destroy(),this._trtc=null,this._testTrtc.off("*"),this._testTrtc.destroy(),this._testTrtc=null},s.prototype.getSDKVersion=function(){return this._version||""},s.prototype.enterRoom=function(e,t){return p(this,void 0,Promise,(function(){var i,o,r,n,s,a,c,u,l,h,p,f,v,g,m,R,y,C,_=this;return T(this,(function(T){switch(T.label){case 0:if(i=e.sdkAppId,o=e.userId,r=e.userSig,n=e.roomId,s=e.strRoomId,a=e.role,c=e.privateMapKey,u=e.businessInfo,l=e.enableAutoPlayDialog,h=e.proxy,p=e.streamId,f=e.userDefineRecordId,this.logger.update({sdkAppId:i,userId:o}),this.logger.info("".concat(as,".enterRoom with params: "),e,t),h&&(this._networkProxy=h),!(i&&o&&r))return[3,5];T.label=1;case 1:return T.trys.push([1,3,,4]),v={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},v=c?d(d({},v),{privateMapKey:c}):v,v=u?d(d({},v),{businessInfo:u}):v,g=l||this._enableAutoPlayDialog,v=Ce(g)?d(d({},v),{enableAutoPlayDialog:g}):v,v=this._networkProxy?d(d({},v),{proxy:this._networkProxy}):v,v=p?d(d({},v),{streamId:p}):v,v=f?d(d({},v),{userDefineRecordId:f}):v,v=void 0!==this._latencyLevel?d(d({},v),{latencyLevel:this._latencyLevel}):v,m=me(),[4,this._trtc.enterRoom(v)];case 2:return T.sent(),this._hasJoinedRoom=!0,this._sdkAppId=i,this._userId=o,this._userSig=r,this._pendingAIDenoiserApply&&(this._pendingAIDenoiserApply=!1,this._applyAIDenoiserDecision().catch((function(e){_.logger.warn("".concat(as,".enterRoom flush AI denoiser decision fail: "),e)}))),R=me()-m,this.emit("onEnterRoom",R),[3,4];case 3:throw y=T.sent(),C=(C=this._transformTRTCErrorCode(y,"enterRoom"))<0?C:-1,this.emit("onEnterRoom",C),this._callFunctionErrorManage(y,"enterRoom"),y;case 4:return[3,6];case 5:this._emitError(Pn),T.label=6;case 6:return[2]}}))}))},s.prototype.exitRoom=function(){return p(this,void 0,Promise,(function(){var e;return T(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),this.logger.info("".concat(as,".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]}}))}))},s.prototype.switchRole=function(e){return p(this,void 0,void 0,(function(){var t;return T(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(as,".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]}}))}))},s.prototype.setDefaultStreamRecvMode=function(e,t){return p(this,void 0,void 0,(function(){return T(this,(function(i){return this.logger.info("".concat(as,".setDefaultStreamRecvMode with param: "),{autoRecvAudio:e,autoRecvVideo:t}),Ce(e)&&(this._autoRecvAudio=e),Ce(t)&&(this._autoRecvVideo=t),[2]}))}))},s.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=e.TRTCAudioQuality.TRTCAudioQualityDefault,this._lastAudioScene=e.TRTCAudioSceneEx.default,this._isAIDenoiserEnabled&&this._trtc)try{this._trtc.stopPlugin(he)}catch(t){this.logger.warn("".concat(as,".resetTRTCCloud stop AI denoiser fail: "),t)}this._isAIDenoiserEnabled=!1,this._currentAIDenoiserMode=void 0,this._pendingAIDenoiserApply=!1},s.prototype._updateLocalVideo=function(){return p(this,void 0,void 0,(function(){var e;return T(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this._trtc.updateLocalVideo(this._generateLocalVideoData())];case 1:return t.sent(),[3,3];case 2:if((e=t.sent()).code!==c.default.ERROR_CODE.OPERATION_ABORT)throw e;return[3,3];case 3:return[2]}}))}))},s.prototype._updateLocalTestVideo=function(){return p(this,void 0,void 0,(function(){var e;return T(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this._testTrtc.updateLocalVideo(this._generateLocalTestVideoData())];case 1:return t.sent(),[3,3];case 2:if((e=t.sent()).code!==c.default.ERROR_CODE.OPERATION_ABORT)throw e;return[3,3];case 3:return[2]}}))}))},s.prototype._updateLocalScreen=function(){return p(this,void 0,void 0,(function(){var e;return T(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this._trtc.updateScreenShare(this._getScreenShareParams())];case 1:return t.sent(),[3,3];case 2:if((e=t.sent()).code!==c.default.ERROR_CODE.OPERATION_ABORT)throw e;return[3,3];case 3:return[2]}}))}))},s.prototype._updateRemoteVideo=function(e,t){return p(this,void 0,void 0,(function(){var i;return T(this,(function(o){switch(o.label){case 0:if(!this._hasJoinedRoom||this._isExitingRoom)return[2];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,this._trtc.updateRemoteVideo(this._generateRemoteVideoData(e,t))];case 2:return o.sent(),[3,4];case 3:if((i=o.sent()).code!==c.default.ERROR_CODE.OPERATION_ABORT)throw i;return[3,4];case 4:return[2]}}))}))},s.prototype.startLocalPreview=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return p(this,void 0,Promise,(function(){var t,i,o,r,n;return T(this,(function(s){switch(s.label){case 0:this.logger.info("".concat(as,".startLocalPreview with params: "),e),1===v([],e,!0).length?i=v([],e,!0)[0]:2===v([],e,!0).length&&(n=v([],e,!0),t=n[0],i=n[1]),Re(t)||(this._setIsMobile(!0),this._setIsFrontCamera(t)),this._setLocalView(i),s.label=1;case 1:s.trys.push([1,9,,10]),s.label=2;case 2:return s.trys.push([2,4,,8]),[4,this._trtc.startLocalVideo(this._generateLocalVideoData())];case 3:return s.sent(),[3,8];case 4:return(o=s.sent()).code!==c.default.ERROR_CODE.OPERATION_ABORT?[3,6]:[4,this._updateLocalVideo()];case 5:return s.sent(),[3,7];case 6:throw o;case 7:return[3,8];case 8:return this.emit("onCameraDidReady"),[3,10];case 9:throw r=s.sent(),this._callFunctionErrorManage(r,"startLocalPreview"),r;case 10:return[2]}}))}))},s.prototype.updateLocalView=function(e){return p(this,void 0,void 0,(function(){return T(this,(function(t){switch(t.label){case 0:return this.logger.info("".concat(as,".updateLocalView with param: "),e),this._setLocalView(e),[4,this._updateLocalVideo()];case 1:return t.sent(),[2]}}))}))},s.prototype.stopLocalPreview=function(){return p(this,void 0,void 0,(function(){var e;return T(this,(function(t){switch(t.label){case 0:this.logger.info("".concat(as,".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(as," stopLocalPreview error: ").concat(e)),this._callFunctionErrorManage(e,"stopLocalPreview"),e;case 4:return[2]}}))}))},s.prototype.muteLocalVideo=function(e){return void 0===e&&(e=!1),p(this,void 0,void 0,(function(){var t;return T(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(as,".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]}}))}))},s.prototype.startRemoteView=function(t,i,o){return p(this,void 0,void 0,(function(){var r,n;return T(this,(function(s){switch(s.label){case 0:this.logger.info("".concat(as,".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===e.TRTCVideoStreamType.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!==c.default.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]}}))}))},s.prototype.updateRemoteView=function(e,t,i){return p(this,void 0,void 0,(function(){return T(this,(function(o){switch(o.label){case 0:return this.logger.info("".concat(as,".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]}}))}))},s.prototype.stopRemoteView=function(e,t){return p(this,void 0,void 0,(function(){var i;return T(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(as,".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]}}))}))},s.prototype.stopAllRemoteView=function(){return p(this,void 0,void 0,(function(){var e;return T(this,(function(t){switch(t.label){case 0:this.logger.info("".concat(as,".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]}}))}))},s.prototype.setVideoEncoderParam=function(t){return p(this,void 0,void 0,(function(){var i,o;return T(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(as,".setVideoEncoderParam with params: "),t),r.label=1;case 1:return r.trys.push([1,4,,5]),i=this._getTRTCVideoProfile(e.TRTCVideoStreamType.TRTCVideoStreamTypeBig,t),this._setVideoProfile(i),[4,this._updateLocalVideo()];case 2:return r.sent(),[4,this._updateLocalTestVideo()];case 3:return r.sent(),[3,5];case 4:throw o=r.sent(),this._callFunctionErrorManage(o,"setVideoEncoderParam"),o;case 5:return[2]}}))}))},s.prototype.setNetworkQosParam=function(e){return p(this,void 0,void 0,(function(){var t,i,o=this;return T(this,(function(r){return this.logger.info("".concat(as,".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)}))}))]}))}))},s.prototype.setLocalRenderParams=function(e){return p(this,void 0,void 0,(function(){var t;return T(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(as,".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]}}))}))},s.prototype.setVideoEncoderMirror=function(e){return p(this,void 0,void 0,(function(){var t;return T(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(as,".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]}}))}))},s.prototype.setRemoteRenderParams=function(e,t,i){return p(this,void 0,void 0,(function(){var o;return T(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(as,".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]}}))}))},s.prototype._updateLocalAudio=function(){return p(this,void 0,void 0,(function(){var e;return T(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this._trtc.updateLocalAudio(this._generateLocalAudioData())];case 1:return t.sent(),[3,3];case 2:if((e=t.sent()).code!==c.default.ERROR_CODE.OPERATION_ABORT)throw e;return[3,3];case 3:return[2]}}))}))},s.prototype._updateLocalTestAudio=function(){return p(this,void 0,void 0,(function(){var e;return T(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this._testTrtc.updateLocalAudio(this._generateLocalTestAudioData())];case 1:return t.sent(),[3,3];case 2:if((e=t.sent()).code!==c.default.ERROR_CODE.OPERATION_ABORT)throw e;return[3,3];case 3:return[2]}}))}))},s.prototype.startLocalAudio=function(t){return void 0===t&&(t=e.TRTCAudioQuality.TRTCAudioQualityDefault),p(this,void 0,void 0,(function(){var i,o,r;return T(this,(function(n){switch(n.label){case 0:t===e.TRTCAudioQuality.TRTCAudioQualitySpeech?this.logger.warn("Web trtcCloud not support audioQuality of TRTCAudioQualitySpeech, and will use TRTCAudioQualityDefault"):this.logger.info("".concat(as,".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!==c.default.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===e.TRTCAudioSceneEx.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(as," startLocalAudio error: ").concat(r)),this._callFunctionErrorManage(r,"startLocalAudio"),r;case 12:return[2]}}))}))},s.prototype.stopLocalAudio=function(){return p(this,void 0,void 0,(function(){var e;return T(this,(function(t){switch(t.label){case 0:this.logger.info("".concat(as,".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]}}))}))},s.prototype.muteLocalAudio=function(e){return void 0===e&&(e=!1),p(this,void 0,void 0,(function(){var t;return T(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(as,".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]}}))}))},s.prototype.setAudioCaptureVolume=function(e){return p(this,void 0,void 0,(function(){var t;return T(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(as,".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]}}))}))},s.prototype.getAudioCaptureVolume=function(){return this.logger.info("".concat(as,".getAudioCaptureVolume")),this._getCaptureVolume()},s.prototype.setAudioPlayoutVolume=function(e){return p(this,void 0,void 0,(function(){var t;return T(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(as,".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]}}))}))},s.prototype.getAudioPlayoutVolume=function(){return this.logger.info("".concat(as,".getAudioPlayoutVolume")),this._playoutVolume},s.prototype.muteRemoteAudio=function(e,t){return void 0===t&&(t=!1),p(this,void 0,void 0,(function(){var i;return T(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(as,".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]}}))}))},s.prototype.muteAllRemoteAudio=function(e){this.logger.info("".concat(as,".muteAllRemoteAudio with params: "),e);try{this._trtc.muteRemoteAudio("*",e)}catch(t){throw this._callFunctionErrorManage(t,"muteAllRemoteAudio"),t}},s.prototype.muteRemoteVideoStream=function(e,t,i){return p(this,void 0,void 0,(function(){var o;return T(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(as,".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]}}))}))},s.prototype.muteAllRemoteVideoStreams=function(e){return p(this,void 0,void 0,(function(){var t;return T(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(as,".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]}}))}))},s.prototype.setRemoteAudioVolume=function(e,t){this.logger.info("".concat(as,".setRemoteAudioVolume with params: "),e,t);try{this._trtc.setRemoteAudioVolume(e,t)}catch(i){throw this._callFunctionErrorManage(i,"setRemoteAudioVolume"),i}},s.prototype.enableAudioVolumeEvaluation=function(e){this.logger.info("".concat(as,".enableAudioVolumeEvaluation with params: "),e);try{this._trtc.enableAudioVolumeEvaluation(e)}catch(t){throw this._callFunctionErrorManage(t,"enableAudioVolumeEvaluation"),t}},s.prototype.enableSmallVideoStream=function(t,i){return p(this,void 0,Promise,(function(){var o;return T(this,(function(r){switch(r.label){case 0:return this.logger.info("".concat(as,".enableSmallVideoStream with params: "),t,i),t?(o=this._getTRTCVideoProfile(e.TRTCVideoStreamType.TRTCVideoStreamTypeSmall,i),this._setSmallStreamVideoProfile(o)):this._setSmallStreamVideoProfile(void 0),[4,this._updateLocalVideo()];case 1:return r.sent(),[2]}}))}))},s.prototype.snapshotVideo=function(t,i){var o="";return o=""===t&&i===e.TRTCVideoStreamType.TRTCVideoStreamTypeBig?this._trtc.getVideoSnapshot():""===t&&i===e.TRTCVideoStreamType.TRTCVideoStreamTypeSub?this._trtc.getVideoSnapshot({streamType:this._getTRTCStreamType(i)}):this._trtc.getVideoSnapshot({userId:t,streamType:this._getTRTCStreamType(i)}),this.emit("onSnapshotComplete",t,i,o),o},s.prototype.startScreenShare=function(t,i,o){return p(this,void 0,void 0,(function(){var r,n,s,a,u,l;return T(this,(function(d){switch(d.label){case 0:this.logger.info("".concat(as,".startScreenShare with params: "),t,i,o),d.label=1;case 1:return d.trys.push([1,3,,4]),n=(r=o||{}).screenAudio,s=void 0!==n&&n,a=r.videoTrack,u=this._getTRTCVideoProfile(e.TRTCVideoStreamType.TRTCVideoStreamTypeSub,o),this._setScreenShareParams({view:t,profile:u,systemAudio:s,videoTrack:a,streamType:i}),[4,this._trtc.startScreenShare(this._getScreenShareParams())];case 2:return d.sent(),this._isSharingScreen=!0,this.emit("onScreenCaptureStarted"),[3,4];case 3:if(l=d.sent(),this._callFunctionErrorManage(l,"startScreenShare"),l.code!==c.default.ERROR_CODE.OPERATION_ABORT)throw console.error("Start share screen error:",l,l.code,l.name,l.message),l;return[3,4];case 4:return[2]}}))}))},s.prototype.setSubStreamEncoderParam=function(t){return p(this,void 0,void 0,(function(){var i,o;return T(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(as,".setSubStreamEncoderParam with params: "),t),i=this._getTRTCVideoProfile(e.TRTCVideoStreamType.TRTCVideoStreamTypeSub,t),this._setScreenShareParams({profile:i}),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this._updateLocalScreen()];case 2:return r.sent(),[3,4];case 3:throw o=r.sent(),this._callFunctionErrorManage(o,"setSubStreamEncoderParam"),o;case 4:return[2]}}))}))},s.prototype.stopScreenShare=function(){return p(this,void 0,Promise,(function(){var e;return T(this,(function(t){switch(t.label){case 0:this.logger.info("".concat(as,".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]}}))}))},s.prototype._startPublishVideoTrack=function(e){var t=e.videoTrack;return p(this,void 0,void 0,(function(){var e,i;return T(this,(function(o){switch(o.label){case 0:o.trys.push([0,7,,8]),o.label=1;case 1:return o.trys.push([1,3,,6]),[4,this._trtc.startLocalVideo({option:{videoTrack:t,profile:this._getVideoProfile()},forcePublish:!0})];case 2:return o.sent(),[3,6];case 3:return(e=o.sent()).code!==c.default.ERROR_CODE.OPERATION_ABORT?[3,5]:[4,this._trtc.updateLocalVideo({option:{videoTrack:t,profile:this._getVideoProfile()},forcePublish:!0})];case 4:o.sent(),o.label=5;case 5:throw e;case 6:return[3,8];case 7:return i=o.sent(),this._callFunctionErrorManage(i,"startPublishVideoTrack"),[3,8];case 8:return[2]}}))}))},s.prototype._stopPublishVideoTrack=function(){return p(this,void 0,void 0,(function(){return T(this,(function(e){switch(e.label){case 0:return this._cameraVideoTrack=null,[4,this._trtc.stopLocalVideo()];case 1:return e.sent(),[2]}}))}))},s.prototype.startScreenCapture=function(){this._emitError(Ln)},s.prototype.pauseScreenCapture=function(){this._emitError(Ln)},s.prototype.resumeScreenCapture=function(){this._emitError(Ln)},s.prototype.getScreenCaptureSources=function(){this._emitError(Ln)},s.prototype.selectScreenCaptureTarget=function(){this._emitError(Ln)},s.prototype.getCameraDevicesList=function(){return p(this,void 0,Promise,(function(){var e,t,i;return T(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(as,".getCameraDevicesList")),o.label=1;case 1:return o.trys.push([1,5,,6]),[4,c.default.getCameraList()];case 2:return e=o.sent(),t=e.map((function(e){return d(d({},e),{deviceName:e.label})})),this._cameraList=e,"{}"!==JSON.stringify(this._currentCamera)?[3,4]:(this._currentCamera=this.getDefaultDeviceInfo(e),this._currentCameraId=this._currentCamera.deviceId,[4,this.setCurrentCameraDevice(this._currentCameraId)]);case 3:o.sent(),o.label=4;case 4:return[2,Promise.resolve(t)];case 5:return i=o.sent(),this._callFunctionErrorManage(i,"getCameraDevicesList"),[2,Promise.resolve([])];case 6:return[2]}}))}))},s.prototype.setCurrentCameraDevice=function(e){var t;return p(this,void 0,Promise,(function(){var i;return T(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(as,".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]}}))}))},s.prototype.getCurrentCameraDevice=function(){this.logger.info("".concat(as,".getCurrentCameraDevice"));var e=this._currentCamera,t=e.deviceId,i=e.label,o=e.kind,r=e.groupId;return new I(t,i,o,i,r)},s.prototype.isFrontCamera=function(){return this._getIsFrontCamera()},s.prototype.switchCamera=function(e){return p(this,void 0,void 0,(function(){return T(this,(function(t){switch(t.label){case 0:return this.logger.info("".concat(as,".switchCamera with params: "),e),this._setIsFrontCamera(e),[4,this._updateLocalVideo()];case 1:return t.sent(),[4,this._updateLocalTestVideo()];case 2:return t.sent(),[2]}}))}))},s.prototype._onVirtualBackgroundError=function(e){this._emitError({code:-1006,message:e.message?e.message:"virtual background error"})},s.prototype.setVirtualBackground=function(e){return p(this,void 0,void 0,(function(){var t,i,o,r,n;return T(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!==pe?[3,2]:[4,this._trtc.updatePlugin(le,{type:i,blurLevel:o})]:[3,5]:[3,8];case 1:s.sent(),s.label=2;case 2:return i!==Te?[3,4]:[4,this._trtc.updatePlugin(le,{type:i,src:r})];case 3:s.sent(),s.label=4;case 4:return[3,7];case 5:return[4,this._trtc.startPlugin(le,d(d({},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(le),this._isVirtualBackground=!1,s.label=9;case 9:return[3,11];case 10:throw n=s.sent(),this.logger.error("".concat(as,".setVirtualBackground fail: "),n),n;case 11:return[2]}}))}))},s.prototype.setTestVirtualBackground=function(e){return p(this,void 0,void 0,(function(){var t,i,o,r,n;return T(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!==pe?[3,2]:[4,this._testTrtc.updatePlugin(le,{type:i,blurLevel:o})]:[3,5]:[3,8];case 1:s.sent(),s.label=2;case 2:return i!==Te?[3,4]:[4,this._testTrtc.updatePlugin(le,{type:i,src:r})];case 3:s.sent(),s.label=4;case 4:return[3,7];case 5:return[4,this._testTrtc.startPlugin(le,d(d({},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(le),this._isTestVirtualBackground=!1,s.label=9;case 9:return[3,11];case 10:throw n=s.sent(),this.logger.error("".concat(as,".setTestVirtualBackground fail: "),n),n;case 11:return[2]}}))}))},s.prototype.useVirtualBackground=function(e){return p(this,void 0,void 0,(function(){return T(this,(function(t){switch(t.label){case 0:return this._trtc?[4,this._trtc.use({plugin:o.VirtualBackground,assetsPath:e})]:[3,2];case 1:t.sent(),t.label=2;case 2:return this._testTrtc?[4,this._testTrtc.use({plugin:o.VirtualBackground,assetsPath:e})]:[3,4];case 3:t.sent(),t.label=4;case 4:return[2]}}))}))},s.prototype.setBeautyStyle=function(e,t,i,o){return p(this,void 0,void 0,(function(){return T(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]}}))}))},s.prototype.setTestBeautyStyle=function(e,t,i,o){return p(this,void 0,void 0,(function(){return T(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]}}))}))},s.prototype.useBeautyStyle=function(e){return p(this,void 0,void 0,(function(){return T(this,(function(t){switch(t.label){case 0:return this._trtc?[4,this._trtc.use({plugin:r.BasicBeauty,assetsPath:e})]:[3,2];case 1:t.sent(),t.label=2;case 2:return this._testTrtc?[4,this._testTrtc.use({plugin:r.BasicBeauty,assetsPath:e})]:[3,4];case 3:t.sent(),t.label=4;case 4:return[2]}}))}))},s.prototype._setAudioQualityEx=function(e){return p(this,void 0,void 0,(function(){var t;return T(this,(function(i){switch(i.label){case 0:return t=(e||{}).audioScene,ye(t)?(this.logger.info("".concat(as,"._setAudioQualityEx audioScene=").concat(t)),this._lastAudioScene=t,[4,this._applyAIDenoiserDecision()]):(this.logger.warn("".concat(as,"._setAudioQualityEx invalid audioScene: "),t),[2]);case 1:return i.sent(),[2]}}))}))},s.prototype._applyAIDenoiserDecision=function(){return p(this,void 0,void 0,(function(){var e,t,i,o,r;return T(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(as,".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},s.assetsPath&&(o.assetsPath=s.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(as,".applyAIDenoiserDecision fail: "),r),[3,10];case 10:return[2]}}))}))},s.prototype._resolveAIDenoiserMode=function(t,i){if(i!==e.TRTCAudioSceneEx.default&&t!==e.TRTCAudioQuality.TRTCAudioQualityMusic)return t===e.TRTCAudioQuality.TRTCAudioQualitySpeech?1:0},s.prototype._handleBeautyStyleParam=function(e,t,i,o,r,n,s){return p(this,void 0,void 0,(function(){var i,a,c,u,l;return T(this,(function(d){switch(d.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");d.label=1;case 1:return d.trys.push([1,8,,9]),a=r/9,c=n/9,0===(i=o/9)&&0===a&&0===c?[4,e.stopPlugin(de)]:[3,3];case 2:return d.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(de,u)];case 4:return d.sent(),s?this._isTestBeautyEnabled=!0:this._isBeautyEnabled=!0,[3,7];case 5:return[4,e.updatePlugin(de,u)];case 6:d.sent(),d.label=7;case 7:return[3,9];case 8:throw l=d.sent(),s?this.logger.error("".concat(as,".").concat("setTestBeautyStyle"," fail: "),l):this.logger.error("".concat(as,".").concat("setBeautyStyle"," fail: "),l),l;case 9:return[2]}}))}))},s.prototype._resetBeautyStyle=function(){return p(this,void 0,void 0,(function(){return T(this,(function(e){switch(e.label){case 0:return this._isBeautyEnabled?[4,this._trtc.stopPlugin(de)]:[3,2];case 1:e.sent(),this._isBeautyEnabled=!1,e.label=2;case 2:return this._isTestBeautyEnabled?[4,this._testTrtc.stopPlugin(de)]:[3,4];case 3:e.sent(),this._isTestBeautyEnabled=!1,e.label=4;case 4:return[2]}}))}))},s.prototype.getMicDevicesList=function(){return p(this,void 0,Promise,(function(){var e,t,i;return T(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(as,".getMicDevicesList")),o.label=1;case 1:return o.trys.push([1,5,,6]),[4,c.default.getMicrophoneList()];case 2:return e=o.sent(),t=e.map((function(e){return d(d({},e),{deviceName:e.label})})),this._microphoneList=e,"{}"!==JSON.stringify(this._currentMicrophone)?[3,4]:(this._currentMicrophone=this.getDefaultDeviceInfo(e),this._currentMicrophoneId=this._currentMicrophone.deviceId,[4,this.setCurrentMicDevice(this._currentMicrophoneId)]);case 3:o.sent(),o.label=4;case 4:return[2,Promise.resolve(t)];case 5:return i=o.sent(),this._callFunctionErrorManage(i,"getMicDevicesList"),[2,Promise.resolve([])];case 6:return[2]}}))}))},s.prototype.setCurrentMicDevice=function(e){var t;return p(this,void 0,Promise,(function(){var i;return T(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(as,".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]}}))}))},s.prototype.getCurrentMicDevice=function(){this.logger.info("".concat(as,".getCurrentMicDevice"));var e=this._currentMicrophone,t=e.deviceId,i=e.label,o=e.kind,r=e.groupId;return new I(t,i,o,i,r)},s.prototype.getSpeakerDevicesList=function(){return p(this,void 0,Promise,(function(){var e,t,i;return T(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(as,".getSpeakerDevicesList")),o.label=1;case 1:return o.trys.push([1,5,,6]),[4,c.default.getSpeakerList()];case 2:return e=o.sent(),t=e.map((function(e){return d(d({},e),{deviceName:e.label})})),this._speakerList=e,"{}"!==JSON.stringify(this._currentSpeaker)?[3,4]:(this._currentSpeaker=this.getDefaultDeviceInfo(e),this._currentSpeakerId=this._currentSpeaker.deviceId,[4,this.setCurrentSpeakerDevice(this._currentSpeakerId)]);case 3:o.sent(),o.label=4;case 4:return[2,Promise.resolve(t)];case 5:return i=o.sent(),this._callFunctionErrorManage(i,"getSpeakerDevicesList"),[2,Promise.resolve([])];case 6:return[2]}}))}))},s.prototype.setCurrentSpeakerDevice=function(e){return p(this,void 0,Promise,(function(){var t;return T(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(as,".setCurrentSpeakerDevice with params: "),{speakerId:e}),i.label=1;case 1:return i.trys.push([1,3,,4]),e?[4,c.default.setCurrentSpeaker(e)]:[2,!1];case 2:return i.sent(),this._setCurrentSpeakerId(e),this._currentSpeaker=this._speakerList.find((function(t){return t.deviceId===e}))||{},[3,4];case 3:throw t=i.sent(),this._callFunctionErrorManage(t,"setCurrentSpeakerDevice"),t;case 4:return[2]}}))}))},s.prototype.getCurrentSpeakerDevice=function(){this.logger.info("".concat(as,".getCurrentSpeakerDevice"));var e=this._currentSpeaker,t=e.deviceId,i=e.label,o=e.kind,r=e.groupId;return new I(t,i,o,i,r)},s.prototype.startCameraDeviceTest=function(e){return p(this,void 0,void 0,(function(){var t;return T(this,(function(i){switch(i.label){case 0:if(this.logger.info("".concat(as,".startCameraDeviceTest with params: "),e),!e)return[2];this._setLocalTestView(e),i.label=1;case 1:return i.trys.push([1,3,,7]),[4,this._testTrtc.startLocalVideo(this._generateLocalTestVideoData())];case 2:return i.sent(),[3,7];case 3:return(t=i.sent()).code!==c.default.ERROR_CODE.OPERATION_ABORT?[3,5]:[4,this._updateLocalTestVideo()];case 4:return i.sent(),[3,6];case 5:throw this._callFunctionErrorManage(t,"startCameraDeviceTest"),t;case 6:return[3,7];case 7:return[2]}}))}))},s.prototype.stopCameraDeviceTest=function(){return p(this,void 0,void 0,(function(){return T(this,(function(e){switch(e.label){case 0:return this.logger.info("".concat(as,".stopCameraDeviceTest")),this._setLocalTestView(null),[4,this._testTrtc.stopLocalVideo()];case 1:return e.sent(),[2]}}))}))},s.prototype.startMicDeviceTest=function(e){return p(this,void 0,void 0,(function(){var t,i=this;return T(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(as,".startMicDeviceTest with params: "),e),o.label=1;case 1:return o.trys.push([1,3,,7]),[4,this._testTrtc.startLocalAudio(this._generateLocalTestAudioData())];case 2:return o.sent(),[3,7];case 3:return(t=o.sent()).code!==c.default.ERROR_CODE.OPERATION_ABORT?[3,5]:[4,this._updateLocalTestAudio()];case 4:return o.sent(),[3,6];case 5:throw this._callFunctionErrorManage(t,"startMicDeviceTest"),t;case 6:return[3,7];case 7:return this._testTrtc.on(c.default.EVENT.AUDIO_VOLUME,(function(e){null==e||e.result.forEach((function(e){var t=e.userId,o=e.volume;""===t&&i.emit("onTestMicVolume",o)}))})),[4,this._testTrtc.enableAudioVolumeEvaluation(e)];case 8:return o.sent(),[2]}}))}))},s.prototype.stopMicDeviceTest=function(){return p(this,void 0,void 0,(function(){return T(this,(function(e){switch(e.label){case 0:return this.logger.info("".concat(as,".stopMicDeviceTest")),[4,this._testTrtc.stopLocalAudio()];case 1:return e.sent(),[2]}}))}))},s.prototype.callExperimentalAPI=function(e){return p(this,void 0,void 0,(function(){var t,i,o;return T(this,(function(r){switch(r.label){case 0:if(this.logger.info("".concat(as,".callExperimentalAPI"),e),(t=_e(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,27,,28]),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]}return[3,25];case 2:return this._handleSetFrameWork(o),[3,26];case 3:return this._echoCancellation=Boolean(o.enable),[3,26];case 4:return this._noiseSuppression=Boolean(o.enable),[3,26];case 5:return this._autoGainControl=Boolean(o.enable),[3,26];case 6:return this._handleKeyMetricsStats(o),[3,26];case 7:return this._networkProxy=o,[3,26];case 8:return[4,this.setVirtualBackground(o)];case 9:return r.sent(),[3,26];case 10:return[4,this.setTestVirtualBackground(o)];case 11:return r.sent(),[3,26];case 12:return[4,this.setTestBeautyStyle(o.style,o.beautyLevel,o.whitenessLevel,o.ruddinessLevel)];case 13:return r.sent(),[3,26];case 14:return this._setVideoEncodeParamEx(o),[3,26];case 15:return this._enableAutoPlayDialog=Boolean(o.enable),[3,26];case 16:return[4,this._setAudioQualityEx(o)];case 17:return r.sent(),[3,26];case 18:return this._latencyLevel=o.latencyLevel,[3,26];case 19:return[4,this._switchPlaybackQuality(o)];case 20:return r.sent(),[3,26];case 21:return[4,this._requestPictureInPicture()];case 22:return r.sent(),[3,26];case 23:return[4,this._exitPictureInPicture()];case 24:return r.sent(),[3,26];case 25:return[3,26];case 26:return[3,28];case 27:throw r.sent();case 28:return[2]}}))}))},s.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)},s.prototype._handleKeyMetricsStats=function(e){var t=e.key,i=e.opt,o=e.value,r=e.version,n=i===ge;c.default._addKVStat({type:i,key:t,value:o,version:r,useUV:n,base:100})},s.prototype._setVideoEncodeParamEx=function(t){return p(this,void 0,void 0,(function(){return T(this,(function(i){switch(i.label){case 0:switch(t.streamType){case e.TRTCVideoStreamType.TRTCVideoStreamTypeBig:return[3,1];case e.TRTCVideoStreamType.TRTCVideoStreamTypeSub:return[3,3]}return[3,5];case 1:return[4,this.setVideoEncoderParam(t)];case 2:case 4:return i.sent(),[3,6];case 3:return[4,this.setSubStreamEncoderParam(t)];case 5:return[3,6];case 6:return[2]}}))}))},s.prototype._switchPlaybackQuality=function(e){return p(this,void 0,void 0,(function(){var t,i,o,r,n,s,a,c;return T(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})]:[2];case 1:return u.sent(),[2]}}))}))},s.prototype._requestPictureInPicture=function(){return p(this,void 0,void 0,(function(){return T(this,(function(e){switch(e.label){case 0:return this.logger.info("".concat(as,"._requestPictureInPicture")),[4,this._trtc.callExperimentalAPI("requestPictureInPicture",{enable:!0})];case 1:return e.sent(),[2]}}))}))},s.prototype._exitPictureInPicture=function(){return p(this,void 0,void 0,(function(){return T(this,(function(e){switch(e.label){case 0:return this.logger.info("".concat(as,"._exitPictureInPicture")),[4,this._trtc.callExperimentalAPI("requestPictureInPicture",{enable:!1})];case 1:return e.sent(),[2]}}))}))},s.prototype._emitError=function(e){e&&this.emit&&this.emit(se,e.code,e.message)},s.prototype._emitWarning=function(e){this.emit&&this.emit(ae,e)},s.prototype._transformTRTCServerError=function(e){return-8===e.extraCode?Vn:0===String(e.extraCode).indexOf("70")?0-e.extraCode:void 0},s.prototype._transformTRTCInvalidOperationError=function(e,t){return"enterRoom"!==t||5104!==e.extraCode&&5998!==e.code?e.code:mn},s.prototype._isCameraError=function(e){return["startLocalPreview","updateLocalView","muteLocalVideo","setVideoEncoderParam","setCurrentCameraDevice","switchCamera","setLocalRenderParams","enableSmallVideoStream","startCameraDeviceTest"].includes(e)},s.prototype._isMicError=function(e){return["startLocalAudio","muteLocalAudio","setAudioCaptureVolume","setCurrentMicDevice","startMicDeviceTest"].includes(e)},s.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 Rn;if(o)return bn;if(r)return En;break;case 5302:if(i)return yn;if(o)return Sn;if(r)return An;break;case 5303:if(i)return _n;if(o)return wn;if(r)return En;break;case 5304:if(i)return Cn;if(o)return Mn;if(r)return En}},s.prototype._transformTRTCUnKnowError=function(e,t){var i=this._isCameraError(t),o=this._isMicError(t);return i?Rn:o?bn:e.code},s.prototype._transformTRTCErrorCode=function(e,t){var i=null==e?void 0:e.code;if(e&&e.code)switch(e.code){case c.default.ERROR_CODE.DEVICE_ERROR:i=this._transformTRTCDeviceError(e,t);break;case c.default.ERROR_CODE.SERVER_ERROR:i=this._transformTRTCServerError(e);break;case c.default.ERROR_CODE.INVALID_OPERATION:case c.default.ERROR_CODE.OPERATION_ABORT:i=this._transformTRTCInvalidOperationError(e,t);break;case c.default.ERROR_CODE.UNKNOWN_ERROR:i=this._transformTRTCUnKnowError(e,t)}return i},s.prototype._callFunctionErrorManage=function(e,t){if(!e||e.code!==c.default.ERROR_CODE.OPERATION_ABORT){this.logger.warn("(".concat(t,") failed - ").concat(e.code," - ").concat(e.message));var i=this._transformTRTCErrorCode(e,t),o=e.message;"startScreenShare"===t&&(o=JSON.stringify({name:e.originError.name,message:o})),this.emit(se,i,o)}},s.prototype._getTRTCResolution=function(t){var i=(e.TRTCVideoResolution[t]||"").split("_");return{width:+(i.length>1&&i[1]),height:+(i.length>2&&i[2])}},s.prototype._getTRTCVideoProfile=function(t,i){void 0===i&&(i={});var o=i.videoWidth,r=i.videoHeight,n=i.videoResolution,s=i.videoFps,a=i.videoBitrate,c=i.resMode,u=i.resolutionMode,l={};switch(t){case e.TRTCVideoStreamType.TRTCVideoStreamTypeSub:l=this._defaultScreenProfile;break;case e.TRTCVideoStreamType.TRTCVideoStreamTypeSmall:l=this._defaultSmallVideoProfile;break;case e.TRTCVideoStreamType.TRTCVideoStreamTypeBig:default:l=this._defaultVideoProfile}if(Re(n))Re(o)||(l.width=o),Re(r)||(l.height=r);else{var d=this._getTRTCResolution(n);l.width=d.width,l.height=d.height}if(!Re(c)&&c===e.TRTCVideoResolutionMode.TRTCVideoResolutionModePortrait||!Re(u)&&u===e.TRTCVideoResolutionMode.TRTCVideoResolutionModePortrait){var h=l.height,p=l.width;l.width=h,l.height=p}return s&&(l.frameRate=s),a&&(l.bitrate=a),l},s.prototype._getTRTCStreamType=function(t){var i;return((i={})[e.TRTCVideoStreamType.TRTCVideoStreamTypeBig]=c.default.TYPE.STREAM_TYPE_MAIN,i[e.TRTCVideoStreamType.TRTCVideoStreamTypeSmall]=c.default.TYPE.STREAM_TYPE_MAIN,i[e.TRTCVideoStreamType.TRTCVideoStreamTypeSub]=c.default.TYPE.STREAM_TYPE_SUB,i)[t]},s.prototype._getTRTCFillMode=function(t){var i;return((i={})[e.TRTCVideoFillMode.TRTCVideoFillMode_Fill]=dn.COVER,i[e.TRTCVideoFillMode.TRTCVideoFillMode_Fit]=dn.CONTAIN,i)[t]},s.prototype._getTRTCCloudVideoFillMode=function(t){var i;return((i={})[dn.COVER]=e.TRTCVideoFillMode.TRTCVideoFillMode_Fill,i[dn.CONTAIN]=e.TRTCVideoFillMode.TRTCVideoFillMode_Fit,i)[t]},s.prototype._getTRTCCloudMirrorType=function(t){return!0===t?e.TRTCVideoMirrorType.TRTCVideoMirrorType_Enable:e.TRTCVideoMirrorType.TRTCVideoMirrorType_Disable},s.prototype._getLocalRenderMirror=function(t){var i;return t===e.TRTCVideoMirrorType.TRTCVideoMirrorType_Auto?!this._getIsMobile()||this._getIsFrontCamera():((i={})[e.TRTCVideoMirrorType.TRTCVideoMirrorType_Enable]=!0,i[e.TRTCVideoMirrorType.TRTCVideoMirrorType_Disable]=!1,i)[t]},s.prototype._getTRTCLocalMirror=function(e,t){var i=this._getLocalRenderMirror(e);return Re(t)?!!i&&"both":i&&t?"both":i&&!t?"view":!i&&t?"publish":!(!i&&!t)&&"view"},s.prototype._getTRTCRemoteMirror=function(t){var i;return((i={})[e.TRTCVideoMirrorType.TRTCVideoMirrorType_Auto]=!1,i[e.TRTCVideoMirrorType.TRTCVideoMirrorType_Enable]=!0,i[e.TRTCVideoMirrorType.TRTCVideoMirrorType_Disable]=!1,i)[t]},s.prototype._getTRTCQosPreference=function(t){var i;return((i={})[e.TRTCVideoQosPreference.TRTCVideoQosPreferenceSmooth]=c.default.TYPE.QOS_PREFERENCE_SMOOTH,i[e.TRTCVideoQosPreference.TRTCVideoQosPreferenceClear]=c.default.TYPE.QOS_PREFERENCE_CLEAR,i)[t]},s.prototype._getTRTCAudioQuality=function(t){var i;return((i={})[e.TRTCAudioQuality.TRTCAudioQualitySpeech]=c.default.TYPE.AUDIO_PROFILE_STANDARD,i[e.TRTCAudioQuality.TRTCAudioQualityDefault]=c.default.TYPE.AUDIO_PROFILE_STANDARD,i[e.TRTCAudioQuality.TRTCAudioQualityMusic]=c.default.TYPE.AUDIO_PROFILE_HIGH_STEREO,i)[t]},s.prototype._getTRTCCloudDeviceType=function(t){return{camera:e.TRTCDeviceType.TRTCDeviceTypeCamera,microphone:e.TRTCDeviceType.TRTCDeviceTypeMic,speaker:e.TRTCDeviceType.TRTCDeviceTypeSpeaker}[t]},s.prototype._getTRTCCloudDeviceState=function(t){return{add:e.TRTCDeviceState.TRTCDeviceStateAdd,remove:e.TRTCDeviceState.TRTCDeviceStateRemove,active:e.TRTCDeviceState.TRTCDeviceStateActive}[t]},s.prototype._getTRTCCloudQuality=function(t){return[e.TRTCQuality.TRTCQuality_Unknown,e.TRTCQuality.TRTCQuality_Excellent,e.TRTCQuality.TRTCQuality_Good,e.TRTCQuality.TRTCQuality_Poor,e.TRTCQuality.TRTCQuality_Bad,e.TRTCQuality.TRTCQuality_Vbad,e.TRTCQuality.TRTCQuality_Down][t]},s.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},s.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},s.prototype._generateLocalAudioData=function(){var e={publish:this._getIsAudioPublish(),mute:this._getAudioMuteType(),muteKeepVolumeDetection:!0,option:{microphoneId:this._getCurrentMicrophoneId(),profile:this._getAudioProfile(),captureVolume:this._getCaptureVolume()}};return Ce(this._echoCancellation)&&(e.option.echoCancellation=this._echoCancellation),Ce(this._autoGainControl)&&(e.option.autoGainControl=this._autoGainControl),Ce(this._noiseSuppression)&&(e.option.noiseSuppression=this._noiseSuppression),e},s.prototype._generateLocalTestAudioData=function(){return{publish:!1,option:{microphoneId:this._getCurrentMicrophoneId(),profile:this._getAudioProfile()}}},s.prototype._generateRemoteVideoData=function(e,t){return Me(this._remoteStreamConfig.get("".concat(e,"_").concat(this._getTRTCStreamType(t))))},s.prototype._addTRTCEvents=function(){var t=this;this._trtc.on(c.default.EVENT.ERROR,(function(e){e&&t.emit("onError",e.code,e.message)})),this._trtc.on(c.default.EVENT.REMOTE_USER_ENTER,(function(e){(null==e?void 0:e.userId)&&t.emit("onRemoteUserEnterRoom",e.userId)})),this._trtc.on(c.default.EVENT.REMOTE_USER_EXIT,(function(e){(null==e?void 0:e.userId)&&t.emit("onRemoteUserLeaveRoom",e.userId)})),this._trtc.on(c.default.EVENT.REMOTE_AUDIO_AVAILABLE,(function(e){(null==e?void 0:e.userId)&&t.emit("onUserAudioAvailable",e.userId,!0)})),this._trtc.on(c.default.EVENT.REMOTE_AUDIO_UNAVAILABLE,(function(e){(null==e?void 0:e.userId)&&t.emit("onUserAudioAvailable",e.userId,!1)})),this._trtc.on(c.default.EVENT.REMOTE_VIDEO_AVAILABLE,(function(e){t._emitVideoAvailable(e,!0)})),this._trtc.on(c.default.EVENT.REMOTE_VIDEO_UNAVAILABLE,(function(e){t._emitVideoAvailable(e,!1)})),this._trtc.on(c.default.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(c.default.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(c.default.EVENT.NETWORK_QUALITY,(function(e){var i=e.uplinkNetworkQuality,o=e.downlinkNetworkQuality,r=new Q("",t._getTRTCCloudQuality(i)),n=[];t._remoteStatisticsUserIdList.length>0&&(n=t._remoteStatisticsUserIdList.map((function(e){return new Q(e,t._getTRTCCloudQuality(o))}))),t.emit("onNetworkQuality",r,n)})),this._trtc.on(c.default.EVENT.AUTOPLAY_FAILED,(function(e){t.emit("onAutoPlayFailed",e)})),this._trtc.on(c.default.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(c.default.EVENT.STATISTICS,(function(i){var o,r=i.rtt,n=i.upLoss,s=i.downLoss,a=i.bytesSent,c=i.bytesReceived,u=i.localStatistics,l=i.remoteStatistics;t._remoteStatisticsUserIdList=l.map((function(e){return e.userId}));var d={big:e.TRTCVideoStreamType.TRTCVideoStreamTypeBig,small:e.TRTCVideoStreamType.TRTCVideoStreamTypeSmall,sub:e.TRTCVideoStreamType.TRTCVideoStreamTypeSub},h=(null===(o=u.video)||void 0===o?void 0:o.length)>0?u.video.map((function(e){var t=new j;return t.width=e.width,t.height=e.height,t.frameRate=e.frameRate,t.videoBitrate=e.bitrate,t.audioBitrate=u.audio.bitrate||0,t.streamType=d[e.videoType],t})):[];if(0===h.length&&u.audio.bitrate>0){var p=new j;p.audioBitrate=u.audio.bitrate||0,h.push(p)}var T=[];l.forEach((function(e){var t=[],i=e.userId,o=e.audio.bitrate;if(e.video&&e.video.forEach((function(e){var r=new U;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=d[e.videoType],t.push(r)})),0===t.length){var r=new U;r.userId=i,r.audioBitrate=o||0,t.push(r)}T.push.apply(T,t)}));var f=new q;f.upLoss=n,f.downLoss=s,f.rtt=r,f.sentBytes=a,f.receivedBytes=c,f.localStatisticsArray=h,f.localStatisticsArraySize=h.length,f.remoteStatisticsArray=T,f.remoteStatisticsArraySize=T.length,t.emit("onStatistics",f)})),this._trtc.on(c.default.EVENT.SCREEN_SHARE_STOPPED,(function(){t.emit("onScreenCaptureStopped",0),t._clearScreenShareParams(),t._isSharingScreen=!1})),this._trtc.on(c.default.EVENT.PUBLISH_STATE_CHANGED,(function(i){var o=i.mediaType;"started"===i.state&&("audio"===o?t.emit("onSendFirstLocalAudioFrame"):"video"===o?t.emit("onSendFirstLocalVideoFrame",e.TRTCVideoStreamType.TRTCVideoStreamTypeBig):"screen"===o&&t.emit("onSendFirstLocalVideoFrame",e.TRTCVideoStreamType.TRTCVideoStreamTypeSub))})),this._trtc.on(c.default.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(c.default.EVENT.AUDIO_PLAY_STATE_CHANGED,(function(e){var i=e.userId;"PLAYING"===e.state&&t.emit("onFirstAudioFrame",i)})),this._trtc.on(c.default.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(c.default.EVENT.CUSTOM_MESSAGE,(function(e){e&&t.emit("onRecvCustomCmdMsg",e.userId,e.cmdId,e.seq,null==e?void 0:e.data)})),this._trtc.on(c.default.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(c.default.EVENT.PICTURE_IN_PICTURE_STATE_CHANGED,(function(e){t.emit("onPictureInPictureStateChanged",e)}))},s.prototype._removeTRTCEvents=function(){this._trtc.off("*")},s.prototype._emitVideoAvailable=function(e,t){var i=e.userId,o=e.streamType;t?this._remoteStreamMap.set("".concat(i,"_").concat(o),!0):this._remoteStreamMap.delete("".concat(i,"_").concat(o)),o===c.default.TYPE.STREAM_TYPE_SUB?i&&this.emit("onUserSubStreamAvailable",i,t):i&&this.emit("onUserVideoAvailable",i,t)},s.prototype._setLocalView=function(e){this._localView=e},s.prototype._getLocalView=function(){return this._localView},s.prototype._setIsMobile=function(e){this._isMobile=e},s.prototype._getIsMobile=function(){return this._isMobile},s.prototype._setIsFrontCamera=function(e){this._isFrontCamera=e},s.prototype._getIsFrontCamera=function(){return this._isFrontCamera},s.prototype._getSmallStreamVideoProfile=function(){return this._smallStreamVideoProfile},s.prototype._setSmallStreamVideoProfile=function(e){this._smallStreamVideoProfile=e},s.prototype._setIsVideoPublish=function(e){this._isVideoPublish=e},s.prototype._getIsVideoPublish=function(){return this._isVideoPublish},s.prototype._setVideoProfile=function(e){this._videoProfile=e},s.prototype._getVideoProfile=function(){return this._videoProfile},s.prototype._setQosPreference=function(e){this._qosPreference=e},s.prototype._getQosPreference=function(){return this._qosPreference},s.prototype._setLocalTestView=function(e){this._localTestView=e},s.prototype._getLocalTestView=function(){return this._localTestView},s.prototype._setScreenShareParams=function(e){var t=e.view,i=e.systemAudio,o=e.fillMode,r=e.profile,n=e.videoTrack,s=e.qosPreference;Re(t)||(this._screenShareParams.view=t),Re(i)||(this._screenShareParams.option.systemAudio=i),Re(o)||(this._screenShareParams.option.fillMode=o),Re(r)||(this._screenShareParams.option.profile=r),Re(n)||(this._screenShareParams.option.videoTrack=n),Re(s)||(this._screenShareParams.option.qosPreference=s),Re(e.streamType)||(this._screenShareParams.streamType=this._getTRTCStreamType(e.streamType))},s.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},s.prototype._getScreenShareParams=function(){return this._screenShareParams},s.prototype._setIsAudioPublish=function(e){this._isAudioPublish=e},s.prototype._getIsAudioPublish=function(){return this._isAudioPublish},s.prototype._setAudioMuteType=function(e){this._audioMuteType=e},s.prototype._getAudioMuteType=function(){return this._audioMuteType},s.prototype._setAudioProfile=function(e){this._audioProfile=e},s.prototype._getAudioProfile=function(){return this._audioProfile},s.prototype._getCaptureVolume=function(){return this._captureVolume},s.prototype._setCaptureVolume=function(e){this._captureVolume=e},s.prototype._setCurrentCameraId=function(e){this._currentCameraId=e},s.prototype._getCurrentCameraId=function(){return this._currentCameraId},s.prototype._setCurrentMicrophoneId=function(e){this._currentMicrophoneId=e},s.prototype._getCurrentMicrophoneId=function(){return this._currentMicrophoneId},s.prototype._setCurrentSpeakerId=function(e){this._currentSpeakerId=e},s.prototype._getCurrentSpeakerId=function(){return this._currentSpeakerId},s.prototype._setRemoteStreamConfig=function(t,i,o){var r=this._remoteStreamConfig.get("".concat(t,"_").concat(this._getTRTCStreamType(i)));r||(r={userId:t,streamType:this._getTRTCStreamType(i),option:{mirror:this._getTRTCRemoteMirror(e.TRTCVideoMirrorType.TRTCVideoMirrorType_Disable),fillMode:this._getTRTCFillMode(e.TRTCVideoFillMode.TRTCVideoFillMode_Fit)}});var n=o.view,s=o.mirrorType,a=o.fillMode,c=o.small;Re(n)||(r.view=n),Re(s)||(r.option.mirror=this._getTRTCRemoteMirror(s)),Re(a)||(r.option.fillMode=this._getTRTCFillMode(a)),Re(c)||(r.option.small=c),this._remoteStreamConfig.set("".concat(t,"_").concat(this._getTRTCStreamType(i)),r)},s.prototype._inheritPropertiesToSubCloud=function(e){e._frameWorkType=this._frameWorkType,e._component=this._component,e._language=this._language,e._networkProxy=d({},this._networkProxy),e._latencyLevel=this._latencyLevel,e._enableAutoPlayDialog=this._enableAutoPlayDialog},s.prototype._inheritEventsToSubCloud=function(e){var t=this;e._trtc.on(c.default.EVENT.AUTOPLAY_FAILED,(function(e){t.emit("onAutoPlayFailed",e)})),e._trtc.on(c.default.EVENT.PICTURE_IN_PICTURE_STATE_CHANGED,(function(e){t.emit("onPictureInPictureStateChanged",e)}))},s.prototype.handleDeviceChange=function(){return p(this,void 0,void 0,(function(){var t=this;return T(this,(function(i){return c.default.getCameraList().then((function(i){return p(t,void 0,void 0,(function(){return T(this,(function(t){switch(t.label){case 0:return this._cameraList.length===i.length?[2]:[4,this.deviceChangeManage(this._cameraList,i,e.TRTCDeviceType.TRTCDeviceTypeCamera)];case 1:return t.sent(),this._cameraList=i,[2]}}))}))})),c.default.getMicrophoneList().then((function(i){return p(t,void 0,void 0,(function(){return T(this,(function(t){switch(t.label){case 0:return[4,this.deviceChangeManage(this._microphoneList,i,e.TRTCDeviceType.TRTCDeviceTypeMic)];case 1:return t.sent(),this._microphoneList=i,[2]}}))}))})),c.default.getSpeakerList().then((function(i){return p(t,void 0,void 0,(function(){return T(this,(function(t){switch(t.label){case 0:return[4,this.deviceChangeManage(this._speakerList,i,e.TRTCDeviceType.TRTCDeviceTypeSpeaker)];case 1:return t.sent(),this._speakerList=i,[2]}}))}))})),[2]}))}))},s.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)},s.prototype.deviceChangeManage=function(t,i,o){return p(this,void 0,void 0,(function(){var r,n,s,a,c;return T(this,(function(u){switch(u.label){case 0:return r=void 0,t.length!==i.length&&(n=(i||[]).map((function(e){return e.deviceId})),s=new I,t.length>i.length?(s=t.filter((function(e){return!n.includes(e.deviceId)}))[0]||{},r=e.TRTCDeviceState.TRTCDeviceStateRemove):(n=(t||[]).map((function(e){return e.deviceId})),s=i.filter((function(e){return!n.includes(e.deviceId)}))[0]||{},r=e.TRTCDeviceState.TRTCDeviceStateAdd),a=s.deviceId,this.emitOnDeviceChange(a,o,r)),c=this.getDefaultDeviceInfo(i),o!==e.TRTCDeviceType.TRTCDeviceTypeCamera||r!==e.TRTCDeviceState.TRTCDeviceStateRemove?[3,3]:this.isSameDevice(this._currentCamera,c)?[2]:c.deviceId?[4,this.autoChangeDevice(o,c)]:[3,2];case 1:u.sent(),u.label=2;case 2:u.label=3;case 3:return o!==e.TRTCDeviceType.TRTCDeviceTypeMic?[3,6]:this.isSameDevice(this._currentMicrophone,c)?[2]:c.deviceId?[4,this.autoChangeDevice(o,c)]:[3,5];case 4:u.sent(),u.label=5;case 5:u.label=6;case 6:return o!==e.TRTCDeviceType.TRTCDeviceTypeSpeaker?[3,9]:this.isSameDevice(this._currentSpeaker,c)?[2]:c.deviceId?[4,this.autoChangeDevice(o,c)]:[3,8];case 7:u.sent(),u.label=8;case 8:u.label=9;case 9:return[2]}}))}))},s.prototype.getDefaultDeviceInfo=function(e){var t=new I;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]},s.prototype.autoChangeDevice=function(t,i){return p(this,void 0,void 0,(function(){var o,r,n;return T(this,(function(s){switch(s.label){case 0:return o=i.deviceId,t!==e.TRTCDeviceType.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,c.default.ERROR_CODE.OPERATION_ABORT,[3,5];case 5:this._currentCameraId=o,this._currentCamera=i,this.emitOnDeviceChange(o,t,e.TRTCDeviceState.TRTCDeviceStateActive),s.label=6;case 6:return t!==e.TRTCDeviceType.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,c.default.ERROR_CODE.OPERATION_ABORT,[3,11];case 11:this._currentMicrophoneId=o,this._currentMicrophone=i,this.emitOnDeviceChange(o,t,e.TRTCDeviceState.TRTCDeviceStateActive),s.label=12;case 12:return t!==e.TRTCDeviceType.TRTCDeviceTypeSpeaker?[3,14]:[4,c.default.setCurrentSpeaker(o)];case 13:s.sent(),this._currentSpeakerId=o,this._currentSpeaker=i,this.emitOnDeviceChange(o,t,e.TRTCDeviceState.TRTCDeviceStateActive),s.label=14;case 14:return[2]}}))}))},s.prototype.emitOnDeviceChange=function(e,t,i){this.emit("onDeviceChange",e,t,i)},s.prototype.getMediaMixingManager=function(){return new Jn({logger:this.logger,trtc:this._trtc,trtcCloud:this})},s.prototype.getAITranscriberManager=function(){return new is({logger:this.logger,trtc:this._trtc})},s.shareInstance=null,s.subCloudMap=new Map,s.enableSEI=!1,s.assetsPath="",h([(a="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 c=[];return null===(t=null===(e=$n.get(this))||void 0===e?void 0:e.queue)||void 0===t||t.forEach((function(e){return c.push(e)})),null===(i=Zn.get(this))||void 0===i||i.forEach((function(e){return null==e?void 0:e.queue.forEach((function(e){return c.push(e)}))})),null===(r=es.get(this))||void 0===r||r.forEach((function(e){return null==e?void 0:e.queue.forEach((function(e){return c.push(e)}))})),c.forEach((function(e){e.reject(new Error("aborted ".concat(a)))})),$n.delete(this),Zn.delete(this),es.delete(this),o.apply(this,n)},i})],s.prototype,"exitRoom",null),h([ts((function(e){return e}))],s.prototype,"muteRemoteAudio",null),h([ts((function(e){return e}))],s.prototype,"muteRemoteVideoStream",null),h([ts((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})],s.prototype,"_switchPlaybackQuality",null),s}(V);e.AITranscriberListener=undefined,e.AudioMuteType=undefined,e.IAITranscriberManager=undefined,e.ITRTCMediaMixingEvent=undefined,e.ITRTCMediaMixingManager=undefined,e.InteractionOption=undefined,e.Rect=Z,e.TRTCCameraCaptureParams=undefined,e.TRTCDeviceInfo=I,e.TRTCImageBuffer=J,e.TRTCLocalStatistics=j,e.TRTCMediaMixingEncParam=undefined,e.TRTCMediaSource=undefined,e.TRTCMixUser=oe,e.TRTCNetworkQosParam=K,e.TRTCParams=D,e.TRTCPublishCDNParam=W,e.TRTCQualityInfo=Q,e.TRTCRemoteStatistics=U,e.TRTCRenderParams=B,e.TRTCScreenCaptureProperty=ne,e.TRTCScreenCaptureSourceInfo=$,e.TRTCStatistics=q,e.TRTCTranscodingConfig=ee,e.TRTCVideoEncParam=O,e.TRTCVolumeInfo=H,e.TranscriberMessage=undefined,e.TranscriberParams=undefined,e.default=ls,Object.defineProperty(e,"__esModule",{value:!0})}));
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("trtc-sdk-v5"),require("trtc-sdk-v5/plugins/lebplayer"),require("trtc-sdk-v5/plugins/video-effect/virtual-background"),require("trtc-sdk-v5/plugins/video-effect/basic-beauty"),require("trtc-sdk-v5/plugins/realtime-transcriber"),require("trtc-sdk-v5/plugins/video-effect/video-mixer"),require("trtc-sdk-v5/plugins/whiteboard")):"function"==typeof define&&define.amd?define(["exports","trtc-sdk-v5","trtc-sdk-v5/plugins/lebplayer","trtc-sdk-v5/plugins/video-effect/virtual-background","trtc-sdk-v5/plugins/video-effect/basic-beauty","trtc-sdk-v5/plugins/realtime-transcriber","trtc-sdk-v5/plugins/video-effect/video-mixer","trtc-sdk-v5/plugins/whiteboard"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).TRTCCloud={},e.TRTC,e.LEBPlayer,e.VirtualBackground,e.BasicBeauty,e.realtimeTranscriber,e.VideoMixer,e.Whiteboard)}(this,(function(e,t,i,o,r,n,s,a){function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=c(t),l=c(s),d=c(a),h=function(e,t){return h=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])},h(e,t)};var p=function(){return p=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},p.apply(this,arguments)};function T(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 f(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 v(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 g(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 m(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 R(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,i=e[Symbol.asyncIterator];return i?i.call(e):(e=g(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 y="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function C(e,t){return e(t={exports:{}},t.exports),t.exports}var _,b,S,M,w,E,A,V,P,L=C((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],d=arguments.length;if(l.fn){switch(l.once&&this.removeListener(e,l.fn,void 0,!0),d){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(d-1);u<d;u++)c[u-1]=arguments[u];l.fn.apply(l.context,c)}else{var h,p=l.length;for(u=0;u<p;u++)switch(l[u].once&&this.removeListener(e,l[u].fn,void 0,!0),d){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(h=1,c=new Array(d-1);h<d;h++)c[h-1]=arguments[h];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}));e.TRTCVideoResolution=void 0,(_=e.TRTCVideoResolution||(e.TRTCVideoResolution={}))[_.TRTCVideoResolution_120_120=1]="TRTCVideoResolution_120_120",_[_.TRTCVideoResolution_160_160=3]="TRTCVideoResolution_160_160",_[_.TRTCVideoResolution_270_270=5]="TRTCVideoResolution_270_270",_[_.TRTCVideoResolution_480_480=7]="TRTCVideoResolution_480_480",_[_.TRTCVideoResolution_160_120=50]="TRTCVideoResolution_160_120",_[_.TRTCVideoResolution_240_180=52]="TRTCVideoResolution_240_180",_[_.TRTCVideoResolution_280_210=54]="TRTCVideoResolution_280_210",_[_.TRTCVideoResolution_320_240=56]="TRTCVideoResolution_320_240",_[_.TRTCVideoResolution_400_300=58]="TRTCVideoResolution_400_300",_[_.TRTCVideoResolution_480_360=60]="TRTCVideoResolution_480_360",_[_.TRTCVideoResolution_640_480=62]="TRTCVideoResolution_640_480",_[_.TRTCVideoResolution_960_720=64]="TRTCVideoResolution_960_720",_[_.TRTCVideoResolution_160_90=100]="TRTCVideoResolution_160_90",_[_.TRTCVideoResolution_256_144=102]="TRTCVideoResolution_256_144",_[_.TRTCVideoResolution_320_180=104]="TRTCVideoResolution_320_180",_[_.TRTCVideoResolution_480_270=106]="TRTCVideoResolution_480_270",_[_.TRTCVideoResolution_640_360=108]="TRTCVideoResolution_640_360",_[_.TRTCVideoResolution_960_540=110]="TRTCVideoResolution_960_540",_[_.TRTCVideoResolution_1280_720=112]="TRTCVideoResolution_1280_720",_[_.TRTCVideoResolution_1920_1080=114]="TRTCVideoResolution_1920_1080",e.TRTCVideoStreamType=void 0,(b=e.TRTCVideoStreamType||(e.TRTCVideoStreamType={}))[b.TRTCVideoStreamTypeBig=0]="TRTCVideoStreamTypeBig",b[b.TRTCVideoStreamTypeSmall=1]="TRTCVideoStreamTypeSmall",b[b.TRTCVideoStreamTypeSub=2]="TRTCVideoStreamTypeSub",e.TRTCVideoFillMode=void 0,(S=e.TRTCVideoFillMode||(e.TRTCVideoFillMode={}))[S.TRTCVideoFillMode_Fill=0]="TRTCVideoFillMode_Fill",S[S.TRTCVideoFillMode_Fit=1]="TRTCVideoFillMode_Fit",e.TRTCVideoMirrorType=void 0,(M=e.TRTCVideoMirrorType||(e.TRTCVideoMirrorType={}))[M.TRTCVideoMirrorType_Auto=0]="TRTCVideoMirrorType_Auto",M[M.TRTCVideoMirrorType_Enable=1]="TRTCVideoMirrorType_Enable",M[M.TRTCVideoMirrorType_Disable=2]="TRTCVideoMirrorType_Disable",e.TRTCBeautyStyle=void 0,(w=e.TRTCBeautyStyle||(e.TRTCBeautyStyle={}))[w.TRTCBeautyStyleSmooth=0]="TRTCBeautyStyleSmooth",w[w.TRTCBeautyStyleNature=1]="TRTCBeautyStyleNature",e.TRTCAppScene=void 0,(E=e.TRTCAppScene||(e.TRTCAppScene={}))[E.TRTCAppSceneVideoCall=0]="TRTCAppSceneVideoCall",E[E.TRTCAppSceneLIVE=1]="TRTCAppSceneLIVE",E[E.TRTCAppSceneAudioCall=2]="TRTCAppSceneAudioCall",E[E.TRTCAppSceneVoiceChatRoom=3]="TRTCAppSceneVoiceChatRoom",e.TRTCRoleType=void 0,(A=e.TRTCRoleType||(e.TRTCRoleType={}))[A.TRTCRoleAnchor=20]="TRTCRoleAnchor",A[A.TRTCRoleAudience=21]="TRTCRoleAudience",e.TRTCAudioQuality=void 0,(V=e.TRTCAudioQuality||(e.TRTCAudioQuality={}))[V.TRTCAudioQualitySpeech=1]="TRTCAudioQualitySpeech",V[V.TRTCAudioQualityDefault=2]="TRTCAudioQualityDefault",V[V.TRTCAudioQualityMusic=3]="TRTCAudioQualityMusic",e.TRTCAudioSceneEx=void 0,(P=e.TRTCAudioSceneEx||(e.TRTCAudioSceneEx={}))[P.default=0]="default",P[P.silent=8]="silent",P[P.hifi2=18]="hifi2";var I,x,O=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};e.TRTCDeviceState=void 0,(I=e.TRTCDeviceState||(e.TRTCDeviceState={}))[I.TRTCDeviceStateAdd=0]="TRTCDeviceStateAdd",I[I.TRTCDeviceStateRemove=1]="TRTCDeviceStateRemove",I[I.TRTCDeviceStateActive=2]="TRTCDeviceStateActive",e.TRTCDeviceType=void 0,(x=e.TRTCDeviceType||(e.TRTCDeviceType={}))[x.TRTCDeviceTypeUnknow=-1]="TRTCDeviceTypeUnknow",x[x.TRTCDeviceTypeMic=0]="TRTCDeviceTypeMic",x[x.TRTCDeviceTypeSpeaker=1]="TRTCDeviceTypeSpeaker",x[x.TRTCDeviceTypeCamera=2]="TRTCDeviceTypeCamera";var D,k=function(t,i,o,r,n,s,a,c,u,l,d){void 0===t&&(t=0),void 0===i&&(i=""),void 0===o&&(o=""),void 0===r&&(r=0),void 0===n&&(n=""),void 0===s&&(s=e.TRTCRoleType.TRTCRoleAnchor),void 0===a&&(a=null),void 0===u&&(u=null),void 0===l&&(l=null),void 0===d&&(d=30),this.sdkAppId=t,this.userId=i,this.userSig=o,this.roomId=r,this.strRoomId=n,this.role=s,this.privateMapKey=a,this.streamId=u,this.userDefineRecordId=l,this.frameWorkType=d},B=function(t,i,o,r){void 0===t&&(t=e.TRTCVideoResolution.TRTCVideoResolution_640_360),void 0===i&&(i=e.TRTCVideoResolutionMode.TRTCVideoResolutionModeLandscape),void 0===o&&(o=15),void 0===r&&(r=550),this.videoResolution=t,this.resMode=i,this.videoFps=o,this.videoBitrate=r};e.TRTCVideoRotation=void 0,(D=e.TRTCVideoRotation||(e.TRTCVideoRotation={}))[D.TRTCVideoRotation0=0]="TRTCVideoRotation0",D[D.TRTCVideoRotation90=1]="TRTCVideoRotation90",D[D.TRTCVideoRotation180=2]="TRTCVideoRotation180",D[D.TRTCVideoRotation270=3]="TRTCVideoRotation270";var z,F=function(t,i,o){void 0===t&&(t=e.TRTCVideoRotation.TRTCVideoRotation0),void 0===i&&(i=e.TRTCVideoFillMode.TRTCVideoFillMode_Fit),void 0===o&&(o=e.TRTCVideoMirrorType.TRTCVideoMirrorType_Disable),this.rotation=t,this.fillMode=i,this.mirrorType=o};e.TRTCQuality=void 0,(z=e.TRTCQuality||(e.TRTCQuality={}))[z.TRTCQuality_Unknown=0]="TRTCQuality_Unknown",z[z.TRTCQuality_Excellent=1]="TRTCQuality_Excellent",z[z.TRTCQuality_Good=2]="TRTCQuality_Good",z[z.TRTCQuality_Poor=3]="TRTCQuality_Poor",z[z.TRTCQuality_Bad=4]="TRTCQuality_Bad",z[z.TRTCQuality_Vbad=5]="TRTCQuality_Vbad",z[z.TRTCQuality_Down=6]="TRTCQuality_Down";var N,Q,W,H=function(t,i){void 0===t&&(t=""),void 0===i&&(i=e.TRTCQuality.TRTCQuality_Unknown),this.userId=t,this.quality=i},j=function(e,t){void 0===e&&(e=""),void 0===t&&(t=0),this.userId=e,this.volume=t},U=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},q=function(t,i,o,r,n,s,a){void 0===t&&(t=0),void 0===i&&(i=0),void 0===o&&(o=0),void 0===r&&(r=0),void 0===s&&(s=0),void 0===a&&(a=e.TRTCVideoStreamType.TRTCVideoStreamTypeBig),this.width=t,this.height=i,this.frameRate=o,this.videoBitrate=r,this.audioBitrate=s,this.streamType=a},G=function(t,i,o,r,n,s,a,c,u,l,d,h,p,T){void 0===t&&(t=""),void 0===o&&(o=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===s&&(s=0),void 0===c&&(c=0),void 0===T&&(T=e.TRTCVideoStreamType.TRTCVideoStreamTypeBig),this.userId=t,this.width=o,this.height=r,this.frameRate=n,this.videoBitrate=s,this.audioBitrate=c,this.streamType=T},Y=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};e.TRTCVideoResolutionMode=void 0,(N=e.TRTCVideoResolutionMode||(e.TRTCVideoResolutionMode={}))[N.TRTCVideoResolutionModeLandscape=0]="TRTCVideoResolutionModeLandscape",N[N.TRTCVideoResolutionModePortrait=1]="TRTCVideoResolutionModePortrait",e.TRTCVideoQosPreference=void 0,(Q=e.TRTCVideoQosPreference||(e.TRTCVideoQosPreference={}))[Q.TRTCVideoQosPreferenceSmooth=1]="TRTCVideoQosPreferenceSmooth",Q[Q.TRTCVideoQosPreferenceClear=2]="TRTCVideoQosPreferenceClear",e.TRTCQosControlMode=void 0,(W=e.TRTCQosControlMode||(e.TRTCQosControlMode={}))[W.TRTCQosControlModeClient=0]="TRTCQosControlModeClient",W[W.TRTCQosControlModeServer=1]="TRTCQosControlModeServer";var K,J,X=function(t,i){void 0===t&&(t=e.TRTCVideoQosPreference.TRTCVideoQosPreferenceClear),void 0===i&&(i=e.TRTCQosControlMode.TRTCQosControlModeServer),this.preference=t,this.controlMode=i},$=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};e.TRTCLogLevel=void 0,(K=e.TRTCLogLevel||(e.TRTCLogLevel={}))[K.TRTCLogLevelVerbose=0]="TRTCLogLevelVerbose",K[K.TRTCLogLevelDebug=1]="TRTCLogLevelDebug",K[K.TRTCLogLevelInfo=2]="TRTCLogLevelInfo",K[K.TRTCLogLevelWarn=3]="TRTCLogLevelWarn",K[K.TRTCLogLevelError=4]="TRTCLogLevelError",K[K.TRTCLogLevelFatal=5]="TRTCLogLevelFatal",K[K.TRTCLogLevelNone=6]="TRTCLogLevelNone",e.TRTCScreenCaptureSourceType=void 0,(J=e.TRTCScreenCaptureSourceType||(e.TRTCScreenCaptureSourceType={}))[J.TRTCScreenCaptureSourceTypeUnknown=-1]="TRTCScreenCaptureSourceTypeUnknown",J[J.TRTCScreenCaptureSourceTypeWindow=0]="TRTCScreenCaptureSourceTypeWindow",J[J.TRTCScreenCaptureSourceTypeScreen=1]="TRTCScreenCaptureSourceTypeScreen",J[J.TRTCScreenCaptureSourceTypeCustom=2]="TRTCScreenCaptureSourceTypeCustom";var Z,ee=function(t,i,o,r,n,s){void 0===t&&(t=e.TRTCScreenCaptureSourceType.TRTCScreenCaptureSourceTypeUnknown),void 0===i&&(i=""),void 0===o&&(o=""),void 0===r&&(r=new $),void 0===n&&(n=new $),void 0===s&&(s=!1),this.type=t,this.sourceId=i,this.sourceName=o,this.thumbBGRA=r,this.iconBGRA=n,this.isMinimizeWindow=s},te=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},ie=function(t,i,o,r,n,s,a,c,u,l,d,h,p,T,f){void 0===t&&(t=e.TRTCTranscodingConfigMode.TRTCTranscodingConfigMode_Unknown),void 0===i&&(i=0),void 0===o&&(o=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===s&&(s=0),void 0===a&&(a=15),void 0===c&&(c=2),void 0===u&&(u=0),void 0===l&&(l=""),void 0===d&&(d=64),void 0===h&&(h=48e3),void 0===p&&(p=1),void 0===T&&(T=[]),void 0===f&&(f=""),this.mode=t,this.appId=i,this.bizId=o,this.videoWidth=r,this.videoHeight=n,this.videoBitrate=s,this.videoFramerate=a,this.videoGOP=c,this.backgroundColor=u,this.backgroundImage=l,this.audioSampleRate=d,this.audioBitrate=h,this.audioChannels=p,this.mixUsersArray=T,this.mixUsersArraySize=T.length,this.streamId=f};e.TRTCTranscodingConfigMode=void 0,(Z=e.TRTCTranscodingConfigMode||(e.TRTCTranscodingConfigMode={}))[Z.TRTCTranscodingConfigMode_Unknown=0]="TRTCTranscodingConfigMode_Unknown",Z[Z.TRTCTranscodingConfigMode_Manual=1]="TRTCTranscodingConfigMode_Manual",Z[Z.TRTCTranscodingConfigMode_Template_PureAudio=2]="TRTCTranscodingConfigMode_Template_PureAudio",Z[Z.TRTCTranscodingConfigMode_Template_PresetLayout=3]="TRTCTranscodingConfigMode_Template_PresetLayout",Z[Z.TRTCTranscodingConfigMode_Template_ScreenSharing=4]="TRTCTranscodingConfigMode_Template_ScreenSharing",Z[Z.TRTC_TranscodingConfigMode_Unknown=5]="TRTC_TranscodingConfigMode_Unknown",Z[Z.TRTC_TranscodingConfigMode_Manual=6]="TRTC_TranscodingConfigMode_Manual",Z[Z.TRTC_TranscodingConfigMode_Template_PureAudio=7]="TRTC_TranscodingConfigMode_Template_PureAudio",Z[Z.TRTC_TranscodingConfigMode_Template_PresetLayout=8]="TRTC_TranscodingConfigMode_Template_PresetLayout",Z[Z.TRTC_TranscodingConfigMode_Template_ScreenSharing=9]="TRTC_TranscodingConfigMode_Template_ScreenSharing";var oe,re,ne=function(t,i,o,r,n,s,a,c){void 0===t&&(t=""),void 0===i&&(i=""),void 0===o&&(o=null),void 0===r&&(r=0),void 0===n&&(n=!1),void 0===s&&(s=e.TRTCVideoStreamType.TRTCVideoStreamTypeBig),void 0===a&&(a=e.TRTCMixInputType.TRTCMixInputTypeUndefined),void 0===c&&(c=0),this.userId=t,this.roomId=i,this.rect=o,this.zOrder=r,this.pureAudio=n,this.streamType=s,this.inputType=a,this.renderMode=c};e.TRTCMixInputType=void 0,(oe=e.TRTCMixInputType||(e.TRTCMixInputType={}))[oe.TRTCMixInputTypeUndefined=0]="TRTCMixInputTypeUndefined",oe[oe.TRTCMixInputTypeAudioVideo=1]="TRTCMixInputTypeAudioVideo",oe[oe.TRTCMixInputTypePureVideo=2]="TRTCMixInputTypePureVideo",oe[oe.TRTCMixInputTypePureAudio=3]="TRTCMixInputTypePureAudio",e.TRTCCameraCaptureMode=void 0,(re=e.TRTCCameraCaptureMode||(e.TRTCCameraCaptureMode={}))[re.TRTCCameraResolutionStrategyAuto=0]="TRTCCameraResolutionStrategyAuto",re[re.TRTCCameraResolutionStrategyPerformance=1]="TRTCCameraResolutionStrategyPerformance",re[re.TRTCCameraResolutionStrategyHighQuality=2]="TRTCCameraResolutionStrategyHighQuality",re[re.TRTCCameraCaptureManual=3]="TRTCCameraCaptureManual";var se,ae=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},ce="onError",ue="onWarning",le="rtc",de="live",he="VirtualBackground",pe="BasicBeauty",Te="AIDenoiser",fe="blur",ve="image",ge={20:"anchor",21:"audience"},me={0:le,1:de,2:le,3:de};!function(e){e[e.ActiveExitRoom=0]="ActiveExitRoom",e[e.KickedExitRoom=1]="KickedExitRoom"}(se||(se={}));var Re="enum";function ye(){return Math.floor(performance.now())}var Ce=function(e){return void 0===e},_e=function(e){return"number"==typeof e},be=function(e){return"boolean"==typeof e};function Se(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 Me(e){return null==e}function we(){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]=we(e[i],t[i]):e[i]=t[i]})),e}),{})}function Ee(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]=Ee(e)}))):"object"==typeof e&&null!==e?(t={},Object.keys(e).forEach((function(i){Object.hasOwnProperty.call(e,i)&&(t[i]=Ee(e[i]))}))):t=e,t)}var Ae,Ve,Pe=function(e){return e&&e.Math===Math&&e},Le=Pe("object"==typeof globalThis&&globalThis)||Pe("object"==typeof window&&window)||Pe("object"==typeof self&&self)||Pe("object"==typeof y&&y)||function(){return this}()||y||Function("return this")(),Ie=function(e){try{return!!e()}catch(t){return!0}},xe=!Ie((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]})),Oe=!Ie((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),De=Function.prototype.call,ke=Oe?De.bind(De):function(){return De.apply(De,arguments)},Be={}.propertyIsEnumerable,ze=Object.getOwnPropertyDescriptor,Fe={f:ze&&!Be.call({1:2},1)?function(e){var t=ze(this,e);return!!t&&t.enumerable}:Be},Ne=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},Qe=Function.prototype,We=Qe.call,He=Oe&&Qe.bind.bind(We,We),je=Oe?He:function(e){return function(){return We.apply(e,arguments)}},Ue=je({}.toString),qe=je("".slice),Ge=function(e){return qe(Ue(e),8,-1)},Ye=Object,Ke=je("".split),Je=Ie((function(){return!Ye("z").propertyIsEnumerable(0)}))?function(e){return"String"===Ge(e)?Ke(e,""):Ye(e)}:Ye,Xe=function(e){return null==e},$e=TypeError,Ze=function(e){if(Xe(e))throw $e("Can't call method on "+e);return e},et=function(e){return Je(Ze(e))},tt="object"==typeof document&&document.all,it={all:tt,IS_HTMLDDA:void 0===tt&&void 0!==tt},ot=it.all,rt=it.IS_HTMLDDA?function(e){return"function"==typeof e||e===ot}:function(e){return"function"==typeof e},nt=it.all,st=it.IS_HTMLDDA?function(e){return"object"==typeof e?null!==e:rt(e)||e===nt}:function(e){return"object"==typeof e?null!==e:rt(e)},at=function(e,t){return arguments.length<2?(i=Le[e],rt(i)?i:void 0):Le[e]&&Le[e][t];var i},ct=je({}.isPrototypeOf),ut="undefined"!=typeof navigator&&String(navigator.userAgent)||"",lt=Le.process,dt=Le.Deno,ht=lt&&lt.versions||dt&&dt.version,pt=ht&&ht.v8;pt&&(Ve=(Ae=pt.split("."))[0]>0&&Ae[0]<4?1:+(Ae[0]+Ae[1])),!Ve&&ut&&(!(Ae=ut.match(/Edge\/(\d+)/))||Ae[1]>=74)&&(Ae=ut.match(/Chrome\/(\d+)/))&&(Ve=+Ae[1]);var Tt=Ve,ft=Le.String,vt=!!Object.getOwnPropertySymbols&&!Ie((function(){var e=Symbol("symbol detection");return!ft(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&Tt&&Tt<41})),gt=vt&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,mt=Object,Rt=gt?function(e){return"symbol"==typeof e}:function(e){var t=at("Symbol");return rt(t)&&ct(t.prototype,mt(e))},yt=String,Ct=TypeError,_t=function(e){if(rt(e))return e;throw Ct(function(e){try{return yt(e)}catch(t){return"Object"}}(e)+" is not a function")},bt=function(e,t){var i=e[t];return Xe(i)?void 0:_t(i)},St=TypeError,Mt=Object.defineProperty,wt=function(e,t){try{Mt(Le,e,{value:t,configurable:!0,writable:!0})}catch(i){Le[e]=t}return t},Et="__core-js_shared__",At=Le[Et]||wt(Et,{}),Vt=C((function(e){(e.exports=function(e,t){return At[e]||(At[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"})})),Pt=Object,Lt=function(e){return Pt(Ze(e))},It=je({}.hasOwnProperty),xt=Object.hasOwn||function(e,t){return It(Lt(e),t)},Ot=0,Dt=Math.random(),kt=je(1..toString),Bt=function(e){return"Symbol("+(void 0===e?"":e)+")_"+kt(++Ot+Dt,36)},zt=Le.Symbol,Ft=Vt("wks"),Nt=gt?zt.for||zt:zt&&zt.withoutSetter||Bt,Qt=function(e){return xt(Ft,e)||(Ft[e]=vt&&xt(zt,e)?zt[e]:Nt("Symbol."+e)),Ft[e]},Wt=TypeError,Ht=Qt("toPrimitive"),jt=function(e,t){if(!st(e)||Rt(e))return e;var i,o=bt(e,Ht);if(o){if(void 0===t&&(t="default"),i=ke(o,e,t),!st(i)||Rt(i))return i;throw Wt("Can't convert object to primitive value")}return void 0===t&&(t="number"),function(e,t){var i,o;if("string"===t&&rt(i=e.toString)&&!st(o=ke(i,e)))return o;if(rt(i=e.valueOf)&&!st(o=ke(i,e)))return o;if("string"!==t&&rt(i=e.toString)&&!st(o=ke(i,e)))return o;throw St("Can't convert object to primitive value")}(e,t)},Ut=function(e){var t=jt(e,"string");return Rt(t)?t:t+""},qt=Le.document,Gt=st(qt)&&st(qt.createElement),Yt=function(e){return Gt?qt.createElement(e):{}},Kt=!xe&&!Ie((function(){return 7!==Object.defineProperty(Yt("div"),"a",{get:function(){return 7}}).a})),Jt=Object.getOwnPropertyDescriptor,Xt={f:xe?Jt:function(e,t){if(e=et(e),t=Ut(t),Kt)try{return Jt(e,t)}catch(i){}if(xt(e,t))return Ne(!ke(Fe.f,e,t),e[t])}},$t=xe&&Ie((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Zt=String,ei=TypeError,ti=function(e){if(st(e))return e;throw ei(Zt(e)+" is not an object")},ii=TypeError,oi=Object.defineProperty,ri=Object.getOwnPropertyDescriptor,ni="enumerable",si="configurable",ai="writable",ci={f:xe?$t?function(e,t,i){if(ti(e),t=Ut(t),ti(i),"function"==typeof e&&"prototype"===t&&"value"in i&&ai in i&&!i[ai]){var o=ri(e,t);o&&o[ai]&&(e[t]=i.value,i={configurable:si in i?i[si]:o[si],enumerable:ni in i?i[ni]:o[ni],writable:!1})}return oi(e,t,i)}:oi:function(e,t,i){if(ti(e),t=Ut(t),ti(i),Kt)try{return oi(e,t,i)}catch(o){}if("get"in i||"set"in i)throw ii("Accessors not supported");return"value"in i&&(e[t]=i.value),e}},ui=xe?function(e,t,i){return ci.f(e,t,Ne(1,i))}:function(e,t,i){return e[t]=i,e},li=Function.prototype,di=xe&&Object.getOwnPropertyDescriptor,hi=xt(li,"name"),pi={EXISTS:hi,PROPER:hi&&"something"===function(){}.name,CONFIGURABLE:hi&&(!xe||xe&&di(li,"name").configurable)},Ti=je(Function.toString);rt(At.inspectSource)||(At.inspectSource=function(e){return Ti(e)});var fi,vi,gi,mi=At.inspectSource,Ri=Le.WeakMap,yi=rt(Ri)&&/native code/.test(String(Ri)),Ci=Vt("keys"),_i=function(e){return Ci[e]||(Ci[e]=Bt(e))},bi={},Si="Object already initialized",Mi=Le.TypeError,wi=Le.WeakMap;if(yi||At.state){var Ei=At.state||(At.state=new wi);Ei.get=Ei.get,Ei.has=Ei.has,Ei.set=Ei.set,fi=function(e,t){if(Ei.has(e))throw Mi(Si);return t.facade=e,Ei.set(e,t),t},vi=function(e){return Ei.get(e)||{}},gi=function(e){return Ei.has(e)}}else{var Ai=_i("state");bi[Ai]=!0,fi=function(e,t){if(xt(e,Ai))throw Mi(Si);return t.facade=e,ui(e,Ai,t),t},vi=function(e){return xt(e,Ai)?e[Ai]:{}},gi=function(e){return xt(e,Ai)}}var Vi={set:fi,get:vi,has:gi,enforce:function(e){return gi(e)?vi(e):fi(e,{})},getterFor:function(e){return function(t){var i;if(!st(t)||(i=vi(t)).type!==e)throw Mi("Incompatible receiver, "+e+" required");return i}}},Pi=C((function(e){var t=pi.CONFIGURABLE,i=Vi.enforce,o=Vi.get,r=String,n=Object.defineProperty,s=je("".slice),a=je("".replace),c=je([].join),u=xe&&!Ie((function(){return 8!==n((function(){}),"length",{value:8}).length})),l=String(String).split("String"),d=e.exports=function(e,o,d){"Symbol("===s(r(o),0,7)&&(o="["+a(r(o),/^Symbol\(([^)]*)\)/,"$1")+"]"),d&&d.getter&&(o="get "+o),d&&d.setter&&(o="set "+o),(!xt(e,"name")||t&&e.name!==o)&&(xe?n(e,"name",{value:o,configurable:!0}):e.name=o),u&&d&&xt(d,"arity")&&e.length!==d.arity&&n(e,"length",{value:d.arity});try{d&&xt(d,"constructor")&&d.constructor?xe&&n(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(p){}var h=i(e);return xt(h,"source")||(h.source=c(l,"string"==typeof o?o:"")),e};Function.prototype.toString=d((function(){return rt(this)&&o(this).source||mi(this)}),"toString")})),Li=function(e,t,i,o){o||(o={});var r=o.enumerable,n=void 0!==o.name?o.name:t;if(rt(i)&&Pi(i,n,o),o.global)r?e[t]=i:wt(t,i);else{try{o.unsafe?e[t]&&(r=!0):delete e[t]}catch(s){}r?e[t]=i:ci.f(e,t,{value:i,enumerable:!1,configurable:!o.nonConfigurable,writable:!o.nonWritable})}return e},Ii=Math.ceil,xi=Math.floor,Oi=Math.trunc||function(e){var t=+e;return(t>0?xi:Ii)(t)},Di=function(e){var t=+e;return t!=t||0===t?0:Oi(t)},ki=Math.max,Bi=Math.min,zi=Math.min,Fi=function(e){return e>0?zi(Di(e),9007199254740991):0},Ni=function(e){return Fi(e.length)},Qi=function(e){return function(t,i,o){var r,n=et(t),s=Ni(n),a=function(e,t){var i=Di(e);return i<0?ki(i+t,0):Bi(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}},Wi={includes:Qi(!0),indexOf:Qi(!1)}.indexOf,Hi=je([].push),ji=function(e,t){var i,o=et(e),r=0,n=[];for(i in o)!xt(bi,i)&&xt(o,i)&&Hi(n,i);for(;t.length>r;)xt(o,i=t[r++])&&(~Wi(n,i)||Hi(n,i));return n},Ui=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],qi=Ui.concat("length","prototype"),Gi={f:Object.getOwnPropertyNames||function(e){return ji(e,qi)}},Yi={f:Object.getOwnPropertySymbols},Ki=je([].concat),Ji=at("Reflect","ownKeys")||function(e){var t=Gi.f(ti(e)),i=Yi.f;return i?Ki(t,i(e)):t},Xi=function(e,t,i){for(var o=Ji(t),r=ci.f,n=Xt.f,s=0;s<o.length;s++){var a=o[s];xt(e,a)||i&&xt(i,a)||r(e,a,n(t,a))}},$i=/#|\.prototype\./,Zi=function(e,t){var i=to[eo(e)];return i===oo||i!==io&&(rt(t)?Ie(t):!!t)},eo=Zi.normalize=function(e){return String(e).replace($i,".").toLowerCase()},to=Zi.data={},io=Zi.NATIVE="N",oo=Zi.POLYFILL="P",ro=Zi,no=Xt.f,so=function(e,t){var i,o,r,n,s,a=e.target,c=e.global,u=e.stat;if(i=c?Le:u?Le[a]||wt(a,{}):(Le[a]||{}).prototype)for(o in t){if(n=t[o],r=e.dontCallGetSet?(s=no(i,o))&&s.value:i[o],!ro(c?o:a+(u?".":"#")+o,e.forced)&&void 0!==r){if(typeof n==typeof r)continue;Xi(n,r)}(e.sham||r&&r.sham)&&ui(n,"sham",!0),Li(i,o,n,e)}},ao={};ao[Qt("toStringTag")]="z";var co,uo="[object z]"===String(ao),lo=Qt("toStringTag"),ho=Object,po="Arguments"===Ge(function(){return arguments}()),To=uo?Ge: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=ho(e),lo))?i:po?Ge(t):"Object"===(o=Ge(t))&&rt(t.callee)?"Arguments":o},fo=String,vo=function(e){if("Symbol"===To(e))throw TypeError("Cannot convert a Symbol value to a string");return fo(e)},go=function(){var e=ti(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},mo=Le.RegExp,Ro=Ie((function(){var e=mo("a","y");return e.lastIndex=2,null!==e.exec("abcd")})),yo=Ro||Ie((function(){return!mo("a","y").sticky})),Co={BROKEN_CARET:Ro||Ie((function(){var e=mo("^r","gy");return e.lastIndex=2,null!==e.exec("str")})),MISSED_STICKY:yo,UNSUPPORTED_Y:Ro},_o=Object.keys||function(e){return ji(e,Ui)},bo=xe&&!$t?Object.defineProperties:function(e,t){ti(e);for(var i,o=et(t),r=_o(t),n=r.length,s=0;n>s;)ci.f(e,i=r[s++],o[i]);return e},So={f:bo},Mo=at("document","documentElement"),wo="prototype",Eo="script",Ao=_i("IE_PROTO"),Vo=function(){},Po=function(e){return"<"+Eo+">"+e+"</"+Eo+">"},Lo=function(e){e.write(Po("")),e.close();var t=e.parentWindow.Object;return e=null,t},Io=function(){try{co=new ActiveXObject("htmlfile")}catch(r){}var e,t,i;Io="undefined"!=typeof document?document.domain&&co?Lo(co):(t=Yt("iframe"),i="java"+Eo+":",t.style.display="none",Mo.appendChild(t),t.src=String(i),(e=t.contentWindow.document).open(),e.write(Po("document.F=Object")),e.close(),e.F):Lo(co);for(var o=Ui.length;o--;)delete Io[wo][Ui[o]];return Io()};bi[Ao]=!0;var xo,Oo,Do=Object.create||function(e,t){var i;return null!==e?(Vo[wo]=ti(e),i=new Vo,Vo[wo]=null,i[Ao]=e):i=Io(),void 0===t?i:So.f(i,t)},ko=Le.RegExp,Bo=Ie((function(){var e=ko(".","s");return!(e.dotAll&&e.exec("\n")&&"s"===e.flags)})),zo=Le.RegExp,Fo=Ie((function(){var e=zo("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")})),No=Vi.get,Qo=Vt("native-string-replace",String.prototype.replace),Wo=RegExp.prototype.exec,Ho=Wo,jo=je("".charAt),Uo=je("".indexOf),qo=je("".replace),Go=je("".slice),Yo=(Oo=/b*/g,ke(Wo,xo=/a/,"a"),ke(Wo,Oo,"a"),0!==xo.lastIndex||0!==Oo.lastIndex),Ko=Co.BROKEN_CARET,Jo=void 0!==/()??/.exec("")[1];(Yo||Jo||Ko||Bo||Fo)&&(Ho=function(e){var t,i,o,r,n,s,a,c=this,u=No(c),l=vo(e),d=u.raw;if(d)return d.lastIndex=c.lastIndex,t=ke(Ho,d,l),c.lastIndex=d.lastIndex,t;var h=u.groups,p=Ko&&c.sticky,T=ke(go,c),f=c.source,v=0,g=l;if(p&&(T=qo(T,"y",""),-1===Uo(T,"g")&&(T+="g"),g=Go(l,c.lastIndex),c.lastIndex>0&&(!c.multiline||c.multiline&&"\n"!==jo(l,c.lastIndex-1))&&(f="(?: "+f+")",g=" "+g,v++),i=new RegExp("^(?:"+f+")",T)),Jo&&(i=new RegExp("^"+f+"$(?!\\s)",T)),Yo&&(o=c.lastIndex),r=ke(Wo,p?i:c,g),p?r?(r.input=Go(r.input,v),r[0]=Go(r[0],v),r.index=c.lastIndex,c.lastIndex+=r[0].length):c.lastIndex=0:Yo&&r&&(c.lastIndex=c.global?r.index+r[0].length:o),Jo&&r&&r.length>1&&ke(Qo,r[0],i,(function(){for(n=1;n<arguments.length-2;n++)void 0===arguments[n]&&(r[n]=void 0)})),r&&h)for(r.groups=s=Do(null),n=0;n<h.length;n++)s[(a=h[n])[0]]=r[a[1]];return r});var Xo=Ho;so({target:"RegExp",proto:!0,forced:/./.exec!==Xo},{exec:Xo});var $o="\t\n\v\f\r                 \u2028\u2029\ufeff",Zo=je("".replace),er=RegExp("^["+$o+"]+"),tr=RegExp("(^|[^"+$o+"])["+$o+"]+$"),ir=function(e){return function(t){var i=vo(Ze(t));return 1&e&&(i=Zo(i,er,"")),2&e&&(i=Zo(i,tr,"$1")),i}},or={start:ir(1),end:ir(2),trim:ir(3)}.trim,rr=je("".charAt),nr=Le.parseFloat,sr=Le.Symbol,ar=sr&&sr.iterator,cr=1/nr($o+"-0")!=-Infinity||ar&&!Ie((function(){nr(Object(ar))}))?function(e){var t=or(vo(e)),i=nr(t);return 0===i&&"-"===rr(t,0)?-0:i}:nr;so({global:!0,forced:parseFloat!==cr},{parseFloat:cr});var ur=function(e){if("Function"===Ge(e))return je(e)},lr=Qt("species"),dr=RegExp.prototype,hr=je("".charAt),pr=je("".charCodeAt),Tr=je("".slice),fr=function(e){return function(t,i){var o,r,n=vo(Ze(t)),s=Di(i),a=n.length;return s<0||s>=a?e?"":void 0:(o=pr(n,s))<55296||o>56319||s+1===a||(r=pr(n,s+1))<56320||r>57343?e?hr(n,s):o:e?Tr(n,s,s+2):r-56320+(o-55296<<10)+65536}},vr={codeAt:fr(!1),charAt:fr(!0)}.charAt,gr=function(e,t,i){return t+(i?vr(e,t).length:1)},mr=TypeError,Rr=function(e,t){var i=e.exec;if(rt(i)){var o=ke(i,e,t);return null!==o&&ti(o),o}if("RegExp"===Ge(e))return ke(Xo,e,t);throw mr("RegExp#exec called on incompatible receiver")};!function(e,t,i,o){var r=Qt(e),n=!Ie((function(){var t={};return t[r]=function(){return 7},7!==""[e](t)})),s=n&&!Ie((function(){var t=!1,i=/a/;return"split"===e&&((i={}).constructor={},i.constructor[lr]=function(){return i},i.flags="",i[r]=/./[r]),i.exec=function(){return t=!0,null},i[r](""),!t}));if(!n||!s||i){var a=ur(/./[r]),c=t(r,""[e],(function(e,t,i,o,r){var s=ur(e),c=t.exec;return c===Xo||c===dr.exec?n&&!r?{done:!0,value:a(t,i,o)}:{done:!0,value:s(i,t,o)}:{done:!1}}));Li(String.prototype,e,c[0]),Li(dr,r,c[1])}o&&ui(dr[r],"sham",!0)}("match",(function(e,t,i){return[function(t){var i=Ze(this),o=Xe(t)?void 0:bt(t,e);return o?ke(o,t,i):new RegExp(t)[e](vo(i))},function(e){var o=ti(this),r=vo(e),n=i(t,o,r);if(n.done)return n.value;if(!o.global)return Rr(o,r);var s=o.unicode;o.lastIndex=0;for(var a,c=[],u=0;null!==(a=Rr(o,r));){var l=vo(a[0]);c[u]=l,""===l&&(o.lastIndex=gr(r,Fi(o.lastIndex),s)),u++}return 0===u?null:c}]}));var yr=Array.isArray||function(e){return"Array"===Ge(e)},Cr=TypeError,_r=function(e){if(e>9007199254740991)throw Cr("Maximum allowed index exceeded");return e},br=function(e,t,i){var o=Ut(t);o in e?ci.f(e,o,Ne(0,i)):e[o]=i},Sr=function(){},Mr=[],wr=at("Reflect","construct"),Er=/^\s*(?:class|function)\b/,Ar=je(Er.exec),Vr=!Er.exec(Sr),Pr=function(e){if(!rt(e))return!1;try{return wr(Sr,Mr,e),!0}catch(t){return!1}},Lr=function(e){if(!rt(e))return!1;switch(To(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Vr||!!Ar(Er,mi(e))}catch(t){return!0}};Lr.sham=!0;var Ir,xr=!wr||Ie((function(){var e;return Pr(Pr.call)||!Pr(Object)||!Pr((function(){e=!0}))||e}))?Lr:Pr,Or=Qt("species"),Dr=Array,kr=function(e,t){return new(function(e){var t;return yr(e)&&(t=e.constructor,(xr(t)&&(t===Dr||yr(t.prototype))||st(t)&&null===(t=t[Or]))&&(t=void 0)),void 0===t?Dr:t}(e))(0===t?0:t)},Br=Qt("species"),zr=Qt("isConcatSpreadable"),Fr=Tt>=51||!Ie((function(){var e=[];return e[zr]=!1,e.concat()[0]!==e})),Nr=function(e){if(!st(e))return!1;var t=e[zr];return void 0!==t?!!t:yr(e)};so({target:"Array",proto:!0,arity:1,forced:!(Fr&&(Ir="concat",Tt>=51||!Ie((function(){var e=[];return(e.constructor={})[Br]=function(){return{foo:1}},1!==e[Ir](Boolean).foo}))))},{concat:function(e){var t,i,o,r,n,s=Lt(this),a=kr(s,0),c=0;for(t=-1,o=arguments.length;t<o;t++)if(Nr(n=-1===t?s:arguments[t]))for(r=Ni(n),_r(c+r),i=0;i<r;i++,c++)i in n&&br(a,c,n[i]);else _r(c+1),br(a,c++,n);return a.length=c,a}});var Qr=window.navigator&&window.navigator.userAgent||"",Wr=/AppleWebKit\/([\d.]+)/i.exec(Qr);Wr&&parseFloat(Wr.pop());var Hr=/iPad/i.test(Qr),jr=/iPhone/i.test(Qr)&&!Hr,Ur=/iPod/i.test(Qr),qr=jr||Hr||Ur,Gr=/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i.test(Qr);qr&&function(){var e=Qr.match(/OS (\d+)_/i);e&&e[1]&&e[1]}();var Yr=/Android/i.test(Qr);Yr&&function(){var e=Qr.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]))}();Yr&&/webkit/i.test(Qr),/Firefox/i.test(Qr)&&function(){var e=Qr.match(/Firefox\/(\d+)/);e&&e[1]&&parseFloat(e[1])}();var Kr=/Edge\//i.test(Qr);Kr&&function(){var e=Qr.match(/Edge\/(\d+)/i);if(e&&e[1])e[1]}();var Jr=/Edg\//i.test(Qr);Jr&&function(){var e=Qr.match(/Edg\/(\d+)/);e&&e[1]&&parseFloat(e[1])}();var Xr=/SogouMobileBrowser\//i.test(Qr);Xr&&function(){var e=Qr.match(/SogouMobileBrowser\/(\d+)/);e&&e[1]&&parseFloat(e[1])}();var $r=/MetaSr\s/i.test(Qr);$r&&function(){var e=Qr.match(/MetaSr(\s\d+(\.\d+)+)/);e&&e[1]&&parseFloat(e[1])}();var Zr=/TBS\/\d+/i.test(Qr);Zr&&function(){var e=Qr.match(/TBS\/(\d+)/i);if(e&&e[1])e[1]}();var en=/XWEB\/\d+/i.test(Qr);en&&function(){var e=Qr.match(/XWEB\/(\d+)/i);if(e&&e[1])e[1]}(),/MSIE\s8\.0/.test(Qr),/MSIE\/\d+/i.test(Qr)&&function(){var e=/MSIE\s(\d+)\.\d/.exec(Qr),t=e&&parseFloat(e[1]);!t&&/Trident\/7.0/i.test(Qr)&&/rv:11.0/.test(Qr)&&(t=11)}(),/(micromessenger|webbrowser)/i.test(Qr)&&function(){var e=Qr.match(/MicroMessenger\/(\d+)/i);if(e&&e[1])e[1]}();var tn=!Zr&&/MQQBrowser\/\d+/i.test(Qr)&&/COVC\/\d+/i.test(Qr),on=!Zr&&/MQQBrowser\/\d+/i.test(Qr)&&!/COVC\/\d+/i.test(Qr);(on||tn)&&function(){var e=Qr.match(/ MQQBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var rn=!Zr&&/ QQBrowser\/\d+/i.test(Qr);rn&&function(){var e=Qr.match(/ QQBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var nn=!Zr&&/QQBrowserLite\/\d+/i.test(Qr);nn&&function(){var e=Qr.match(/QQBrowserLite\/([\d.]+)/);e&&e[1]&&e[1]}();var sn=!Zr&&/MQBHD\/\d+/i.test(Qr);sn&&function(){var e=Qr.match(/MQBHD\/([\d.]+)/);e&&e[1]&&e[1]}(),/Windows/i.test(Qr),!qr&&/MAC OS X/i.test(Qr),!Yr&&/Linux/i.test(Qr),/MicroMessenger/i.test(Qr),/UCBrowser/i.test(Qr),/Electron/i.test(Qr);var an=/MiuiBrowser/i.test(Qr);an&&function(){var e=Qr.match(/MiuiBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var cn=/HuaweiBrowser/i.test(Qr);/Huawei/i.test(Qr),cn&&function(){var e=Qr.match(/HuaweiBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var un=/SamsungBrowser/i.test(Qr);un&&function(){var e=Qr.match(/SamsungBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var ln=/HeyTapBrowser/i.test(Qr);ln&&function(){var e=Qr.match(/HeyTapBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var dn=/VivoBrowser/i.test(Qr);dn&&function(){var e=Qr.match(/VivoBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var hn,pn,Tn,fn=/Chrome/i.test(Qr),vn=!Kr&&!$r&&!Xr&&!Zr&&!en&&!Jr&&!rn&&!an&&!cn&&!un&&!ln&&!dn&&/Chrome/i.test(Qr);vn&&function(){var e=Qr.match(/Chrome\/(\d+)/);e&&e[1]&&parseFloat(e[1])}(),vn&&function(){var e=Qr.match(/Chrome\/([\d.]+)/);e&&e[1]&&e[1]}(),!fn&&!on&&!tn&&!nn&&!sn&&/Safari/i.test(Qr)&&function(){var e=Qr.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"}(hn||(hn={})),function(e){e.CONTAIN="contain",e.COVER="cover",e.FILL="fill"}(pn||(pn={})),function(e){e[e.exitRoom=0]="exitRoom",e[e.banned=1]="banned",e[e.roomDisband=2]="roomDisband"}(Tn||(Tn={}));var gn,mn,Rn,yn=-3340,Cn=-1301,_n=-1314,bn=-1315,Sn=-1316,Mn=-1302,wn=-1317,En=-1318,An=-1319,Vn=-1308,Pn=-102015,Ln=-70252,In={code:-1001,message:"参数错误, 请检查参数格式、是否非空等"},xn={code:-1005,message:"not supported"},On="2.12.2-beta.6";e.TRTCMediaMixingErrorCode=void 0,(gn=e.TRTCMediaMixingErrorCode||(e.TRTCMediaMixingErrorCode={}))[gn.Success=0]="Success",gn[gn.Error=-1]="Error",gn[gn.InvalidParams=-2]="InvalidParams",gn[gn.NotFoundSource=-3]="NotFoundSource",gn[gn.ImageSourceLoadFailed=-4]="ImageSourceLoadFailed",gn[gn.CameraNotAuthorized=-5]="CameraNotAuthorized",gn[gn.CameraIsOccupied=-6]="CameraIsOccupied",gn[gn.CameraDisconnected=-7]="CameraDisconnected",e.TRTCMediaSourceType=void 0,(mn=e.TRTCMediaSourceType||(e.TRTCMediaSourceType={}))[mn.kCamera=0]="kCamera",mn[mn.kScreen=1]="kScreen",mn[mn.kImage=2]="kImage",mn[mn.kPhoneMirror=4]="kPhoneMirror",mn[mn.kText=5]="kText",mn[mn.kVideo=6]="kVideo",e.TRTCMediaMixingEvent=void 0,(Rn=e.TRTCMediaMixingEvent||(e.TRTCMediaMixingEvent={})).onSourceSelected="onSourceSelected",Rn.onSourceMoved="onSourceMoved",Rn.onSourceResized="onSourceResized",Rn.onRightButtonClicked="onRightButtonClicked",Rn.onError="onError",Rn.onSourcePlugged="onSourcePlugged",Rn.onSourceConnected="onSourceConnected",Rn.onSourceDisconnected="onSourceDisconnected",Rn.onSourceUnplugged="onSourceUnplugged",Rn.onMediaSourceSizeChanged="onMediaSourceSizeChanged";var Dn,kn=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}(),Bn=new kn(null),zn=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"):Bn.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 Bn.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)):Bn.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 Bn.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){Bn.debug("".concat(this.logPrefix,"setEnabled: ").concat(this.enabled," -> ").concat(e)),this.enabled=e,this.movable&&(this.movable.style.cursor=e?"move":"default",Bn.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"}(Dn||(Dn={}));var Fn="trtc-resizable-top-left-anchor",Nn="trtc-resizable-top-anchor",Qn="trtc-resizable-top-right-anchor",Wn="trtc-resizable-left-anchor",Hn="trtc-resizable-right-anchor",jn="trtc-resizable-bottom-left-anchor",Un="trtc-resizable-bottom-anchor",qn="trtc-resizable-bottom-right-anchor",Gn={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 Yn(e,t){for(var i in t)e.style[i]=t[i]}var Kn=function(){function e(e,t,i){void 0===i&&(i={keepRatio:!1,stopPropagation:!1,anchorMode:Dn.Both,canExceedContainer:!1}),this.logPrefix="[Resizable]",this.container=null,this.options={keepRatio:!1,stopPropagation:!1,anchorMode:Dn.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||Dn.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(Fn),Yn(c,Object.assign({},Gn.resizeAnchor,Gn.topLeftAnchor)),this.topLeftAnchor=c;var u=document.createElement("div");u.className="trtc-resizable-resize-anchor ".concat(Nn),Yn(u,Object.assign({},Gn.resizeAnchor,Gn.topAnchor)),this.topAnchor=u;var l=document.createElement("div");l.className="trtc-resizable-resize-anchor ".concat(Qn),Yn(l,Object.assign({},Gn.resizeAnchor,Gn.topRightAnchor)),this.topRightAnchor=l;var d=document.createElement("div");d.className="trtc-resizable-resize-anchor ".concat(Wn),Yn(d,Object.assign({},Gn.resizeAnchor,Gn.leftAnchor)),this.leftAnchor=d;var h=document.createElement("div");h.className="trtc-resizable-resize-anchor ".concat(Hn),Yn(h,Object.assign({},Gn.resizeAnchor,Gn.rightAnchor)),this.rightAnchor=h;var p=document.createElement("div");p.className="trtc-resizable-resize-anchor ".concat(jn),Yn(p,Object.assign({},Gn.resizeAnchor,Gn.bottomLeftAnchor)),this.bottomLeftAnchor=p;var T=document.createElement("div");T.className="trtc-resizable-resize-anchor ".concat(Un),Yn(T,Object.assign({},Gn.resizeAnchor,Gn.bottomAnchor)),this.bottomAnchor=T;var f=document.createElement("div");f.className="trtc-resizable-resize-anchor ".concat(qn),Yn(f,Object.assign({},Gn.resizeAnchor,Gn.bottomRightAnchor)),this.bottomRightAnchor=f,this.options.anchorMode!==Dn.Both&&this.options.anchorMode!==Dn.Edge||(null===(e=this.resizeTarget)||void 0===e||e.appendChild(u),null===(t=this.resizeTarget)||void 0===t||t.appendChild(d),null===(i=this.resizeTarget)||void 0===i||i.appendChild(h),null===(o=this.resizeTarget)||void 0===o||o.appendChild(T)),this.options.anchorMode!==Dn.Both&&this.options.anchorMode!==Dn.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(f))},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,Bn.debug("resize origin:",this.originTop,this.originLeft,this.originWidth,this.originHeight)}else Bn.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 Fn: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 Nn: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 Wn: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 Hn: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 jn: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 Un: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 qn: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 Bn.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 Bn.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 Bn.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,d,h,p,T,f;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!==Dn.Both&&this.options.anchorMode!==Dn.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===(d=this.resizeTarget)||void 0===d||d.removeChild(this.bottomAnchor))),this.options.anchorMode!==Dn.Both&&this.options.anchorMode!==Dn.Corner||(this.topLeftAnchor&&(null===(h=this.resizeTarget)||void 0===h||h.removeChild(this.topLeftAnchor)),this.topRightAnchor&&(null===(p=this.resizeTarget)||void 0===p||p.removeChild(this.topRightAnchor)),this.bottomLeftAnchor&&(null===(T=this.resizeTarget)||void 0===T||T.removeChild(this.bottomLeftAnchor)),this.bottomRightAnchor&&(null===(f=this.resizeTarget)||void 0===f||f.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}(),Jn=function(){var t=new Map;for(var i in e.TRTCVideoResolution)if(isNaN(Number(i))){var o=e.TRTCVideoResolution[i],r=i.split("_");t.set(o,{width:parseInt(r[1]),height:parseInt(r[2])})}return t}(),Xn=function(){function t(t){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=t.logger,this.container=t.view,this.container.style.position="relative",this.videoResolution=t.videoResolution,this.resMode=t.resMode,Jn.has(t.videoResolution)){var i=Jn.get(t.videoResolution),o=i.width,r=i.height;this.resMode===e.TRTCVideoResolutionMode.TRTCVideoResolutionModeLandscape?(this.mixingVideoWidth=o,this.mixingVideoHeight=r):(this.mixingVideoWidth=r,this.mixingVideoHeight=o)}this.updatePreviewProperty(),this.canExceedContainer=t.canExceedContainer||!1,this.eventEmitter=new L,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 t.prototype.updateOptions=function(t){if(!Me(t.videoResolution)||!Me(t.resMode)){if(this.resMode=Me(t.resMode)?this.resMode:t.resMode,t.videoResolution&&Jn.has(t.videoResolution)){var i=Jn.get(t.videoResolution),o=i.width,r=i.height;this.resMode===e.TRTCVideoResolutionMode.TRTCVideoResolutionModeLandscape?(this.mixingVideoWidth=o,this.mixingVideoHeight=r):(this.mixingVideoWidth=r,this.mixingVideoHeight=o)}this.updatePreviewProperty(),this.updateOverlay()}},t.prototype.addMedia=function(e){this.mediaList.unshift(e),e.isSelected&&(this.selectedMediaIndex=0,this.updateOverlay())},t.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()))},t.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()))},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.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=[]},t.prototype.initMediaMovable=function(){this.onMove=this.onMove.bind(this),this.movableHandler=new zn(this.moveAndResizeOverlay,this.container,{canExceedContainer:this.canExceedContainer,calcPositionOnly:!1}),this.movableHandler.on("move",this.onMove)},t.prototype.initMediaResizable=function(){this.onResize=this.onResize.bind(this),this.resizableHandler=new Kn(this.moveAndResizeOverlay,this.container,{keepRatio:!0,stopPropagation:!0,canExceedContainer:this.canExceedContainer,anchorMode:0}),this.resizableHandler.on("resize",this.onResize)},t.prototype.updateCanExceedContainer=function(e){this.movableHandler&&(this.movableHandler.options.canExceedContainer=e),this.resizableHandler&&(this.resizableHandler.options.canExceedContainer=e)},t.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"))},t.prototype.initContainerResizeObserver=function(){this.container&&(this.onPreviewAreaResize=this.onPreviewAreaResize.bind(this),this.resizeObserver=new ResizeObserver(this.onPreviewAreaResize),this.resizeObserver.observe(this.container))},t.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}}},t.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"))},t.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}},t.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",p({},o),n)}else console.debug("".concat(this.logPrefix,"onMove no selected media"))},t.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)},t.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(!Ce(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},c={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",p({},n),c)}else console.debug("".concat(this.logPrefix,"onResize no selected media"))},t.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},t.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?p({},e):null)},t.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)}},t.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}))))}},t.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},t.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",p({},this.mediaList[this.selectedMediaIndex]))},t}(),$n=function(){function t(i){if(this.logPrefix="[TRTCMediaMixingManager]",this.eventEmitter=new L,this.publishParams={videoEncoderParams:{videoResolution:e.TRTCVideoResolution.TRTCVideoResolution_1280_720,resMode:e.TRTCVideoResolutionMode.TRTCVideoResolutionModeLandscape,videoFps:15,videoBitrate:1800},canvasColor:0},this.mediaMixingDesigner=null,this.sourceList=[],this.trtcSourceMap=new Map,this.mixVideoTrack=null,this.publishStreamType=e.TRTCVideoStreamType.TRTCVideoStreamTypeBig,this.selectedSource=null,this.view=null,this.screensWithSystemAudio=new Set,t.mediaMixingManager)return t.mediaMixingManager;t.mediaMixingManager=this,this.logger=i.logger,this.trtc=i.trtc,this.trtcCloud=i.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 f(this,void 0,Promise,(function(){var e,i,o,r,n;return v(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 f(this,void 0,Promise,(function(){var t,i,o,r,n=this;return v(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._getTRTCSourceKey=function(t){var i;return((i={})[e.TRTCMediaSourceType.kCamera]="camera",i[e.TRTCMediaSourceType.kScreen]="screen",i[e.TRTCMediaSourceType.kText]="text",i[e.TRTCMediaSourceType.kVideo]="video",i[e.TRTCMediaSourceType.kImage]="image",i)[t.type]},t.prototype._getTRTCFillMode=function(t){var i;return((i={})[e.TRTCVideoFillMode.TRTCVideoFillMode_Fill]="cover",i[e.TRTCVideoFillMode.TRTCVideoFillMode_Fit]="contain",i)[t]},t.prototype._getTRTCVideoProfile=function(t,i){var o,r,n,s=null!==(r=((o={})[e.TRTCVideoResolution.TRTCVideoResolution_480_270]={width:480,height:270},o[e.TRTCVideoResolution.TRTCVideoResolution_640_360]={width:640,height:360},o[e.TRTCVideoResolution.TRTCVideoResolution_960_540]={width:960,height:540},o[e.TRTCVideoResolution.TRTCVideoResolution_1280_720]={width:1280,height:720},o[e.TRTCVideoResolution.TRTCVideoResolution_1920_1080]={width:1920,height:1080},o)[t])&&void 0!==r?r:(n=t)&&"object"==typeof n&&"number"==typeof n.width&&"number"==typeof n.height?t:{width:1920,height:1080};return{width:s.width,height:s.height,frameRate:i,bitrate:1e3}},t.prototype._getTRTCLayout=function(t){var i,o,r,n,s,a,c,u,l,d,h,p,T,f,v,g,m={zIndex:(null===(r=t.layout)||void 0===r?void 0:r.zOrder)||0};if(Ce(null===(n=t.layout)||void 0===n?void 0:n.rect)||(m.x=null===(s=t.layout)||void 0===s?void 0:s.rect.left,m.y=null===(a=t.layout)||void 0===a?void 0:a.rect.top,m.width=(null===(c=t.layout)||void 0===c?void 0:c.rect.right)-(null===(u=t.layout)||void 0===u?void 0:u.rect.left),m.height=(null===(l=t.layout)||void 0===l?void 0:l.rect.bottom)-(null===(d=t.layout)||void 0===d?void 0:d.rect.top)),Ce(null===(h=t.layout)||void 0===h?void 0:h.fillMode)||(m.fillMode=this._getTRTCFillMode(null===(p=t.layout)||void 0===p?void 0:p.fillMode)),!Ce(null===(T=t.layout)||void 0===T?void 0:T.mirror)){var R=((i={})[e.TRTCVideoMirrorType.TRTCVideoMirrorType_Auto]=!0,i[e.TRTCVideoMirrorType.TRTCVideoMirrorType_Enable]=!0,i[e.TRTCVideoMirrorType.TRTCVideoMirrorType_Disable]=!1,i);m.mirror=R[null===(f=t.layout)||void 0===f?void 0:f.mirror]}if(!Ce(null===(v=t.layout)||void 0===v?void 0:v.rotation)){var y=((o={})[e.TRTCVideoRotation.TRTCVideoRotation0]=0,o[e.TRTCVideoRotation.TRTCVideoRotation90]=90,o[e.TRTCVideoRotation.TRTCVideoRotation180]=180,o[e.TRTCVideoRotation.TRTCVideoRotation270]=270,o);m.rotation=y[null===(g=t.layout)||void 0===g?void 0:g.rotation]}return m},t.prototype._getTRTCSourceItem=function(t){var i,o,r,n,s,a,c,u,l,d;switch(t.type){case e.TRTCMediaSourceType.kScreen:return d=e.TRTCVideoResolution.TRTCVideoResolution_1920_1080,(null==t?void 0:t.useInternalTrack)?{id:t.id,layout:this._getTRTCLayout(t),useInternalTrack:!0}:{id:t.id,profile:this._getTRTCVideoProfile((null===(i=t.screen)||void 0===i?void 0:i.resolution)||d,(null===(o=t.screen)||void 0===o?void 0:o.fps)||15),layout:this._getTRTCLayout(t),systemAudio:null===(r=t.screen)||void 0===r?void 0:r.systemAudio};case e.TRTCMediaSourceType.kCamera:return d=e.TRTCVideoResolution.TRTCVideoResolution_1280_720,(null==t?void 0:t.useInternalTrack)?{id:t.id,layout:this._getTRTCLayout(t),useInternalTrack:!0}:{id:t.id,cameraId:null===(n=t.camera)||void 0===n?void 0:n.cameraId,profile:this._getTRTCVideoProfile((null===(s=t.camera)||void 0===s?void 0:s.resolution)||d,(null===(a=t.camera)||void 0===a?void 0:a.fps)||15),videoTrack:null===(c=t.camera)||void 0===c?void 0:c.videoTrack,layout:this._getTRTCLayout(t)};case e.TRTCMediaSourceType.kText:return p(p({id:t.id},t.text||{}),{layout:this._getTRTCLayout(t)});case e.TRTCMediaSourceType.kImage:return{id:t.id,url:null===(u=t.image)||void 0===u?void 0:u.url,layout:this._getTRTCLayout(t)};case e.TRTCMediaSourceType.kVideo:return{id:t.id,url:null===(l=t.video)||void 0===l?void 0:l.url,layout:this._getTRTCLayout(t)};default:return null}},t.prototype._getCanvasSize=function(t,i){var o,r,n=((o={})[e.TRTCVideoResolution.TRTCVideoResolution_480_270]={width:480,height:270},o[e.TRTCVideoResolution.TRTCVideoResolution_640_360]={width:640,height:360},o[e.TRTCVideoResolution.TRTCVideoResolution_960_540]={width:960,height:540},o[e.TRTCVideoResolution.TRTCVideoResolution_1280_720]={width:1280,height:720},o[e.TRTCVideoResolution.TRTCVideoResolution_1920_1080]={width:1920,height:1080},o)[t],s=n.width,a=n.height;return i===e.TRTCVideoResolutionMode.TRTCVideoResolutionModePortrait&&(s=(r=[a,s])[0],a=r[1]),{width:s,height:a}},t.prototype.addMediaSource=function(t){var i;return f(this,void 0,Promise,(function(){var o,r,n,s,a,c,u,l,d;return v(this,(function(h){switch(h.label){case 0:if(-1!==this.findMediaSourceIndex(t))throw new Error("Media source already existed");if(o=Ee(t),r=this._getTRTCSourceKey(o),!(n=this._getTRTCSourceItem(o))||!r)throw new Error("Invalid media source");return(s=Ee(this.trtcSourceMap.get(r))||[]).push(n),[4,this.trtc.updatePlugin("VideoMixer",(d={},d[r]=s,d))];case 1:return a=h.sent(),c=a.result,u=a.systemAudioTrackList,t.type===e.TRTCMediaSourceType.kScreen&&(null==u?void 0:u[t.id])?(this.screensWithSystemAudio.add(t.id),l=null==u?void 0:u[t.id],this.logger.log("".concat(this.logPrefix," startPlugin AudioMixer, track ID:"),l.id),[4,this.trtc.startPlugin("AudioMixer",{id:"systemAudioTrack_".concat(t.id),track:l})]):[3,3];case 2:h.sent(),h.label=3;case 3:if(c.failedDetails.find((function(e){return e.id===t.id})))throw new Error("Failed to add media source");return o.isSelected&&(this.unselectMediaSource(this.selectedSource),this.selectedSource=t),this.trtcSourceMap.set(r,s),null===(i=this.mediaMixingDesigner)||void 0===i||i.addMedia({id:o.id,rect:this._getDesignerMediaRect(t),isSelected:!!Ce(o.isSelected)||o.isSelected,origin:o,interaction:o.interaction}),o.isSelected&&(this.selectedSource=o),this.sourceList.push(o),[2]}}))}))},t.prototype.removeMediaSource=function(t){var i,o,r;return f(this,void 0,Promise,(function(){var n,s,a,c,u,l;return v(this,(function(d){switch(d.label){case 0:if(this.logger.log("".concat(this.logPrefix,"removeMediaSource:"),t),-1===(n=this.findMediaSourceIndex(t)))throw new Error("Not existing media source to remove");return s=this._getTRTCSourceKey(t),a=Ee(this.trtcSourceMap.get(s))||[],c=a.findIndex((function(e){return e.id===t.id})),a.splice(c,1),[4,this.trtc.updatePlugin("VideoMixer",(l={},l[s]=a,l))];case 1:return u=d.sent().result,t.type===e.TRTCMediaSourceType.kScreen&&this.screensWithSystemAudio.has(t.id)?(this.screensWithSystemAudio.delete(t.id),[4,this.trtc.stopPlugin("AudioMixer",{id:"systemAudioTrack_".concat(t.id)})]):[3,3];case 2:d.sent(),d.label=3;case 3:if(u.failedDetails.find((function(e){return e.id===t.id})))throw new Error("Failed to remove media source");return null===(i=this.mediaMixingDesigner)||void 0===i||i.removeMedia({id:t.id,rect:null===(o=t.layout)||void 0===o?void 0:o.rect,isSelected:t.isSelected||!1,origin:Ee(t)}),(null===(r=this.selectedSource)||void 0===r?void 0:r.id)===t.id&&(this.selectedSource=null),this.trtcSourceMap.set(s,a),this.sourceList.splice(n,1),[2]}}))}))},t.prototype._getDesignerMediaRect=function(t){var i,o,r=(null===(i=t.layout)||void 0===i?void 0:i.rect)||{left:0,top:0,right:0,bottom:0},n=r.left,s=r.top,a=r.right,c=r.bottom,u=a-n,l=c-s;switch(null===(o=t.layout)||void 0===o?void 0:o.rotation){case e.TRTCVideoRotation.TRTCVideoRotation0:case e.TRTCVideoRotation.TRTCVideoRotation180:return{left:n,top:s,right:a,bottom:c};case e.TRTCVideoRotation.TRTCVideoRotation90:case e.TRTCVideoRotation.TRTCVideoRotation270:return{left:n,top:s,right:n+l,bottom:s+u};default:return{left:n,top:s,right:a,bottom:c}}},t.prototype._getPluginMediaRect=function(t){var i,o,r=(null===(i=t.layout)||void 0===i?void 0:i.rect)||{left:0,top:0,right:0,bottom:0},n=r.left,s=r.top,a=r.right,c=r.bottom;switch(null===(o=t.layout)||void 0===o?void 0:o.rotation){case e.TRTCVideoRotation.TRTCVideoRotation0:case e.TRTCVideoRotation.TRTCVideoRotation180:return{left:n,top:s,right:a,bottom:c};case e.TRTCVideoRotation.TRTCVideoRotation90:case e.TRTCVideoRotation.TRTCVideoRotation270:return{left:n,top:s,right:n+(c-s),bottom:s+(a-n)};default:return{left:n,top:s,right:a,bottom:c}}},t.prototype.updateMediaSource=function(e){var t,i;return f(this,void 0,Promise,(function(){var o,r,n,s,a,c,u,l;return v(this,(function(d){switch(d.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=p(p({},this.sourceList[o]),Ee(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=Ee(this.trtcSourceMap.get(n))||[],c=a.findIndex((function(t){return t.id===e.id})),a[c]=s,[4,this.trtc.updatePlugin("VideoMixer",(l={},l[n]=a,l))];case 1:if(d.sent().result.failedDetails.find((function(t){return t.id===e.id})))throw new Error("Failed to update media source");return u={id:e.id,rect:this._getDesignerMediaRect(e),isSelected:e.isSelected||!1,origin:Ee(e),interaction:r.interaction},this.logger.log("".concat(this.logPrefix,"updateParams:"),JSON.stringify(u)),null===(i=this.mediaMixingDesigner)||void 0===i||i.updateMedia(u),this.trtcSourceMap.set(n,a),this.sourceList[o]=r,[2]}}))}))},t.prototype.startPublish=function(t){var i;return f(this,void 0,Promise,(function(){var o;return v(this,(function(r){switch(r.label){case 0:return o=null!==(i=null==t?void 0:t.streamType)&&void 0!==i?i:e.TRTCVideoStreamType.TRTCVideoStreamTypeBig,this.publishStreamType=o,this.logger.log("".concat(this.logPrefix," startPublish, streamType:"),o),[4,this.trtcCloud._startPublishVideoTrack({videoTrack:this.mixVideoTrack,streamType:o})];case 1:return r.sent(),[2]}}))}))},t.prototype.stopPublish=function(){return f(this,void 0,Promise,(function(){return v(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(e){var t,i,o,r,n;return f(this,void 0,Promise,(function(){var s,a,c,l,d,h,p,T,f,g,m,y,C,_,b,S,M,w,E,A,V,P,L,I;return v(this,(function(v){switch(v.label){case 0:this.logger.log("".concat(this.logPrefix,"updatePublishParams:"),e),s=this.publishParams,this.publishParams=e,a=this._getCanvasSize(e.videoEncoderParams.videoResolution,e.videoEncoderParams.resMode),c=a.width,l=a.height,v.label=1;case 1:return v.trys.push([1,3,,4]),[4,this.trtc.updatePlugin("VideoMixer",{canvasInfo:{width:c,height:l,canvasColor:String(e.canvasColor)}})];case 2:return v.sent(),[3,4];case 3:if((d=v.sent()).code!==u.default.ERROR_CODE.OPERATION_ABORT)throw d;return[3,4];case 4:null===(o=this.mediaMixingDesigner)||void 0===o||o.updateOptions({videoResolution:this.publishParams.videoEncoderParams.videoResolution,resMode:this.publishParams.videoEncoderParams.resMode}),v.label=5;case 5:v.trys.push([5,11,12,17]),h=R(this.sourceList),v.label=6;case 6:return[4,h.next()];case 7:return(p=v.sent()).done?[3,10]:(T=p.value).layout?(f=T.layout.rect||{left:0,top:0,right:0,bottom:0},g=f.left,m=f.top,y=f.right,C=f.bottom,_=this._getCanvasSize(s.videoEncoderParams.videoResolution),b=_.width,S=_.height,M=this._getCanvasSize(e.videoEncoderParams.videoResolution),w=M.width,E=M.height,A=g*w/b,V=m*E/S,P=y*w/b,L=C*E/S,T.layout.rect={left:A,top:V,right:P,bottom:L},[4,this.updateMediaSource(T)]):[3,9];case 8:v.sent(),null===(r=this.eventEmitter)||void 0===r||r.emit("onSourceResized",T,null===(n=T.layout)||void 0===n?void 0:n.rect),v.label=9;case 9:return[3,6];case 10:return[3,17];case 11:return I=v.sent(),t={error:I},[3,17];case 12:return v.trys.push([12,,15,16]),p&&!p.done&&(i=h.return)?[4,i.call(h)]:[3,14];case 13:v.sent(),v.label=14;case 14:return[3,16];case 15:if(t)throw t.error;return[7];case 16:return[7];case 17:return[4,this.trtcCloud.setVideoEncoderParam(e.videoEncoderParams)];case 18:return v.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 t,i;this.view&&(this.mediaMixingDesigner=new Xn({view:this.view,videoResolution:(null===(t=this.publishParams)||void 0===t?void 0:t.videoEncoderParams.videoResolution)||e.TRTCVideoResolution.TRTCVideoResolution_1920_1080,resMode:(null===(i=this.publishParams)||void 0===i?void 0:i.videoEncoderParams.resMode)||e.TRTCVideoResolutionMode.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 f(this,void 0,void 0,(function(){return v(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(p(p({},e.origin),{isSelected:!0})),[3,3]):[3,1];case 1:return this.selectedSource?[4,this.updateMediaSource(p(p({},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=p(p({},e.origin),{layout:p(p({},e.origin.layout),{rect:t})});this.updateMediaSource(we(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=p(p({},e.origin),{layout:p(p({},e.origin.layout),{rect:t})});this.updateMediaSource(we(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 f(this,void 0,Promise,(function(){var o;return v(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:Ee(e)}),[2]):[2]}))}))},t.mediaMixingManager=null,t}();e.TRTCWhiteboardEvent=void 0,(e.TRTCWhiteboardEvent||(e.TRTCWhiteboardEvent={})).onSendWhiteboardCommand="onSendWhiteboardCommand";var Zn="Whiteboard",es=["pen","rect","ellipse","arrow","eraserObject"],ts=function(){function e(t){if(this.logPrefix="[TRTCWhiteboardManager]",this.eventEmitter=new L,this.delegate=null,this.started=!1,this.view=null,e.whiteboardManager)return e.whiteboardManager;e.whiteboardManager=this,this.logger=t.logger,this.trtc=t.trtc,this.trtcCloud=t.trtcCloud}return e.prototype.setDelegate=function(e){this.log("setDelegate:",!!e),this.delegate=e},e.prototype.onRecvWhiteboardCommand=function(e){return f(this,void 0,Promise,(function(){return v(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 f(this,void 0,Promise,(function(){var t,i,o,r,n,s;return v(this,(function(a){switch(a.label){case 0:t=this._resolveView(e.view_handle),this.view=t,i={},t&&(i.view=t),(o=this._buildToolGroup(e.tool))&&(i.tool=o),(r=this._buildConfigGroup(e.whiteboard))&&(i.config=r),(n=this._buildCanvasInfo(e.canvas))&&(i.canvasInfo=n),a.label=1;case 1:return a.trys.push([1,3,,4]),[4,this.trtc.startPlugin(Zn,i)];case 2:return a.sent(),this.started=!0,this.log("whiteboard started:",i),[3,4];case 3:throw s=a.sent(),this.logError("startPlugin Whiteboard error:",s),s;case 4:return[2]}}))}))},e.prototype._update=function(e){return f(this,void 0,Promise,(function(){var t,i,o,r,n;return v(this,(function(s){switch(s.label){case 0:if(t={},(i=this._buildToolGroup(e.tool))&&(t.tool=i),(o=this._buildConfigGroup(e.whiteboard))&&(t.config=o),(r=this._buildCanvasInfo(e.canvas))&&(t.canvasInfo=r),0===Object.keys(t).length)return[2];s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this.trtc.updatePlugin(Zn,t)];case 2:return s.sent(),this.log("whiteboard updated:",t),[3,4];case 3:throw n=s.sent(),this.logError("updatePlugin Whiteboard error:",n),n;case 4:return[2]}}))}))},e.prototype._stop=function(){return f(this,void 0,Promise,(function(){var e;return v(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(Zn)];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.view=null,[7];case 5:return[2]}}))}))},e.prototype._applyLocalOp=function(e){return f(this,void 0,Promise,(function(){var t,i;return v(this,(function(o){switch(o.label){case 0:if(!(t=this._opToOperation(e)))return[2];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,this.trtc.updatePlugin(Zn,{operation:t})];case 2:return o.sent(),this.log("whiteboard local op:",e,"-> operation:",t),[3,4];case 3:return i=o.sent(),this.logError("updatePlugin Whiteboard op error:",i),[3,4];case 4:return[2]}}))}))},e.prototype._applyRemoteCommand=function(e){return f(this,void 0,Promise,(function(){return v(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._buildToolGroup=function(e){if(e){var t={};e.type&&es.includes(e.type)&&(t.name=e.type);var i=this._normalizeColor(e.color);return i&&(t.color=i),"number"==typeof e.line_width&&(t.lineWidth=e.line_width),Object.keys(t).length>0?t:void 0}},e.prototype._buildConfigGroup=function(e){if(e&&"boolean"==typeof e.interactive)return{interactive:e.interactive}},e.prototype._buildCanvasInfo=function(e){if(e&&"number"==typeof e.width&&"number"==typeof e.height)return{width:e.width,height:e.height}},e.prototype._opToOperation=function(e){switch(e){case"undo":return"undo";case"redo":return"redo";case"clearall":case"clearself":return"clear";default:return null}},e.prototype._normalizeColor=function(e){if(null!=e){if("string"==typeof e)return e;if("number"==typeof e){var t=e>>>24&255,i=e>>>16&255,o=e>>>8&255,r=255&e,n=function(e){return e.toString(16).padStart(2,"0")};return t>0&&t<255?"rgba(".concat(i,", ").concat(o,", ").concat(r,", ").concat((t/255).toFixed(3),")"):"#".concat(n(i)).concat(n(o)).concat(n(r))}}},e.prototype._resolveView=function(e){return e?"string"==typeof e?document.getElementById(e):"number"==typeof e?(this.log("numeric view_handle is not supported on web, fallback to VideoMixer view"),null):e instanceof HTMLElement?e:null:null},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 f(this,void 0,Promise,(function(){return v(this,(function(i){switch(i.label){case 0:return this.log("destroy"),[4,this._stop()];case 1:return i.sent(),this.delegate=null,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,m([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,m([e,this.logPrefix],i,!1))},e.whiteboardManager=null,e}(),is=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=p(p({},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 c=[];this.queue=this.queue.filter((function(e,t){return 0===t||(e.functionName!==o||(c.push(e),!1))})),c.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}(),os=new WeakMap,rs=new WeakMap,ns=new WeakMap;function ss(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=ns.get(this)||new Map;ns.set(this,c);for(var u=null,l=0,d=s;l<d.length;l++){var h=d[l],p=c.get(h);if(p){u=p;break}}for(var T=u||new is,f=0,v=s;f<v.length;f++){h=v[f];c.set(h,T)}var g=a?o:void 0;return T.push({fn:n,args:t,context:this},!1,a,g)},r}}var as=function(){function e(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 e.prototype.registerStateListener=function(){this.trtc.on(u.default.EVENT.REALTIME_TRANSCRIBER_STATE_CHANGED,this.handleStateEvent)},e.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)}},e.prototype.updateMessageSubscription=function(){var e=!this.isPaused&&this.listeners.size>0;if(e&&!this.isMessageListenerRegistered)return this.trtc.on(u.default.EVENT.REALTIME_TRANSCRIBER_MESSAGE,this.handleMessageEvent),void(this.isMessageListenerRegistered=!0);!e&&this.isMessageListenerRegistered&&(this.trtc.off(u.default.EVENT.REALTIME_TRANSCRIBER_MESSAGE,this.handleMessageEvent),this.isMessageListenerRegistered=!1)},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,m([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,m([e,this.logPrefix],i,!1))},e.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)}}))},e.prototype.startRealtimeTranscriber=function(e){return f(this,void 0,Promise,(function(){var t,i,o;return v(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]}}))}))},e.prototype.stopRealtimeTranscriber=function(e){return f(this,void 0,Promise,(function(){var t;return v(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]}}))}))},e.prototype.pauseReceivingMessage=function(){this.isPaused||(this.log("pauseReceivingMessage"),this.isPaused=!0,this.updateMessageSubscription())},e.prototype.resumeReceivingMessage=function(){this.isPaused&&(this.log("resumeReceivingMessage"),this.isPaused=!1,this.updateMessageSubscription())},e.prototype.addListener=function(e){this.listeners.add(e),this.updateMessageSubscription()},e.prototype.removeListener=function(e){this.log("removeListener"),this.listeners.delete(e),this.updateMessageSubscription()},e.prototype.destroy=function(){this.log("destroy"),this.listeners.clear(),this.isPaused=!0,this.updateMessageSubscription(),this.trtc.off(u.default.EVENT.REALTIME_TRANSCRIBER_STATE_CHANGED,this.handleStateEvent)},e}(),cs=u.default._loggerManager;cs.info("TRTCCloud Version: ".concat(On));var us,ls,ds,hs="trtcCloud",ps=1;navigator&&navigator.mediaDevices&&navigator.mediaDevices.addEventListener&&navigator.mediaDevices.addEventListener("devicechange",(us=function(){0!==Ts.size&&Array.from(Ts.values()).forEach((function(e){e.fn()}))},ls=30,function(){for(var e=this,t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];ds>0&&clearTimeout(ds),ds=window.setTimeout((function(){us.apply(e,t),ds=-1}),ls)}));var Ts=new Map,fs=function(t){function s(o){void 0===o&&(o={});var r=t.call(this)||this;r._version="",r._frameWorkType=30,r._component=0,r._language=0,r._networkProxy={},r._localView=null,r._autoRecvAudio=!0,r._autoRecvVideo=!1,r._localTestView=null,r._isVideoPublish=!0,r._localRenderParams={rotation:e.TRTCVideoRotation.TRTCVideoRotation0,fillMode:e.TRTCVideoFillMode.TRTCVideoFillMode_Fill,mirrorType:e.TRTCVideoMirrorType.TRTCVideoMirrorType_Auto},r._encoderMirror=void 0,r._videoProfile={},r._isAudioPublish=!0,r._audioMuteType=!1,r._audioProfile=u.default.TYPE.AUDIO_PROFILE_STANDARD,r._captureVolume=100,r._playoutVolume=100,r._isSharingScreen=!1,r._remoteStreamConfig=new Map,r._remoteStreamMap=new Map,r._cameraList=[],r._microphoneList=[],r._speakerList=[],r._currentCamera={},r._currentMicrophone={},r._currentSpeaker={},r._currentCameraId="",r._currentMicrophoneId="",r._currentSpeakerId="",r._screenShareParams={option:{}},r._isMobile=Gr,r._isFrontCamera=!0,r._cameraVideoTrack=null,r._smallStreamVideoProfile=void 0,r._qosPreference=void 0,r._defaultVideoProfile={width:640,height:480,frameRate:15,bitrate:900},r._defaultScreenProfile={width:1920,height:1080,frameRate:15,bitrate:1500},r._defaultSmallVideoProfile={width:160,height:120,frameRate:15,bitrate:200},r._isVirtualBackground=!1,r._isTestVirtualBackground=!1,r._isBeautyEnabled=!1,r._isTestBeautyEnabled=!1,r._currentAudioQuality=e.TRTCAudioQuality.TRTCAudioQualityDefault,r._lastAudioScene=e.TRTCAudioSceneEx.default,r._isAIDenoiserEnabled=!1,r._currentAIDenoiserMode=void 0,r._pendingAIDenoiserApply=!1,r._remoteStatisticsUserIdList=[],r._hasJoinedRoom=!1,r._isExitingRoom=!1,r._version=On;var a=o.frameWorkType,c=void 0===a?30:a,h=o.component,p=void 0===h?0:h,T=o.language,f=void 0===T?0:T;return r._frameWorkType=c,r._component=p,r._language=f,r._trtc=u.default.create({enableSEI:s.enableSEI,assetsPath:s.assetsPath,enableVolumeControlInIOS:!0,plugins:[l.default,i.LEBPlayer,n.RealtimeTranscriber,d.default]}),r._testTrtc=u.default.create(),r._log=u.default._loggerManager,r.logger=new kn(cs,{seq:ps++}),r._echoCancellation=void 0,r._noiseSuppression=void 0,r._autoGainControl=void 0,r._addTRTCEvents(),r.handleDeviceChange=r.handleDeviceChange.bind(r),Ts.set(r,{fn:r.handleDeviceChange,self:r}),r}var a;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}h(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}(s,t),s.getPlugin=function(e){return"VirtualBackground"===e?o.VirtualBackground:"BasicBeauty"===e?r.BasicBeauty:"VideoMixer"===e?l.default:"Whiteboard"===e?d.default:null},s.getTRTCShareInstance=function(e){return s.shareInstance||(s.shareInstance=new s(e)),s.shareInstance},s.setLogLevel=function(t,i){var o,r=((o={})[e.TRTCLogLevel.TRTCLogLevelVerbose]=0,o[e.TRTCLogLevel.TRTCLogLevelDebug]=1,o[e.TRTCLogLevel.TRTCLogLevelInfo]=2,o[e.TRTCLogLevel.TRTCLogLevelWarn]=3,o[e.TRTCLogLevel.TRTCLogLevelError]=4,o[e.TRTCLogLevel.TRTCLogLevelFatal]=4,o[e.TRTCLogLevel.TRTCLogLevelNone]=5,o),n=r[t];Ce(n)&&(n=r[e.TRTCLogLevel.TRTCLogLevelInfo]);var s=!be(i)||i;u.default.setLogLevel(n,s)},s.destroyTRTCShareInstance=function(){s.shareInstance&&(s.shareInstance._destroy(),s.shareInstance=null),Array.from(s.subCloudMap.keys()).forEach((function(e){return e._destroy()}))},s.callExperimentalAPI=function(e){console.log("static ".concat(hs,".callExperimentalAPI"),e);var t=Se(e);if(t!==e){var i=t.api,o=t.params;if(i&&o)try{switch(i){case"enableSEI":s.enableSEI=o.enable;break;case"setAssetsPath":s.assetsPath=o.assetsPath}}catch(r){throw r}}},s.prototype.createSubCloud=function(){if(this!==s.shareInstance)return null;var e=new s;return this._inheritPropertiesToSubCloud(e),this._inheritEventsToSubCloud(e),s.subCloudMap.set(e,e),e},s.prototype.destroy=function(){this!==s.shareInstance?(s.subCloudMap.get(this)&&s.subCloudMap.delete(this),this._destroy()):s.destroyTRTCShareInstance()},s.prototype._destroy=function(){Ts.delete(this),this.removeAllListeners(),this._trtc.off("*"),this._trtc.destroy(),this._trtc=null,this._testTrtc.off("*"),this._testTrtc.destroy(),this._testTrtc=null},s.prototype.getSDKVersion=function(){return this._version||""},s.prototype.enterRoom=function(e,t){return f(this,void 0,Promise,(function(){var i,o,r,n,s,a,c,u,l,d,h,T,f,g,m,R,y,C,_=this;return v(this,(function(v){switch(v.label){case 0:if(i=e.sdkAppId,o=e.userId,r=e.userSig,n=e.roomId,s=e.strRoomId,a=e.role,c=e.privateMapKey,u=e.businessInfo,l=e.enableAutoPlayDialog,d=e.proxy,h=e.streamId,T=e.userDefineRecordId,this.logger.update({sdkAppId:i,userId:o}),this.logger.info("".concat(hs,".enterRoom with params: "),e,t),d&&(this._networkProxy=d),!(i&&o&&r))return[3,5];v.label=1;case 1:return v.trys.push([1,3,,4]),f={sdkAppId:i,userId:o,userSig:r,roomId:n,strRoomId:s,role:ge[a],scene:me[t],autoReceiveAudio:this._autoRecvAudio,autoReceiveVideo:this._autoRecvVideo,frameWorkType:this._frameWorkType,component:this._component,language:this._language},f=c?p(p({},f),{privateMapKey:c}):f,f=u?p(p({},f),{businessInfo:u}):f,g=l||this._enableAutoPlayDialog,f=be(g)?p(p({},f),{enableAutoPlayDialog:g}):f,f=this._networkProxy?p(p({},f),{proxy:this._networkProxy}):f,f=h?p(p({},f),{streamId:h}):f,f=T?p(p({},f),{userDefineRecordId:T}):f,f=void 0!==this._latencyLevel?p(p({},f),{latencyLevel:this._latencyLevel}):f,m=ye(),[4,this._trtc.enterRoom(f)];case 2:return v.sent(),this._hasJoinedRoom=!0,this._sdkAppId=i,this._userId=o,this._userSig=r,this._pendingAIDenoiserApply&&(this._pendingAIDenoiserApply=!1,this._applyAIDenoiserDecision().catch((function(e){_.logger.warn("".concat(hs,".enterRoom flush AI denoiser decision fail: "),e)}))),R=ye()-m,this.emit("onEnterRoom",R),[3,4];case 3:throw y=v.sent(),C=(C=this._transformTRTCErrorCode(y,"enterRoom"))<0?C:-1,this.emit("onEnterRoom",C),this._callFunctionErrorManage(y,"enterRoom"),y;case 4:return[3,6];case 5:this._emitError(In),v.label=6;case 6:return[2]}}))}))},s.prototype.exitRoom=function(){return f(this,void 0,Promise,(function(){var e;return v(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),this.logger.info("".concat(hs,".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",Tn.exitRoom),[3,3];case 2:throw e=t.sent(),this._callFunctionErrorManage(e,"exitRoom"),e;case 3:return[2]}}))}))},s.prototype.switchRole=function(e){return f(this,void 0,void 0,(function(){var t;return v(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(hs,".switchRole with param: "),e),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this._trtc.switchRole(ge[e])];case 2:return i.sent(),this.emit("onSwitchRole",0,"switch role success, role = ".concat(e,", ").concat(ge[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]}}))}))},s.prototype.setDefaultStreamRecvMode=function(e,t){return f(this,void 0,void 0,(function(){return v(this,(function(i){return this.logger.info("".concat(hs,".setDefaultStreamRecvMode with param: "),{autoRecvAudio:e,autoRecvVideo:t}),be(e)&&(this._autoRecvAudio=e),be(t)&&(this._autoRecvVideo=t),[2]}))}))},s.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=e.TRTCAudioQuality.TRTCAudioQualityDefault,this._lastAudioScene=e.TRTCAudioSceneEx.default,this._isAIDenoiserEnabled&&this._trtc)try{this._trtc.stopPlugin(Te)}catch(t){this.logger.warn("".concat(hs,".resetTRTCCloud stop AI denoiser fail: "),t)}this._isAIDenoiserEnabled=!1,this._currentAIDenoiserMode=void 0,this._pendingAIDenoiserApply=!1},s.prototype._updateLocalVideo=function(){return f(this,void 0,void 0,(function(){var e;return v(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this._trtc.updateLocalVideo(this._generateLocalVideoData())];case 1:return t.sent(),[3,3];case 2:if((e=t.sent()).code!==u.default.ERROR_CODE.OPERATION_ABORT)throw e;return[3,3];case 3:return[2]}}))}))},s.prototype._updateLocalTestVideo=function(){return f(this,void 0,void 0,(function(){var e;return v(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this._testTrtc.updateLocalVideo(this._generateLocalTestVideoData())];case 1:return t.sent(),[3,3];case 2:if((e=t.sent()).code!==u.default.ERROR_CODE.OPERATION_ABORT)throw e;return[3,3];case 3:return[2]}}))}))},s.prototype._updateLocalScreen=function(){return f(this,void 0,void 0,(function(){var e;return v(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this._trtc.updateScreenShare(this._getScreenShareParams())];case 1:return t.sent(),[3,3];case 2:if((e=t.sent()).code!==u.default.ERROR_CODE.OPERATION_ABORT)throw e;return[3,3];case 3:return[2]}}))}))},s.prototype._updateRemoteVideo=function(e,t){return f(this,void 0,void 0,(function(){var i;return v(this,(function(o){switch(o.label){case 0:if(!this._hasJoinedRoom||this._isExitingRoom)return[2];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,this._trtc.updateRemoteVideo(this._generateRemoteVideoData(e,t))];case 2:return o.sent(),[3,4];case 3:if((i=o.sent()).code!==u.default.ERROR_CODE.OPERATION_ABORT)throw i;return[3,4];case 4:return[2]}}))}))},s.prototype.startLocalPreview=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return f(this,void 0,Promise,(function(){var t,i,o,r,n;return v(this,(function(s){switch(s.label){case 0:this.logger.info("".concat(hs,".startLocalPreview with params: "),e),1===m([],e,!0).length?i=m([],e,!0)[0]:2===m([],e,!0).length&&(n=m([],e,!0),t=n[0],i=n[1]),Ce(t)||(this._setIsMobile(!0),this._setIsFrontCamera(t)),this._setLocalView(i),s.label=1;case 1:s.trys.push([1,9,,10]),s.label=2;case 2:return s.trys.push([2,4,,8]),[4,this._trtc.startLocalVideo(this._generateLocalVideoData())];case 3:return s.sent(),[3,8];case 4:return(o=s.sent()).code!==u.default.ERROR_CODE.OPERATION_ABORT?[3,6]:[4,this._updateLocalVideo()];case 5:return s.sent(),[3,7];case 6:throw o;case 7:return[3,8];case 8:return this.emit("onCameraDidReady"),[3,10];case 9:throw r=s.sent(),this._callFunctionErrorManage(r,"startLocalPreview"),r;case 10:return[2]}}))}))},s.prototype.updateLocalView=function(e){return f(this,void 0,void 0,(function(){return v(this,(function(t){switch(t.label){case 0:return this.logger.info("".concat(hs,".updateLocalView with param: "),e),this._setLocalView(e),[4,this._updateLocalVideo()];case 1:return t.sent(),[2]}}))}))},s.prototype.stopLocalPreview=function(){return f(this,void 0,void 0,(function(){var e;return v(this,(function(t){switch(t.label){case 0:this.logger.info("".concat(hs,".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(hs," stopLocalPreview error: ").concat(e)),this._callFunctionErrorManage(e,"stopLocalPreview"),e;case 4:return[2]}}))}))},s.prototype.muteLocalVideo=function(e){return void 0===e&&(e=!1),f(this,void 0,void 0,(function(){var t;return v(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(hs,".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]}}))}))},s.prototype.startRemoteView=function(t,i,o){return f(this,void 0,void 0,(function(){var r,n;return v(this,(function(s){switch(s.label){case 0:this.logger.info("".concat(hs,".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===e.TRTCVideoStreamType.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!==u.default.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]}}))}))},s.prototype.updateRemoteView=function(e,t,i){return f(this,void 0,void 0,(function(){return v(this,(function(o){switch(o.label){case 0:return this.logger.info("".concat(hs,".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]}}))}))},s.prototype.stopRemoteView=function(e,t){return f(this,void 0,void 0,(function(){var i;return v(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(hs,".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]}}))}))},s.prototype.stopAllRemoteView=function(){return f(this,void 0,void 0,(function(){var e;return v(this,(function(t){switch(t.label){case 0:this.logger.info("".concat(hs,".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]}}))}))},s.prototype.setVideoEncoderParam=function(t){return f(this,void 0,void 0,(function(){var i,o;return v(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(hs,".setVideoEncoderParam with params: "),t),r.label=1;case 1:return r.trys.push([1,4,,5]),i=this._getTRTCVideoProfile(e.TRTCVideoStreamType.TRTCVideoStreamTypeBig,t),this._setVideoProfile(i),[4,this._updateLocalVideo()];case 2:return r.sent(),[4,this._updateLocalTestVideo()];case 3:return r.sent(),[3,5];case 4:throw o=r.sent(),this._callFunctionErrorManage(o,"setVideoEncoderParam"),o;case 5:return[2]}}))}))},s.prototype.setNetworkQosParam=function(e){return f(this,void 0,void 0,(function(){var t,i,o=this;return v(this,(function(r){return this.logger.info("".concat(hs,".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)}))}))]}))}))},s.prototype.setLocalRenderParams=function(e){return f(this,void 0,void 0,(function(){var t;return v(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(hs,".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]}}))}))},s.prototype.setVideoEncoderMirror=function(e){return f(this,void 0,void 0,(function(){var t;return v(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(hs,".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]}}))}))},s.prototype.setRemoteRenderParams=function(e,t,i){return f(this,void 0,void 0,(function(){var o;return v(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(hs,".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]}}))}))},s.prototype._updateLocalAudio=function(){return f(this,void 0,void 0,(function(){var e;return v(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this._trtc.updateLocalAudio(this._generateLocalAudioData())];case 1:return t.sent(),[3,3];case 2:if((e=t.sent()).code!==u.default.ERROR_CODE.OPERATION_ABORT)throw e;return[3,3];case 3:return[2]}}))}))},s.prototype._updateLocalTestAudio=function(){return f(this,void 0,void 0,(function(){var e;return v(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this._testTrtc.updateLocalAudio(this._generateLocalTestAudioData())];case 1:return t.sent(),[3,3];case 2:if((e=t.sent()).code!==u.default.ERROR_CODE.OPERATION_ABORT)throw e;return[3,3];case 3:return[2]}}))}))},s.prototype.startLocalAudio=function(t){return void 0===t&&(t=e.TRTCAudioQuality.TRTCAudioQualityDefault),f(this,void 0,void 0,(function(){var i,o,r;return v(this,(function(n){switch(n.label){case 0:t===e.TRTCAudioQuality.TRTCAudioQualitySpeech?this.logger.warn("Web trtcCloud not support audioQuality of TRTCAudioQualitySpeech, and will use TRTCAudioQualityDefault"):this.logger.info("".concat(hs,".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!==u.default.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===e.TRTCAudioSceneEx.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(hs," startLocalAudio error: ").concat(r)),this._callFunctionErrorManage(r,"startLocalAudio"),r;case 12:return[2]}}))}))},s.prototype.stopLocalAudio=function(){return f(this,void 0,void 0,(function(){var e;return v(this,(function(t){switch(t.label){case 0:this.logger.info("".concat(hs,".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]}}))}))},s.prototype.muteLocalAudio=function(e){return void 0===e&&(e=!1),f(this,void 0,void 0,(function(){var t;return v(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(hs,".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]}}))}))},s.prototype.setAudioCaptureVolume=function(e){return f(this,void 0,void 0,(function(){var t;return v(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(hs,".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]}}))}))},s.prototype.getAudioCaptureVolume=function(){return this.logger.info("".concat(hs,".getAudioCaptureVolume")),this._getCaptureVolume()},s.prototype.setAudioPlayoutVolume=function(e){return f(this,void 0,void 0,(function(){var t;return v(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(hs,".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]}}))}))},s.prototype.getAudioPlayoutVolume=function(){return this.logger.info("".concat(hs,".getAudioPlayoutVolume")),this._playoutVolume},s.prototype.muteRemoteAudio=function(e,t){return void 0===t&&(t=!1),f(this,void 0,void 0,(function(){var i;return v(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(hs,".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(In),[2]);case 2:return o.sent(),[3,4];case 3:throw i=o.sent(),this._callFunctionErrorManage(i,"muteRemoteAudio"),i;case 4:return[2]}}))}))},s.prototype.muteAllRemoteAudio=function(e){this.logger.info("".concat(hs,".muteAllRemoteAudio with params: "),e);try{this._trtc.muteRemoteAudio("*",e)}catch(t){throw this._callFunctionErrorManage(t,"muteAllRemoteAudio"),t}},s.prototype.muteRemoteVideoStream=function(e,t,i){return f(this,void 0,void 0,(function(){var o;return v(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(hs,".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]}}))}))},s.prototype.muteAllRemoteVideoStreams=function(e){return f(this,void 0,void 0,(function(){var t;return v(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(hs,".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]}}))}))},s.prototype.setRemoteAudioVolume=function(e,t){this.logger.info("".concat(hs,".setRemoteAudioVolume with params: "),e,t);try{this._trtc.setRemoteAudioVolume(e,t)}catch(i){throw this._callFunctionErrorManage(i,"setRemoteAudioVolume"),i}},s.prototype.enableAudioVolumeEvaluation=function(e){this.logger.info("".concat(hs,".enableAudioVolumeEvaluation with params: "),e);try{this._trtc.enableAudioVolumeEvaluation(e)}catch(t){throw this._callFunctionErrorManage(t,"enableAudioVolumeEvaluation"),t}},s.prototype.enableSmallVideoStream=function(t,i){return f(this,void 0,Promise,(function(){var o;return v(this,(function(r){switch(r.label){case 0:return this.logger.info("".concat(hs,".enableSmallVideoStream with params: "),t,i),t?(o=this._getTRTCVideoProfile(e.TRTCVideoStreamType.TRTCVideoStreamTypeSmall,i),this._setSmallStreamVideoProfile(o)):this._setSmallStreamVideoProfile(void 0),[4,this._updateLocalVideo()];case 1:return r.sent(),[2]}}))}))},s.prototype.snapshotVideo=function(t,i){var o="";return o=""===t&&i===e.TRTCVideoStreamType.TRTCVideoStreamTypeBig?this._trtc.getVideoSnapshot():""===t&&i===e.TRTCVideoStreamType.TRTCVideoStreamTypeSub?this._trtc.getVideoSnapshot({streamType:this._getTRTCStreamType(i)}):this._trtc.getVideoSnapshot({userId:t,streamType:this._getTRTCStreamType(i)}),this.emit("onSnapshotComplete",t,i,o),o},s.prototype.startScreenShare=function(t,i,o){return f(this,void 0,void 0,(function(){var r,n,s,a,c,l;return v(this,(function(d){switch(d.label){case 0:this.logger.info("".concat(hs,".startScreenShare with params: "),t,i,o),d.label=1;case 1:return d.trys.push([1,3,,4]),n=(r=o||{}).screenAudio,s=void 0!==n&&n,a=r.videoTrack,c=this._getTRTCVideoProfile(e.TRTCVideoStreamType.TRTCVideoStreamTypeSub,o),this._setScreenShareParams({view:t,profile:c,systemAudio:s,videoTrack:a,streamType:i}),[4,this._trtc.startScreenShare(this._getScreenShareParams())];case 2:return d.sent(),this._isSharingScreen=!0,this.emit("onScreenCaptureStarted"),[3,4];case 3:if(l=d.sent(),this._callFunctionErrorManage(l,"startScreenShare"),l.code!==u.default.ERROR_CODE.OPERATION_ABORT)throw console.error("Start share screen error:",l,l.code,l.name,l.message),l;return[3,4];case 4:return[2]}}))}))},s.prototype.setSubStreamEncoderParam=function(t){return f(this,void 0,void 0,(function(){var i,o;return v(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(hs,".setSubStreamEncoderParam with params: "),t),i=this._getTRTCVideoProfile(e.TRTCVideoStreamType.TRTCVideoStreamTypeSub,t),this._setScreenShareParams({profile:i}),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this._updateLocalScreen()];case 2:return r.sent(),[3,4];case 3:throw o=r.sent(),this._callFunctionErrorManage(o,"setSubStreamEncoderParam"),o;case 4:return[2]}}))}))},s.prototype.stopScreenShare=function(){return f(this,void 0,Promise,(function(){var e;return v(this,(function(t){switch(t.label){case 0:this.logger.info("".concat(hs,".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]}}))}))},s.prototype._startPublishVideoTrack=function(t){var i=t.videoTrack,o=t.streamType,r=void 0===o?e.TRTCVideoStreamType.TRTCVideoStreamTypeBig:o;return f(this,void 0,void 0,(function(){var t,o,n,s;return v(this,(function(a){switch(a.label){case 0:if(r!==e.TRTCVideoStreamType.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:u.default.TYPE.STREAM_TYPE_SUB,option:{videoTrack:i}})];case 3:return a.sent(),[3,7];case 4:return(t=a.sent()).code!==u.default.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!==u.default.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]}}))}))},s.prototype._stopPublishVideoTrack=function(t){var i=(void 0===t?{}:t).streamType,o=void 0===i?e.TRTCVideoStreamType.TRTCVideoStreamTypeBig:i;return f(this,void 0,void 0,(function(){return v(this,(function(t){switch(t.label){case 0:return o!==e.TRTCVideoStreamType.TRTCVideoStreamTypeSub?[3,2]:[4,this._trtc.stopScreenShare()];case 1:case 3:return t.sent(),[2];case 2:return this._cameraVideoTrack=null,[4,this._trtc.stopLocalVideo()]}}))}))},s.prototype.startScreenCapture=function(){this._emitError(xn)},s.prototype.pauseScreenCapture=function(){this._emitError(xn)},s.prototype.resumeScreenCapture=function(){this._emitError(xn)},s.prototype.getScreenCaptureSources=function(){this._emitError(xn)},s.prototype.selectScreenCaptureTarget=function(){this._emitError(xn)},s.prototype.getCameraDevicesList=function(){return f(this,void 0,Promise,(function(){var e,t,i;return v(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(hs,".getCameraDevicesList")),o.label=1;case 1:return o.trys.push([1,5,,6]),[4,u.default.getCameraList()];case 2:return e=o.sent(),t=e.map((function(e){return p(p({},e),{deviceName:e.label})})),this._cameraList=e,"{}"!==JSON.stringify(this._currentCamera)?[3,4]:(this._currentCamera=this.getDefaultDeviceInfo(e),this._currentCameraId=this._currentCamera.deviceId,[4,this.setCurrentCameraDevice(this._currentCameraId)]);case 3:o.sent(),o.label=4;case 4:return[2,Promise.resolve(t)];case 5:return i=o.sent(),this._callFunctionErrorManage(i,"getCameraDevicesList"),[2,Promise.resolve([])];case 6:return[2]}}))}))},s.prototype.setCurrentCameraDevice=function(e){var t;return f(this,void 0,Promise,(function(){var i;return v(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(hs,".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]}}))}))},s.prototype.getCurrentCameraDevice=function(){this.logger.info("".concat(hs,".getCurrentCameraDevice"));var e=this._currentCamera,t=e.deviceId,i=e.label,o=e.kind,r=e.groupId;return new O(t,i,o,i,r)},s.prototype.isFrontCamera=function(){return this._getIsFrontCamera()},s.prototype.switchCamera=function(e){return f(this,void 0,void 0,(function(){return v(this,(function(t){switch(t.label){case 0:return this.logger.info("".concat(hs,".switchCamera with params: "),e),this._setIsFrontCamera(e),[4,this._updateLocalVideo()];case 1:return t.sent(),[4,this._updateLocalTestVideo()];case 2:return t.sent(),[2]}}))}))},s.prototype._onVirtualBackgroundError=function(e){this._emitError({code:-1006,message:e.message?e.message:"virtual background error"})},s.prototype.setVirtualBackground=function(e){return f(this,void 0,void 0,(function(){var t,i,o,r,n;return v(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!==fe?[3,2]:[4,this._trtc.updatePlugin(he,{type:i,blurLevel:o})]:[3,5]:[3,8];case 1:s.sent(),s.label=2;case 2:return i!==ve?[3,4]:[4,this._trtc.updatePlugin(he,{type:i,src:r})];case 3:s.sent(),s.label=4;case 4:return[3,7];case 5:return[4,this._trtc.startPlugin(he,p(p({},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(he),this._isVirtualBackground=!1,s.label=9;case 9:return[3,11];case 10:throw n=s.sent(),this.logger.error("".concat(hs,".setVirtualBackground fail: "),n),n;case 11:return[2]}}))}))},s.prototype.setTestVirtualBackground=function(e){return f(this,void 0,void 0,(function(){var t,i,o,r,n;return v(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!==fe?[3,2]:[4,this._testTrtc.updatePlugin(he,{type:i,blurLevel:o})]:[3,5]:[3,8];case 1:s.sent(),s.label=2;case 2:return i!==ve?[3,4]:[4,this._testTrtc.updatePlugin(he,{type:i,src:r})];case 3:s.sent(),s.label=4;case 4:return[3,7];case 5:return[4,this._testTrtc.startPlugin(he,p(p({},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(he),this._isTestVirtualBackground=!1,s.label=9;case 9:return[3,11];case 10:throw n=s.sent(),this.logger.error("".concat(hs,".setTestVirtualBackground fail: "),n),n;case 11:return[2]}}))}))},s.prototype.useVirtualBackground=function(e){return f(this,void 0,void 0,(function(){return v(this,(function(t){switch(t.label){case 0:return this._trtc?[4,this._trtc.use({plugin:o.VirtualBackground,assetsPath:e})]:[3,2];case 1:t.sent(),t.label=2;case 2:return this._testTrtc?[4,this._testTrtc.use({plugin:o.VirtualBackground,assetsPath:e})]:[3,4];case 3:t.sent(),t.label=4;case 4:return[2]}}))}))},s.prototype.setBeautyStyle=function(e,t,i,o){return f(this,void 0,void 0,(function(){return v(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]}}))}))},s.prototype.setTestBeautyStyle=function(e,t,i,o){return f(this,void 0,void 0,(function(){return v(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]}}))}))},s.prototype.useBeautyStyle=function(e){return f(this,void 0,void 0,(function(){return v(this,(function(t){switch(t.label){case 0:return this._trtc?[4,this._trtc.use({plugin:r.BasicBeauty,assetsPath:e})]:[3,2];case 1:t.sent(),t.label=2;case 2:return this._testTrtc?[4,this._testTrtc.use({plugin:r.BasicBeauty,assetsPath:e})]:[3,4];case 3:t.sent(),t.label=4;case 4:return[2]}}))}))},s.prototype._setAudioQualityEx=function(e){return f(this,void 0,void 0,(function(){var t;return v(this,(function(i){switch(i.label){case 0:return t=(e||{}).audioScene,_e(t)?(this.logger.info("".concat(hs,"._setAudioQualityEx audioScene=").concat(t)),this._lastAudioScene=t,[4,this._applyAIDenoiserDecision()]):(this.logger.warn("".concat(hs,"._setAudioQualityEx invalid audioScene: "),t),[2]);case 1:return i.sent(),[2]}}))}))},s.prototype._applyAIDenoiserDecision=function(){return f(this,void 0,void 0,(function(){var e,t,i,o,r;return v(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(hs,".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(Te)]:[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},s.assetsPath&&(o.assetsPath=s.assetsPath),[4,this._trtc.startPlugin(Te,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(Te,{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(hs,".applyAIDenoiserDecision fail: "),r),[3,10];case 10:return[2]}}))}))},s.prototype._resolveAIDenoiserMode=function(t,i){if(i!==e.TRTCAudioSceneEx.default&&t!==e.TRTCAudioQuality.TRTCAudioQualityMusic)return t===e.TRTCAudioQuality.TRTCAudioQualitySpeech?1:0},s.prototype._handleBeautyStyleParam=function(e,t,i,o,r,n,s){return f(this,void 0,void 0,(function(){var i,a,c,u,l;return v(this,(function(d){switch(d.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");d.label=1;case 1:return d.trys.push([1,8,,9]),a=r/9,c=n/9,0===(i=o/9)&&0===a&&0===c?[4,e.stopPlugin(pe)]:[3,3];case 2:return d.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(pe,u)];case 4:return d.sent(),s?this._isTestBeautyEnabled=!0:this._isBeautyEnabled=!0,[3,7];case 5:return[4,e.updatePlugin(pe,u)];case 6:d.sent(),d.label=7;case 7:return[3,9];case 8:throw l=d.sent(),s?this.logger.error("".concat(hs,".").concat("setTestBeautyStyle"," fail: "),l):this.logger.error("".concat(hs,".").concat("setBeautyStyle"," fail: "),l),l;case 9:return[2]}}))}))},s.prototype._resetBeautyStyle=function(){return f(this,void 0,void 0,(function(){return v(this,(function(e){switch(e.label){case 0:return this._isBeautyEnabled?[4,this._trtc.stopPlugin(pe)]:[3,2];case 1:e.sent(),this._isBeautyEnabled=!1,e.label=2;case 2:return this._isTestBeautyEnabled?[4,this._testTrtc.stopPlugin(pe)]:[3,4];case 3:e.sent(),this._isTestBeautyEnabled=!1,e.label=4;case 4:return[2]}}))}))},s.prototype.getMicDevicesList=function(){return f(this,void 0,Promise,(function(){var e,t,i;return v(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(hs,".getMicDevicesList")),o.label=1;case 1:return o.trys.push([1,5,,6]),[4,u.default.getMicrophoneList()];case 2:return e=o.sent(),t=e.map((function(e){return p(p({},e),{deviceName:e.label})})),this._microphoneList=e,"{}"!==JSON.stringify(this._currentMicrophone)?[3,4]:(this._currentMicrophone=this.getDefaultDeviceInfo(e),this._currentMicrophoneId=this._currentMicrophone.deviceId,[4,this.setCurrentMicDevice(this._currentMicrophoneId)]);case 3:o.sent(),o.label=4;case 4:return[2,Promise.resolve(t)];case 5:return i=o.sent(),this._callFunctionErrorManage(i,"getMicDevicesList"),[2,Promise.resolve([])];case 6:return[2]}}))}))},s.prototype.setCurrentMicDevice=function(e){var t;return f(this,void 0,Promise,(function(){var i;return v(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(hs,".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]}}))}))},s.prototype.getCurrentMicDevice=function(){this.logger.info("".concat(hs,".getCurrentMicDevice"));var e=this._currentMicrophone,t=e.deviceId,i=e.label,o=e.kind,r=e.groupId;return new O(t,i,o,i,r)},s.prototype.getSpeakerDevicesList=function(){return f(this,void 0,Promise,(function(){var e,t,i;return v(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(hs,".getSpeakerDevicesList")),o.label=1;case 1:return o.trys.push([1,5,,6]),[4,u.default.getSpeakerList()];case 2:return e=o.sent(),t=e.map((function(e){return p(p({},e),{deviceName:e.label})})),this._speakerList=e,"{}"!==JSON.stringify(this._currentSpeaker)?[3,4]:(this._currentSpeaker=this.getDefaultDeviceInfo(e),this._currentSpeakerId=this._currentSpeaker.deviceId,[4,this.setCurrentSpeakerDevice(this._currentSpeakerId)]);case 3:o.sent(),o.label=4;case 4:return[2,Promise.resolve(t)];case 5:return i=o.sent(),this._callFunctionErrorManage(i,"getSpeakerDevicesList"),[2,Promise.resolve([])];case 6:return[2]}}))}))},s.prototype.setCurrentSpeakerDevice=function(e){return f(this,void 0,Promise,(function(){var t;return v(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(hs,".setCurrentSpeakerDevice with params: "),{speakerId:e}),i.label=1;case 1:return i.trys.push([1,3,,4]),e?[4,u.default.setCurrentSpeaker(e)]:[2,!1];case 2:return i.sent(),this._setCurrentSpeakerId(e),this._currentSpeaker=this._speakerList.find((function(t){return t.deviceId===e}))||{},[3,4];case 3:throw t=i.sent(),this._callFunctionErrorManage(t,"setCurrentSpeakerDevice"),t;case 4:return[2]}}))}))},s.prototype.getCurrentSpeakerDevice=function(){this.logger.info("".concat(hs,".getCurrentSpeakerDevice"));var e=this._currentSpeaker,t=e.deviceId,i=e.label,o=e.kind,r=e.groupId;return new O(t,i,o,i,r)},s.prototype.startCameraDeviceTest=function(e){return f(this,void 0,void 0,(function(){var t;return v(this,(function(i){switch(i.label){case 0:if(this.logger.info("".concat(hs,".startCameraDeviceTest with params: "),e),!e)return[2];this._setLocalTestView(e),i.label=1;case 1:return i.trys.push([1,3,,7]),[4,this._testTrtc.startLocalVideo(this._generateLocalTestVideoData())];case 2:return i.sent(),[3,7];case 3:return(t=i.sent()).code!==u.default.ERROR_CODE.OPERATION_ABORT?[3,5]:[4,this._updateLocalTestVideo()];case 4:return i.sent(),[3,6];case 5:throw this._callFunctionErrorManage(t,"startCameraDeviceTest"),t;case 6:return[3,7];case 7:return[2]}}))}))},s.prototype.stopCameraDeviceTest=function(){return f(this,void 0,void 0,(function(){return v(this,(function(e){switch(e.label){case 0:return this.logger.info("".concat(hs,".stopCameraDeviceTest")),this._setLocalTestView(null),[4,this._testTrtc.stopLocalVideo()];case 1:return e.sent(),[2]}}))}))},s.prototype.startMicDeviceTest=function(e){return f(this,void 0,void 0,(function(){var t,i=this;return v(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(hs,".startMicDeviceTest with params: "),e),o.label=1;case 1:return o.trys.push([1,3,,7]),[4,this._testTrtc.startLocalAudio(this._generateLocalTestAudioData())];case 2:return o.sent(),[3,7];case 3:return(t=o.sent()).code!==u.default.ERROR_CODE.OPERATION_ABORT?[3,5]:[4,this._updateLocalTestAudio()];case 4:return o.sent(),[3,6];case 5:throw this._callFunctionErrorManage(t,"startMicDeviceTest"),t;case 6:return[3,7];case 7:return this._testTrtc.on(u.default.EVENT.AUDIO_VOLUME,(function(e){null==e||e.result.forEach((function(e){var t=e.userId,o=e.volume;""===t&&i.emit("onTestMicVolume",o)}))})),[4,this._testTrtc.enableAudioVolumeEvaluation(e)];case 8:return o.sent(),[2]}}))}))},s.prototype.stopMicDeviceTest=function(){return f(this,void 0,void 0,(function(){return v(this,(function(e){switch(e.label){case 0:return this.logger.info("".concat(hs,".stopMicDeviceTest")),[4,this._testTrtc.stopLocalAudio()];case 1:return e.sent(),[2]}}))}))},s.prototype.callExperimentalAPI=function(e){return f(this,void 0,void 0,(function(){var t,i,o;return v(this,(function(r){switch(r.label){case 0:if(this.logger.info("".concat(hs,".callExperimentalAPI"),e),(t=Se(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(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]}}))}))},s.prototype._handleSetFrameWork=function(e){var t=e.frameWork,i=e.component,o=e.language;_e(t)&&(this._frameWorkType=t),_e(i)&&(this._component=i),_e(o)&&(this._language=o)},s.prototype._handleKeyMetricsStats=function(e){var t=e.key,i=e.opt,o=e.value,r=e.version,n=i===Re;u.default._addKVStat({type:i,key:t,value:o,version:r,useUV:n,base:100})},s.prototype._setVideoEncodeParamEx=function(t){return f(this,void 0,void 0,(function(){return v(this,(function(i){switch(i.label){case 0:switch(t.streamType){case e.TRTCVideoStreamType.TRTCVideoStreamTypeBig:return[3,1];case e.TRTCVideoStreamType.TRTCVideoStreamTypeSub:return[3,3]}return[3,5];case 1:return[4,this.setVideoEncoderParam(t)];case 2:case 4:return i.sent(),[3,6];case 3:return[4,this.setSubStreamEncoderParam(t)];case 5:return[3,6];case 6:return[2]}}))}))},s.prototype._switchPlaybackQuality=function(e){return f(this,void 0,void 0,(function(){var t,i,o,r,n,s,a,c;return v(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})]:[2];case 1:return u.sent(),[2]}}))}))},s.prototype._requestPictureInPicture=function(){return f(this,void 0,void 0,(function(){return v(this,(function(e){switch(e.label){case 0:return this.logger.info("".concat(hs,"._requestPictureInPicture")),[4,this._trtc.callExperimentalAPI("requestPictureInPicture",{enable:!0})];case 1:return e.sent(),[2]}}))}))},s.prototype._exitPictureInPicture=function(){return f(this,void 0,void 0,(function(){return v(this,(function(e){switch(e.label){case 0:return this.logger.info("".concat(hs,"._exitPictureInPicture")),[4,this._trtc.callExperimentalAPI("requestPictureInPicture",{enable:!1})];case 1:return e.sent(),[2]}}))}))},s.prototype._emitError=function(e){e&&this.emit&&this.emit(ce,e.code,e.message)},s.prototype._emitWarning=function(e){this.emit&&this.emit(ue,e)},s.prototype._transformTRTCServerError=function(e){return-8===e.extraCode?Ln:0===String(e.extraCode).indexOf("70")?0-e.extraCode:void 0},s.prototype._transformTRTCInvalidOperationError=function(e,t){return"enterRoom"!==t||5104!==e.extraCode&&5998!==e.code?e.code:yn},s.prototype._isCameraError=function(e){return["startLocalPreview","updateLocalView","muteLocalVideo","setVideoEncoderParam","setCurrentCameraDevice","switchCamera","setLocalRenderParams","enableSmallVideoStream","startCameraDeviceTest"].includes(e)},s.prototype._isMicError=function(e){return["startLocalAudio","muteLocalAudio","setAudioCaptureVolume","setCurrentMicDevice","startMicDeviceTest"].includes(e)},s.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 Cn;if(o)return Mn;if(r)return Vn;break;case 5302:if(i)return _n;if(o)return wn;if(r)return Pn;break;case 5303:if(i)return Sn;if(o)return An;if(r)return Vn;break;case 5304:if(i)return bn;if(o)return En;if(r)return Vn}},s.prototype._transformTRTCUnKnowError=function(e,t){var i=this._isCameraError(t),o=this._isMicError(t);return i?Cn:o?Mn:e.code},s.prototype._transformTRTCErrorCode=function(e,t){var i=null==e?void 0:e.code;if(e&&e.code)switch(e.code){case u.default.ERROR_CODE.DEVICE_ERROR:i=this._transformTRTCDeviceError(e,t);break;case u.default.ERROR_CODE.SERVER_ERROR:i=this._transformTRTCServerError(e);break;case u.default.ERROR_CODE.INVALID_OPERATION:case u.default.ERROR_CODE.OPERATION_ABORT:i=this._transformTRTCInvalidOperationError(e,t);break;case u.default.ERROR_CODE.UNKNOWN_ERROR:i=this._transformTRTCUnKnowError(e,t)}return i},s.prototype._callFunctionErrorManage=function(e,t){if(!e||e.code!==u.default.ERROR_CODE.OPERATION_ABORT){this.logger.warn("(".concat(t,") failed - ").concat(e.code," - ").concat(e.message));var i=this._transformTRTCErrorCode(e,t),o=e.message;"startScreenShare"===t&&(o=JSON.stringify({name:e.originError.name,message:o})),this.emit(ce,i,o)}},s.prototype._getTRTCResolution=function(t){var i=(e.TRTCVideoResolution[t]||"").split("_");return{width:+(i.length>1&&i[1]),height:+(i.length>2&&i[2])}},s.prototype._getTRTCVideoProfile=function(t,i){void 0===i&&(i={});var o=i.videoWidth,r=i.videoHeight,n=i.videoResolution,s=i.videoFps,a=i.videoBitrate,c=i.resMode,u=i.resolutionMode,l={};switch(t){case e.TRTCVideoStreamType.TRTCVideoStreamTypeSub:l=this._defaultScreenProfile;break;case e.TRTCVideoStreamType.TRTCVideoStreamTypeSmall:l=this._defaultSmallVideoProfile;break;case e.TRTCVideoStreamType.TRTCVideoStreamTypeBig:default:l=this._defaultVideoProfile}if(Ce(n))Ce(o)||(l.width=o),Ce(r)||(l.height=r);else{var d=this._getTRTCResolution(n);l.width=d.width,l.height=d.height}if(!Ce(c)&&c===e.TRTCVideoResolutionMode.TRTCVideoResolutionModePortrait||!Ce(u)&&u===e.TRTCVideoResolutionMode.TRTCVideoResolutionModePortrait){var h=l.height,p=l.width;l.width=h,l.height=p}return s&&(l.frameRate=s),a&&(l.bitrate=a),l},s.prototype._getTRTCStreamType=function(t){var i;return((i={})[e.TRTCVideoStreamType.TRTCVideoStreamTypeBig]=u.default.TYPE.STREAM_TYPE_MAIN,i[e.TRTCVideoStreamType.TRTCVideoStreamTypeSmall]=u.default.TYPE.STREAM_TYPE_MAIN,i[e.TRTCVideoStreamType.TRTCVideoStreamTypeSub]=u.default.TYPE.STREAM_TYPE_SUB,i)[t]},s.prototype._getTRTCFillMode=function(t){var i;return((i={})[e.TRTCVideoFillMode.TRTCVideoFillMode_Fill]=pn.COVER,i[e.TRTCVideoFillMode.TRTCVideoFillMode_Fit]=pn.CONTAIN,i)[t]},s.prototype._getTRTCCloudVideoFillMode=function(t){var i;return((i={})[pn.COVER]=e.TRTCVideoFillMode.TRTCVideoFillMode_Fill,i[pn.CONTAIN]=e.TRTCVideoFillMode.TRTCVideoFillMode_Fit,i)[t]},s.prototype._getTRTCCloudMirrorType=function(t){return!0===t?e.TRTCVideoMirrorType.TRTCVideoMirrorType_Enable:e.TRTCVideoMirrorType.TRTCVideoMirrorType_Disable},s.prototype._getLocalRenderMirror=function(t){var i;return t===e.TRTCVideoMirrorType.TRTCVideoMirrorType_Auto?!this._getIsMobile()||this._getIsFrontCamera():((i={})[e.TRTCVideoMirrorType.TRTCVideoMirrorType_Enable]=!0,i[e.TRTCVideoMirrorType.TRTCVideoMirrorType_Disable]=!1,i)[t]},s.prototype._getTRTCLocalMirror=function(e,t){var i=this._getLocalRenderMirror(e);return Ce(t)?!!i&&"both":i&&t?"both":i&&!t?"view":!i&&t?"publish":!(!i&&!t)&&"view"},s.prototype._getTRTCRemoteMirror=function(t){var i;return((i={})[e.TRTCVideoMirrorType.TRTCVideoMirrorType_Auto]=!1,i[e.TRTCVideoMirrorType.TRTCVideoMirrorType_Enable]=!0,i[e.TRTCVideoMirrorType.TRTCVideoMirrorType_Disable]=!1,i)[t]},s.prototype._getTRTCQosPreference=function(t){var i;return((i={})[e.TRTCVideoQosPreference.TRTCVideoQosPreferenceSmooth]=u.default.TYPE.QOS_PREFERENCE_SMOOTH,i[e.TRTCVideoQosPreference.TRTCVideoQosPreferenceClear]=u.default.TYPE.QOS_PREFERENCE_CLEAR,i)[t]},s.prototype._getTRTCAudioQuality=function(t){var i;return((i={})[e.TRTCAudioQuality.TRTCAudioQualitySpeech]=u.default.TYPE.AUDIO_PROFILE_STANDARD,i[e.TRTCAudioQuality.TRTCAudioQualityDefault]=u.default.TYPE.AUDIO_PROFILE_STANDARD,i[e.TRTCAudioQuality.TRTCAudioQualityMusic]=u.default.TYPE.AUDIO_PROFILE_HIGH_STEREO,i)[t]},s.prototype._getTRTCCloudDeviceType=function(t){return{camera:e.TRTCDeviceType.TRTCDeviceTypeCamera,microphone:e.TRTCDeviceType.TRTCDeviceTypeMic,speaker:e.TRTCDeviceType.TRTCDeviceTypeSpeaker}[t]},s.prototype._getTRTCCloudDeviceState=function(t){return{add:e.TRTCDeviceState.TRTCDeviceStateAdd,remove:e.TRTCDeviceState.TRTCDeviceStateRemove,active:e.TRTCDeviceState.TRTCDeviceStateActive}[t]},s.prototype._getTRTCCloudQuality=function(t){return[e.TRTCQuality.TRTCQuality_Unknown,e.TRTCQuality.TRTCQuality_Excellent,e.TRTCQuality.TRTCQuality_Good,e.TRTCQuality.TRTCQuality_Poor,e.TRTCQuality.TRTCQuality_Bad,e.TRTCQuality.TRTCQuality_Vbad,e.TRTCQuality.TRTCQuality_Down][t]},s.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},s.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},s.prototype._generateLocalAudioData=function(){var e={publish:this._getIsAudioPublish(),mute:this._getAudioMuteType(),muteKeepVolumeDetection:!0,option:{microphoneId:this._getCurrentMicrophoneId(),profile:this._getAudioProfile(),captureVolume:this._getCaptureVolume()}};return be(this._echoCancellation)&&(e.option.echoCancellation=this._echoCancellation),be(this._autoGainControl)&&(e.option.autoGainControl=this._autoGainControl),be(this._noiseSuppression)&&(e.option.noiseSuppression=this._noiseSuppression),e},s.prototype._generateLocalTestAudioData=function(){return{publish:!1,option:{microphoneId:this._getCurrentMicrophoneId(),profile:this._getAudioProfile()}}},s.prototype._generateRemoteVideoData=function(e,t){return Ee(this._remoteStreamConfig.get("".concat(e,"_").concat(this._getTRTCStreamType(t))))},s.prototype._addTRTCEvents=function(){var t=this;this._trtc.on(u.default.EVENT.ERROR,(function(e){e&&t.emit("onError",e.code,e.message)})),this._trtc.on(u.default.EVENT.REMOTE_USER_ENTER,(function(e){(null==e?void 0:e.userId)&&t.emit("onRemoteUserEnterRoom",e.userId)})),this._trtc.on(u.default.EVENT.REMOTE_USER_EXIT,(function(e){(null==e?void 0:e.userId)&&t.emit("onRemoteUserLeaveRoom",e.userId)})),this._trtc.on(u.default.EVENT.REMOTE_AUDIO_AVAILABLE,(function(e){(null==e?void 0:e.userId)&&t.emit("onUserAudioAvailable",e.userId,!0)})),this._trtc.on(u.default.EVENT.REMOTE_AUDIO_UNAVAILABLE,(function(e){(null==e?void 0:e.userId)&&t.emit("onUserAudioAvailable",e.userId,!1)})),this._trtc.on(u.default.EVENT.REMOTE_VIDEO_AVAILABLE,(function(e){t._emitVideoAvailable(e,!0)})),this._trtc.on(u.default.EVENT.REMOTE_VIDEO_UNAVAILABLE,(function(e){t._emitVideoAvailable(e,!1)})),this._trtc.on(u.default.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(u.default.EVENT.KICKED_OUT,(function(e){var i={banned:Tn.banned,room_disband:Tn.roomDisband};_e(i[e.reason])&&t.emit("onExitRoom",i[e.reason])})),this._trtc.on(u.default.EVENT.NETWORK_QUALITY,(function(e){var i=e.uplinkNetworkQuality,o=e.downlinkNetworkQuality,r=new H("",t._getTRTCCloudQuality(i)),n=[];t._remoteStatisticsUserIdList.length>0&&(n=t._remoteStatisticsUserIdList.map((function(e){return new H(e,t._getTRTCCloudQuality(o))}))),t.emit("onNetworkQuality",r,n)})),this._trtc.on(u.default.EVENT.AUTOPLAY_FAILED,(function(e){t.emit("onAutoPlayFailed",e)})),this._trtc.on(u.default.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(u.default.EVENT.STATISTICS,(function(i){var o,r=i.rtt,n=i.upLoss,s=i.downLoss,a=i.bytesSent,c=i.bytesReceived,u=i.localStatistics,l=i.remoteStatistics;t._remoteStatisticsUserIdList=l.map((function(e){return e.userId}));var d={big:e.TRTCVideoStreamType.TRTCVideoStreamTypeBig,small:e.TRTCVideoStreamType.TRTCVideoStreamTypeSmall,sub:e.TRTCVideoStreamType.TRTCVideoStreamTypeSub},h=(null===(o=u.video)||void 0===o?void 0:o.length)>0?u.video.map((function(e){var t=new q;return t.width=e.width,t.height=e.height,t.frameRate=e.frameRate,t.videoBitrate=e.bitrate,t.audioBitrate=u.audio.bitrate||0,t.streamType=d[e.videoType],t})):[];if(0===h.length&&u.audio.bitrate>0){var p=new q;p.audioBitrate=u.audio.bitrate||0,h.push(p)}var T=[];l.forEach((function(e){var t=[],i=e.userId,o=e.audio.bitrate;if(e.video&&e.video.forEach((function(e){var r=new G;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=d[e.videoType],t.push(r)})),0===t.length){var r=new G;r.userId=i,r.audioBitrate=o||0,t.push(r)}T.push.apply(T,t)}));var f=new Y;f.upLoss=n,f.downLoss=s,f.rtt=r,f.sentBytes=a,f.receivedBytes=c,f.localStatisticsArray=h,f.localStatisticsArraySize=h.length,f.remoteStatisticsArray=T,f.remoteStatisticsArraySize=T.length,t.emit("onStatistics",f)})),this._trtc.on(u.default.EVENT.SCREEN_SHARE_STOPPED,(function(){t.emit("onScreenCaptureStopped",0),t._clearScreenShareParams(),t._isSharingScreen=!1})),this._trtc.on(u.default.EVENT.PUBLISH_STATE_CHANGED,(function(i){var o=i.mediaType;"started"===i.state&&("audio"===o?t.emit("onSendFirstLocalAudioFrame"):"video"===o?t.emit("onSendFirstLocalVideoFrame",e.TRTCVideoStreamType.TRTCVideoStreamTypeBig):"screen"===o&&t.emit("onSendFirstLocalVideoFrame",e.TRTCVideoStreamType.TRTCVideoStreamTypeSub))})),this._trtc.on(u.default.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(u.default.EVENT.AUDIO_PLAY_STATE_CHANGED,(function(e){var i=e.userId;"PLAYING"===e.state&&t.emit("onFirstAudioFrame",i)})),this._trtc.on(u.default.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(u.default.EVENT.CUSTOM_MESSAGE,(function(e){e&&t.emit("onRecvCustomCmdMsg",e.userId,e.cmdId,e.seq,null==e?void 0:e.data)})),this._trtc.on(u.default.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(u.default.EVENT.PICTURE_IN_PICTURE_STATE_CHANGED,(function(e){t.emit("onPictureInPictureStateChanged",e)}))},s.prototype._removeTRTCEvents=function(){this._trtc.off("*")},s.prototype._emitVideoAvailable=function(e,t){var i=e.userId,o=e.streamType;t?this._remoteStreamMap.set("".concat(i,"_").concat(o),!0):this._remoteStreamMap.delete("".concat(i,"_").concat(o)),o===u.default.TYPE.STREAM_TYPE_SUB?i&&this.emit("onUserSubStreamAvailable",i,t):i&&this.emit("onUserVideoAvailable",i,t)},s.prototype._setLocalView=function(e){this._localView=e},s.prototype._getLocalView=function(){return this._localView},s.prototype._setIsMobile=function(e){this._isMobile=e},s.prototype._getIsMobile=function(){return this._isMobile},s.prototype._setIsFrontCamera=function(e){this._isFrontCamera=e},s.prototype._getIsFrontCamera=function(){return this._isFrontCamera},s.prototype._getSmallStreamVideoProfile=function(){return this._smallStreamVideoProfile},s.prototype._setSmallStreamVideoProfile=function(e){this._smallStreamVideoProfile=e},s.prototype._setIsVideoPublish=function(e){this._isVideoPublish=e},s.prototype._getIsVideoPublish=function(){return this._isVideoPublish},s.prototype._setVideoProfile=function(e){this._videoProfile=e},s.prototype._getVideoProfile=function(){return this._videoProfile},s.prototype._setQosPreference=function(e){this._qosPreference=e},s.prototype._getQosPreference=function(){return this._qosPreference},s.prototype._setLocalTestView=function(e){this._localTestView=e},s.prototype._getLocalTestView=function(){return this._localTestView},s.prototype._setScreenShareParams=function(e){var t=e.view,i=e.systemAudio,o=e.fillMode,r=e.profile,n=e.videoTrack,s=e.qosPreference;Ce(t)||(this._screenShareParams.view=t),Ce(i)||(this._screenShareParams.option.systemAudio=i),Ce(o)||(this._screenShareParams.option.fillMode=o),Ce(r)||(this._screenShareParams.option.profile=r),Ce(n)||(this._screenShareParams.option.videoTrack=n),Ce(s)||(this._screenShareParams.option.qosPreference=s),Ce(e.streamType)||(this._screenShareParams.streamType=this._getTRTCStreamType(e.streamType))},s.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},s.prototype._getScreenShareParams=function(){return this._screenShareParams},s.prototype._setIsAudioPublish=function(e){this._isAudioPublish=e},s.prototype._getIsAudioPublish=function(){return this._isAudioPublish},s.prototype._setAudioMuteType=function(e){this._audioMuteType=e},s.prototype._getAudioMuteType=function(){return this._audioMuteType},s.prototype._setAudioProfile=function(e){this._audioProfile=e},s.prototype._getAudioProfile=function(){return this._audioProfile},s.prototype._getCaptureVolume=function(){return this._captureVolume},s.prototype._setCaptureVolume=function(e){this._captureVolume=e},s.prototype._setCurrentCameraId=function(e){this._currentCameraId=e},s.prototype._getCurrentCameraId=function(){return this._currentCameraId},s.prototype._setCurrentMicrophoneId=function(e){this._currentMicrophoneId=e},s.prototype._getCurrentMicrophoneId=function(){return this._currentMicrophoneId},s.prototype._setCurrentSpeakerId=function(e){this._currentSpeakerId=e},s.prototype._getCurrentSpeakerId=function(){return this._currentSpeakerId},s.prototype._setRemoteStreamConfig=function(t,i,o){var r=this._remoteStreamConfig.get("".concat(t,"_").concat(this._getTRTCStreamType(i)));r||(r={userId:t,streamType:this._getTRTCStreamType(i),option:{mirror:this._getTRTCRemoteMirror(e.TRTCVideoMirrorType.TRTCVideoMirrorType_Disable),fillMode:this._getTRTCFillMode(e.TRTCVideoFillMode.TRTCVideoFillMode_Fit)}});var n=o.view,s=o.mirrorType,a=o.fillMode,c=o.small;Ce(n)||(r.view=n),Ce(s)||(r.option.mirror=this._getTRTCRemoteMirror(s)),Ce(a)||(r.option.fillMode=this._getTRTCFillMode(a)),Ce(c)||(r.option.small=c),this._remoteStreamConfig.set("".concat(t,"_").concat(this._getTRTCStreamType(i)),r)},s.prototype._inheritPropertiesToSubCloud=function(e){e._frameWorkType=this._frameWorkType,e._component=this._component,e._language=this._language,e._networkProxy=p({},this._networkProxy),e._latencyLevel=this._latencyLevel,e._enableAutoPlayDialog=this._enableAutoPlayDialog},s.prototype._inheritEventsToSubCloud=function(e){var t=this;e._trtc.on(u.default.EVENT.AUTOPLAY_FAILED,(function(e){t.emit("onAutoPlayFailed",e)})),e._trtc.on(u.default.EVENT.PICTURE_IN_PICTURE_STATE_CHANGED,(function(e){t.emit("onPictureInPictureStateChanged",e)}))},s.prototype.handleDeviceChange=function(){return f(this,void 0,void 0,(function(){var t=this;return v(this,(function(i){return u.default.getCameraList().then((function(i){return f(t,void 0,void 0,(function(){return v(this,(function(t){switch(t.label){case 0:return this._cameraList.length===i.length?[2]:[4,this.deviceChangeManage(this._cameraList,i,e.TRTCDeviceType.TRTCDeviceTypeCamera)];case 1:return t.sent(),this._cameraList=i,[2]}}))}))})),u.default.getMicrophoneList().then((function(i){return f(t,void 0,void 0,(function(){return v(this,(function(t){switch(t.label){case 0:return[4,this.deviceChangeManage(this._microphoneList,i,e.TRTCDeviceType.TRTCDeviceTypeMic)];case 1:return t.sent(),this._microphoneList=i,[2]}}))}))})),u.default.getSpeakerList().then((function(i){return f(t,void 0,void 0,(function(){return v(this,(function(t){switch(t.label){case 0:return[4,this.deviceChangeManage(this._speakerList,i,e.TRTCDeviceType.TRTCDeviceTypeSpeaker)];case 1:return t.sent(),this._speakerList=i,[2]}}))}))})),[2]}))}))},s.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)},s.prototype.deviceChangeManage=function(t,i,o){return f(this,void 0,void 0,(function(){var r,n,s,a,c;return v(this,(function(u){switch(u.label){case 0:return r=void 0,t.length!==i.length&&(n=(i||[]).map((function(e){return e.deviceId})),s=new O,t.length>i.length?(s=t.filter((function(e){return!n.includes(e.deviceId)}))[0]||{},r=e.TRTCDeviceState.TRTCDeviceStateRemove):(n=(t||[]).map((function(e){return e.deviceId})),s=i.filter((function(e){return!n.includes(e.deviceId)}))[0]||{},r=e.TRTCDeviceState.TRTCDeviceStateAdd),a=s.deviceId,this.emitOnDeviceChange(a,o,r)),c=this.getDefaultDeviceInfo(i),o!==e.TRTCDeviceType.TRTCDeviceTypeCamera||r!==e.TRTCDeviceState.TRTCDeviceStateRemove?[3,3]:this.isSameDevice(this._currentCamera,c)?[2]:c.deviceId?[4,this.autoChangeDevice(o,c)]:[3,2];case 1:u.sent(),u.label=2;case 2:u.label=3;case 3:return o!==e.TRTCDeviceType.TRTCDeviceTypeMic?[3,6]:this.isSameDevice(this._currentMicrophone,c)?[2]:c.deviceId?[4,this.autoChangeDevice(o,c)]:[3,5];case 4:u.sent(),u.label=5;case 5:u.label=6;case 6:return o!==e.TRTCDeviceType.TRTCDeviceTypeSpeaker?[3,9]:this.isSameDevice(this._currentSpeaker,c)?[2]:c.deviceId?[4,this.autoChangeDevice(o,c)]:[3,8];case 7:u.sent(),u.label=8;case 8:u.label=9;case 9:return[2]}}))}))},s.prototype.getDefaultDeviceInfo=function(e){var t=new O;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]},s.prototype.autoChangeDevice=function(t,i){return f(this,void 0,void 0,(function(){var o,r,n;return v(this,(function(s){switch(s.label){case 0:return o=i.deviceId,t!==e.TRTCDeviceType.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,u.default.ERROR_CODE.OPERATION_ABORT,[3,5];case 5:this._currentCameraId=o,this._currentCamera=i,this.emitOnDeviceChange(o,t,e.TRTCDeviceState.TRTCDeviceStateActive),s.label=6;case 6:return t!==e.TRTCDeviceType.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,u.default.ERROR_CODE.OPERATION_ABORT,[3,11];case 11:this._currentMicrophoneId=o,this._currentMicrophone=i,this.emitOnDeviceChange(o,t,e.TRTCDeviceState.TRTCDeviceStateActive),s.label=12;case 12:return t!==e.TRTCDeviceType.TRTCDeviceTypeSpeaker?[3,14]:[4,u.default.setCurrentSpeaker(o)];case 13:s.sent(),this._currentSpeakerId=o,this._currentSpeaker=i,this.emitOnDeviceChange(o,t,e.TRTCDeviceState.TRTCDeviceStateActive),s.label=14;case 14:return[2]}}))}))},s.prototype.emitOnDeviceChange=function(e,t,i){this.emit("onDeviceChange",e,t,i)},s.prototype.getMediaMixingManager=function(){return new $n({logger:this.logger,trtc:this._trtc,trtcCloud:this})},s.prototype.getWhiteboardManager=function(){return new ts({logger:this.logger,trtc:this._trtc,trtcCloud:this})},s.prototype.getAITranscriberManager=function(){return new as({logger:this.logger,trtc:this._trtc})},s.shareInstance=null,s.subCloudMap=new Map,s.enableSEI=!1,s.assetsPath="",T([(a="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 c=[];return null===(t=null===(e=os.get(this))||void 0===e?void 0:e.queue)||void 0===t||t.forEach((function(e){return c.push(e)})),null===(i=rs.get(this))||void 0===i||i.forEach((function(e){return null==e?void 0:e.queue.forEach((function(e){return c.push(e)}))})),null===(r=ns.get(this))||void 0===r||r.forEach((function(e){return null==e?void 0:e.queue.forEach((function(e){return c.push(e)}))})),c.forEach((function(e){e.reject(new Error("aborted ".concat(a)))})),os.delete(this),rs.delete(this),ns.delete(this),o.apply(this,n)},i})],s.prototype,"exitRoom",null),T([ss((function(e){return e}))],s.prototype,"muteRemoteAudio",null),T([ss((function(e){return e}))],s.prototype,"muteRemoteVideoStream",null),T([ss((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})],s.prototype,"_switchPlaybackQuality",null),s}(L);e.AITranscriberListener=undefined,e.AudioMuteType=undefined,e.IAITranscriberManager=undefined,e.ITRTCMediaMixingEvent=undefined,e.ITRTCMediaMixingManager=undefined,e.ITRTCWhiteboardManager=undefined,e.InteractionOption=undefined,e.Rect=te,e.TRTCCameraCaptureParams=undefined,e.TRTCDeviceInfo=O,e.TRTCImageBuffer=$,e.TRTCLocalStatistics=q,e.TRTCMediaMixingEncParam=undefined,e.TRTCMediaSource=undefined,e.TRTCMixUser=ne,e.TRTCNetworkQosParam=X,e.TRTCParams=k,e.TRTCPublishCDNParam=U,e.TRTCQualityInfo=H,e.TRTCRemoteStatistics=G,e.TRTCRenderParams=F,e.TRTCScreenCaptureProperty=ae,e.TRTCScreenCaptureSourceInfo=ee,e.TRTCStatistics=Y,e.TRTCTranscodingConfig=ie,e.TRTCVideoEncParam=B,e.TRTCVolumeInfo=j,e.TranscriberMessage=undefined,e.TranscriberParams=undefined,e.WhiteboardCanvasInfo=undefined,e.WhiteboardDelegate=undefined,e.WhiteboardRecvCommand=undefined,e.WhiteboardSendPayload=undefined,e.WhiteboardToolConfig=undefined,e.default=fs,Object.defineProperty(e,"__esModule",{value:!0})}));