7 lines
230 KiB
JavaScript
7 lines
230 KiB
JavaScript
import{r as ye}from"./trtc-js-sdk-DYM4KK88.js";import{r as Ae}from"./rtc-ai-denoiser-V2uN2Ltv.js";import{r as De}from"./tim-js-sdk-D6E6n_Uo.js";import{r as Re}from"./tsignaling-LowdXh8I.js";var ge={exports:{}},Ie;function Le(){return Ie||(Ie=1,function(Ce,Se){(function(Ee,_e){Ce.exports=_e(ye(),Ae(),De(),Re())})(window,function(Ee,_e,me,Te){return function(F){var u={};function r(s){if(u[s])return u[s].exports;var i=u[s]={i:s,l:!1,exports:{}};return F[s].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=F,r.c=u,r.d=function(s,i,o){r.o(s,i)||Object.defineProperty(s,i,{enumerable:!0,get:o})},r.r=function(s){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(s,"__esModule",{value:!0})},r.t=function(s,i){if(1&i&&(s=r(s)),8&i||4&i&&typeof s=="object"&&s&&s.__esModule)return s;var o=Object.create(null);if(r.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:s}),2&i&&typeof s!="string")for(var S in s)r.d(o,S,(function(P){return s[P]}).bind(null,S));return o},r.n=function(s){var i=s&&s.__esModule?function(){return s.default}:function(){return s};return r.d(i,"a",i),i},r.o=function(s,i){return Object.prototype.hasOwnProperty.call(s,i)},r.p="",r(r.s=31)}([function(F,u,r){r.r(u),r.d(u,"mainUrl",function(){return s}),r.d(u,"backupUrl",function(){return i}),r.d(u,"Mode",function(){return o}),r.d(u,"Role",function(){return S}),r.d(u,"VIDEO_STAT_BIT",function(){return P}),r.d(u,"AUDIO_STAT_BIT",function(){return l}),r.d(u,"AUDIO_MUTE_BIT",function(){return n}),r.d(u,"VIDEO_MUTE_BIT",function(){return h}),r.d(u,"VIDEO_MUTED_MASK",function(){return e}),r.d(u,"AUX_VIDEO_MUTED_MASK",function(){return a}),r.d(u,"AUDIO_MUTED_MASK",function(){return E}),r.d(u,"MAIN_STREAM_MSID",function(){return D}),r.d(u,"AUX_STREAM_MSID",function(){return O}),r.d(u,"StreamType",function(){return f}),r.d(u,"TRTC_QUALITY_UNKNOWN",function(){return t}),r.d(u,"TRTC_QUALITY_EXCELLENT",function(){return d}),r.d(u,"TRTC_QUALITY_GOOD",function(){return m}),r.d(u,"TRTC_QUALITY_POOR",function(){return g}),r.d(u,"TRTC_QUALITY_BAD",function(){return C}),r.d(u,"TRTC_QUALITY_VBAD",function(){return N}),r.d(u,"TRTC_QUALITY_DISCONNECTED",function(){return L}),r.d(u,"DTLS_STATE_UNKNOWN",function(){return B}),r.d(u,"SuccessRate",function(){return R}),r.d(u,"MTA_API_PENDING",function(){return v}),r.d(u,"MTA_API_SUCCESS",function(){return w}),r.d(u,"ConnectionState",function(){return T}),r.d(u,"UPLINK_RECONNECTION_COUNT",function(){return y}),r.d(u,"DOWNLINK_RECONNECTION_COUNT",function(){return p}),r.d(u,"SIGNAL_RECONNECTION_COUNT",function(){return _}),r.d(u,"KIBANA_EVENT",function(){return A}),r.d(u,"SIGNAL_PING_TIMEOUT",function(){return k}),r.d(u,"SIGNAL_PING_PONG_INTERVAL",function(){return x}),r.d(u,"INNER_EVENT",function(){return I}),r.d(u,"AI_NOISE_REDUCE_ASSETS_PATH",function(){return Y}),r.d(u,"MAX_NUMBER_ROOM_ID",function(){return $}),r.d(u,"NAME",function(){return U}),r.d(u,"CONSOLE_DOMESTIC",function(){return c}),r.d(u,"CONSOLE_FOREIGN",function(){return M}),r.d(u,"BUY_ADDRESS_DOMESTIC",function(){return V}),r.d(u,"BUY_ADDRESS_FOREIGN",function(){return G}),r.d(u,"REGION_CHINA",function(){return b}),r.d(u,"REGION_SINGAPORE",function(){return j}),r.d(u,"REGION_FRANKFURT",function(){return H}),r.d(u,"REGION_SEOUL",function(){return W}),r.d(u,"REGION_BOMBAY",function(){return q}),r.d(u,"REGION_SILICON",function(){return K});const s="wss://qcloud.rtc.qq.com:8687",i="wss://bk.rtc.qq.com:8687",o={RTC:1,LIVE:2},S={HOST:20,AUDIENCE:21},P=1,l=8,n=64,h=16,e=1,a=2,E=4,D="5Y2wZK8nANNAoVw6dSAHVjNxrD1ObBM2kBPV",O="224d130c-7b5c-415b-aaa2-79c2eb5a6df2",f={NONE:0,AUDIO:1,MAIN:2,AUX:7},t=0,d=1,m=2,g=3,C=4,N=5,L=6,B="unknown",R={JOIN:"join",PUBLISH:"publish",UNPUBLISH:"unpublish",LOCAL_STREAM_INITIALIZE:"local_stream_initialize",SUBSCRIBE:"subscribe",UNSUBSCRIBE:"unsubscibe",UPLINK_CONNECTION:"uplink_connection",UPLINK_RECONNECTION:"uplink_reconnection",DOWNLINK_CONNECTION:"downlink_connection",DOWNLINK_RECONNECTION:"downlink_reconnection",SIGNAL_CONNECTION:"signal_connection",SIGNAL_RECONNECTION:"signal_reconnection",UPDATE_STREAM:"update_stream"},v="pending",w="success",T={CONNECTING:"connecting",CONNECTED:"connected",DISCONNECTED:"disconnected"},y=30,p=30,_=30,A={SDK_CONSTRUCT:"sdkConstruct",SDK_LOGIN:"sdkLogin",DELTA_JOIN:"delta-join",REJOIN:"rejoin",LEAVE:"leave",DELTA_LEAVE:"delta-leave",PUBLISH:"publish",DELTA_PUBLISH:"delta-publish",UNPUBLISH:"unpublish",SUBSCRIBE:"subscribe",UNSUBSCRIBE:"unsubscribe",UPLINK_CONNECTION:"uplink-connection",UPLINK_RECONNECTION:"uplink-reconnection",DOWNLINK_CONNECTION:"downlink-connection",DOWNLINK_RECONNECTION:"downlink-reconnection",ON_TRACK:"ontrack",SET_LOCAL_DESCRIPTION:"setLocalDescription",SET_REMOTE_DESCRIPTION:"setRemoteDescription",ICE_CONNECTION_STATE:"iceConnectionState",LOCAL_STREAM_INITIALIZE:"stream-initialize",SIGNAL_CONNECTION:"websocketConnectionState",SIGNAL_RECONNECTION:"websocketReconnectionState",UPDATE_STREAM:"update-stream",RECOVER_SUBSCRIPTION:"recover-subscription"},k=6e3,x=1e4,I={SET_REMOTE_OFFER_FINISHED:"set-remote-offer-finished"},Y="https://web.sdk.qcloud.com/trtc/webrtc/download/aiNoiseReduce/",$=2147483647,U={DEFAULT:"default",BOOLEAN:"boolean",STRING:"string",NUMBER:"number",OBJECT:"object",ARRAY:"array",FUNCTION:"function",FILE:"file",MAP:"map",SET:"set",UNDEFINED:"undefined",VIDEO:"video",AUDIO:"audio",ON_ERROR:"onError",MAIN:"main",RTC:"rtc",LIVE:"live",SMALL:"small",BIG:"big",AUXILIARY:"auxiliary",INVITER:"inviter",INVITEE:"invitee",VIDEO_INPUT:"videoinput",AUDIO_INPUT:"audioinput",LOCAL:"local",REMOTE:"remote",TRTC:"TRTC",WEB:"web",NORMAL:"normal",REJECT:"reject",IGNORE:"ignore",TIMEOUT:"timeout",RIC:"ric",RAF:"raf",INTERVAL:"interval",CANCEL:"cancel",BUSYLINE:"busyline",UNKNOWN:"unknown",SINGLE_CALL:"SingleCall",GROUP_CALL:"groupCall",CALLER:"caller",CALLEE:"callee",COVER:"cover",CONTAIN:"contain",FILL:"fill",AV_CALL:"av_call",CALLKIT_RECORDS_SVR:"callkit_records_svr",SINGLE:"single",GROUP:"group",START_CALL:"start_call",RECEIVE_CALL:"receive_call",CALL_ACCEPTED:"call_accepted",ACCEPT_CALL:"accept_call",CALL_MISSED:"call_missed",NOT_ANSWER_CALL:"not_answer_call",CALL_REJECTED:"call_rejected",REJECT_CALL:"reject_call",CALL_BUSY:"call_busy",IGNORE_CALL:"ignore_call",CANCEL_CALL:"cancel_call",CALL_CANCELED:"call_canceled",CALL_FAILED:"call_failed",CALL_END:"call_end",CALL_INTERRUPTED:"call_interrupted",INVITE_USER:"invite_user",JOIN_IN_GROUP_CALL:"join_in_group_call",EVENT_REPORT:"event_report",HEART_BEAT:"heartbeat",CALLING:"calling",BANNED:"banned",WAITING:"waiting",CONNECTED:"connected"},c="https://console.cloud.tencent.com/im/detail",M="https://console.intl.cloud.tencent.com/im/detail",V="https://buy.cloud.tencent.com/avc?addRavLicense=1",G="https://buy.tencentcloud.com/avc?addRavLicense=1",b=1,j=9,H=17,W=18,q=21,K=15},function(F,u,r){r.r(u),r.d(u,"isMap",function(){return o}),r.d(u,"isSet",function(){return S}),r.d(u,"isFile",function(){return P}),r.d(u,"isNumber",function(){return l}),r.d(u,"isString",function(){return n}),r.d(u,"isObject",function(){return h}),r.d(u,"isBoolean",function(){return e}),r.d(u,"isPlainObject",function(){return a}),r.d(u,"isArray",function(){return E}),r.d(u,"isUndefined",function(){return D}),r.d(u,"isNativeClass",function(){return f}),r.d(u,"isArrayOrObject",function(){return t}),r.d(u,"isFunction",function(){return d}),r.d(u,"isInstanceOfError",function(){return m}),r.d(u,"getType",function(){return g}),r.d(u,"TimeUtil",function(){return N}),r.d(u,"stringifyError",function(){return L}),r.d(u,"map2String",function(){return B}),r.d(u,"randomString",function(){return w}),r.d(u,"isValidType",function(){return T}),r.d(u,"mapKeys",function(){return y}),r.d(u,"mapValues",function(){return p}),r.d(u,"generateRandomRoomID",function(){return _}),r.d(u,"formatDuration",function(){return k}),r.d(u,"compareVersion",function(){return x}),r.d(u,"date2ISOString",function(){return I}),r.d(u,"getHostType",function(){return Y}),r.d(u,"isCallSignaling",function(){return $}),r.d(u,"performanceNow",function(){return U}),r.d(u,"isDomesticSDKAppID",function(){return c}),r.d(u,"getPurchaseAddress",function(){return M}),r.d(u,"getRegionId",function(){return V}),r.d(u,"timeoutForFun",function(){return G});var s=r(7),i=r(0);const o=function(b){return g(b)===i.NAME.MAP},S=function(b){return g(b)===i.NAME.SET},P=function(b){return g(b)===i.NAME.FILE},l=function(b){return b!==null&&(typeof b===i.NAME.NUMBER&&!isNaN(b-0)||typeof b===i.NAME.OBJECT&&b.constructor===Number)},n=function(b){return typeof b===i.NAME.STRING},h=function(b){return b!==null&&typeof b===i.NAME.OBJECT},e=function(b){return typeof b===i.NAME.BOOLEAN},a=function(b){if(typeof b!==i.NAME.OBJECT||b===null)return!1;const j=Object.getPrototypeOf(b);if(j===null)return!0;let H=j;for(;Object.getPrototypeOf(H)!==null;)H=Object.getPrototypeOf(H);return j===H},E=function(b){return typeof Array.isArray===i.NAME.FUNCTION?Array.isArray(b):g(b)===i.NAME.ARRAY},D=function(b){return typeof b===i.NAME.UNDEFINED},O=/^class\s/,f=function(b){return typeof b===i.NAME.FUNCTION&&O.test(b.toString())},t=function(b){return E(b)||h(b)},d=function(b){return typeof b===i.NAME.FUNCTION},m=function(b){return b instanceof Error},g=function(b){return Object.prototype.toString.call(b).match(/^\[object (.*)\]$/)[1].toLowerCase()};let C=0;Date.now||(Date.now=function(){return new Date().getTime()});const N={now(){C===0&&(C=Date.now()-1);const b=Date.now()-C;return b>4294967295?(C+=4294967295,Date.now()-C):b},utc:()=>Math.round(Date.now()/1e3)},L=function(b){return JSON.stringify(b,["message","code"])},B=function(b){if(!o(b))return"not a map!!!";let j="";for(const[H,W]of b.entries()){if(o(W))return`[k=${H} -> ${B(W)}`;j+=`[k=${H} v=${W}] `}return j},R="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",v=R.length,w=function(){let b="";for(let j=32;j>0;--j)b+=R[Math.floor(Math.random()*v)];return b},T=function(b,j){for(const H in b)if(b[H]===j)return!0;return!1};function y(b,j){const H={};return Object.keys(b).forEach(W=>{H[j(b[W],W)]=b[W]}),H}function p(b,j){const H={};return Object.keys(b).forEach(W=>{H[W]=j(b[W],W)}),H}function _(){return Math.round(1e8*Math.random())}function A(b){return b<10?"0"+b:b}function k(b){if(b<60)return"00:00:"+A(b);if(b<3600){const K=parseInt(b/60),z=b-60*K;return`00:${A(K)}:${A(z)}`}const j=parseInt(b/3600),H=b-3600*j,W=parseInt(H/60),q=H-60*W;return`${A(j)}:${A(W)}:${A(q)}`}function x(b,j){b=b.split("."),j=j.split(".");const H=Math.max(b.length,j.length);for(;b.length<H;)b.push("0");for(;j.length<H;)j.push("0");for(let W=0;W<H;W++){const q=parseInt(b[W]),K=parseInt(j[W]);if(q>K)return 1;if(q<K)return-1}return 0}const I=function(){const b=new Date,j=b.toISOString(),H=b.getTimezoneOffset()/60;let W="";return W=H<0?H>-10?"+0"+Math.abs(100*H):"+"+Math.abs(100*H):H>=10?"-"+100*H:"-0"+100*H,j.replace("Z",W)};function Y(){let b="unknown";return s.IS_MAC&&(b="mac"),s.IS_WIN&&(b="windows"),s.IS_IOS&&(b="ios"),s.IS_ANDROID&&(b="android"),b}function $(b){return b===i.NAME.AV_CALL}function U(){return performance&&performance.now?Math.floor(performance.now()):Date.now()}function c(b){const j=String(b);return j.startsWith("14")||j.startsWith("16")||j.startsWith("17")}function M(b){return`${c(b)?i.BUY_ADDRESS_DOMESTIC:i.BUY_ADDRESS_FOREIGN}&position=${b}®ionId=${V(b)}`}function V(b){return b>=2e7&&b<3e7||b>=172e7&&b<173e7?i.REGION_SINGAPORE:b>=3e7&&b<4e7||b>=173e7&&b<174e7?i.REGION_SEOUL:b>=4e7&&b<5e7||b>=174e7&&b<175e7?i.REGION_FRANKFURT:b>=5e7&&b<6e7||b>=175e7&&b<176e7?i.REGION_BOMBAY:b>=7e7&&b<8e7||b>=177e7&&b<178e7?i.REGION_SILICON:i.REGION_CHINA}async function G(b,j){return Promise.race([b(),new Promise((H,W)=>{setTimeout(()=>{H()},j)})])}},function(F,u,r){r.r(u);var s=r(8),i=r(1);let o=0;const S=new Map;function P(){const n=new Date;return`TUICallEngine ${n.toLocaleTimeString("en-US",{hour12:!1})}.${function(h){let e;switch(h.toString().length){case 1:e="00"+h;break;case 2:e="0"+h;break;default:e=h}return e}(n.getMilliseconds())}:`}const l={_data:[],_length:0,_visible:!1,arguments2String(n){let h;if(n.length===1)h=P()+n[0];else{h=P();for(let e=0,{length:a}=n;e<a;e++)Object(i.isArrayOrObject)(n[e])?Object(i.isInstanceOfError)(n[e])?h+=Object(i.stringifyError)(n[e]):h+=JSON.stringify(n[e]):h+=n[e],h+=" "}return h},debug(){if(o<=-1){const n=this.arguments2String(arguments);l.record(n,"debug"),s.a.debug(n)}},log(){if(o<=0){const n=this.arguments2String(arguments);l.record(n,"log"),s.a.log(n)}},info(){if(o<=1){const n=this.arguments2String(arguments);l.record(n,"info"),s.a.info(n)}},warn(){if(o<=2){const n=this.arguments2String(arguments);l.record(n,"warn"),s.a.warn(n)}},error(){if(o<=3){const n=this.arguments2String(arguments);l.record(n,"error"),s.a.error(n)}},time(n){S.set(n,i.TimeUtil.now())},timeEnd(n){if(S.has(n)){const h=i.TimeUtil.now()-S.get(n);return S.delete(n),h}return s.a.warn(`未找到对应label: ${n}, 请在调用 logger.timeEnd 前,调用 logger.time`),0},setLevel(n){n<4&&s.a.log(`${P()}set level from ${o} to ${n}`),o=n},getLevel:()=>o,record(n,h){l._length===1100&&(l._data.splice(0,100),l._length=1e3),l._length++,l._data.push(`${n} [${h}]
|
|
`)},getLog:()=>l._data};u.default=l},function(F,u,r){var s=r(19),i=Object.prototype.toString;function o(e){return i.call(e)==="[object Array]"}function S(e){return e===void 0}function P(e){return e!==null&&typeof e=="object"}function l(e){if(i.call(e)!=="[object Object]")return!1;var a=Object.getPrototypeOf(e);return a===null||a===Object.prototype}function n(e){return i.call(e)==="[object Function]"}function h(e,a){if(e!=null)if(typeof e!="object"&&(e=[e]),o(e))for(var E=0,D=e.length;E<D;E++)a.call(null,e[E],E,e);else for(var O in e)Object.prototype.hasOwnProperty.call(e,O)&&a.call(null,e[O],O,e)}F.exports={isArray:o,isArrayBuffer:function(e){return i.call(e)==="[object ArrayBuffer]"},isBuffer:function(e){return e!==null&&!S(e)&&e.constructor!==null&&!S(e.constructor)&&typeof e.constructor.isBuffer=="function"&&e.constructor.isBuffer(e)},isFormData:function(e){return typeof FormData<"u"&&e instanceof FormData},isArrayBufferView:function(e){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return typeof e=="string"},isNumber:function(e){return typeof e=="number"},isObject:P,isPlainObject:l,isUndefined:S,isDate:function(e){return i.call(e)==="[object Date]"},isFile:function(e){return i.call(e)==="[object File]"},isBlob:function(e){return i.call(e)==="[object Blob]"},isFunction:n,isStream:function(e){return P(e)&&n(e.pipe)},isURLSearchParams:function(e){return typeof URLSearchParams<"u"&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return(typeof navigator>"u"||navigator.product!=="ReactNative"&&navigator.product!=="NativeScript"&&navigator.product!=="NS")&&typeof window<"u"&&typeof document<"u"},forEach:h,merge:function e(){var a={};function E(f,t){l(a[t])&&l(f)?a[t]=e(a[t],f):l(f)?a[t]=e({},f):o(f)?a[t]=f.slice():a[t]=f}for(var D=0,O=arguments.length;D<O;D++)h(arguments[D],E);return a},extend:function(e,a,E){return h(a,function(D,O){e[O]=E&&typeof D=="function"?s(D,E):D}),e},trim:function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")},stripBOM:function(e){return e.charCodeAt(0)===65279&&(e=e.slice(1)),e}}},function(F,u,r){Object.defineProperty(u,"__esModule",{value:!0}),u.default={UNKNOWN:65535,NO_NETWORK:2805,FAILURE_SWITCH_TO_AUDIO:60001,FAILURE_SWITCH_TO_VIDEO:60002,NOT_MICROPHONE_LIST:60003,NOT_CAMERA_LIST:60004,NOT_SUPPORT:60006,ERROR_PACKAGE_NOT_PURCHASED:-1001,ERROR_PACKAGE_NOT_SUPPORTED:-1002,ERROR_TIM_VERSION_OUTDATED:-1003,ERROR_PERMISSION_DENIED:-1101,ERROR_GET_DEVICE_LIST_FAIL:-1102,ERROR_INIT_FAIL:-1201,ERROR_PARAM_INVALID:-1202,ERROR_REQUEST_REFUSED:-1203,ERROR_REQUEST_REPEATED:-1204,ERROR_SCENE_NOT_SUPPORTED:-1205,ERROR_SIGNALING_SEND_FAIL:-1401,ERROR_INVALID_INVITEID:8010,ERROR_INVALID_SEND_FAIL:20003,ERROR_HTTP:3e4,ERROR_BLACKLIST:20007}},function(F,u,r){var s;s=()=>(()=>{var i={530:function(l,n,h){var e=this&&this.__assign||function(){return(e=Object.assign||function(R){for(var v,w=1,T=arguments.length;w<T;w++)for(var y in v=arguments[w])Object.prototype.hasOwnProperty.call(v,y)&&(R[y]=v[y]);return R}).apply(this,arguments)},a=this&&this.__awaiter||function(R,v,w,T){return new(w||(w=Promise))(function(y,p){function _(x){try{k(T.next(x))}catch(I){p(I)}}function A(x){try{k(T.throw(x))}catch(I){p(I)}}function k(x){var I;x.done?y(x.value):(I=x.value,I instanceof w?I:new w(function(Y){Y(I)})).then(_,A)}k((T=T.apply(R,v||[])).next())})},E=this&&this.__generator||function(R,v){var w,T,y,p,_={label:0,sent:function(){if(1&y[0])throw y[1];return y[1]},trys:[],ops:[]};return p={next:A(0),throw:A(1),return:A(2)},typeof Symbol=="function"&&(p[Symbol.iterator]=function(){return this}),p;function A(k){return function(x){return function(I){if(w)throw new TypeError("Generator is already executing.");for(;p&&(p=0,I[0]&&(_=0)),_;)try{if(w=1,T&&(y=2&I[0]?T.return:I[0]?T.throw||((y=T.return)&&y.call(T),0):T.next)&&!(y=y.call(T,I[1])).done)return y;switch(T=0,y&&(I=[2&I[0],y.value]),I[0]){case 0:case 1:y=I;break;case 4:return _.label++,{value:I[1],done:!1};case 5:_.label++,T=I[1],I=[0];continue;case 7:I=_.ops.pop(),_.trys.pop();continue;default:if(!((y=(y=_.trys).length>0&&y[y.length-1])||I[0]!==6&&I[0]!==2)){_=0;continue}if(I[0]===3&&(!y||I[1]>y[0]&&I[1]<y[3])){_.label=I[1];break}if(I[0]===6&&_.label<y[1]){_.label=y[1],y=I;break}if(y&&_.label<y[2]){_.label=y[2],_.ops.push(I);break}y[2]&&_.ops.pop(),_.trys.pop();continue}I=v.call(R,_)}catch(Y){I=[6,Y],T=0}finally{w=y=0}if(5&I[0])throw I[1];return{value:I[0]?I[1]:void 0,done:!0}}([k,x])}}};Object.defineProperty(n,"__esModule",{value:!0});var D,O=h(928),f=h(434),t=h(757),d=h(150),m=h(758),g=h(23);(function(R){R[R.DEBUG=0]="DEBUG",R[R.INFO=1]="INFO",R[R.WARING=2]="WARING",R[R.ERROR=3]="ERROR"})(D||(D={}));var C={metric:!0,context:!0},N=function(R,v,w){return w===void 0&&(w=0),(0,O.isPlainObject)(R)?((0,O.isPlainObject)(v)&&Object.keys(v).forEach(function(T){var y=R[T],p=v[T];R[T]=C[T]&&w===0?N(y,p,1):p}),R):(0,O.isPlainObject)(v)?v:{}},L={clsConfig:{endpoint:"",topicId:""}},B=function(){function R(v){var w=this;this.url="",this.uploadChannel="",this.sendPipe=null,this.sendEsPipe=null,this._logLevel=D.INFO,this._getReportDataList=[];var T=v||L,y=T.clsConfig,p=T.esConfig,_=y.endpoint,A=y.topicId;this.esConfig=p,this.endpoint=_,this.topicId=A;var k=this.buildUploadUrl();this.url=k,this.initPageUnloadMonitor(),this.sendPipe=(0,t.createPipeline)([(0,g.createThrottlePipe)(this,5),(0,d.formatClsLog)(),(0,m.limitLengthPipe)(),function(x){return a(w,void 0,void 0,function(){var I,Y,$=this;return E(this,function(U){return I=0,(Y=function(){return a($,void 0,void 0,function(){var c;return E(this,function(M){switch(M.label){case 0:return M.trys.push([0,2,,3]),[4,this.send({url:k,data:x})];case 1:return M.sent(),[3,3];case 2:return c=M.sent(),I<=2?(I++,setTimeout(function(){Y()},1e3)):console.debug(c),[3,3];case 3:return[2]}})})})(),[2]})})}])}return R.prototype.initPageUnloadMonitor=function(){var v=this,w=this;!(0,O.isMiniProgram)()&&document&&typeof document.addEventListener=="function"&&document.addEventListener("visibilitychange",function(){if(document.visibilityState==="hidden"){var T=v.getCommonReportData(),y=N(T,{level:D.WARING,method:"PAGE_UNLOAD",type:"event"});if(w.esConfig)try{var p=w.esConfig,_=p.url,A=p.table;(0,t.createPipeline)([(0,g.createThrottlePipe)(w,1),(0,d.formatESLog)({table:A}),(0,m.limitLengthPipe)(),function(k){return a(v,void 0,void 0,function(){var x;return E(this,function(I){try{x=new Blob([JSON.stringify(k)],{type:"application/x-www-form-urlencoded"}),navigator==null||navigator.sendBeacon(_,x)}catch(Y){console.debug(Y)}return[2]})})}])(y)}catch(k){console.debug(k)}}})},R.prototype.updateEsConfig=function(v){var w=this;try{if(v){this.esConfig=v;var T=v.url,y=v.table;T&&y&&(this.uploadChannel=T,this.sendEsPipe=(0,t.createPipeline)([(0,g.createThrottlePipe)(this,5),(0,d.formatESLog)({table:y}),(0,m.limitLengthPipe)(),function(p){return a(w,void 0,void 0,function(){var _,A,k=this;return E(this,function(x){return _=0,(A=function(){return a(k,void 0,void 0,function(){var I;return E(this,function(Y){switch(Y.label){case 0:return Y.trys.push([0,2,,3]),[4,this.send({url:T,data:p})];case 1:return Y.sent(),[3,3];case 2:return I=Y.sent(),_<=2?(_++,setTimeout(function(){A()},1e3)):console.debug(I),[3,3];case 3:return[2]}})})})(),[2]})})}]))}}catch(p){console.debug(p)}},R.prototype.updateGetReportData=function(v){typeof v=="function"&&this._getReportDataList.push(v)},R.prototype.setLogLevel=function(v){typeof v!="number"&&(v=D.INFO),this._logLevel=v},R.prototype.createLogFunc=function(v){var w=this;return function(T,y){w.log(T,y,{level:v})}},R.prototype.buildUploadUrl=function(){return this.endpoint&&this.topicId?"".concat(this.endpoint,"/tracklog?topic_id=").concat(this.topicId):""},R.prototype.info=function(v,w){this.log(v,w,{level:D.INFO})},R.prototype.debug=function(v,w){this.log(v,w,{level:D.DEBUG})},R.prototype.warn=function(v,w){this.log(v,w,{level:D.WARING})},R.prototype.error=function(v,w){this.log(v,w,{level:D.ERROR})},R.prototype.log=function(v,w,T){try{var y=T||{},p=y.level;if(y.topicId,this._logLevel<=p){var _=this.getCommonReportData(),A=N(_,e({level:p,method:v},w));this.sendPipe(A),typeof this.sendEsPipe=="function"&&this.sendEsPipe(A)}}catch(k){console.debug(k)}},R.prototype.getCommonReportData=function(){for(var v={},w=0;w<this._getReportDataList.length;w++)v=N(v,this._getReportDataList[w]());return v},R.prototype.send=function(v){return a(this,void 0,void 0,function(){var w,T,y,p;return E(this,function(_){switch(_.label){case 0:T=(w=v||{}).url,y=w.data,_.label=1;case 1:return _.trys.push([1,4,,5]),T?[4,(0,f.request)({url:T,data:y,method:"post"})]:[3,3];case 2:_.sent(),_.label=3;case 3:return[3,5];case 4:throw p=_.sent(),console.debug(p),new Error(p);case 5:return[2]}})})},R}();n.default=B},314:(l,n,h)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.formatClsLog=void 0;var e=h(928);n.formatClsLog=function(){return function(a,E){try{E({logs:a==null?void 0:a.map(function(D){var O={};return Object.keys(D).forEach(function(f){if((0,e.isPlainObject)(D[f]))try{O[f]=(0,e.stringifyPlus)(D[f])}catch(t){console.debug(t)}else f==="time"&&(O[f]=new Date(D[f]).toISOString()),O[f]=D[f]+""}),{contents:O,time:D.time}}),source:""})}catch(D){console.debug(D)}}}},597:(l,n,h)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.formatESLog=void 0;var e=h(928);n.formatESLog=function(a){var E=a.table;return function(D,O){try{var f=D==null?void 0:D.map(function(t){var d={};return Object.keys(t).forEach(function(m){if((0,e.isPlainObject)(t[m]))try{d[m]=(0,e.stringifyPlus)(t[m])}catch(g){console.debug(g)}else d[m]=m==="level"?t[m]+"":m==="time"?new Date(t[m]).toISOString():t[m]}),d});O({table:E,report:f})}catch(t){console.debug(t)}}}},150:(l,n,h)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.formatClsLog=n.formatESLog=void 0;var e=h(314);Object.defineProperty(n,"formatClsLog",{enumerable:!0,get:function(){return e.formatClsLog}});var a=h(597);Object.defineProperty(n,"formatESLog",{enumerable:!0,get:function(){return a.formatESLog}})},757:(l,n,h)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.createPipeline=void 0;var e=h(928);n.createPipeline=function(a){if(!a||!a.reduce||!a.length)throw new TypeError("createPipeline need at least one function param");return a.length===1?function(E,D){a[0](E,D||e.noop)}:a.reduce(function(E,D){return function(O,f){return f===void 0&&(f=e.noop),E(O,function(t){return D==null?void 0:D(t,f)})}})}},758:(l,n,h)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.limitLengthPipe=n.MAX_LOG_LENGTH=void 0;var e=h(928);n.MAX_LOG_LENGTH=102400,n.limitLengthPipe=function(){return function(a,E){try{var D=(a=a||{}).logs,O=D===void 0?[]:D;a.logs=O==null?void 0:O.map(function(f){var t=n.MAX_LOG_LENGTH,d=f.contents;return Object.keys(d).forEach(function(m){var g=d[m];try{g&&g.length>t&&(d[m]=g==null?void 0:g.substring(0,t))}catch{console.debug("size of content > limitSize"),d[m]=(0,e.stringifyPlus)(g).substring(0,t)}}),f}),E(a)}catch(f){console.debug(f)}}}},23:(l,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.createThrottlePipe=void 0,n.createThrottlePipe=function(h,e){var a,E=[];return function(D,O){if(Array.isArray(D)?E=E.concat(D):E.push(D),e&&E.length>=e||h.sendNow&&E.length>0)return O(E.splice(0,E.length)),void(a&&clearTimeout(a));a&&clearTimeout(a),a=setTimeout(function(){a=null,E.length>0&&O(E.splice(0,E.length))},h.delay||1e3)}}},434:function(l,n,h){var e=this&&this.__assign||function(){return(e=Object.assign||function(d){for(var m,g=1,C=arguments.length;g<C;g++)for(var N in m=arguments[g])Object.prototype.hasOwnProperty.call(m,N)&&(d[N]=m[N]);return d}).apply(this,arguments)},a=this&&this.__awaiter||function(d,m,g,C){return new(g||(g=Promise))(function(N,L){function B(w){try{v(C.next(w))}catch(T){L(T)}}function R(w){try{v(C.throw(w))}catch(T){L(T)}}function v(w){var T;w.done?N(w.value):(T=w.value,T instanceof g?T:new g(function(y){y(T)})).then(B,R)}v((C=C.apply(d,m||[])).next())})},E=this&&this.__generator||function(d,m){var g,C,N,L,B={label:0,sent:function(){if(1&N[0])throw N[1];return N[1]},trys:[],ops:[]};return L={next:R(0),throw:R(1),return:R(2)},typeof Symbol=="function"&&(L[Symbol.iterator]=function(){return this}),L;function R(v){return function(w){return function(T){if(g)throw new TypeError("Generator is already executing.");for(;L&&(L=0,T[0]&&(B=0)),B;)try{if(g=1,C&&(N=2&T[0]?C.return:T[0]?C.throw||((N=C.return)&&N.call(C),0):C.next)&&!(N=N.call(C,T[1])).done)return N;switch(C=0,N&&(T=[2&T[0],N.value]),T[0]){case 0:case 1:N=T;break;case 4:return B.label++,{value:T[1],done:!1};case 5:B.label++,C=T[1],T=[0];continue;case 7:T=B.ops.pop(),B.trys.pop();continue;default:if(!((N=(N=B.trys).length>0&&N[N.length-1])||T[0]!==6&&T[0]!==2)){B=0;continue}if(T[0]===3&&(!N||T[1]>N[0]&&T[1]<N[3])){B.label=T[1];break}if(T[0]===6&&B.label<N[1]){B.label=N[1],N=T;break}if(N&&B.label<N[2]){B.label=N[2],B.ops.push(T);break}N[2]&&B.ops.pop(),B.trys.pop();continue}T=m.call(d,B)}catch(y){T=[6,y],C=0}finally{g=N=0}if(5&T[0])throw T[1];return{value:T[0]?T[1]:void 0,done:!0}}([v,w])}}},D=this&&this.__rest||function(d,m){var g={};for(var C in d)Object.prototype.hasOwnProperty.call(d,C)&&m.indexOf(C)<0&&(g[C]=d[C]);if(d!=null&&typeof Object.getOwnPropertySymbols=="function"){var N=0;for(C=Object.getOwnPropertySymbols(d);N<C.length;N++)m.indexOf(C[N])<0&&Object.prototype.propertyIsEnumerable.call(d,C[N])&&(g[C[N]]=d[C[N]])}return g};Object.defineProperty(n,"__esModule",{value:!0}),n.request=void 0;var O=h(147),f=h(310),t=h(928);n.request=function(d){return a(void 0,void 0,void 0,function(){var m=d.url,g=d.data,C=d.header,N=C===void 0?{}:C,L=d.method,B=L===void 0?"GET":L,R=d.dataType,v=d.responseType,w=D(d,["url","data","header","method","dataType","responseType"]);return E(this,function(T){return(0,t.isBrowser)()?[2,(0,f.requestXHR)(m,g,{headers:N,method:B,responseType:v,dataType:R})]:(0,t.isMiniProgram)()?[2,(0,O.requestWeapp)(e({url:m,data:g,header:N,method:B,dataType:R,responseType:v},w))]:(console.debug("unsupport env"),[2])})})}},147:function(l,n,h){var e=this&&this.__assign||function(){return(e=Object.assign||function(f){for(var t,d=1,m=arguments.length;d<m;d++)for(var g in t=arguments[d])Object.prototype.hasOwnProperty.call(t,g)&&(f[g]=t[g]);return f}).apply(this,arguments)},a=this&&this.__awaiter||function(f,t,d,m){return new(d||(d=Promise))(function(g,C){function N(R){try{B(m.next(R))}catch(v){C(v)}}function L(R){try{B(m.throw(R))}catch(v){C(v)}}function B(R){var v;R.done?g(R.value):(v=R.value,v instanceof d?v:new d(function(w){w(v)})).then(N,L)}B((m=m.apply(f,t||[])).next())})},E=this&&this.__generator||function(f,t){var d,m,g,C,N={label:0,sent:function(){if(1&g[0])throw g[1];return g[1]},trys:[],ops:[]};return C={next:L(0),throw:L(1),return:L(2)},typeof Symbol=="function"&&(C[Symbol.iterator]=function(){return this}),C;function L(B){return function(R){return function(v){if(d)throw new TypeError("Generator is already executing.");for(;C&&(C=0,v[0]&&(N=0)),N;)try{if(d=1,m&&(g=2&v[0]?m.return:v[0]?m.throw||((g=m.return)&&g.call(m),0):m.next)&&!(g=g.call(m,v[1])).done)return g;switch(m=0,g&&(v=[2&v[0],g.value]),v[0]){case 0:case 1:g=v;break;case 4:return N.label++,{value:v[1],done:!1};case 5:N.label++,m=v[1],v=[0];continue;case 7:v=N.ops.pop(),N.trys.pop();continue;default:if(!((g=(g=N.trys).length>0&&g[g.length-1])||v[0]!==6&&v[0]!==2)){N=0;continue}if(v[0]===3&&(!g||v[1]>g[0]&&v[1]<g[3])){N.label=v[1];break}if(v[0]===6&&N.label<g[1]){N.label=g[1],g=v;break}if(g&&N.label<g[2]){N.label=g[2],N.ops.push(v);break}g[2]&&N.ops.pop(),N.trys.pop();continue}v=t.call(f,N)}catch(w){v=[6,w],m=0}finally{d=g=0}if(5&v[0])throw v[1];return{value:v[0]?v[1]:void 0,done:!0}}([B,R])}}};Object.defineProperty(n,"__esModule",{value:!0}),n.requestWeapp=void 0;var D=h(690),O=0;n.requestWeapp=function(f){return a(this,void 0,void 0,function(){var t;return E(this,function(d){switch(d.label){case 0:d.trys.push([0,5,6,7]),d.label=1;case 1:return O>=2?[4,(0,D.startBlocking)()]:[3,3];case 2:return d.sent(),[3,1];case 3:return O++,[4,new Promise(function(m,g){wx.request(e(e({},f),{success:function(C){m(C)},fail:function(C){g(C)}}))})];case 4:return[2,d.sent()];case 5:return t=d.sent(),[2,Promise.reject(t)];case 6:return O--,(0,D.resolveFirstBlock)(),[7];case 7:return[2]}})})}},310:function(l,n,h){var e=this&&this.__awaiter||function(t,d,m,g){return new(m||(m=Promise))(function(C,N){function L(v){try{R(g.next(v))}catch(w){N(w)}}function B(v){try{R(g.throw(v))}catch(w){N(w)}}function R(v){var w;v.done?C(v.value):(w=v.value,w instanceof m?w:new m(function(T){T(w)})).then(L,B)}R((g=g.apply(t,d||[])).next())})},a=this&&this.__generator||function(t,d){var m,g,C,N,L={label:0,sent:function(){if(1&C[0])throw C[1];return C[1]},trys:[],ops:[]};return N={next:B(0),throw:B(1),return:B(2)},typeof Symbol=="function"&&(N[Symbol.iterator]=function(){return this}),N;function B(R){return function(v){return function(w){if(m)throw new TypeError("Generator is already executing.");for(;N&&(N=0,w[0]&&(L=0)),L;)try{if(m=1,g&&(C=2&w[0]?g.return:w[0]?g.throw||((C=g.return)&&C.call(g),0):g.next)&&!(C=C.call(g,w[1])).done)return C;switch(g=0,C&&(w=[2&w[0],C.value]),w[0]){case 0:case 1:C=w;break;case 4:return L.label++,{value:w[1],done:!1};case 5:L.label++,g=w[1],w=[0];continue;case 7:w=L.ops.pop(),L.trys.pop();continue;default:if(!((C=(C=L.trys).length>0&&C[C.length-1])||w[0]!==6&&w[0]!==2)){L=0;continue}if(w[0]===3&&(!C||w[1]>C[0]&&w[1]<C[3])){L.label=w[1];break}if(w[0]===6&&L.label<C[1]){L.label=C[1],C=w;break}if(C&&L.label<C[2]){L.label=C[2],L.ops.push(w);break}C[2]&&L.ops.pop(),L.trys.pop();continue}w=d.call(t,L)}catch(T){w=[6,T],g=0}finally{m=C=0}if(5&w[0])throw w[1];return{value:w[0]?w[1]:void 0,done:!0}}([R,v])}}};Object.defineProperty(n,"__esModule",{value:!0}),n.requestXHR=void 0;var E=h(580),D=h(690),O=0;function f(t,d,m){m.status?d(new Error("Request failed with status code "+m.status)):t(m)}n.default=f,n.requestXHR=function(t,d,m){return d===void 0&&(d={}),m===void 0&&(m={}),e(this,void 0,void 0,function(){var g,C=this;return a(this,function(N){switch(N.label){case 0:return N.trys.push([0,2,3,4]),[4,new Promise(function(L,B){return e(C,void 0,void 0,function(){var R,v,w,T,y,p;return a(this,function(_){switch(_.label){case 0:return O>=2?[4,(0,D.startBlocking)()]:[3,2];case 1:return _.sent(),[3,0];case 2:return O++,R=m.method,v=m.headers,w=v===void 0?{}:v,T=m.responseType,y=T===void 0?"json":T,R=(R||"get").toUpperCase(),Object.assign(w,{"Content-type":"application/json"}),(p=new window.XMLHttpRequest).responseType=y,p.timeout=1e4,p.onreadystatechange=function(){p.readyState===4&&(p.status===200?L({data:p.response}):B({code:p.status,msg:p.statusText}))},p.ontimeout=function(A){B({code:p.status,msg:p.statusText})},p.onloadend=function(){p&&(f(function(A){L(A)},function(A){B(A)},{status:p.status,statusText:p.statusText}),p=null)},p.onabort=function(){p&&(B(new Error("Request aborted")),p=null)},p.onerror=function(){B(new Error("Network Error")),p=null},R==="GET"?t="url".concat(t.indexOf("?")===-1?"?":"&").concat(E.default.stringify(d)):R==="POST"&&(d=JSON.stringify(d)),p.open(R,t,!0),Object.keys(w).forEach(function(A){p.setRequestHeader(A,w[A])}),p.send(R==="POST"?d:null),[2]}})})})];case 1:return[2,N.sent()];case 2:throw g=N.sent(),new Error(g);case 3:return O--,(0,D.resolveFirstBlock)(),[7];case 4:return[2]}})})}},928:(l,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.date2ISOString=n.stringifyPlus=n.noop=n.isBrowser=n.isMiniProgram=n.isPlainObject=n.appendParams=void 0,n.appendParams=function(e,a){a===void 0&&(a={});var E=[];return Object.keys(a).forEach(function(D){var O=a[D];if(O!==void 0){if((0,n.isPlainObject)(O))try{O=JSON.stringify(O)}catch{}E.push("".concat(D,"=").concat(encodeURIComponent(O)))}}),E.length?(e.indexOf("?")>-1?"".concat(e,"&"):"".concat(e,"?"))+E.join("&"):e},n.isPlainObject=function(e){if(typeof e!="object"||e===null)return!1;var a=Object.getPrototypeOf(e);if(a===null)return!0;for(var E=a;Object.getPrototypeOf(E)!==null;)E=Object.getPrototypeOf(E);return a===E},n.isMiniProgram=function(){try{return!(!(wx!=null&&wx.request)||!(wx!=null&&wx.connectSocket))}catch{return!1}},n.isBrowser=function(){try{return!(0,n.isMiniProgram)()&&typeof window<"u"&&window.document!==void 0}catch{return!1}},n.noop=function(){};var h=function(){var e=new WeakSet;return function(a,E){if(E instanceof Error)return"Error.message: ".concat(E.message,`
|
|
Error.stack: `).concat(E.stack);if(typeof E=="object"&&E!==null){if(e.has(E))return"[Circular ".concat(a||"root","]");e.add(E)}return E}};n.stringifyPlus=function(e){if(typeof e=="string")return e;try{return e instanceof Error?(JSON.stringify(e,h())||"undefined").replace(/"/gim,""):JSON.stringify(e,h())||"undefined"}catch(a){return`error happen when aegis stringify:
|
|
`.concat(a.message,`
|
|
`).concat(a.stack)}},n.date2ISOString=function(){var e,a=new Date,E=a.toISOString(),D=a.getTimezoneOffset()/60;return e=D<0?D>-10?"+0".concat(Math.abs(100*D)):"+".concat(Math.abs(100*D)):D>=10?"-".concat(100*D):"-0".concat(100*D),E.replace("Z",e)}},580:(l,n,h)=>{Object.defineProperty(n,"__esModule",{value:!0});var e=h(928);n.default={stringify:function(a){return a?Object.keys(a).map(function(E){var D=a[E];if((0,e.isPlainObject)(D))D=JSON.stringify(D);else{if(typeof D!="string"&&typeof D!="number")return"";D=+D}return encodeURIComponent(E)+"="+encodeURIComponent(D)}).filter(function(E){return E.length>0}).join("&"):""}}},690:(l,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.startBlocking=n.resolveFirstBlock=void 0;var h=[];n.startBlocking=function(){var e,a=new Promise(function(E){e=E});return h.push({promise:a,resolve:e}),a},n.resolveFirstBlock=function(){h.length&&(h[0].resolve(),h.shift())}}},o={};function S(l){var n=o[l];if(n!==void 0)return n.exports;var h=o[l]={exports:{}};return i[l].call(h.exports,h,h.exports,S),h.exports}var P={};return(()=>{var l=P;Object.defineProperty(l,"__esModule",{value:!0});var n=S(530),h={debug:console.debug,info:console.info,warn:console.warn,error:console.error,updateGetReportData:function(a){console.debug(a)}},e=null;l.default=function(a){if(!e){var E=a||{},D=E.clsConfig,O=(E.esConfig,D.endpoint),f=D.topicId;if(!O||!f)return console.debug("endpoint and topicId must not be null"),h;e=new n.default(a)}return e}})(),P})(),F.exports=s()},function(F,u,r){Object.defineProperty(u,"__esModule",{value:!0}),u.DEVICEID_TYPE=u.DEVICE_TYPE=u.CALL_EXPERMENTEL_API_TYPE=u.LOG_LEVEL=u.MODE_TYPE=u.VALID_VIDEO_PROFILE_LIST=u.BUSINESS_ID=u.ACTION_TYPE=u.CALL_ROLE=u.CALL_STATUS=u.CMD_TYPE=u.CMD_TYPE_LIST=u.CALL_TYPE=void 0;var s=r(14);(function(i){i[i.UNKNOWN=0]="UNKNOWN",i[i.AUDIO_CALL=1]="AUDIO_CALL",i[i.VIDEO_CALL=2]="VIDEO_CALL"})(u.CALL_TYPE||(u.CALL_TYPE={})),u.CMD_TYPE_LIST=["","audioCall","videoCall"],function(i){i.AUDIO_CALL="audioCall",i.VIDEO_CALL="videoCall",i.HANG_UP="hangup",i.SWITCH_TO_AUDIO="switchToAudio",i.SWITCH_TO_AUDIO_CALL="switch_to_audio_call",i.SWITCH_TO_VIDEO="switchToVideo"}(u.CMD_TYPE||(u.CMD_TYPE={})),function(i){i.IDLE="idle",i.CALLING="calling",i.CONNECTED="connected"}(u.CALL_STATUS||(u.CALL_STATUS={})),function(i){i.UNKNOWN="",i.INVITER="inviter",i.INVITEE="invitee"}(u.CALL_ROLE||(u.CALL_ROLE={})),function(i){i[i.INVITE=1]="INVITE",i[i.CANCEL_INVITE=2]="CANCEL_INVITE",i[i.ACCEPT_INVITE=3]="ACCEPT_INVITE",i[i.REJECT_INVITE=4]="REJECT_INVITE",i[i.INVITE_TIMEOUT=5]="INVITE_TIMEOUT"}(u.ACTION_TYPE||(u.ACTION_TYPE={})),function(i){i[i.SIGNAL=1]="SIGNAL"}(u.BUSINESS_ID||(u.BUSINESS_ID={})),u.VALID_VIDEO_PROFILE_LIST=Object.keys(s.TUICommonDefine.VideoEncoderParams),function(i){i.AUDIO="audio",i.VIDEO="video"}(u.MODE_TYPE||(u.MODE_TYPE={})),function(i){i[i.NORMAL=0]="NORMAL",i[i.RELEASE=1]="RELEASE",i[i.WARNING=2]="WARNING",i[i.ERROR=3]="ERROR",i[i.NONE=4]="NONE"}(u.LOG_LEVEL||(u.LOG_LEVEL={})),function(i){i[i.BASE=Math.pow(2,16)]="BASE",i[i.PRO=Math.pow(2,17)]="PRO",i[i.ULTIMATE=Math.pow(2,18)]="ULTIMATE"}(u.CALL_EXPERMENTEL_API_TYPE||(u.CALL_EXPERMENTEL_API_TYPE={})),function(i){i.AUDIO="audio",i.VIDEO="video",i.CAMERA="camera",i.MICROPHONES="microphones"}(u.DEVICE_TYPE||(u.DEVICE_TYPE={})),function(i){i.audio="microphoneId",i.video="cameraId"}(u.DEVICEID_TYPE||(u.DEVICEID_TYPE={}))},function(F,u,r){r.r(u),r.d(u,"IN_Browser",function(){return s}),r.d(u,"IN_WXMiniProgram",function(){return i}),r.d(u,"USER_AGENT",function(){return o}),r.d(u,"IS_IPAD",function(){return l}),r.d(u,"IS_IPHONE",function(){return n}),r.d(u,"IS_IPOD",function(){return h}),r.d(u,"IS_IOS",function(){return e}),r.d(u,"IOS_VERSION",function(){return a}),r.d(u,"IS_ANDROID",function(){return E}),r.d(u,"ANDROID_VERSION",function(){return D}),r.d(u,"IS_OLD_ANDROID",function(){return O}),r.d(u,"IS_NATIVE_ANDROID",function(){return f}),r.d(u,"IS_FIREFOX",function(){return t}),r.d(u,"FIREFOX_VERSION",function(){return d}),r.d(u,"IS_EDGE",function(){return m}),r.d(u,"EDGE_VERSION",function(){return g}),r.d(u,"IS_EDG",function(){return C}),r.d(u,"EDG_VERSION",function(){return N}),r.d(u,"IS_CHROME",function(){return L}),r.d(u,"CHROME_MAJOR_VERSION",function(){return B}),r.d(u,"CHROME_VERSION",function(){return R}),r.d(u,"IS_IE8",function(){return v}),r.d(u,"IE_VERSION",function(){return w}),r.d(u,"IS_SAFARI",function(){return T}),r.d(u,"IS_ANY_SAFARI",function(){return y}),r.d(u,"SAFARI_VERSION",function(){return p}),r.d(u,"IS_TBS",function(){return _}),r.d(u,"TBS_VERSION",function(){return A}),r.d(u,"IS_X5MQQB",function(){return k}),r.d(u,"IS_MQQB",function(){return x}),r.d(u,"MQQB_VERSION",function(){return I}),r.d(u,"IS_QQB",function(){return Y}),r.d(u,"IS_WECHAT",function(){return $}),r.d(u,"WECHAT_VERSION",function(){return U}),r.d(u,"IS_WIN",function(){return c}),r.d(u,"IS_MAC",function(){return M}),r.d(u,"IS_LINUX",function(){return V}),r.d(u,"IS_WX",function(){return G}),r.d(u,"IS_UCBROWSER",function(){return b}),r.d(u,"IS_MIUIBROWSER",function(){return j}),r.d(u,"IS_HUAWEIBROWSER",function(){return H}),r.d(u,"HUAWEI_VERSION",function(){return W}),r.d(u,"BROWSER_VERSION",function(){return q}),r.d(u,"IS_LOCAL",function(){return K}),r.d(u,"getBrowserInfo",function(){return Z}),r.d(u,"getOsInfo",function(){return X});const s=typeof window<"u",i=typeof wx<"u",o=window.navigator&&window.navigator.userAgent||"",S=/AppleWebKit\/([\d.]+)/i.exec(o),P=S?parseFloat(S.pop()):null,l=/iPad/i.test(o),n=/iPhone/i.test(o)&&!l,h=/iPod/i.test(o),e=n||l||h,a=function(){const J=o.match(/OS (\d+)_/i);return J&&J[1]?J[1]:null}(),E=/Android/i.test(o),D=function(){const J=o.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!J)return null;const Q=J[1]&&parseFloat(J[1]),pe=J[2]&&parseFloat(J[2]);return Q&&pe?parseFloat(`${J[1]}.${J[2]}`):Q||null}(),O=E&&/webkit/i.test(o)&&D<2.3,f=E&&D<5&&P<537,t=/Firefox/i.test(o),d=function(){const J=o.match(/Firefox\/(\d+)/);return J&&J[1]?parseFloat(J[1]):null}(),m=/Edge\//i.test(o),g=m&&function(){const J=o.match(/Edge\/(\d+)/i);if(J&&J[1])return J[1]}(),C=/Edg\//i.test(o),N=function(){const J=o.match(/Edg\/(\d+)/);return J&&J[1]?parseFloat(J[1]):null}(),L=!m&&/Chrome/i.test(o),B=function(){const J=o.match(/Chrome\/(\d+)/);return J&&J[1]?parseFloat(J[1]):null}(),R=function(){const J=o.match(/Chrome\/([\d.]+)/);return J&&J[1]?J[1]:null}(),v=/MSIE\s8\.0/.test(o),w=function(){const J=/MSIE\s(\d+)\.\d/.exec(o);let Q=J&&parseFloat(J[1]);return!Q&&/Trident\/7.0/i.test(o)&&/rv:11.0/.test(o)&&(Q=11),Q}(),T=/Safari/i.test(o)&&!L&&!E&&!m,y=T||e,p=function(){const J=o.match(/Version\/([\d.]+)/);return J&&J[1]?J[1]:null}(),_=/TBS\/\d+/i.test(o),A=function(){const J=o.match(/TBS\/(\d+)/i);if(J&&J[1])return J[1]}(),k=!_&&/MQQBrowser\/\d+/i.test(o)&&/COVC\/\d+/i.test(o),x=!_&&/MQQBrowser\/\d+/i.test(o),I=(x||k)&&function(){const J=o.match(/ MQQBrowser\/([\d.]+)/);return J&&J[1]?J[1]:null}(),Y=!_&&/ QQBrowser\/\d+/i.test(o),$=/(micromessenger|webbrowser)/i.test(o),U=$&&function(){const J=o.match(/MicroMessenger\/(\d+)/i);if(J&&J[1])return J[1]}(),c=/Windows/i.test(o),M=/MAC OS X/i.test(o),V=/Linux/i.test(o),G=/MicroMessenger/i.test(o),b=/UCBrowser/i.test(o),j=/MiuiBrowser/i.test(o),H=/HuaweiBrowser/i.test(o),W=H&&function(){const J=o.match(/HuaweiBrowser\/([\d.]+)/);return J&&J[1]?J[1]:null}(),q=L?"Chrome/"+R:T?"Safari/"+p:"NotSupportedBrowser",K=location.protocol==="file:"||location.hostname==="localhost"||/^\d+\.\d+\.\d+\.\d+$/.test(location.hostname),z=new Map([[t,["Firefox",d]],[C,["Edg",N]],[L,["Chrome",R]],[T,["Safari",p]],[_,["TBS",A]],[$&&n,["WeChat",U]],[x,["QQ(Mobile)",I]],[k,["QQ(Mobile X5)",I]],[H,["HW",W]],[m,["EDGE",g]]]);function Z(){let J="unknown",Q="unknown";return z.get(!0)&&(J=z.get(!0)[0],Q=z.get(!0)[1]),{name:J,version:Q}}function X(){let J="unknown";return M&&(J="mac"),c&&(J="windows"),E&&(J="android"),e&&(J="iOS"),{name:J}}},function(F,u,r){(function(s){let i,o;i=typeof console<"u"?console:s!==void 0&&s.console?s.console:typeof window<"u"&&window.console?window.console:{};const S=function(){},P=["assert","clear","count","debug","dir","dirxml","error","exception","group","groupCollapsed","groupEnd","info","log","markTimeline","profile","profileEnd","table","time","timeEnd","timeStamp","trace","warn"];let{length:l}=P;for(;l--;)o=P[l],console[o]||(i[o]=S);i.methods=P,u.a=i}).call(this,r(35))},function(F,u,r){Object.defineProperty(u,"__esModule",{value:!0}),u.ERROR_CN_MESSAGE=u.ERROR_MESSAGE=void 0,u.ERROR_MESSAGE={NO_NETWORK:"未连接到网络",FAILURE_SWITCH_TO_AUDIO:"switch to audio call error",FAILURE_SWITCH_TO_VIDEO:"switch to video call error",NOT_MICROPHONE_LIST:"No microphone device",NOT_CAMERA_LIST:"No camera device",ERROR_PACKAGE_NOT_PURCHASED:"You do not have TUICallKit package, please open the free experience in the console: https://console.intl.cloud.tencent.com/im/detail or purchase the official package: ${purchaseAddress}",ERROR_PACKAGE_NOT_SUPPORTED:"The package you purchased does not support this ability. You can refer to here to purchase: ${purchaseAddress}",ERROR_TIM_VERSION_OUTDATED:"TIM SDK version is too old, Please upgrade version",ERROR_PERMISSION_DENIED:"camera permission refused / microphone permission refused. You can perform the trtc capability test at https://web.sdk.qcloud.com/trtc/webrtc/demo/detect/index.html to check whether the current environment supports audio and video calls",ERROR_GET_DEVICE_LIST_FAIL:"Failed to get device list",ERROR_INIT_FAIL:"init or login is not complete, this API needs to be used after init. To solve the problem, please go to: https://cloud.tencent.com/document/product/647/78769#3a61f42b-e06f-49af-88bf-362d40025887",ERROR_REQUEST_REFUSED:"The API is support use in the state of. To solve the problem, please go to: https://cloud.tencent.com/document/product/647/78769#5e65043d-e3dc-4bd3-8220-3ac7694dfa42",ERROR_REQUEST_REPEATED:"The current method is being executed, please do not call it repeatedly",ERROR_REQUEST_REPEATED_SWITCH:"Consistent with the current call type, please do not switch repeatedly",ERROR_SCENE_NOT_SUPPORTED:"In the current call scene, this function is not supported",ERROR_SIGNALING_SEND_FAIL:"signaling failed to send",ERROR_INVALID_INVITEID:"inviteID is invalid or invitation has been processed. To solve the problem, please go to: https://cloud.tencent.com/document/product/647/84363#e97ea97b-7812-42ed-89b7-2a3840ac0e3f",ERROR_INVALID_SEND_FAIL:"Invalid sender or receiver identifier! To solve the problem, please go to: https://cloud.tencent.com/document/product/647/84363#661be1b0-f649-4199-a343-958c3f4f4bbb",ERROR_PARAM_INVALID:"invalid parameter",ERROR_HTTP:"The current page is detected to be using the http protocol(or localhost). To ensure smooth access and experience of all functions of TUICallEngine SDK for production environment users, please use the https protocol to access the audio and video application page. More Info: https://web.sdk.qcloud.com/trtc/webrtc/doc/en/tutorial-05-info-browser.html#h2-3",NOT_SUPPORT:"The current page does not have webRTC capability. You can perform the trtc capability test at https://web.sdk.qcloud.com/trtc/webrtc/demo/detect/index.html to check whether the current environment supports audio and video calls"},u.ERROR_CN_MESSAGE={NO_NETWORK:"未连接到网络",FAILURE_SWITCH_TO_AUDIO:"切换语音通话失败",FAILURE_SWITCH_TO_VIDEO:"切换视频通话失败",NOT_MICROPHONE_LIST:"没有麦克风设备",NOT_CAMERA_LIST:"没有摄像头设备",ERROR_PACKAGE_NOT_PURCHASED:"您的应用还未开通音视频通话(TUICallKit)能力,您可以去控制台申请免费体验: https://console.cloud.tencent.com/im/detail 或购买通话能力套餐包: ${purchaseAddress}",ERROR_PACKAGE_NOT_SUPPORTED:"您暂不支持使用该能力,请前往如下购买页购买开通: ${purchaseAddress}",ERROR_TIM_VERSION_OUTDATED:"TIM SDK 版本太旧,请升级版本",ERROR_PERMISSION_DENIED:"摄像头/麦克风权限被拒绝,可以前往: https://web.sdk.qcloud.com/trtc/webrtc/demo/detect/index.html 进行 trtc 能力测试,查看当前环境是否支持音视频通话",ERROR_GET_DEVICE_LIST_FAIL:"获取设备列表失败",ERROR_INIT_FAIL:"TUICallEngine 初始化登录未完成,需要在 init 或 login 完成后使用此 API 。解决方案请前往: https://cloud.tencent.com/document/product/647/78769#3a61f42b-e06f-49af-88bf-362d40025887",ERROR_REQUEST_REFUSED:"当前通话状态无法使用该 API。解决方案请前往: https://cloud.tencent.com/document/product/647/78769#5e65043d-e3dc-4bd3-8220-3ac7694dfa42",ERROR_REQUEST_REPEATED:"当前方法正在执行中,请勿重复调用",ERROR_REQUEST_REPEATED_SWITCH:"与当前通话类型一致,请勿重复切换",ERROR_SCENE_NOT_SUPPORTED:"当前通话场景不支持该功能",ERROR_SIGNALING_SEND_FAIL:"信令发送失败",ERROR_INVALID_INVITEID:"邀请 ID 无效或邀请已处理。解决方案请前往: https://cloud.tencent.com/document/product/647/84363#e97ea97b-7812-42ed-89b7-2a3840ac0e3f",ERROR_INVALID_SEND_FAIL:"消息发送方或接收方 UserID 无效或不存在。解决方案请前往: https://cloud.tencent.com/document/product/647/84363#661be1b0-f649-4199-a343-958c3f4f4bbb",ERROR_PARAM_INVALID:"参数错误",ERROR_HTTP:"检测到当前页面正处于 http 协议下,为确保生产环境用户顺畅接入和体验 TUICallEngine SDK 的全部功能,请使用 https 协议(或 localhost)访问音视频应用页面。详情请前往:https://web.sdk.qcloud.com/trtc/webrtc/doc/zh-cn/tutorial-05-info-browser.html#h2-3",NOT_SUPPORT:"当前页面不具备 webRTC 能力。可以前往: https://web.sdk.qcloud.com/trtc/webrtc/demo/detect/index.html 进行 trtc 能力测试,查看当前环境是否支持音视频通话"}},function(F,u,r){var s,i=this&&this.__extends||(s=function(l,n){return(s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(h,e){h.__proto__=e}||function(h,e){for(var a in e)e.hasOwnProperty(a)&&(h[a]=e[a])})(l,n)},function(l,n){function h(){this.constructor=l}s(l,n),l.prototype=n===null?Object.create(n):(h.prototype=n.prototype,new h)});Object.defineProperty(u,"__esModule",{value:!0});var o=r(4),S=r(9),P=function(l){function n(h){var e=h.message,a=h.code,E=a===void 0?o.default.UNKNOWN:a,D=l.call(this,e+" "+function(O){for(var f in S.ERROR_CN_MESSAGE)if(o.default[f]===O)return S.ERROR_CN_MESSAGE[f];return"UNKNOWN"}(E)+" <"+function(O){for(var f in o.default)if(o.default[f]===O)return f;return"UNKNOWN"}(E)+": "+E+">")||this;return D.code=E,D.name="TUICallEngineError",D.message_=e,D}return i(n,l),n.prototype.getCode=function(){return this.code},n}(Error);u.default=P},function(F,u,r){r.r(u);var s=r(1),i=r(2),o=r(4),S=r.n(o),P=r(9);class l{constructor(h){this.sdkappid="",this.version="",this.userid="",this.platform="",this.useragent="",this.method=h,this.codeint=1,this.calltype=1,this.talktime=0,this.message="",this.text="",this.startts=Date.now(),this.endts=0,this.timespan=0,this.time="",this.networktype="",this.host=Object(s.getHostType)()}static bindController(h){l.prototype._eventStatController=h}setCommonInfo(h){const{SDKAppID:e,version:a,userID:E,platform:D,scene:O}=h;this.sdkappid=e,this.version=""+a,this.userid=E,this.platform=D,this.scene=O,this.time=Object(s.date2ISOString)(),this.startts&&this.endts&&!this.timespan&&(this.timespan=Math.abs(this.endts-this.startts))}setEnd(h=!1){this.endts=Date.now(),h?this._eventStatController.pushIn(this):setTimeout(()=>{this._eventStatController.pushIn(this)},0)}setError(h,e,a){return this.setNetworkType(a),e?(h.code&&this.setCode(h.code),h.message&&this.setMessage(h.message)):(this.setCode(S.a.NO_NETWORK),this.setMessage(P.ERROR_MESSAGE.NO_NETWORK)),this}setCode(h){return h==="ECONNABORTED"&&(this.codeint=103),Object(s.isNumber)(h)?this.codeint=h:i.default.warn("SSOLogData.setCode value not a number, please check!",h,typeof h),this}setMessage(h){return Object(s.isString)(h)?(this.message=h,this):this}setText(h){return Object(s.isNumber)(h)?this.text=h.toString():Object(s.isString)(h)?this.text=h:Object(s.isPlainObject)(h)&&(this.text=JSON.stringify(h)),this}setTalkTime(h){return this.talktime=h,this}setMessageType(h){return this.msgType=h,this}setCallType(h){return this.calltype=h,this}setNetworkType(h){return Object(s.isUndefined)(h)?i.default.warn("SSOLogData.setNetworkType value is undefined, please check!"):this.networktype=h,this}}u.default=l},function(F,u,r){Object.defineProperty(u,"__esModule",{value:!0}),u.TUICallEvent=void 0,u.TUICallEvent={ERROR:"onError",SDK_READY:"sdkReady",ON_CALL_BEGIN:"onCallBegin",INVITED:"onInvited",ON_CALL_RECEIVED:"onCallReceived",USER_ACCEPT:"onUserAccept",USER_ENTER:"onUserEnter",USER_LEAVE:"onUserLeave",REJECT:"onReject",NO_RESP:"onNoResp",LINE_BUSY:"onLineBusy",CALLING_CANCEL:"onCallingCancel",ON_CALL_CANCELED:"onCallCanceled",KICKED_OUT:"onKickedOut",CALLING_TIMEOUT:"onCallingTimeout",CALL_END:"onCallEnd",CALLING_END:"onCallEnd",USER_VIDEO_AVAILABLE:"onUserVideoAvailable",USER_AUDIO_AVAILABLE:"onUserAudioAvailable",USER_VOICE_VOLUME:"onUserVoiceVolume",GROUP_CALL_INVITEE_LIST_UPDATE:"onGroupCallInviteeListUpdate",CALL_TYPE_CHANGED:"onCallTypeChanged",DEVICED_UPDATED:"onDeviceUpdated",MESSAGE_SENT_BY_ME:"onMessageSentByMe"}},function(F,u,r){r.r(u),r.d(u,"default",function(){return D});var s=r(2),i=r(1);class o{constructor(){this._table="timweb-trtccalling",this._report=[]}pushIn(f){s.default.debug("SSOLogBody.pushIn",this._report.length,f),this._report.push(f)}backfill(f){Object(i.isArray)(f)&&f.length!==0&&(s.default.debug("SSOLogBody.backfill",this._report.length,f.length),this._report.unshift(...f))}getLogsNumInMemory(){return this._report.length}isEmpty(){return this._report.length===0}_reset(){this._report.length=0,this._report=[]}getTable(){return this._table}getLogsInMemory(){const f=this._report.slice();return this._reset(),f}}var S=r(11),P=r(17),l=r(29),n=r.n(l);const h={CURRENT:{COMMON:"https://webim.tim.qq.com"}},e={IM_OPEN_STAT:"imopenstat"},a={TIM_WEB_TRTCCALLING_REPORT:"tweb_trtccalling_report"},E={imopenstat:"v4"};class D{constructor(){this.TAG="trtccalling-ssolog-event",this._reportBody=new o,this._version=P.version||"",this.MIN_THRESHOLD=20,this.MAX_THRESHOLD=100,this.WAITING_TIME=6e4,this.INTERVAL=2e4,this._timerID=0,this._resetLastReportTime(),this._startReportTimer(),this._retryCount=0,this.MAX_RETRY_COUNT=3}reportAtOnce(){s.default.debug("EventStatController.reportAtOnce"),this._report()}pushIn(f){f instanceof S.default&&(f.setCommonInfo({SDKAppID:Number(sessionStorage.getItem("sdkAppId")),version:this._version,userID:sessionStorage.getItem("userId")}),this._reportBody.pushIn(f),this._report())}_resetLastReportTime(){this._lastReportTime=Date.now()}_startReportTimer(){this._timerID=setInterval(()=>{Date.now()<this._lastReportTime+this.WAITING_TIME||this._reportBody.isEmpty()||this._report()},this.INTERVAL)}_stopReportTimer(){this._timerID>0&&(clearInterval(this._timerID),this._timerID=0)}_report(){if(this._reportBody.isEmpty())return;const f=Math.ceil(+new Date/1e3),t=sessionStorage.getItem("sdkAppId"),d=this._reportBody.getLogsInMemory(),m={table:this._reportBody.getTable(),report:d},g=`${h.CURRENT.COMMON}/${E.imopenstat}/${e.IM_OPEN_STAT}/${a.TIM_WEB_TRTCCALLING_REPORT}/?sdkappid=${t}&reqtime=${f}`;n.a.post(g,JSON.stringify(m)).then(()=>{this._resetLastReportTime(),this._retryCount>0&&(s.default.debug("EventStatController.report retry success"),this._retryCount=0)}).catch(C=>{s.default.warn("EventStatController.report, error:"+Object(i.stringifyError)(C)),this._reportBody.backfill(d),this._reportBody.getLogsNumInMemory()>this.MAX_THRESHOLD||this._retryCount===this.MAX_RETRY_COUNT||this._timerID===0?this._retryCount=0:this._retryCount+=1})}reset(){s.default.log("EventStatController.reset"),this._stopReportTimer(),this._report()}}},function(F,u,r){Object.defineProperty(u,"__esModule",{value:!0}),u.TUICommonDefine=u.TUICallType=void 0,u.TUICallType={AUDIO_CALL:1,VIDEO_CALL:2,DEVCIED_CAMERA:"camera",DEVCIED_MICROPHONES:"microphones"},u.TUICommonDefine={VideoEncoderParams:{"120p":"120p","120p_2":"120p_2","180p":"180p","180p_2":"180p_2","240p":"240p","360p":"360p","360p_2":"360p_2","480p":"480p","480p_2":"480p_2","720p":"720p","1080p":"1080p","1440p":"1440p","4K":"4K"}}},function(F,u,r){r.r(u),r.d(u,"LOG_STATUS",function(){return s});const s={START:"start",SUCCESS:"success",FAIL:"fail"};u.default={SDK_CONSTRUCT:"sdkConstruct",SDK_READY:"sdkReady",SDK_NOT_READY:"sdkNotReady",LOGIN:"login",LOGOUT:"logout",CALL:"call",GROUP_CALL:"groupCall",ACCEPT:"accept",REJECT:"reject",HANGUP:"hangup",START_REMOTE_VIEW:"startRemoteView",STOP_REMOTE_VIEW:"stopRemoteView",START_LOCAL_VIEW:"startLocalView",STOP_LOCAL_VIEW:"stopLocalView",OPEN_CAMERA:"openCamera",CLOSE_CAMERA:"closeCamera",SET_MIC_MUTE:"setMicMute",SET_VIDEO_QUALITY:"setVideoQuality",SWITCH_TO_AUDIO_CALL:"switchToAudioCall",SWITCH_TO_VIDEO_CALL:"switchToVideoCall",SET_VIDEO_RENDER_PARAMS:"setVideoRenderParams",MUTE:"mute",UNMUTE:"unmute",SWITCH_CALL_MIDIA_TYPE:"switchCallMediaType",GET_DEVICE_LIST:"getDeviceList",SWITCH_DEVICE:"switchDevice",SET_SELF_INFO:"setSelfInfo",ENABLE_AI_VOICE:"enableAIVoice",CHANGE_CALL_STATUS:"changeCallStatus",TALK_TIME:"talktime",ERROR:"error",INVITED:"invited",GROUP_CALL_INVITEE_LIST_UPDATE:"group_call_invitee_list_update",USER_ENTER:"user_enter",USER_LEAVE:"user_leave",NO_RESP:"no_resp",LINE_BUSY:"line_busy",CALLING_CANCEL:"calling_cancel",KICKED_OUT:"kicked_out",CALLING_TIMEOUT:"calling_timeout",CALLING_END:"calling_end",USER_VIDEO_AVAILABLE:"user_video_available",USER_AUDIO_AVAILABLE:"user_audio_available",USER_VOICE_VOLUME:"user_voice_volume",CALL_TYPE_CHANGED:"call_type_changed",DEVICED_UPDATED:"deviced_updated",QUALITY_REPORT:"quality_report",TSIGNALING_NEW_INVITATION_RECEIVED:"tsignaling_new_invitation_received"}},function(F,u,r){(function(s){var i=r(3),o=r(43),S=r(21),P={"Content-Type":"application/x-www-form-urlencoded"};function l(e,a){!i.isUndefined(e)&&i.isUndefined(e["Content-Type"])&&(e["Content-Type"]=a)}var n,h={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:((typeof XMLHttpRequest<"u"||s!==void 0&&Object.prototype.toString.call(s)==="[object process]")&&(n=r(22)),n),transformRequest:[function(e,a){return o(a,"Accept"),o(a,"Content-Type"),i.isFormData(e)||i.isArrayBuffer(e)||i.isBuffer(e)||i.isStream(e)||i.isFile(e)||i.isBlob(e)?e:i.isArrayBufferView(e)?e.buffer:i.isURLSearchParams(e)?(l(a,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):i.isObject(e)||a&&a["Content-Type"]==="application/json"?(l(a,"application/json"),function(E,D,O){if(i.isString(E))try{return(D||JSON.parse)(E),i.trim(E)}catch(f){if(f.name!=="SyntaxError")throw f}return(O||JSON.stringify)(E)}(e)):e}],transformResponse:[function(e){var a=this.transitional,E=a&&a.silentJSONParsing,D=a&&a.forcedJSONParsing,O=!E&&this.responseType==="json";if(O||D&&i.isString(e)&&e.length)try{return JSON.parse(e)}catch(f){if(O)throw f.name==="SyntaxError"?S(f,this,"E_JSON_PARSE"):f}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300}};h.headers={common:{Accept:"application/json, text/plain, */*"}},i.forEach(["delete","get","head"],function(e){h.headers[e]={}}),i.forEach(["post","put","patch"],function(e){h.headers[e]=i.merge(P)}),F.exports=h}).call(this,r(42))},function(F){F.exports=JSON.parse(`{"name":"tuicall-engine-webrtc","version":"1.6.1","description":"腾讯云 tuicall-engine-webrtc","main":"index","private":true,"dependencies":{"rtc-ai-denoiser":"latest","EventEmitter":"^1.0.0","axios":"^0.21.0","dayjs":"^1.11.7","tuikit-logger":"latest"},"peerDependencies":{"trtc-js-sdk":"latest","tim-js-sdk":"latest","tsignaling":"latest"},"devDependencies":{"@babel/preset-typescript":"^7.12.7","@typescript-eslint/eslint-plugin":"^4.33.0","@typescript-eslint/parser":"^4.33.0","docdash-blue":"^1.1.9","eslint":"^7.27.0","eslint-config-google":"^0.14.0","eslint-plugin-prettier":"^4.0.0","fs-extra":"^9.0.1","jsdoc":"^3.6.11","prettier":"^2.5.0","pretty":"^2.0.0","replace":"^1.2.2","rimraf":"^4.1.2","ts-loader":"^8.4.0","typescript":"^3.9.7","watch":"^1.0.2","webpack":"^4.44.1","webpack-cli":"^3.3.12"},"scripts":{"watch":"watch 'npm run build_withcopy4' src","dev":"npm run watch","build":"webpack --config webpack.config.js","build_withcopy":"npm run build && cp dist/npm/tuicall-engine-webrtc.js ../../github/TUICalling/Web/node_modules/tuicall-engine-webrtc/tuicall-engine-webrtc.js","build_withcopy2":"npm run build && cp dist/npm/tuicall-engine-webrtc.js ../sdk/trtc-calling-webrtc-demo/node_modules/tuicall-engine-webrtc/tuicall-engine-webrtc.js","build_withcopy3":"npm run build && cp dist/npm/tuicall-engine-webrtc.js ./example-js/tuicall-engine-webrtc.js","build_withcopy4":"npm run build && cp dist/npm/tuicall-engine-webrtc.js ./example/node_modules/tuicall-engine-webrtc/tuicall-engine-webrtc.js","build_demo3":"npm run build && cp dist/npm/tuicall-engine-webrtc.js ./examples/call-engine-demo-vue3//node_modules/tuicall-engine-webrtc/tuicall-engine-webrtc.js","build:package":"node build/package-bundle.js","lint":"./node_modules/.bin/eslint ./src; exit 0","fix":"./node_modules/.bin/eslint --fix ./src; exit 0","prerelease":"npm run lint && npm run build && npm run doc && npm run build:package","doc":"npm run doc:clean && tsc --target ESNEXT && npm run doc:build","doc:build":"npm run changelog && npm run main && ./node_modules/.bin/jsdoc -c build/jsdoc/jsdoc.json && node ./build/jsdoc/fix-doc.js","doc:clean":"node ./build/jsdoc/clean-doc.js","changelog":"cp CHANGELOG.md build/jsdoc/tutorials/20-CHANGELOG.md","main":"cp README.md build/jsdoc/main.md"},"repository":{"type":"git","url":"https://github.com/tencentyun/TUICallKit/tree/main/Web"},"author":"Tencent Cloud Terminal R&D Center","license":"ISC"}`)},function(F,u){F.exports=Ee},function(F,u,r){F.exports=function(s,i){return function(){for(var o=new Array(arguments.length),S=0;S<o.length;S++)o[S]=arguments[S];return s.apply(i,o)}}},function(F,u,r){var s=r(3);function i(o){return encodeURIComponent(o).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}F.exports=function(o,S,P){if(!S)return o;var l;if(P)l=P(S);else if(s.isURLSearchParams(S))l=S.toString();else{var n=[];s.forEach(S,function(e,a){e!=null&&(s.isArray(e)?a+="[]":e=[e],s.forEach(e,function(E){s.isDate(E)?E=E.toISOString():s.isObject(E)&&(E=JSON.stringify(E)),n.push(i(a)+"="+i(E))}))}),l=n.join("&")}if(l){var h=o.indexOf("#");h!==-1&&(o=o.slice(0,h)),o+=(o.indexOf("?")===-1?"?":"&")+l}return o}},function(F,u,r){F.exports=function(s,i,o,S,P){return s.config=i,o&&(s.code=o),s.request=S,s.response=P,s.isAxiosError=!0,s.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},s}},function(F,u,r){var s=r(3),i=r(44),o=r(45),S=r(20),P=r(46),l=r(49),n=r(50),h=r(23);F.exports=function(e){return new Promise(function(a,E){var D=e.data,O=e.headers,f=e.responseType;s.isFormData(D)&&delete O["Content-Type"];var t=new XMLHttpRequest;if(e.auth){var d=e.auth.username||"",m=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";O.Authorization="Basic "+btoa(d+":"+m)}var g=P(e.baseURL,e.url);function C(){if(t){var L="getAllResponseHeaders"in t?l(t.getAllResponseHeaders()):null,B={data:f&&f!=="text"&&f!=="json"?t.response:t.responseText,status:t.status,statusText:t.statusText,headers:L,config:e,request:t};i(a,E,B),t=null}}if(t.open(e.method.toUpperCase(),S(g,e.params,e.paramsSerializer),!0),t.timeout=e.timeout,"onloadend"in t?t.onloadend=C:t.onreadystatechange=function(){t&&t.readyState===4&&(t.status!==0||t.responseURL&&t.responseURL.indexOf("file:")===0)&&setTimeout(C)},t.onabort=function(){t&&(E(h("Request aborted",e,"ECONNABORTED",t)),t=null)},t.onerror=function(){E(h("Network Error",e,null,t)),t=null},t.ontimeout=function(){var L="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(L=e.timeoutErrorMessage),E(h(L,e,e.transitional&&e.transitional.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",t)),t=null},s.isStandardBrowserEnv()){var N=(e.withCredentials||n(g))&&e.xsrfCookieName?o.read(e.xsrfCookieName):void 0;N&&(O[e.xsrfHeaderName]=N)}"setRequestHeader"in t&&s.forEach(O,function(L,B){D===void 0&&B.toLowerCase()==="content-type"?delete O[B]:t.setRequestHeader(B,L)}),s.isUndefined(e.withCredentials)||(t.withCredentials=!!e.withCredentials),f&&f!=="json"&&(t.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&t.addEventListener("progress",e.onDownloadProgress),typeof e.onUploadProgress=="function"&&t.upload&&t.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then(function(L){t&&(t.abort(),E(L),t=null)}),D||(D=null),t.send(D)})}},function(F,u,r){var s=r(21);F.exports=function(i,o,S,P,l){var n=new Error(i);return s(n,o,S,P,l)}},function(F,u,r){F.exports=function(s){return!(!s||!s.__CANCEL__)}},function(F,u,r){var s=r(3);F.exports=function(i,o){o=o||{};var S={},P=["url","method","data"],l=["headers","auth","proxy","params"],n=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],h=["validateStatus"];function e(O,f){return s.isPlainObject(O)&&s.isPlainObject(f)?s.merge(O,f):s.isPlainObject(f)?s.merge({},f):s.isArray(f)?f.slice():f}function a(O){s.isUndefined(o[O])?s.isUndefined(i[O])||(S[O]=e(void 0,i[O])):S[O]=e(i[O],o[O])}s.forEach(P,function(O){s.isUndefined(o[O])||(S[O]=e(void 0,o[O]))}),s.forEach(l,a),s.forEach(n,function(O){s.isUndefined(o[O])?s.isUndefined(i[O])||(S[O]=e(void 0,i[O])):S[O]=e(void 0,o[O])}),s.forEach(h,function(O){O in o?S[O]=e(i[O],o[O]):O in i&&(S[O]=e(void 0,i[O]))});var E=P.concat(l).concat(n).concat(h),D=Object.keys(i).concat(Object.keys(o)).filter(function(O){return E.indexOf(O)===-1});return s.forEach(D,a),S}},function(F,u,r){function s(i){this.message=i}s.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},s.prototype.__CANCEL__=!0,F.exports=s},function(F,u,r){var s=this&&this.__awaiter||function(E,D,O,f){return new(O||(O=Promise))(function(t,d){function m(N){try{C(f.next(N))}catch(L){d(L)}}function g(N){try{C(f.throw(N))}catch(L){d(L)}}function C(N){var L;N.done?t(N.value):(L=N.value,L instanceof O?L:new O(function(B){B(L)})).then(m,g)}C((f=f.apply(E,D||[])).next())})},i=this&&this.__generator||function(E,D){var O,f,t,d,m={label:0,sent:function(){if(1&t[0])throw t[1];return t[1]},trys:[],ops:[]};return d={next:g(0),throw:g(1),return:g(2)},typeof Symbol=="function"&&(d[Symbol.iterator]=function(){return this}),d;function g(C){return function(N){return function(L){if(O)throw new TypeError("Generator is already executing.");for(;m;)try{if(O=1,f&&(t=2&L[0]?f.return:L[0]?f.throw||((t=f.return)&&t.call(f),0):f.next)&&!(t=t.call(f,L[1])).done)return t;switch(f=0,t&&(L=[2&L[0],t.value]),L[0]){case 0:case 1:t=L;break;case 4:return m.label++,{value:L[1],done:!1};case 5:m.label++,f=L[1],L=[0];continue;case 7:L=m.ops.pop(),m.trys.pop();continue;default:if(t=m.trys,!((t=t.length>0&&t[t.length-1])||L[0]!==6&&L[0]!==2)){m=0;continue}if(L[0]===3&&(!t||L[1]>t[0]&&L[1]<t[3])){m.label=L[1];break}if(L[0]===6&&m.label<t[1]){m.label=t[1],t=L;break}if(t&&m.label<t[2]){m.label=t[2],m.ops.push(L);break}t[2]&&m.ops.pop(),m.trys.pop();continue}L=D.call(E,m)}catch(B){L=[6,B],f=0}finally{O=t=0}if(5&L[0])throw L[1];return{value:L[0]?L[1]:void 0,done:!0}}([C,N])}}};Object.defineProperty(u,"__esModule",{value:!0}),u.validateBusiness=u.businessValidate=void 0;var o=r(5),S=r(10),P=r(4),l=r(9),n=r(6),h=r(1);function e(E,D,O){if(o.default().error("validateBusiness.fail",{text:{error:E}}),E.code===2905)throw new S.default({message:l.ERROR_MESSAGE.ERROR_TIM_VERSION_OUTDATED+" >= 2.21.2",code:P.default.ERROR_TIM_VERSION_OUTDATED});var f="";throw f=D===n.CALL_EXPERMENTEL_API_TYPE.PRO?function(t){var d=h.isDomesticSDKAppID(t)?""+l.ERROR_CN_MESSAGE.ERROR_PACKAGE_NOT_SUPPORTED:""+l.ERROR_MESSAGE.ERROR_PACKAGE_NOT_SUPPORTED;return d=d.replace("${purchaseAddress}",h.getPurchaseAddress(t))}(O)+" <ERROR_PACKAGE_NOT_SUPPORTED: "+P.default.ERROR_PACKAGE_NOT_SUPPORTED+">":function(t){var d=h.isDomesticSDKAppID(t)?""+l.ERROR_CN_MESSAGE.ERROR_PACKAGE_NOT_PURCHASED:""+l.ERROR_MESSAGE.ERROR_PACKAGE_NOT_PURCHASED;return d=d.replace("${purchaseAddress}",h.getPurchaseAddress(t))}(O)+" <ERROR_PACKAGE_NOT_PURCHASED: "+P.default.ERROR_PACKAGE_NOT_PURCHASED+">",new Error(f)}function a(E,D,O){return s(this,void 0,void 0,function(){return i(this,function(f){switch(f.label){case 0:return f.trys.push([0,2,,3]),[4,this.tim.callExperimentalAPI("isCommercialAbilityEnabled",E)];case 1:if(f.sent().data.enabled)return[2,D.apply(this,O)];try{E===n.CALL_EXPERMENTEL_API_TYPE.BASE&&(this._callDataReport.setCodeAndMessage(P.default.ERROR_PACKAGE_NOT_SUPPORTED,l.ERROR_MESSAGE.ERROR_PACKAGE_NOT_SUPPORTED),this._callDataReport.uploadToKibana())}catch(t){console.warn("base ability check failed, userId:"+this.getUserID()+", error: "+t)}throw new S.default({message:l.ERROR_MESSAGE.ERROR_PACKAGE_NOT_SUPPORTED,code:P.default.ERROR_PACKAGE_NOT_SUPPORTED});case 2:return e(f.sent(),E,this._sdkAppID),[3,3];case 3:return[2]}})})}u.businessValidate=function(E){return function(D,O,f){var t=f.value;return f.value=function(){for(var d=[],m=0;m<arguments.length;m++)d[m]=arguments[m];return s(this,void 0,void 0,function(){return i(this,function(g){switch(g.label){case 0:return g.trys.push([0,2,,3]),[4,a.call(this,E,t,d)];case 1:return[2,g.sent()];case 2:throw g.sent();case 3:return[2]}})})},f}},u.validateBusiness=function(E,D,O){return s(this,void 0,void 0,function(){var f;return i(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,E.callExperimentalAPI("isCommercialAbilityEnabled",D)];case 1:if((f=t.sent()).data.enabled)return[2,Promise.resolve(f.data.enabled)];throw new S.default({message:l.ERROR_MESSAGE.ERROR_PACKAGE_NOT_SUPPORTED,code:P.default.ERROR_PACKAGE_NOT_SUPPORTED});case 2:return e(t.sent(),D,O),[3,3];case 3:return[2]}})})}},function(F,u,r){Object.defineProperty(u,"__esModule",{value:!0}),u.callRoleMapping=u.callTypeMapping=void 0;var s=r(6),i=r(0);u.callTypeMapping=function(o){var S=i.NAME.UNKNOWN;switch(o){case s.CALL_TYPE.AUDIO_CALL:S=i.NAME.AUDIO;break;case s.CALL_TYPE.VIDEO_CALL:S=i.NAME.VIDEO}return S},u.callRoleMapping=function(o){var S=o;return S===s.CALL_ROLE.INVITER?S=i.NAME.CALLER:S===s.CALL_ROLE.INVITEE&&(S=i.NAME.CALLEE),S}},function(F,u,r){F.exports=r(37)},function(F,u,r){F.exports=function(){var s=6e4,i=36e5,o="millisecond",S="second",P="minute",l="hour",n="day",h="week",e="month",a="quarter",E="year",D="date",O="Invalid Date",f=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,t=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,d={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(p){var _=["th","st","nd","rd"],A=p%100;return"["+p+(_[(A-20)%10]||_[A]||_[0])+"]"}},m=function(p,_,A){var k=String(p);return!k||k.length>=_?p:""+Array(_+1-k.length).join(A)+p},g={s:m,z:function(p){var _=-p.utcOffset(),A=Math.abs(_),k=Math.floor(A/60),x=A%60;return(_<=0?"+":"-")+m(k,2,"0")+":"+m(x,2,"0")},m:function p(_,A){if(_.date()<A.date())return-p(A,_);var k=12*(A.year()-_.year())+(A.month()-_.month()),x=_.clone().add(k,e),I=A-x<0,Y=_.clone().add(k+(I?-1:1),e);return+(-(k+(A-x)/(I?x-Y:Y-x))||0)},a:function(p){return p<0?Math.ceil(p)||0:Math.floor(p)},p:function(p){return{M:e,y:E,w:h,d:n,D,h:l,m:P,s:S,ms:o,Q:a}[p]||String(p||"").toLowerCase().replace(/s$/,"")},u:function(p){return p===void 0}},C="en",N={};N[C]=d;var L="$isDayjsObject",B=function(p){return p instanceof T||!(!p||!p[L])},R=function p(_,A,k){var x;if(!_)return C;if(typeof _=="string"){var I=_.toLowerCase();N[I]&&(x=I),A&&(N[I]=A,x=I);var Y=_.split("-");if(!x&&Y.length>1)return p(Y[0])}else{var $=_.name;N[$]=_,x=$}return!k&&x&&(C=x),x||!k&&C},v=function(p,_){if(B(p))return p.clone();var A=typeof _=="object"?_:{};return A.date=p,A.args=arguments,new T(A)},w=g;w.l=R,w.i=B,w.w=function(p,_){return v(p,{locale:_.$L,utc:_.$u,x:_.$x,$offset:_.$offset})};var T=function(){function p(A){this.$L=R(A.locale,null,!0),this.parse(A),this.$x=this.$x||A.x||{},this[L]=!0}var _=p.prototype;return _.parse=function(A){this.$d=function(k){var x=k.date,I=k.utc;if(x===null)return new Date(NaN);if(w.u(x))return new Date;if(x instanceof Date)return new Date(x);if(typeof x=="string"&&!/Z$/i.test(x)){var Y=x.match(f);if(Y){var $=Y[2]-1||0,U=(Y[7]||"0").substring(0,3);return I?new Date(Date.UTC(Y[1],$,Y[3]||1,Y[4]||0,Y[5]||0,Y[6]||0,U)):new Date(Y[1],$,Y[3]||1,Y[4]||0,Y[5]||0,Y[6]||0,U)}}return new Date(x)}(A),this.init()},_.init=function(){var A=this.$d;this.$y=A.getFullYear(),this.$M=A.getMonth(),this.$D=A.getDate(),this.$W=A.getDay(),this.$H=A.getHours(),this.$m=A.getMinutes(),this.$s=A.getSeconds(),this.$ms=A.getMilliseconds()},_.$utils=function(){return w},_.isValid=function(){return this.$d.toString()!==O},_.isSame=function(A,k){var x=v(A);return this.startOf(k)<=x&&x<=this.endOf(k)},_.isAfter=function(A,k){return v(A)<this.startOf(k)},_.isBefore=function(A,k){return this.endOf(k)<v(A)},_.$g=function(A,k,x){return w.u(A)?this[k]:this.set(x,A)},_.unix=function(){return Math.floor(this.valueOf()/1e3)},_.valueOf=function(){return this.$d.getTime()},_.startOf=function(A,k){var x=this,I=!!w.u(k)||k,Y=w.p(A),$=function(H,W){var q=w.w(x.$u?Date.UTC(x.$y,W,H):new Date(x.$y,W,H),x);return I?q:q.endOf(n)},U=function(H,W){return w.w(x.toDate()[H].apply(x.toDate("s"),(I?[0,0,0,0]:[23,59,59,999]).slice(W)),x)},c=this.$W,M=this.$M,V=this.$D,G="set"+(this.$u?"UTC":"");switch(Y){case E:return I?$(1,0):$(31,11);case e:return I?$(1,M):$(0,M+1);case h:var b=this.$locale().weekStart||0,j=(c<b?c+7:c)-b;return $(I?V-j:V+(6-j),M);case n:case D:return U(G+"Hours",0);case l:return U(G+"Minutes",1);case P:return U(G+"Seconds",2);case S:return U(G+"Milliseconds",3);default:return this.clone()}},_.endOf=function(A){return this.startOf(A,!1)},_.$set=function(A,k){var x,I=w.p(A),Y="set"+(this.$u?"UTC":""),$=(x={},x[n]=Y+"Date",x[D]=Y+"Date",x[e]=Y+"Month",x[E]=Y+"FullYear",x[l]=Y+"Hours",x[P]=Y+"Minutes",x[S]=Y+"Seconds",x[o]=Y+"Milliseconds",x)[I],U=I===n?this.$D+(k-this.$W):k;if(I===e||I===E){var c=this.clone().set(D,1);c.$d[$](U),c.init(),this.$d=c.set(D,Math.min(this.$D,c.daysInMonth())).$d}else $&&this.$d[$](U);return this.init(),this},_.set=function(A,k){return this.clone().$set(A,k)},_.get=function(A){return this[w.p(A)]()},_.add=function(A,k){var x,I=this;A=Number(A);var Y=w.p(k),$=function(M){var V=v(I);return w.w(V.date(V.date()+Math.round(M*A)),I)};if(Y===e)return this.set(e,this.$M+A);if(Y===E)return this.set(E,this.$y+A);if(Y===n)return $(1);if(Y===h)return $(7);var U=(x={},x[P]=s,x[l]=i,x[S]=1e3,x)[Y]||1,c=this.$d.getTime()+A*U;return w.w(c,this)},_.subtract=function(A,k){return this.add(-1*A,k)},_.format=function(A){var k=this,x=this.$locale();if(!this.isValid())return x.invalidDate||O;var I=A||"YYYY-MM-DDTHH:mm:ssZ",Y=w.z(this),$=this.$H,U=this.$m,c=this.$M,M=x.weekdays,V=x.months,G=x.meridiem,b=function(W,q,K,z){return W&&(W[q]||W(k,I))||K[q].slice(0,z)},j=function(W){return w.s($%12||12,W,"0")},H=G||function(W,q,K){var z=W<12?"AM":"PM";return K?z.toLowerCase():z};return I.replace(t,function(W,q){return q||function(K){switch(K){case"YY":return String(k.$y).slice(-2);case"YYYY":return w.s(k.$y,4,"0");case"M":return c+1;case"MM":return w.s(c+1,2,"0");case"MMM":return b(x.monthsShort,c,V,3);case"MMMM":return b(V,c);case"D":return k.$D;case"DD":return w.s(k.$D,2,"0");case"d":return String(k.$W);case"dd":return b(x.weekdaysMin,k.$W,M,2);case"ddd":return b(x.weekdaysShort,k.$W,M,3);case"dddd":return M[k.$W];case"H":return String($);case"HH":return w.s($,2,"0");case"h":return j(1);case"hh":return j(2);case"a":return H($,U,!0);case"A":return H($,U,!1);case"m":return String(U);case"mm":return w.s(U,2,"0");case"s":return String(k.$s);case"ss":return w.s(k.$s,2,"0");case"SSS":return w.s(k.$ms,3,"0");case"Z":return Y}return null}(W)||Y.replace(":","")})},_.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},_.diff=function(A,k,x){var I,Y=this,$=w.p(k),U=v(A),c=(U.utcOffset()-this.utcOffset())*s,M=this-U,V=function(){return w.m(Y,U)};switch($){case E:I=V()/12;break;case e:I=V();break;case a:I=V()/3;break;case h:I=(M-c)/6048e5;break;case n:I=(M-c)/864e5;break;case l:I=M/i;break;case P:I=M/s;break;case S:I=M/1e3;break;default:I=M}return x?I:w.a(I)},_.daysInMonth=function(){return this.endOf(e).$D},_.$locale=function(){return N[this.$L]},_.locale=function(A,k){if(!A)return this.$L;var x=this.clone(),I=R(A,k,!0);return I&&(x.$L=I),x},_.clone=function(){return w.w(this.$d,this)},_.toDate=function(){return new Date(this.valueOf())},_.toJSON=function(){return this.isValid()?this.toISOString():null},_.toISOString=function(){return this.$d.toISOString()},_.toString=function(){return this.$d.toUTCString()},p}(),y=T.prototype;return v.prototype=y,[["$ms",o],["$s",S],["$m",P],["$H",l],["$W",n],["$M",e],["$y",E],["$D",D]].forEach(function(p){y[p[1]]=function(_){return this.$g(_,p[0],p[1])}}),v.extend=function(p,_){return p.$i||(p(_,T,v),p.$i=!0),v},v.locale=R,v.isDayjs=B,v.unix=function(p){return v(1e3*p)},v.en=N[C],v.Ls=N,v.p={},v}()},function(F,u,r){Object.defineProperty(u,"__esModule",{value:!0});var s=r(32),i=r(12),o=r(14);u.default={TUICallEngine:s.default,TUICallEvent:i.TUICallEvent,TUICallType:o.TUICallType}},function(F,u,r){var s=this&&this.__assign||function(){return(s=Object.assign||function(U){for(var c,M=1,V=arguments.length;M<V;M++)for(var G in c=arguments[M])Object.prototype.hasOwnProperty.call(c,G)&&(U[G]=c[G]);return U}).apply(this,arguments)},i=this&&this.__decorate||function(U,c,M,V){var G,b=arguments.length,j=b<3?c:V===null?V=Object.getOwnPropertyDescriptor(c,M):V;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(U,c,M,V);else for(var H=U.length-1;H>=0;H--)(G=U[H])&&(j=(b<3?G(j):b>3?G(c,M,j):G(c,M))||j);return b>3&&j&&Object.defineProperty(c,M,j),j},o=this&&this.__metadata||function(U,c){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(U,c)},S=this&&this.__awaiter||function(U,c,M,V){return new(M||(M=Promise))(function(G,b){function j(q){try{W(V.next(q))}catch(K){b(K)}}function H(q){try{W(V.throw(q))}catch(K){b(K)}}function W(q){var K;q.done?G(q.value):(K=q.value,K instanceof M?K:new M(function(z){z(K)})).then(j,H)}W((V=V.apply(U,c||[])).next())})},P=this&&this.__generator||function(U,c){var M,V,G,b,j={label:0,sent:function(){if(1&G[0])throw G[1];return G[1]},trys:[],ops:[]};return b={next:H(0),throw:H(1),return:H(2)},typeof Symbol=="function"&&(b[Symbol.iterator]=function(){return this}),b;function H(W){return function(q){return function(K){if(M)throw new TypeError("Generator is already executing.");for(;j;)try{if(M=1,V&&(G=2&K[0]?V.return:K[0]?V.throw||((G=V.return)&&G.call(V),0):V.next)&&!(G=G.call(V,K[1])).done)return G;switch(V=0,G&&(K=[2&K[0],G.value]),K[0]){case 0:case 1:G=K;break;case 4:return j.label++,{value:K[1],done:!1};case 5:j.label++,V=K[1],K=[0];continue;case 7:K=j.ops.pop(),j.trys.pop();continue;default:if(G=j.trys,!((G=G.length>0&&G[G.length-1])||K[0]!==6&&K[0]!==2)){j=0;continue}if(K[0]===3&&(!G||K[1]>G[0]&&K[1]<G[3])){j.label=K[1];break}if(K[0]===6&&j.label<G[1]){j.label=G[1],G=K;break}if(G&&j.label<G[2]){j.label=G[2],j.ops.push(K);break}G[2]&&j.ops.pop(),j.trys.pop();continue}K=c.call(U,j)}catch(z){K=[6,z],V=0}finally{M=G=0}if(5&K[0])throw K[1];return{value:K[0]?K[1]:void 0,done:!0}}([W,q])}}},l=this&&this.__spreadArrays||function(){for(var U=0,c=0,M=arguments.length;c<M;c++)U+=arguments[c].length;var V=Array(U),G=0;for(c=0;c<M;c++)for(var b=arguments[c],j=0,H=b.length;j<H;j++,G++)V[G]=b[j];return V};Object.defineProperty(u,"__esModule",{value:!0});var n=r(33),h=r(1),e=r(34),a=r(18),E=r(57),D=r(58),O=r(60),f=r(11),t=r(15),d=r(13),m=r(7),g=r(61),C=r(2),N=r(5),L=r(6),B=r(10),R=r(4),v=r(9),w=r(0),T=r(62),y=r(68),p=r(70),_=r(72),A=a,k=E,x=r(17),I="TUICallEngine",Y=N.default({clsConfig:{endpoint:_.CLS_ENDPOINT,topicId:_.CLS_TOPIC_ID}}),$=function(){function U(c){this._localPlayOptions={mirror:!1,muted:!0,objectFit:w.NAME.COVER},this._remotePlayOptions={mirror:!1,muted:!1,objectFit:w.NAME.COVER},this._permission={audio:!1,video:!1},this._initialCallId="",this._sdkAppID=c.SDKAppID,this._isLogin=!1,this._trtcClient=null,this._userID="",this._userSig="",this._switchCallModeStatus=!0,this._timExternal=!1,this._inviterInviteID={},this._audioVideoSwitchIdList=[],this._acceptedUserObject={},this._callTimeout=30,this._callStatus=L.CALL_STATUS.IDLE,this._callType=L.CALL_TYPE.UNKNOWN,this._roomID=0,this._isInviter=!1,this._isGroupCall=!1,this._inviteeList=[],this._unHandledInviteeList=[],this._handledInviteeList=[],sessionStorage.setItem("sdkAppId",""+this._sdkAppID),this._localViewId="",this._netMonitor=new g.default,this._outerEmitter=new n.default,this._delegate=new O.default(this._outerEmitter),this._callDataReport=new y.CallDataReport({version:x.version,sdkAppId:c.SDKAppID}),this._dataReportObserver=new y.TUICallEngineObserver(this._outerEmitter,this._callDataReport),this._connectStartTime=0,c.tim&&(this._timExternal=!0),this.tim=c.tim||k.create(c),this._tsignalingClient=new D.default(this,s(s({tim:this.tim},c),{isRejectNotifyAll:!0})),this._callRecordReport=new p.CallRecordReport({version:x.version,tim:this.tim}),this._recordReportObserver=new p.TUICallEngineRecordObserver(this._outerEmitter,this._callRecordReport),this._quality="480p";var M=new f.default(t.default.SDK_CONSTRUCT);this._eventStatController=new d.default,f.default.bindController(this._eventStatController),M.setText({SDKVersion:x.version,userAgent:m.USER_AGENT,SDKAppID:c.SDKAppID,timExternal:this._timExternal}).setEnd(),this._initLogger(c),this._logger.info(I+".constructor.start",{text:{data:c},type:"api"}),C.default.info(I+" SDK Version:"+x.version+", SDKAppID:"+c.SDKAppID+", UserAgent:"+m.USER_AGENT)}return U.prototype._initLogger=function(c){var M=this;this._logger=Y,this._logger.updateGetReportData(function(){return{app:"TUICallEngine-web",verison:x.version,useragent:{userAgent:window.navigator.userAgent,language:window.navigator.language,platform:window.navigator.platform},platform:w.NAME.WEB,sdkappid:c.SDKAppID,time:+new Date,userid:M.getUserID(),callinfo:{roomid:M.getRoomID(),inviteid:M.getInitialCallId(),callrole:M.isInviter()?w.NAME.INVITER:w.NAME.INVITEE,groupid:M.getGroupID(),calltype:M.getCallType(),handledInviteeList:M.getHandledInviteeList(),unHandledInviteeList:M.getUnHandledInviteeList()},callkitversion:c.callkitVersion||w.NAME.UNKNOWN,framework:c.frameWork||w.NAME.UNKNOWN,isfromchat:c.chat?"true":"false"}})},U.prototype.getDevicePermission=function(){return this._permission},U.prototype.setDevicePermission=function(c,M){this._permission[c]=M},U.prototype.getTrtcClient=function(){var c;return(c=this._trtcClient)===null||c===void 0?void 0:c.getClient()},U.prototype.getLogger=function(){return this._logger},U.prototype.getUserID=function(){return this._userID},U.prototype.setRoomID=function(c){this._roomID=c},U.prototype.getRoomID=function(){return this._roomID},U.prototype.getCallType=function(){return this._callType},U.prototype.setCallType=function(c){this._callType=c},U.prototype.isInviter=function(){return this._isInviter},U.prototype.setConnectStartTime=function(c){this._connectStartTime=c},U.prototype.getConnectStartTime=function(){return this._connectStartTime},U.prototype.getInviteeList=function(){return this._inviteeList},U.prototype.setInviteeList=function(c){this._inviteeList=l(c)},U.prototype.getCallDataReport=function(){return this._callDataReport},U.prototype.getCallRecordReport=function(){return this._callRecordReport},U.prototype.getUnHandledInviteeList=function(){return this._unHandledInviteeList||[]},U.prototype.setUnHandledInviteeList=function(c){this._unHandledInviteeList=l(c),C.default.log(I+".setUnHandledInviteeList",this._unHandledInviteeList)},U.prototype.addUnHandledInviteeList=function(c){var M=this;c===void 0&&(c=[]),c.length!==0&&c.forEach(function(V){M._unHandledInviteeList.indexOf(V)===-1&&M._unHandledInviteeList.push(V)})},U.prototype.deleteUnHandledInviteeList=function(c){var M=this;c===void 0&&(c=[]),c.length!==0&&c.forEach(function(V){M._unHandledInviteeList=M._unHandledInviteeList.filter(function(G){return G!==V})})},U.prototype.getHandledInviteeList=function(){return this._handledInviteeList||[]},U.prototype.setHandledInviteeList=function(c){this._handledInviteeList=l(c),C.default.log(I+".setHandledInviteeList",this._handledInviteeList)},U.prototype.addHandledInviteeList=function(c){var M=this;c===void 0&&(c=[]),c.length!==0&&c.forEach(function(V){M._handledInviteeList.indexOf(V)===-1&&M._handledInviteeList.push(V)})},U.prototype.deleteHandledInviteeList=function(c){var M=this;c===void 0&&(c=[]),c.length!==0&&c.forEach(function(V){M._handledInviteeList=M._handledInviteeList.filter(function(G){return G!==V})})},U.prototype.isGroupCall=function(){return this._isGroupCall},U.prototype.setIsGroupCall=function(c){this._isGroupCall=c},U.prototype.getGroupID=function(){return this._groupID},U.prototype.setGroupID=function(c){this._groupID=c},U.prototype.setLocalPlayOptions=function(c){c===void 0&&(c={}),this._localPlayOptions=s(s({},this._localPlayOptions),c)},U.prototype.getLocalPlayOptions=function(){return this._localPlayOptions||{}},U.prototype.setRemotePlayOptions=function(c){c===void 0&&(c={}),this._remotePlayOptions=s(s({},this._remotePlayOptions),c)},U.prototype.getRemotePlayOptions=function(){return this._remotePlayOptions||{}},U.prototype.addAcceptedUserList=function(c,M){var V=this;if(M.length!==0)if(c)(this._acceptedUserObject[c]||[]).length===0?this._acceptedUserObject[c]=M:M.forEach(function(W){V._acceptedUserObject[c].indexOf(W)===-1&&V._acceptedUserObject[c].push(W)});else for(var G=this.getInviterInviteIdList(),b=function(W){var q=G[W],K=j.getInviterInviteIdUserList(q),z=M.filter(function(Z){return K.indexOf(Z)!==-1});(j._acceptedUserObject[q]||[]).length===0?j._acceptedUserObject[q]=z:z.forEach(function(Z){V._acceptedUserObject[q].indexOf(Z)===-1&&V._acceptedUserObject[q].push(Z)})},j=this,H=0;H<G.length;H++)b(H)},U.prototype.getAcceptedUserList=function(c){return this._acceptedUserObject[c]||[]},U.prototype.setIsLogin=function(c){this._isLogin=c},U.prototype.getIsLogin=function(){return this._isLogin},U.createInstance=function(c){return Y.updateEsConfig({url:_.ES_URL+"?sdkappid="+(c==null?void 0:c.SDKAppID),table:_.ES_TABLE}),U.instance||(U.instance=new U(c)),U.instance},U.prototype.destroyInstance=function(){return S(this,void 0,void 0,function(){return P(this,function(c){switch(c.label){case 0:return this.getIsLogin()?this._timExternal?[4,this.logout()]:[3,2]:[3,4];case 1:return c.sent(),[3,4];case 2:return[4,this.tim.destroy()];case 3:c.sent(),c.label=4;case 4:return this._callDataReport.reset(),this._dataReportObserver.removeLister(),this._callRecordReport.reset(),this._recordReportObserver.removeLister(),U.instance=null,[2]}})})},U.prototype.setLogLevel=function(c){C.default.setLevel(c),this._tsignalingClient.setLogLevel(c),A.Logger.setLogLevel(1)},U.prototype.on=function(c,M,V){this._outerEmitter.on(c,M,V||this)},U.prototype.off=function(c,M,V){this._outerEmitter.off(c,M,V||this)},U.prototype.init=function(c){return S(this,void 0,void 0,function(){return P(this,function(M){return[2,this.login(c)]})})},U.prototype.login=function(c){return S(this,void 0,void 0,function(){var M,V,G,b,j;return P(this,function(H){switch(H.label){case 0:if(this._logger.updateGetReportData(function(){return{userid:c.userID}}),this._logger.info(I+".login.start",{text:{data:s(s({},c),{userSig:""})},type:"api"}),this.getIsLogin())return this._logger.warn(I+".login.fail",{text:{error:"userId has been login"},type:"api"}),C.default.warn(I+".login - userId has been login"),[2];H.label=1;case 1:return H.trys.push([1,3,,4]),C.default.debug(I+".login - params:",c),this._netMonitor.start(),M=c.userID,V=c.userSig,G=c.assetsPath,this._userID=M,this._callDataReport.setUserID(M),this._userSig=V,this._trtcClient=new e.default({sdkAppID:this._sdkAppID,userID:M,userSig:V,tuiCallEngine:this,assetsPath:G}),sessionStorage.setItem("userId",""+this._userID),[4,this._tsignalingClient.login({userID:M,userSig:V})];case 2:return b=H.sent(),this.setIsLogin(!0),[2,b];case 3:throw j=H.sent(),this._logger.error(I+".login.fail",{text:{error:j},type:"api"}),new Error(I+".login - userId: "+this._userID+" login failed, error: "+j+" ");case 4:return[2]}})})},U.prototype.logout=function(){return S(this,void 0,void 0,function(){var c;return P(this,function(M){switch(M.label){case 0:C.default.debug(I+".logout"),this._logger.info(I+".logout.start",{text:{data:{userID:this._userID,timExternal:this._timExternal}},type:"api"}),this._userID="",this._userSig="",M.label=1;case 1:return M.trys.push([1,5,,6]),[4,this._resetTUICallEngine()];case 2:return M.sent(),this._trtcClient.removeTRTCEvents(),this._trtcClient=null,this.setIsLogin(!1),this._timExternal?[3,4]:[4,this._tsignalingClient.logout()];case 3:M.sent(),M.label=4;case 4:return[2,!0];case 5:throw c=M.sent(),this._logger.error(I+".logout.fail",{text:{data:{userID:this._userID},error:c},type:"api"}),new Error(I+".logout failed, error: "+c+" ");case 6:return[2]}})})},U.prototype.call=function(c){var M,V;return S(this,void 0,void 0,function(){var G,b,j,H,W,q,K,z,Z,X,J;return P(this,function(Q){switch(Q.label){case 0:this._logger.info(I+".call.start",{text:{data:c},type:"api"}),C.default.log(I+".call - params:",c),this._callDataReport.setAbilityBit(!0),this._callDataReport.setCallScene(w.NAME.SINGLE_CALL),Q.label=1;case 1:return Q.trys.push([1,3,,4]),[4,(M=this._trtcClient)===null||M===void 0?void 0:M.getMediaDevicesAuth({audio:!0})];case 2:return Q.sent(),[3,4];case 3:return G=Q.sent(),this.checkDevicePermissionErrorHandle(G,"call",w.NAME.AUDIO),[3,4];case 4:if(b=c.userID,j=c.type,H=c.offlinePushInfo,W=c.roomID,q=c.timeout,K=c.userData,this.getUserID()===b)throw this._logger.error(I+".call.fail",{text:{error:"Called id can not be yourself. userId:"+this.getUserID()+", inviteeId:"+b},type:"api"}),C.default.log(I+".call failed. Called id can't be yourself. userId:"+this.getUserID()+", inviteeId:"+b),new Error(I+".call failed. Called id can't be yourself. userId:"+this.getUserID()+", inviteeId:"+b);this._callStatus=L.CALL_STATUS.CALLING,this._callType=j,this._isInviter=!0,this._inviterID=this._userID,this._inviteeID=b,this._isGroupCall=!1,this._groupID="",this._roomID=W||h.generateRandomRoomID(),this._callTimeout=q||this._callTimeout,C.default.info("roomID:"+this._roomID),z={callType:w.NAME.SINGLE,mediaType:j,inviteeList:[b]},Q.label=5;case 5:return Q.trys.push([5,11,,13]),[4,(V=this._trtcClient)===null||V===void 0?void 0:V.join(this._roomID)];case 6:return Q.sent(),this._callDataReport.setEnterRoomTime(new Date().getTime()),this._tsignalingClient.setTSignalingIsJoined(!0),Z=this._callDataReport.getCallData(),Z=s(s({},Z),{roomID:this._roomID,callRole:L.CALL_ROLE.INVITER,callType:this._callType,inviteeList:[b]}),this._callDataReport.setCallData(Z),[4,this._tsignalingClient.invite({userID:b,type:j,roomID:this._roomID,timeout:this._callTimeout,offlinePushInfo:H,userIDList:[b],userData:K})];case 7:return X=Q.sent(),this._callDataReport.setSendSignalingTime(new Date().getTime()),this.setHandledInviteeList([this._userID]),this.setUnHandledInviteeList([b]),""+(j+1)+X.data.message.conversationType+X.data.message.from+X.data.message.to,X.code!==0?[3,8]:(this.addInviterInviteId(X.inviteID,[this._userID,b]),this._callDataReport.setInviteID(X.inviteID),this.setInitialCallId(X.inviteID),this._callRecordUpload(s({eventType:w.NAME.START_CALL},z)),this._callRecordReport.startHeartbeat(),[3,10]);case 8:return this._callDataReport.setCodeAndMessage(X.code,X.message),this._callDataReport.uploadToKibana(),this._callRecordUpload(s({eventType:w.NAME.CALL_FAILED},z)),this._logger.error(I+".call.fail",{text:{error:X},type:"api"}),[4,this._resetTUICallEngine()];case 9:Q.sent(),Q.label=10;case 10:return[2,X];case 11:return(J=Q.sent()).getCode?this._callDataReport.setCodeAndMessage(J.getCode(),J.message):J.code===R.default.ERROR_BLACKLIST?(this._delegate.onError(R.default.ERROR_BLACKLIST,J.message),this._callDataReport.setCodeAndMessage(R.default.ERROR_BLACKLIST,J.message)):this._callDataReport.setCodeAndMessage(R.default.UNKNOWN,JSON.stringify(J)),this._callDataReport.uploadToKibana(),this._callRecordUpload(s({eventType:w.NAME.CALL_FAILED},z)),this._logger.error(I+".call.fail",{text:{error:J},type:"api"}),[4,this._resetTUICallEngine()];case 12:throw Q.sent(),new B.default({message:I+"<call>: failed "+J.message,code:J.code});case 13:return[2]}})})},U.prototype.addAudioVideoSwitchIdList=function(c){c&&this._audioVideoSwitchIdList.push(c)},U.prototype.getAudioVideoSwitchIdList=function(){return this._audioVideoSwitchIdList||[]},U.prototype.addInviterInviteId=function(c,M){M.length!==0&&((this._inviterInviteID[c]||[]).length===0?this._inviterInviteID[c]=M:this._inviterInviteID[c]=l(this._inviterInviteID[c],M))},U.prototype.getInviterInviteIdList=function(){return Object.keys(this._inviterInviteID||{})},U.prototype.getTotalInviterInviteIdList=function(){var c=this.getInviterInviteIdList();return l(this._audioVideoSwitchIdList,c)},U.prototype.getInviterInviteIdUserList=function(c){var M=this,V=[];return c?V=this._inviterInviteID[c]||[]:this.getInviterInviteIdList().forEach(function(G){V=l(V,M.getInviterInviteIdUserList(G))}),V},U.prototype.getInviterID=function(){return this._inviterID},U.prototype.setInviterID=function(c){this._inviterID=c},U.prototype.groupCall=function(c){var M,V;return S(this,void 0,void 0,function(){var G,b,j,H,W,q,K,z,Z,X,J;return P(this,function(Q){switch(Q.label){case 0:if(this._logger.info(I+".groupCall.start",{text:{data:c},type:"api"}),((M=c==null?void 0:c.userIDList)===null||M===void 0?void 0:M.length)===0)throw new B.default({message:I+"<groupCall>: userIDList don' empty ",code:R.default.ERROR_PARAM_INVALID});C.default.debug(I+".groupCall - params:",c),Q.label=1;case 1:return Q.trys.push([1,3,,4]),[4,(V=this._trtcClient)===null||V===void 0?void 0:V.getMediaDevicesAuth({audio:!0})];case 2:return Q.sent(),[3,4];case 3:return G=Q.sent(),this.checkDevicePermissionErrorHandle(G,"groupCall",w.NAME.AUDIO),[3,4];case 4:if(b=c.userIDList,j=c.type,H=c.groupID,W=c.offlinePushInfo,q=c.roomID,K=c.timeout,z=c.userData,(b=l(b)).indexOf(this.getUserID())!==-1)throw C.default.log(I+".groupCall failed. Called list can't contain yourself. userId:"+this.getUserID()+", inviteeIdList:"+b),new Error(I+".groupCall failed. Called list can't contain yourself. userId:"+this.getUserID()+", inviteeIdList:"+b);this._callType=j,this._isInviter=!0,this._isGroupCall=!0,this._inviterID=this._userID,this._groupID=H||"",this.setInviteeList(b),this.setHandledInviteeList([this._userID]),this.setUnHandledInviteeList(b),this._roomID||(this._roomID=q||h.generateRandomRoomID(),this._callStatus=L.CALL_STATUS.CALLING),this._callTimeout=K||this._callTimeout,this._callDataReport.setCallScene(w.NAME.GROUP_CALL),Z={callType:w.NAME.GROUP,mediaType:j,inviteeList:b},Q.label=5;case 5:return Q.trys.push([5,11,,13]),[4,this._trtcClient.join(this._roomID)];case 6:return Q.sent(),this._tsignalingClient.setTSignalingIsJoined(!0),[4,this._tsignalingClient.inviteInGroup({groupID:this._groupID,userIDList:b,type:j,roomID:this._roomID,timeout:this._callTimeout,offlinePushInfo:W,userData:z})];case 7:return X=Q.sent(),C.default.log("groupCall res",X),H?(""+(j+1)+X.data.message.conversationType+X.data.message.from+X.data.message.to+b,X.code!==0?[3,8]:(this.addInviterInviteId(X.inviteID,l([this._userID],b)),this.setInitialCallId(X.inviteID),this._callRecordUpload(s({eventType:w.NAME.START_CALL},Z)),this._callRecordReport.startHeartbeat(),[3,10])):[3,10];case 8:return this._callRecordUpload(s({eventType:w.NAME.CALL_FAILED},Z)),this._logger.error(I+".inviteInGroup.fail",{text:{data:X},type:"api"}),[4,this._resetTUICallEngine()];case 9:Q.sent(),Q.label=10;case 10:return[2,X];case 11:return J=Q.sent(),this._callRecordUpload(s({eventType:w.NAME.CALL_FAILED},Z)),this._logger.error(I+".groupCall.fail",{text:{error:J},type:"api"}),[4,this._resetTUICallEngine()];case 12:throw Q.sent(),new B.default({message:I+"<groupCall>: failed "+J.message,code:J.code});case 13:return[2]}})})},U.prototype.joinInGroupCall=function(c){var M,V;return S(this,void 0,void 0,function(){var G,b,j,H,W,q;return P(this,function(K){switch(K.label){case 0:this._logger.info(I+".joinInGroupCall.start",{text:{data:c},type:"api"}),K.label=1;case 1:return K.trys.push([1,3,,4]),[4,(M=this._trtcClient)===null||M===void 0?void 0:M.getMediaDevicesAuth({audio:!0})];case 2:return K.sent(),[3,4];case 3:return G=K.sent(),this.checkDevicePermissionErrorHandle(G,"joinInGroupCall",w.NAME.AUDIO),[3,4];case 4:return K.trys.push([4,6,,8]),b=c.roomID,j=c.type,H=c.groupID,this._callType=j,this._groupID=H,this._roomID=b,this._isGroupCall=!0,this._isInviter=!1,this.addHandledInviteeList([this.getUserID()]),this.changeCallStatus(L.CALL_STATUS.CALLING),[4,(V=this._trtcClient)===null||V===void 0?void 0:V.join(b)];case 5:return K.sent(),this.changeCallStatus(L.CALL_STATUS.CONNECTED),this.getCallRecordReport().setBodyStatus(L.CALL_STATUS.CONNECTED),C.default.log(I+".joinInGroupCall roomID:"+b+",type:"+j+",userID:"+this.getUserID()),W={eventType:w.NAME.JOIN_IN_GROUP_CALL,callType:w.NAME.GROUP,mediaType:this._callType},this._callRecordUpload(W),this._callRecordReport.startHeartbeat(),[3,8];case 6:return q=K.sent(),this._logger.error(I+".joinInGroupCall.fail",{text:{error:q},type:"api"}),[4,this._resetTUICallEngine()];case 7:throw K.sent(),new Error(I+".joinInGroupCall failed error: "+q);case 8:return[2]}})})},U.prototype.inviteUser=function(c){return S(this,void 0,void 0,function(){var M,V,G,b,j,H,W,q,K,z,Z,X=this;return P(this,function(J){switch(J.label){case 0:if(this._logger.info(I+".inviteUser.start",{text:{data:c},type:"api"}),!this.isGroupCall())throw this._logger.error(I+".inviteUser.fail",{text:{error:"inviteUser failed",data:c},type:"api"}),C.default.error(I+".inviteUser failed - groupID:"+this._groupID+", roomID:"+this._roomID+", type:"+this._callType),new Error(I+".inviteUser failed - groupID:"+this._groupID+", roomID:"+this._roomID+", type:"+this._callType);if(!this.isInviter()&&this._callStatus!==L.CALL_STATUS.CONNECTED)throw this._logger.error(I+".inviteUser.fail",{text:{error:"current status:"+this._callStatus+" not support"},type:"api"}),C.default.error(I+".inviteUser failed - current status:"+this._callStatus+" not support"),new Error(I+".inviteUser failed - current status:"+this._callStatus+" not support");if(M=c.userIDList,V=M===void 0?[]:M,G=c.offlinePushInfo,V.length===0)throw this._logger.error(I+".inviteUser.fail",{text:{error:"userIDList is empty"},type:"api"}),C.default.error(I+".inviteUser failed - userIDList is empty"),new Error(I+".inviteUser failed - userIDList is empty");if(b=this.getHandledInviteeList(),j=this.getUnHandledInviteeList(),H=l(b,j),(W=V.filter(function(Q){return H.indexOf(Q)===-1})).length===0)return this._logger.error(I+".inviteUser.fail",{text:{error:"userIDList in call list",data:{userIDList:V,totalUserList:H}},type:"api"}),C.default.error(I+".inviteUser failed - userIDList in call list. userIDList:"+JSON.stringify(V)+", call list:"+JSON.stringify(H)),[2,Promise.reject(I+".inviteUser failed - userIDList in call list. userIDList:"+JSON.stringify(V)+", call list:"+JSON.stringify(H))];V=W,J.label=1;case 1:return J.trys.push([1,3,,4]),q=this._handledInviteeList.filter(function(Q){return Q!==X._userID}),[4,this._tsignalingClient.inviteInGroup({groupID:this._groupID,userIDList:V,type:this._callType,roomID:this._roomID,timeout:this._callTimeout,inCallUserIDs:l(this._unHandledInviteeList,q),offlinePushInfo:G,initialCallId:this.getInitialCallId()})];case 2:return K=J.sent(),C.default.log("inviteUser res",K),""+(this._callType+1)+K.data.message.conversationType+K.data.message.from+K.data.message.to+V,K.code===0?(this.addUnHandledInviteeList(V),this.addInviterInviteId(K.inviteID,l([this._userID],V)),z={eventType:w.NAME.INVITE_USER,callType:w.NAME.GROUP,mediaType:this._callType,inviteeList:V},this._callRecordUpload(z)):this._logger.error(I+".inviteUser.fail",{type:"api"}),[2,K];case 3:throw Z=J.sent(),new Error(I+".inviteUser failed, userId:"+this.getUserID()+", inviteeIdList:"+V+", error: "+Z);case 4:return[2]}})})},U.prototype.accept=function(){var c,M;return S(this,void 0,void 0,function(){var V,G,b,j,H,W,q,K,z,Z;return P(this,function(X){switch(X.label){case 0:if(this._logger.info(I+".accept.start",{text:{data:{callStatus:this.getCallStatus(),inviteData:this._tsignalingClient.getInviteData()},type:"api"}}),C.default.debug(I+".accept"),this.getCallStatus()===L.CALL_STATUS.CONNECTED)return this._logger.error(I+".accept.fail",{text:{error:"already connected, avoid repeat accept"},type:"api"}),C.default.warn(I+".accept - already connected, avoid repeat accept"),[2];if(!this._tsignalingClient.getInviteData())return this._logger.error(I+".accept.fail",{text:{error:"there are no calls to accept"},type:"api"}),C.default.warn(I+".accept - there are no calls to accept"),[2];this._callDataReport.setCallAcceptTime(new Date().getTime()),X.label=1;case 1:return X.trys.push([1,5,,6]),[4,(c=this._trtcClient)===null||c===void 0?void 0:c.getMediaDevicesAuth({audio:!0})];case 2:return X.sent().audio?[3,4]:[4,this._resetTUICallEngine()];case 3:X.sent(),X.label=4;case 4:return[3,6];case 5:return V=X.sent(),this.checkDevicePermissionErrorHandle(V,"accept",w.NAME.AUDIO),[3,6];case 6:G=this._tsignalingClient.getInviteData(),b=G.inviteID,j=G.inviteData,H=j.roomID,W=j.callType,C.default.debug(I+".accept - params","inviteID: "+b+",callType: "+W+",roomID: "+H+"."),this._callType=W,this._callStatus=L.CALL_STATUS.CALLING,console.log("accept roomId: "+H),q={},X.label=7;case 7:return X.trys.push([7,9,,11]),this._callDataReport.setEnterRoomTime(new Date().getTime()),[4,(M=this._trtcClient)===null||M===void 0?void 0:M.join(H)];case 8:return q=X.sent(),this.addHandledInviteeList([this.getUserID()]),this.deleteUnHandledInviteeList([this.getUserID()]),this.addAcceptedUserList(b,[this.getUserID()]),this._tsignalingClient.setInviteData(null),this.changeCallStatus(L.CALL_STATUS.CONNECTED),this.getCallRecordReport().setBodyStatus(L.CALL_STATUS.CONNECTED),[3,11];case 9:return K=X.sent(),this._logger.error(I+".accept.join.fail",{text:{error:K},type:"api"}),this.isGroupCall()||(K.getCode?this._callDataReport.setCodeAndMessage(K.getCode(),K.message):this._callDataReport.setCodeAndMessage(R.default.UNKNOWN,JSON.stringify(K)),this._callDataReport.uploadToKibana()),[4,this._resetTUICallEngine()];case 10:throw X.sent(),new Error(I+".accept failed, error: "+K);case 11:q=s(s({},q),{roomID:H,callType:W}),X.label=12;case 12:return X.trys.push([12,14,,16]),[4,this._tsignalingClient.accept({inviteID:b,callType:W})];case 13:return z=X.sent(),""+(W+1)+z.data.message.conversationType+this._userID+z.data.message.to,this._callRecordUpload({eventType:w.NAME.ACCEPT_CALL}),[3,16];case 14:return Z=X.sent(),C.default.error(Z),this._logger.error(I+".accept.fail",{text:{error:Z},type:"api"}),[4,this._resetTUICallEngine()];case 15:throw X.sent(),this.isGroupCall()||(this._callDataReport.setCodeAndMessage(R.default.UNKNOWN,JSON.stringify(Z)),this._callDataReport.uploadToKibana()),new B.default({message:I+"<accept>: failed "+Z.message,code:Z.code});case 16:return[2,s(s({},q),z)]}})})},U.prototype.reject=function(){return S(this,void 0,void 0,function(){var c,M,V,G,b,j,H,W;return P(this,function(q){switch(q.label){case 0:if(this._logger.info(I+".reject.start",{text:{data:{inviteData:this._tsignalingClient.getInviteData(),callStatus:this._callStatus},type:"api"}}),!this._tsignalingClient.getInviteData())return C.default.warn(I+".reject - there are no calls to reject"),[2];c=this._callStatus===L.CALL_STATUS.CONNECTED,M=this._tsignalingClient.getInviteData(),V=M.inviteID,G=M.inviteData,b=G.callType,C.default.warn(I+".reject - params","inviteID: "+V+",callType: "+b+",isBusy: "+c+"."),q.label=1;case 1:return q.trys.push([1,5,,6]),[4,this._tsignalingClient.reject({inviteID:V,callType:b,isBusy:c})];case 2:return j=q.sent(),this._callRecordUpload({eventType:w.NAME.REJECT_CALL}),c?[3,4]:(H=this.generateEventData(),[4,this._resetTUICallEngine()]);case 3:q.sent(),this._delegate.onCallingCancel(s(s({userID:this._userID},H),{reason:w.NAME.REJECT})),q.label=4;case 4:return[2,j];case 5:throw W=q.sent(),this._logger.error(I+".reject.fail",{text:{error:W},type:"api"}),new B.default({message:I+"<reject>: failed "+W.message,code:W.code});case 6:return[2]}})})},U.prototype.hangup=function(){var c;return S(this,void 0,void 0,function(){var M,V,G,b,j,H,W,q,K,z,Z,X,J,Q,pe,oe,ve,se,re,fe;return P(this,function(ee){switch(ee.label){case 0:if(this._logger.info(I+".hangup.start",{text:{data:{inviteData:this._tsignalingClient.getInviteData(),callStatus:this._callStatus,inviterInviteID:this._acceptedUserObject,inviteIdList:this.getInviterInviteIdList(),isInviter:this.isInviter(),isGroupCall:this.isGroupCall(),callType:this.getCallType(),currentUserID:this.getUserID()}},type:"api"}),C.default.warn(I+". - callStatus:"+this._callStatus+" _inviterInviteID:"+JSON.stringify(this._acceptedUserObject)),this._callStatus===L.CALL_STATUS.IDLE)throw this._logger.error(I+".hangup.fail",{text:{error:"current status:"+this._callStatus,type:"api"}}),new Error(I+".hangup failed. current status:"+this._callStatus);if(this._callStatus===L.CALL_STATUS.CALLING&&this.getInviterInviteIdList().length===0)throw this._logger.error(I+".hangup.fail",{text:{error:"call/groupCall incomplete。please wait cancel"},type:"api"}),new Error(I+".call/groupCall incomplete。please wait cancel");if(M=this.isGroupCall(),V=this.isInviter(),G=this.getUserID(),b=this.generateCallTotalTime(),j=this.getCallType(),W=this.getInviterInviteIdList(),this._callStatus!==L.CALL_STATUS.CONNECTED)return[3,7];ee.label=1;case 1:return ee.trys.push([1,5,,7]),[4,(c=this._trtcClient)===null||c===void 0?void 0:c.leave()];case 2:return ee.sent(),W.length!==0?[3,4]:(X=this.generateCallEndData({callMediaType:j,totalTime:b}),this._delegate.onCallEnd(X),[4,this._resetTUICallEngine()]);case 3:ee.sent(),ee.label=4;case 4:return[3,7];case 5:return q=ee.sent(),this._logger.error(I+".hangup.fail",{text:{error:q},type:"api"}),[4,this._resetTUICallEngine()];case 6:throw ee.sent(),new Error(q);case 7:K=this.getHandledInviteeList(),z=this.getUnHandledInviteeList(),Z=this.generateEventData(),ee.label=8;case 8:return ee.trys.push([8,30,,31]),M?[3,15]:(X=this.generateCallEndData(),V?z.length!==1?[3,10]:[4,this._cancel()]:[3,12]);case 9:return H=ee.sent(),this._delegate.onCallingCancel(s(s({userID:G},Z),{reason:w.NAME.NORMAL})),[3,11];case 10:this._delegate.onCallEnd(X),ee.label=11;case 11:return[3,13];case 12:this._delegate.onCallEnd(X),ee.label=13;case 13:return[4,this._resetTUICallEngine()];case 14:return ee.sent(),[3,29];case 15:return J=this.getCallStatus(),Q={callType:j,userIDList:l(K.filter(function(le){return le!==G}),z),callEnd:b},V?J!==L.CALL_STATUS.CALLING?[3,18]:[4,this._cancel(this.getInviterInviteIdList())]:[3,23];case 16:return H=ee.sent(),[4,this._resetTUICallEngine()];case 17:ee.sent(),this._delegate.onCallingCancel(s(s({userID:G},Z),{reason:w.NAME.NORMAL})),ee.label=18;case 18:if(J!==L.CALL_STATUS.CONNECTED)return[3,22];pe=function(le){var ne,ae,ue,ce,de,he;return P(this,function(ie){switch(ie.label){case 0:return ne=W[le],ae=oe.getInviterInviteIdUserList(ne),(ue=oe.getAcceptedUserList(ne)).length>0?(ce=ue.filter(function(te){return K.indexOf(te)!==-1}),de=ae.filter(function(te){return z.indexOf(te)!==-1}),Q.userIDList=l(ce,de).filter(function(te){return te!==G}),C.default.warn("inviter emit hangup signal, notify userIDList:"+JSON.stringify(Q.userIDList)),Q.userIDList.length===0?[3,2]:[4,oe._tsignalingClient.hangup(Q)]):[3,5];case 1:return H=ie.sent(),[3,4];case 2:return K.length>1?(Q.userIDList=K.filter(function(te){return te!==G}),[4,oe._tsignalingClient.hangup(Q)]):[3,4];case 3:H=ie.sent(),ie.label=4;case 4:return[3,7];case 5:return he=oe.getUnHandledInviteeList(),ae.filter(function(te){return he.indexOf(te)!==-1}).length>0?(C.default.warn("inviter emit cancel signal, userIdList:"+ae),[4,oe._cancel([ne])]):[3,7];case 6:H=ie.sent(),ie.label=7;case 7:return[2]}})},oe=this,re=0,ee.label=19;case 19:return re<W.length?[5,pe(re)]:[3,22];case 20:ee.sent(),ee.label=21;case 21:return re++,[3,19];case 22:return[3,27];case 23:ve=function(le){var ne,ae,ue,ce,de,he;return P(this,function(ie){switch(ie.label){case 0:return ne=W[le],ae=se.getInviterInviteIdUserList(ne),(ue=se.getAcceptedUserList(ne)).length>0?(ce=ue.filter(function(te){return K.indexOf(te)!==-1}),de=ae.filter(function(te){return z.indexOf(te)!==-1}),Q.userIDList=l(ce,de).filter(function(te){return te!==G}),C.default.warn("invitee emit hangup signal, notify userIDList:"+JSON.stringify(Q.userIDList)),Q.userIDList.length===0?[3,2]:[4,se._tsignalingClient.hangup(Q)]):[3,5];case 1:return H=ie.sent(),[3,4];case 2:return K.length>1?(Q.userIDList=K.filter(function(te){return te!==G}),[4,se._tsignalingClient.hangup(Q)]):[3,4];case 3:H=ie.sent(),ie.label=4;case 4:return[3,7];case 5:return he=se.getUnHandledInviteeList(),ae.filter(function(te){return he.indexOf(te)!==-1}).length>0?(C.default.warn("invitee emit cancel signal, inviteID:"+ne),[4,se._cancel([ne])]):[3,7];case 6:H=ie.sent(),ie.label=7;case 7:return[2]}})},se=this,re=0,ee.label=24;case 24:return re<W.length?[5,ve(re)]:[3,27];case 25:ee.sent(),ee.label=26;case 26:return re++,[3,24];case 27:return[4,this._resetTUICallEngine()];case 28:ee.sent(),ee.label=29;case 29:return[2,H];case 30:throw fe=ee.sent(),this._logger.error(I+".hangup.fail",{text:{error:fe},type:"api"}),C.default.warn(I+".hangup failed, error: "+fe),new Error(I+".hangup failed, error: "+fe);case 31:return[2]}})})},U.prototype._cancel=function(c){return S(this,void 0,void 0,function(){var M,V,G,b,j,H;return P(this,function(W){switch(W.label){case 0:this._logger.info(I+"._cancel.start",{text:{data:{inviteIDList:c,inviterInviteID:this._inviterInviteID},type:"api"}}),C.default.log("_cancel _inviterInviteID",this._inviterInviteID),M=[],W.label=1;case 1:W.trys.push([1,6,,7]),(c||[]).length===0&&(c=this.getInviterInviteIdList().slice(0,1)),V=0,W.label=2;case 2:return V<c.length?(G=c[V],[4,this._tsignalingClient.cancel({inviteID:G})]):[3,5];case 3:b=W.sent(),M.push(b),W.label=4;case 4:return V++,[3,2];case 5:return[3,7];case 6:throw j=W.sent(),this._logger.error(I+"._cancel.fail",{text:{error:j},type:"api"}),new B.default({message:I+"<_cancel>: failed "+j.message,code:j.code});case 7:return H="cancel "+JSON.stringify(M)+" succeeded",C.default.log(I+"._cancel "+H),[2,M]}})})},U.prototype.startRemoteView=function(c){var M;return S(this,void 0,void 0,function(){var V,G,b;return P(this,function(j){return this._logger.info(I+".startRemoteView.start",{text:{data:c},type:"api"}),C.default.debug(I+".startRemoteView - params:",c),V=c.userID,G=c.videoViewDomID,b=c.options,[2,(M=this._trtcClient)===null||M===void 0?void 0:M.playRemoteVideo({videoViewDomID:G,userID:V,options:b})]})})},U.prototype.stopRemoteView=function(c){var M;return S(this,void 0,void 0,function(){var V;return P(this,function(G){return this._logger.info(I+".stopRemoteView.start",{text:{data:c},type:"api"}),C.default.debug(I+".stopRemoteView - params:",c),V=c.userID,[2,(M=this._trtcClient)===null||M===void 0?void 0:M.stopRemoteVideo({userID:V})]})})},U.prototype.startLocalView=function(c){var M;return S(this,void 0,void 0,function(){var V,G,b,j;return P(this,function(H){switch(H.label){case 0:return H.trys.push([0,2,,3]),this._logger.info(I+".startLocalView.start",{text:{data:c},type:"api"}),C.default.debug(I+".startLocalView - params:",c),V=c.userID,G=c.videoViewDomID,b=c.options,this._localViewId=G,[4,(M=this._trtcClient)===null||M===void 0?void 0:M.playLocalVideo({videoViewDomID:G,userID:V,options:b})];case 1:return H.sent(),[3,3];case 2:throw j=H.sent(),this._logger.error(I+".startLocalView.fail",{text:{error:j},type:"api"}),new Error(I+".startLocalView failed. error: "+j);case 3:return[2]}})})},U.prototype.stopLocalView=function(c){var M;return S(this,void 0,void 0,function(){return P(this,function(V){return this._logger.info(I+".stopLocalView.start",{text:{data:c},type:"api"}),C.default.debug(I+".stopLocalView - params:",c),c.userID,this._localViewId="",[2,(M=this._trtcClient)===null||M===void 0?void 0:M.stopLocalVideo()]})})},U.prototype.openCamera=function(c){var M;return S(this,void 0,void 0,function(){var V,G,b;return P(this,function(j){switch(j.label){case 0:if(j.trys.push([0,2,,3]),this._logger.info(I+".openCamera.start",{text:{data:{hasDomID:!!c,hasLocalViewId:!!this._localViewId}},type:"api"}),V=c,!c){if(!this._localViewId)return this._logger.error(I+".openCamera.fail",{text:{error:"A DOM parameter is required to render the camera data"},type:"api"}),C.default.error(I+".openCamera failed. error: A DOM parameter is required to render the camera data"),[2];C.default.warn(I+".openCamera warning. warn: A DOM parameter is required to render the camera data. "+I+".startLocalView() will be deprecated soon."),V=this._localViewId}return G={videoViewDomID:V,userID:this.getUserID()},[4,(M=this._trtcClient)===null||M===void 0?void 0:M.playLocalVideo(G)];case 1:return j.sent(),[3,3];case 2:throw b=j.sent(),this._logger.error(I+".openCamera.fail",{text:{error:b},type:"api"}),C.default.error(I+".openCamera failed. error: "+b),new Error(I+".openCamera failed. error: "+b);case 3:return[2]}})})},U.prototype.closeCamera=function(){var c;return S(this,void 0,void 0,function(){return P(this,function(M){try{return this._logger.info(I+".openCamera.start",{type:"api"}),[2,(c=this._trtcClient)===null||c===void 0?void 0:c.stopLocalVideo()]}catch(V){throw this._logger.error(I+".openCamera.fail",{text:{error:V},type:"api"}),new Error(I+".closeCamera failed. error: "+V)}return[2]})})},U.prototype.openMicrophone=function(){var c;return S(this,void 0,void 0,function(){return P(this,function(M){return this._logger.info(I+".openMicrophone.start",{type:"api"}),[2,(c=this._trtcClient)===null||c===void 0?void 0:c.unMuteLocalAudio()]})})},U.prototype.closeMicrophone=function(){var c;return S(this,void 0,void 0,function(){return P(this,function(M){return this._logger.info(I+".closeMicrophone.start",{type:"api"}),[2,(c=this._trtcClient)===null||c===void 0?void 0:c.muteLocalAudio()]})})},U.prototype.setVideoQuality=function(c){return S(this,void 0,void 0,function(){return P(this,function(M){switch(M.label){case 0:return this._logger.info(I+".setVideoQuality.start",{text:{data:{profile:c,currentProfile:this.getVideoQuality(),hasTrtcClient:!!this._trtcClient}},type:"api"}),C.default.debug(I+".setVideoQuality - quality:"+JSON.stringify(c)),c===this.getVideoQuality()?(C.default.warn(I+".setVideoQuality failed - profile not change"),[2]):(this._quality=c,this._trtcClient?[4,this._trtcClient._setVideoProfile(this._trtcClient.getLocalStream(),c)]:[3,2]);case 1:M.sent(),M.label=2;case 2:return[2]}})})},U.prototype.getVideoQuality=function(){return this._quality},U.prototype.setVideoRenderParams=function(c){return S(this,void 0,void 0,function(){return P(this,function(M){switch(M.label){case 0:return this._logger.info(I+".setVideoRenderParams.start",{text:{data:{params:c,hasTRTCClient:!!this._trtcClient}},type:"api"}),this._trtcClient?[4,this._trtcClient._setVideoRenderParams(c)]:[3,2];case 1:M.sent(),M.label=2;case 2:return[2]}})})},U.prototype.switchCallMediaType=function(c){return S(this,void 0,void 0,function(){var M;return P(this,function(V){switch(V.label){case 0:if(this._logger.info(I+".switchCallMediaType.start",{text:{data:{newMediaType:c,currentCallType:this._callType}},type:"api"}),this._callType===c)throw this._logger.error(I+".switchCallMediaType.fail",{text:{error:v.ERROR_MESSAGE.ERROR_REQUEST_REPEATED_SWITCH},type:"api"}),new B.default({message:I+"<switchCallMediaType>: "+v.ERROR_MESSAGE.ERROR_REQUEST_REPEATED_SWITCH,code:R.default.ERROR_REQUEST_REPEATED});if(!this._switchCallModeStatus)throw this._logger.error(I+".switchCallMediaType.fail",{text:{error:"audio and video call switching"},type:"api"}),new Error(I+" audio and video call switching.");C.default.log(I+".switchCallMediaType",this._inviterID,this._inviteeID),V.label=1;case 1:return V.trys.push([1,3,,4]),[4,this._tsignalingClient.switchCallMode({userID:this._isInviter?this._inviteeID:this._inviterID,callType:this._callType,roomID:this._roomID,timeout:this._callTimeout,mode:c===L.CALL_TYPE.AUDIO_CALL?L.MODE_TYPE.AUDIO:L.MODE_TYPE.VIDEO})];case 2:return V.sent(),this.setSwitchCallModeStatus(!1),[3,4];case 3:throw M=V.sent(),this._logger.error(I+".switchCallMediaType.fail",{text:{error:M},type:"api"}),new Error(I+".switchCallMediaType failed, error: "+M);case 4:return[2]}})})},U.prototype.setSwitchCallModeStatus=function(c){this._switchCallModeStatus=c},U.prototype.getSwitchCallModeStatus=function(){return this._switchCallModeStatus},U.prototype.getDeviceList=function(c){var M,V;return S(this,void 0,void 0,function(){var G,b;return P(this,function(j){switch(j.label){case 0:if(this._logger.info(I+".getDeviceList.start",{text:{data:{deviceType:c}},type:"api"}),c!==L.DEVICE_TYPE.CAMERA)return[3,5];j.label=1;case 1:return j.trys.push([1,4,,5]),[4,(M=this._trtcClient)===null||M===void 0?void 0:M.getMediaDevicesAuth({video:!0,isThrowVideoError:!0})];case 2:return j.sent(),[4,A.getCameras()];case 3:return[2,j.sent()];case 4:return G=j.sent(),this.checkDevicePermissionErrorHandle(G,"getDeviceList",w.NAME.VIDEO),[3,5];case 5:if(c!==L.DEVICE_TYPE.MICROPHONES)return[3,10];j.label=6;case 6:return j.trys.push([6,9,,10]),[4,(V=this._trtcClient)===null||V===void 0?void 0:V.getMediaDevicesAuth({audio:!0})];case 7:return j.sent(),[4,A.getMicrophones()];case 8:return[2,j.sent()];case 9:return b=j.sent(),this.checkDevicePermissionErrorHandle(b,"getDeviceList",w.NAME.AUDIO),[3,10];case 10:return[2]}})})},U.prototype.switchDevice=function(c){var M;return S(this,void 0,void 0,function(){var V,G;return P(this,function(b){return this._logger.info(I+".switchDevice.start",{text:{data:{params:c}},type:"api"}),V=c.deviceType,G=c.deviceId,C.default.debug(I+".switchDevice -params: deviceType:"+V+",deviceID:"+G),[2,(M=this._trtcClient)===null||M===void 0?void 0:M.switchDevice(V,G)]})})},U.prototype.setSelfInfo=function(c){return S(this,void 0,void 0,function(){var M,V,G;return P(this,function(b){return this._logger.info(I+".setSelfInfo.start",{text:{data:{params:c}},type:"api"}),M=c.nickName,V=c.avatar,G={nick:M,avatar:V},!M&&delete G.nick,!V&&delete G.avatar,C.default.log(I+".setSelfInfo -params: nickName:"+G.nick+",avatar:"+G.avatar),[2,this.tim.updateMyProfile(G)]})})},U.prototype.generateCallEndData=function(c){var M=c||{},V=M.roomId,G=M.callMediaType,b=M.callRole,j=M.totalTime,H=M.userId;return V=V||this.getRoomID(),G=G||this.getCallType(),b||(b=this.isInviter()?L.CALL_ROLE.INVITER:L.CALL_ROLE.INVITEE),{roomID:V,callMediaType:G,callRole:b,totalTime:j=h.isUndefined(j)?this.generateCallTotalTime():j,userID:H=H||this.getUserID()}},U.prototype.generateEventData=function(){return{callID:this.getInviterInviteIdList()[0],roomID:this._roomID,callRole:this._isInviter?w.NAME.INVITER:w.NAME.INVITEE,callMediaType:this._callType}},U.prototype.enableAIVoice=function(c){var M;return S(this,void 0,void 0,function(){return P(this,function(V){switch(V.label){case 0:return this._logger.info(I+".enableAIVoice.start",{text:{data:{enable:c}},type:"api"}),this._trtcClient?[4,(M=this._trtcClient)===null||M===void 0?void 0:M.enableAIVoice(c)]:[3,2];case 1:V.sent(),V.label=2;case 2:return[2]}})})},U.prototype._resetTUICallEngine=function(){var c;return S(this,void 0,void 0,function(){var M;return P(this,function(V){switch(V.label){case 0:return C.default.debug(I+"._resetTUICallEngine"),this._roomID=0,this._isInviter=!1,this._isGroupCall=!1,this.setSwitchCallModeStatus(!0),this._groupID="",this._callStatus=L.CALL_STATUS.IDLE,this._inviteeList=[],this._unHandledInviteeList=[],this._handledInviteeList=[],this._inviterInviteID={},this._audioVideoSwitchIdList=[],this._acceptedUserObject={},this._connectStartTime=0,this._switchCallModeStatus=!0,this._initialCallId="",this._localViewId="",[4,(c=this._trtcClient)===null||c===void 0?void 0:c.reset()];case 1:return V.sent(),this._tsignalingClient.setInviteData(null),this._tsignalingClient.resetJoined(),(M=document.getElementById("_trtc_calling_layer"))&&(M.innerHTML=""),[2]}})})},U.prototype.getCallStatus=function(){return this._callStatus},U.prototype.changeCallStatus=function(c){this._callStatus!==c&&(this._logger.info(I+".changeCallStatus.start",{text:{data:{newCallStatus:c,currentStatus:this._callStatus}},type:"api"}),C.default.debug(I+".changeCallStatus from "+this._callStatus+" to "+c),this._callStatus=c)},U.prototype._callRecordUpload=function(c){var M=s(s({},c),{callRole:this.isInviter()?w.NAME.INVITER:w.NAME.INVITEE,userID:this.getUserID(),roomID:this.getRoomID(),inviteID:this.getInitialCallId()});this._callRecordReport.eventUpload(M)},U.prototype.extractCallingInfoFromMessage=function(c){if(!c||c.type!=="TIMCustomElem")return"";var M=JSON.parse(c.payload.data);if(C.default.debug(I+".extractCallingInfoFromMessage - signalingData:",c.payload.data),M.businessID!==L.BUSINESS_ID.SIGNAL)return"";switch(M.actionType){case L.ACTION_TYPE.INVITE:var V=JSON.parse(M.data);return V.call_end>0?"结束通话,通话时长:"+h.formatDuration(V.call_end):V.call_end!==0&&V.room_id?"发起通话":"结束群聊";case L.ACTION_TYPE.CANCEL_INVITE:return"取消通话";case L.ACTION_TYPE.ACCEPT_INVITE:return"已接听";case L.ACTION_TYPE.REJECT_INVITE:return"拒绝通话";case L.ACTION_TYPE.INVITE_TIMEOUT:return"无应答";default:return""}},U.prototype.setInitialCallId=function(c){this._initialCallId=c},U.prototype.getInitialCallId=function(){return this._initialCallId},U.prototype.generateCallTotalTime=function(){return this.getConnectStartTime()===0?0:Math.round((Date.now()-this.getConnectStartTime())/1e3)},U.prototype.checkDevicePermissionErrorHandle=function(c,M,V){var G=R.default.UNKNOWN,b="";switch(c==null?void 0:c.name){case"NotFoundError":V===w.NAME.AUDIO&&(G=R.default.NOT_MICROPHONE_LIST),V===w.NAME.VIDEO&&(G=R.default.NOT_CAMERA_LIST),b=I+"."+M+" failed. error: "+c+".";break;case"NotAllowedError":G=R.default.ERROR_PERMISSION_DENIED,b=I+"."+M+" failed: "+v.ERROR_MESSAGE.ERROR_PERMISSION_DENIED+". 如何设备授权: https://web.sdk.qcloud.com/component/trtccalling/doc/TUICallEngine/web/tutorial-33-device-permission.html."}throw this._delegate.onError(G,JSON.stringify(b)),this._logger.error(I+"."+M+".fail",{text:{error:c},type:"api"}),new B.default({code:G,message:b})},U.CALL_TYPE=L.CALL_TYPE,i([T.paramValidate(T.VALIDATE_PARAMS.login),o("design:type",Function),o("design:paramtypes",[Object]),o("design:returntype",Promise)],U.prototype,"init",null),i([T.paramValidate(T.VALIDATE_PARAMS.login),o("design:type",Function),o("design:paramtypes",[Object]),o("design:returntype",Promise)],U.prototype,"login",null),i([T.avoidRepeatedCall(),T.paramValidate(T.VALIDATE_PARAMS.call),T.statusValidate({init:!0,callStatus:[L.CALL_STATUS.IDLE]}),T.businessValidate(L.CALL_EXPERMENTEL_API_TYPE.BASE),o("design:type",Function),o("design:paramtypes",[Object]),o("design:returntype",Promise)],U.prototype,"call",null),i([T.avoidRepeatedCall(),T.paramValidate(T.VALIDATE_PARAMS.groupCall),T.statusValidate({init:!0,callStatus:[L.CALL_STATUS.IDLE]}),T.businessValidate(L.CALL_EXPERMENTEL_API_TYPE.PRO),o("design:type",Function),o("design:paramtypes",[Object]),o("design:returntype",Promise)],U.prototype,"groupCall",null),i([T.paramValidate(T.VALIDATE_PARAMS.joinInGroupCall),T.statusValidate({init:!0,callStatus:[L.CALL_STATUS.IDLE]}),T.businessValidate(L.CALL_EXPERMENTEL_API_TYPE.PRO),o("design:type",Function),o("design:paramtypes",[Object]),o("design:returntype",Promise)],U.prototype,"joinInGroupCall",null),i([T.paramValidate(T.VALIDATE_PARAMS.inviteUser),T.statusValidate({init:!0,callStatus:[L.CALL_STATUS.CALLING,L.CALL_STATUS.CONNECTED]}),T.businessValidate(L.CALL_EXPERMENTEL_API_TYPE.PRO),o("design:type",Function),o("design:paramtypes",[Object]),o("design:returntype",Promise)],U.prototype,"inviteUser",null),i([T.avoidRepeatedCall(),T.statusValidate({init:!0,callStatus:[L.CALL_STATUS.CALLING]}),o("design:type",Function),o("design:paramtypes",[]),o("design:returntype",Promise)],U.prototype,"accept",null),i([T.avoidRepeatedCall(),T.statusValidate({init:!0,callStatus:[L.CALL_STATUS.CALLING]}),o("design:type",Function),o("design:paramtypes",[]),o("design:returntype",Promise)],U.prototype,"reject",null),i([T.avoidRepeatedCall(),T.statusValidate({init:!0,callStatus:[L.CALL_STATUS.CALLING,L.CALL_STATUS.CONNECTED]}),o("design:type",Function),o("design:paramtypes",[]),o("design:returntype",Promise)],U.prototype,"hangup",null),i([T.paramValidate(T.VALIDATE_PARAMS.startRemoteView),T.statusValidate({init:!0,callStatus:[L.CALL_STATUS.CONNECTED]}),o("design:type",Function),o("design:paramtypes",[Object]),o("design:returntype",Promise)],U.prototype,"startRemoteView",null),i([T.paramValidate(T.VALIDATE_PARAMS.stopRemoteView),T.statusValidate({init:!0,callStatus:[L.CALL_STATUS.CONNECTED]}),o("design:type",Function),o("design:paramtypes",[Object]),o("design:returntype",Promise)],U.prototype,"stopRemoteView",null),i([T.paramValidate(T.VALIDATE_PARAMS.startLocalView),T.statusValidate({init:!0,callStatus:[L.CALL_STATUS.CALLING,L.CALL_STATUS.CONNECTED]}),T.apiCallQueue(),o("design:type",Function),o("design:paramtypes",[Object]),o("design:returntype",Promise)],U.prototype,"startLocalView",null),i([T.paramValidate(T.VALIDATE_PARAMS.stopLocalView),T.statusValidate({init:!0,callStatus:[L.CALL_STATUS.CALLING,L.CALL_STATUS.CONNECTED]}),T.apiCallQueue(),o("design:type",Function),o("design:paramtypes",[Object]),o("design:returntype",Promise)],U.prototype,"stopLocalView",null),i([T.statusValidate({init:!0,callStatus:[L.CALL_STATUS.CALLING,L.CALL_STATUS.CONNECTED]}),o("design:type",Function),o("design:paramtypes",[Object]),o("design:returntype",Promise)],U.prototype,"openCamera",null),i([T.statusValidate({init:!0,callStatus:[L.CALL_STATUS.CALLING,L.CALL_STATUS.CONNECTED]}),o("design:type",Function),o("design:paramtypes",[]),o("design:returntype",Promise)],U.prototype,"closeCamera",null),i([T.statusValidate({init:!0,callStatus:[L.CALL_STATUS.CALLING,L.CALL_STATUS.CONNECTED]}),o("design:type",Function),o("design:paramtypes",[]),o("design:returntype",Promise)],U.prototype,"openMicrophone",null),i([T.statusValidate({init:!0,callStatus:[L.CALL_STATUS.CALLING,L.CALL_STATUS.CONNECTED]}),o("design:type",Function),o("design:paramtypes",[]),o("design:returntype",Promise)],U.prototype,"closeMicrophone",null),i([T.paramValidate(T.VALIDATE_PARAMS.setVideoQuality),o("design:type",Function),o("design:paramtypes",[Object]),o("design:returntype",Promise)],U.prototype,"setVideoQuality",null),i([T.paramValidate(T.VALIDATE_PARAMS.setVideoRenderParams),o("design:type",Function),o("design:paramtypes",[Object]),o("design:returntype",Promise)],U.prototype,"setVideoRenderParams",null),i([T.paramValidate(T.VALIDATE_PARAMS.switchCallMediaType),T.statusValidate({init:!0,callStatus:[L.CALL_STATUS.CONNECTED,L.CALL_STATUS.CALLING],scene:!0}),o("design:type",Function),o("design:paramtypes",[Number]),o("design:returntype",Promise)],U.prototype,"switchCallMediaType",null),i([T.paramValidate(T.VALIDATE_PARAMS.getDeviceList),T.statusValidate({init:!0}),o("design:type",Function),o("design:paramtypes",[String]),o("design:returntype",Promise)],U.prototype,"getDeviceList",null),i([T.paramValidate(T.VALIDATE_PARAMS.switchDevice),T.statusValidate({init:!0,callStatus:[L.CALL_STATUS.CALLING,L.CALL_STATUS.CONNECTED]}),o("design:type",Function),o("design:paramtypes",[Object]),o("design:returntype",Promise)],U.prototype,"switchDevice",null),i([T.paramValidate(T.VALIDATE_PARAMS.setSelfInfo),T.statusValidate({init:!0}),o("design:type",Function),o("design:paramtypes",[Object]),o("design:returntype",Promise)],U.prototype,"setSelfInfo",null),i([T.statusValidate({init:!0}),o("design:type",Function),o("design:paramtypes",[Boolean]),o("design:returntype",Promise)],U.prototype,"enableAIVoice",null),i([T.paramValidate(T.VALIDATE_PARAMS.createInstance),o("design:type",Function),o("design:paramtypes",[Object]),o("design:returntype",void 0)],U,"createInstance",null),U}();u.default=$},function(F,u,r){r.r(u),r.d(u,"default",function(){return S});const s=Function.prototype.apply,i=new WeakMap;function o(P){return i.has(P)||i.set(P,{}),i.get(P)}class S{constructor(l=null,n=console){const h=o(this);return h._events=new Set,h._callbacks={},h._console=n,h._maxListeners=l===null?null:parseInt(l,10),this}_addCallback(l,n,h,e){return this._getCallbacks(l).push({callback:n,context:h,weight:e}),this._getCallbacks(l).sort((a,E)=>a.weight>E.weight),this}_getCallbacks(l){return o(this)._callbacks[l]}_getCallbackIndex(l,n){return this._has(l)?this._getCallbacks(l).findIndex(h=>h.callback===n):null}_achieveMaxListener(l){return o(this)._maxListeners!==null&&o(this)._maxListeners<=this.listenersNumber(l)}_callbackIsExists(l,n,h){const e=this._getCallbackIndex(l,n),a=e!==-1?this._getCallbacks(l)[e]:void 0;return e!==-1&&a&&a.context===h}_has(l){return o(this)._events.has(l)}on(l,n,h=null,e=1){const a=o(this);if(typeof n!="function")throw new TypeError(n+" is not a function");return this._has(l)?(this._achieveMaxListener(l)&&a._console.warn(`Max listeners (${a._maxListeners}) for event "${l}" is reached!`),this._callbackIsExists(...arguments)&&a._console.warn(`Event "${l}" already has the callback ${n}.`)):(a._events.add(l),a._callbacks[l]=[]),this._addCallback(...arguments),this}once(l,n,h=null,e=1){const a=(...E)=>(this.off(l,a),s.call(n,h,E));return this.on(l,a,h,e)}off(l,n=null){const h=o(this);let e;return this._has(l)&&(n===null?(h._events.delete(l),h._callbacks[l]=null):(e=this._getCallbackIndex(l,n),e!==-1&&(h._callbacks[l].splice(e,1),this.off(...arguments)))),this}emit(l,...n){return this._has(l)&&this._getCallbacks(l).forEach(h=>s.call(h.callback,h.context,n)),this}clear(){const l=o(this);return l._events.clear(),l._callbacks={},this}listenersNumber(l){return this._has(l)?this._getCallbacks(l).length:null}}},function(F,u,r){var s=this&&this.__assign||function(){return(s=Object.assign||function(T){for(var y,p=1,_=arguments.length;p<_;p++)for(var A in y=arguments[p])Object.prototype.hasOwnProperty.call(y,A)&&(T[A]=y[A]);return T}).apply(this,arguments)},i=this&&this.__awaiter||function(T,y,p,_){return new(p||(p=Promise))(function(A,k){function x($){try{Y(_.next($))}catch(U){k(U)}}function I($){try{Y(_.throw($))}catch(U){k(U)}}function Y($){var U;$.done?A($.value):(U=$.value,U instanceof p?U:new p(function(c){c(U)})).then(x,I)}Y((_=_.apply(T,y||[])).next())})},o=this&&this.__generator||function(T,y){var p,_,A,k,x={label:0,sent:function(){if(1&A[0])throw A[1];return A[1]},trys:[],ops:[]};return k={next:I(0),throw:I(1),return:I(2)},typeof Symbol=="function"&&(k[Symbol.iterator]=function(){return this}),k;function I(Y){return function($){return function(U){if(p)throw new TypeError("Generator is already executing.");for(;x;)try{if(p=1,_&&(A=2&U[0]?_.return:U[0]?_.throw||((A=_.return)&&A.call(_),0):_.next)&&!(A=A.call(_,U[1])).done)return A;switch(_=0,A&&(U=[2&U[0],A.value]),U[0]){case 0:case 1:A=U;break;case 4:return x.label++,{value:U[1],done:!1};case 5:x.label++,_=U[1],U=[0];continue;case 7:U=x.ops.pop(),x.trys.pop();continue;default:if(A=x.trys,!((A=A.length>0&&A[A.length-1])||U[0]!==6&&U[0]!==2)){x=0;continue}if(U[0]===3&&(!A||U[1]>A[0]&&U[1]<A[3])){x.label=U[1];break}if(U[0]===6&&x.label<A[1]){x.label=A[1],A=U;break}if(A&&x.label<A[2]){x.label=A[2],x.ops.push(U);break}A[2]&&x.ops.pop(),x.trys.pop();continue}U=y.call(T,x)}catch(c){U=[6,c],_=0}finally{p=A=0}if(5&U[0])throw U[1];return{value:U[0]?U[1]:void 0,done:!0}}([Y,$])}}},S=this&&this.__spreadArrays||function(){for(var T=0,y=0,p=arguments.length;y<p;y++)T+=arguments[y].length;var _=Array(T),A=0;for(y=0;y<p;y++)for(var k=arguments[y],x=0,I=k.length;x<I;x++,A++)_[A]=k[x];return _};Object.defineProperty(u,"__esModule",{value:!0});var P=r(18),l=r(5),n=r(2),h=r(36),e=r(6),a=r(1),E=r(11),D=r(15),O=r(13),f=r(10),t=r(4),d=r(9),m=r(6),g=r(56),C=r(27),N=r(0),L=r(0),B=r(7),R="TRTCClient",v=P,w=function(){function T(y){var p,_=this;this._sdkAppID=y.sdkAppID,this._userID=y.userID,this._userSig=y.userSig,this._tuiCallEngine=y.tuiCallEngine,this._videoAvailableMap=new Map,this._isJoined=!1,this._isPublished=!1,this._unPublishing=!1,this._localStream=null,this._remoteStreams=[],this._userIdDomMap=new Map,this._device={video:null,audio:null,microphoneList:[],cameraList:[]},this._prevDevices=[],this._assetsPath=y.assetsPath,this._eventStatController=new O.default,E.default.bindController(this._eventStatController),this._isAiNoiseSuppress=!0,this._logger=l.default(),h.isHttpProtocols()&&console.error("code: "+t.default.ERROR_HTTP+", "+d.ERROR_MESSAGE.ERROR_HTTP+", "+d.ERROR_CN_MESSAGE.ERROR_HTTP);var A=v.VERSION;a.compareVersion(A,"4.7.0")>=0?v.checkSystemRequirements().then(function(k){if(!k.result)throw _._tuiCallEngine._delegate.onError(t.default.NOT_SUPPORT,JSON.stringify(k)),new f.default({message:d.ERROR_MESSAGE.NOT_SUPPORT+" "+JSON.stringify(k),code:t.default.NOT_SUPPORT})}):v.checkSystemRequirements().then(function(k){if(!k)throw _._tuiCallEngine._delegate.onError(t.default.NOT_SUPPORT,k),new f.default({message:d.ERROR_MESSAGE.NOT_SUPPORT+" "+JSON.stringify(k),code:t.default.NOT_SUPPORT})}),this._frameWorkType=32,a.compareVersion(A,"4.15.1")>=0?(this._frameWorkType=30,this._component=14,(!((p=window==null?void 0:window.localStorage)===null||p===void 0)&&p.getItem("_isTIMCallKit")||window!=null&&window._isTIMCallKit)&&(this._component=15)):this._component=3,this.init()}return T.prototype.init=function(){var y=this;this._client=v.createClient({mode:L.NAME.RTC,sdkAppId:this._sdkAppID,userId:this._userID,userSig:this._userSig,frameWorkType:this._frameWorkType,component:this._component}),this.addTRTCEvents(),navigator.mediaDevices.addEventListener("devicechange",function(){return i(y,void 0,void 0,function(){var p,_,A,k,x,I=this;return o(this,function(Y){switch(Y.label){case 0:return[4,v.getMicrophones()];case 1:return p=Y.sent(),[4,v.getCameras()];case 2:return _=Y.sent(),A=S(p,_),this.setDevices(A),k=A.filter(function($){return I._prevDevices.findIndex(function(U){var c=U.deviceId;return $.deviceId===c})<0}),x=this._prevDevices.filter(function($){return A.findIndex(function(U){var c=U.deviceId;return $.deviceId===c})<0}),k.length>0&&this.handleDevicesAdd(k),x.length>0&&this.handleDevicesRemoved(x),this._tuiCallEngine._delegate.onDeviceUpdated(this._device.microphoneList,this._device.cameraList,this._device.audio,this._device.video),this._prevDevices=A,[2]}})})})},T.prototype.getClient=function(){return this._client},T.prototype.getRemoteStreams=function(){return this._remoteStreams},T.prototype.getLocalStream=function(){return this._localStream},T.prototype.getMicrophoneList=function(){return i(this,void 0,void 0,function(){var y;return o(this,function(p){switch(p.label){case 0:return[4,v.getMicrophones()];case 1:return y=p.sent(),this._device.microphoneList=y,[2]}})})},T.prototype.getCamerasList=function(){return i(this,void 0,void 0,function(){var y;return o(this,function(p){switch(p.label){case 0:return[4,v.getCameras()];case 1:return y=p.sent(),this._device.cameraList=y,[2]}})})},T.prototype.getDevices=function(y){return i(this,void 0,void 0,function(){return o(this,function(p){switch(p.label){case 0:return this._logger.info(R+".getDevices.start",{text:{data:{callType:y}},type:"api"}),[4,this.getMicrophoneList()];case 1:return p.sent(),this._device.microphoneList.length!==0?[3,3]:[4,this._tuiCallEngine._resetTUICallEngine()];case 2:return p.sent(),this._tuiCallEngine._delegate.onError(t.default.NOT_MICROPHONE_LIST,d.ERROR_MESSAGE.NOT_MICROPHONE_LIST),this._logger.error(R+".getDevices.fail",{text:{error:d.ERROR_MESSAGE.NOT_MICROPHONE_LIST},type:"api"}),[2];case 3:return this._device.audio=JSON.parse(JSON.stringify(this._device.microphoneList[0])),y===e.CALL_TYPE.VIDEO_CALL&&this._tuiCallEngine.getDevicePermission().video?[4,this.getCamerasList()]:[3,5];case 4:p.sent(),this._device.video=JSON.parse(JSON.stringify(this._device.cameraList[0])),p.label=5;case 5:return this._prevDevices.length>0||(this._prevDevices=S(this._device.microphoneList,this._device.cameraList)),[2]}})})},T.prototype.setDevices=function(y){this._device.microphoneList=y.filter(function(p){return p.kind===L.NAME.AUDIO_INPUT})||[],this._device.cameraList=y.filter(function(p){return p.kind===L.NAME.VIDEO_INPUT})||[]},T.prototype.handleDevicesAdd=function(y,p){var _=this;y.forEach(function(A){A.kind===L.NAME.AUDIO_INPUT?_.switchDevice(e.DEVICE_TYPE.AUDIO,A.deviceId):A.kind===L.NAME.VIDEO_INPUT&&p&&_.switchDevice(e.DEVICE_TYPE.VIDEO,A.deviceId)})},T.prototype.handleDevicesRemoved=function(y){var p=this;y.forEach(function(_){_.kind===L.NAME.AUDIO_INPUT?p.isCurrentMicrophoneRemoved(_.deviceId)&&p.handleDevicesAdd(p._prevDevices):_.kind===L.NAME.VIDEO_INPUT&&p.isCurrentCameraRemoved(_.deviceId)&&p.handleDevicesAdd(p._prevDevices,!0)})},T.prototype.isCurrentMicrophoneRemoved=function(y){var p,_=(p=this._localStream)===null||p===void 0?void 0:p.getAudioTrack();return!(!_||_.getSettings().deviceId!==y)},T.prototype.isCurrentCameraRemoved=function(y){var p,_=(p=this._localStream)===null||p===void 0?void 0:p.getVideoTrack();return!(!_||_.getSettings().deviceId!==y)},T.prototype.switchDevice=function(y,p){return i(this,void 0,void 0,function(){var _;return o(this,function(A){switch(A.label){case 0:return this._logger.info(R+".switchDevice.start",{text:{data:{deviceType:y,deviceId:p}},type:"api"}),n.default.log(R+".switchDevice - params: deviceType:"+y+",deviceID:"+p),this._localStream?[4,this._localStream.switchDevice(y,p)]:[3,2];case 1:A.sent(),A.label=2;case 2:return _={deviceType:y,deviceId:p},this._device[y]=_,this._tuiCallEngine._delegate.onDeviceUpdated(this._device.microphoneList,this._device.cameraList,this._device.audio,this._device.video),[2]}})})},T.prototype.join=function(y){var p;return i(this,void 0,void 0,function(){var _,A,k,x,I,Y,$,U,c,M=this;return o(this,function(V){switch(V.label){case 0:return _=+new Date,A=this.getCallType(),this._logger.info(R+".join.start",{text:{data:{roomID:y,callType:A,isJoin:this._isJoined}},type:"api"}),A!==e.CALL_TYPE.VIDEO_CALL||this._tuiCallEngine.getDevicePermission().video?[3,2]:[4,this.getMediaDevicesAuth({video:!0})];case 1:V.sent(),V.label=2;case 2:return[4,this.getDevices(A)];case 3:if(V.sent(),this._isJoined)return this._logger.error(R+".join.fail",{text:{error:"duplicate RtcClient.join() observed"},type:"api"}),n.default.warn(R+".join - duplicate RtcClient.join() observed"),[2];V.label=4;case 4:return V.trys.push([4,6,,7]),[4,this._client.join({roomId:y})];case 5:return V.sent(),this._isJoined=!0,this._tuiCallEngine.isInviter()||(k=this._tuiCallEngine.generateEventData(),this._tuiCallEngine._delegate.onCallBegin(k)),x=+new Date,this._logger.info(R+".join.success",{type:"api",text:{cost:x-_}}),n.default.log(R+".join - join room success, callType:"+A),[3,7];case 6:throw I=V.sent(),this._logger.error(R+".join.fail",{text:{error:I},type:"api"}),n.default.error(R+".join - join room failed! "+I),new Error(R+".join - join room failed! "+I);case 7:if(this._tuiCallEngine.getCallStatus()===e.CALL_STATUS.IDLE)return this._logger.error(R+".join.fail",{text:{error:"early hangup"},type:"api"}),n.default.warn(R+".join - early hangup"),[2,this._tuiCallEngine.hangup()];Y={audio:!0,video:!1,userId:this._userID},A===e.CALL_TYPE.VIDEO_CALL&&this._tuiCallEngine.getDevicePermission().video&&(Y.video=!0),V.label=8;case 8:return V.trys.push([8,15,,16]),$=+new Date,this._logger.info(R+".join.createStream.start",{text:{data:Y},type:"api"}),this._localStream=v.createStream(Y),[4,this._setVideoProfile(this._localStream)];case 9:return V.sent(),[4,this._localStream.initialize()];case 10:return V.sent(),!((p=this==null?void 0:this._tuiCallEngine)===null||p===void 0)&&p.tim?[4,a.timeoutForFun(function(){return M._addAiNoiseReduce(M._tuiCallEngine.tim)},3e3)]:[3,12];case 11:V.sent(),V.label=12;case 12:return U=+new Date,this._logger.info(R+".join.createStream.success",{text:{cost:U-$},type:"api"}),n.default.log(R+".join - initialize local stream success"),this._tuiCallEngine.isInviter()?[3,14]:[4,this.publish()];case 13:V.sent(),V.label=14;case 14:return this._joinedTimestamp=new Date,[2,{audio:Y.audio,video:Y.video,userId:Y.userId}];case 15:throw c=V.sent(),this._logger.error(R+".join.fail",{text:{error:c},type:"api"}),n.default.error(R+".join - failed to initialize local stream - "+c),new f.default({message:R+"<join>: "+d.ERROR_MESSAGE.ERROR_PERMISSION_DENIED,code:t.default.ERROR_PERMISSION_DENIED});case 16:return[2]}})})},T.prototype._addAiNoiseReduce=function(y){return i(this,void 0,void 0,function(){var p,_,A;return o(this,function(k){switch(k.label){case 0:this._logger.info(R+"._addAiNoiseReduce.start",{type:"api",text:{data:{assetsPath:this._assetsPath}}}),k.label=1;case 1:return k.trys.push([1,7,,8]),[4,C.validateBusiness(y,m.CALL_EXPERMENTEL_API_TYPE.PRO,this._sdkAppID)];case 2:return p=k.sent(),n.default.info(R+"._addAiNoiseReduce - aiNoiseReduceSupport."+p),p&&g?(this._assetsPath||n.default.warn(R+"._addAiNoiseReduce - please pass validate assetsPath"),this._aiNoiseSuppression=new g({assetsPath:this._assetsPath||N.AI_NOISE_REDUCE_ASSETS_PATH}),_=this,[4,this._aiNoiseSuppression.createProcessor({sdkAppId:this._sdkAppID,userId:this._userID,userSig:this._userSig})]):[3,6];case 3:return _._aiNoiseSuppressionProcessor=k.sent(),[4,this._aiNoiseSuppressionProcessor.process(this._localStream)];case 4:return k.sent(),[4,this.enableAIVoice(this._isAiNoiseSuppress)];case 5:k.sent(),k.label=6;case 6:return[3,8];case 7:return A=k.sent(),this._logger.error(R+"._addAiNoiseReduce.fail",{text:{error:A},type:"api"}),n.default.warn(R+"._addAiNoiseReduce - error."+A),[3,8];case 8:return[2]}})})},T.prototype.playLocalVideo=function(y){var p;return i(this,void 0,void 0,function(){var _,A,k,x,I,Y;return o(this,function($){switch($.label){case 0:return $.trys.push([0,5,,6]),this._logger.info(R+".playLocalVideo.start",{text:{data:y},type:"api"}),n.default.debug(R+".playLocalVideo - params:",y),_=y.videoViewDomID,A=y.userID,y.options&&this._tuiCallEngine.setLocalPlayOptions(y.options),k=this._tuiCallEngine.getLocalPlayOptions(),x=_,typeof _===L.NAME.STRING&&(x=document.getElementById(_)),this._userIdDomMap.set(A,x),!this._localStream||this._localStream.hasVideo()?[3,2]:(I=this._localStream.getVideoTrack(),[4,this.addTrack(I)]);case 1:$.sent(),$.label=2;case 2:return x?[4,(p=this==null?void 0:this._localStream)===null||p===void 0?void 0:p.play(x,k)]:[3,4];case 3:$.sent(),$.label=4;case 4:return[3,6];case 5:throw Y=$.sent(),this._logger.error(R+".playLocalVideo.fail",{text:{error:Y},type:"api"}),n.default.error(R+".playLocalVideo - failed, error:"+Y),new Error(R+".playLocalVideo - failed, error:"+Y);case 6:return[2]}})})},T.prototype.stopLocalVideo=function(){return i(this,void 0,void 0,function(){var y,p;return o(this,function(_){switch(_.label){case 0:return _.trys.push([0,6,,7]),this._logger.info(R+".stopLocalVideo.start",{text:{data:{hasLocalStream:!!this._localStream,hasVideo:this._localStream&&this._localStream.hasVideo()}},type:"api"}),this._localStream?this._localStream.hasAudio()?(y=this._localStream.getVideoTrack())?[4,this._localStream.removeTrack(y)]:[3,2]:[3,3]:[3,5];case 1:_.sent(),y.stop(),_.label=2;case 2:return[3,5];case 3:return[4,this.unpublish()];case 4:_.sent(),this._localStream.stop(),this._localStream.close(),this._localStream=null,this._userIdDomMap.delete(this._tuiCallEngine.getUserID()),_.label=5;case 5:return[3,7];case 6:throw p=_.sent(),this._logger.error(R+".stopLocalVideo.fail",{text:{error:p},type:"api"}),n.default.error(R+".stopLocalVideo - failed to play local video "+p),new Error(R+".stopLocalVideo - failed to play local video "+p);case 7:return[2]}})})},T.prototype.playRemoteVideo=function(y){return i(this,void 0,void 0,function(){var p,_,A,k,x,I;return o(this,function(Y){switch(Y.label){case 0:n.default.debug(R+".playRemoteVideo - params:",y),p=y.videoViewDomID,_=y.userID,y.options&&this._tuiCallEngine.setRemotePlayOptions(y.options),A=this._tuiCallEngine.getRemotePlayOptions(),k=p,typeof p===L.NAME.STRING&&(k=document.getElementById(p)),this._userIdDomMap.set(_,k),Y.label=1;case 1:if(Y.trys.push([1,6,,7]),!(x=this._remoteStreams.find(function($){return $.getUserId()===_})))throw new Error("currentRemoteUserStream is empty");if(!k)throw new Error("domID is empty");return document.getElementById("_trtc_calling_audio_call-"+_)?[4,x.stop()]:[3,3];case 2:Y.sent(),document.getElementById("_trtc_calling_audio_call-"+_).remove(),Y.label=3;case 3:return[4,x==null?void 0:x.play(k,A)];case 4:return Y.sent(),[4,x==null?void 0:x.unmuteVideo()];case 5:return Y.sent(),[3,7];case 6:throw I=Y.sent(),this._logger.error(R+".playRemoteVideo.fail",{text:{error:I},type:"api"}),n.default.error(R+".playRemoteVideo - failed to play remote video reason: "+I),new Error(R+".playRemoteVideo - failed to play remote video reason: "+I);case 7:return[2]}})})},T.prototype.stopRemoteVideo=function(y){return i(this,void 0,void 0,function(){var p,_,A;return o(this,function(k){switch(k.label){case 0:n.default.debug(R+".stopRemoteVideo - params:",y),p=y.userID,k.label=1;case 1:return k.trys.push([1,4,,5]),(_=this._remoteStreams.find(function(x){return x.getUserId()===p}))&&_.hasVideo()?[4,_.muteVideo()]:[3,3];case 2:k.sent(),k.label=3;case 3:return[3,5];case 4:throw A=k.sent(),this._logger.error(R+".stopRemoteView.fail",{text:{error:A},type:"api"}),n.default.error(R+".stopRemoteVideo - failed to stop remote video "+A),new Error(R+".stopRemoteVideo - failed to stop remote video "+A);case 5:return[2]}})})},T.prototype.getCallType=function(){return this._tuiCallEngine.getCallType()},T.prototype.leave=function(){var y,p;return i(this,void 0,void 0,function(){var _;return o(this,function(A){switch(A.label){case 0:return this._logger.info(R+".leave.start",{text:{data:{isJoined:this._isJoined}},type:"api"}),n.default.log(R+"-leave._isJoined:"+this._isJoined),this._isJoined?[4,this.unpublish()]:(n.default.warn(R+".leave - please join() firstly"),[2]);case 1:return A.sent(),this._tuiCallEngine.getCallDataReport().setExitRoomTime(new Date().getTime()),[4,this._client.leave()];case 2:return A.sent(),this._isJoined=!1,this._isPublished=!1,(y=this==null?void 0:this._localStream)===null||y===void 0||y.close(),this._localStream=null,this._remoteStreams=[],this._userIdDomMap.clear(),this._videoAvailableMap.clear(),this._leaveTimestamp=new Date,this._client.enableAudioVolumeEvaluation(-1),(p=this==null?void 0:this._aiNoiseSuppressionProcessor)===null||p===void 0||p.destroy(),this._aiNoiseSuppressionProcessor=null,this._isAiNoiseSuppress=!0,_=Math.floor((this._leaveTimestamp-this._joinedTimestamp)/1e3),new E.default(D.default.TALK_TIME).setTalkTime(_).setText("talkTime record").setEnd(),[2]}})})},T.prototype.publish=function(){return i(this,void 0,void 0,function(){var y;return o(this,function(p){switch(p.label){case 0:if(this._logger.info(R+".publish.start",{text:{data:{isJoined:this._isJoined,isPublished:this._isPublished,hasLocalStream:!!this._localStream}},type:"api"}),!this._isJoined)return n.default.warn(R+".publish - please join() firstly"),[2];if(this._isPublished)return n.default.warn(R+".publish - duplicate RtcClient.publish() observed"),[2];if(this._tuiCallEngine.getCallStatus()===e.CALL_STATUS.IDLE)return this._logger.error(R+".publish.fail",{text:{error:"early hangup"},type:"api"}),n.default.warn(R+".join - early hangup"),this._tuiCallEngine.hangup(),[2];if(!this._localStream)return[2];p.label=1;case 1:return p.trys.push([1,3,,4]),[4,this._client.publish(this._localStream)];case 2:return p.sent(),this._isPublished=!0,n.default.log(R+".publish success"),[3,4];case 3:return y=p.sent(),this._logger.error(R+".publish.fail",{text:{error:y},type:"api"}),n.default.error(R+".publish - failed to publish local stream "+y),this._isPublished=!1,[3,4];case 4:return[2]}})})},T.prototype.unpublish=function(){return i(this,void 0,void 0,function(){return o(this,function(y){switch(y.label){case 0:return this._logger.info(R+".unpublish.start",{text:{data:{isPublished:this._isPublished,hasLocalStream:!!this._localStream,unPublishing:this._unPublishing}},type:"api"}),this._isPublished?this._localStream?this._unPublishing?(n.default.log(R+".unpublish - _unPublishing"),[2]):(this._unPublishing=!0,[4,this._client.unpublish(this._localStream)]):(n.default.warn(R+".unpublish - RtcClient._localStream is null"),[2]):(n.default.warn(R+".unpublish - RtcClient.unpublish() called but not published yet"),[2]);case 1:return y.sent(),n.default.log(R+".unpublish - complete"),this._unPublishing=!1,this._isPublished=!1,[2]}})})},T.prototype.playAudioStream=function(y){return i(this,void 0,void 0,function(){var p,_,A,k;return o(this,function(x){return p=y.getUserId(),_="_trtc_calling_audio_call-"+p,(A=document.getElementById("_trtc_calling_layer"))||((A=document.createElement("div")).setAttribute("id","_trtc_calling_layer"),A.style.display="none",document.body.appendChild(A)),(k=document.createElement("div")).setAttribute("id",_),A.appendChild(k),y&&(y.play(_),y.on("error",function(I){if(I.getCode()===16451){var Y=document.createElement("button");Y.onclick=function(){n.default.log(R+".remoteStream - resume"),y.resume()},Y.style.display="none",document.body.appendChild(Y);var $=setTimeout(function(){Y.click(),clearTimeout($),document.body.removeChild(Y)},0)}})),[2]})})},T.prototype.delegateVideoAvailableState=function(y,p){y&&this._videoAvailableMap.get(y)!==p&&(this._videoAvailableMap.set(y,p),this._tuiCallEngine._delegate.onUserVideoAvailable({userID:y,isVideoAvailable:p}))},T.prototype.querySubscribeSuccess=function(y){return this._videoAvailableMap.get(y)!==void 0},T.prototype.addTRTCEvents=function(){var y=this;this._client.on("error",function(p){n.default.error(R+".handleEvents - client on error "+p);var _=p.getCode(),A=JSON.stringify({name:L.NAME.TRTC,error:p});y._tuiCallEngine._delegate.onError(_,A)}),this._client.on("client-banned",function(p){return i(y,void 0,void 0,function(){var _,A;return o(this,function(k){switch(k.label){case 0:return n.default.error(R+".handleEvents - client has been banned for "+p),this._tuiCallEngine.getCallStatus()===e.CALL_STATUS.CONNECTED&&(_=this._tuiCallEngine.generateCallEndData(),this._tuiCallEngine._delegate.onCallEnd(_)),this._tuiCallEngine.getCallStatus()!==e.CALL_STATUS.CALLING?[3,2]:(A=s(s({},this._tuiCallEngine.generateEventData()),{reason:L.NAME.BANNED}),this._tuiCallEngine._delegate.onCallingCancel(s({userID:this._tuiCallEngine.getUserID()},A)),[4,this._tuiCallEngine._cancel()]);case 1:k.sent(),k.label=2;case 2:return[4,this._tuiCallEngine._resetTUICallEngine()];case 3:return k.sent(),[2]}})})}),this._client.on("peer-join",function(p){return i(y,void 0,void 0,function(){var _,A,k,x;return o(this,function(I){switch(I.label){case 0:return _=p.userId,this._isPublished||!this._tuiCallEngine.isInviter()?[3,2]:[4,this.publish()];case 1:I.sent(),I.label=2;case 2:return n.default.log(R+".handleEvents - peer-join "+_),this._tuiCallEngine.getConnectStartTime()||(this._tuiCallEngine.setConnectStartTime(Date.now()),this._client.enableAudioVolumeEvaluation(1e3)),this._tuiCallEngine._delegate.onUserEnter(_),A=this._tuiCallEngine.isGroupCall(),this._tuiCallEngine.addHandledInviteeList([_]),this._tuiCallEngine.deleteUnHandledInviteeList([_]),this._tuiCallEngine.addAcceptedUserList(null,[_]),this._tuiCallEngine.getCallStatus()===e.CALL_STATUS.CALLING&&this._tuiCallEngine.isInviter()&&(k=this._tuiCallEngine.generateEventData(),this._tuiCallEngine._delegate.onCallBegin(k)),this._tuiCallEngine.changeCallStatus(e.CALL_STATUS.CONNECTED),A&&(x=this._tuiCallEngine.getHandledInviteeList(),this._tuiCallEngine._delegate.onGroupCallInviteeListUpdate(x)),[2]}})})}),this._client.on("peer-leave",function(p){return i(y,void 0,void 0,function(){var _,A,k,x,I,Y,$,U;return o(this,function(c){switch(c.label){case 0:return this._tuiCallEngine.getCallStatus()===e.CALL_STATUS.IDLE?[2]:(_=p.userId,n.default.log(R+".handleEvents - peer-leave:"+_),A=this._tuiCallEngine.isGroupCall(),this._tuiCallEngine.deleteHandledInviteeList([_]),this._videoAvailableMap.delete(_),this._tuiCallEngine._delegate.onUserLeave(_),A?(k=this._tuiCallEngine.getHandledInviteeList(),x=this._tuiCallEngine.getUnHandledInviteeList(),k.length!==0&&this._tuiCallEngine._delegate.onGroupCallInviteeListUpdate(k),I=this._tuiCallEngine.getUserID(),k.length!==1||k[0]!==I||x.length!==0?[3,2]:(Y=this._tuiCallEngine.generateCallEndData(),this._tuiCallEngine._delegate.onCallEnd(Y),[4,this._tuiCallEngine._resetTUICallEngine()])):[3,3]);case 1:c.sent(),c.label=2;case 2:return[3,6];case 3:return $=this._tuiCallEngine.getHandledInviteeList(),U={callType:this._tuiCallEngine.getCallType(),userIDList:[_],callEnd:this._tuiCallEngine.generateCallTotalTime()},$.length!==1?[3,6]:[4,this._tuiCallEngine._tsignalingClient.hangup(U)];case 4:return c.sent(),[4,this._tuiCallEngine._resetTUICallEngine()];case 5:c.sent(),c.label=6;case 6:return[2]}})})}),this._client.on("stream-added",function(p){return i(y,void 0,void 0,function(){var _,A,k,x,I,Y;return o(this,function($){switch($.label){case 0:_=p.stream,A=_.getId(),k=_.getUserId(),n.default.log(R+".handleEvents - remote stream added, userID:"+k+" streamID:"+A+" type:"+_.getType()),$.label=1;case 1:return $.trys.push([1,3,,5]),[4,this._client.subscribe(_)];case 2:return $.sent(),[3,5];case 3:return x=$.sent(),I=x.getCode(),Y=JSON.stringify({name:"TRTC",error:x}),[4,this._tuiCallEngine._resetTUICallEngine()];case 4:return $.sent(),this._tuiCallEngine._delegate.onError(I,Y),[3,5];case 5:return[2]}})})}),this._client.on("stream-subscribed",function(p){return i(y,void 0,void 0,function(){var _,A;return o(this,function(k){return _=p.stream,A=_.getUserId(),n.default.log(R+".handleEvents - stream subscribed, _remoteStreams:"+this._remoteStreams+", userID:"+A+", video: "+_.hasVideo()),this._remoteStreams.push(_),this._tuiCallEngine.getCallType()===e.CALL_TYPE.VIDEO_CALL&&this.delegateVideoAvailableState(A,_.hasVideo()),(this.getCallType()===e.CALL_TYPE.AUDIO_CALL||this._tuiCallEngine.getCallType()===e.CALL_TYPE.VIDEO_CALL&&!_.hasVideo())&&this.playAudioStream(_),[2]})})}),this._client.on("stream-removed",function(p){var _=p.stream,A=_.getId(),k=_.getUserId(),x="_trtc_calling_audio_call-"+k;if(n.default.log(R+".handleEvents - remote stream-removed, streamID:"+A+" type:"+_.getType()),y._tuiCallEngine._delegate.onUserAudioAvailable({userID:k,isAudioAvailable:!1}),y._tuiCallEngine._delegate.onUserVideoAvailable({userID:k,isVideoAvailable:!1}),_.stop(),_.close(),y._remoteStreams=y._remoteStreams.filter(function($){return $.getId()!==A}),y.getCallType()===e.CALL_TYPE.AUDIO_CALL){var I=document.getElementById("_trtc_calling_layer"),Y=document.getElementById(x);I&&Y&&I.removeChild(Y)}y._videoAvailableMap.delete(k)}),this._client.on("stream-updated",function(p){var _=p.stream,A=_.getUserId(),k=_.getType(),x=_.hasAudio(),I=_.hasVideo();n.default.log(R+".handleEvents - stream-updated, type:"+k+" hasAudio:"+x+" hasVideo:"+I),y.querySubscribeSuccess(A)&&y.delegateVideoAvailableState(A,!!I)}),this._client.on("mute-audio",function(p){n.default.debug(R+".handleEvents - "+p.userId+" mute audio"),y._tuiCallEngine._delegate.onUserAudioAvailable({userID:p.userId,isAudioAvailable:!1})}),this._client.on("unmute-audio",function(p){n.default.debug(R+".handleEvents - "+p.userId+" unmute audio"),y._tuiCallEngine._delegate.onUserAudioAvailable({userID:p.userId,isAudioAvailable:!0})}),this._client.on("mute-video",function(p){n.default.debug(R+".handleEvents - "+p.userId+" mute video"),y.querySubscribeSuccess(p.userId)&&y.delegateVideoAvailableState(p.userId,!1)}),this._client.on("unmute-video",function(p){n.default.debug(R+".handleEvents - "+p.userId+" unmute video"),y.querySubscribeSuccess(p.userId)&&y.delegateVideoAvailableState(p.userId,!0)}),this._client.on("audio-volume",function(p){n.default.debug(R+".handleEvents - "+p+" audio volume"),y._tuiCallEngine._delegate.onUserVoiceVolume(p.result)}),this._client.on("connection-state-changed",function(p){n.default.log(R+".handleEvents - RtcClient state changed from "+p.prevState+" to "+p.state)})},T.prototype.removeTRTCEvents=function(){this._client.off("*")},T.prototype.muteLocalAudio=function(){var y;(y=this._localStream)===null||y===void 0||y.muteAudio()},T.prototype.unMuteLocalAudio=function(){var y;(y=this._localStream)===null||y===void 0||y.unmuteAudio()},T.prototype.switchCallMode=function(y){return i(this,void 0,void 0,function(){var p;return o(this,function(_){switch(_.label){case 0:switch(n.default.log(R+".switchCallMode - type",y),p=this._localStream.getVideoTrack(),y){case e.CALL_TYPE.VIDEO_CALL:return[3,1];case e.CALL_TYPE.AUDIO_CALL:return[3,2]}return[3,6];case 1:try{this.removeTrack(p),this._tuiCallEngine.setCallType(e.CALL_TYPE.AUDIO_CALL),this._tuiCallEngine.setSwitchCallModeStatus(!0),this._tuiCallEngine._delegate.onCallTypeChanged(e.CALL_TYPE.VIDEO_CALL,e.CALL_TYPE.AUDIO_CALL)}catch{this._tuiCallEngine._delegate.onError(t.default.FAILURE_SWITCH_TO_AUDIO,d.ERROR_MESSAGE.FAILURE_SWITCH_TO_AUDIO)}return[3,6];case 2:return _.trys.push([2,4,,5]),[4,this.addTrack(p)];case 3:return _.sent(),this._tuiCallEngine.setCallType(e.CALL_TYPE.VIDEO_CALL),this._tuiCallEngine.setSwitchCallModeStatus(!0),this._tuiCallEngine._delegate.onCallTypeChanged(e.CALL_TYPE.AUDIO_CALL,e.CALL_TYPE.VIDEO_CALL),[3,5];case 4:return _.sent(),this._tuiCallEngine._delegate.onError(t.default.FAILURE_SWITCH_TO_VIDEO,d.ERROR_MESSAGE.FAILURE_SWITCH_TO_VIDEO),[3,5];case 5:return[3,6];case 6:return[2]}})})},T.prototype.removeTrack=function(y){return i(this,void 0,void 0,function(){var p;return o(this,function(_){switch(_.label){case 0:if(n.default.log(R+".removeTrack ",!!y),!y)return[3,4];_.label=1;case 1:return _.trys.push([1,3,,4]),[4,this._localStream.removeTrack(y)];case 2:return _.sent(),y.stop(),[3,4];case 3:throw p=_.sent(),n.default.error(R+".removeTrack - failed to removeTrack local stream "+p),new Error(p);case 4:return[2]}})})},T.prototype.addTrack=function(y){var p,_;return i(this,void 0,void 0,function(){var A,k,x,I,Y;return o(this,function($){switch($.label){case 0:return this._logger.info(R+".addTrack.start",{type:"api"}),n.default.log(R+".addTrack ",!y),y?[3,7]:(A={userId:this._tuiCallEngine.getUserID(),audio:!1,video:!0},(k=(p=this==null?void 0:this._localStream)===null||p===void 0?void 0:p.getCameraId())&&(A.cameraId=k),x=v.createStream(A),[4,this._setVideoProfile(x)]);case 1:return $.sent(),[4,x.initialize()];case 2:$.sent(),I=x.getVideoTrack(),$.label=3;case 3:return $.trys.push([3,6,,7]),I?[4,(_=this._localStream)===null||_===void 0?void 0:_.addTrack(I)]:[3,5];case 4:$.sent(),$.label=5;case 5:return[3,7];case 6:throw Y=$.sent(),this._logger.error(R+".addTrack.fail",{text:{error:Y},type:"api"}),n.default.error(R+".addTrack - failed to addTrack local stream "+Y),new Error(Y);case 7:return[2]}})})},T.prototype.reset=function(){return i(this,void 0,void 0,function(){return o(this,function(y){switch(y.label){case 0:return this._isJoined?[4,this.leave()]:[3,2];case 1:y.sent(),y.label=2;case 2:return[2]}})})},T.prototype.getMediaDevicesAuth=function(y){return i(this,void 0,void 0,function(){var p,_,A,k;return o(this,function(x){switch(x.label){case 0:if(h.isHttpProtocols())throw this._logger.error(R+".getMediaDevicesAuth.fail",{text:{error:d.ERROR_MESSAGE.ERROR_HTTP},type:"api"}),new f.default({message:""+d.ERROR_MESSAGE.ERROR_HTTP,code:t.default.ERROR_HTTP});if(p=this._tuiCallEngine.getDevicePermission(),!y.audio)return[3,4];if(B.IS_IOS&&p.audio)return[2,p];x.label=1;case 1:return x.trys.push([1,3,,4]),[4,navigator.mediaDevices.getUserMedia({audio:!0,video:!1})];case 2:return A=x.sent(),this.releaseStream(A),this._tuiCallEngine.setDevicePermission(e.DEVICE_TYPE.AUDIO,!0),[3,4];case 3:throw _=x.sent(),this._tuiCallEngine.setDevicePermission(e.DEVICE_TYPE.AUDIO,!1),_;case 4:if(!y.video)return[3,8];if(B.IS_IOS&&p.video)return[2,p];x.label=5;case 5:return x.trys.push([5,7,,8]),[4,navigator.mediaDevices.getUserMedia({audio:!1,video:!0})];case 6:return A=x.sent(),this.releaseStream(A),this._tuiCallEngine.setDevicePermission(e.DEVICE_TYPE.VIDEO,!0),[3,8];case 7:if(k=x.sent(),this._tuiCallEngine.setDevicePermission(e.DEVICE_TYPE.VIDEO,!1),n.default.error(R+".getMediaDevicesAuth - failed to get user video steam - "+k),y.isThrowVideoError)throw k;return[3,8];case 8:return[2,this._tuiCallEngine.getDevicePermission()]}})})},T.prototype.enableAIVoice=function(y){return i(this,void 0,void 0,function(){return o(this,function(p){switch(p.label){case 0:return this._isAiNoiseSuppress=y,this._aiNoiseSuppressionProcessor?(n.default.info(R+".enableAIVoice "+y),y?[4,this._aiNoiseSuppressionProcessor.enable()]:[3,2]):(this._logger.error(R+".enableAIVoice.fail",{text:{data:{enable:y}},type:"api"}),[2]);case 1:return p.sent(),[3,4];case 2:return[4,this._aiNoiseSuppressionProcessor.disable()];case 3:p.sent(),p.label=4;case 4:return[2]}})})},T.prototype.releaseStream=function(y){for(var p=y.getTracks(),_=0;_<p.length;_++)p[_].stop()},T.prototype._setVideoProfile=function(y,p){return i(this,void 0,void 0,function(){var _,A;return o(this,function(k){switch(k.label){case 0:return k.trys.push([0,3,,7]),this._logger.info(R+"._setVideoProfile.start",{type:"api"}),y?(p=p||this._tuiCallEngine.getVideoQuality(),y?[4,y.setVideoProfile(p)]:[3,2]):(this._logger.error(R+"._setVideoProfile.fail",{text:{error:"stream is empty"},type:"api"}),n.default.warn(R+"._setVideoProfile - stream is empty"),[2]);case 1:k.sent(),k.label=2;case 2:return[3,7];case 3:return _=k.sent(),this._logger.error(R+"._setVideoProfile.fail",{text:{error:_},type:"api"}),_.name!=="OverconstrainedError"?[3,5]:(console.error("当前摄像头不支持该 profile"),[4,(A=v.createStream({video:!0,audio:!1})).initialize()]);case 4:return k.sent(),this._localStream.replaceTrack(A.getVideoTrack()),[3,6];case 5:console.error("当前浏览器不支持动态调用该接口"),k.label=6;case 6:return[3,7];case 7:return[2]}})})},T.prototype._setVideoRenderParams=function(y){return i(this,void 0,void 0,function(){var p,_,A,k,x,I,Y,$,U,c,M,V,G,b,j;return o(this,function(H){switch(H.label){case 0:return H.trys.push([0,11,,12]),_=(p=y||{}).userID,A=p.objectFit,k=A===void 0?"":A,_&&!this._userIdDomMap.has(_)?(this._logger.error(R+".setVideoRenderParams.fail",{text:{error:_+" does not have a play node"},type:"api"}),n.default.warn(R+"._setVideoRenderParams - failed the userID: "+_+" does not have a play node"),[2]):(x={},k!==L.NAME.CONTAIN&&k!==L.NAME.COVER&&k!==L.NAME.FILL||(x.objectFit=y.objectFit),a.isBoolean(y.muted)&&(x.muted=y.muted),a.isBoolean(y.mirror)&&(x.mirror=y.mirror),I=this._tuiCallEngine.getUserID(),_!==I&&_?[3,3]:(this._tuiCallEngine.setLocalPlayOptions(x),Y=this._tuiCallEngine.getLocalPlayOptions(),G=this._userIdDomMap.get(I),this._localStream?[4,this._localStream.play(G,Y)]:[3,2]));case 1:H.sent(),H.label=2;case 2:H.label=3;case 3:if(_)return[3,7];this._tuiCallEngine.setRemotePlayOptions(x),V=this._tuiCallEngine.getRemotePlayOptions(),$=($=Array.from(this._userIdDomMap,function(W){return W[0]})).filter(function(W){return W!==I}),U=function(W){var q,K;return o(this,function(z){switch(z.label){case 0:return q=c._userIdDomMap.get($[W]),K=c._remoteStreams.find(function(Z){return Z.getUserId()===$[W]}),K?[4,K.play(q,V)]:[3,2];case 1:z.sent(),z.label=2;case 2:return[2]}})},c=this,M=0,H.label=4;case 4:return M<$.length?[5,U(M)]:[3,7];case 5:H.sent(),H.label=6;case 6:return M++,[3,4];case 7:return _&&_!==I?(this._tuiCallEngine.setRemotePlayOptions(x),V=this._tuiCallEngine.getRemotePlayOptions(),G=this._userIdDomMap.get(_),b=this._remoteStreams.find(function(W){return W.getUserId()===_}),b?[4,b.play(G,V)]:[3,9]):[3,10];case 8:H.sent(),H.label=9;case 9:H.label=10;case 10:return[3,12];case 11:return j=H.sent(),this._logger.error(R+".setVideoRenderParams.fail",{text:{error:j},type:"api"}),n.default.warn(R+"._setVideoRenderParams - failed call stream.play error: "+j),[3,12];case 12:return[2]}})})},T}();u.default=w},function(F,u){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch{typeof window=="object"&&(r=window)}F.exports=r},function(F,u,r){Object.defineProperty(u,"__esModule",{value:!0}),u.isHttpProtocols=void 0,u.isHttpProtocols=function(){if(!window||!window.location)return!1;var s=window.location,i=s.protocol,o=s.hostname;return i==="http:"&&o!=="localhost"&&o!=="127.0.0.1"}},function(F,u,r){var s=r(3),i=r(19),o=r(38),S=r(25);function P(n){var h=new o(n),e=i(o.prototype.request,h);return s.extend(e,o.prototype,h),s.extend(e,h),e}var l=P(r(16));l.Axios=o,l.create=function(n){return P(S(l.defaults,n))},l.Cancel=r(26),l.CancelToken=r(53),l.isCancel=r(24),l.all=function(n){return Promise.all(n)},l.spread=r(54),l.isAxiosError=r(55),F.exports=l,F.exports.default=l},function(F,u,r){var s=r(3),i=r(20),o=r(39),S=r(40),P=r(25),l=r(51),n=l.validators;function h(e){this.defaults=e,this.interceptors={request:new o,response:new o}}h.prototype.request=function(e){typeof e=="string"?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=P(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var a=e.transitional;a!==void 0&&l.assertOptions(a,{silentJSONParsing:n.transitional(n.boolean,"1.0.0"),forcedJSONParsing:n.transitional(n.boolean,"1.0.0"),clarifyTimeoutError:n.transitional(n.boolean,"1.0.0")},!1);var E=[],D=!0;this.interceptors.request.forEach(function(C){typeof C.runWhen=="function"&&C.runWhen(e)===!1||(D=D&&C.synchronous,E.unshift(C.fulfilled,C.rejected))});var O,f=[];if(this.interceptors.response.forEach(function(C){f.push(C.fulfilled,C.rejected)}),!D){var t=[S,void 0];for(Array.prototype.unshift.apply(t,E),t=t.concat(f),O=Promise.resolve(e);t.length;)O=O.then(t.shift(),t.shift());return O}for(var d=e;E.length;){var m=E.shift(),g=E.shift();try{d=m(d)}catch(C){g(C);break}}try{O=S(d)}catch(C){return Promise.reject(C)}for(;f.length;)O=O.then(f.shift(),f.shift());return O},h.prototype.getUri=function(e){return e=P(this.defaults,e),i(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},s.forEach(["delete","get","head","options"],function(e){h.prototype[e]=function(a,E){return this.request(P(E||{},{method:e,url:a,data:(E||{}).data}))}}),s.forEach(["post","put","patch"],function(e){h.prototype[e]=function(a,E,D){return this.request(P(D||{},{method:e,url:a,data:E}))}}),F.exports=h},function(F,u,r){var s=r(3);function i(){this.handlers=[]}i.prototype.use=function(o,S,P){return this.handlers.push({fulfilled:o,rejected:S,synchronous:!!P&&P.synchronous,runWhen:P?P.runWhen:null}),this.handlers.length-1},i.prototype.eject=function(o){this.handlers[o]&&(this.handlers[o]=null)},i.prototype.forEach=function(o){s.forEach(this.handlers,function(S){S!==null&&o(S)})},F.exports=i},function(F,u,r){var s=r(3),i=r(41),o=r(24),S=r(16);function P(l){l.cancelToken&&l.cancelToken.throwIfRequested()}F.exports=function(l){return P(l),l.headers=l.headers||{},l.data=i.call(l,l.data,l.headers,l.transformRequest),l.headers=s.merge(l.headers.common||{},l.headers[l.method]||{},l.headers),s.forEach(["delete","get","head","post","put","patch","common"],function(n){delete l.headers[n]}),(l.adapter||S.adapter)(l).then(function(n){return P(l),n.data=i.call(l,n.data,n.headers,l.transformResponse),n},function(n){return o(n)||(P(l),n&&n.response&&(n.response.data=i.call(l,n.response.data,n.response.headers,l.transformResponse))),Promise.reject(n)})}},function(F,u,r){var s=r(3),i=r(16);F.exports=function(o,S,P){var l=this||i;return s.forEach(P,function(n){o=n.call(l,o,S)}),o}},function(F,u){var r,s,i=F.exports={};function o(){throw new Error("setTimeout has not been defined")}function S(){throw new Error("clearTimeout has not been defined")}function P(f){if(r===setTimeout)return setTimeout(f,0);if((r===o||!r)&&setTimeout)return r=setTimeout,setTimeout(f,0);try{return r(f,0)}catch{try{return r.call(null,f,0)}catch{return r.call(this,f,0)}}}(function(){try{r=typeof setTimeout=="function"?setTimeout:o}catch{r=o}try{s=typeof clearTimeout=="function"?clearTimeout:S}catch{s=S}})();var l,n=[],h=!1,e=-1;function a(){h&&l&&(h=!1,l.length?n=l.concat(n):e=-1,n.length&&E())}function E(){if(!h){var f=P(a);h=!0;for(var t=n.length;t;){for(l=n,n=[];++e<t;)l&&l[e].run();e=-1,t=n.length}l=null,h=!1,function(d){if(s===clearTimeout)return clearTimeout(d);if((s===S||!s)&&clearTimeout)return s=clearTimeout,clearTimeout(d);try{s(d)}catch{try{return s.call(null,d)}catch{return s.call(this,d)}}}(f)}}function D(f,t){this.fun=f,this.array=t}function O(){}i.nextTick=function(f){var t=new Array(arguments.length-1);if(arguments.length>1)for(var d=1;d<arguments.length;d++)t[d-1]=arguments[d];n.push(new D(f,t)),n.length!==1||h||P(E)},D.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=O,i.addListener=O,i.once=O,i.off=O,i.removeListener=O,i.removeAllListeners=O,i.emit=O,i.prependListener=O,i.prependOnceListener=O,i.listeners=function(f){return[]},i.binding=function(f){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(f){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(F,u,r){var s=r(3);F.exports=function(i,o){s.forEach(i,function(S,P){P!==o&&P.toUpperCase()===o.toUpperCase()&&(i[o]=S,delete i[P])})}},function(F,u,r){var s=r(23);F.exports=function(i,o,S){var P=S.config.validateStatus;S.status&&P&&!P(S.status)?o(s("Request failed with status code "+S.status,S.config,null,S.request,S)):i(S)}},function(F,u,r){var s=r(3);F.exports=s.isStandardBrowserEnv()?{write:function(i,o,S,P,l,n){var h=[];h.push(i+"="+encodeURIComponent(o)),s.isNumber(S)&&h.push("expires="+new Date(S).toGMTString()),s.isString(P)&&h.push("path="+P),s.isString(l)&&h.push("domain="+l),n===!0&&h.push("secure"),document.cookie=h.join("; ")},read:function(i){var o=document.cookie.match(new RegExp("(^|;\\s*)("+i+")=([^;]*)"));return o?decodeURIComponent(o[3]):null},remove:function(i){this.write(i,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},function(F,u,r){var s=r(47),i=r(48);F.exports=function(o,S){return o&&!s(S)?i(o,S):S}},function(F,u,r){F.exports=function(s){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(s)}},function(F,u,r){F.exports=function(s,i){return i?s.replace(/\/+$/,"")+"/"+i.replace(/^\/+/,""):s}},function(F,u,r){var s=r(3),i=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];F.exports=function(o){var S,P,l,n={};return o&&s.forEach(o.split(`
|
|
`),function(h){if(l=h.indexOf(":"),S=s.trim(h.substr(0,l)).toLowerCase(),P=s.trim(h.substr(l+1)),S){if(n[S]&&i.indexOf(S)>=0)return;n[S]=S==="set-cookie"?(n[S]?n[S]:[]).concat([P]):n[S]?n[S]+", "+P:P}}),n}},function(F,u,r){var s=r(3);F.exports=s.isStandardBrowserEnv()?function(){var i,o=/(msie|trident)/i.test(navigator.userAgent),S=document.createElement("a");function P(l){var n=l;return o&&(S.setAttribute("href",n),n=S.href),S.setAttribute("href",n),{href:S.href,protocol:S.protocol?S.protocol.replace(/:$/,""):"",host:S.host,search:S.search?S.search.replace(/^\?/,""):"",hash:S.hash?S.hash.replace(/^#/,""):"",hostname:S.hostname,port:S.port,pathname:S.pathname.charAt(0)==="/"?S.pathname:"/"+S.pathname}}return i=P(window.location.href),function(l){var n=s.isString(l)?P(l):l;return n.protocol===i.protocol&&n.host===i.host}}():function(){return!0}},function(F,u,r){var s=r(52),i={};["object","boolean","number","function","string","symbol"].forEach(function(l,n){i[l]=function(h){return typeof h===l||"a"+(n<1?"n ":" ")+l}});var o={},S=s.version.split(".");function P(l,n){for(var h=n?n.split("."):S,e=l.split("."),a=0;a<3;a++){if(h[a]>e[a])return!0;if(h[a]<e[a])return!1}return!1}i.transitional=function(l,n,h){var e=n&&P(n);function a(E,D){return"[Axios v"+s.version+"] Transitional option '"+E+"'"+D+(h?". "+h:"")}return function(E,D,O){if(l===!1)throw new Error(a(D," has been removed in "+n));return e&&!o[D]&&(o[D]=!0,console.warn(a(D," has been deprecated since v"+n+" and will be removed in the near future"))),!l||l(E,D,O)}},F.exports={isOlderVersion:P,assertOptions:function(l,n,h){if(typeof l!="object")throw new TypeError("options must be an object");for(var e=Object.keys(l),a=e.length;a-- >0;){var E=e[a],D=n[E];if(D){var O=l[E],f=O===void 0||D(O,E,l);if(f!==!0)throw new TypeError("option "+E+" must be "+f)}else if(h!==!0)throw Error("Unknown option "+E)}},validators:i}},function(F){F.exports=JSON.parse('{"name":"axios","version":"0.21.4","description":"Promise based HTTP client for the browser and node.js","main":"index.js","scripts":{"test":"grunt test","start":"node ./sandbox/server.js","build":"NODE_ENV=production grunt build","preversion":"npm test","version":"npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json","postversion":"git push && git push --tags","examples":"node ./examples/server.js","coveralls":"cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js","fix":"eslint --fix lib/**/*.js"},"repository":{"type":"git","url":"https://github.com/axios/axios.git"},"keywords":["xhr","http","ajax","promise","node"],"author":"Matt Zabriskie","license":"MIT","bugs":{"url":"https://github.com/axios/axios/issues"},"homepage":"https://axios-http.com","devDependencies":{"coveralls":"^3.0.0","es6-promise":"^4.2.4","grunt":"^1.3.0","grunt-banner":"^0.6.0","grunt-cli":"^1.2.0","grunt-contrib-clean":"^1.1.0","grunt-contrib-watch":"^1.0.0","grunt-eslint":"^23.0.0","grunt-karma":"^4.0.0","grunt-mocha-test":"^0.13.3","grunt-ts":"^6.0.0-beta.19","grunt-webpack":"^4.0.2","istanbul-instrumenter-loader":"^1.0.0","jasmine-core":"^2.4.1","karma":"^6.3.2","karma-chrome-launcher":"^3.1.0","karma-firefox-launcher":"^2.1.0","karma-jasmine":"^1.1.1","karma-jasmine-ajax":"^0.1.13","karma-safari-launcher":"^1.0.0","karma-sauce-launcher":"^4.3.6","karma-sinon":"^1.0.5","karma-sourcemap-loader":"^0.3.8","karma-webpack":"^4.0.2","load-grunt-tasks":"^3.5.2","minimist":"^1.2.0","mocha":"^8.2.1","sinon":"^4.5.0","terser-webpack-plugin":"^4.2.3","typescript":"^4.0.5","url-search-params":"^0.10.0","webpack":"^4.44.2","webpack-dev-server":"^3.11.0"},"browser":{"./lib/adapters/http.js":"./lib/adapters/xhr.js"},"jsdelivr":"dist/axios.min.js","unpkg":"dist/axios.min.js","typings":"./index.d.ts","dependencies":{"follow-redirects":"^1.14.0"},"bundlesize":[{"path":"./dist/axios.min.js","threshold":"5kB"}]}')},function(F,u,r){var s=r(26);function i(o){if(typeof o!="function")throw new TypeError("executor must be a function.");var S;this.promise=new Promise(function(l){S=l});var P=this;o(function(l){P.reason||(P.reason=new s(l),S(P.reason))})}i.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},i.source=function(){var o;return{token:new i(function(S){o=S}),cancel:o}},F.exports=i},function(F,u,r){F.exports=function(s){return function(i){return s.apply(null,i)}}},function(F,u,r){F.exports=function(s){return typeof s=="object"&&s.isAxiosError===!0}},function(F,u){F.exports=_e},function(F,u){F.exports=me},function(F,u,r){var s=this&&this.__assign||function(){return(s=Object.assign||function(f){for(var t,d=1,m=arguments.length;d<m;d++)for(var g in t=arguments[d])Object.prototype.hasOwnProperty.call(t,g)&&(f[g]=t[g]);return f}).apply(this,arguments)},i=this&&this.__awaiter||function(f,t,d,m){return new(d||(d=Promise))(function(g,C){function N(R){try{B(m.next(R))}catch(v){C(v)}}function L(R){try{B(m.throw(R))}catch(v){C(v)}}function B(R){var v;R.done?g(R.value):(v=R.value,v instanceof d?v:new d(function(w){w(v)})).then(N,L)}B((m=m.apply(f,t||[])).next())})},o=this&&this.__generator||function(f,t){var d,m,g,C,N={label:0,sent:function(){if(1&g[0])throw g[1];return g[1]},trys:[],ops:[]};return C={next:L(0),throw:L(1),return:L(2)},typeof Symbol=="function"&&(C[Symbol.iterator]=function(){return this}),C;function L(B){return function(R){return function(v){if(d)throw new TypeError("Generator is already executing.");for(;N;)try{if(d=1,m&&(g=2&v[0]?m.return:v[0]?m.throw||((g=m.return)&&g.call(m),0):m.next)&&!(g=g.call(m,v[1])).done)return g;switch(m=0,g&&(v=[2&v[0],g.value]),v[0]){case 0:case 1:g=v;break;case 4:return N.label++,{value:v[1],done:!1};case 5:N.label++,m=v[1],v=[0];continue;case 7:v=N.ops.pop(),N.trys.pop();continue;default:if(g=N.trys,!((g=g.length>0&&g[g.length-1])||v[0]!==6&&v[0]!==2)){N=0;continue}if(v[0]===3&&(!g||v[1]>g[0]&&v[1]<g[3])){N.label=v[1];break}if(v[0]===6&&N.label<g[1]){N.label=g[1],g=v;break}if(g&&N.label<g[2]){N.label=g[2],N.ops.push(v);break}g[2]&&N.ops.pop(),N.trys.pop();continue}v=t.call(f,N)}catch(w){v=[6,w],m=0}finally{d=g=0}if(5&v[0])throw v[1];return{value:v[0]?v[1]:void 0,done:!0}}([B,R])}}},S=this&&this.__rest||function(f,t){var d={};for(var m in f)Object.prototype.hasOwnProperty.call(f,m)&&t.indexOf(m)<0&&(d[m]=f[m]);if(f!=null&&typeof Object.getOwnPropertySymbols=="function"){var g=0;for(m=Object.getOwnPropertySymbols(f);g<m.length;g++)t.indexOf(m[g])<0&&Object.prototype.propertyIsEnumerable.call(f,m[g])&&(d[m[g]]=f[m[g]])}return d},P=this&&this.__spreadArrays||function(){for(var f=0,t=0,d=arguments.length;t<d;t++)f+=arguments[t].length;var m=Array(f),g=0;for(t=0;t<d;t++)for(var C=arguments[t],N=0,L=C.length;N<L;N++,g++)m[g]=C[N];return m};Object.defineProperty(u,"__esModule",{value:!0});var l=r(59),n=r(5),h=r(2),e=r(6),a="TSignalClient",E=r(0),D=r(1),O=function(){function f(t,d){this._tuiCallEngine=t,this._tsignaling=new l(d),this._tsignalingReady=!1,this._joined=!1,this._newInvitationData=null,this._resolveMap=new Map,this._logger=n.default(),this.addTSignalEvents()}return f.prototype.setTSignalingIsJoined=function(t){this._joined=t},f.prototype.getTSignalingIsJoined=function(){return this._joined},f.prototype.setLogLevel=function(t){this._tsignaling.setLogLevel(t)},f.prototype.addTSignalEvents=function(){var t=this._tsignaling;t.on(l.EVENT.SDK_READY,this.onSdkReady,this),t.on(l.EVENT.SDK_NOT_READY,this.onSdkNotReady,this),t.on(l.EVENT.NEW_INVITATION_RECEIVED,this.onNewInvitationReceived,this),t.on(l.EVENT.INVITEE_ACCEPTED,this.onInviteeAccepted,this),t.on(l.EVENT.INVITEE_REJECTED,this.onInviteeRejected,this),t.on(l.EVENT.INVITATION_CANCELLED,this.onInvitationCancelled,this),t.on(l.EVENT.INVITATION_TIMEOUT,this.onInvitationTimeout,this),t.on(l.EVENT.KICKED_OUT,this.onKickedOut,this),t.on(l.EVENT.NET_STATE_CHANGE,this.onNetStateChange,this),l.EVENT.MESSAGE_SENT_BY_ME&&t.on(l.EVENT.MESSAGE_SENT_BY_ME,this.onMessageSentByMe,this)},f.prototype.onSdkReady=function(t){this._logger.info(a+".onSdkReady",{type:"event"}),this._tsignalingReady=!0,this._tuiCallEngine._delegate.onSdkReady(t);var d=this._resolveMap.get("login");d&&(d.resolve(d.value),this._resolveMap.delete("login"))},f.prototype.onSdkNotReady=function(){this._logger.info(a+".onSdkNotReady",{type:"event"}),this._tsignalingReady=!1},f.prototype.onNewInvitationReceived=function(t){var d,m,g;return i(this,void 0,void 0,function(){var C,N,L,B,R,v,w,T,y,p,_;return o(this,function(A){switch(A.label){case 0:return C=this._tuiCallEngine.getCallStatus(),this._logger.info(a+".onNewInvitationReceived",{type:"event",text:{data:{params:t,currentCallStatus:C}}}),h.default.log(a+".onNewInvitationReceived - params:",t,"currentCallStatus:"+C),N=t.data,L=N.inviter,B=N.inviteeList,R=N.data,v=N.inviteID,w=N.groupID,T=JSON.parse(R),D.isCallSignaling(T==null?void 0:T.businessID)?(T.room_id||(T.room_id=(d=T==null?void 0:T.data)===null||d===void 0?void 0:d.room_id),y=((m=T==null?void 0:T.data)===null||m===void 0?void 0:m.initialCallId)||"",this._tuiCallEngine.getUserID()===L?[2]:(_={inviter:L,inviteeList:B,inviteID:v,isGroupCall:p=!!w,inviteData:T,groupID:w,initialCallId:y,currentCallStatus:C,inCallUserIDs:(T==null?void 0:T.inCallUserIDs)||[]},((g=T==null?void 0:T.data)===null||g===void 0?void 0:g.cmd)!==e.CMD_TYPE.HANG_UP?[3,2]:(h.default.log(a+".hangup - params:",L,T,this._tuiCallEngine.getHandledInviteeList(),this._tuiCallEngine.getUnHandledInviteeList(),C,p),C===e.CALL_STATUS.IDLE?[2]:[4,this.handleHangupSignal(_)]))):[2];case 1:return A.sent(),[2];case 2:return!w&&this.judgeSwitchCallMode(T)?(C!==e.CALL_STATUS.IDLE&&this._tuiCallEngine.getRoomID()===T.room_id&&(this.handleSwitchCallMode(v,T),this._tuiCallEngine.addAudioVideoSwitchIdList(v)),[2]):C===e.CALL_STATUS.IDLE?[3,4]:[4,this.reject({inviteID:v,callType:T.call_type,isBusy:!0})];case 3:return A.sent(),this._tuiCallEngine.getCallRecordReport().eventUploadNotSave({inviteID:y||v,callRole:E.NAME.INVITEE,eventType:E.NAME.IGNORE_CALL,roomID:T.room_id,mediaType:T.call_type,callType:w?E.NAME.GROUP:E.NAME.SINGLE}),[2];case 4:return this.handleInvitedSignal(_),[2]}})})},f.prototype.handleHangupSignal=function(t){return i(this,void 0,void 0,function(){var d,m,g,C,N,L,B,R,v,w;return o(this,function(T){switch(T.label){case 0:if(this._logger.info(a+".handleHangupSignal",{text:{data:s(s({},t),{isInviter:this._tuiCallEngine.isInviter(),isGroupCall:this._tuiCallEngine.isGroupCall()})},type:"event"}),d=t.inviter,m=t.inviteData,g=t.currentCallStatus,C=t.inviteeList,N=this._tuiCallEngine.isGroupCall(),L=this._tuiCallEngine.isInviter(),g===e.CALL_STATUS.CALLING){if(R=this._tuiCallEngine.getHandledInviteeList(),(v=this._tuiCallEngine.getUnHandledInviteeList()).indexOf(d)!==-1&&this._tuiCallEngine.deleteUnHandledInviteeList([d]),R.indexOf(d)===-1)return[2]}else if(this._tuiCallEngine.deleteHandledInviteeList([d]),(R=this._tuiCallEngine.getHandledInviteeList()).indexOf(d)===-1&&R.length>1)return[2];return B=this._tuiCallEngine.generateCallEndData({totalTime:m.call_end||0}),N?[3,2]:[4,this._tuiCallEngine._resetTUICallEngine()];case 1:return T.sent(),this._tuiCallEngine._delegate.onCallEnd(B),[3,10];case 2:return this._tuiCallEngine.deleteHandledInviteeList([d]),R=this._tuiCallEngine.getHandledInviteeList(),v=this._tuiCallEngine.getUnHandledInviteeList(),L?R.length!==1||v.length!==0?[3,4]:[4,this._tuiCallEngine._resetTUICallEngine()]:[3,5];case 3:T.sent(),this._tuiCallEngine._delegate.onCallEnd(B),T.label=4;case 4:return[3,10];case 5:return g!==e.CALL_STATUS.CALLING?[3,8]:(C.indexOf(this._tuiCallEngine.getUserID())!==-1&&this._tuiCallEngine._delegate.onUserLeave(d),R.length!==0||v.length!==1?[3,7]:(w=this._tuiCallEngine.generateEventData(),[4,this._tuiCallEngine._resetTUICallEngine()]));case 6:T.sent(),this._tuiCallEngine._delegate.onCallingCancel(s(s({userID:d},w),{reason:E.NAME.NORMAL})),T.label=7;case 7:return[3,10];case 8:return R.length!==1||v.length!==0?[3,10]:[4,this._tuiCallEngine._resetTUICallEngine()];case 9:T.sent(),this._tuiCallEngine._delegate.onCallEnd(B),T.label=10;case 10:return[2]}})})},f.prototype.handleInvitedSignal=function(t){return i(this,void 0,void 0,function(){var d,m,g,C,N,L,B,R,v,w,T,y,p,_;return o(this,function(A){return d=t.inviter,m=t.inviteeList,g=t.isGroupCall,C=t.groupID,N=t.inviteID,L=t.inviteData,B=t.inCallUserIDs,R=B===void 0?[]:B,v=t.initialCallId,w=v===void 0?"":v,this._tuiCallEngine.changeCallStatus(e.CALL_STATUS.CALLING),this._tuiCallEngine.setInviterID(d),this._tuiCallEngine.setInviteeList(m),this._tuiCallEngine.setRoomID(L.room_id),this._tuiCallEngine.setCallType(L.call_type),this._tuiCallEngine.addUnHandledInviteeList(P(m,R)),this._tuiCallEngine.addHandledInviteeList([d]),this._tuiCallEngine.addAcceptedUserList(N,[d]),this._tuiCallEngine.setInitialCallId(w),g&&(this._tuiCallEngine.setIsGroupCall(g),this._tuiCallEngine.setGroupID(C)),this._tuiCallEngine.addInviterInviteId(N,P([d],m)),T=R.filter(function(k){return m.indexOf(k)===-1}),this._newInvitationData={sponsor:d,userIDList:P(m,T),isFromGroup:g,inviteID:N,groupID:C,inviteData:{version:L.version,callType:L.call_type,roomID:L.room_id},userData:L.userData,calleeIdList:m},y=this._tuiCallEngine.getCallDataReport().getCallData(),y=s(s({},y),{roomID:L.room_id,inviteID:N,callRole:e.CALL_ROLE.INVITEE,callType:L.call_type,inviteeList:m,callScene:C?E.NAME.GROUP_CALL:E.NAME.SINGLE_CALL}),p=this._tuiCallEngine.generateEventData()||{},this._tuiCallEngine.getCallDataReport().setCallData(y),_={eventType:E.NAME.RECEIVE_CALL,callType:C?E.NAME.GROUP:E.NAME.SINGLE,mediaType:L.call_type,callRole:E.NAME.INVITEE,userID:this._tuiCallEngine.getUserID(),roomID:L.room_id,inviteID:w||N},this._tuiCallEngine.getCallRecordReport().eventUpload(_),this._tuiCallEngine._delegate.onInvited(s(s({},p),this._newInvitationData)),[2]})})},f.prototype.getInviteData=function(){return this._newInvitationData},f.prototype.setInviteData=function(t){this._newInvitationData=t},f.prototype.handleSwitchCallMode=function(t,d){var m={inviteID:t,callType:d.call_type,switch_to_audio_call:null},g={cmd:e.CMD_TYPE.SWITCH_TO_VIDEO};d.call_type===e.CALL_TYPE.VIDEO_CALL?(m.switch_to_audio_call=e.CMD_TYPE.SWITCH_TO_AUDIO_CALL,g.cmd=e.CMD_TYPE.SWITCH_TO_AUDIO):delete m.switch_to_audio_call;var C=this._tuiCallEngine.getCallStatus();if(this.accept(m,g),C===e.CALL_STATUS.CALLING){var N=d.call_type===e.CALL_TYPE.VIDEO_CALL?e.CALL_TYPE.AUDIO_CALL:e.CALL_TYPE.VIDEO_CALL;this._tuiCallEngine._delegate.onCallTypeChanged(d.call_type,N),this._newInvitationData.inviteData.callType=N,this._tuiCallEngine.setSwitchCallModeStatus(!1)}else C===e.CALL_STATUS.CONNECTED&&(this._tuiCallEngine.setSwitchCallModeStatus(!1),this._tuiCallEngine._trtcClient.switchCallMode(this._tuiCallEngine.getCallType()))},f.prototype.judgeSwitchCallMode=function(t){var d=t.switch_to_audio_call&&t.switch_to_audio_call===e.CMD_TYPE.SWITCH_TO_AUDIO_CALL||t.data&&t.data.cmd===e.CMD_TYPE.SWITCH_TO_AUDIO||t.data&&t.data.cmd===e.CMD_TYPE.SWITCH_TO_VIDEO;return h.default.log(a+".switchCallMode:",t,"isSwitchCallMode-"+d),d},f.prototype.onInviteeAccepted=function(t){return i(this,void 0,void 0,function(){var d,m,g,C,N;return o(this,function(L){switch(L.label){case 0:return this._logger.info(a+".onInviteeAccepted",{text:{data:t},type:"event"}),h.default.log(a+".onInviteeAccepted - params:",t),d=JSON.parse(t.data.data),D.isCallSignaling(d==null?void 0:d.businessID)?(m=t.data.invitee,g=t.data.inviteID,this._tuiCallEngine.getTotalInviterInviteIdList().indexOf(g)===-1?[2]:this._tuiCallEngine.isGroupCall()||!this.judgeSwitchCallMode(d)||this._tuiCallEngine.getSwitchCallModeStatus()?(C=this._tuiCallEngine.getCallStatus(),m!==this._tuiCallEngine.getUserID()||C!==e.CALL_STATUS.CALLING?[3,2]:(N=this._tuiCallEngine.generateEventData(),[4,this._tuiCallEngine._resetTUICallEngine()])):(this._tuiCallEngine._trtcClient.switchCallMode(this._tuiCallEngine.getCallType()),[2])):[2];case 1:return L.sent(),this._tuiCallEngine._delegate.onCallingCancel(s({userID:m},N)),[2];case 2:return C===e.CALL_STATUS.CALLING&&this._tuiCallEngine.isInviter()&&(N=this._tuiCallEngine.generateEventData(),this._tuiCallEngine._delegate.onCallBegin(N)),this._tuiCallEngine.isInviter()&&this._tuiCallEngine.changeCallStatus(e.CALL_STATUS.CONNECTED),this._tuiCallEngine._delegate.onUserAccept(m),this._tuiCallEngine.addHandledInviteeList([m]),this._tuiCallEngine.deleteUnHandledInviteeList([m]),this._tuiCallEngine.addAcceptedUserList(g,[m]),[2]}})})},f.prototype.onInviteeRejected=function(t){var d;return i(this,void 0,void 0,function(){var m,g,C,N,L,B,R,v,w,T,y,p,_;return o(this,function(A){switch(A.label){case 0:return this._logger.info(a+".onInviteeRejected",{text:{data:s(s({},t),{currentUserID:this._tuiCallEngine.getUserID(),currentCallStatus:this._tuiCallEngine.getCallStatus()})},type:"event"}),h.default.log(a+".onInviteeRejected - params:",t),m=t.data.inviteID,g=JSON.parse(t.data.data),D.isCallSignaling(g==null?void 0:g.businessID)?this._tuiCallEngine.isGroupCall()||this._tuiCallEngine.getSwitchCallModeStatus()||this._tuiCallEngine.getAudioVideoSwitchIdList().indexOf(m)===-1?(C=t.data.invitee,N=t.data.inviter,L=this._tuiCallEngine.getUserID(),(B=this._tuiCallEngine.getCallStatus())===e.CALL_STATUS.IDLE?[2]:this._tuiCallEngine.getInviterInviteIdList().indexOf(m)===-1?(this._tuiCallEngine.isInviter()&&this._tuiCallEngine.getInviterInviteIdUserList().indexOf(C)!==-1||this._tuiCallEngine.deleteUnHandledInviteeList([C]),[2]):(R=this._tuiCallEngine.generateEventData(),v=s({userID:C},R),L!==C||B!==e.CALL_STATUS.CALLING?[3,2]:[4,this._tuiCallEngine._resetTUICallEngine()])):(h.default.log(a+".onInviteeRejected - Audio and video switching is not available"),this._tuiCallEngine.setSwitchCallModeStatus(!0),[2]):[2];case 1:return A.sent(),this._tuiCallEngine._delegate.onCallingCancel(v),[2];case 2:return w=this._tuiCallEngine.isGroupCall(),T=this._tuiCallEngine.isInviter(),this._tuiCallEngine.deleteUnHandledInviteeList([C]),y=this._tuiCallEngine.getUnHandledInviteeList(),p=this._tuiCallEngine.getHandledInviteeList(),B===e.CALL_STATUS.CONNECTED&&p.indexOf(C)!==-1?[2]:g.line_busy==="line_busy"||g.line_busy===""||!((d=g==null?void 0:g.data)===null||d===void 0)&&d.message&&g.data.message==="lineBusy"?w?[3,4]:[4,this._tuiCallEngine._resetTUICallEngine()]:[3,7];case 3:return A.sent(),this._tuiCallEngine._delegate.onCallingCancel(s(s({},v),{reason:E.NAME.BUSYLINE})),[3,6];case 4:return y.length!==0||p.length!==1?[3,6]:[4,this._tuiCallEngine._resetTUICallEngine()];case 5:A.sent(),this._tuiCallEngine._delegate.onCallingCancel(s(s({},v),{reason:E.NAME.BUSYLINE})),A.label=6;case 6:return N===this._tuiCallEngine.getInviterID()&&this._tuiCallEngine._delegate.onLineBusy(C),[3,18];case 7:return w?[3,9]:[4,this._tuiCallEngine._resetTUICallEngine()];case 8:return A.sent(),this._tuiCallEngine._delegate.onCallingCancel(s(s({},v),{reason:E.NAME.REJECT})),this._tuiCallEngine._delegate.onReject(C),[3,18];case 9:return B!==e.CALL_STATUS.CALLING?[3,15]:T?y.length!==0||p.length!==1?[3,11]:[4,this._tuiCallEngine._resetTUICallEngine()]:[3,12];case 10:A.sent(),this._tuiCallEngine._delegate.onCallingCancel(s(s({},v),{reason:E.NAME.REJECT})),A.label=11;case 11:return[3,14];case 12:return y.length!==1||p.length!==0?[3,14]:[4,this._tuiCallEngine._resetTUICallEngine()];case 13:A.sent(),this._tuiCallEngine._delegate.onCallingCancel(s(s({},v),{reason:E.NAME.REJECT})),A.label=14;case 14:return[3,17];case 15:return y.length!==0||p.length!==1?[3,17]:(_=this._tuiCallEngine.generateCallEndData({userId:C}),[4,this._tuiCallEngine._resetTUICallEngine()]);case 16:A.sent(),this._tuiCallEngine._delegate.onCallEnd(_),A.label=17;case 17:this._tuiCallEngine._delegate.onReject(C),A.label=18;case 18:return[2]}})})},f.prototype.onInvitationCancelled=function(t){return i(this,void 0,void 0,function(){var d,m;return o(this,function(g){switch(g.label){case 0:return this._logger.info(a+".onInvitationCancelled",{text:{data:s(s({},t),{currentUserID:this._tuiCallEngine.getUserID(),currentCallStatus:this._tuiCallEngine.getCallStatus(),inviteeList:this._tuiCallEngine.getInviterInviteIdList()})},type:"event"}),h.default.log(a+".onInvitationCancelled - params:",t,this._tuiCallEngine.getCallStatus()),d=JSON.parse(t.data.data),D.isCallSignaling(d==null?void 0:d.businessID)?this._tuiCallEngine.getCallStatus()===e.CALL_STATUS.IDLE||this._tuiCallEngine.getInviterInviteIdList().indexOf(t.data.inviteID)===-1?[2]:(m=this._tuiCallEngine.generateEventData(),[4,this._tuiCallEngine._resetTUICallEngine()]):[2];case 1:return g.sent(),this._tuiCallEngine._delegate.onCallingCancel(s(s({userID:this._tuiCallEngine.getUserID()},m),{reason:E.NAME.NORMAL})),[2]}})})},f.prototype.onInvitationTimeout=function(t){var d;return i(this,void 0,void 0,function(){var m,g,C,N,L,B,R,v,w,T,y,p,_,A,k;return o(this,function(x){switch(x.label){case 0:return this._logger.info(a+".onInvitationTimeout",{text:{data:s(s({},t),{currentUserID:this._tuiCallEngine.getUserID(),isGroupCall:this._tuiCallEngine.isGroupCall(),currentCallStatus:this._tuiCallEngine.getCallStatus(),inviteeList:this._tuiCallEngine.getInviterInviteIdList()})},type:"event"}),m=t.data,g=m.inviter,C=m.inviteeList,N=C===void 0?[]:C,L=m.inviteID,B=this._tuiCallEngine.getUserID(),R=this._tuiCallEngine.isGroupCall(),v=this._tuiCallEngine.isInviter(),w=this._tuiCallEngine.getCallStatus(),this._tuiCallEngine.deleteUnHandledInviteeList(N),h.default.log(a+".onInvitationTimeout - params:",t,"currentUserID:"+B+" isInviter:"+v+" isGroupCall:"+R+" currentCallStatus:"+w+" inviteID:"+((d=this==null?void 0:this._newInvitationData)===null||d===void 0?void 0:d.inviteID)),this._tuiCallEngine.getInviterInviteIdList().indexOf(L)===-1?[2]:w===e.CALL_STATUS.IDLE?[2]:(T=this._tuiCallEngine.getHandledInviteeList(),y=this._tuiCallEngine.getUnHandledInviteeList(),p=s(s({},this._tuiCallEngine.generateEventData()),{reason:E.NAME.TIMEOUT}),R?[3,2]:[4,this._tuiCallEngine._resetTUICallEngine()]);case 1:return x.sent(),v?(this._tuiCallEngine._delegate.onCallingCancel(s({userID:N[0]},p)),this._tuiCallEngine._delegate.onNoResp(g,N)):(this._tuiCallEngine._delegate.onCallingCancel(s({userID:N[0]||""},p)),_=this._tuiCallEngine.getCallRecordReport().getCallRecordData().head,this._tuiCallEngine.getCallRecordReport().eventUpload(s(s({},_),{eventType:E.NAME.NOT_ANSWER_CALL,inviteID:this._tuiCallEngine.getInitialCallId()}))),[3,12];case 2:return w!==e.CALL_STATUS.CALLING?[3,10]:v?y.length!==0?[3,4]:[4,this._tuiCallEngine._resetTUICallEngine()]:[3,5];case 3:x.sent(),this._tuiCallEngine._delegate.onCallingCancel(s({userID:N.join(",")},p)),x.label=4;case 4:return this._tuiCallEngine._delegate.onNoResp(g,N),[3,9];case 5:return N.indexOf(B)!==-1?[3,6]:(this._tuiCallEngine._delegate.onNoResp(g,N),[3,8]);case 6:return[4,this._tuiCallEngine._resetTUICallEngine()];case 7:x.sent(),this._tuiCallEngine._delegate.onCallingCancel(s({userID:B},p)),x.label=8;case 8:A=this._tuiCallEngine.getCallRecordReport().getCallRecordData().head,this._tuiCallEngine.getCallRecordReport().eventUpload(s(s({},A),{eventType:E.NAME.NOT_ANSWER_CALL,inviteID:this._tuiCallEngine.getInitialCallId()})),x.label=9;case 9:return[3,12];case 10:return this._tuiCallEngine._delegate.onNoResp(g,N),T.length!==1||y.length!==0?[3,12]:(k=this._tuiCallEngine.generateCallEndData(),[4,this._tuiCallEngine._resetTUICallEngine()]);case 11:x.sent(),this._tuiCallEngine._delegate.onCallEnd(k),x.label=12;case 12:return[2]}})})},f.prototype.onKickedOut=function(){return i(this,void 0,void 0,function(){return o(this,function(t){switch(t.label){case 0:return this._logger.info(a+".onKickedOut",{text:{error:"onKickedOut"},type:"event"}),h.default.log(a+".onKickedOut"),this._tuiCallEngine.setIsLogin(!1),this._tuiCallEngine._trtcClient.removeTRTCEvents(),[4,this._tuiCallEngine._resetTUICallEngine()];case 1:return t.sent(),this._tuiCallEngine._delegate.onKickedOut(),[2]}})})},f.prototype.onNetStateChange=function(){h.default.debug(a+".onNetStateChange")},f.prototype.onMessageSentByMe=function(t){this._tuiCallEngine._delegate.onMessageSentByMe(t)},f.prototype.login=function(t){return i(this,void 0,void 0,function(){var d=this;return o(this,function(m){return this._logger.info(a+".login.start",{text:{data:t},type:"api"}),[2,new Promise(function(g,C){d._tsignaling.login(t).then(function(N){var L;if(!((L=N.data)===null||L===void 0)&&L.repeatLogin)return d._logger.info(a+".login.success",{text:{error:"The TIM login status has been inherited into Call"},type:"api"}),h.default.warn(a+".login - success: The TIM login status has been inherited into Call. IM 登录状态已成功被 Call 继承。"),void g();d._resolveMap.set("login",{resolve:g,value:N})}).catch(function(N){C(N)})})]})})},f.prototype.logout=function(){return i(this,void 0,void 0,function(){return o(this,function(t){return this._logger.info(a+".logout.start",{type:"api"}),this._joined=!1,[2,this._tsignaling.logout()]})})},f.prototype.invite=function(t){return i(this,void 0,void 0,function(){var d,m,g,C,N,L,B,R,v;return o(this,function(w){switch(w.label){case 0:return this._logger.info(a+".invite.start",{text:{data:t},type:"api"}),d=t.userID,m=t.type,g=t.roomID,C=t.timeout,N=t.offlinePushInfo,L=t.userIDList,B=t.userData,R=B===void 0?"":B,[4,this._tsignaling.invite({userID:d,data:JSON.stringify(this.handleNewSignaling({version:0,call_type:m,room_id:g},{userIDs:L},R)),timeout:C,offlinePushInfo:N})];case 1:return v=w.sent(),[2,s(s({},v),{roomID:g,userID:d})]}})})},f.prototype.inviteInGroup=function(t){return i(this,void 0,void 0,function(){var d,m,g,C,N,L,B,R,v,w,T,y;return o(this,function(p){switch(p.label){case 0:return this._logger.info(a+".inviteInGroup.start",{text:{data:t},type:"api"}),d=t.groupID,m=t.userIDList,g=t.roomID,C=t.type,N=t.timeout,L=t.offlinePushInfo,B=t.inCallUserIDs,R=t.userData,v=R===void 0?"":R,w=t.initialCallId,T=w===void 0?"":w,[4,this._tsignaling.inviteInGroup({groupID:d,inviteeList:m,data:JSON.stringify(this.handleNewSignaling({version:0,call_type:C,room_id:g,inCallUserIDs:B},{initialCallId:T},v)),timeout:N,offlinePushInfo:L})];case 1:return y=p.sent(),[2,s(s({},y),{roomID:g,groupID:d})]}})})},f.prototype.hangup=function(t){return i(this,void 0,void 0,function(){var d,m,g,C,N,L,B,R;return o(this,function(v){switch(v.label){case 0:return this._logger.info(a+".hangup.start",{text:{data:t},type:"api"}),h.default.log(a+".hangup - params:",t),d=t.userIDList,m=t.callType,g=t.callEnd,N={version:0,call_type:m,call_end:C=g===void 0?0:g},L={cmd:e.CMD_TYPE.HANG_UP},B=JSON.stringify(this.handleNewSignaling(N,L)),this._tuiCallEngine.isGroupCall()&&this._tuiCallEngine.getGroupID()?[4,this._tsignaling.inviteInGroup({inviteeList:d,groupID:this._tuiCallEngine.getGroupID(),data:B,timeout:0})]:[3,2];case 1:return v.sent(),[3,4];case 2:return[4,this._tsignaling.invite({userID:d[0],data:B,timeout:0})];case 3:v.sent(),v.label=4;case 4:return this._joined=!1,R=this._tuiCallEngine.generateCallEndData({callMediaType:m,totalTime:C}),this._tuiCallEngine._delegate.onCallEnd(R),[2]}})})},f.prototype.accept=function(t,d){return i(this,void 0,void 0,function(){var m,g,C;return o(this,function(N){switch(N.label){case 0:return this._logger.info(a+".accept.start",{text:{data:t},type:"api"}),m=t.inviteID,g=t.callType,C=S(t,["inviteID","callType"]),[4,this._tsignaling.accept({inviteID:m,data:JSON.stringify(this.handleNewSignaling(s({version:0,call_type:g},C),d))})];case 1:return[2,N.sent()]}})})},f.prototype.reject=function(t){return i(this,void 0,void 0,function(){var d,m,g,C;return o(this,function(N){return this._logger.info(a+".reject.start",{text:{data:{params:t}},type:"api"}),d=t.inviteID,m=t.callType,g=t.isBusy,C={version:0,call_type:m},g&&(C.line_busy="line_busy"),[2,this._tsignaling.reject({inviteID:d,data:JSON.stringify(this.handleNewSignaling(C,{message:g?"lineBusy":""}))})]})})},f.prototype.cancel=function(t){return i(this,void 0,void 0,function(){var d,m;return o(this,function(g){return this._logger.info(a+".cancel.start",{text:{data:t},type:"api"}),d=t.inviteID,m=JSON.stringify(this.handleNewSignaling({version:4,businessID:E.NAME.AV_CALL,call_type:this._tuiCallEngine.getCallType()})),[2,this._tsignaling.cancel({inviteID:d,data:m})]})})},f.prototype.resetJoined=function(){this._joined=!1},f.prototype.switchCallMode=function(t){return i(this,void 0,void 0,function(){var d,m,g,C,N,L,B,R;return o(this,function(v){switch(v.label){case 0:return this._logger.info(a+".switchCallMode.start",{text:{data:t},type:"api"}),d=t.userID,m=t.callType,g=t.roomID,C=t.timeout,N=t.mode,L={version:0,call_type:m,room_id:g,switch_to_audio_call:null},B={cmd:e.CMD_TYPE.SWITCH_TO_VIDEO},N===e.MODE_TYPE.AUDIO?(L.switch_to_audio_call=e.CMD_TYPE.SWITCH_TO_AUDIO_CALL,B.cmd=e.CMD_TYPE.SWITCH_TO_AUDIO):delete L.switch_to_audio_call,[4,this._tsignaling.invite({userID:d,data:JSON.stringify(this.handleNewSignaling(L,B)),timeout:C})];case 1:return(R=v.sent()).inviteID&&this._tuiCallEngine.addAudioVideoSwitchIdList(R.inviteID),[2]}})})},f.prototype.handleNewSignaling=function(t,d,m){return s(s({userData:m||""},t),{version:4,businessID:E.NAME.AV_CALL,platform:"Web",data:s({cmd:e.CMD_TYPE_LIST[t.call_type],room_id:t.room_id,inviter:this._tuiCallEngine.getInviterID(),message:""},d)})},f}();u.default=O},function(F,u){F.exports=Te},function(F,u,r){var s=this&&this.__assign||function(){return(s=Object.assign||function(e){for(var a,E=1,D=arguments.length;E<D;E++)for(var O in a=arguments[E])Object.prototype.hasOwnProperty.call(a,O)&&(e[O]=a[O]);return e}).apply(this,arguments)};Object.defineProperty(u,"__esModule",{value:!0});var i=r(5),o=r(12),S=r(2),P=r(11),l=r(13),n="TUICallObserver",h=function(){function e(a){this._eventEmitter=a,this._callEngineLogger=i.default(),this._eventStatController=new l.default,P.default.bindController(this._eventStatController)}return e.prototype.onError=function(a,E){S.default.debug(n+".onError code:"+a+" msg:"+E),this._eventEmitter.emit(o.TUICallEvent.ERROR,{code:a,msg:E}),this._callEngineLogger.error("onError",{type:"event",text:{error:{code:a,msg:E}}})},e.prototype.onSdkReady=function(a){S.default.debug(n+".onSdkReady params:"+a),this._eventEmitter.emit(o.TUICallEvent.SDK_READY,a),this._callEngineLogger.info("TUICallEvent.SDK_READY",{type:"event",text:{data:{params:a}}})},e.prototype.onInvited=function(a){S.default.debug(n+".onInvited params:",a);var E=a.sponsor,D=a.userIDList,O=a.isFromGroup,f=a.inviteData,t=a.inviteID,d=a.userData,m=d===void 0?"":d,g=a.calleeIdList,C=a.callID,N=a.roomID,L=a.callMediaType,B=a.callRole,R={callID:C,calleeIdList:g,groupID:a.groupID,callMediaType:L,roomID:N,callRole:B,userData:m},v=s({sponsor:E,userIDList:D,isFromGroup:O,inviteData:f,inviteID:t},R);this._eventEmitter.emit(o.TUICallEvent.INVITED,v),this._eventEmitter.emit(o.TUICallEvent.ON_CALL_RECEIVED,R),this._callEngineLogger.info("TUICallEvent.INVITED",{type:"event",text:{data:{params:a}}})},e.prototype.onUserAccept=function(a){S.default.debug(n+".onUserAccept userID:"+a),this._eventEmitter.emit(o.TUICallEvent.USER_ACCEPT,{userID:a}),this._callEngineLogger.info("TUICallEvent.USER_ACCEPT",{type:"event",text:{data:{userID:a}}})},e.prototype.onCallBegin=function(a){S.default.debug(n+".onCallBegin params:"+JSON.stringify(a)),this._eventEmitter.emit(o.TUICallEvent.ON_CALL_BEGIN,a),this._callEngineLogger.info("TUICallEvent.ON_CALL_BEGIN",{type:"event",text:{data:{params:a}}})},e.prototype.onUserEnter=function(a){S.default.debug(n+".onUserEnter userID:"+a),this._eventEmitter.emit(o.TUICallEvent.USER_ENTER,{userID:a}),this._callEngineLogger.info("TUICallEvent.USER_ENTER",{type:"event",text:{data:{userID:a}}})},e.prototype.onUserLeave=function(a){S.default.debug(n+".onUserLeave userID:"+a),this._eventEmitter.emit(o.TUICallEvent.USER_LEAVE,{userID:a}),this._callEngineLogger.info("TUICallEvent.USER_LEAVE",{type:"event",text:{data:{userID:a}}})},e.prototype.onReject=function(a){S.default.debug(n+".onReject userID:"+a),this._eventEmitter.emit(o.TUICallEvent.REJECT,{userID:a}),this._callEngineLogger.info("TUICallEvent.REJECT",{type:"event",text:{data:{userID:a}}})},e.prototype.onNoResp=function(a,E){S.default.debug(n+".onNoResp userIDList:",a,E),this._eventEmitter.emit(o.TUICallEvent.NO_RESP,{sponsor:a,userIDList:E}),this._callEngineLogger.info("TUICallEvent.NO_RESP",{type:"event",text:{data:{sponsor:a,userIDList:E}}})},e.prototype.onLineBusy=function(a){S.default.debug(n+".onLineBusy userID:"+a),this._eventEmitter.emit(o.TUICallEvent.LINE_BUSY,{userID:a}),this._callEngineLogger.info("TUICallEvent.LINE_BUSY",{type:"event",text:{data:{userID:a}}})},e.prototype.onCallingCancel=function(a,E){S.default.debug(n+".onCallingCancel ",a),this._eventEmitter.emit(o.TUICallEvent.CALLING_CANCEL,a),this._eventEmitter.emit(o.TUICallEvent.ON_CALL_CANCELED,a),this._callEngineLogger.info("TUICallEvent.ON_CALL_CANCELED",{type:"event",text:{data:{params:a}}})},e.prototype.onKickedOut=function(){S.default.debug(n+".onKickedOut"),this._eventEmitter.emit(o.TUICallEvent.KICKED_OUT,{}),this._callEngineLogger.info("TUICallEvent.KICKED_OUT",{type:"event"})},e.prototype.onCallingTimeout=function(a,E){S.default.debug(n+".onCallingTimeout userIDList:",E),this._eventEmitter.emit(o.TUICallEvent.CALLING_TIMEOUT,{sponsor:a,userIDList:E}),this._callEngineLogger.info("TUICallEvent.CALLING_TIMEOUT",{type:"event",text:{data:{sponsor:a,userIDList:E}}})},e.prototype.onCallEnd=function(a){S.default.debug(n+".onCallEnd params:"+a),this._eventEmitter.emit(o.TUICallEvent.CALLING_END,s(s({},a),{callEnd:a.totalTime})),this._callEngineLogger.info("TUICallEvent.CALLING_END",{type:"event",text:{data:{params:a}}})},e.prototype.onUserVideoAvailable=function(a){S.default.debug(n+".onUserVideoAvailable params:",a);var E=a.userID,D=a.isVideoAvailable;this._eventEmitter.emit(o.TUICallEvent.USER_VIDEO_AVAILABLE,{userID:E,isVideoAvailable:D}),this._callEngineLogger.info("TUICallEvent.USER_VIDEO_AVAILABLE",{type:"event",text:{data:{params:a}}})},e.prototype.onUserAudioAvailable=function(a){S.default.debug(n+".onUserAudioAvailable params:",a);var E=a.userID,D=a.isAudioAvailable;this._eventEmitter.emit(o.TUICallEvent.USER_AUDIO_AVAILABLE,{userID:E,isAudioAvailable:D}),this._callEngineLogger.info("TUICallEvent.USER_AUDIO_AVAILABLE",{type:"event",text:{data:{params:a}}})},e.prototype.onUserVoiceVolume=function(a){this._eventEmitter.emit(o.TUICallEvent.USER_VOICE_VOLUME,{volumeMap:a})},e.prototype.onGroupCallInviteeListUpdate=function(a){this._eventEmitter.emit(o.TUICallEvent.GROUP_CALL_INVITEE_LIST_UPDATE,{userIDList:a}),this._callEngineLogger.info("TUICallEvent.GROUP_CALL_INVITEE_LIST_UPDATE",{type:"event",text:{data:{userIDList:a}}})},e.prototype.onCallTypeChanged=function(a,E){this._eventEmitter.emit(o.TUICallEvent.CALL_TYPE_CHANGED,{oldCallType:a,newCallType:E}),this._callEngineLogger.info("TUICallEvent.CALL_TYPE_CHANGED",{type:"event",text:{data:{oldCallType:a,newCallType:E}}})},e.prototype.onDeviceUpdated=function(a,E,D,O){this._eventEmitter.emit(o.TUICallEvent.DEVICED_UPDATED,{microphoneList:a,cameraList:E,currentMicrophone:D,currentCamera:O}),this._callEngineLogger.info("TUICallEvent.DEVICED_UPDATED",{type:"event",text:{data:{microphoneList:a,cameraList:E,currentMicrophone:D,currentCamera:O}}})},e.prototype.onMessageSentByMe=function(a){this._eventEmitter.emit(o.TUICallEvent.MESSAGE_SENT_BY_ME,a)},e}();u.default=h},function(F,u,r){r.r(u);var s=r(2);const i="none",o="online",S=function(){let P=window.location.protocol;return["http:","https:"].indexOf(P)<0&&(P="http:"),P};u.default=class{constructor(){this._networkType="",this.maxWaitTime=3e3}start(){this._networkType=o}_onNetworkStatusChange(P){this._networkType=P.networkType,P.isConnected?s.default.info("NetMonitor networkType:"+P.networkType):s.default.warn("NetMonitor no network, please check!")}probe(){return new Promise(P=>{if(window&&window.fetch)fetch(`${S()}//webim-1252463788.file.myqcloud.com/assets/test/speed.xml?random=${Math.random()}`).then(l=>{l.ok?P([!0,o]):P([!1,i])}).catch(()=>{P([!1,i])});else{const l=new XMLHttpRequest,n=setTimeout(()=>{s.default.warn("NetMonitor fetch timeout. Probably no network, please check!"),l.abort(),this._networkType=i,P([!1,i])},this.maxWaitTime);l.onreadystatechange=function(){l.readyState===4&&(clearTimeout(n),l.status===200||l.status===304?(this._networkType=o,P([!0,o])):(s.default.warn(`NetMonitor fetch status:${l.status}. Probably no network, please check!`),this._networkType=i,P([!1,i])))},l.open("GET",`${S()}//webim-1252463788.file.myqcloud.com/assets/test/speed.xml?random=${Math.random()}`),l.send()}})}getNetworkType(){return this._networkType}reset(){this._networkType=""}}},function(F,u,r){Object.defineProperty(u,"__esModule",{value:!0}),u.apiCallQueue=u.avoidRepeatedCall=u.statusValidate=u.businessValidate=u.paramValidate=u.VALIDATE_PARAMS=void 0;var s=r(63);Object.defineProperty(u,"VALIDATE_PARAMS",{enumerable:!0,get:function(){return s.VALIDATE_PARAMS}});var i=r(64);Object.defineProperty(u,"paramValidate",{enumerable:!0,get:function(){return i.paramValidate}});var o=r(27);Object.defineProperty(u,"businessValidate",{enumerable:!0,get:function(){return o.businessValidate}});var S=r(65);Object.defineProperty(u,"statusValidate",{enumerable:!0,get:function(){return S.statusValidate}});var P=r(66);Object.defineProperty(u,"avoidRepeatedCall",{enumerable:!0,get:function(){return P.avoidRepeatedCall}});var l=r(67);Object.defineProperty(u,"apiCallQueue",{enumerable:!0,get:function(){return l.apiCallQueue}})},function(F,u,r){Object.defineProperty(u,"__esModule",{value:!0}),u.VALIDATE_PARAMS=void 0;var s=r(14),i=r(0);u.VALIDATE_PARAMS={createInstance:{SDKAppID:{required:!0,rules:[i.NAME.NUMBER],allowEmpty:!1},tim:{required:!1,rules:[i.NAME.OBJECT],allowEmpty:!0}},login:{userID:{required:!0,rules:[i.NAME.STRING],allowEmpty:!1},userSig:{required:!0,rules:[i.NAME.STRING],allowEmpty:!1}},call:{userID:{required:!0,rules:[i.NAME.STRING],allowEmpty:!1},type:{required:!0,rules:[i.NAME.NUMBER],range:[1,2],allowEmpty:!1},roomID:{required:!1,rules:[i.NAME.NUMBER],range:"1~"+i.MAX_NUMBER_ROOM_ID,allowEmpty:!1},timeout:{required:!1,rules:[i.NAME.NUMBER],allowEmpty:!1}},groupCall:{userIDList:{required:!0,rules:[i.NAME.ARRAY],allowEmpty:!1},type:{required:!0,rules:[i.NAME.NUMBER],range:[1,2],allowEmpty:!1},groupID:{required:!0,rules:[i.NAME.STRING],allowEmpty:!1},roomID:{required:!1,rules:[i.NAME.NUMBER],range:"1~"+i.MAX_NUMBER_ROOM_ID,allowEmpty:!1},timeout:{required:!1,rules:[i.NAME.NUMBER],allowEmpty:!1}},joinInGroupCall:{type:{required:!0,rules:[i.NAME.NUMBER],range:[1,2],allowEmpty:!1},groupID:{required:!0,rules:[i.NAME.STRING],allowEmpty:!1},roomID:{required:!0,rules:[i.NAME.NUMBER],allowEmpty:!1}},inviteUser:{userIDList:{required:!0,rules:[i.NAME.ARRAY],allowEmpty:!1}},startRemoteView:{userID:{required:!0,rules:[i.NAME.STRING],allowEmpty:!1},videoViewDomID:{required:!0,rules:[i.NAME.STRING],allowEmpty:!1}},stopRemoteView:{userID:{required:!0,rules:[i.NAME.STRING],allowEmpty:!1}},startLocalView:{userID:{required:!0,rules:[i.NAME.STRING],allowEmpty:!1},videoViewDomID:{required:!0,rules:[i.NAME.STRING],allowEmpty:!1}},stopLocalView:{userID:{required:!0,rules:[i.NAME.STRING],allowEmpty:!1}},switchDevice:{deviceType:{required:!0,rules:[i.NAME.STRING],allowEmpty:!1},deviceId:{required:!0,rules:[i.NAME.STRING],allowEmpty:!1}},setVideoQuality:[{key:"profile",required:!0,rules:[i.NAME.STRING,i.NAME.OBJECT],range:Object.keys(s.TUICommonDefine.VideoEncoderParams),allowEmpty:!1}],switchCallMediaType:[{key:"newMediaType",required:!0,rules:[i.NAME.NUMBER],range:[1,2],allowEmpty:!1}],getDeviceList:[{key:"deviceType",required:!0,rules:[i.NAME.STRING],range:["camera","microphones"],allowEmpty:!1}],setSelfInfo:{nickName:{required:!1,rules:[i.NAME.STRING],allowEmpty:!1},avatar:{required:!1,rules:[i.NAME.STRING],allowEmpty:!1}},setVideoRenderParams:{objectFit:{require:!1,rules:[i.NAME.STRING],range:[i.NAME.CONTAIN,i.NAME.COVER,i.NAME.FILL],allowEmpty:!1},muted:{require:!1,rules:[i.NAME.BOOLEAN],allowEmpty:!1},mirror:{require:!1,rules:[i.NAME.BOOLEAN],allowEmpty:!1}}}},function(F,u,r){var s=this&&this.__assign||function(){return(s=Object.assign||function(h){for(var e,a=1,E=arguments.length;a<E;a++)for(var D in e=arguments[a])Object.prototype.hasOwnProperty.call(e,D)&&(h[D]=e[D]);return h}).apply(this,arguments)};Object.defineProperty(u,"__esModule",{value:!0}),u.paramValidate=void 0;var i=r(5),o=r(1),S=r(10),P=r(4);function l(h,e,a){var E=i.default();try{if(o.isArray(h))for(var D=0;D<h.length;D++)n.call(this,s(s({},h[D]),{value:e[D],name:a}));else for(var O in h)n.call(this,s(s({},h[O]),{value:e[0][O],name:a,key:O}))}catch(f){throw E.error("paramValidate.fail",{text:{error:f}}),f}}function n(h){var e=h.required,a=h.rules,E=h.range,D=h.value,O=h.allowEmpty,f=h.name,t=h.key;if(o.isUndefined(D)){if(e)throw new S.default({message:"API<"+f+">: "+t+" is required.",code:P.default.ERROR_PARAM_INVALID})}else{var d="";if(!a.some(function(N){return N===o.getType(D)})){for(var m=0;m<a.length;m++){var g=a[m];d+=(g=g.replace(g[0],g[0].toUpperCase()))+"/"}throw d=d.substring(0,d.length-1),new S.default({message:"API<"+f+">: "+t+" must be "+d+", current "+t+" is "+typeof D+".",code:P.default.ERROR_PARAM_INVALID})}if(O===!1&&o.isString(D)&&D.trim()==="")throw new S.default({message:"API<"+f+">: "+t+" is blank.",code:P.default.ERROR_PARAM_INVALID});if(o.isArray(E)&&E&&E.indexOf(D)===-1)throw new S.default({message:"API<"+f+">: "+t+" error, only be "+E+", current "+t+" is "+D+".",code:P.default.ERROR_PARAM_INVALID});if(o.isString(E)&&E.indexOf("~")!==-1){var C=E.split("~");if(D<+C[0]||D>+C[1]||o.isNumber(D)&&Number.isNaN(D))throw new S.default({message:"API<"+f+">: "+t+" error, only be "+E+", current "+t+" is "+D+".",code:P.default.ERROR_PARAM_INVALID})}}}u.paramValidate=function(h){return function(e,a,E){var D=E.value;return E.value=function(){for(var O=[],f=0;f<arguments.length;f++)O[f]=arguments[f];return l.call(this,h,O,a),D.apply(this,O)},E}}},function(F,u,r){Object.defineProperty(u,"__esModule",{value:!0}),u.statusValidate=void 0;var s=r(5),i=r(10),o=r(4),S=r(9);function P(l,n,h){var e,a=s.default();if(l!=null&&l.init&&!this._isLogin)throw a.error("statusValidate.fail",{text:{error:"API<"+h+">: "+S.ERROR_MESSAGE.ERROR_INIT_FAIL}}),new i.default({message:"API<"+h+">: "+S.ERROR_MESSAGE.ERROR_INIT_FAIL,code:o.default.ERROR_INIT_FAIL});if(((e=l==null?void 0:l.callStatus)===null||e===void 0?void 0:e.indexOf(this._callStatus))===-1)throw a.error("statusValidate.fail",{text:{error:"API<"+h+">: "+S.ERROR_MESSAGE.ERROR_REQUEST_REFUSED+". support status: ["+l.callStatus.join(",")+"], current status: "+this._callStatus}}),new i.default({message:"API<"+h+">: "+S.ERROR_MESSAGE.ERROR_REQUEST_REFUSED+". support status: ["+l.callStatus.join(",")+"], current status: "+this._callStatus,code:o.default.ERROR_REQUEST_REFUSED});if(l!=null&&l.scene&&this._isGroupCall)throw a.error("statusValidate.fail",{text:{error:"API<"+h+">: "+S.ERROR_MESSAGE.ERROR_SCENE_NOT_SUPPORTED}}),new i.default({message:"API<"+h+">: "+S.ERROR_MESSAGE.ERROR_SCENE_NOT_SUPPORTED,code:o.default.ERROR_SCENE_NOT_SUPPORTED})}u.statusValidate=function(l){return function(n,h,e){var a=e.value;return e.value=function(){for(var E=[],D=0;D<arguments.length;D++)E[D]=arguments[D];return P.call(this,l,E,h),a.apply(this,E)},e}}},function(F,u,r){var s=this&&this.__awaiter||function(l,n,h,e){return new(h||(h=Promise))(function(a,E){function D(t){try{f(e.next(t))}catch(d){E(d)}}function O(t){try{f(e.throw(t))}catch(d){E(d)}}function f(t){var d;t.done?a(t.value):(d=t.value,d instanceof h?d:new h(function(m){m(d)})).then(D,O)}f((e=e.apply(l,n||[])).next())})},i=this&&this.__generator||function(l,n){var h,e,a,E,D={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return E={next:O(0),throw:O(1),return:O(2)},typeof Symbol=="function"&&(E[Symbol.iterator]=function(){return this}),E;function O(f){return function(t){return function(d){if(h)throw new TypeError("Generator is already executing.");for(;D;)try{if(h=1,e&&(a=2&d[0]?e.return:d[0]?e.throw||((a=e.return)&&a.call(e),0):e.next)&&!(a=a.call(e,d[1])).done)return a;switch(e=0,a&&(d=[2&d[0],a.value]),d[0]){case 0:case 1:a=d;break;case 4:return D.label++,{value:d[1],done:!1};case 5:D.label++,e=d[1],d=[0];continue;case 7:d=D.ops.pop(),D.trys.pop();continue;default:if(a=D.trys,!((a=a.length>0&&a[a.length-1])||d[0]!==6&&d[0]!==2)){D=0;continue}if(d[0]===3&&(!a||d[1]>a[0]&&d[1]<a[3])){D.label=d[1];break}if(d[0]===6&&D.label<a[1]){D.label=a[1],a=d;break}if(a&&D.label<a[2]){D.label=a[2],D.ops.push(d);break}a[2]&&D.ops.pop(),D.trys.pop();continue}d=n.call(l,D)}catch(m){d=[6,m],e=0}finally{h=a=0}if(5&d[0])throw d[1];return{value:d[0]?d[1]:void 0,done:!0}}([f,t])}}};Object.defineProperty(u,"__esModule",{value:!0}),u.avoidRepeatedCall=void 0;var o=r(5),S=r(10),P=r(4);u.avoidRepeatedCall=function(){var l=o.default();return function(n,h,e){var a=e.value,E=new Set;return e.value=function(){for(var D=[],O=0;O<arguments.length;O++)D[O]=arguments[O];return s(this,void 0,void 0,function(){var f,t;return i(this,function(d){switch(d.label){case 0:if(E.has(this))throw l.error("avoidRepeatedCall.fail",{text:{error:"previous "+h+"() is ongoing, please avoid repeated calls"}}),new S.default({message:"previous "+h+"() is ongoing, please avoid repeated calls",code:P.default.ERROR_REQUEST_REPEATED});d.label=1;case 1:return d.trys.push([1,3,,4]),E.add(this),[4,a.apply(this,D)];case 2:return f=d.sent(),E.delete(this),[2,f];case 3:throw t=d.sent(),l.error("avoidRepeatedCall.fail",{text:{error:t}}),E.delete(this),t;case 4:return[2]}})})},e}}},function(F,u,r){var s=this&&this.__assign||function(){return(s=Object.assign||function(o){for(var S,P=1,l=arguments.length;P<l;P++)for(var n in S=arguments[P])Object.prototype.hasOwnProperty.call(S,n)&&(o[n]=S[n]);return o}).apply(this,arguments)};Object.defineProperty(u,"__esModule",{value:!0}),u.apiCallQueue=void 0;var i=new WeakMap;u.apiCallQueue=function(){return function(o,S,P){var l=P.value,n=function(h){var e=h.fn,a=h.args,E=h.context,D=h.resolve,O=h.reject;e.apply(E,a).then(D,O).finally(function(){var f=i.get(E);f.shift(),f[0]&&n(s({},f[0]))})};return P.value=function(){for(var h=this,e=[],a=0;a<arguments.length;a++)e[a]=arguments[a];return new Promise(function(E,D){if(i.has(h)){var O=i.get(h),f=O.length;O.push({fn:l,args:e,context:h,resolve:E,reject:D}),f===0&&n({fn:l,args:e,context:h,resolve:E,reject:D})}else i.set(h,[{fn:l,args:e,context:h,resolve:E,reject:D}]),n({fn:l,args:e,context:h,resolve:E,reject:D})})},P}}},function(F,u,r){Object.defineProperty(u,"__esModule",{value:!0}),u.TUICallEngineObserver=u.CallDataReport=void 0;var s=r(6),i=r(12),o=r(11),S=r(15),P=r(13),l=r(0),n=r(69),h=r(1),e=r(28),a=function(){function D(O){this._eventStatController=new P.default,o.default.bindController(this._eventStatController),this.initializeCallData(O),this._ssoLog=new o.default(S.default.QUALITY_REPORT)}return D.prototype.setCallData=function(O){this._callData=O},D.prototype.getCallData=function(){return this._callData},D.prototype.setInviteID=function(O){this._callData.inviteID=O},D.prototype.setTotalTime=function(O){this._callData.totalTime=O},D.prototype.setAbilityBit=function(O){this._callData.abilityBit=!!O},D.prototype.setEnterRoomTime=function(O){this._callData.enterRoomTime=n.convertTimeStampToString(O)},D.prototype.setSendSignalingTime=function(O){this._callData.sendSignalingTime=n.convertTimeStampToString(O)},D.prototype.setCallAcceptTime=function(O){this._callData.callAcceptTime=n.convertTimeStampToString(O)},D.prototype.setExitRoomTime=function(O){this._callData.exitRoomTime=n.convertTimeStampToString(O)},D.prototype.setCallEndTime=function(O){this._callData.callEndTime=O},D.prototype.setCodeAndMessage=function(O,f){this._callData.code=O||0,this._callData.message=f||""},D.prototype.setCallScene=function(O){this._callData.callScene=O||""},D.prototype.getResult=function(){return this._callData.result},D.prototype.setResult=function(O){this._callData.result=O||""},D.prototype.setUserID=function(O){this._callData.userID=O||""},D.prototype.packageCallDataToKibana=function(){var O=e.callTypeMapping(this._callData.callType),f=e.callRoleMapping(this._callData.callRole);return"CallData{version='"+this._callData.version+", platform="+this._callData.platform+", framework="+this._callData.framework+", sdk_app_id="+this._callData.sdkAppId+", user_id="+this._callData.userID+", room_id="+this._callData.roomID+", invite_id="+this._callData.inviteID+", invitee_list="+this._callData.inviteeList+", media_type="+O+", role="+f+", call_scene="+this._callData.callScene+", result="+this._callData.result+", total_time="+this._callData.totalTime+", total_score="+this._callData.totalScore+", ability_bit="+this._callData.abilityBit+", enter_room="+this._callData.enterRoomTime+", send_signaling="+this._callData.sendSignalingTime+", call_accept="+this._callData.callAcceptTime+", exit_room="+this._callData.exitRoomTime+", call_end="+this._callData.callEndTime+", code="+this._callData.code+", message="+this._callData.message+", network="+this._callData.network+", audio="+this._callData.audio+", video="+this._callData.video+"}"},D.prototype.initializeCallData=function(O){var f=O||{},t=f.version,d=t===void 0?"":t,m=f.sdkAppId,g=m===void 0?0:m,C=f.userID,N=C===void 0?"":C,L=h.getHostType();this._callData={version:d,platform:L,framework:l.NAME.WEB,sdkAppId:g,userID:N,roomID:0,inviteID:"",callRole:s.CALL_ROLE.UNKNOWN,callScene:"",callType:s.CALL_TYPE.UNKNOWN,inviteeList:[],result:l.NAME.UNKNOWN,totalTime:0,totalScore:0,code:0,message:"",abilityBit:!1,enterRoomTime:"",sendSignalingTime:"",callAcceptTime:"",exitRoomTime:"",callEndTime:"",network:0,audio:0,video:0}},D.prototype.reset=function(){this.initializeCallData(),this._ssoLog=null},D.prototype.clearCallDataAfterUpload=function(){var O=this.getCallData(),f=O.version,t=O.sdkAppId,d=O.userID;this.initializeCallData({version:f,sdkAppId:t,userID:d})},D.prototype.uploadToKibana=function(){try{this._ssoLog.setText(this.packageCallDataToKibana()).setEnd(),this.clearCallDataAfterUpload()}catch{}},D}();u.CallDataReport=a;var E=function(){function D(O,f){this._eventEmitter=O,this._callDataReport=f,this.registerListener()}return D.prototype.registerListener=function(){this._eventEmitter.on(i.TUICallEvent.CALLING_END,this.onCallEnd.bind(this)),this._eventEmitter.on(i.TUICallEvent.CALLING_CANCEL,this.onCallingCancel.bind(this)),this._eventEmitter.on(i.TUICallEvent.NO_RESP,this.onNoResponse.bind(this)),this._eventEmitter.on(i.TUICallEvent.LINE_BUSY,this.onLineBusy.bind(this)),this._eventEmitter.on(i.TUICallEvent.REJECT,this.onReject.bind(this))},D.prototype.removeLister=function(){this._eventEmitter.off(i.TUICallEvent.CALLING_END,this.onCallEnd.bind(this)),this._eventEmitter.off(i.TUICallEvent.CALLING_CANCEL,this.onCallingCancel.bind(this)),this._eventEmitter.off(i.TUICallEvent.NO_RESP,this.onNoResponse.bind(this)),this._eventEmitter.off(i.TUICallEvent.LINE_BUSY,this.onLineBusy.bind(this)),this._eventEmitter.off(i.TUICallEvent.REJECT,this.onReject.bind(this))},D.prototype.onCallEnd=function(O){var f=O.totalTime,t=f===void 0?0:f;this._callDataReport.setTotalTime(t),this._callDataReport.setResult(l.NAME.NORMAL),this._callDataReport.setCodeAndMessage(),this._callDataReport.uploadToKibana()},D.prototype.onCallingCancel=function(){this._callDataReport.getResult()||this._callDataReport.setResult(l.NAME.CANCEL),this._callDataReport.setCodeAndMessage(),this._callDataReport.uploadToKibana()},D.prototype.onNoResponse=function(){this._callDataReport.setResult(l.NAME.TIMEOUT)},D.prototype.onLineBusy=function(){this._callDataReport.setResult(l.NAME.BUSYLINE)},D.prototype.onReject=function(){this._callDataReport.setResult(l.NAME.REJECT)},D}();u.TUICallEngineObserver=E},function(F,u,r){r.r(u),r.d(u,"setBaseTime",function(){return l}),r.d(u,"getCurrentTime",function(){return n}),r.d(u,"getTimestamp",function(){return h}),r.d(u,"convertTimeStampToString",function(){return e});var s=r(2),i=r(30),o=r.n(i);let S=new Date().getTime(),P=0;const l=function(a){S=a,P=S-new Date().getTime();const E=new Date;E.setTime(a),s.default.info("baseTime from server: "+E+" offset: "+P)},n=function(){return new Date().getTime()+P},h=function(){const a=new Date;return a.setTime(n()),a.toLocaleString()},e=a=>a<=0?"":o()(a).format("YYYY-MM-DD HH:mm:ss")},function(F,u,r){var s=this&&this.__assign||function(){return(s=Object.assign||function(f){for(var t,d=1,m=arguments.length;d<m;d++)for(var g in t=arguments[d])Object.prototype.hasOwnProperty.call(t,g)&&(f[g]=t[g]);return f}).apply(this,arguments)},i=this&&this.__awaiter||function(f,t,d,m){return new(d||(d=Promise))(function(g,C){function N(R){try{B(m.next(R))}catch(v){C(v)}}function L(R){try{B(m.throw(R))}catch(v){C(v)}}function B(R){var v;R.done?g(R.value):(v=R.value,v instanceof d?v:new d(function(w){w(v)})).then(N,L)}B((m=m.apply(f,t||[])).next())})},o=this&&this.__generator||function(f,t){var d,m,g,C,N={label:0,sent:function(){if(1&g[0])throw g[1];return g[1]},trys:[],ops:[]};return C={next:L(0),throw:L(1),return:L(2)},typeof Symbol=="function"&&(C[Symbol.iterator]=function(){return this}),C;function L(B){return function(R){return function(v){if(d)throw new TypeError("Generator is already executing.");for(;N;)try{if(d=1,m&&(g=2&v[0]?m.return:v[0]?m.throw||((g=m.return)&&g.call(m),0):m.next)&&!(g=g.call(m,v[1])).done)return g;switch(m=0,g&&(v=[2&v[0],g.value]),v[0]){case 0:case 1:g=v;break;case 4:return N.label++,{value:v[1],done:!1};case 5:N.label++,m=v[1],v=[0];continue;case 7:v=N.ops.pop(),N.trys.pop();continue;default:if(g=N.trys,!((g=g.length>0&&g[g.length-1])||v[0]!==6&&v[0]!==2)){N=0;continue}if(v[0]===3&&(!g||v[1]>g[0]&&v[1]<g[3])){N.label=v[1];break}if(v[0]===6&&N.label<g[1]){N.label=g[1],g=v;break}if(g&&N.label<g[2]){N.label=g[2],N.ops.push(v);break}g[2]&&N.ops.pop(),N.trys.pop();continue}v=t.call(f,N)}catch(w){v=[6,w],m=0}finally{d=g=0}if(5&v[0])throw v[1];return{value:v[0]?v[1]:void 0,done:!0}}([B,R])}}};Object.defineProperty(u,"__esModule",{value:!0}),u.TUICallEngineRecordObserver=u.CallRecordReport=void 0;var S=r(6),P=r(12),l=r(0),n=r(2),h=r(71),e=r(7),a=r(28),E={serviceCommand:l.NAME.CALLKIT_RECORDS_SVR+".*"},D=function(){function f(t){this._tim=t.tim,this._heartbeat=-1,this._lastHeartBeatTime=-1,this._bodyStatus=l.NAME.WAITING,this.initializeCallData(t)}return f.prototype.getCallRecordData=function(){return this._callRecordData},f.prototype.initializeCallData=function(t){var d=t||{},m=d.version,g=m===void 0?"":m,C=d.userID,N=C===void 0?"":C,L=e.getOsInfo().name,B={version:1,command:l.NAME.EVENT_REPORT,sdk_version:g,seq:0,os_name:l.NAME.WEB,os_version:"0.0",device_name:L,framework:l.NAME.WEB,call_type:"",media_type:"",client_ts:0,role:S.CALL_ROLE.UNKNOWN,user_id:N,room_id:"",call_id:""};this._callRecordData={head:B,body:{event_type:"",code:0,message:"",invitee_list:[]}}},f.prototype.reset=function(){this.initializeCallData()},f.prototype._setCallType=function(t){t&&(this._callRecordData.head=s(s({},this._callRecordData.head),{call_type:t}))},f.prototype._setMediaType=function(t){t&&(this._callRecordData.head=s(s({},this._callRecordData.head),{media_type:a.callTypeMapping(t)}))},f.prototype._setCallRole=function(t){t&&(this._callRecordData.head=s(s({},this._callRecordData.head),{role:t}))},f.prototype._setUserID=function(t){t&&(this._callRecordData.head=s(s({},this._callRecordData.head),{user_id:t}))},f.prototype._setRoomID=function(t){t&&(this._callRecordData.head=s(s({},this._callRecordData.head),{room_id:""+t}))},f.prototype._setInviteID=function(t){t===void 0&&(t=""),t&&(this._callRecordData.head=s(s({},this._callRecordData.head),{call_id:t}))},f.prototype._setEventType=function(t){t&&(this._callRecordData.body=s(s({},this._callRecordData.body),{event_type:t}))},f.prototype._setInviteeList=function(t){t===void 0&&(t=[]),this._callRecordData.body=s(s({},this._callRecordData.body),{invitee_list:t})},f.prototype._setSeq=function(){var t=this.getCallRecordData().head.seq;this._callRecordData.head=s(s({},this._callRecordData.head),{seq:t+1})},f.prototype.setBodyStatus=function(t){if(t){var d=l.NAME.WAITING;switch(t){case S.CALL_STATUS.CALLING:d=l.NAME.WAITING;break;case S.CALL_STATUS.CONNECTED:d=l.NAME.CALLING}this._bodyStatus=d}},f.prototype.eventUpload=function(t){var d;return i(this,void 0,void 0,function(){var m,g,C,N,L,B,R,v,w,T,y,p,_,A;return o(this,function(k){switch(k.label){case 0:return m=t.eventType,g=t.callType,C=t.mediaType,N=t.callRole,L=t.userID,B=t.roomID,R=t.inviteID,v=t.inviteeList,w=v===void 0?[]:v,m?(this._callRecordData.head=s(s({},this._callRecordData.head),{command:l.NAME.EVENT_REPORT,client_ts:Math.floor(Date.now()/1e3)}),this._setCallType(g),this._setMediaType(C),this._setCallRole(N),this._setUserID(L),this._setRoomID(B),this._setInviteID(R),this._setEventType(m),this._setInviteeList(w),this._setSeq(),T=this.getCallRecordData(),y=T.head,p=T.body,_={head:s(s({},y),{role:a.callRoleMapping(y.role)}),body:p},A=s(s({},E),{data:JSON.stringify(_)}),[4,(d=this==null?void 0:this._tim)===null||d===void 0?void 0:d.callExperimentalAPI("sendTRTCCustomData",A)]):[2];case 1:return k.sent(),[2]}})})},f.prototype.eventUploadNotSave=function(t){var d;return i(this,void 0,void 0,function(){var m,g,C,N,L,B,R,v,w,T,y;return o(this,function(p){switch(p.label){case 0:return m=t.eventType,g=t.callType,C=t.mediaType,N=t.callRole,L=t.roomID,B=t.inviteID,this._setSeq(),R=this.getCallRecordData(),v=R.head,w=R.body,T={head:s(s({},v),{role:a.callRoleMapping(N),call_id:B,call_type:g,media_type:a.callTypeMapping(C),room_id:""+L,client_ts:Math.floor(Date.now()/1e3)}),body:s(s({},w),{event_type:m})},y=s(s({},E),{data:JSON.stringify(T)}),[4,(d=this==null?void 0:this._tim)===null||d===void 0?void 0:d.callExperimentalAPI("sendTRTCCustomData",y)];case 1:return p.sent(),[2]}})})},f.prototype.heartBeatUpload=function(){var t;return i(this,void 0,void 0,function(){var d,m,g,C;return o(this,function(N){switch(N.label){case 0:return N.trys.push([0,2,,3]),this._setSeq(),d=this._callRecordData.head,m={head:s(s({},d),{role:a.callRoleMapping(d.role),clientTs:Date.now(),command:l.NAME.HEART_BEAT}),body:{status:this._bodyStatus}},g=s(s({},E),{data:m}),[4,(t=this==null?void 0:this._tim)===null||t===void 0?void 0:t.callExperimentalAPI("sendTRTCCustomData",g)];case 1:return N.sent(),[3,3];case 2:return C=N.sent(),console.warn("heartBeatUpload failed. error: "+JSON.stringify(C)),[3,3];case 3:return[2]}})})},f.prototype.startHeartbeat=function(){this._heartbeat===-1&&(n.default.info("start heart beat..."),this.heartBeatUpload(),this._heartbeat=h.default.run(l.NAME.TIMEOUT,this.doHeartbeat.bind(this),{delay:2e3,count:0,backgroundTask:!0}))},f.prototype.stopHeartbeat=function(){this._heartbeat!==-1&&(n.default.info("stop heart beat"),h.default.clearTask(this._heartbeat),this._heartbeat=-1,this._lastHeartBeatTime=-1,this._bodyStatus=l.NAME.WAITING)},f.prototype.doHeartbeat=function(){return i(this,void 0,void 0,function(){var t;return o(this,function(d){return this.heartBeatUpload(),t=Date.now(),this._lastHeartBeatTime>0&&t-this._lastHeartBeatTime>1e4&&n.default.warn("heartbeat took "+(t-this._lastHeartBeatTime)),this._lastHeartBeatTime=t,[2]})})},f}();u.CallRecordReport=D;var O=function(){function f(t,d){this._eventEmitter=t,this._callRecordDataReport=d,this._isCallAccepted=!1,this.registerListener()}return f.prototype.registerListener=function(){this._eventEmitter.on(P.TUICallEvent.ON_CALL_RECEIVED,this.onCallReceived.bind(this)),this._eventEmitter.on(P.TUICallEvent.USER_ACCEPT,this.onCallAccepted.bind(this)),this._eventEmitter.on(P.TUICallEvent.CALLING_END,this.onCallEnd.bind(this)),this._eventEmitter.on(P.TUICallEvent.CALLING_CANCEL,this.onCallingCancel.bind(this)),this._eventEmitter.on(P.TUICallEvent.NO_RESP,this.onNoResponse.bind(this)),this._eventEmitter.on(P.TUICallEvent.LINE_BUSY,this.onLineBusy.bind(this)),this._eventEmitter.on(P.TUICallEvent.REJECT,this.onReject.bind(this))},f.prototype.removeLister=function(){this._eventEmitter.off(P.TUICallEvent.ON_CALL_RECEIVED,this.onCallReceived),this._eventEmitter.off(P.TUICallEvent.USER_ACCEPT,this.onCallAccepted),this._eventEmitter.off(P.TUICallEvent.CALLING_END,this.onCallEnd),this._eventEmitter.off(P.TUICallEvent.CALLING_CANCEL,this.onCallingCancel),this._eventEmitter.off(P.TUICallEvent.NO_RESP,this.onNoResponse),this._eventEmitter.off(P.TUICallEvent.LINE_BUSY,this.onLineBusy),this._eventEmitter.off(P.TUICallEvent.REJECT,this.onReject)},f.prototype.onCallReceived=function(){this._callRecordDataReport.startHeartbeat()},f.prototype.onCallAccepted=function(){var t=this._callRecordDataReport.getCallRecordData().head;if((t==null?void 0:t.role)===l.NAME.INVITER){if(this._isCallAccepted&&t.call_type===l.NAME.GROUP)return;this._isCallAccepted=!0;var d={eventType:l.NAME.CALL_ACCEPTED};this._callRecordDataReport.eventUpload(d),this._callRecordDataReport.setBodyStatus(S.CALL_STATUS.CONNECTED)}},f.prototype.onCallEnd=function(){var t={eventType:l.NAME.CALL_END};this._isCallAccepted=!1,this._callRecordDataReport.eventUpload(t),this._callRecordDataReport.stopHeartbeat()},f.prototype.onCallingCancel=function(t){var d=this._callRecordDataReport.getCallRecordData().head,m=d.role===l.NAME.INVITER?l.NAME.CANCEL_CALL:l.NAME.CALL_CANCELED;this._isCallAccepted=!1;var g=(t||{}).reason;((g===void 0?"":g)===l.NAME.NORMAL||d.role===l.NAME.INVITER&&d.call_type===l.NAME.GROUP)&&this._callRecordDataReport.eventUpload({eventType:m}),this._callRecordDataReport.stopHeartbeat()},f.prototype.onNoResponse=function(){this._uploadInC2C(l.NAME.TIMEOUT)},f.prototype.onLineBusy=function(){this._uploadInC2C(l.NAME.BUSYLINE)},f.prototype.onReject=function(){this._uploadInC2C(l.NAME.REJECT)},f.prototype._uploadInC2C=function(t){var d=this._callRecordDataReport.getCallRecordData().head;if((d==null?void 0:d.call_type)===l.NAME.SINGLE){var m="";switch(t){case l.NAME.TIMEOUT:m=d.role===l.NAME.INVITER?l.NAME.CALL_MISSED:l.NAME.NOT_ANSWER_CALL;break;case l.NAME.REJECT:m=d.role===l.NAME.INVITER&&l.NAME.CALL_REJECTED;break;case l.NAME.BUSYLINE:m=d.role===l.NAME.INVITER?l.NAME.CALL_BUSY:l.NAME.NOT_ANSWER_CALL;break;default:return}this._callRecordDataReport.eventUpload({eventType:m})}},f}();u.TUICallEngineRecordObserver=O},function(F,u,r){var s=this&&this.__assign||function(){return(s=Object.assign||function(l){for(var n,h=1,e=arguments.length;h<e;h++)for(var a in n=arguments[h])Object.prototype.hasOwnProperty.call(n,a)&&(l[a]=n[a]);return l}).apply(this,arguments)};Object.defineProperty(u,"__esModule",{value:!0});var i=r(1),o=r(0),S=window==null?void 0:window.cancelAnimationFrame,P=function(){function l(){}return l.generateTaskID=function(){return this.currentTaskID++},l.run=function(n,h,e){n===void 0&&(n=o.NAME.TIMEOUT),e=n===o.NAME.INTERVAL?s({delay:2e3,count:0,backgroundTask:!0},e):n===o.NAME.RAF?s({fps:60,delay:16.6,count:0,backgroundTask:!0},e):s({delay:2e3,count:0,backgroundTask:!0},e),i.isObject(h)&&(e=s(s({},e),h)),i.isFunction(n)&&(h=n,n=o.NAME.TIMEOUT);var a=s({taskID:this.generateTaskID(),loopCount:0,intervalID:null,timeoutID:null,rafID:null,taskName:n,callback:h},e);return this.taskMap.set(a.taskID,a),this[n](a),a.taskID},l.interval=function(n){var h=this;return n.intervalID=setInterval(function(){n.callback(),n.loopCount+=1,h.isBreakLoop(n)},n.delay)},l.timeout=function(n){var h=this,e=function(){if(n.callback(),n.loopCount+=1,!h.isBreakLoop(n))return n.timeoutID=setTimeout(e,n.delay)};return n.timeoutID=setTimeout(e,n.delay)},l.raf=function(n){var h=this;n.delay=(1e3/n.fps).toFixed(2);var e,a=i.performanceNow(),E=function(){if(document.hidden&&n.backgroundTask)return e=i.performanceNow()-a,a=i.performanceNow(),n.callback(),n.loopCount+=1,h.isBreakLoop(n)?void 0:n.timeoutID=setTimeout(E,n.delay-Math.floor(e%n.delay));if((e=i.performanceNow()-a)>=n.delay&&(a=i.performanceNow()-Math.floor(e%n.delay),n.callback(),n.loopCount+=1),!h.isBreakLoop(n))return n.rafID=requestAnimationFrame(E)};if(n.rafID=requestAnimationFrame(E),n.backgroundTask){var D=function(){if(document.hidden){var O=i.performanceNow()-a;O>=n.delay?E():n.timeoutID=setTimeout(E,n.delay-O)}};document.addEventListener("visibilitychange",D),n.onVisibilitychange=D,document.hidden&&D()}return n.taskID},l.hasTask=function(n){return this.taskMap.has(n)},l.clearTask=function(n){if(!this.taskMap.has(n))return!0;var h=this.taskMap.get(n),e=h.intervalID,a=h.timeoutID,E=h.rafID,D=h.onVisibilitychange;return e&&clearInterval(e),a&&clearTimeout(a),E&&S(E),D&&document.removeEventListener("visibilitychange",D),this.taskMap.delete(n),!0},l.isBreakLoop=function(n){return!this.taskMap.has(n.taskID)||n.count!==0&&n.loopCount>=n.count&&(this.clearTask(n.taskID),!0)},l.taskMap=new Map,l.currentTaskID=1,l}();u.default=P},function(F,u,r){Object.defineProperty(u,"__esModule",{value:!0}),u.ES_TABLE=u.ES_URL=u.CLS_TOPIC_ID=u.CLS_ENDPOINT=void 0,u.CLS_ENDPOINT="https://ap-nanjing.cls.tencentcs.com",u.CLS_TOPIC_ID="a1310e66-a3f5-4572-a1c3-7a327a27496d",u.ES_URL="https://webim.tim.qq.com/v4/imopenstat/tweb_trtccalling_report",u.ES_TABLE="timweb-trtccalling"}]).default})}(ge)),ge.exports}var Ue=Le();export{Ue as t};
|